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