Home | History | Annotate | Download | only in include
      1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
      2 /* ***** BEGIN LICENSE BLOCK *****
      3  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
      4  *
      5  * The contents of this file are subject to the Mozilla Public License Version
      6  * 1.1 (the "License"); you may not use this file except in compliance with
      7  * the License. You may obtain a copy of the License at
      8  * http://www.mozilla.org/MPL/
      9  *
     10  * Software distributed under the License is distributed on an "AS IS" basis,
     11  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
     12  * for the specific language governing rights and limitations under the
     13  * License.
     14  *
     15  * The Original Code is mozilla.org code.
     16  *
     17  * The Initial Developer of the Original Code is
     18  * Netscape Communications Corporation.
     19  * Portions created by the Initial Developer are Copyright (C) 1998
     20  * the Initial Developer. All Rights Reserved.
     21  *
     22  * Contributor(s):
     23  *
     24  * Alternatively, the contents of this file may be used under the terms of
     25  * either the GNU General Public License Version 2 or later (the "GPL"), or
     26  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
     27  * in which case the provisions of the GPL or the LGPL are applicable instead
     28  * of those above. If you wish to allow use of your version of this file only
     29  * under the terms of either the GPL or the LGPL, and not to allow others to
     30  * use your version of this file under the terms of the MPL, indicate your
     31  * decision by deleting the provisions above and replace them with the notice
     32  * and other provisions required by the GPL or the LGPL. If you do not delete
     33  * the provisions above, a recipient may use your version of this file under
     34  * the terms of any one of the MPL, the GPL or the LGPL.
     35  *
     36  * ***** END LICENSE BLOCK ***** */
     37 
     38 #ifndef __EPMANAGER_H__
     39 #define __EPMANAGER_H__
     40 
     41 #include "npapi.h"
     42 #include "npupp.h"
     43 
     44 typedef NPError (__stdcall * NP_GETENTRYPOINTS) (NPPluginFuncs* pFuncs);
     45 typedef NPError (__stdcall * NP_INITIALIZE) (NPNetscapeFuncs* pFuncs);
     46 typedef NPError (__stdcall * NP_SHUTDOWN) (void);
     47 
     48 struct InstanceList
     49 {
     50   InstanceList * next;
     51   NPP instance;
     52 
     53   InstanceList(NPP _instance);
     54   ~InstanceList();
     55 };
     56 
     57 struct PluginEntryPointList
     58 {
     59   PluginEntryPointList * next;
     60   char mimetype[80];
     61   InstanceList * instances;
     62   NPPluginFuncs realNPPFuncs;
     63   NP_SHUTDOWN realShutdown;
     64   XP_HLIB hLib;
     65 
     66   PluginEntryPointList();
     67   ~PluginEntryPointList();
     68 };
     69 
     70 class NPPEntryPointManager
     71 {
     72 private:
     73   PluginEntryPointList * mEntryPoints;
     74 
     75 public:
     76   void createEntryPointsForPlugin(char * mimetype, NPPluginFuncs * funcs, NP_SHUTDOWN shutdownproc, XP_HLIB hLib);
     77   void removeEntryPointsForPlugin(NPP instance, XP_HLIB * lib);
     78   NPPluginFuncs * findEntryPointsForPlugin(char * mimetype);
     79 
     80 private:
     81   NPPluginFuncs * findEntryPointsForInstance(NPP instance);
     82 
     83 public:
     84   NPPEntryPointManager();
     85   ~NPPEntryPointManager();
     86 
     87   void callNP_Shutdown(NPP instance);
     88   void callNP_ShutdownAll();
     89 
     90   NPError callNPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved);
     91   NPError callNPP_Destroy(NPP instance, NPSavedData** save, BOOL * last);
     92   NPError callNPP_SetWindow(NPP instance, NPWindow* window);
     93   NPError callNPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype);
     94   NPError callNPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason);
     95   int32   callNPP_WriteReady(NPP instance, NPStream* stream);
     96   int32   callNPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer);
     97   void    callNPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname);
     98   void    callNPP_Print(NPP instance, NPPrint* platformPrint);
     99   void    callNPP_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData);
    100   jref    callNPP_GetJavaClass(void);
    101   NPError callNPP_GetValue(NPP instance, NPPVariable variable, void *value);
    102   NPError callNPP_SetValue(NPP instance, NPNVariable variable, void *value);
    103   int16   callNPP_HandleEvent(NPP instance, void* event);
    104 };
    105 
    106 #endif
    107