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

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       5             : 
       6             : #ifndef _nsPluginNativeWindow_h_
       7             : #define _nsPluginNativeWindow_h_
       8             : 
       9             : #include "nscore.h"
      10             : #include "nsCOMPtr.h"
      11             : #include "nsISupportsImpl.h"
      12             : #include "nsNPAPIPluginInstance.h"
      13             : #include "npapi.h"
      14             : #include "nsIWidget.h"
      15             : 
      16             : /**
      17             :  * base class for native plugin window implementations
      18             :  */
      19             : class nsPluginNativeWindow : public NPWindow
      20             : {
      21             : public:
      22           0 :   nsPluginNativeWindow() : NPWindow() {
      23           0 :     MOZ_COUNT_CTOR(nsPluginNativeWindow);
      24           0 :   }
      25             : 
      26           0 :   virtual ~nsPluginNativeWindow() {
      27           0 :     MOZ_COUNT_DTOR(nsPluginNativeWindow);
      28           0 :   }
      29             : 
      30             :   /**
      31             :    *   !!! CAUTION !!!
      32             :    *
      33             :    * The base class |nsPluginWindow| is defined as a struct in nsplugindefs.h,
      34             :    * thus it does not have a destructor of its own.
      35             :    * One should never attempt to delete |nsPluginNativeWindow| object instance
      36             :    * (or derivatives) using a pointer of |nsPluginWindow *| type. Should such
      37             :    * necessity occur it must be properly casted first.
      38             :    */
      39             : 
      40             : public:
      41             :   nsresult GetPluginInstance(RefPtr<nsNPAPIPluginInstance> &aPluginInstance) {
      42             :     aPluginInstance = mPluginInstance;
      43             :     return NS_OK;
      44             :   }
      45           0 :   nsresult SetPluginInstance(nsNPAPIPluginInstance *aPluginInstance) {
      46           0 :     if (mPluginInstance != aPluginInstance)
      47           0 :       mPluginInstance = aPluginInstance;
      48           0 :     return NS_OK;
      49             :   }
      50             : 
      51             :   nsresult GetPluginWidget(nsIWidget **aWidget) const {
      52             :     NS_IF_ADDREF(*aWidget = mWidget);
      53             :     return NS_OK;
      54             :   }
      55           0 :   nsresult SetPluginWidget(nsIWidget *aWidget) {
      56           0 :     mWidget = aWidget;
      57           0 :     return NS_OK;
      58             :   }
      59             : 
      60             : public:
      61           0 :   virtual nsresult CallSetWindow(RefPtr<nsNPAPIPluginInstance> &aPluginInstance) {
      62             :     // null aPluginInstance means that we want to call SetWindow(null)
      63           0 :     if (aPluginInstance)
      64           0 :       aPluginInstance->SetWindow(this);
      65           0 :     else if (mPluginInstance)
      66           0 :       mPluginInstance->SetWindow(nullptr);
      67             : 
      68           0 :     SetPluginInstance(aPluginInstance);
      69           0 :     return NS_OK;
      70             :   }
      71             : 
      72             : protected:
      73             :   RefPtr<nsNPAPIPluginInstance> mPluginInstance;
      74             :   nsCOMPtr<nsIWidget> mWidget;
      75             : };
      76             : 
      77             : nsresult PLUG_NewPluginNativeWindow(nsPluginNativeWindow ** aPluginNativeWindow);
      78             : nsresult PLUG_DeletePluginNativeWindow(nsPluginNativeWindow * aPluginNativeWindow);
      79             : 
      80             : #endif //_nsPluginNativeWindow_h_

Generated by: LCOV version 1.13