LCOV - code coverage report
Current view: top level - dom/base - nsMimeTypeArray.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 5 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 14 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef nsMimeTypeArray_h___
       8             : #define nsMimeTypeArray_h___
       9             : 
      10             : #include "nsString.h"
      11             : #include "nsTArray.h"
      12             : #include "nsWrapperCache.h"
      13             : #include "nsPIDOMWindow.h"
      14             : #include "mozilla/dom/BindingDeclarations.h"
      15             : 
      16             : class nsMimeType;
      17             : class nsPluginElement;
      18             : 
      19             : class nsMimeTypeArray final : public nsISupports,
      20             :                               public nsWrapperCache
      21             : {
      22             : public:
      23             :   explicit nsMimeTypeArray(nsPIDOMWindowInner* aWindow);
      24             : 
      25             :   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
      26           0 :   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsMimeTypeArray)
      27             : 
      28             :   nsPIDOMWindowInner* GetParentObject() const;
      29             :   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
      30             : 
      31             :   void Refresh();
      32             : 
      33             :   // MimeTypeArray WebIDL methods
      34             :   nsMimeType* Item(uint32_t index, mozilla::dom::CallerType aCallerType);
      35             :   nsMimeType* NamedItem(const nsAString& name,
      36             :                         mozilla::dom::CallerType aCallerType);
      37             :   nsMimeType* IndexedGetter(uint32_t index, bool &found,
      38             :                             mozilla::dom::CallerType aCallerType);
      39             :   nsMimeType* NamedGetter(const nsAString& name, bool &found,
      40             :                           mozilla::dom::CallerType aCallerType);
      41             :   uint32_t Length(mozilla::dom::CallerType aCallerType);
      42             :   void GetSupportedNames(nsTArray<nsString>& retval,
      43             :                          mozilla::dom::CallerType aCallerType);
      44             : 
      45             : protected:
      46             :   virtual ~nsMimeTypeArray();
      47             : 
      48             :   void EnsurePluginMimeTypes();
      49             :   void Clear();
      50             : 
      51             :   nsCOMPtr<nsPIDOMWindowInner> mWindow;
      52             : 
      53             :   // mMimeTypes contains MIME types handled by plugins or by an OS
      54             :   // PreferredApplicationHandler.
      55             :   nsTArray<RefPtr<nsMimeType> > mMimeTypes;
      56             :   nsTArray<RefPtr<nsMimeType> > mCTPMimeTypes;
      57             : };
      58             : 
      59             : class nsMimeType final : public nsWrapperCache
      60             : {
      61             : public:
      62           0 :   NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsMimeType)
      63           0 :   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(nsMimeType)
      64             : 
      65             :   nsMimeType(nsPIDOMWindowInner* aWindow,
      66             :              nsPluginElement* aPluginElement,
      67             :              const nsAString& aType,
      68             :              const nsAString& aDescription,
      69             :              const nsAString& aExtension);
      70             :   nsPIDOMWindowInner* GetParentObject() const;
      71             :   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
      72             : 
      73           0 :   const nsString& Type() const
      74             :   {
      75           0 :     return mType;
      76             :   }
      77             : 
      78             :   // MimeType WebIDL methods
      79             :   void GetDescription(nsString& retval) const;
      80             :   nsPluginElement *GetEnabledPlugin() const;
      81             :   void GetSuffixes(nsString& retval) const;
      82             :   void GetType(nsString& retval) const;
      83             : 
      84             : protected:
      85             :   virtual ~nsMimeType();
      86             : 
      87             :   nsCOMPtr<nsPIDOMWindowInner> mWindow;
      88             : 
      89             :   // Strong reference to the active plugin. Note that this creates an explicit
      90             :   // reference cycle through the plugin element's mimetype array. We rely on the
      91             :   // cycle collector to break this cycle.
      92             :   RefPtr<nsPluginElement> mPluginElement;
      93             :   nsString mType;
      94             :   nsString mDescription;
      95             :   nsString mExtension;
      96             : };
      97             : 
      98             : #endif /* nsMimeTypeArray_h___ */

Generated by: LCOV version 1.13