OLD | NEW |
| (Empty) |
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | |
2 /* ***** BEGIN LICENSE BLOCK ***** | |
3 * Version: NPL 1.1/GPL 2.0/LGPL 2.1 | |
4 * | |
5 * The contents of this file are subject to the Netscape Public License | |
6 * Version 1.1 (the "License"); you may not use this file except in | |
7 * compliance with the License. You may obtain a copy of the License at | |
8 * http://www.mozilla.org/NPL/ | |
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 NPL, 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 NPL, the GPL or the LGPL. | |
35 * | |
36 * ***** END LICENSE BLOCK ***** */ | |
37 | |
38 #ifndef OMAHA_PLUGINS_COMMON_PLUGINBASE_H_ | |
39 #define OMAHA_PLUGINS_COMMON_PLUGINBASE_H_ | |
40 | |
41 #include "omaha/plugins/base/npplat.h" | |
42 | |
43 struct nsPluginCreateData | |
44 { | |
45 NPP instance; | |
46 NPMIMEType type; | |
47 uint16 mode; | |
48 int16 argc; | |
49 char** argn; | |
50 char** argv; | |
51 NPSavedData* saved; | |
52 }; | |
53 | |
54 #pragma warning(push) | |
55 #pragma warning(disable:4100) // unreferenced formal parameter | |
56 class nsPluginInstanceBase | |
57 { | |
58 public: | |
59 // these three methods must be implemented in the derived | |
60 // class platform specific way | |
61 virtual NPBool init(NPWindow* aWindow) = 0; | |
62 virtual void shut() = 0; | |
63 virtual NPBool isInitialized() = 0; | |
64 | |
65 // implement all or part of those methods in the derived | |
66 // class as needed | |
67 virtual NPError SetWindow(NPWindow* pNPWindow) { return NPE
RR_NO_ERROR; } | |
68 virtual NPError NewStream(NPMIMEType type, NPStream* stream, | |
69 NPBool seekable, uint16* stype) { return NPE
RR_NO_ERROR; } | |
70 virtual NPError DestroyStream(NPStream *stream, NPError reason) { return NPE
RR_NO_ERROR; } | |
71 virtual void StreamAsFile(NPStream* stream, const char* fname) { return; } | |
72 virtual int32 WriteReady(NPStream *stream) { return 0x0
fffffff; } | |
73 virtual int32 Write(NPStream *stream, int32 offset, | |
74 int32 len, void *buffer) { return len
; } | |
75 virtual void Print(NPPrint* printInfo) { return; } | |
76 virtual uint16 HandleEvent(void* event) { return 0;
} | |
77 virtual void URLNotify(const char* url, NPReason reason, | |
78 void* notifyData) { return; } | |
79 virtual NPError GetValue(NPPVariable variable, void *value) { return NPE
RR_NO_ERROR; } | |
80 virtual NPError SetValue(NPNVariable variable, void *value) { return NPE
RR_NO_ERROR; } | |
81 }; | |
82 #pragma warning(pop) | |
83 | |
84 // functions that should be implemented for each specific plugin | |
85 | |
86 // creation and destruction of the object of the derived class | |
87 nsPluginInstanceBase * NS_NewPluginInstance(nsPluginCreateData * aCreateDataStru
ct); | |
88 void NS_DestroyPluginInstance(nsPluginInstanceBase * aPlugin); | |
89 | |
90 // global plugin initialization and shutdown | |
91 NPError NS_PluginInitialize(); | |
92 void NS_PluginShutdown(); | |
93 | |
94 #ifdef XP_UNIX | |
95 // global to get plugins name & description | |
96 NPError NS_PluginGetValue(NPPVariable aVariable, void *aValue); | |
97 #endif | |
98 | |
99 #endif // OMAHA_PLUGINS_COMMON_PLUGINBASE_H_ | |
OLD | NEW |