Move AppMenuTest from ChromeShellTest to ChromePublicTest
[chromium-blink-merge.git] / third_party / npapi / bindings / npfunctions.h
blobf755b0469e5f06e13bfcfb55526412a723def814
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
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
13 * License.
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.
22 * Contributor(s):
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 ***** */
38 #ifndef npfunctions_h_
39 #define npfunctions_h_
41 #ifdef __OS2__
42 #pragma pack(1)
43 #define NP_LOADDS _System
44 #else
45 #define NP_LOADDS
46 #endif
48 #include "npapi.h"
49 #include "npruntime.h"
51 typedef NPError (* NP_LOADDS NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved);
52 typedef NPError (* NP_LOADDS NPP_DestroyProcPtr)(NPP instance, NPSavedData** save);
53 typedef NPError (* NP_LOADDS NPP_SetWindowProcPtr)(NPP instance, NPWindow* window);
54 typedef NPError (* NP_LOADDS NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype);
55 typedef NPError (* NP_LOADDS NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
56 typedef int32_t (* NP_LOADDS NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream);
57 typedef int32_t (* NP_LOADDS NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
58 typedef void (* NP_LOADDS NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname);
59 typedef void (* NP_LOADDS NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint);
60 typedef int16_t (* NP_LOADDS NPP_HandleEventProcPtr)(NPP instance, void* event);
61 typedef void (* NP_LOADDS NPP_URLNotifyProcPtr)(NPP instance, const char* url, NPReason reason, void* notifyData);
62 /* Any NPObjects returned to the browser via NPP_GetValue should be retained
63 by the plugin on the way out. The browser is responsible for releasing. */
64 typedef NPError (* NP_LOADDS NPP_GetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value);
65 typedef NPError (* NP_LOADDS NPP_SetValueProcPtr)(NPP instance, NPNVariable variable, void *value);
66 typedef NPBool (* NP_LOADDS NPP_GotFocusPtr)(NPP instance, NPFocusDirection direction);
67 typedef void (* NP_LOADDS NPP_LostFocusPtr)(NPP instance);
68 typedef void (* NP_LOADDS NPP_URLRedirectNotifyPtr)(NPP instance, const char* url, int32_t status, void* notifyData);
69 typedef NPError (* NP_LOADDS NPP_ClearSiteDataPtr)(const char* site, uint64_t flags, uint64_t maxAge);
70 typedef char** (* NP_LOADDS NPP_GetSitesWithDataPtr)(void);
72 typedef NPError (*NPN_GetValueProcPtr)(NPP instance, NPNVariable variable, void *ret_value);
73 typedef NPError (*NPN_SetValueProcPtr)(NPP instance, NPPVariable variable, void *value);
74 typedef NPError (*NPN_GetURLNotifyProcPtr)(NPP instance, const char* url, const char* window, void* notifyData);
75 typedef NPError (*NPN_PostURLNotifyProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData);
76 typedef NPError (*NPN_GetURLProcPtr)(NPP instance, const char* url, const char* window);
77 typedef NPError (*NPN_PostURLProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file);
78 typedef NPError (*NPN_RequestReadProcPtr)(NPStream* stream, NPByteRange* rangeList);
79 typedef NPError (*NPN_NewStreamProcPtr)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
80 typedef int32_t (*NPN_WriteProcPtr)(NPP instance, NPStream* stream, int32_t len, void* buffer);
81 typedef NPError (*NPN_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
82 typedef void (*NPN_StatusProcPtr)(NPP instance, const char* message);
83 /* Browser manages the lifetime of the buffer returned by NPN_UserAgent, don't
84 depend on it sticking around and don't free it. */
85 typedef const char* (*NPN_UserAgentProcPtr)(NPP instance);
86 typedef void* (*NPN_MemAllocProcPtr)(uint32_t size);
87 typedef void (*NPN_MemFreeProcPtr)(void* ptr);
88 typedef uint32_t (*NPN_MemFlushProcPtr)(uint32_t size);
89 typedef void (*NPN_ReloadPluginsProcPtr)(NPBool reloadPages);
90 typedef void* (*NPN_GetJavaEnvProcPtr)(void);
91 typedef void* (*NPN_GetJavaPeerProcPtr)(NPP instance);
92 typedef void (*NPN_InvalidateRectProcPtr)(NPP instance, NPRect *rect);
93 typedef void (*NPN_InvalidateRegionProcPtr)(NPP instance, NPRegion region);
94 typedef void (*NPN_ForceRedrawProcPtr)(NPP instance);
95 typedef NPIdentifier (*NPN_GetStringIdentifierProcPtr)(const NPUTF8* name);
96 typedef void (*NPN_GetStringIdentifiersProcPtr)(const NPUTF8** names, int32_t nameCount, NPIdentifier* identifiers);
97 typedef NPIdentifier (*NPN_GetIntIdentifierProcPtr)(int32_t intid);
98 typedef bool (*NPN_IdentifierIsStringProcPtr)(NPIdentifier identifier);
99 typedef NPUTF8* (*NPN_UTF8FromIdentifierProcPtr)(NPIdentifier identifier);
100 typedef int32_t (*NPN_IntFromIdentifierProcPtr)(NPIdentifier identifier);
101 typedef NPObject* (*NPN_CreateObjectProcPtr)(NPP npp, NPClass *aClass);
102 typedef NPObject* (*NPN_RetainObjectProcPtr)(NPObject *obj);
103 typedef void (*NPN_ReleaseObjectProcPtr)(NPObject *obj);
104 typedef bool (*NPN_InvokeProcPtr)(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result);
105 typedef bool (*NPN_InvokeDefaultProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
106 typedef bool (*NPN_EvaluateProcPtr)(NPP npp, NPObject *obj, NPString *script, NPVariant *result);
107 typedef bool (*NPN_GetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result);
108 typedef bool (*NPN_SetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value);
109 typedef bool (*NPN_RemovePropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
110 typedef bool (*NPN_HasPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
111 typedef bool (*NPN_HasMethodProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
112 typedef void (*NPN_ReleaseVariantValueProcPtr)(NPVariant *variant);
113 typedef void (*NPN_SetExceptionProcPtr)(NPObject *obj, const NPUTF8 *message);
114 typedef void (*NPN_PushPopupsEnabledStateProcPtr)(NPP npp, NPBool enabled);
115 typedef void (*NPN_PopPopupsEnabledStateProcPtr)(NPP npp);
116 typedef bool (*NPN_EnumerateProcPtr)(NPP npp, NPObject *obj, NPIdentifier **identifier, uint32_t *count);
117 typedef void (*NPN_PluginThreadAsyncCallProcPtr)(NPP instance, void (*func)(void *), void *userData);
118 typedef bool (*NPN_ConstructProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
119 typedef NPError (*NPN_GetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, char **value, uint32_t *len);
120 typedef NPError (*NPN_SetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, const char *value, uint32_t len);
121 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);
122 typedef uint32_t (*NPN_ScheduleTimerPtr)(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
123 typedef void (*NPN_UnscheduleTimerPtr)(NPP instance, uint32_t timerID);
124 typedef NPError (*NPN_PopUpContextMenuPtr)(NPP instance, NPMenu* menu);
125 typedef NPBool (*NPN_ConvertPointPtr)(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
126 typedef NPBool (*NPN_HandleEventPtr)(NPP instance, void *event, NPBool handled);
127 typedef NPBool (*NPN_UnfocusInstancePtr)(NPP instance, NPFocusDirection direction);
128 typedef void (*NPN_URLRedirectResponsePtr)(NPP instance, void* notifyData, NPBool allow);
130 typedef struct _NPPluginFuncs {
131 uint16_t size;
132 uint16_t version;
133 NPP_NewProcPtr newp;
134 NPP_DestroyProcPtr destroy;
135 NPP_SetWindowProcPtr setwindow;
136 NPP_NewStreamProcPtr newstream;
137 NPP_DestroyStreamProcPtr destroystream;
138 NPP_StreamAsFileProcPtr asfile;
139 NPP_WriteReadyProcPtr writeready;
140 NPP_WriteProcPtr write;
141 NPP_PrintProcPtr print;
142 NPP_HandleEventProcPtr event;
143 NPP_URLNotifyProcPtr urlnotify;
144 void* javaClass;
145 NPP_GetValueProcPtr getvalue;
146 NPP_SetValueProcPtr setvalue;
147 NPP_GotFocusPtr gotfocus;
148 NPP_LostFocusPtr lostfocus;
149 NPP_URLRedirectNotifyPtr urlredirectnotify;
150 NPP_ClearSiteDataPtr clearsitedata;
151 NPP_GetSitesWithDataPtr getsiteswithdata;
152 } NPPluginFuncs;
154 typedef struct _NPNetscapeFuncs {
155 uint16_t size;
156 uint16_t version;
157 NPN_GetURLProcPtr geturl;
158 NPN_PostURLProcPtr posturl;
159 NPN_RequestReadProcPtr requestread;
160 NPN_NewStreamProcPtr newstream;
161 NPN_WriteProcPtr write;
162 NPN_DestroyStreamProcPtr destroystream;
163 NPN_StatusProcPtr status;
164 NPN_UserAgentProcPtr uagent;
165 NPN_MemAllocProcPtr memalloc;
166 NPN_MemFreeProcPtr memfree;
167 NPN_MemFlushProcPtr memflush;
168 NPN_ReloadPluginsProcPtr reloadplugins;
169 NPN_GetJavaEnvProcPtr getJavaEnv;
170 NPN_GetJavaPeerProcPtr getJavaPeer;
171 NPN_GetURLNotifyProcPtr geturlnotify;
172 NPN_PostURLNotifyProcPtr posturlnotify;
173 NPN_GetValueProcPtr getvalue;
174 NPN_SetValueProcPtr setvalue;
175 NPN_InvalidateRectProcPtr invalidaterect;
176 NPN_InvalidateRegionProcPtr invalidateregion;
177 NPN_ForceRedrawProcPtr forceredraw;
178 NPN_GetStringIdentifierProcPtr getstringidentifier;
179 NPN_GetStringIdentifiersProcPtr getstringidentifiers;
180 NPN_GetIntIdentifierProcPtr getintidentifier;
181 NPN_IdentifierIsStringProcPtr identifierisstring;
182 NPN_UTF8FromIdentifierProcPtr utf8fromidentifier;
183 NPN_IntFromIdentifierProcPtr intfromidentifier;
184 NPN_CreateObjectProcPtr createobject;
185 NPN_RetainObjectProcPtr retainobject;
186 NPN_ReleaseObjectProcPtr releaseobject;
187 NPN_InvokeProcPtr invoke;
188 NPN_InvokeDefaultProcPtr invokeDefault;
189 NPN_EvaluateProcPtr evaluate;
190 NPN_GetPropertyProcPtr getproperty;
191 NPN_SetPropertyProcPtr setproperty;
192 NPN_RemovePropertyProcPtr removeproperty;
193 NPN_HasPropertyProcPtr hasproperty;
194 NPN_HasMethodProcPtr hasmethod;
195 NPN_ReleaseVariantValueProcPtr releasevariantvalue;
196 NPN_SetExceptionProcPtr setexception;
197 NPN_PushPopupsEnabledStateProcPtr pushpopupsenabledstate;
198 NPN_PopPopupsEnabledStateProcPtr poppopupsenabledstate;
199 NPN_EnumerateProcPtr enumerate;
200 NPN_PluginThreadAsyncCallProcPtr pluginthreadasynccall;
201 NPN_ConstructProcPtr construct;
202 NPN_GetValueForURLPtr getvalueforurl;
203 NPN_SetValueForURLPtr setvalueforurl;
204 NPN_GetAuthenticationInfoPtr getauthenticationinfo;
205 NPN_ScheduleTimerPtr scheduletimer;
206 NPN_UnscheduleTimerPtr unscheduletimer;
207 NPN_PopUpContextMenuPtr popupcontextmenu;
208 NPN_ConvertPointPtr convertpoint;
209 NPN_HandleEventPtr handleevent;
210 NPN_UnfocusInstancePtr unfocusinstance;
211 NPN_URLRedirectResponsePtr urlredirectresponse;
212 } NPNetscapeFuncs;
214 #ifdef XP_MACOSX
216 * Mac OS X version(s) of NP_GetMIMEDescription(const char *)
217 * These can be called to retreive MIME information from the plugin dynamically
219 * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way
220 * to get mime info from the plugin only on OSX and may not be supported
221 * in furture version -- use NP_GetMIMEDescription instead
223 enum
225 kBPSupportedMIMETypesStructVers_1 = 1
227 typedef struct _BPSupportedMIMETypes
229 SInt32 structVersion; /* struct version */
230 Handle typeStrings; /* STR# formated handle, allocated by plugin */
231 Handle infoStrings; /* STR# formated handle, allocated by plugin */
232 } BPSupportedMIMETypes;
233 OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags);
234 #define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription"
235 typedef const char* (*NP_GetMIMEDescriptionProcPtr)(void);
236 typedef OSErr (*BP_GetSupportedMIMETypesProcPtr)(BPSupportedMIMETypes*, UInt32);
237 #endif
239 #endif /* npfunctions_h_ */