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