|
1 /* ***** BEGIN LICENSE BLOCK ***** |
|
2 * Version: NPL 1.1/GPL 2.0/LGPL 2.1 |
|
3 * |
|
4 * The contents of this file are subject to the Netscape Public License |
|
5 * Version 1.1 (the "License"); you may not use this file except in |
|
6 * compliance with the License. You may obtain a copy of the License at |
|
7 * http://www.mozilla.org/NPL/ |
|
8 * |
|
9 * Software distributed under the License is distributed on an "AS IS" basis, |
|
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
|
11 * for the specific language governing rights and limitations under the |
|
12 * License. |
|
13 * |
|
14 * The Original Code is mozilla.org code. |
|
15 * |
|
16 * The Initial Developer of the Original Code is |
|
17 * Netscape Communications Corporation. |
|
18 * Portions created by the Initial Developer are Copyright (C) 1998 |
|
19 * the Initial Developer. All Rights Reserved. |
|
20 * |
|
21 * Contributor(s): |
|
22 * Portions Copyright (c) 2004-2006, Nokia Corporation |
|
23 * |
|
24 * |
|
25 * Alternatively, the contents of this file may be used under the terms of |
|
26 * either the GNU General Public License Version 2 or later (the "GPL"), or |
|
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
|
28 * in which case the provisions of the GPL or the LGPL are applicable instead |
|
29 * of those above. If you wish to allow use of your version of this file only |
|
30 * under the terms of either the GPL or the LGPL, and not to allow others to |
|
31 * use your version of this file under the terms of the NPL, indicate your |
|
32 * decision by deleting the provisions above and replace them with the notice |
|
33 * and other provisions required by the GPL or the LGPL. If you do not delete |
|
34 * the provisions above, a recipient may use your version of this file under |
|
35 * the terms of any one of the NPL, the GPL or the LGPL. |
|
36 * |
|
37 * ***** END LICENSE BLOCK ***** */ |
|
38 |
|
39 /* NOTES: |
|
40 * Nokia modified this file, by changing certain variables for the purpose of |
|
41 * porting the file to the Symbian platform on May 1st, 2004. |
|
42 */ |
|
43 |
|
44 /* |
|
45 * Netscape client plug-in API spec |
|
46 */ |
|
47 |
|
48 #ifndef _NPAPI_H_ |
|
49 #define _NPAPI_H_ |
|
50 |
|
51 #ifdef INCLUDE_JAVA |
|
52 #include "jri.h" /* Java Runtime Interface */ |
|
53 #else |
|
54 #ifndef __SYMBIAN32__ |
|
55 #define jref void * |
|
56 #define JRIEnv void |
|
57 #endif |
|
58 #endif |
|
59 |
|
60 #ifdef _WIN32 |
|
61 # ifndef XP_WIN |
|
62 # define XP_WIN 1 |
|
63 # endif /* XP_WIN */ |
|
64 #endif /* _WIN32 */ |
|
65 |
|
66 #ifdef __MWERKS__ |
|
67 # define _declspec __declspec |
|
68 # ifdef macintosh |
|
69 # ifndef XP_MAC |
|
70 # define XP_MAC 1 |
|
71 # endif /* XP_MAC */ |
|
72 # endif /* macintosh */ |
|
73 # ifdef __INTEL__ |
|
74 # undef NULL |
|
75 # ifndef XP_WIN |
|
76 # define XP_WIN 1 |
|
77 # endif /* __INTEL__ */ |
|
78 # endif /* XP_PC */ |
|
79 #endif /* __MWERKS__ */ |
|
80 |
|
81 #ifdef __SYMBIAN32__ |
|
82 #undef XP_WIN |
|
83 #endif |
|
84 |
|
85 #if defined(__APPLE_CC__) && !defined(__MACOS_CLASSIC__) |
|
86 # define XP_MACOSX |
|
87 #endif |
|
88 |
|
89 #ifdef XP_MAC |
|
90 #include <Quickdraw.h> |
|
91 #include <Events.h> |
|
92 #endif |
|
93 |
|
94 #ifdef XP_MACOSX |
|
95 #include <Carbon/Carbon.h> |
|
96 #include <ApplicationServices/ApplicationServices.h> |
|
97 #include <OpenGL/OpenGL.h> |
|
98 #endif |
|
99 |
|
100 #ifdef XP_UNIX |
|
101 #include <X11/Xlib.h> |
|
102 #include <X11/Xutil.h> |
|
103 #endif |
|
104 |
|
105 #ifdef XP_WIN |
|
106 #include <windows.h> |
|
107 #endif |
|
108 |
|
109 #ifdef __SYMBIAN32__ |
|
110 #include <np_defines.h> |
|
111 #endif |
|
112 #if defined(XP_MACOSX) && defined(__LP64__) |
|
113 #error 64-bit Netscape plug-ins are not supported on Mac OS X |
|
114 #endif |
|
115 |
|
116 /*----------------------------------------------------------------------*/ |
|
117 /* Plugin Version Constants */ |
|
118 /*----------------------------------------------------------------------*/ |
|
119 |
|
120 #define NP_VERSION_MAJOR 0 |
|
121 #define NP_VERSION_MINOR 18 |
|
122 |
|
123 |
|
124 |
|
125 /*----------------------------------------------------------------------*/ |
|
126 /* Definition of Basic Types */ |
|
127 /*----------------------------------------------------------------------*/ |
|
128 |
|
129 #ifndef _UINT16 |
|
130 #define _UINT16 |
|
131 typedef unsigned short uint16; |
|
132 #endif |
|
133 |
|
134 #ifndef _UINT32 |
|
135 #define _UINT32 |
|
136 #ifdef __LP64__ |
|
137 typedef unsigned int uint32; |
|
138 #else /* __LP64__ */ |
|
139 typedef unsigned long uint32; |
|
140 #endif /* __LP64__ */ |
|
141 #endif |
|
142 |
|
143 #ifndef _INT16 |
|
144 #define _INT16 |
|
145 typedef short int16; |
|
146 #endif |
|
147 |
|
148 #ifndef _INT32 |
|
149 #define _INT32 |
|
150 #ifdef __LP64__ |
|
151 typedef int int32; |
|
152 #else /* __LP64__ */ |
|
153 typedef long int32; |
|
154 #endif /* __LP64__ */ |
|
155 #endif |
|
156 |
|
157 #ifndef FALSE |
|
158 #define FALSE (0) |
|
159 #endif |
|
160 #ifndef TRUE |
|
161 #define TRUE (1) |
|
162 #endif |
|
163 #ifndef NULL |
|
164 #define NULL (0L) |
|
165 #endif |
|
166 |
|
167 typedef unsigned char NPBool; |
|
168 typedef int16 NPError; |
|
169 typedef int16 NPReason; |
|
170 #ifndef __SYMBIAN32__ |
|
171 typedef char* NPMIMEType; |
|
172 #else/* __SYMBIAN32__ */ |
|
173 typedef const TDesC8& NPMIMEType; |
|
174 #endif |
|
175 |
|
176 /*----------------------------------------------------------------------*/ |
|
177 /* Structures and definitions */ |
|
178 /*----------------------------------------------------------------------*/ |
|
179 |
|
180 #if !defined(__LP64__) |
|
181 #if defined(XP_MAC) || defined(XP_MACOSX) |
|
182 #pragma options align=mac68k |
|
183 #endif |
|
184 #endif /* __LP64__ */ |
|
185 |
|
186 /* |
|
187 * NPP is a plug-in's opaque instance handle |
|
188 */ |
|
189 #ifdef __SYMBIAN32__ |
|
190 #ifndef _NP_RUNTIME_H_NPP |
|
191 #define _NP_RUNTIME_H_NPP |
|
192 typedef struct _NPP |
|
193 { |
|
194 void* pdata; /* plug-in private data */ |
|
195 void* ndata; /* netscape private data */ |
|
196 } NPP_t; |
|
197 |
|
198 typedef NPP_t* NPP; |
|
199 #endif // _NP_RUNTIME_H_NPP |
|
200 #else |
|
201 typedef struct _NPP |
|
202 { |
|
203 void* pdata; /* plug-in private data */ |
|
204 void* ndata; /* netscape private data */ |
|
205 } NPP_t; |
|
206 |
|
207 typedef NPP_t* NPP; |
|
208 #endif // |
|
209 |
|
210 typedef struct _NPStream |
|
211 { |
|
212 void* pdata; /* plug-in private data */ |
|
213 void* ndata; /* netscape private data */ |
|
214 #ifndef __SYMBIAN32__ |
|
215 const char* url; |
|
216 #else /*__SYMBIAN32__*/ |
|
217 HBufC* url; |
|
218 #endif |
|
219 uint32 end; |
|
220 uint32 lastmodified; |
|
221 void* notifyData; |
|
222 const char* headers; /* Response headers from host. |
|
223 * Exists only for >= NPVERS_HAS_RESPONSE_HEADERS. |
|
224 * Used for HTTP only; NULL for non-HTTP. |
|
225 * Available from NPP_NewStream onwards. |
|
226 * Plugin should copy this data before storing it. |
|
227 * Includes HTTP status line and all headers, |
|
228 * preferably verbatim as received from server, |
|
229 * headers formatted as in HTTP ("Header: Value"), |
|
230 * and newlines (\n, NOT \r\n) separating lines. |
|
231 * Terminated by \n\0 (NOT \n\n\0). */ |
|
232 } NPStream; |
|
233 |
|
234 |
|
235 typedef struct _NPByteRange |
|
236 { |
|
237 int32 offset; /* negative offset means from the end */ |
|
238 uint32 length; |
|
239 struct _NPByteRange* next; |
|
240 } NPByteRange; |
|
241 |
|
242 |
|
243 typedef struct _NPSavedData |
|
244 { |
|
245 int32 len; |
|
246 void* buf; |
|
247 } NPSavedData; |
|
248 |
|
249 |
|
250 typedef struct _NPRect |
|
251 { |
|
252 uint16 top; |
|
253 uint16 left; |
|
254 uint16 bottom; |
|
255 uint16 right; |
|
256 } NPRect; |
|
257 |
|
258 |
|
259 #ifdef XP_UNIX |
|
260 /* |
|
261 * Unix specific structures and definitions |
|
262 */ |
|
263 |
|
264 /* |
|
265 * Callback Structures. |
|
266 * |
|
267 * These are used to pass additional platform specific information. |
|
268 */ |
|
269 enum { |
|
270 NP_SETWINDOW = 1, |
|
271 NP_PRINT |
|
272 }; |
|
273 |
|
274 typedef struct |
|
275 { |
|
276 int32 type; |
|
277 } NPAnyCallbackStruct; |
|
278 |
|
279 typedef struct |
|
280 { |
|
281 int32 type; |
|
282 Display* display; |
|
283 Visual* visual; |
|
284 Colormap colormap; |
|
285 unsigned int depth; |
|
286 } NPSetWindowCallbackStruct; |
|
287 |
|
288 typedef struct |
|
289 { |
|
290 int32 type; |
|
291 FILE* fp; |
|
292 } NPPrintCallbackStruct; |
|
293 |
|
294 #endif /* XP_UNIX */ |
|
295 |
|
296 /* |
|
297 * The following masks are applied on certain platforms to NPNV and |
|
298 * NPPV selectors that pass around pointers to COM interfaces. Newer |
|
299 * compilers on some platforms may generate vtables that are not |
|
300 * compatible with older compilers. To prevent older plugins from |
|
301 * not understanding a new browser's ABI, these masks change the |
|
302 * values of those selectors on those platforms. To remain backwards |
|
303 * compatible with differenet versions of the browser, plugins can |
|
304 * use these masks to dynamically determine and use the correct C++ |
|
305 * ABI that the browser is expecting. This does not apply to Windows |
|
306 * as Microsoft's COM ABI will likely not change. |
|
307 */ |
|
308 |
|
309 #define NP_ABI_GCC3_MASK 0x10000000 |
|
310 /* |
|
311 * gcc 3.x generated vtables on UNIX and OSX are incompatible with |
|
312 * previous compilers. |
|
313 */ |
|
314 #if (defined (XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3)) |
|
315 #define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK |
|
316 #else |
|
317 #define _NP_ABI_MIXIN_FOR_GCC3 0 |
|
318 #endif |
|
319 |
|
320 #define NP_ABI_MACHO_MASK 0x01000000 |
|
321 /* |
|
322 * On OSX, the Mach-O executable format is significantly |
|
323 * different than CFM. In addition to having a different |
|
324 * C++ ABI, it also has has different C calling convention. |
|
325 * You must use glue code when calling between CFM and |
|
326 * Mach-O C functions. |
|
327 */ |
|
328 #if (defined(TARGET_RT_MAC_MACHO)) |
|
329 #define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK |
|
330 #else |
|
331 #define _NP_ABI_MIXIN_FOR_MACHO 0 |
|
332 #endif |
|
333 |
|
334 |
|
335 #define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO) |
|
336 |
|
337 /* |
|
338 * List of variable names for which NPP_GetValue shall be implemented |
|
339 */ |
|
340 typedef enum { |
|
341 NPPVpluginNameString = 1, |
|
342 NPPVpluginDescriptionString, |
|
343 NPPVpluginWindowBool, |
|
344 NPPVpluginTransparentBool, |
|
345 |
|
346 NPPVjavaClass, /* Not implemented in WebKit */ |
|
347 NPPVpluginWindowSize, /* Not implemented in WebKit */ |
|
348 NPPVpluginTimerInterval, /* Not implemented in WebKit */ |
|
349 |
|
350 NPPVpluginScriptableInstance = (10 | NP_ABI_MASK), /* Not implemented in WebKit */ |
|
351 NPPVpluginScriptableIID = 11, /* Not implemented in WebKit */ |
|
352 |
|
353 /* 12 and over are available on Mozilla builds starting with 0.9.9 */ |
|
354 NPPVjavascriptPushCallerBool = 12, /* Not implemented in WebKit */ |
|
355 NPPVpluginKeepLibraryInMemory = 13, /* Not implemented in WebKit */ |
|
356 NPPVpluginNeedsXEmbed = 14, /* Not implemented in WebKit */ |
|
357 |
|
358 /* Get the NPObject for scripting the plugin. */ |
|
359 NPPVpluginScriptableNPObject = 15, |
|
360 |
|
361 #ifdef __SYMBIAN32__ |
|
362 // Custom NPP variables, starting from 100 till 1000 |
|
363 NPPVPluginFocusPosition = 100, |
|
364 NPPVPluginDeactivate = 101, |
|
365 NPPVpluginInteractiveBool = 1000, |
|
366 #endif |
|
367 |
|
368 /* Get the plugin value (as \0-terminated UTF-8 string data) for |
|
369 * form submission if the plugin is part of a form. Use |
|
370 * NPN_MemAlloc() to allocate memory for the string data. |
|
371 */ |
|
372 NPPVformValue = 16, /* Not implemented in WebKit */ |
|
373 NPPVpluginFullScreenBool = 17 /* Not implemented in WebKit */ |
|
374 } NPPVariable; |
|
375 |
|
376 /* |
|
377 * List of variable names for which NPN_GetValue is implemented by Mozilla |
|
378 */ |
|
379 typedef enum { |
|
380 NPNVxDisplay = 1, |
|
381 NPNVxtAppContext, |
|
382 NPNVnetscapeWindow, |
|
383 NPNVjavascriptEnabledBool, |
|
384 NPNVasdEnabledBool, |
|
385 NPNVisOfflineBool, |
|
386 |
|
387 /* 10 and over are available on Mozilla builds starting with 0.9.4 */ |
|
388 NPNVserviceManager = (10 | NP_ABI_MASK), /* Not implemented in WebKit */ |
|
389 NPNVDOMElement = (11 | NP_ABI_MASK), /* Not implemented in WebKit */ |
|
390 NPNVDOMWindow = (12 | NP_ABI_MASK), /* Not implemented in WebKit */ |
|
391 NPNVToolkit = (13 | NP_ABI_MASK), /* Not implemented in WebKit */ |
|
392 NPNVSupportsXEmbedBool = 14, /* Not implemented in WebKit */ |
|
393 |
|
394 /* Get the NPObject wrapper for the browser window. */ |
|
395 NPNVWindowNPObject = 15, |
|
396 |
|
397 /* Get the NPObject wrapper for the plugins DOM element. */ |
|
398 NPNVPluginElementNPObject, |
|
399 |
|
400 #ifdef XP_MACOSX |
|
401 , NPNVpluginDrawingModel = 1000 /* The NPDrawingModel specified by the plugin */ |
|
402 |
|
403 #ifndef NP_NO_QUICKDRAW |
|
404 , NPNVsupportsQuickDrawBool = 2000 /* TRUE if the browser supports the QuickDraw drawing model */ |
|
405 #endif |
|
406 , NPNVsupportsCoreGraphicsBool = 2001 /* TRUE if the browser supports the CoreGraphics drawing model */ |
|
407 , NPNVsupportsOpenGLBool = 2002 /* TRUE if the browser supports the OpenGL drawing model (CGL on Mac) */ |
|
408 #endif /* XP_MACOSX */ |
|
409 |
|
410 /* Get the id of the currently connected access point */ |
|
411 NPNNetworkAccess |
|
412 } NPNVariable; |
|
413 |
|
414 /* |
|
415 * The type of a NPWindow - it specifies the type of the data structure |
|
416 * returned in the window field. |
|
417 */ |
|
418 typedef enum { |
|
419 NPWindowTypeWindow = 1, |
|
420 NPWindowTypeDrawable |
|
421 } NPWindowType; |
|
422 |
|
423 #ifdef XP_MACOSX |
|
424 |
|
425 /* |
|
426 * The drawing model for a Mac OS X plugin. These are the possible values for the NPNVpluginDrawingModel variable. |
|
427 */ |
|
428 |
|
429 typedef enum { |
|
430 #ifndef NP_NO_QUICKDRAW |
|
431 NPDrawingModelQuickDraw = 0, |
|
432 #endif |
|
433 NPDrawingModelCoreGraphics = 1, |
|
434 NPDrawingModelOpenGL = 2 |
|
435 } NPDrawingModel; |
|
436 |
|
437 #endif |
|
438 |
|
439 typedef struct _NPWindow |
|
440 { |
|
441 void* window; /* Platform specific window handle */ |
|
442 int32 x; /* Position of top left corner relative */ |
|
443 int32 y; /* to a netscape page. */ |
|
444 uint32 width; /* Maximum window size */ |
|
445 uint32 height; |
|
446 NPRect clipRect; /* Clipping rectangle in port coordinates */ |
|
447 /* Used by MAC only. */ |
|
448 #ifdef XP_UNIX |
|
449 void * ws_info; /* Platform-dependent additonal data */ |
|
450 #endif /* XP_UNIX */ |
|
451 NPWindowType type; /* Is this a window or a drawable? */ |
|
452 } NPWindow; |
|
453 |
|
454 |
|
455 typedef struct _NPFullPrint |
|
456 { |
|
457 NPBool pluginPrinted; /* Set TRUE if plugin handled fullscreen */ |
|
458 /* printing */ |
|
459 NPBool printOne; /* TRUE if plugin should print one copy */ |
|
460 /* to default printer */ |
|
461 void* platformPrint; /* Platform-specific printing info */ |
|
462 } NPFullPrint; |
|
463 |
|
464 typedef struct _NPEmbedPrint |
|
465 { |
|
466 NPWindow window; |
|
467 void* platformPrint; /* Platform-specific printing info */ |
|
468 } NPEmbedPrint; |
|
469 |
|
470 typedef struct _NPPrint |
|
471 { |
|
472 uint16 mode; /* NP_FULL or NP_EMBED */ |
|
473 union |
|
474 { |
|
475 NPFullPrint fullPrint; /* if mode is NP_FULL */ |
|
476 NPEmbedPrint embedPrint; /* if mode is NP_EMBED */ |
|
477 } print; |
|
478 } NPPrint; |
|
479 |
|
480 #if defined(XP_MAC) || defined(XP_MACOSX) |
|
481 typedef EventRecord NPEvent; |
|
482 #elif defined(XP_WIN) |
|
483 typedef struct _NPEvent |
|
484 { |
|
485 uint16 event; |
|
486 uint32 wParam; |
|
487 uint32 lParam; |
|
488 } NPEvent; |
|
489 #elif defined (XP_UNIX) |
|
490 typedef XEvent NPEvent; |
|
491 #elif defined (__SYMBIAN32__) |
|
492 typedef struct _NPEvent |
|
493 { |
|
494 uint32 event; |
|
495 void* param; |
|
496 } NPEvent; |
|
497 #else |
|
498 typedef void* NPEvent; |
|
499 #endif /* XP_MAC */ |
|
500 |
|
501 #if defined(XP_MAC) |
|
502 typedef RgnHandle NPRegion; |
|
503 #elif defined(XP_MACOSX) |
|
504 /* |
|
505 * NPRegion's type depends on the drawing model specified by the plugin (see NPNVpluginDrawingModel). |
|
506 * NPQDRegion represents a QuickDraw RgnHandle and is used with the QuickDraw drawing model. |
|
507 * NPCGRegion repesents a graphical region when using any other drawing model. |
|
508 */ |
|
509 typedef void *NPRegion; |
|
510 #ifndef NP_NO_QUICKDRAW |
|
511 typedef RgnHandle NPQDRegion; |
|
512 #endif |
|
513 typedef CGPathRef NPCGRegion; |
|
514 #elif defined(XP_WIN) |
|
515 typedef HRGN NPRegion; |
|
516 #elif defined(XP_UNIX) |
|
517 typedef Region NPRegion; |
|
518 #else |
|
519 typedef void *NPRegion; |
|
520 #endif /* XP_MAC */ |
|
521 |
|
522 #ifdef XP_MACOSX |
|
523 |
|
524 /* |
|
525 * NP_CGContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelCoreGraphics |
|
526 * as its drawing model. |
|
527 */ |
|
528 |
|
529 typedef struct NP_CGContext |
|
530 { |
|
531 CGContextRef context; |
|
532 WindowRef window; |
|
533 } NP_CGContext; |
|
534 |
|
535 /* |
|
536 * NP_GLContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelOpenGL as its |
|
537 * drawing model. |
|
538 */ |
|
539 |
|
540 typedef struct NP_GLContext |
|
541 { |
|
542 CGLContextObj context; |
|
543 WindowRef window; |
|
544 } NP_GLContext; |
|
545 |
|
546 #endif /* XP_MACOSX */ |
|
547 |
|
548 #if defined(XP_MAC) || defined(XP_MACOSX) |
|
549 |
|
550 /* |
|
551 * Mac-specific structures and definitions. |
|
552 */ |
|
553 |
|
554 #ifndef NP_NO_QUICKDRAW |
|
555 |
|
556 /* |
|
557 * NP_Port is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelQuickDraw as its |
|
558 * drawing model, or the plugin does not specify a drawing model. |
|
559 * |
|
560 * It is not recommended that new plugins use NPDrawingModelQuickDraw or NP_Port, as QuickDraw has been |
|
561 * deprecated in Mac OS X 10.5. CoreGraphics is the preferred drawing API. |
|
562 * |
|
563 * NP_Port is not available in 64-bit. |
|
564 */ |
|
565 |
|
566 typedef struct NP_Port |
|
567 { |
|
568 CGrafPtr port; /* Grafport */ |
|
569 int32 portx; /* position inside the topmost window */ |
|
570 int32 porty; |
|
571 } NP_Port; |
|
572 |
|
573 #endif /* NP_NO_QUICKDRAW */ |
|
574 |
|
575 /* |
|
576 * Non-standard event types that can be passed to HandleEvent |
|
577 */ |
|
578 #define getFocusEvent (osEvt + 16) |
|
579 #define loseFocusEvent (osEvt + 17) |
|
580 #define adjustCursorEvent (osEvt + 18) |
|
581 |
|
582 #endif /* XP_MAC */ |
|
583 |
|
584 |
|
585 /* |
|
586 * Values for mode passed to NPP_New: |
|
587 */ |
|
588 #define NP_EMBED 1 |
|
589 #define NP_FULL 2 |
|
590 |
|
591 /* |
|
592 * Values for stream type passed to NPP_NewStream: |
|
593 */ |
|
594 #define NP_NORMAL 1 |
|
595 #define NP_SEEK 2 |
|
596 #define NP_ASFILE 3 |
|
597 #define NP_ASFILEONLY 4 |
|
598 |
|
599 #define NP_MAXREADY (((unsigned)(~0)<<1)>>1) |
|
600 |
|
601 #if !defined(__LP64__) |
|
602 #if defined(XP_MAC) || defined(XP_MACOSX) |
|
603 #pragma options align=reset |
|
604 #endif |
|
605 #endif /* __LP64__ */ |
|
606 |
|
607 |
|
608 /*----------------------------------------------------------------------*/ |
|
609 /* Error and Reason Code definitions */ |
|
610 /*----------------------------------------------------------------------*/ |
|
611 |
|
612 /* |
|
613 * Values of type NPError: |
|
614 */ |
|
615 #define NPERR_BASE 0 |
|
616 #define NPERR_NO_ERROR (NPERR_BASE + 0) |
|
617 #define NPERR_GENERIC_ERROR (NPERR_BASE + 1) |
|
618 #define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2) |
|
619 #define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3) |
|
620 #define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4) |
|
621 #define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5) |
|
622 #define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6) |
|
623 #define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7) |
|
624 #define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8) |
|
625 #define NPERR_INVALID_PARAM (NPERR_BASE + 9) |
|
626 #define NPERR_INVALID_URL (NPERR_BASE + 10) |
|
627 #define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11) |
|
628 #define NPERR_NO_DATA (NPERR_BASE + 12) |
|
629 #define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13) |
|
630 |
|
631 /* |
|
632 * Values of type NPReason: |
|
633 */ |
|
634 #define NPRES_BASE 0 |
|
635 #define NPRES_DONE (NPRES_BASE + 0) |
|
636 #define NPRES_NETWORK_ERR (NPRES_BASE + 1) |
|
637 #define NPRES_USER_BREAK (NPRES_BASE + 2) |
|
638 |
|
639 /* |
|
640 * Don't use these obsolete error codes any more. |
|
641 */ |
|
642 #define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR |
|
643 #define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR |
|
644 #define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK |
|
645 |
|
646 /* |
|
647 * Version feature information |
|
648 */ |
|
649 #define NPVERS_HAS_STREAMOUTPUT 8 |
|
650 #define NPVERS_HAS_NOTIFICATION 9 |
|
651 #define NPVERS_HAS_LIVECONNECT 9 |
|
652 #define NPVERS_WIN16_HAS_LIVECONNECT 9 |
|
653 #define NPVERS_68K_HAS_LIVECONNECT 11 |
|
654 #define NPVERS_HAS_WINDOWLESS 11 |
|
655 #define NPVERS_HAS_XPCONNECT_SCRIPTING 13 /* Not implemented in WebKit */ |
|
656 #define NPVERS_HAS_NPRUNTIME_SCRIPTING 14 |
|
657 #define NPVERS_HAS_FORM_VALUES 15 /* Not implemented in WebKit; see bug 13061 */ |
|
658 #define NPVERS_HAS_POPUPS_ENABLED_STATE 16 /* Not implemented in WebKit */ |
|
659 #define NPVERS_HAS_RESPONSE_HEADERS 17 |
|
660 #define NPVERS_HAS_NPOBJECT_ENUM 18 |
|
661 |
|
662 |
|
663 /*----------------------------------------------------------------------*/ |
|
664 /* Function Prototypes */ |
|
665 /*----------------------------------------------------------------------*/ |
|
666 |
|
667 #if defined(_WINDOWS) && !defined(WIN32) |
|
668 #define NP_LOADDS _loadds |
|
669 #else |
|
670 #define NP_LOADDS |
|
671 #endif |
|
672 |
|
673 #ifndef __SYMBIAN32__ |
|
674 #ifdef __cplusplus |
|
675 extern "C" { |
|
676 #endif |
|
677 #endif |
|
678 |
|
679 /* |
|
680 * NPP_* functions are provided by the plugin and called by the navigator. |
|
681 */ |
|
682 |
|
683 #ifdef XP_UNIX |
|
684 char* NPP_GetMIMEDescription(void); |
|
685 #endif /* XP_UNIX */ |
|
686 |
|
687 #ifdef __SYMBIAN32__ |
|
688 #include <badesca.h> |
|
689 IMPORT_C const TDesC* NPP_GetMIMEDescription(void); |
|
690 #endif /* __SYMBIAN32__ */ |
|
691 |
|
692 NPError NPP_Initialize(void); |
|
693 #ifdef __SYMBIAN32__ |
|
694 IMPORT_C |
|
695 #endif /* __SYMBIAN32__ */ |
|
696 void NPP_Shutdown(void); |
|
697 |
|
698 #ifndef __SYMBIAN32__ |
|
699 NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, |
|
700 uint16 mode, int16 argc, char* argn[], |
|
701 char* argv[], NPSavedData* saved); |
|
702 #else |
|
703 NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, |
|
704 uint16 mode, CDesCArray* argn, |
|
705 CDesCArray* argv, NPSavedData* saved); |
|
706 #endif /* __SYMBIAN32__ */ |
|
707 |
|
708 NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save); |
|
709 NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window); |
|
710 NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type, |
|
711 NPStream* stream, NPBool seekable, |
|
712 uint16* stype); |
|
713 NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream, |
|
714 NPReason reason); |
|
715 int32 NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream); |
|
716 int32 NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32 offset, |
|
717 int32 len, void* buffer); |
|
718 |
|
719 #ifndef __SYMBIAN32__ |
|
720 void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream, |
|
721 const char* fname); |
|
722 #else/* __SYMBIAN32__ */ |
|
723 void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream, |
|
724 const TDesC& fname); |
|
725 #endif /* __SYMBIAN32__ */ |
|
726 |
|
727 void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint); |
|
728 int16 NPP_HandleEvent(NPP instance, void* event); |
|
729 |
|
730 #ifndef __SYMBIAN32__ |
|
731 void NP_LOADDS NPP_URLNotify(NPP instance, const char* url, |
|
732 NPReason reason, void* notifyData); |
|
733 jref NP_LOADDS NPP_GetJavaClass(void); |
|
734 #else/* __SYMBIAN32__ */ |
|
735 void NP_LOADDS NPP_URLNotify(NPP instance, const TDesC& url, |
|
736 NPReason reason, void* notifyData); |
|
737 #endif /* __SYMBIAN32__ */ |
|
738 |
|
739 |
|
740 #ifdef __SYMBIAN32__ |
|
741 IMPORT_C |
|
742 #endif /* __SYMBIAN32__ */ |
|
743 NPError NPP_GetValue(NPP instance, NPPVariable variable, |
|
744 void *value); |
|
745 NPError NPP_SetValue(NPP instance, NPNVariable variable, |
|
746 void *value); |
|
747 |
|
748 /* |
|
749 * NPN_* functions are provided by the navigator and called by the plugin. |
|
750 */ |
|
751 |
|
752 void NPN_Version(int* plugin_major, int* plugin_minor, |
|
753 int* netscape_major, int* netscape_minor); |
|
754 |
|
755 #ifndef __SYMBIAN32__ |
|
756 NPError NPN_GetURLNotify(NPP instance, const char* url, |
|
757 const char* target, void* notifyData); |
|
758 NPError NPN_GetURL(NPP instance, const char* url, |
|
759 const char* target); |
|
760 NPError NPN_PostURLNotify(NPP instance, const char* url, |
|
761 const char* target, uint32 len, |
|
762 const char* buf, NPBool file, |
|
763 void* notifyData); |
|
764 NPError NPN_PostURL(NPP instance, const char* url, |
|
765 const char* target, uint32 len, |
|
766 const char* buf, NPBool file); |
|
767 #else/* __SYMBIAN32__ */ |
|
768 NPError NP_LOADDS NPN_GetURLNotify(NPP instance, const TDesC& url, |
|
769 const TDesC* target, void* notifyData); |
|
770 NPError NP_LOADDS NPN_GetURL(NPP instance, const TDesC& url, |
|
771 const TDesC* target); |
|
772 NPError NP_LOADDS NPN_PostURLNotify(NPP instance, const TDesC& url, |
|
773 const TDesC* target, |
|
774 const TDesC& buf, NPBool file, |
|
775 void* notifyData); |
|
776 NPError NP_LOADDS NPN_PostURL(NPP instance, const TDesC& url, |
|
777 const TDesC* target, |
|
778 const TDesC& buf, NPBool file); |
|
779 #endif /* __SYMBIAN32__ */ |
|
780 |
|
781 NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList); |
|
782 |
|
783 #ifndef __SYMBIAN32__ |
|
784 NPError NPN_NewStream(NPP instance, NPMIMEType type, |
|
785 const char* target, NPStream** stream); |
|
786 #else/* __SYMBIAN32__ */ |
|
787 NPError NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type, |
|
788 const TDesC* target, NPStream** stream); |
|
789 #endif /* __SYMBIAN32__ */ |
|
790 |
|
791 int32 NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer); |
|
792 NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPReason reason); |
|
793 |
|
794 #ifndef __SYMBIAN32__ |
|
795 void NPN_Status(NPP instance, const char* message); |
|
796 #else/* __SYMBIAN32__ */ |
|
797 void NP_LOADDS NPN_Status(NPP instance, const TDesC& message); |
|
798 #endif /* __SYMBIAN32__ */ |
|
799 |
|
800 #ifndef __SYMBIAN32__ |
|
801 const char* NPN_UserAgent(NPP instance); |
|
802 #else/* __SYMBIAN32__ */ |
|
803 const TDesC* NP_LOADDS NPN_UserAgent(NPP instance); |
|
804 #endif /* __SYMBIAN32__ */ |
|
805 |
|
806 |
|
807 void* NPN_MemAlloc(uint32 size); |
|
808 void NPN_MemFree(void* ptr); |
|
809 uint32 NPN_MemFlush(uint32 size); |
|
810 void NPN_ReloadPlugins(NPBool reloadPages); |
|
811 #ifndef __SYMBIAN32__ |
|
812 JRIEnv* NPN_GetJavaEnv(void); |
|
813 jref NPN_GetJavaPeer(NPP instance); |
|
814 #endif |
|
815 NPError NPN_GetValue(NPP instance, NPNVariable variable, |
|
816 void *value); |
|
817 NPError NPN_SetValue(NPP instance, NPPVariable variable, |
|
818 void *value); |
|
819 void NPN_InvalidateRect(NPP instance, NPRect *invalidRect); |
|
820 void NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion); |
|
821 void NPN_ForceRedraw(NPP instance); |
|
822 void NPN_PushPopupsEnabledState(NPP instance, NPBool enabled); |
|
823 void NPN_PopPopupsEnabledState(NPP instance); |
|
824 |
|
825 #ifndef __SYMBIAN32__ |
|
826 #ifdef __cplusplus |
|
827 } /* end extern "C" */ |
|
828 #endif |
|
829 #endif |
|
830 |
|
831 #endif /* _NPAPI_H_ */ |