dom/plugins/base/npfunctions.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef npfunctions_h_
michael@0 7 #define npfunctions_h_
michael@0 8
michael@0 9 #include "npapi.h"
michael@0 10 #include "npruntime.h"
michael@0 11
michael@0 12 #ifdef MOZ_WIDGET_ANDROID
michael@0 13 #include <jni.h>
michael@0 14 #endif
michael@0 15
michael@0 16 typedef NPError (* NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved);
michael@0 17 typedef NPError (* NPP_DestroyProcPtr)(NPP instance, NPSavedData** save);
michael@0 18 typedef NPError (* NPP_SetWindowProcPtr)(NPP instance, NPWindow* window);
michael@0 19 typedef NPError (* NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype);
michael@0 20 typedef NPError (* NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
michael@0 21 typedef int32_t (* NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream);
michael@0 22 typedef int32_t (* NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
michael@0 23 typedef void (* NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname);
michael@0 24 typedef void (* NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint);
michael@0 25 typedef int16_t (* NPP_HandleEventProcPtr)(NPP instance, void* event);
michael@0 26 typedef void (* NPP_URLNotifyProcPtr)(NPP instance, const char* url, NPReason reason, void* notifyData);
michael@0 27 /* Any NPObjects returned to the browser via NPP_GetValue should be retained
michael@0 28 by the plugin on the way out. The browser is responsible for releasing. */
michael@0 29 typedef NPError (* NPP_GetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value);
michael@0 30 typedef NPError (* NPP_SetValueProcPtr)(NPP instance, NPNVariable variable, void *value);
michael@0 31 typedef NPBool (* NPP_GotFocusPtr)(NPP instance, NPFocusDirection direction);
michael@0 32 typedef void (* NPP_LostFocusPtr)(NPP instance);
michael@0 33 typedef void (* NPP_URLRedirectNotifyPtr)(NPP instance, const char* url, int32_t status, void* notifyData);
michael@0 34 typedef NPError (* NPP_ClearSiteDataPtr)(const char* site, uint64_t flags, uint64_t maxAge);
michael@0 35 typedef char** (* NPP_GetSitesWithDataPtr)(void);
michael@0 36 typedef void (* NPP_DidCompositePtr)(NPP instance);
michael@0 37
michael@0 38 typedef NPError (*NPN_GetValueProcPtr)(NPP instance, NPNVariable variable, void *ret_value);
michael@0 39 typedef NPError (*NPN_SetValueProcPtr)(NPP instance, NPPVariable variable, void *value);
michael@0 40 typedef NPError (*NPN_GetURLNotifyProcPtr)(NPP instance, const char* url, const char* window, void* notifyData);
michael@0 41 typedef NPError (*NPN_PostURLNotifyProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData);
michael@0 42 typedef NPError (*NPN_GetURLProcPtr)(NPP instance, const char* url, const char* window);
michael@0 43 typedef NPError (*NPN_PostURLProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file);
michael@0 44 typedef NPError (*NPN_RequestReadProcPtr)(NPStream* stream, NPByteRange* rangeList);
michael@0 45 typedef NPError (*NPN_NewStreamProcPtr)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
michael@0 46 typedef int32_t (*NPN_WriteProcPtr)(NPP instance, NPStream* stream, int32_t len, void* buffer);
michael@0 47 typedef NPError (*NPN_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
michael@0 48 typedef void (*NPN_StatusProcPtr)(NPP instance, const char* message);
michael@0 49 /* Browser manages the lifetime of the buffer returned by NPN_UserAgent, don't
michael@0 50 depend on it sticking around and don't free it. */
michael@0 51 typedef const char* (*NPN_UserAgentProcPtr)(NPP instance);
michael@0 52 typedef void* (*NPN_MemAllocProcPtr)(uint32_t size);
michael@0 53 typedef void (*NPN_MemFreeProcPtr)(void* ptr);
michael@0 54 typedef uint32_t (*NPN_MemFlushProcPtr)(uint32_t size);
michael@0 55 typedef void (*NPN_ReloadPluginsProcPtr)(NPBool reloadPages);
michael@0 56 typedef void* (*NPN_GetJavaEnvProcPtr)(void);
michael@0 57 typedef void* (*NPN_GetJavaPeerProcPtr)(NPP instance);
michael@0 58 typedef void (*NPN_InvalidateRectProcPtr)(NPP instance, NPRect *rect);
michael@0 59 typedef void (*NPN_InvalidateRegionProcPtr)(NPP instance, NPRegion region);
michael@0 60 typedef void (*NPN_ForceRedrawProcPtr)(NPP instance);
michael@0 61 typedef NPIdentifier (*NPN_GetStringIdentifierProcPtr)(const NPUTF8* name);
michael@0 62 typedef void (*NPN_GetStringIdentifiersProcPtr)(const NPUTF8** names, int32_t nameCount, NPIdentifier* identifiers);
michael@0 63 typedef NPIdentifier (*NPN_GetIntIdentifierProcPtr)(int32_t intid);
michael@0 64 typedef bool (*NPN_IdentifierIsStringProcPtr)(NPIdentifier identifier);
michael@0 65 typedef NPUTF8* (*NPN_UTF8FromIdentifierProcPtr)(NPIdentifier identifier);
michael@0 66 typedef int32_t (*NPN_IntFromIdentifierProcPtr)(NPIdentifier identifier);
michael@0 67 typedef NPObject* (*NPN_CreateObjectProcPtr)(NPP npp, NPClass *aClass);
michael@0 68 typedef NPObject* (*NPN_RetainObjectProcPtr)(NPObject *obj);
michael@0 69 typedef void (*NPN_ReleaseObjectProcPtr)(NPObject *obj);
michael@0 70 typedef bool (*NPN_InvokeProcPtr)(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result);
michael@0 71 typedef bool (*NPN_InvokeDefaultProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
michael@0 72 typedef bool (*NPN_EvaluateProcPtr)(NPP npp, NPObject *obj, NPString *script, NPVariant *result);
michael@0 73 typedef bool (*NPN_GetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result);
michael@0 74 typedef bool (*NPN_SetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value);
michael@0 75 typedef bool (*NPN_RemovePropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
michael@0 76 typedef bool (*NPN_HasPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
michael@0 77 typedef bool (*NPN_HasMethodProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
michael@0 78 typedef void (*NPN_ReleaseVariantValueProcPtr)(NPVariant *variant);
michael@0 79 typedef void (*NPN_SetExceptionProcPtr)(NPObject *obj, const NPUTF8 *message);
michael@0 80 typedef void (*NPN_PushPopupsEnabledStateProcPtr)(NPP npp, NPBool enabled);
michael@0 81 typedef void (*NPN_PopPopupsEnabledStateProcPtr)(NPP npp);
michael@0 82 typedef bool (*NPN_EnumerateProcPtr)(NPP npp, NPObject *obj, NPIdentifier **identifier, uint32_t *count);
michael@0 83 typedef void (*NPN_PluginThreadAsyncCallProcPtr)(NPP instance, void (*func)(void *), void *userData);
michael@0 84 typedef bool (*NPN_ConstructProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
michael@0 85 typedef NPError (*NPN_GetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, char **value, uint32_t *len);
michael@0 86 typedef NPError (*NPN_SetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, const char *value, uint32_t len);
michael@0 87 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);
michael@0 88 typedef uint32_t (*NPN_ScheduleTimerPtr)(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
michael@0 89 typedef void (*NPN_UnscheduleTimerPtr)(NPP instance, uint32_t timerID);
michael@0 90 typedef NPError (*NPN_PopUpContextMenuPtr)(NPP instance, NPMenu* menu);
michael@0 91 typedef NPBool (*NPN_ConvertPointPtr)(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
michael@0 92 typedef NPBool (*NPN_HandleEventPtr)(NPP instance, void *event, NPBool handled);
michael@0 93 typedef NPBool (*NPN_UnfocusInstancePtr)(NPP instance, NPFocusDirection direction);
michael@0 94 typedef void (*NPN_URLRedirectResponsePtr)(NPP instance, void* notifyData, NPBool allow);
michael@0 95 typedef NPError (*NPN_InitAsyncSurfacePtr)(NPP instance, NPSize *size, NPImageFormat format, void *initData, NPAsyncSurface *surface);
michael@0 96 typedef NPError (*NPN_FinalizeAsyncSurfacePtr)(NPP instance, NPAsyncSurface *surface);
michael@0 97 typedef void (*NPN_SetCurrentAsyncSurfacePtr)(NPP instance, NPAsyncSurface *surface, NPRect *changed);
michael@0 98
michael@0 99 typedef struct _NPPluginFuncs {
michael@0 100 uint16_t size;
michael@0 101 uint16_t version;
michael@0 102 NPP_NewProcPtr newp;
michael@0 103 NPP_DestroyProcPtr destroy;
michael@0 104 NPP_SetWindowProcPtr setwindow;
michael@0 105 NPP_NewStreamProcPtr newstream;
michael@0 106 NPP_DestroyStreamProcPtr destroystream;
michael@0 107 NPP_StreamAsFileProcPtr asfile;
michael@0 108 NPP_WriteReadyProcPtr writeready;
michael@0 109 NPP_WriteProcPtr write;
michael@0 110 NPP_PrintProcPtr print;
michael@0 111 NPP_HandleEventProcPtr event;
michael@0 112 NPP_URLNotifyProcPtr urlnotify;
michael@0 113 void* javaClass;
michael@0 114 NPP_GetValueProcPtr getvalue;
michael@0 115 NPP_SetValueProcPtr setvalue;
michael@0 116 NPP_GotFocusPtr gotfocus;
michael@0 117 NPP_LostFocusPtr lostfocus;
michael@0 118 NPP_URLRedirectNotifyPtr urlredirectnotify;
michael@0 119 NPP_ClearSiteDataPtr clearsitedata;
michael@0 120 NPP_GetSitesWithDataPtr getsiteswithdata;
michael@0 121 NPP_DidCompositePtr didComposite;
michael@0 122 } NPPluginFuncs;
michael@0 123
michael@0 124 typedef struct _NPNetscapeFuncs {
michael@0 125 uint16_t size;
michael@0 126 uint16_t version;
michael@0 127 NPN_GetURLProcPtr geturl;
michael@0 128 NPN_PostURLProcPtr posturl;
michael@0 129 NPN_RequestReadProcPtr requestread;
michael@0 130 NPN_NewStreamProcPtr newstream;
michael@0 131 NPN_WriteProcPtr write;
michael@0 132 NPN_DestroyStreamProcPtr destroystream;
michael@0 133 NPN_StatusProcPtr status;
michael@0 134 NPN_UserAgentProcPtr uagent;
michael@0 135 NPN_MemAllocProcPtr memalloc;
michael@0 136 NPN_MemFreeProcPtr memfree;
michael@0 137 NPN_MemFlushProcPtr memflush;
michael@0 138 NPN_ReloadPluginsProcPtr reloadplugins;
michael@0 139 NPN_GetJavaEnvProcPtr getJavaEnv;
michael@0 140 NPN_GetJavaPeerProcPtr getJavaPeer;
michael@0 141 NPN_GetURLNotifyProcPtr geturlnotify;
michael@0 142 NPN_PostURLNotifyProcPtr posturlnotify;
michael@0 143 NPN_GetValueProcPtr getvalue;
michael@0 144 NPN_SetValueProcPtr setvalue;
michael@0 145 NPN_InvalidateRectProcPtr invalidaterect;
michael@0 146 NPN_InvalidateRegionProcPtr invalidateregion;
michael@0 147 NPN_ForceRedrawProcPtr forceredraw;
michael@0 148 NPN_GetStringIdentifierProcPtr getstringidentifier;
michael@0 149 NPN_GetStringIdentifiersProcPtr getstringidentifiers;
michael@0 150 NPN_GetIntIdentifierProcPtr getintidentifier;
michael@0 151 NPN_IdentifierIsStringProcPtr identifierisstring;
michael@0 152 NPN_UTF8FromIdentifierProcPtr utf8fromidentifier;
michael@0 153 NPN_IntFromIdentifierProcPtr intfromidentifier;
michael@0 154 NPN_CreateObjectProcPtr createobject;
michael@0 155 NPN_RetainObjectProcPtr retainobject;
michael@0 156 NPN_ReleaseObjectProcPtr releaseobject;
michael@0 157 NPN_InvokeProcPtr invoke;
michael@0 158 NPN_InvokeDefaultProcPtr invokeDefault;
michael@0 159 NPN_EvaluateProcPtr evaluate;
michael@0 160 NPN_GetPropertyProcPtr getproperty;
michael@0 161 NPN_SetPropertyProcPtr setproperty;
michael@0 162 NPN_RemovePropertyProcPtr removeproperty;
michael@0 163 NPN_HasPropertyProcPtr hasproperty;
michael@0 164 NPN_HasMethodProcPtr hasmethod;
michael@0 165 NPN_ReleaseVariantValueProcPtr releasevariantvalue;
michael@0 166 NPN_SetExceptionProcPtr setexception;
michael@0 167 NPN_PushPopupsEnabledStateProcPtr pushpopupsenabledstate;
michael@0 168 NPN_PopPopupsEnabledStateProcPtr poppopupsenabledstate;
michael@0 169 NPN_EnumerateProcPtr enumerate;
michael@0 170 NPN_PluginThreadAsyncCallProcPtr pluginthreadasynccall;
michael@0 171 NPN_ConstructProcPtr construct;
michael@0 172 NPN_GetValueForURLPtr getvalueforurl;
michael@0 173 NPN_SetValueForURLPtr setvalueforurl;
michael@0 174 NPN_GetAuthenticationInfoPtr getauthenticationinfo;
michael@0 175 NPN_ScheduleTimerPtr scheduletimer;
michael@0 176 NPN_UnscheduleTimerPtr unscheduletimer;
michael@0 177 NPN_PopUpContextMenuPtr popupcontextmenu;
michael@0 178 NPN_ConvertPointPtr convertpoint;
michael@0 179 NPN_HandleEventPtr handleevent;
michael@0 180 NPN_UnfocusInstancePtr unfocusinstance;
michael@0 181 NPN_URLRedirectResponsePtr urlredirectresponse;
michael@0 182 NPN_InitAsyncSurfacePtr initasyncsurface;
michael@0 183 NPN_FinalizeAsyncSurfacePtr finalizeasyncsurface;
michael@0 184 NPN_SetCurrentAsyncSurfacePtr setcurrentasyncsurface;
michael@0 185 } NPNetscapeFuncs;
michael@0 186
michael@0 187 #ifdef XP_MACOSX
michael@0 188 /*
michael@0 189 * Mac OS X version(s) of NP_GetMIMEDescription(const char *)
michael@0 190 * These can be called to retreive MIME information from the plugin dynamically
michael@0 191 *
michael@0 192 * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way
michael@0 193 * to get mime info from the plugin only on OSX and may not be supported
michael@0 194 * in furture version -- use NP_GetMIMEDescription instead
michael@0 195 */
michael@0 196 enum
michael@0 197 {
michael@0 198 kBPSupportedMIMETypesStructVers_1 = 1
michael@0 199 };
michael@0 200 typedef struct _BPSupportedMIMETypes
michael@0 201 {
michael@0 202 SInt32 structVersion; /* struct version */
michael@0 203 Handle typeStrings; /* STR# formated handle, allocated by plug-in */
michael@0 204 Handle infoStrings; /* STR# formated handle, allocated by plug-in */
michael@0 205 } BPSupportedMIMETypes;
michael@0 206 OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags);
michael@0 207 #define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription"
michael@0 208 typedef const char* (*NP_GetMIMEDescriptionProcPtr)(void);
michael@0 209 typedef OSErr (*BP_GetSupportedMIMETypesProcPtr)(BPSupportedMIMETypes*, UInt32);
michael@0 210 #endif
michael@0 211
michael@0 212 #if defined(_WIN32)
michael@0 213 #define OSCALL WINAPI
michael@0 214 #else
michael@0 215 #define OSCALL
michael@0 216 #endif
michael@0 217
michael@0 218 #if defined(XP_UNIX)
michael@0 219 /* GCC 3.3 and later support the visibility attribute. */
michael@0 220 #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
michael@0 221 #define NP_VISIBILITY_DEFAULT __attribute__((visibility("default")))
michael@0 222 #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
michael@0 223 #define NP_VISIBILITY_DEFAULT __global
michael@0 224 #else
michael@0 225 #define NP_VISIBILITY_DEFAULT
michael@0 226 #endif
michael@0 227 #define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type
michael@0 228 #endif
michael@0 229
michael@0 230 #if defined(_WIN32)
michael@0 231 #ifdef __cplusplus
michael@0 232 extern "C" {
michael@0 233 #endif
michael@0 234 /* plugin meta member functions */
michael@0 235 typedef NPError (OSCALL *NP_GetEntryPointsFunc)(NPPluginFuncs*);
michael@0 236 NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs);
michael@0 237 typedef NPError (OSCALL *NP_InitializeFunc)(NPNetscapeFuncs*);
michael@0 238 NPError OSCALL NP_Initialize(NPNetscapeFuncs* bFuncs);
michael@0 239 typedef NPError (OSCALL *NP_ShutdownFunc)(void);
michael@0 240 NPError OSCALL NP_Shutdown(void);
michael@0 241 typedef const char* (*NP_GetMIMEDescriptionFunc)(void);
michael@0 242 const char* NP_GetMIMEDescription(void);
michael@0 243 #ifdef __cplusplus
michael@0 244 }
michael@0 245 #endif
michael@0 246 #endif
michael@0 247
michael@0 248 #ifdef XP_UNIX
michael@0 249 #ifdef __cplusplus
michael@0 250 extern "C" {
michael@0 251 #endif
michael@0 252 typedef char* (*NP_GetPluginVersionFunc)(void);
michael@0 253 NP_EXPORT(char*) NP_GetPluginVersion(void);
michael@0 254 typedef const char* (*NP_GetMIMEDescriptionFunc)(void);
michael@0 255 NP_EXPORT(const char*) NP_GetMIMEDescription(void);
michael@0 256 #ifdef XP_MACOSX
michael@0 257 typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*);
michael@0 258 NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs);
michael@0 259 typedef NPError (*NP_GetEntryPointsFunc)(NPPluginFuncs*);
michael@0 260 NP_EXPORT(NPError) NP_GetEntryPoints(NPPluginFuncs* pFuncs);
michael@0 261 #else
michael@0 262 #ifdef MOZ_WIDGET_ANDROID
michael@0 263 typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*, NPPluginFuncs*, JNIEnv* pEnv);
michael@0 264 NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, JNIEnv* pEnv);
michael@0 265 #else
michael@0 266 typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*, NPPluginFuncs*);
michael@0 267 NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs);
michael@0 268 #endif
michael@0 269 #endif
michael@0 270 typedef NPError (*NP_ShutdownFunc)(void);
michael@0 271 NP_EXPORT(NPError) NP_Shutdown(void);
michael@0 272 typedef NPError (*NP_GetValueFunc)(void *, NPPVariable, void *);
michael@0 273 NP_EXPORT(NPError) NP_GetValue(void *future, NPPVariable aVariable, void *aValue);
michael@0 274 #ifdef __cplusplus
michael@0 275 }
michael@0 276 #endif
michael@0 277 #endif
michael@0 278
michael@0 279 #endif /* npfunctions_h_ */

mercurial