OLD | NEW |
| (Empty) |
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | |
2 /* ***** BEGIN LICENSE BLOCK ***** | |
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | |
4 * | |
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/ | |
9 * | |
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. | |
14 * | |
15 * The Original Code is mozilla.org code. | |
16 * | |
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. | |
21 * | |
22 * Contributor(s): | |
23 * | |
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. | |
35 * | |
36 * ***** END LICENSE BLOCK ***** */ | |
37 | |
38 #ifndef npapi_h_ | |
39 #define npapi_h_ | |
40 | |
41 #if defined(__OS2__) | |
42 #pragma pack(1) | |
43 #endif | |
44 | |
45 /* BEGIN GOOGLE MODIFICATIONS */ | |
46 | |
47 #ifndef __native_client__ | |
48 #include "nptypes.h" | |
49 #endif | |
50 | |
51 #include <stdint.h> | |
52 #include <sys/types.h> | |
53 | |
54 /* END GOOGLE MODIFICATIONS */ | |
55 | |
56 #if defined(__OS2__) || defined(OS2) | |
57 #ifndef XP_OS2 | |
58 #define XP_OS2 1 | |
59 #endif | |
60 #endif | |
61 | |
62 #if defined(_WIN32) && !defined(__SYMBIAN32__) | |
63 #include <windows.h> | |
64 #ifndef XP_WIN | |
65 #define XP_WIN 1 | |
66 #endif | |
67 #endif | |
68 | |
69 /* BEGIN GOOGLE MODIFICATIONS */ | |
70 /* On Linux and Mac, be sure to set Mozilla-specific macros. */ | |
71 #if defined(USE_X11) | |
72 #if !defined(XP_UNIX) | |
73 #define XP_UNIX 1 | |
74 #endif | |
75 #if !defined(MOZ_X11) | |
76 #define MOZ_X11 1 | |
77 #endif | |
78 #endif | |
79 /* END GOOGLE MODIFICATIONS */ | |
80 | |
81 #if defined(__SYMBIAN32__) | |
82 #ifndef XP_SYMBIAN | |
83 #define XP_SYMBIAN 1 | |
84 #undef XP_WIN | |
85 #endif | |
86 #endif | |
87 | |
88 #if defined(__APPLE_CC__) && !defined(XP_UNIX) | |
89 #ifndef XP_MACOSX | |
90 #define XP_MACOSX 1 | |
91 #endif | |
92 #endif | |
93 | |
94 #if defined(XP_MACOSX) && defined(__LP64__) | |
95 #define NP_NO_QUICKDRAW | |
96 #define NP_NO_CARBON | |
97 #endif | |
98 | |
99 #if defined(XP_MACOSX) | |
100 #include <ApplicationServices/ApplicationServices.h> | |
101 #include <OpenGL/OpenGL.h> | |
102 #ifndef NP_NO_CARBON | |
103 #include <Carbon/Carbon.h> | |
104 #endif | |
105 #endif | |
106 | |
107 #if defined(XP_UNIX) | |
108 #include <stdio.h> | |
109 /* BEGIN GOOGLE MODIFICATIONS */ | |
110 #if 0 | |
111 /* END GOOGLE MODIFICATIONS */ | |
112 #if defined(MOZ_X11) | |
113 #include <X11/Xlib.h> | |
114 #include <X11/Xutil.h> | |
115 #endif | |
116 /* BEGIN GOOGLE MODIFICATIONS */ | |
117 #endif | |
118 /* END GOOGLE MODIFICATIONS */ | |
119 #endif | |
120 | |
121 #if defined(XP_SYMBIAN) | |
122 #include <QEvent> | |
123 #include <QRegion> | |
124 #endif | |
125 | |
126 /*----------------------------------------------------------------------*/ | |
127 /* Plugin Version Constants */ | |
128 /*----------------------------------------------------------------------*/ | |
129 | |
130 #define NP_VERSION_MAJOR 0 | |
131 #define NP_VERSION_MINOR 27 | |
132 | |
133 | |
134 /* The OS/2 version of Netscape uses RC_DATA to define the | |
135 mime types, file extensions, etc that are required. | |
136 Use a vertical bar to separate types, end types with \0. | |
137 FileVersion and ProductVersion are 32bit ints, all other | |
138 entries are strings that MUST be terminated with a \0. | |
139 | |
140 AN EXAMPLE: | |
141 | |
142 RCDATA NP_INFO_ProductVersion { 1,0,0,1,} | |
143 | |
144 RCDATA NP_INFO_MIMEType { "video/x-video|", | |
145 "video/x-flick\0" } | |
146 RCDATA NP_INFO_FileExtents { "avi|", | |
147 "flc\0" } | |
148 RCDATA NP_INFO_FileOpenName{ "MMOS2 video player(*.avi)|", | |
149 "MMOS2 Flc/Fli player(*.flc)\0" } | |
150 | |
151 RCDATA NP_INFO_FileVersion { 1,0,0,1 } | |
152 RCDATA NP_INFO_CompanyName { "Netscape Communications\0" } | |
153 RCDATA NP_INFO_FileDescription { "NPAVI32 Extension DLL\0" | |
154 RCDATA NP_INFO_InternalName { "NPAVI32\0" ) | |
155 RCDATA NP_INFO_LegalCopyright { "Copyright Netscape Communications \251 1996\
0" | |
156 RCDATA NP_INFO_OriginalFilename { "NVAPI32.DLL" } | |
157 RCDATA NP_INFO_ProductName { "NPAVI32 Dynamic Link Library\0" } | |
158 */ | |
159 /* RC_DATA types for version info - required */ | |
160 #define NP_INFO_ProductVersion 1 | |
161 #define NP_INFO_MIMEType 2 | |
162 #define NP_INFO_FileOpenName 3 | |
163 #define NP_INFO_FileExtents 4 | |
164 /* RC_DATA types for version info - used if found */ | |
165 #define NP_INFO_FileDescription 5 | |
166 #define NP_INFO_ProductName 6 | |
167 /* RC_DATA types for version info - optional */ | |
168 #define NP_INFO_CompanyName 7 | |
169 #define NP_INFO_FileVersion 8 | |
170 #define NP_INFO_InternalName 9 | |
171 #define NP_INFO_LegalCopyright 10 | |
172 #define NP_INFO_OriginalFilename 11 | |
173 | |
174 #ifndef RC_INVOKED | |
175 | |
176 /*----------------------------------------------------------------------*/ | |
177 /* Definition of Basic Types */ | |
178 /*----------------------------------------------------------------------*/ | |
179 | |
180 typedef unsigned char NPBool; | |
181 typedef int16_t NPError; | |
182 typedef int16_t NPReason; | |
183 typedef char* NPMIMEType; | |
184 | |
185 /*----------------------------------------------------------------------*/ | |
186 /* Structures and definitions */ | |
187 /*----------------------------------------------------------------------*/ | |
188 | |
189 #if !defined(__LP64__) | |
190 #if defined(XP_MACOSX) | |
191 #pragma options align=mac68k | |
192 #endif | |
193 #endif /* __LP64__ */ | |
194 | |
195 /* | |
196 * NPP is a plugin's opaque instance handle | |
197 */ | |
198 typedef struct _NPP | |
199 { | |
200 void* pdata; /* plugin private data */ | |
201 void* ndata; /* netscape private data */ | |
202 } NPP_t; | |
203 | |
204 typedef NPP_t* NPP; | |
205 | |
206 typedef struct _NPStream | |
207 { | |
208 void* pdata; /* plugin private data */ | |
209 void* ndata; /* netscape private data */ | |
210 const char* url; | |
211 uint32_t end; | |
212 uint32_t lastmodified; | |
213 void* notifyData; | |
214 const char* headers; /* Response headers from host. | |
215 * Exists only for >= NPVERS_HAS_RESPONSE_HEADERS. | |
216 * Used for HTTP only; NULL for non-HTTP. | |
217 * Available from NPP_NewStream onwards. | |
218 * Plugin should copy this data before storing it. | |
219 * Includes HTTP status line and all headers, | |
220 * preferably verbatim as received from server, | |
221 * headers formatted as in HTTP ("Header: Value"), | |
222 * and newlines (\n, NOT \r\n) separating lines. | |
223 * Terminated by \n\0 (NOT \n\n\0). */ | |
224 } NPStream; | |
225 | |
226 typedef struct _NPByteRange | |
227 { | |
228 int32_t offset; /* negative offset means from the end */ | |
229 uint32_t length; | |
230 struct _NPByteRange* next; | |
231 } NPByteRange; | |
232 | |
233 typedef struct _NPSavedData | |
234 { | |
235 int32_t len; | |
236 void* buf; | |
237 } NPSavedData; | |
238 | |
239 typedef struct _NPRect | |
240 { | |
241 uint16_t top; | |
242 uint16_t left; | |
243 uint16_t bottom; | |
244 uint16_t right; | |
245 } NPRect; | |
246 | |
247 typedef struct _NPSize | |
248 { | |
249 int32_t width; | |
250 int32_t height; | |
251 } NPSize; | |
252 | |
253 typedef enum { | |
254 NPFocusNext = 0, | |
255 NPFocusPrevious = 1 | |
256 } NPFocusDirection; | |
257 | |
258 /* Return values for NPP_HandleEvent */ | |
259 #define kNPEventNotHandled 0 | |
260 #define kNPEventHandled 1 | |
261 /* Exact meaning must be spec'd in event model. */ | |
262 #define kNPEventStartIME 2 | |
263 | |
264 #if defined(XP_UNIX) | |
265 /* | |
266 * Unix specific structures and definitions | |
267 */ | |
268 | |
269 /* | |
270 * Callback Structures. | |
271 * | |
272 * These are used to pass additional platform specific information. | |
273 */ | |
274 enum { | |
275 NP_SETWINDOW = 1, | |
276 NP_PRINT | |
277 }; | |
278 | |
279 typedef struct | |
280 { | |
281 int32_t type; | |
282 } NPAnyCallbackStruct; | |
283 | |
284 /* BEGIN GOOGLE MODIFICATIONS */ | |
285 typedef struct _NPSetWindowCallbackStruct NPSetWindowCallbackStruct; | |
286 /* END GOOGLE MODIFICATIONS */ | |
287 | |
288 typedef struct | |
289 { | |
290 int32_t type; | |
291 FILE* fp; | |
292 } NPPrintCallbackStruct; | |
293 | |
294 #endif /* XP_UNIX */ | |
295 | |
296 #if defined(XP_MACOSX) | |
297 typedef enum { | |
298 #ifndef NP_NO_QUICKDRAW | |
299 NPDrawingModelQuickDraw = 0, | |
300 #endif | |
301 NPDrawingModelCoreGraphics = 1, | |
302 NPDrawingModelOpenGL = 2, | |
303 NPDrawingModelCoreAnimation = 3, | |
304 NPDrawingModelInvalidatingCoreAnimation = 4 | |
305 } NPDrawingModel; | |
306 | |
307 typedef enum { | |
308 #ifndef NP_NO_CARBON | |
309 NPEventModelCarbon = 0, | |
310 #endif | |
311 NPEventModelCocoa = 1 | |
312 } NPEventModel; | |
313 #endif | |
314 | |
315 /* | |
316 * The following masks are applied on certain platforms to NPNV and | |
317 * NPPV selectors that pass around pointers to COM interfaces. Newer | |
318 * compilers on some platforms may generate vtables that are not | |
319 * compatible with older compilers. To prevent older plugins from | |
320 * not understanding a new browser's ABI, these masks change the | |
321 * values of those selectors on those platforms. To remain backwards | |
322 * compatible with different versions of the browser, plugins can | |
323 * use these masks to dynamically determine and use the correct C++ | |
324 * ABI that the browser is expecting. This does not apply to Windows | |
325 * as Microsoft's COM ABI will likely not change. | |
326 */ | |
327 | |
328 #define NP_ABI_GCC3_MASK 0x10000000 | |
329 /* | |
330 * gcc 3.x generated vtables on UNIX and OSX are incompatible with | |
331 * previous compilers. | |
332 */ | |
333 #if (defined(XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3)) | |
334 #define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK | |
335 #else | |
336 #define _NP_ABI_MIXIN_FOR_GCC3 0 | |
337 #endif | |
338 | |
339 #if defined(XP_MACOSX) | |
340 #define NP_ABI_MACHO_MASK 0x01000000 | |
341 #define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK | |
342 #else | |
343 #define _NP_ABI_MIXIN_FOR_MACHO 0 | |
344 #endif | |
345 | |
346 #define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO) | |
347 | |
348 /* | |
349 * List of variable names for which NPP_GetValue shall be implemented | |
350 */ | |
351 typedef enum { | |
352 NPPVpluginNameString = 1, | |
353 NPPVpluginDescriptionString, | |
354 NPPVpluginWindowBool, | |
355 NPPVpluginTransparentBool, | |
356 NPPVjavaClass, | |
357 NPPVpluginWindowSize, | |
358 NPPVpluginTimerInterval, | |
359 NPPVpluginScriptableInstance = (10 | NP_ABI_MASK), | |
360 NPPVpluginScriptableIID = 11, | |
361 NPPVjavascriptPushCallerBool = 12, | |
362 NPPVpluginKeepLibraryInMemory = 13, | |
363 NPPVpluginNeedsXEmbed = 14, | |
364 | |
365 /* Get the NPObject for scripting the plugin. Introduced in NPAPI minor versio
n 14. | |
366 */ | |
367 NPPVpluginScriptableNPObject = 15, | |
368 | |
369 /* Get the plugin value (as \0-terminated UTF-8 string data) for | |
370 * form submission if the plugin is part of a form. Use | |
371 * NPN_MemAlloc() to allocate memory for the string data. Introduced | |
372 * in NPAPI minor version 15. | |
373 */ | |
374 NPPVformValue = 16, | |
375 | |
376 NPPVpluginUrlRequestsDisplayedBool = 17, | |
377 | |
378 /* Checks if the plugin is interested in receiving the http body of | |
379 * all http requests (including failed ones, http status != 200). | |
380 */ | |
381 NPPVpluginWantsAllNetworkStreams = 18, | |
382 | |
383 /* Browsers can retrieve a native ATK accessibility plug ID via this variable.
*/ | |
384 NPPVpluginNativeAccessibleAtkPlugId = 19, | |
385 | |
386 /* Checks to see if the plugin would like the browser to load the "src" attrib
ute. */ | |
387 NPPVpluginCancelSrcStream = 20, | |
388 | |
389 NPPVsupportsAdvancedKeyHandling = 21, | |
390 | |
391 NPPVpluginUsesDOMForCursorBool = 22 | |
392 | |
393 #if defined(XP_MACOSX) | |
394 /* Used for negotiating drawing models */ | |
395 , NPPVpluginDrawingModel = 1000 | |
396 /* Used for negotiating event models */ | |
397 , NPPVpluginEventModel = 1001 | |
398 /* In the NPDrawingModelCoreAnimation drawing model, the browser asks the plug
in for a Core Animation layer. */ | |
399 , NPPVpluginCoreAnimationLayer = 1003 | |
400 #endif | |
401 | |
402 #if defined(MOZ_PLATFORM_MAEMO) && ((MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_M
AEMO == 6)) | |
403 , NPPVpluginWindowlessLocalBool = 2002 | |
404 #endif | |
405 } NPPVariable; | |
406 | |
407 /* | |
408 * List of variable names for which NPN_GetValue should be implemented. | |
409 */ | |
410 typedef enum { | |
411 NPNVxDisplay = 1, | |
412 NPNVxtAppContext, | |
413 NPNVnetscapeWindow, | |
414 NPNVjavascriptEnabledBool, | |
415 NPNVasdEnabledBool, | |
416 NPNVisOfflineBool, | |
417 | |
418 NPNVserviceManager = (10 | NP_ABI_MASK), | |
419 NPNVDOMElement = (11 | NP_ABI_MASK), | |
420 NPNVDOMWindow = (12 | NP_ABI_MASK), | |
421 NPNVToolkit = (13 | NP_ABI_MASK), | |
422 NPNVSupportsXEmbedBool = 14, | |
423 | |
424 /* Get the NPObject wrapper for the browser window. */ | |
425 NPNVWindowNPObject = 15, | |
426 | |
427 /* Get the NPObject wrapper for the plugins DOM element. */ | |
428 NPNVPluginElementNPObject = 16, | |
429 | |
430 NPNVSupportsWindowless = 17, | |
431 | |
432 NPNVprivateModeBool = 18, | |
433 | |
434 NPNVsupportsAdvancedKeyHandling = 21, | |
435 | |
436 NPNVdocumentOrigin = 22 | |
437 | |
438 #if defined(XP_MACOSX) | |
439 /* Used for negotiating drawing models */ | |
440 , NPNVpluginDrawingModel = 1000 | |
441 #ifndef NP_NO_QUICKDRAW | |
442 , NPNVsupportsQuickDrawBool = 2000 | |
443 #endif | |
444 , NPNVsupportsCoreGraphicsBool = 2001 | |
445 , NPNVsupportsOpenGLBool = 2002 | |
446 , NPNVsupportsCoreAnimationBool = 2003 | |
447 , NPNVsupportsInvalidatingCoreAnimationBool = 2004 | |
448 #ifndef NP_NO_CARBON | |
449 , NPNVsupportsCarbonBool = 3000 /* TRUE if the browser supports the Carbon eve
nt model */ | |
450 #endif | |
451 , NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event
model */ | |
452 , NPNVsupportsUpdatedCocoaTextInputBool = 3002 /* TRUE if the browser supports
the updated | |
453 Cocoa text input specificati
on. */ | |
454 , NPNVsupportsCompositingCoreAnimationPluginsBool = 74656 /* TRUE if the brows
er supports | |
455 CA model composit
ing */ | |
456 #endif | |
457 #if defined(MOZ_PLATFORM_MAEMO) && ((MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_M
AEMO == 6)) | |
458 , NPNVSupportsWindowlessLocal = 2002 | |
459 #endif | |
460 } NPNVariable; | |
461 | |
462 typedef enum { | |
463 NPNURLVCookie = 501, | |
464 NPNURLVProxy | |
465 } NPNURLVariable; | |
466 | |
467 /* | |
468 * The type of Toolkit the widgets use | |
469 */ | |
470 typedef enum { | |
471 NPNVGtk12 = 1, | |
472 NPNVGtk2 | |
473 } NPNToolkitType; | |
474 | |
475 /* | |
476 * The type of a NPWindow - it specifies the type of the data structure | |
477 * returned in the window field. | |
478 */ | |
479 typedef enum { | |
480 NPWindowTypeWindow = 1, | |
481 NPWindowTypeDrawable | |
482 } NPWindowType; | |
483 | |
484 typedef struct _NPWindow | |
485 { | |
486 void* window; /* Platform specific window handle */ | |
487 /* OS/2: x - Position of bottom left corner */ | |
488 /* OS/2: y - relative to visible netscape window */ | |
489 int32_t x; /* Position of top left corner relative */ | |
490 int32_t y; /* to a netscape page. */ | |
491 uint32_t width; /* Maximum window size */ | |
492 uint32_t height; | |
493 NPRect clipRect; /* Clipping rectangle in port coordinates */ | |
494 #if (defined(XP_UNIX) || defined(XP_SYMBIAN)) && !defined(XP_MACOSX) | |
495 void * ws_info; /* Platform-dependent additional data */ | |
496 #endif /* XP_UNIX */ | |
497 NPWindowType type; /* Is this a window or a drawable? */ | |
498 } NPWindow; | |
499 | |
500 typedef struct _NPImageExpose | |
501 { | |
502 char* data; /* image pointer */ | |
503 int32_t stride; /* Stride of data image pointer */ | |
504 int32_t depth; /* Depth of image pointer */ | |
505 int32_t x; /* Expose x */ | |
506 int32_t y; /* Expose y */ | |
507 uint32_t width; /* Expose width */ | |
508 uint32_t height; /* Expose height */ | |
509 NPSize dataSize; /* Data buffer size */ | |
510 float translateX; /* translate X matrix value */ | |
511 float translateY; /* translate Y matrix value */ | |
512 float scaleX; /* scale X matrix value */ | |
513 float scaleY; /* scale Y matrix value */ | |
514 } NPImageExpose; | |
515 | |
516 typedef struct _NPFullPrint | |
517 { | |
518 NPBool pluginPrinted;/* Set TRUE if plugin handled fullscreen printing */ | |
519 NPBool printOne; /* TRUE if plugin should print one copy to default | |
520 printer */ | |
521 void* platformPrint; /* Platform-specific printing info */ | |
522 } NPFullPrint; | |
523 | |
524 typedef struct _NPEmbedPrint | |
525 { | |
526 NPWindow window; | |
527 void* platformPrint; /* Platform-specific printing info */ | |
528 } NPEmbedPrint; | |
529 | |
530 typedef struct _NPPrint | |
531 { | |
532 uint16_t mode; /* NP_FULL or NP_EMBED */ | |
533 union | |
534 { | |
535 NPFullPrint fullPrint; /* if mode is NP_FULL */ | |
536 NPEmbedPrint embedPrint; /* if mode is NP_EMBED */ | |
537 } print; | |
538 } NPPrint; | |
539 | |
540 #if defined(XP_MACOSX) | |
541 #ifndef NP_NO_CARBON | |
542 typedef EventRecord NPEvent; | |
543 #endif | |
544 #elif defined(XP_SYMBIAN) | |
545 typedef QEvent NPEvent; | |
546 #elif defined(XP_WIN) | |
547 typedef struct _NPEvent | |
548 { | |
549 uint16_t event; | |
550 uintptr_t wParam; | |
551 uintptr_t lParam; | |
552 } NPEvent; | |
553 #elif defined(XP_OS2) | |
554 typedef struct _NPEvent | |
555 { | |
556 uint32_t event; | |
557 uint32_t wParam; | |
558 uint32_t lParam; | |
559 } NPEvent; | |
560 #elif defined(XP_UNIX) && defined(MOZ_X11) | |
561 /* BEGIN GOOGLE MODIFICATIONS */ | |
562 typedef union _XEvent XEvent; | |
563 /* END GOOGLE MODIFICATIONS */ | |
564 typedef XEvent NPEvent; | |
565 #else | |
566 typedef void* NPEvent; | |
567 #endif | |
568 | |
569 #if defined(XP_MACOSX) | |
570 typedef void* NPRegion; | |
571 #ifndef NP_NO_QUICKDRAW | |
572 typedef RgnHandle NPQDRegion; | |
573 #endif | |
574 typedef CGPathRef NPCGRegion; | |
575 #elif defined(XP_WIN) | |
576 typedef HRGN NPRegion; | |
577 #elif defined(XP_UNIX) && defined(MOZ_X11) | |
578 /* BEGIN GOOGLE MODIFICATIONS */ | |
579 typedef struct _XRegion *Region; | |
580 /* END GOOGLE MODIFICATIONS */ | |
581 typedef Region NPRegion; | |
582 #elif defined(XP_SYMBIAN) | |
583 typedef QRegion* NPRegion; | |
584 #else | |
585 typedef void *NPRegion; | |
586 #endif | |
587 | |
588 typedef struct _NPNSString NPNSString; | |
589 typedef struct _NPNSWindow NPNSWindow; | |
590 typedef struct _NPNSMenu NPNSMenu; | |
591 | |
592 #if defined(XP_MACOSX) | |
593 typedef NPNSMenu NPMenu; | |
594 #else | |
595 typedef void *NPMenu; | |
596 #endif | |
597 | |
598 typedef enum { | |
599 NPCoordinateSpacePlugin = 1, | |
600 NPCoordinateSpaceWindow, | |
601 NPCoordinateSpaceFlippedWindow, | |
602 NPCoordinateSpaceScreen, | |
603 NPCoordinateSpaceFlippedScreen | |
604 } NPCoordinateSpace; | |
605 | |
606 #if defined(XP_MACOSX) | |
607 | |
608 #ifndef NP_NO_QUICKDRAW | |
609 typedef struct NP_Port | |
610 { | |
611 CGrafPtr port; | |
612 int32_t portx; /* position inside the topmost window */ | |
613 int32_t porty; | |
614 } NP_Port; | |
615 #endif /* NP_NO_QUICKDRAW */ | |
616 | |
617 /* | |
618 * NP_CGContext is the type of the NPWindow's 'window' when the plugin specifies
NPDrawingModelCoreGraphics | |
619 * as its drawing model. | |
620 */ | |
621 | |
622 typedef struct NP_CGContext | |
623 { | |
624 CGContextRef context; | |
625 void *window; /* A WindowRef under the Carbon event model. */ | |
626 } NP_CGContext; | |
627 | |
628 /* | |
629 * NP_GLContext is the type of the NPWindow's 'window' when the plugin specifies
NPDrawingModelOpenGL as its | |
630 * drawing model. | |
631 */ | |
632 | |
633 typedef struct NP_GLContext | |
634 { | |
635 CGLContextObj context; | |
636 #ifdef NP_NO_CARBON | |
637 NPNSWindow *window; | |
638 #else | |
639 void *window; /* Can be either an NSWindow or a WindowRef depending on the eve
nt model */ | |
640 #endif | |
641 } NP_GLContext; | |
642 | |
643 typedef enum { | |
644 NPCocoaEventDrawRect = 1, | |
645 NPCocoaEventMouseDown, | |
646 NPCocoaEventMouseUp, | |
647 NPCocoaEventMouseMoved, | |
648 NPCocoaEventMouseEntered, | |
649 NPCocoaEventMouseExited, | |
650 NPCocoaEventMouseDragged, | |
651 NPCocoaEventKeyDown, | |
652 NPCocoaEventKeyUp, | |
653 NPCocoaEventFlagsChanged, | |
654 NPCocoaEventFocusChanged, | |
655 NPCocoaEventWindowFocusChanged, | |
656 NPCocoaEventScrollWheel, | |
657 NPCocoaEventTextInput | |
658 } NPCocoaEventType; | |
659 | |
660 typedef struct _NPCocoaEvent { | |
661 NPCocoaEventType type; | |
662 uint32_t version; | |
663 union { | |
664 struct { | |
665 uint32_t modifierFlags; | |
666 double pluginX; | |
667 double pluginY; | |
668 int32_t buttonNumber; | |
669 int32_t clickCount; | |
670 double deltaX; | |
671 double deltaY; | |
672 double deltaZ; | |
673 } mouse; | |
674 struct { | |
675 uint32_t modifierFlags; | |
676 NPNSString *characters; | |
677 NPNSString *charactersIgnoringModifiers; | |
678 NPBool isARepeat; | |
679 uint16_t keyCode; | |
680 } key; | |
681 struct { | |
682 CGContextRef context; | |
683 double x; | |
684 double y; | |
685 double width; | |
686 double height; | |
687 } draw; | |
688 struct { | |
689 NPBool hasFocus; | |
690 } focus; | |
691 struct { | |
692 NPNSString *text; | |
693 } text; | |
694 } data; | |
695 } NPCocoaEvent; | |
696 | |
697 #ifndef NP_NO_CARBON | |
698 /* Non-standard event types that can be passed to HandleEvent */ | |
699 enum NPEventType { | |
700 NPEventType_GetFocusEvent = (osEvt + 16), | |
701 NPEventType_LoseFocusEvent, | |
702 NPEventType_AdjustCursorEvent, | |
703 NPEventType_MenuCommandEvent, | |
704 NPEventType_ClippingChangedEvent, | |
705 NPEventType_ScrollingBeginsEvent = 1000, | |
706 NPEventType_ScrollingEndsEvent | |
707 }; | |
708 #endif /* NP_NO_CARBON */ | |
709 | |
710 #endif /* XP_MACOSX */ | |
711 | |
712 /* | |
713 * Values for mode passed to NPP_New: | |
714 */ | |
715 #define NP_EMBED 1 | |
716 #define NP_FULL 2 | |
717 | |
718 /* | |
719 * Values for stream type passed to NPP_NewStream: | |
720 */ | |
721 #define NP_NORMAL 1 | |
722 #define NP_SEEK 2 | |
723 #define NP_ASFILE 3 | |
724 #define NP_ASFILEONLY 4 | |
725 | |
726 #define NP_MAXREADY (((unsigned)(~0)<<1)>>1) | |
727 | |
728 /* | |
729 * Flags for NPP_ClearSiteData. | |
730 */ | |
731 #define NP_CLEAR_ALL 0 | |
732 #define NP_CLEAR_CACHE (1 << 0) | |
733 | |
734 #if !defined(__LP64__) | |
735 #if defined(XP_MACOSX) | |
736 #pragma options align=reset | |
737 #endif | |
738 #endif /* __LP64__ */ | |
739 | |
740 /*----------------------------------------------------------------------*/ | |
741 /* Error and Reason Code definitions */ | |
742 /*----------------------------------------------------------------------*/ | |
743 | |
744 /* | |
745 * Values of type NPError: | |
746 */ | |
747 #define NPERR_BASE 0 | |
748 #define NPERR_NO_ERROR (NPERR_BASE + 0) | |
749 #define NPERR_GENERIC_ERROR (NPERR_BASE + 1) | |
750 #define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2) | |
751 #define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3) | |
752 #define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4) | |
753 #define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5) | |
754 #define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6) | |
755 #define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7) | |
756 #define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8) | |
757 #define NPERR_INVALID_PARAM (NPERR_BASE + 9) | |
758 #define NPERR_INVALID_URL (NPERR_BASE + 10) | |
759 #define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11) | |
760 #define NPERR_NO_DATA (NPERR_BASE + 12) | |
761 #define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13) | |
762 #define NPERR_TIME_RANGE_NOT_SUPPORTED (NPERR_BASE + 14) | |
763 #define NPERR_MALFORMED_SITE (NPERR_BASE + 15) | |
764 | |
765 /* | |
766 * Values of type NPReason: | |
767 */ | |
768 #define NPRES_BASE 0 | |
769 #define NPRES_DONE (NPRES_BASE + 0) | |
770 #define NPRES_NETWORK_ERR (NPRES_BASE + 1) | |
771 #define NPRES_USER_BREAK (NPRES_BASE + 2) | |
772 | |
773 /* | |
774 * Don't use these obsolete error codes any more. | |
775 */ | |
776 #define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR | |
777 #define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR | |
778 #define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK | |
779 | |
780 /* | |
781 * Version feature information | |
782 */ | |
783 #define NPVERS_HAS_STREAMOUTPUT 8 | |
784 #define NPVERS_HAS_NOTIFICATION 9 | |
785 #define NPVERS_HAS_LIVECONNECT 9 | |
786 #define NPVERS_68K_HAS_LIVECONNECT 11 | |
787 #define NPVERS_HAS_WINDOWLESS 11 | |
788 #define NPVERS_HAS_XPCONNECT_SCRIPTING 13 | |
789 #define NPVERS_HAS_NPRUNTIME_SCRIPTING 14 | |
790 #define NPVERS_HAS_FORM_VALUES 15 | |
791 #define NPVERS_HAS_POPUPS_ENABLED_STATE 16 | |
792 #define NPVERS_HAS_RESPONSE_HEADERS 17 | |
793 #define NPVERS_HAS_NPOBJECT_ENUM 18 | |
794 #define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19 | |
795 #define NPVERS_HAS_ALL_NETWORK_STREAMS 20 | |
796 #define NPVERS_HAS_URL_AND_AUTH_INFO 21 | |
797 #define NPVERS_HAS_PRIVATE_MODE 22 | |
798 #define NPVERS_MACOSX_HAS_COCOA_EVENTS 23 | |
799 #define NPVERS_HAS_ADVANCED_KEY_HANDLING 25 | |
800 #define NPVERS_HAS_URL_REDIRECT_HANDLING 26 | |
801 #define NPVERS_HAS_CLEAR_SITE_DATA 27 | |
802 | |
803 /*----------------------------------------------------------------------*/ | |
804 /* Function Prototypes */ | |
805 /*----------------------------------------------------------------------*/ | |
806 | |
807 #if defined(__OS2__) | |
808 #define NP_LOADDS _System | |
809 #else | |
810 #define NP_LOADDS | |
811 #endif | |
812 | |
813 #ifdef __cplusplus | |
814 extern "C" { | |
815 #endif | |
816 | |
817 /* NPP_* functions are provided by the plugin and called by the navigator. */ | |
818 | |
819 #if defined(XP_UNIX) | |
820 const char* NPP_GetMIMEDescription(void); | |
821 #endif | |
822 | |
823 NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, | |
824 uint16_t mode, int16_t argc, char* argn[], | |
825 char* argv[], NPSavedData* saved); | |
826 NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save); | |
827 NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window); | |
828 NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type, | |
829 NPStream* stream, NPBool seekable, | |
830 uint16_t* stype); | |
831 NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream, | |
832 NPReason reason); | |
833 int32_t NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream); | |
834 int32_t NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32_t offset, | |
835 int32_t len, void* buffer); | |
836 void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream, | |
837 const char* fname); | |
838 void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint); | |
839 int16_t NP_LOADDS NPP_HandleEvent(NPP instance, void* event); | |
840 void NP_LOADDS NPP_URLNotify(NPP instance, const char* url, | |
841 NPReason reason, void* notifyData); | |
842 NPError NP_LOADDS NPP_GetValue(NPP instance, NPPVariable variable, void *value); | |
843 NPError NP_LOADDS NPP_SetValue(NPP instance, NPNVariable variable, void *value); | |
844 NPBool NP_LOADDS NPP_GotFocus(NPP instance, NPFocusDirection direction); | |
845 void NP_LOADDS NPP_LostFocus(NPP instance); | |
846 void NP_LOADDS NPP_URLRedirectNotify(NPP instance, const char* url, int32_t s
tatus, void* notifyData); | |
847 NPError NP_LOADDS NPP_ClearSiteData(const char* site, uint64_t flags, uint64_t m
axAge); | |
848 char** NP_LOADDS NPP_GetSitesWithData(void); | |
849 | |
850 /* NPN_* functions are provided by the navigator and called by the plugin. */ | |
851 void NP_LOADDS NPN_Version(int* plugin_major, int* plugin_minor, | |
852 int* netscape_major, int* netscape_minor); | |
853 NPError NP_LOADDS NPN_GetURLNotify(NPP instance, const char* url, | |
854 const char* target, void* notifyData); | |
855 NPError NP_LOADDS NPN_GetURL(NPP instance, const char* url, | |
856 const char* target); | |
857 NPError NP_LOADDS NPN_PostURLNotify(NPP instance, const char* url, | |
858 const char* target, uint32_t len, | |
859 const char* buf, NPBool file, | |
860 void* notifyData); | |
861 NPError NP_LOADDS NPN_PostURL(NPP instance, const char* url, | |
862 const char* target, uint32_t len, | |
863 const char* buf, NPBool file); | |
864 NPError NP_LOADDS NPN_RequestRead(NPStream* stream, NPByteRange* rangeList); | |
865 NPError NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type, | |
866 const char* target, NPStream** stream); | |
867 int32_t NP_LOADDS NPN_Write(NPP instance, NPStream* stream, int32_t len, | |
868 void* buffer); | |
869 NPError NP_LOADDS NPN_DestroyStream(NPP instance, NPStream* stream, | |
870 NPReason reason); | |
871 void NP_LOADDS NPN_Status(NPP instance, const char* message); | |
872 const char* NP_LOADDS NPN_UserAgent(NPP instance); | |
873 void* NP_LOADDS NPN_MemAlloc(uint32_t size); | |
874 void NP_LOADDS NPN_MemFree(void* ptr); | |
875 uint32_t NP_LOADDS NPN_MemFlush(uint32_t size); | |
876 void NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages); | |
877 NPError NP_LOADDS NPN_GetValue(NPP instance, NPNVariable variable, | |
878 void *value); | |
879 NPError NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable, | |
880 void *value); | |
881 void NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect); | |
882 void NP_LOADDS NPN_InvalidateRegion(NPP instance, | |
883 NPRegion invalidRegion); | |
884 void NP_LOADDS NPN_ForceRedraw(NPP instance); | |
885 void NP_LOADDS NPN_PushPopupsEnabledState(NPP instance, NPBool enabled); | |
886 void NP_LOADDS NPN_PopPopupsEnabledState(NPP instance); | |
887 void NP_LOADDS NPN_PluginThreadAsyncCall(NPP instance, | |
888 void (*func) (void *), | |
889 void *userData); | |
890 NPError NP_LOADDS NPN_GetValueForURL(NPP instance, NPNURLVariable variable, | |
891 const char *url, char **value, | |
892 uint32_t *len); | |
893 NPError NP_LOADDS NPN_SetValueForURL(NPP instance, NPNURLVariable variable, | |
894 const char *url, const char *value, | |
895 uint32_t len); | |
896 NPError NP_LOADDS NPN_GetAuthenticationInfo(NPP instance, | |
897 const char *protocol, | |
898 const char *host, int32_t port, | |
899 const char *scheme, | |
900 const char *realm, | |
901 char **username, uint32_t *ulen, | |
902 char **password, | |
903 uint32_t *plen); | |
904 uint32_t NP_LOADDS NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool
repeat, void (*timerFunc)(NPP npp, uint32_t timerID)); | |
905 void NP_LOADDS NPN_UnscheduleTimer(NPP instance, uint32_t timerID); | |
906 NPError NP_LOADDS NPN_PopUpContextMenu(NPP instance, NPMenu* menu); | |
907 NPBool NP_LOADDS NPN_ConvertPoint(NPP instance, double sourceX, double sour
ceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSp
ace destSpace); | |
908 NPBool NP_LOADDS NPN_HandleEvent(NPP instance, void *event, NPBool handled)
; | |
909 NPBool NP_LOADDS NPN_UnfocusInstance(NPP instance, NPFocusDirection directi
on); | |
910 void NP_LOADDS NPN_URLRedirectResponse(NPP instance, void* notifyData, NP
Bool allow); | |
911 | |
912 #ifdef __cplusplus | |
913 } /* end extern "C" */ | |
914 #endif | |
915 | |
916 #endif /* RC_INVOKED */ | |
917 #if defined(__OS2__) | |
918 #pragma pack() | |
919 #endif | |
920 | |
921 #endif /* npapi_h_ */ | |
OLD | NEW |