source: trunk/libs/mozilla/include/npfunctions.h@ 359

Last change on this file since 359 was 359, checked in by dmik, 13 years ago

icedtea-web: Import selected Mozilla sources for plugin DLL.

Taken from the Firefox 11.0 source tarball.

  • Property svn:eol-style set to native
File size: 16.1 KB
Line 
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 npfunctions_h_
39#define npfunctions_h_
40
41#ifdef __OS2__
42#pragma pack(1)
43#define NP_LOADDS _System
44#else
45#define NP_LOADDS
46#endif
47
48#include "npapi.h"
49#include "npruntime.h"
50
51#ifdef MOZ_WIDGET_ANDROID
52#include <jni.h>
53#endif
54
55typedef NPError (* NP_LOADDS NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved);
56typedef NPError (* NP_LOADDS NPP_DestroyProcPtr)(NPP instance, NPSavedData** save);
57typedef NPError (* NP_LOADDS NPP_SetWindowProcPtr)(NPP instance, NPWindow* window);
58typedef NPError (* NP_LOADDS NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype);
59typedef NPError (* NP_LOADDS NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
60typedef int32_t (* NP_LOADDS NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream);
61typedef int32_t (* NP_LOADDS NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
62typedef void (* NP_LOADDS NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname);
63typedef void (* NP_LOADDS NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint);
64typedef int16_t (* NP_LOADDS NPP_HandleEventProcPtr)(NPP instance, void* event);
65typedef void (* NP_LOADDS NPP_URLNotifyProcPtr)(NPP instance, const char* url, NPReason reason, void* notifyData);
66/* Any NPObjects returned to the browser via NPP_GetValue should be retained
67 by the plugin on the way out. The browser is responsible for releasing. */
68typedef NPError (* NP_LOADDS NPP_GetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value);
69typedef NPError (* NP_LOADDS NPP_SetValueProcPtr)(NPP instance, NPNVariable variable, void *value);
70typedef NPBool (* NP_LOADDS NPP_GotFocusPtr)(NPP instance, NPFocusDirection direction);
71typedef void (* NP_LOADDS NPP_LostFocusPtr)(NPP instance);
72typedef void (* NP_LOADDS NPP_URLRedirectNotifyPtr)(NPP instance, const char* url, int32_t status, void* notifyData);
73typedef NPError (* NP_LOADDS NPP_ClearSiteDataPtr)(const char* site, uint64_t flags, uint64_t maxAge);
74typedef char** (* NP_LOADDS NPP_GetSitesWithDataPtr)(void);
75
76typedef NPError (*NPN_GetValueProcPtr)(NPP instance, NPNVariable variable, void *ret_value);
77typedef NPError (*NPN_SetValueProcPtr)(NPP instance, NPPVariable variable, void *value);
78typedef NPError (*NPN_GetURLNotifyProcPtr)(NPP instance, const char* url, const char* window, void* notifyData);
79typedef NPError (*NPN_PostURLNotifyProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData);
80typedef NPError (*NPN_GetURLProcPtr)(NPP instance, const char* url, const char* window);
81typedef NPError (*NPN_PostURLProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file);
82typedef NPError (*NPN_RequestReadProcPtr)(NPStream* stream, NPByteRange* rangeList);
83typedef NPError (*NPN_NewStreamProcPtr)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
84typedef int32_t (*NPN_WriteProcPtr)(NPP instance, NPStream* stream, int32_t len, void* buffer);
85typedef NPError (*NPN_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
86typedef void (*NPN_StatusProcPtr)(NPP instance, const char* message);
87/* Browser manages the lifetime of the buffer returned by NPN_UserAgent, don't
88 depend on it sticking around and don't free it. */
89typedef const char* (*NPN_UserAgentProcPtr)(NPP instance);
90typedef void* (*NPN_MemAllocProcPtr)(uint32_t size);
91typedef void (*NPN_MemFreeProcPtr)(void* ptr);
92typedef uint32_t (*NPN_MemFlushProcPtr)(uint32_t size);
93typedef void (*NPN_ReloadPluginsProcPtr)(NPBool reloadPages);
94typedef void* (*NPN_GetJavaEnvProcPtr)(void);
95typedef void* (*NPN_GetJavaPeerProcPtr)(NPP instance);
96typedef void (*NPN_InvalidateRectProcPtr)(NPP instance, NPRect *rect);
97typedef void (*NPN_InvalidateRegionProcPtr)(NPP instance, NPRegion region);
98typedef void (*NPN_ForceRedrawProcPtr)(NPP instance);
99typedef NPIdentifier (*NPN_GetStringIdentifierProcPtr)(const NPUTF8* name);
100typedef void (*NPN_GetStringIdentifiersProcPtr)(const NPUTF8** names, int32_t nameCount, NPIdentifier* identifiers);
101typedef NPIdentifier (*NPN_GetIntIdentifierProcPtr)(int32_t intid);
102typedef bool (*NPN_IdentifierIsStringProcPtr)(NPIdentifier identifier);
103typedef NPUTF8* (*NPN_UTF8FromIdentifierProcPtr)(NPIdentifier identifier);
104typedef int32_t (*NPN_IntFromIdentifierProcPtr)(NPIdentifier identifier);
105typedef NPObject* (*NPN_CreateObjectProcPtr)(NPP npp, NPClass *aClass);
106typedef NPObject* (*NPN_RetainObjectProcPtr)(NPObject *obj);
107typedef void (*NPN_ReleaseObjectProcPtr)(NPObject *obj);
108typedef bool (*NPN_InvokeProcPtr)(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result);
109typedef bool (*NPN_InvokeDefaultProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
110typedef bool (*NPN_EvaluateProcPtr)(NPP npp, NPObject *obj, NPString *script, NPVariant *result);
111typedef bool (*NPN_GetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result);
112typedef bool (*NPN_SetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value);
113typedef bool (*NPN_RemovePropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
114typedef bool (*NPN_HasPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
115typedef bool (*NPN_HasMethodProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
116typedef void (*NPN_ReleaseVariantValueProcPtr)(NPVariant *variant);
117typedef void (*NPN_SetExceptionProcPtr)(NPObject *obj, const NPUTF8 *message);
118typedef void (*NPN_PushPopupsEnabledStateProcPtr)(NPP npp, NPBool enabled);
119typedef void (*NPN_PopPopupsEnabledStateProcPtr)(NPP npp);
120typedef bool (*NPN_EnumerateProcPtr)(NPP npp, NPObject *obj, NPIdentifier **identifier, uint32_t *count);
121typedef void (*NPN_PluginThreadAsyncCallProcPtr)(NPP instance, void (*func)(void *), void *userData);
122typedef bool (*NPN_ConstructProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
123typedef NPError (*NPN_GetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, char **value, uint32_t *len);
124typedef NPError (*NPN_SetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, const char *value, uint32_t len);
125typedef NPError (*NPN_GetAuthenticationInfoPtr)(NPP npp, const char *protocol, const char *host, int32_t port, const char *scheme, const char *realm, char **username, uint32_t *ulen, char **password, uint32_t *plen);
126typedef uint32_t (*NPN_ScheduleTimerPtr)(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
127typedef void (*NPN_UnscheduleTimerPtr)(NPP instance, uint32_t timerID);
128typedef NPError (*NPN_PopUpContextMenuPtr)(NPP instance, NPMenu* menu);
129typedef NPBool (*NPN_ConvertPointPtr)(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
130typedef NPBool (*NPN_HandleEventPtr)(NPP instance, void *event, NPBool handled);
131typedef NPBool (*NPN_UnfocusInstancePtr)(NPP instance, NPFocusDirection direction);
132typedef void (*NPN_URLRedirectResponsePtr)(NPP instance, void* notifyData, NPBool allow);
133
134typedef struct _NPPluginFuncs {
135 uint16_t size;
136 uint16_t version;
137 NPP_NewProcPtr newp;
138 NPP_DestroyProcPtr destroy;
139 NPP_SetWindowProcPtr setwindow;
140 NPP_NewStreamProcPtr newstream;
141 NPP_DestroyStreamProcPtr destroystream;
142 NPP_StreamAsFileProcPtr asfile;
143 NPP_WriteReadyProcPtr writeready;
144 NPP_WriteProcPtr write;
145 NPP_PrintProcPtr print;
146 NPP_HandleEventProcPtr event;
147 NPP_URLNotifyProcPtr urlnotify;
148 void* javaClass;
149 NPP_GetValueProcPtr getvalue;
150 NPP_SetValueProcPtr setvalue;
151 NPP_GotFocusPtr gotfocus;
152 NPP_LostFocusPtr lostfocus;
153 NPP_URLRedirectNotifyPtr urlredirectnotify;
154 NPP_ClearSiteDataPtr clearsitedata;
155 NPP_GetSitesWithDataPtr getsiteswithdata;
156} NPPluginFuncs;
157
158typedef struct _NPNetscapeFuncs {
159 uint16_t size;
160 uint16_t version;
161 NPN_GetURLProcPtr geturl;
162 NPN_PostURLProcPtr posturl;
163 NPN_RequestReadProcPtr requestread;
164 NPN_NewStreamProcPtr newstream;
165 NPN_WriteProcPtr write;
166 NPN_DestroyStreamProcPtr destroystream;
167 NPN_StatusProcPtr status;
168 NPN_UserAgentProcPtr uagent;
169 NPN_MemAllocProcPtr memalloc;
170 NPN_MemFreeProcPtr memfree;
171 NPN_MemFlushProcPtr memflush;
172 NPN_ReloadPluginsProcPtr reloadplugins;
173 NPN_GetJavaEnvProcPtr getJavaEnv;
174 NPN_GetJavaPeerProcPtr getJavaPeer;
175 NPN_GetURLNotifyProcPtr geturlnotify;
176 NPN_PostURLNotifyProcPtr posturlnotify;
177 NPN_GetValueProcPtr getvalue;
178 NPN_SetValueProcPtr setvalue;
179 NPN_InvalidateRectProcPtr invalidaterect;
180 NPN_InvalidateRegionProcPtr invalidateregion;
181 NPN_ForceRedrawProcPtr forceredraw;
182 NPN_GetStringIdentifierProcPtr getstringidentifier;
183 NPN_GetStringIdentifiersProcPtr getstringidentifiers;
184 NPN_GetIntIdentifierProcPtr getintidentifier;
185 NPN_IdentifierIsStringProcPtr identifierisstring;
186 NPN_UTF8FromIdentifierProcPtr utf8fromidentifier;
187 NPN_IntFromIdentifierProcPtr intfromidentifier;
188 NPN_CreateObjectProcPtr createobject;
189 NPN_RetainObjectProcPtr retainobject;
190 NPN_ReleaseObjectProcPtr releaseobject;
191 NPN_InvokeProcPtr invoke;
192 NPN_InvokeDefaultProcPtr invokeDefault;
193 NPN_EvaluateProcPtr evaluate;
194 NPN_GetPropertyProcPtr getproperty;
195 NPN_SetPropertyProcPtr setproperty;
196 NPN_RemovePropertyProcPtr removeproperty;
197 NPN_HasPropertyProcPtr hasproperty;
198 NPN_HasMethodProcPtr hasmethod;
199 NPN_ReleaseVariantValueProcPtr releasevariantvalue;
200 NPN_SetExceptionProcPtr setexception;
201 NPN_PushPopupsEnabledStateProcPtr pushpopupsenabledstate;
202 NPN_PopPopupsEnabledStateProcPtr poppopupsenabledstate;
203 NPN_EnumerateProcPtr enumerate;
204 NPN_PluginThreadAsyncCallProcPtr pluginthreadasynccall;
205 NPN_ConstructProcPtr construct;
206 NPN_GetValueForURLPtr getvalueforurl;
207 NPN_SetValueForURLPtr setvalueforurl;
208 NPN_GetAuthenticationInfoPtr getauthenticationinfo;
209 NPN_ScheduleTimerPtr scheduletimer;
210 NPN_UnscheduleTimerPtr unscheduletimer;
211 NPN_PopUpContextMenuPtr popupcontextmenu;
212 NPN_ConvertPointPtr convertpoint;
213 NPN_HandleEventPtr handleevent;
214 NPN_UnfocusInstancePtr unfocusinstance;
215 NPN_URLRedirectResponsePtr urlredirectresponse;
216} NPNetscapeFuncs;
217
218#ifdef XP_MACOSX
219/*
220 * Mac OS X version(s) of NP_GetMIMEDescription(const char *)
221 * These can be called to retreive MIME information from the plugin dynamically
222 *
223 * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way
224 * to get mime info from the plugin only on OSX and may not be supported
225 * in furture version -- use NP_GetMIMEDescription instead
226 */
227enum
228{
229 kBPSupportedMIMETypesStructVers_1 = 1
230};
231typedef struct _BPSupportedMIMETypes
232{
233 SInt32 structVersion; /* struct version */
234 Handle typeStrings; /* STR# formated handle, allocated by plug-in */
235 Handle infoStrings; /* STR# formated handle, allocated by plug-in */
236} BPSupportedMIMETypes;
237OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags);
238#define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription"
239typedef const char* (*NP_GetMIMEDescriptionProcPtr)(void);
240typedef OSErr (*BP_GetSupportedMIMETypesProcPtr)(BPSupportedMIMETypes*, UInt32);
241#endif
242
243#if defined(_WIN32)
244#define OSCALL WINAPI
245#else
246#if defined(__OS2__)
247#define OSCALL _System
248#else
249#define OSCALL
250#endif
251#endif
252
253#if defined(XP_UNIX)
254/* GCC 3.3 and later support the visibility attribute. */
255#if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
256#define NP_VISIBILITY_DEFAULT __attribute__((visibility("default")))
257#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
258#define NP_VISIBILITY_DEFAULT __global
259#else
260#define NP_VISIBILITY_DEFAULT
261#endif
262#define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type
263#endif
264
265#if defined(_WIN32) || defined (__OS2__)
266#ifdef __cplusplus
267extern "C" {
268#endif
269/* plugin meta member functions */
270#if defined(__OS2__)
271typedef struct _NPPluginData { /* Alternate OS2 Plugin interface */
272 char *pMimeTypes;
273 char *pFileExtents;
274 char *pFileOpenTemplate;
275 char *pProductName;
276 char *pProductDescription;
277 unsigned long dwProductVersionMS;
278 unsigned long dwProductVersionLS;
279} NPPluginData;
280typedef NPError (*NP_GetPluginDataFunc)(NPPluginData*);
281NPError OSCALL NP_GetPluginData(NPPluginData * pPluginData);
282#endif
283typedef NPError (*NP_GetEntryPointsFunc)(NPPluginFuncs*);
284NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs);
285typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*);
286NPError OSCALL NP_Initialize(NPNetscapeFuncs* bFuncs);
287typedef NPError (*NP_ShutdownFunc)(void);
288NPError OSCALL NP_Shutdown(void);
289typedef const char* (*NP_GetMIMEDescriptionFunc)(void);
290const char* NP_GetMIMEDescription(void);
291#ifdef __cplusplus
292}
293#endif
294#endif
295
296#if defined(__OS2__)
297#pragma pack()
298#endif
299
300#ifdef XP_UNIX
301#ifdef __cplusplus
302extern "C" {
303#endif
304typedef char* (*NP_GetPluginVersionFunc)(void);
305NP_EXPORT(char*) NP_GetPluginVersion(void);
306typedef const char* (*NP_GetMIMEDescriptionFunc)(void);
307NP_EXPORT(const char*) NP_GetMIMEDescription(void);
308#ifdef XP_MACOSX
309typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*);
310NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs);
311typedef NPError (*NP_GetEntryPointsFunc)(NPPluginFuncs*);
312NP_EXPORT(NPError) NP_GetEntryPoints(NPPluginFuncs* pFuncs);
313#else
314#ifdef MOZ_WIDGET_ANDROID
315typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*, NPPluginFuncs*, JNIEnv* pEnv);
316NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, JNIEnv* pEnv);
317#else
318typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*, NPPluginFuncs*);
319NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs);
320#endif
321#endif
322typedef NPError (*NP_ShutdownFunc)(void);
323NP_EXPORT(NPError) NP_Shutdown(void);
324typedef NPError (*NP_GetValueFunc)(void *, NPPVariable, void *);
325NP_EXPORT(NPError) NP_GetValue(void *future, NPPVariable aVariable, void *aValue);
326#ifdef __cplusplus
327}
328#endif
329#endif
330
331#endif /* npfunctions_h_ */
Note: See TracBrowser for help on using the repository browser.