dom/plugins/base/npapi.h

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

mercurial