summaryrefslogtreecommitdiffstats
path: root/webkit/glue/plugins/nphostapi.h
blob: 515d526322c9a5a651f9dcbe1d37d7761733b63b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// TODO:  Did not implement JRIGlobalRef function yet.  Not sure if this is used?

#ifndef WEBKIT_GLUE_PLUGIN_NPHOSTAPI_H__
#define WEBKIT_GLUE_PLUGIN_NPHOSTAPI_H__

#include "third_party/npapi/bindings/npapi.h"
#include "third_party/npapi/bindings/npruntime.h"

#ifdef __cplusplus
extern "C" { 
#endif

//
// NPAPI NPP Function Pointers
//
typedef NPError      (*NPP_NewProcPtr)(NPMIMEType pluginType,
                         NPP instance,
                         uint16 mode,
                         int16 argc,
                         char* argn[],
                         char* argv[],
                         NPSavedData* saved);
typedef NPError      (*NPP_DestroyProcPtr)(NPP instance,
                         NPSavedData** save);
typedef NPError      (*NPP_SetWindowProcPtr)(NPP instance,
                         NPWindow* window);
typedef NPError      (*NPP_NewStreamProcPtr)(NPP instance,
                         NPMIMEType type, 
                         NPStream* stream,
                         NPBool seekable,
                         uint16* stype);
typedef NPError      (*NPP_DestroyStreamProcPtr)(NPP instance,
                         NPStream* stream,
                         NPReason reason);
typedef int32        (*NPP_WriteReadyProcPtr)(NPP instance,
                         NPStream* stream);
typedef int32        (*NPP_WriteProcPtr)(NPP instance,
                         NPStream* stream, 
                         int32 offset,
                         int32 len,
                         void* buffer);
typedef void         (*NPP_StreamAsFileProcPtr)(NPP instance,
                         NPStream* stream,
                         const char* fname);
typedef void         (*NPP_PrintProcPtr)(NPP instance,
                         NPPrint* platformPrint);
typedef int16        (*NPP_HandleEventProcPtr)(NPP instance,
                         void* event);
typedef void         (*NPP_URLNotifyProcPtr)(NPP instance,
                         const char* url, 
                         NPReason reason,
                         void* notifyData);
typedef void* JRIGlobalRef; //not using this right now
typedef NPError      (*NPP_GetValueProcPtr)(NPP instance,
                         NPPVariable variable,
                         void *ret_alue);
typedef NPError      (*NPP_SetValueProcPtr)(NPP instance,
                         NPNVariable variable,
                         void *ret_alue);

//
// NPAPI NPN Function Pointers
//
typedef NPError      (*NPN_GetURLProcPtr)(NPP instance,
                         const char* URL,
                         const char* window);
typedef NPError      (*NPN_PostURLProcPtr)(NPP instance,
                         const char* URL,
                         const char* window,
                         uint32 len,
                         const char* buf,
                         NPBool file);
typedef NPError      (*NPN_RequestReadProcPtr)(NPStream* stream,
                         NPByteRange* rangeList);
typedef NPError      (*NPN_NewStreamProcPtr)(NPP instance,
                         NPMIMEType type,
                         const char* window,
                         NPStream** stream);
typedef int32        (*NPN_WriteProcPtr)(NPP instance,
                         NPStream* stream,
                         int32 len,
                         void* buffer);
typedef NPError      (*NPN_DestroyStreamProcPtr)(NPP instance,
                         NPStream* stream,
                         NPReason reason);
typedef void         (*NPN_StatusProcPtr)(NPP instance,
                         const char* message);
typedef const char*  (*NPN_UserAgentProcPtr)(NPP instance);
typedef void*        (*NPN_MemAllocProcPtr)(uint32 size);
typedef void         (*NPN_MemFreeProcPtr)(void* ptr);
typedef uint32       (*NPN_MemFlushProcPtr)(uint32 size);
typedef void         (*NPN_ReloadPluginsProcPtr)(NPBool reloadPages);

typedef void*        (*NPN_GetJavaEnvProcPtr)(void);
typedef void*        (*NPN_GetJavaPeerProcPtr)(NPP instance);

typedef NPError      (*NPN_GetURLNotifyProcPtr)(NPP instance,
                         const char* URL,
                         const char* window,
                         void* notifyData);
typedef NPError      (*NPN_PostURLNotifyProcPtr)(NPP instance,
                         const char* URL,
                         const char* window,
                         uint32 len,
                         const char* buf,
                         NPBool file,
                         void* notifyData);
typedef NPError      (*NPN_GetValueProcPtr)(NPP instance,
                         NPNVariable variable,
                         void *ret_value);
typedef NPError      (*NPN_SetValueProcPtr)(NPP instance,
                         NPPVariable variable,
                         void *value);
typedef void         (*NPN_InvalidateRectProcPtr)(NPP instance,
                         NPRect *rect);
typedef void         (*NPN_InvalidateRegionProcPtr)(NPP instance,
                         NPRegion region);
typedef void         (*NPN_ForceRedrawProcPtr)(NPP instance);

typedef void         (*NPN_ReleaseVariantValueProcPtr) (NPVariant *variant);

typedef NPIdentifier (*NPN_GetStringIdentifierProcPtr) (const NPUTF8 *name);
typedef void         (*NPN_GetStringIdentifiersProcPtr) (const NPUTF8 **names,
                         int32_t nameCount,
                         NPIdentifier *identifiers);
typedef NPIdentifier (*NPN_GetIntIdentifierProcPtr) (int32_t intid);
typedef int32_t      (*NPN_IntFromIdentifierProcPtr) (NPIdentifier identifier);
typedef bool         (*NPN_IdentifierIsStringProcPtr) (NPIdentifier identifier);
typedef NPUTF8 *     (*NPN_UTF8FromIdentifierProcPtr) (NPIdentifier identifier);

typedef NPObject*    (*NPN_CreateObjectProcPtr) (NPP,
                         NPClass *aClass);
typedef NPObject*    (*NPN_RetainObjectProcPtr) (NPObject *obj);
typedef void         (*NPN_ReleaseObjectProcPtr) (NPObject *obj);
typedef bool         (*NPN_InvokeProcPtr) (NPP npp,
                         NPObject *obj,
                         NPIdentifier methodName,
                         const NPVariant *args,
                         unsigned argCount,
                         NPVariant *result);
typedef bool         (*NPN_InvokeDefaultProcPtr) (NPP npp,
                         NPObject *obj,
                         const NPVariant *args,
                         unsigned argCount,
                         NPVariant *result);
typedef bool         (*NPN_EvaluateProcPtr) (NPP npp,
                         NPObject *obj,
                         NPString *script,
                         NPVariant *result);
typedef bool         (*NPN_GetPropertyProcPtr) (NPP npp,
                         NPObject *obj,
                         NPIdentifier propertyName,
                         NPVariant *result);
typedef bool         (*NPN_SetPropertyProcPtr) (NPP npp,
                         NPObject *obj,
                         NPIdentifier propertyName,
                         const NPVariant *value);
typedef bool         (*NPN_HasPropertyProcPtr) (NPP,
                         NPObject *npobj,
                         NPIdentifier propertyName);
typedef bool         (*NPN_HasMethodProcPtr) (NPP npp,
                         NPObject *npobj,
                         NPIdentifier methodName);
typedef bool         (*NPN_RemovePropertyProcPtr) (NPP npp,
                         NPObject *obj,
                         NPIdentifier propertyName);
typedef void         (*NPN_SetExceptionProcPtr) (NPObject *obj,
                         const NPUTF8 *message);
typedef void         (*NPN_PushPopupsEnabledStateProcPtr)(NPP npp,
                         NPBool enabled);
typedef void         (*NPN_PopPopupsEnabledStateProcPtr)(NPP npp);
typedef bool         (*NPN_EnumerateProcPtr)(NPP npp,
                         NPObject *obj,
                         NPIdentifier **identifier,
                         uint32_t *count);
typedef void         (*NPN_PluginThreadAsyncCallProcPtr)(NPP instance, 
                         void (*func)(void *),
                         void *userData);
typedef bool         (*NPN_ConstructProcPtr)(NPP npp,
                         NPObject* obj,
                         const NPVariant *args,
                         uint32_t argCount,
                         NPVariant *result);

//
// NPAPI Function table of NPP functions (functions provided by plugin to host)
//
typedef struct _NPPluginFuncs {
    unsigned short size;
    unsigned short version;
    NPP_NewProcPtr newp;
    NPP_DestroyProcPtr destroy;
    NPP_SetWindowProcPtr setwindow;
    NPP_NewStreamProcPtr newstream;
    NPP_DestroyStreamProcPtr destroystream;
    NPP_StreamAsFileProcPtr asfile;
    NPP_WriteReadyProcPtr writeready;
    NPP_WriteProcPtr write;
    NPP_PrintProcPtr print;
    NPP_HandleEventProcPtr event;
    NPP_URLNotifyProcPtr urlnotify;
    JRIGlobalRef javaClass;
    NPP_GetValueProcPtr getvalue;
    NPP_SetValueProcPtr setvalue;
} NPPluginFuncs;

//
// NPAPI Function table NPN functions (functions provided by host to plugin)
//
typedef struct _NPNetscapeFuncs {
    uint16 size;
    uint16 version;
    NPN_GetURLProcPtr geturl;
    NPN_PostURLProcPtr posturl;
    NPN_RequestReadProcPtr requestread;
    NPN_NewStreamProcPtr newstream;
    NPN_WriteProcPtr write;
    NPN_DestroyStreamProcPtr destroystream;
    NPN_StatusProcPtr status;
    NPN_UserAgentProcPtr uagent;
    NPN_MemAllocProcPtr memalloc;
    NPN_MemFreeProcPtr memfree;
    NPN_MemFlushProcPtr memflush;
    NPN_ReloadPluginsProcPtr reloadplugins;
    NPN_GetJavaEnvProcPtr getJavaEnv;
    NPN_GetJavaPeerProcPtr getJavaPeer;
    NPN_GetURLNotifyProcPtr geturlnotify;
    NPN_PostURLNotifyProcPtr posturlnotify;
    NPN_GetValueProcPtr getvalue;
    NPN_SetValueProcPtr setvalue;
    NPN_InvalidateRectProcPtr invalidaterect;
    NPN_InvalidateRegionProcPtr invalidateregion;
    NPN_ForceRedrawProcPtr forceredraw;

    NPN_GetStringIdentifierProcPtr getstringidentifier;
    NPN_GetStringIdentifiersProcPtr getstringidentifiers;
    NPN_GetIntIdentifierProcPtr getintidentifier;
    NPN_IdentifierIsStringProcPtr identifierisstring;
    NPN_UTF8FromIdentifierProcPtr utf8fromidentifier;
    NPN_IntFromIdentifierProcPtr intfromidentifier;
    NPN_CreateObjectProcPtr createobject;
    NPN_RetainObjectProcPtr retainobject;
    NPN_ReleaseObjectProcPtr releaseobject;
    NPN_InvokeProcPtr invoke;
    NPN_InvokeDefaultProcPtr invokeDefault;
    NPN_EvaluateProcPtr evaluate;
    NPN_GetPropertyProcPtr getproperty;
    NPN_SetPropertyProcPtr setproperty;
    NPN_RemovePropertyProcPtr removeproperty;
    NPN_HasPropertyProcPtr hasproperty;
    NPN_HasMethodProcPtr hasmethod;
    NPN_ReleaseVariantValueProcPtr releasevariantvalue;
    NPN_SetExceptionProcPtr setexception;
    NPN_PushPopupsEnabledStateProcPtr pushpopupsenabledstate;
    NPN_PopPopupsEnabledStateProcPtr poppopupsenabledstate;
    NPN_EnumerateProcPtr enumerate;
    NPN_PluginThreadAsyncCallProcPtr pluginthreadasynccall;
    NPN_ConstructProcPtr construct;
} NPNetscapeFuncs;

//
// NPAPI DLL entry points
//
typedef NPError (__stdcall * NP_InitializeFunc)(NPNetscapeFuncs* pFuncs);
typedef NPError (__stdcall * NP_GetEntryPointsFunc)(NPPluginFuncs* pFuncs);
typedef NPError (__stdcall * NP_ShutdownFunc)(void);


#ifdef __cplusplus
} // extern "C"
#endif

#endif // WEBKIT_GLUE_PLUGIN_NPHOSTAPI_H__