dom/plugins/base/npfunctions.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/plugins/base/npfunctions.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,279 @@
     1.4 +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef npfunctions_h_
    1.10 +#define npfunctions_h_
    1.11 +
    1.12 +#include "npapi.h"
    1.13 +#include "npruntime.h"
    1.14 +
    1.15 +#ifdef MOZ_WIDGET_ANDROID
    1.16 +#include <jni.h>
    1.17 +#endif
    1.18 +
    1.19 +typedef NPError      (* NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved);
    1.20 +typedef NPError      (* NPP_DestroyProcPtr)(NPP instance, NPSavedData** save);
    1.21 +typedef NPError      (* NPP_SetWindowProcPtr)(NPP instance, NPWindow* window);
    1.22 +typedef NPError      (* NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype);
    1.23 +typedef NPError      (* NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
    1.24 +typedef int32_t      (* NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream);
    1.25 +typedef int32_t      (* NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
    1.26 +typedef void         (* NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname);
    1.27 +typedef void         (* NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint);
    1.28 +typedef int16_t      (* NPP_HandleEventProcPtr)(NPP instance, void* event);
    1.29 +typedef void         (* NPP_URLNotifyProcPtr)(NPP instance, const char* url, NPReason reason, void* notifyData);
    1.30 +/* Any NPObjects returned to the browser via NPP_GetValue should be retained
    1.31 +   by the plugin on the way out. The browser is responsible for releasing. */
    1.32 +typedef NPError      (* NPP_GetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value);
    1.33 +typedef NPError      (* NPP_SetValueProcPtr)(NPP instance, NPNVariable variable, void *value);
    1.34 +typedef NPBool       (* NPP_GotFocusPtr)(NPP instance, NPFocusDirection direction);
    1.35 +typedef void         (* NPP_LostFocusPtr)(NPP instance);
    1.36 +typedef void         (* NPP_URLRedirectNotifyPtr)(NPP instance, const char* url, int32_t status, void* notifyData);
    1.37 +typedef NPError      (* NPP_ClearSiteDataPtr)(const char* site, uint64_t flags, uint64_t maxAge);
    1.38 +typedef char**       (* NPP_GetSitesWithDataPtr)(void);
    1.39 +typedef void         (* NPP_DidCompositePtr)(NPP instance);
    1.40 +
    1.41 +typedef NPError      (*NPN_GetValueProcPtr)(NPP instance, NPNVariable variable, void *ret_value);
    1.42 +typedef NPError      (*NPN_SetValueProcPtr)(NPP instance, NPPVariable variable, void *value);
    1.43 +typedef NPError      (*NPN_GetURLNotifyProcPtr)(NPP instance, const char* url, const char* window, void* notifyData);
    1.44 +typedef NPError      (*NPN_PostURLNotifyProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData);
    1.45 +typedef NPError      (*NPN_GetURLProcPtr)(NPP instance, const char* url, const char* window);
    1.46 +typedef NPError      (*NPN_PostURLProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file);
    1.47 +typedef NPError      (*NPN_RequestReadProcPtr)(NPStream* stream, NPByteRange* rangeList);
    1.48 +typedef NPError      (*NPN_NewStreamProcPtr)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
    1.49 +typedef int32_t      (*NPN_WriteProcPtr)(NPP instance, NPStream* stream, int32_t len, void* buffer);
    1.50 +typedef NPError      (*NPN_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
    1.51 +typedef void         (*NPN_StatusProcPtr)(NPP instance, const char* message);
    1.52 +/* Browser manages the lifetime of the buffer returned by NPN_UserAgent, don't
    1.53 +   depend on it sticking around and don't free it. */
    1.54 +typedef const char*  (*NPN_UserAgentProcPtr)(NPP instance);
    1.55 +typedef void*        (*NPN_MemAllocProcPtr)(uint32_t size);
    1.56 +typedef void         (*NPN_MemFreeProcPtr)(void* ptr);
    1.57 +typedef uint32_t     (*NPN_MemFlushProcPtr)(uint32_t size);
    1.58 +typedef void         (*NPN_ReloadPluginsProcPtr)(NPBool reloadPages);
    1.59 +typedef void*        (*NPN_GetJavaEnvProcPtr)(void);
    1.60 +typedef void*        (*NPN_GetJavaPeerProcPtr)(NPP instance);
    1.61 +typedef void         (*NPN_InvalidateRectProcPtr)(NPP instance, NPRect *rect);
    1.62 +typedef void         (*NPN_InvalidateRegionProcPtr)(NPP instance, NPRegion region);
    1.63 +typedef void         (*NPN_ForceRedrawProcPtr)(NPP instance);
    1.64 +typedef NPIdentifier (*NPN_GetStringIdentifierProcPtr)(const NPUTF8* name);
    1.65 +typedef void         (*NPN_GetStringIdentifiersProcPtr)(const NPUTF8** names, int32_t nameCount, NPIdentifier* identifiers);
    1.66 +typedef NPIdentifier (*NPN_GetIntIdentifierProcPtr)(int32_t intid);
    1.67 +typedef bool         (*NPN_IdentifierIsStringProcPtr)(NPIdentifier identifier);
    1.68 +typedef NPUTF8*      (*NPN_UTF8FromIdentifierProcPtr)(NPIdentifier identifier);
    1.69 +typedef int32_t      (*NPN_IntFromIdentifierProcPtr)(NPIdentifier identifier);
    1.70 +typedef NPObject*    (*NPN_CreateObjectProcPtr)(NPP npp, NPClass *aClass);
    1.71 +typedef NPObject*    (*NPN_RetainObjectProcPtr)(NPObject *obj);
    1.72 +typedef void         (*NPN_ReleaseObjectProcPtr)(NPObject *obj);
    1.73 +typedef bool         (*NPN_InvokeProcPtr)(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result);
    1.74 +typedef bool         (*NPN_InvokeDefaultProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
    1.75 +typedef bool         (*NPN_EvaluateProcPtr)(NPP npp, NPObject *obj, NPString *script, NPVariant *result);
    1.76 +typedef bool         (*NPN_GetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result);
    1.77 +typedef bool         (*NPN_SetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value);
    1.78 +typedef bool         (*NPN_RemovePropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
    1.79 +typedef bool         (*NPN_HasPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
    1.80 +typedef bool         (*NPN_HasMethodProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
    1.81 +typedef void         (*NPN_ReleaseVariantValueProcPtr)(NPVariant *variant);
    1.82 +typedef void         (*NPN_SetExceptionProcPtr)(NPObject *obj, const NPUTF8 *message);
    1.83 +typedef void         (*NPN_PushPopupsEnabledStateProcPtr)(NPP npp, NPBool enabled);
    1.84 +typedef void         (*NPN_PopPopupsEnabledStateProcPtr)(NPP npp);
    1.85 +typedef bool         (*NPN_EnumerateProcPtr)(NPP npp, NPObject *obj, NPIdentifier **identifier, uint32_t *count);
    1.86 +typedef void         (*NPN_PluginThreadAsyncCallProcPtr)(NPP instance, void (*func)(void *), void *userData);
    1.87 +typedef bool         (*NPN_ConstructProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
    1.88 +typedef NPError      (*NPN_GetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, char **value, uint32_t *len);
    1.89 +typedef NPError      (*NPN_SetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, const char *value, uint32_t len);
    1.90 +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);
    1.91 +typedef uint32_t     (*NPN_ScheduleTimerPtr)(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
    1.92 +typedef void         (*NPN_UnscheduleTimerPtr)(NPP instance, uint32_t timerID);
    1.93 +typedef NPError      (*NPN_PopUpContextMenuPtr)(NPP instance, NPMenu* menu);
    1.94 +typedef NPBool       (*NPN_ConvertPointPtr)(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
    1.95 +typedef NPBool       (*NPN_HandleEventPtr)(NPP instance, void *event, NPBool handled);
    1.96 +typedef NPBool       (*NPN_UnfocusInstancePtr)(NPP instance, NPFocusDirection direction);
    1.97 +typedef void         (*NPN_URLRedirectResponsePtr)(NPP instance, void* notifyData, NPBool allow);
    1.98 +typedef NPError      (*NPN_InitAsyncSurfacePtr)(NPP instance, NPSize *size, NPImageFormat format, void *initData, NPAsyncSurface *surface);
    1.99 +typedef NPError      (*NPN_FinalizeAsyncSurfacePtr)(NPP instance, NPAsyncSurface *surface);
   1.100 +typedef void         (*NPN_SetCurrentAsyncSurfacePtr)(NPP instance, NPAsyncSurface *surface, NPRect *changed);
   1.101 +
   1.102 +typedef struct _NPPluginFuncs {
   1.103 +  uint16_t size;
   1.104 +  uint16_t version;
   1.105 +  NPP_NewProcPtr newp;
   1.106 +  NPP_DestroyProcPtr destroy;
   1.107 +  NPP_SetWindowProcPtr setwindow;
   1.108 +  NPP_NewStreamProcPtr newstream;
   1.109 +  NPP_DestroyStreamProcPtr destroystream;
   1.110 +  NPP_StreamAsFileProcPtr asfile;
   1.111 +  NPP_WriteReadyProcPtr writeready;
   1.112 +  NPP_WriteProcPtr write;
   1.113 +  NPP_PrintProcPtr print;
   1.114 +  NPP_HandleEventProcPtr event;
   1.115 +  NPP_URLNotifyProcPtr urlnotify;
   1.116 +  void* javaClass;
   1.117 +  NPP_GetValueProcPtr getvalue;
   1.118 +  NPP_SetValueProcPtr setvalue;
   1.119 +  NPP_GotFocusPtr gotfocus;
   1.120 +  NPP_LostFocusPtr lostfocus;
   1.121 +  NPP_URLRedirectNotifyPtr urlredirectnotify;
   1.122 +  NPP_ClearSiteDataPtr clearsitedata;
   1.123 +  NPP_GetSitesWithDataPtr getsiteswithdata;
   1.124 +  NPP_DidCompositePtr didComposite;
   1.125 +} NPPluginFuncs;
   1.126 +
   1.127 +typedef struct _NPNetscapeFuncs {
   1.128 +  uint16_t size;
   1.129 +  uint16_t version;
   1.130 +  NPN_GetURLProcPtr geturl;
   1.131 +  NPN_PostURLProcPtr posturl;
   1.132 +  NPN_RequestReadProcPtr requestread;
   1.133 +  NPN_NewStreamProcPtr newstream;
   1.134 +  NPN_WriteProcPtr write;
   1.135 +  NPN_DestroyStreamProcPtr destroystream;
   1.136 +  NPN_StatusProcPtr status;
   1.137 +  NPN_UserAgentProcPtr uagent;
   1.138 +  NPN_MemAllocProcPtr memalloc;
   1.139 +  NPN_MemFreeProcPtr memfree;
   1.140 +  NPN_MemFlushProcPtr memflush;
   1.141 +  NPN_ReloadPluginsProcPtr reloadplugins;
   1.142 +  NPN_GetJavaEnvProcPtr getJavaEnv;
   1.143 +  NPN_GetJavaPeerProcPtr getJavaPeer;
   1.144 +  NPN_GetURLNotifyProcPtr geturlnotify;
   1.145 +  NPN_PostURLNotifyProcPtr posturlnotify;
   1.146 +  NPN_GetValueProcPtr getvalue;
   1.147 +  NPN_SetValueProcPtr setvalue;
   1.148 +  NPN_InvalidateRectProcPtr invalidaterect;
   1.149 +  NPN_InvalidateRegionProcPtr invalidateregion;
   1.150 +  NPN_ForceRedrawProcPtr forceredraw;
   1.151 +  NPN_GetStringIdentifierProcPtr getstringidentifier;
   1.152 +  NPN_GetStringIdentifiersProcPtr getstringidentifiers;
   1.153 +  NPN_GetIntIdentifierProcPtr getintidentifier;
   1.154 +  NPN_IdentifierIsStringProcPtr identifierisstring;
   1.155 +  NPN_UTF8FromIdentifierProcPtr utf8fromidentifier;
   1.156 +  NPN_IntFromIdentifierProcPtr intfromidentifier;
   1.157 +  NPN_CreateObjectProcPtr createobject;
   1.158 +  NPN_RetainObjectProcPtr retainobject;
   1.159 +  NPN_ReleaseObjectProcPtr releaseobject;
   1.160 +  NPN_InvokeProcPtr invoke;
   1.161 +  NPN_InvokeDefaultProcPtr invokeDefault;
   1.162 +  NPN_EvaluateProcPtr evaluate;
   1.163 +  NPN_GetPropertyProcPtr getproperty;
   1.164 +  NPN_SetPropertyProcPtr setproperty;
   1.165 +  NPN_RemovePropertyProcPtr removeproperty;
   1.166 +  NPN_HasPropertyProcPtr hasproperty;
   1.167 +  NPN_HasMethodProcPtr hasmethod;
   1.168 +  NPN_ReleaseVariantValueProcPtr releasevariantvalue;
   1.169 +  NPN_SetExceptionProcPtr setexception;
   1.170 +  NPN_PushPopupsEnabledStateProcPtr pushpopupsenabledstate;
   1.171 +  NPN_PopPopupsEnabledStateProcPtr poppopupsenabledstate;
   1.172 +  NPN_EnumerateProcPtr enumerate;
   1.173 +  NPN_PluginThreadAsyncCallProcPtr pluginthreadasynccall;
   1.174 +  NPN_ConstructProcPtr construct;
   1.175 +  NPN_GetValueForURLPtr getvalueforurl;
   1.176 +  NPN_SetValueForURLPtr setvalueforurl;
   1.177 +  NPN_GetAuthenticationInfoPtr getauthenticationinfo;
   1.178 +  NPN_ScheduleTimerPtr scheduletimer;
   1.179 +  NPN_UnscheduleTimerPtr unscheduletimer;
   1.180 +  NPN_PopUpContextMenuPtr popupcontextmenu;
   1.181 +  NPN_ConvertPointPtr convertpoint;
   1.182 +  NPN_HandleEventPtr handleevent;
   1.183 +  NPN_UnfocusInstancePtr unfocusinstance;
   1.184 +  NPN_URLRedirectResponsePtr urlredirectresponse;
   1.185 +  NPN_InitAsyncSurfacePtr initasyncsurface;
   1.186 +  NPN_FinalizeAsyncSurfacePtr finalizeasyncsurface;
   1.187 +  NPN_SetCurrentAsyncSurfacePtr setcurrentasyncsurface;
   1.188 +} NPNetscapeFuncs;
   1.189 +
   1.190 +#ifdef XP_MACOSX
   1.191 +/*
   1.192 + * Mac OS X version(s) of NP_GetMIMEDescription(const char *)
   1.193 + * These can be called to retreive MIME information from the plugin dynamically
   1.194 + *
   1.195 + * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way
   1.196 + *       to get mime info from the plugin only on OSX and may not be supported
   1.197 + *       in furture version -- use NP_GetMIMEDescription instead
   1.198 + */
   1.199 +enum
   1.200 +{
   1.201 + kBPSupportedMIMETypesStructVers_1    = 1
   1.202 +};
   1.203 +typedef struct _BPSupportedMIMETypes
   1.204 +{
   1.205 + SInt32    structVersion;      /* struct version */
   1.206 + Handle    typeStrings;        /* STR# formated handle, allocated by plug-in */
   1.207 + Handle    infoStrings;        /* STR# formated handle, allocated by plug-in */
   1.208 +} BPSupportedMIMETypes;
   1.209 +OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags);
   1.210 +#define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription"
   1.211 +typedef const char* (*NP_GetMIMEDescriptionProcPtr)(void);
   1.212 +typedef OSErr (*BP_GetSupportedMIMETypesProcPtr)(BPSupportedMIMETypes*, UInt32);
   1.213 +#endif
   1.214 +
   1.215 +#if defined(_WIN32)
   1.216 +#define OSCALL WINAPI
   1.217 +#else
   1.218 +#define OSCALL
   1.219 +#endif
   1.220 +
   1.221 +#if defined(XP_UNIX)
   1.222 +/* GCC 3.3 and later support the visibility attribute. */
   1.223 +#if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
   1.224 +#define NP_VISIBILITY_DEFAULT __attribute__((visibility("default")))
   1.225 +#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
   1.226 +#define NP_VISIBILITY_DEFAULT __global
   1.227 +#else
   1.228 +#define NP_VISIBILITY_DEFAULT
   1.229 +#endif
   1.230 +#define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type
   1.231 +#endif
   1.232 +
   1.233 +#if defined(_WIN32)
   1.234 +#ifdef __cplusplus
   1.235 +extern "C" {
   1.236 +#endif
   1.237 +/* plugin meta member functions */
   1.238 +typedef NPError     (OSCALL *NP_GetEntryPointsFunc)(NPPluginFuncs*);
   1.239 +NPError OSCALL      NP_GetEntryPoints(NPPluginFuncs* pFuncs);
   1.240 +typedef NPError     (OSCALL *NP_InitializeFunc)(NPNetscapeFuncs*);
   1.241 +NPError OSCALL      NP_Initialize(NPNetscapeFuncs* bFuncs);
   1.242 +typedef NPError     (OSCALL *NP_ShutdownFunc)(void);
   1.243 +NPError OSCALL      NP_Shutdown(void);
   1.244 +typedef const char* (*NP_GetMIMEDescriptionFunc)(void);
   1.245 +const char*         NP_GetMIMEDescription(void);
   1.246 +#ifdef __cplusplus
   1.247 +}
   1.248 +#endif
   1.249 +#endif
   1.250 +
   1.251 +#ifdef XP_UNIX
   1.252 +#ifdef __cplusplus
   1.253 +extern "C" {
   1.254 +#endif
   1.255 +typedef char*          (*NP_GetPluginVersionFunc)(void);
   1.256 +NP_EXPORT(char*)       NP_GetPluginVersion(void);
   1.257 +typedef const char*    (*NP_GetMIMEDescriptionFunc)(void);
   1.258 +NP_EXPORT(const char*) NP_GetMIMEDescription(void);
   1.259 +#ifdef XP_MACOSX
   1.260 +typedef NPError        (*NP_InitializeFunc)(NPNetscapeFuncs*);
   1.261 +NP_EXPORT(NPError)     NP_Initialize(NPNetscapeFuncs* bFuncs);
   1.262 +typedef NPError        (*NP_GetEntryPointsFunc)(NPPluginFuncs*);
   1.263 +NP_EXPORT(NPError)     NP_GetEntryPoints(NPPluginFuncs* pFuncs);
   1.264 +#else
   1.265 +#ifdef MOZ_WIDGET_ANDROID
   1.266 +typedef NPError    (*NP_InitializeFunc)(NPNetscapeFuncs*, NPPluginFuncs*, JNIEnv* pEnv);
   1.267 +NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, JNIEnv* pEnv);
   1.268 +#else
   1.269 +typedef NPError    (*NP_InitializeFunc)(NPNetscapeFuncs*, NPPluginFuncs*);
   1.270 +NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs);
   1.271 +#endif
   1.272 +#endif
   1.273 +typedef NPError        (*NP_ShutdownFunc)(void);
   1.274 +NP_EXPORT(NPError)     NP_Shutdown(void);
   1.275 +typedef NPError        (*NP_GetValueFunc)(void *, NPPVariable, void *);
   1.276 +NP_EXPORT(NPError)     NP_GetValue(void *future, NPPVariable aVariable, void *aValue);
   1.277 +#ifdef __cplusplus
   1.278 +}
   1.279 +#endif
   1.280 +#endif
   1.281 +
   1.282 +#endif /* npfunctions_h_ */

mercurial