Evince
Evince is a document viewer capable of displaying multiple and single page document formats like PDF and Postscript.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
npfunctions.h
Go to the documentation of this file.
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 
6 #ifndef npfunctions_h_
7 #define npfunctions_h_
8 
9 #ifdef __OS2__
10 #pragma pack(1)
11 #define NP_LOADDS _System
12 #else
13 #define NP_LOADDS
14 #endif
15 
16 #include "npapi.h"
17 #include "npruntime.h"
18 
19 #ifdef MOZ_WIDGET_ANDROID
20 #include <jni.h>
21 #endif
22 
23 typedef NPError (* NP_LOADDS NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved);
24 typedef NPError (* NP_LOADDS NPP_DestroyProcPtr)(NPP instance, NPSavedData** save);
25 typedef NPError (* NP_LOADDS NPP_SetWindowProcPtr)(NPP instance, NPWindow* window);
26 typedef NPError (* NP_LOADDS NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype);
27 typedef NPError (* NP_LOADDS NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
28 typedef int32_t (* NP_LOADDS NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream);
29 typedef int32_t (* NP_LOADDS NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
30 typedef void (* NP_LOADDS NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname);
31 typedef void (* NP_LOADDS NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint);
32 typedef int16_t (* NP_LOADDS NPP_HandleEventProcPtr)(NPP instance, void* event);
33 typedef void (* NP_LOADDS NPP_URLNotifyProcPtr)(NPP instance, const char* url, NPReason reason, void* notifyData);
34 /* Any NPObjects returned to the browser via NPP_GetValue should be retained
35  by the plugin on the way out. The browser is responsible for releasing. */
36 typedef NPError (* NP_LOADDS NPP_GetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value);
37 typedef NPError (* NP_LOADDS NPP_SetValueProcPtr)(NPP instance, NPNVariable variable, void *value);
38 typedef NPBool (* NP_LOADDS NPP_GotFocusPtr)(NPP instance, NPFocusDirection direction);
39 typedef void (* NP_LOADDS NPP_LostFocusPtr)(NPP instance);
40 typedef void (* NP_LOADDS NPP_URLRedirectNotifyPtr)(NPP instance, const char* url, int32_t status, void* notifyData);
41 typedef NPError (* NP_LOADDS NPP_ClearSiteDataPtr)(const char* site, uint64_t flags, uint64_t maxAge);
42 typedef char** (* NP_LOADDS NPP_GetSitesWithDataPtr)(void);
43 typedef void (* NP_LOADDS NPP_DidCompositePtr)(NPP instance);
44 
45 typedef NPError (*NPN_GetValueProcPtr)(NPP instance, NPNVariable variable, void *ret_value);
46 typedef NPError (*NPN_SetValueProcPtr)(NPP instance, NPPVariable variable, void *value);
47 typedef NPError (*NPN_GetURLNotifyProcPtr)(NPP instance, const char* url, const char* window, void* notifyData);
48 typedef NPError (*NPN_PostURLNotifyProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData);
49 typedef NPError (*NPN_GetURLProcPtr)(NPP instance, const char* url, const char* window);
50 typedef NPError (*NPN_PostURLProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file);
51 typedef NPError (*NPN_RequestReadProcPtr)(NPStream* stream, NPByteRange* rangeList);
52 typedef NPError (*NPN_NewStreamProcPtr)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
53 typedef int32_t (*NPN_WriteProcPtr)(NPP instance, NPStream* stream, int32_t len, void* buffer);
54 typedef NPError (*NPN_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
55 typedef void (*NPN_StatusProcPtr)(NPP instance, const char* message);
56 /* Browser manages the lifetime of the buffer returned by NPN_UserAgent, don't
57  depend on it sticking around and don't free it. */
58 typedef const char* (*NPN_UserAgentProcPtr)(NPP instance);
59 typedef void* (*NPN_MemAllocProcPtr)(uint32_t size);
60 typedef void (*NPN_MemFreeProcPtr)(void* ptr);
61 typedef uint32_t (*NPN_MemFlushProcPtr)(uint32_t size);
62 typedef void (*NPN_ReloadPluginsProcPtr)(NPBool reloadPages);
63 typedef void* (*NPN_GetJavaEnvProcPtr)(void);
64 typedef void* (*NPN_GetJavaPeerProcPtr)(NPP instance);
65 typedef void (*NPN_InvalidateRectProcPtr)(NPP instance, NPRect *rect);
66 typedef void (*NPN_InvalidateRegionProcPtr)(NPP instance, NPRegion region);
67 typedef void (*NPN_ForceRedrawProcPtr)(NPP instance);
69 typedef void (*NPN_GetStringIdentifiersProcPtr)(const NPUTF8** names, int32_t nameCount, NPIdentifier* identifiers);
70 typedef NPIdentifier (*NPN_GetIntIdentifierProcPtr)(int32_t intid);
71 typedef bool (*NPN_IdentifierIsStringProcPtr)(NPIdentifier identifier);
72 typedef NPUTF8* (*NPN_UTF8FromIdentifierProcPtr)(NPIdentifier identifier);
73 typedef int32_t (*NPN_IntFromIdentifierProcPtr)(NPIdentifier identifier);
74 typedef NPObject* (*NPN_CreateObjectProcPtr)(NPP npp, NPClass *aClass);
75 typedef NPObject* (*NPN_RetainObjectProcPtr)(NPObject *obj);
76 typedef void (*NPN_ReleaseObjectProcPtr)(NPObject *obj);
77 typedef bool (*NPN_InvokeProcPtr)(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result);
78 typedef bool (*NPN_InvokeDefaultProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
79 typedef bool (*NPN_EvaluateProcPtr)(NPP npp, NPObject *obj, NPString *script, NPVariant *result);
80 typedef bool (*NPN_GetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result);
81 typedef bool (*NPN_SetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value);
82 typedef bool (*NPN_RemovePropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
83 typedef bool (*NPN_HasPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
84 typedef bool (*NPN_HasMethodProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
85 typedef void (*NPN_ReleaseVariantValueProcPtr)(NPVariant *variant);
86 typedef void (*NPN_SetExceptionProcPtr)(NPObject *obj, const NPUTF8 *message);
87 typedef void (*NPN_PushPopupsEnabledStateProcPtr)(NPP npp, NPBool enabled);
89 typedef bool (*NPN_EnumerateProcPtr)(NPP npp, NPObject *obj, NPIdentifier **identifier, uint32_t *count);
90 typedef void (*NPN_PluginThreadAsyncCallProcPtr)(NPP instance, void (*func)(void *), void *userData);
91 typedef bool (*NPN_ConstructProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
92 typedef NPError (*NPN_GetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, char **value, uint32_t *len);
93 typedef NPError (*NPN_SetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, const char *value, uint32_t len);
94 typedef 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);
95 typedef uint32_t (*NPN_ScheduleTimerPtr)(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
96 typedef void (*NPN_UnscheduleTimerPtr)(NPP instance, uint32_t timerID);
97 typedef NPError (*NPN_PopUpContextMenuPtr)(NPP instance, NPMenu* menu);
98 typedef NPBool (*NPN_ConvertPointPtr)(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
99 typedef NPBool (*NPN_HandleEventPtr)(NPP instance, void *event, NPBool handled);
100 typedef NPBool (*NPN_UnfocusInstancePtr)(NPP instance, NPFocusDirection direction);
101 typedef void (*NPN_URLRedirectResponsePtr)(NPP instance, void* notifyData, NPBool allow);
102 typedef NPError (*NPN_InitAsyncSurfacePtr)(NPP instance, NPSize *size, NPImageFormat format, void *initData, NPAsyncSurface *surface);
103 typedef NPError (*NPN_FinalizeAsyncSurfacePtr)(NPP instance, NPAsyncSurface *surface);
104 typedef void (*NPN_SetCurrentAsyncSurfacePtr)(NPP instance, NPAsyncSurface *surface, NPRect *changed);
105 
106 typedef struct _NPPluginFuncs {
107  uint16_t size;
108  uint16_t version;
109  NPP_NewProcPtr newp;
110  NPP_DestroyProcPtr destroy;
111  NPP_SetWindowProcPtr setwindow;
112  NPP_NewStreamProcPtr newstream;
113  NPP_DestroyStreamProcPtr destroystream;
114  NPP_StreamAsFileProcPtr asfile;
115  NPP_WriteReadyProcPtr writeready;
116  NPP_WriteProcPtr write;
117  NPP_PrintProcPtr print;
118  NPP_HandleEventProcPtr event;
119  NPP_URLNotifyProcPtr urlnotify;
120  void* javaClass;
121  NPP_GetValueProcPtr getvalue;
122  NPP_SetValueProcPtr setvalue;
123  NPP_GotFocusPtr gotfocus;
124  NPP_LostFocusPtr lostfocus;
125  NPP_URLRedirectNotifyPtr urlredirectnotify;
126  NPP_ClearSiteDataPtr clearsitedata;
127  NPP_GetSitesWithDataPtr getsiteswithdata;
128  NPP_DidCompositePtr didComposite;
129 } NPPluginFuncs;
130 
131 typedef struct _NPNetscapeFuncs {
132  uint16_t size;
133  uint16_t version;
193 
194 #ifdef XP_MACOSX
195 /*
196  * Mac OS X version(s) of NP_GetMIMEDescription(const char *)
197  * These can be called to retreive MIME information from the plugin dynamically
198  *
199  * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way
200  * to get mime info from the plugin only on OSX and may not be supported
201  * in furture version -- use NP_GetMIMEDescription instead
202  */
203 enum
204 {
205  kBPSupportedMIMETypesStructVers_1 = 1
206 };
207 typedef struct _BPSupportedMIMETypes
208 {
209  SInt32 structVersion; /* struct version */
210  Handle typeStrings; /* STR# formated handle, allocated by plug-in */
211  Handle infoStrings; /* STR# formated handle, allocated by plug-in */
212 } BPSupportedMIMETypes;
213 OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags);
214 #define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription"
215 typedef const char* (*NP_GetMIMEDescriptionProcPtr)(void);
216 typedef OSErr (*BP_GetSupportedMIMETypesProcPtr)(BPSupportedMIMETypes*, UInt32);
217 #endif
218 
219 #if defined(_WIN32)
220 #define OSCALL WINAPI
221 #else
222 #if defined(__OS2__)
223 #define OSCALL _System
224 #else
225 #define OSCALL
226 #endif
227 #endif
228 
229 #if defined(XP_UNIX)
230 /* GCC 3.3 and later support the visibility attribute. */
231 #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
232 #define NP_VISIBILITY_DEFAULT __attribute__((visibility("default")))
233 #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
234 #define NP_VISIBILITY_DEFAULT __global
235 #else
236 #define NP_VISIBILITY_DEFAULT
237 #endif
238 #define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type
239 #endif
240 
241 #if defined(_WIN32) || defined (__OS2__)
242 #ifdef __cplusplus
243 extern "C" {
244 #endif
245 /* plugin meta member functions */
246 #if defined(__OS2__)
247 typedef struct _NPPluginData { /* Alternate OS2 Plugin interface */
248  char *pMimeTypes;
249  char *pFileExtents;
250  char *pFileOpenTemplate;
251  char *pProductName;
252  char *pProductDescription;
253  unsigned long dwProductVersionMS;
254  unsigned long dwProductVersionLS;
255 } NPPluginData;
256 typedef NPError (OSCALL *NP_GetPluginDataFunc)(NPPluginData*);
257 NPError OSCALL NP_GetPluginData(NPPluginData * pPluginData);
258 #endif
259 typedef NPError (OSCALL *NP_GetEntryPointsFunc)(NPPluginFuncs*);
260 NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs);
261 typedef NPError (OSCALL *NP_InitializeFunc)(NPNetscapeFuncs*);
263 typedef NPError (OSCALL *NP_ShutdownFunc)(void);
265 typedef const char* (*NP_GetMIMEDescriptionFunc)(void);
266 const char* NP_GetMIMEDescription(void);
267 #ifdef __cplusplus
268 }
269 #endif
270 #endif
271 
272 #if defined(__OS2__)
273 #pragma pack()
274 #endif
275 
276 #ifdef XP_UNIX
277 #ifdef __cplusplus
278 extern "C" {
279 #endif
280 typedef char* (*NP_GetPluginVersionFunc)(void);
281 NP_EXPORT(char*) NP_GetPluginVersion(void);
282 typedef const char* (*NP_GetMIMEDescriptionFunc)(void);
283 NP_EXPORT(const char*) NP_GetMIMEDescription(void);
284 #ifdef XP_MACOSX
285 typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*);
286 NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs);
287 typedef NPError (*NP_GetEntryPointsFunc)(NPPluginFuncs*);
288 NP_EXPORT(NPError) NP_GetEntryPoints(NPPluginFuncs* pFuncs);
289 #else
290 #ifdef MOZ_WIDGET_ANDROID
291 typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*, NPPluginFuncs*, JNIEnv* pEnv);
292 NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, JNIEnv* pEnv);
293 #else
294 typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*, NPPluginFuncs*);
295 NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs);
296 #endif
297 #endif
298 typedef NPError (*NP_ShutdownFunc)(void);
299 NP_EXPORT(NPError) NP_Shutdown(void);
300 typedef NPError (*NP_GetValueFunc)(void *, NPPVariable, void *);
301 NP_EXPORT(NPError) NP_GetValue(void *future, NPPVariable aVariable, void *aValue);
302 #ifdef __cplusplus
303 }
304 #endif
305 #endif
306 
307 #endif /* npfunctions_h_ */