LCOV - code coverage report
Current view: directory - objdir/dist/include/mozilla - PluginPRLibrary.h (source / functions) Found Hit Coverage
Test: app.info Lines: 24 0 0.0 %
Date: 2012-06-02 Functions: 7 0 0.0 %

       1                 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
       2                 :  * vim: sw=4 ts=4 et :
       3                 :  * ***** BEGIN LICENSE BLOCK *****
       4                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       5                 :  *
       6                 :  * The contents of this file are subject to the Mozilla Public License Version
       7                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       8                 :  * the License. You may obtain a copy of the License at
       9                 :  * http://www.mozilla.org/MPL/
      10                 :  *
      11                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      12                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      13                 :  * for the specific language governing rights and limitations under the
      14                 :  * License.
      15                 :  *
      16                 :  * The Original Code is Mozilla Plugin App.
      17                 :  *
      18                 :  * The Initial Developer of the Original Code is
      19                 :  *   Josh Aas <josh@mozilla.com>
      20                 :  * Portions created by the Initial Developer are Copyright (C) 2009
      21                 :  * the Initial Developer. All Rights Reserved.
      22                 :  *
      23                 :  * Contributor(s):
      24                 :  *
      25                 :  * Alternatively, the contents of this file may be used under the terms of
      26                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
      27                 :  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      28                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      29                 :  * of those above. If you wish to allow use of your version of this file only
      30                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      31                 :  * use your version of this file under the terms of the MPL, indicate your
      32                 :  * decision by deleting the provisions above and replace them with the notice
      33                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      34                 :  * the provisions above, a recipient may use your version of this file under
      35                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      36                 :  *
      37                 :  * ***** END LICENSE BLOCK ***** */
      38                 : 
      39                 : #ifndef PluginPRLibrary_h
      40                 : #define PluginPRLibrary_h 1
      41                 : 
      42                 : #include "mozilla/PluginLibrary.h"
      43                 : #include "nsNPAPIPlugin.h"
      44                 : #include "npfunctions.h"
      45                 : 
      46                 : namespace mozilla {
      47                 : 
      48                 : class PluginPRLibrary : public PluginLibrary
      49                 : {
      50                 : public:
      51               0 :     PluginPRLibrary(const char* aFilePath, PRLibrary* aLibrary) :
      52                 : #if defined(XP_UNIX) && !defined(XP_MACOSX)
      53                 :         mNP_Initialize(nsnull),
      54                 : #else
      55                 :         mNP_Initialize(nsnull),
      56                 : #endif
      57                 :         mNP_Shutdown(nsnull),
      58                 :         mNP_GetMIMEDescription(nsnull),
      59                 : #if defined(XP_UNIX) && !defined(XP_MACOSX)
      60                 :         mNP_GetValue(nsnull),
      61                 : #endif
      62                 : #if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2)
      63                 :         mNP_GetEntryPoints(nsnull),
      64                 : #endif
      65                 :         mNPP_New(nsnull),
      66                 :         mNPP_GetValue(nsnull),
      67                 :         mNPP_ClearSiteData(nsnull),
      68                 :         mNPP_GetSitesWithData(nsnull),
      69                 :         mLibrary(aLibrary),
      70               0 :         mFilePath(aFilePath)
      71                 :     {
      72               0 :         NS_ASSERTION(mLibrary, "need non-null lib");
      73                 :         // addref here??
      74               0 :     }
      75                 : 
      76               0 :     virtual ~PluginPRLibrary()
      77               0 :     {
      78                 :         // unref here??
      79               0 :     }
      80                 : 
      81               0 :     virtual void SetPlugin(nsNPAPIPlugin*) { }
      82                 : 
      83               0 :     virtual bool HasRequiredFunctions() {
      84                 :         mNP_Initialize = (NP_InitializeFunc)
      85               0 :             PR_FindFunctionSymbol(mLibrary, "NP_Initialize");
      86               0 :         if (!mNP_Initialize)
      87               0 :             return false;
      88                 : 
      89                 :         mNP_Shutdown = (NP_ShutdownFunc)
      90               0 :             PR_FindFunctionSymbol(mLibrary, "NP_Shutdown");
      91               0 :         if (!mNP_Shutdown)
      92               0 :             return false;
      93                 : 
      94                 :         mNP_GetMIMEDescription = (NP_GetMIMEDescriptionFunc)
      95               0 :             PR_FindFunctionSymbol(mLibrary, "NP_GetMIMEDescription");
      96                 : #ifndef XP_MACOSX
      97               0 :         if (!mNP_GetMIMEDescription)
      98               0 :             return false;
      99                 : #endif
     100                 : 
     101                 : #if defined(XP_UNIX) && !defined(XP_MACOSX)
     102                 :         mNP_GetValue = (NP_GetValueFunc)
     103               0 :             PR_FindFunctionSymbol(mLibrary, "NP_GetValue");
     104               0 :         if (!mNP_GetValue)
     105               0 :             return false;
     106                 : #endif
     107                 : 
     108                 : #if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2)
     109                 :         mNP_GetEntryPoints = (NP_GetEntryPointsFunc)
     110                 :             PR_FindFunctionSymbol(mLibrary, "NP_GetEntryPoints");
     111                 :         if (!mNP_GetEntryPoints)
     112                 :             return false;
     113                 : #endif
     114               0 :         return true;
     115                 :     }
     116                 : 
     117                 : #if defined(XP_UNIX) && !defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK)
     118                 :     virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs,
     119                 :                                    NPPluginFuncs* pFuncs, NPError* error);
     120                 : #else
     121                 :     virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs,
     122                 :                                    NPError* error);
     123                 : #endif
     124                 : 
     125                 :     virtual nsresult NP_Shutdown(NPError* error);
     126                 :     virtual nsresult NP_GetMIMEDescription(const char** mimeDesc);
     127                 : 
     128                 :     virtual nsresult NP_GetValue(void *future, NPPVariable aVariable,
     129                 :                                  void *aValue, NPError* error);
     130                 : 
     131                 : #if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2)
     132                 :     virtual nsresult NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error);
     133                 : #endif
     134                 : 
     135                 :     virtual nsresult NPP_New(NPMIMEType pluginType, NPP instance,
     136                 :                              uint16_t mode, int16_t argc, char* argn[],
     137                 :                              char* argv[], NPSavedData* saved,
     138                 :                              NPError* error);
     139                 : 
     140                 :     virtual nsresult NPP_ClearSiteData(const char* site, uint64_t flags,
     141                 :                                        uint64_t maxAge);
     142                 :     virtual nsresult NPP_GetSitesWithData(InfallibleTArray<nsCString>& result);
     143                 : 
     144                 :     virtual nsresult AsyncSetWindow(NPP instance, NPWindow* window);
     145                 :     virtual nsresult GetImageContainer(NPP instance, ImageContainer** aContainer);
     146                 :     virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize);
     147               0 :     NS_OVERRIDE virtual bool UseAsyncPainting() { return false; }
     148                 : #if defined(XP_MACOSX)
     149                 :     virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, bool *aDrawing);
     150                 : #endif
     151                 :     NS_OVERRIDE
     152                 :     virtual nsresult SetBackgroundUnknown(NPP instance);
     153                 :     NS_OVERRIDE
     154                 :     virtual nsresult BeginUpdateBackground(NPP instance,
     155                 :                                            const nsIntRect&, gfxContext** aCtx);
     156                 :     NS_OVERRIDE
     157                 :     virtual nsresult EndUpdateBackground(NPP instance,
     158                 :                                          gfxContext* aCtx, const nsIntRect&);
     159                 : #if defined(MOZ_WIDGET_QT) && (MOZ_PLATFORM_MAEMO == 6)
     160                 :     virtual nsresult HandleGUIEvent(NPP instance,
     161                 :                                     const nsGUIEvent& anEvent, bool* handled);
     162                 : #endif
     163                 : 
     164               0 :     virtual void GetLibraryPath(nsACString& aPath) { aPath.Assign(mFilePath); }
     165                 : 
     166                 : private:
     167                 :     NP_InitializeFunc mNP_Initialize;
     168                 :     NP_ShutdownFunc mNP_Shutdown;
     169                 :     NP_GetMIMEDescriptionFunc mNP_GetMIMEDescription;
     170                 : #if defined(XP_UNIX) && !defined(XP_MACOSX)
     171                 :     NP_GetValueFunc mNP_GetValue;
     172                 : #endif
     173                 : #if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2)
     174                 :     NP_GetEntryPointsFunc mNP_GetEntryPoints;
     175                 : #endif
     176                 :     NPP_NewProcPtr mNPP_New;
     177                 :     NPP_GetValueProcPtr mNPP_GetValue;
     178                 :     NPP_ClearSiteDataPtr mNPP_ClearSiteData;
     179                 :     NPP_GetSitesWithDataPtr mNPP_GetSitesWithData;
     180                 :     PRLibrary* mLibrary;
     181                 :     nsCString mFilePath;
     182                 : };
     183                 : 
     184                 : 
     185                 : } // namespace mozilla
     186                 : 
     187                 : #endif  // ifndef PluginPRLibrary_h

Generated by: LCOV version 1.7