1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
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/
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
15 * The Original Code is mozilla.org code.
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.
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.
36 * ***** END LICENSE BLOCK ***** */
43 struct nsPluginCreateData
54 class nsPluginInstanceBase
57 // these three methods must be implemented in the derived
58 // class platform specific way
59 virtual NPBool
init(NPWindow
* aWindow
) = 0;
60 virtual void shut() = 0;
61 virtual NPBool
isInitialized() = 0;
63 // implement all or part of those methods in the derived
65 virtual NPError
SetWindow(NPWindow
* pNPWindow
) { return NPERR_NO_ERROR
; }
66 virtual NPError
NewStream(NPMIMEType type
, NPStream
* stream
,
67 NPBool seekable
, uint16_t* stype
) { return NPERR_NO_ERROR
; }
68 virtual NPError
DestroyStream(NPStream
*stream
, NPError reason
) { return NPERR_NO_ERROR
; }
69 virtual void StreamAsFile(NPStream
* stream
, const char* fname
) { return; }
70 virtual int32_t WriteReady(NPStream
*stream
) { return 0x0fffffff; }
71 virtual int32_t Write(NPStream
*stream
, int32_t offset
,
72 int32_t len
, void *buffer
) { return len
; }
73 virtual void Print(NPPrint
* printInfo
) { return; }
74 virtual uint16_t HandleEvent(void* event
) { return 0; }
75 virtual void URLNotify(const char* url
, NPReason reason
,
76 void* notifyData
) { return; }
77 virtual NPError
GetValue(NPPVariable variable
, void *value
) { return NPERR_NO_ERROR
; }
78 virtual NPError
SetValue(NPNVariable variable
, void *value
) { return NPERR_NO_ERROR
; }
81 // functions that should be implemented for each specific plugin
83 // creation and destruction of the object of the derived class
84 nsPluginInstanceBase
* NS_NewPluginInstance(nsPluginCreateData
* aCreateDataStruct
);
85 void NS_DestroyPluginInstance(nsPluginInstanceBase
* aPlugin
);
87 // global plugin initialization and shutdown
88 NPError
NS_PluginInitialize();
89 void NS_PluginShutdown();
92 // global to get plugins name & description
93 NPError
NS_PluginGetValue(NPPVariable aVariable
, void *aValue
);
96 #endif // pluginbase_h_