LCOV - code coverage report
Current view: top level - dom/base - nsPluginArray.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 6 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 18 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 nsPluginArray_h___
       8             : #define nsPluginArray_h___
       9             : 
      10             : #include "nsTArray.h"
      11             : #include "nsWeakReference.h"
      12             : #include "nsIObserver.h"
      13             : #include "nsWrapperCache.h"
      14             : #include "nsPIDOMWindow.h"
      15             : #include "mozilla/dom/BindingDeclarations.h"
      16             : 
      17             : class nsPluginElement;
      18             : class nsMimeType;
      19             : class nsIInternalPluginTag;
      20             : 
      21           0 : class nsPluginArray final : public nsIObserver,
      22             :                             public nsSupportsWeakReference,
      23             :                             public nsWrapperCache
      24             : {
      25             : public:
      26             :   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
      27           0 :   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsPluginArray,
      28             :                                                          nsIObserver)
      29             : 
      30             :   // nsIObserver
      31             :   NS_DECL_NSIOBSERVER
      32             : 
      33             :   explicit nsPluginArray(nsPIDOMWindowInner* aWindow);
      34             :   nsPIDOMWindowInner* GetParentObject() const;
      35             :   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
      36             : 
      37             :   // nsPluginArray registers itself as an observer with a weak reference.
      38             :   // This can't be done in the constructor, because at that point its
      39             :   // refcount is 0 (and it gets destroyed upon registration). So, Init()
      40             :   // must be called after construction.
      41             :   void Init();
      42             :   void Invalidate();
      43             : 
      44             :   void GetMimeTypes(nsTArray<RefPtr<nsMimeType>>& aMimeTypes);
      45             :   void GetCTPMimeTypes(nsTArray<RefPtr<nsMimeType>>& aMimeTypes);
      46             : 
      47             :   static void NotifyHiddenPluginTouched(nsPluginElement* aElement);
      48             : 
      49             :   // PluginArray WebIDL methods
      50             : 
      51             :   nsPluginElement* Item(uint32_t aIndex, mozilla::dom::CallerType aCallerType);
      52             :   nsPluginElement* NamedItem(const nsAString& aName,
      53             :                              mozilla::dom::CallerType aCallerType);
      54             :   void Refresh(bool aReloadDocuments);
      55             :   nsPluginElement* IndexedGetter(uint32_t aIndex, bool &aFound,
      56             :                                  mozilla::dom::CallerType aCallerType);
      57             :   nsPluginElement* NamedGetter(const nsAString& aName, bool &aFound,
      58             :                                mozilla::dom::CallerType aCallerType);
      59             :   uint32_t Length(mozilla::dom::CallerType aCallerType);
      60             :   void GetSupportedNames(nsTArray<nsString>& aRetval,
      61             :                          mozilla::dom::CallerType aCallerType);
      62             : 
      63             : private:
      64             :   virtual ~nsPluginArray();
      65             : 
      66             :   bool AllowPlugins() const;
      67             :   void EnsurePlugins();
      68             : 
      69             :   nsCOMPtr<nsPIDOMWindowInner> mWindow;
      70             :   nsTArray<RefPtr<nsPluginElement> > mPlugins;
      71             :   /* A separate list of click-to-play plugins that we don't tell content
      72             :    * about but keep track of so we can still prompt the user to click to play.
      73             :    */
      74             :   nsTArray<RefPtr<nsPluginElement> > mCTPPlugins;
      75             : };
      76             : 
      77           0 : class nsPluginElement final : public nsISupports,
      78             :                               public nsWrapperCache
      79             : {
      80             : public:
      81             :   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
      82           0 :   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsPluginElement)
      83             : 
      84             :   nsPluginElement(nsPIDOMWindowInner* aWindow,
      85             :                   nsIInternalPluginTag* aPluginTag);
      86             : 
      87             :   nsPIDOMWindowInner* GetParentObject() const;
      88             :   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
      89             : 
      90           0 :   nsIInternalPluginTag* PluginTag() const
      91             :   {
      92           0 :     return mPluginTag;
      93             :   }
      94             : 
      95             :   // Plugin WebIDL methods
      96             : 
      97             :   void GetDescription(nsString& retval) const;
      98             :   void GetFilename(nsString& retval) const;
      99             :   void GetVersion(nsString& retval) const;
     100             :   void GetName(nsString& retval) const;
     101             :   nsMimeType* Item(uint32_t index);
     102             :   nsMimeType* NamedItem(const nsAString& name);
     103             :   nsMimeType* IndexedGetter(uint32_t index, bool &found);
     104             :   nsMimeType* NamedGetter(const nsAString& name, bool &found);
     105             :   uint32_t Length();
     106             :   void GetSupportedNames(nsTArray<nsString>& retval);
     107             : 
     108             :   nsTArray<RefPtr<nsMimeType> >& MimeTypes();
     109             : 
     110             : protected:
     111             :   ~nsPluginElement();
     112             : 
     113             :   void EnsurePluginMimeTypes();
     114             : 
     115             :   nsCOMPtr<nsPIDOMWindowInner> mWindow;
     116             :   nsCOMPtr<nsIInternalPluginTag> mPluginTag;
     117             :   nsTArray<RefPtr<nsMimeType> > mMimeTypes;
     118             : };
     119             : 
     120             : #endif /* nsPluginArray_h___ */

Generated by: LCOV version 1.13