npapi.h

Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: NPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Netscape Public License
00005  * Version 1.1 (the "License"); you may not use this file except in
00006  * compliance with the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/NPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is mozilla.org code.
00015  *
00016  * The Initial Developer of the Original Code is
00017  * Netscape Communications Corporation.
00018  * Portions created by the Initial Developer are Copyright (C) 1998
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *    Portions Copyright (c) 2004-2006, Nokia Corporation
00023  *
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the NPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the NPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 /* NOTES:
00040  * Nokia modified this file, by changing certain variables for the purpose of
00041  * porting the file to the Symbian platform on May 1st, 2004.
00042  */
00043 
00044  /*
00045   *  Netscape client plug-in API spec
00046   */
00047 
00048 #ifndef _NPAPI_H_
00049 #define _NPAPI_H_
00050 
00051 #define GENERIC_CONTEXTS
00052 
00053 #ifdef INCLUDE_JAVA
00054 #include "jri.h"                /* Java Runtime Interface */
00055 #else
00056 #ifndef __SYMBIAN32__
00057 #define jref    void *
00058 #define JRIEnv  void
00059 #endif
00060 #endif
00061 
00062 #ifdef _WIN32
00063 #    ifndef XP_WIN
00064 #        define XP_WIN 1
00065 #    endif /* XP_WIN */
00066 #endif /* _WIN32 */
00067 
00068 #ifdef __MWERKS__
00069 #    define _declspec __declspec
00070 #    ifdef macintosh
00071 #        ifndef XP_MAC
00072 #            define XP_MAC 1
00073 #        endif /* XP_MAC */
00074 #    endif /* macintosh */
00075 #    ifdef __INTEL__
00076 #        undef NULL
00077 #        ifndef XP_WIN
00078 #            define XP_WIN 1
00079 #        endif /* __INTEL__ */
00080 #    endif /* XP_PC */
00081 #endif /* __MWERKS__ */
00082 
00083 #ifdef __SYMBIAN32__
00084 #undef XP_WIN
00085 #endif
00086 
00087 #if defined(__APPLE_CC__) && !defined(__MACOS_CLASSIC__)
00088 #   define XP_MACOSX
00089 #endif
00090 
00091 #ifdef XP_MAC
00092     #include <Quickdraw.h>
00093     #include <Events.h>
00094 #endif
00095 
00096 #ifdef XP_MACOSX
00097     #include <Carbon/Carbon.h>
00098     #include <ApplicationServices/ApplicationServices.h>
00099     #include <OpenGL/OpenGL.h>
00100 #endif
00101 
00102 #ifdef XP_UNIX
00103     #include <X11/Xlib.h>
00104     #include <X11/Xutil.h>
00105 #endif
00106 
00107 #ifdef XP_WIN
00108     #include <windows.h>
00109 #endif
00110 
00111 #ifdef __SYMBIAN32__
00112 #include <np_defines.h>
00113 #endif
00114 #if defined(XP_MACOSX) && defined(__LP64__)
00115 #error 64-bit Netscape plug-ins are not supported on Mac OS X
00116 #endif
00117 
00118 /*----------------------------------------------------------------------*/
00119 /*             Plugin Version Constants                                 */
00120 /*----------------------------------------------------------------------*/
00121 
00122 #define NP_VERSION_MAJOR 0
00123 #define NP_VERSION_MINOR 18
00124 
00125 
00126 
00127 /*----------------------------------------------------------------------*/
00128 /*             Definition of Basic Types                                */
00129 /*----------------------------------------------------------------------*/
00130 
00131 #ifndef _UINT16
00132 #define _UINT16
00133 typedef unsigned short uint16;
00134 #endif
00135 
00136 #ifndef _UINT32
00137 #define _UINT32
00138 #ifdef __LP64__
00139 typedef unsigned int uint32;
00140 #else /* __LP64__ */
00141 typedef unsigned long uint32;
00142 #endif /* __LP64__ */
00143 #endif
00144 
00145 #ifndef _INT16
00146 #define _INT16
00147 typedef short int16;
00148 #endif
00149 
00150 #ifndef _INT32
00151 #define _INT32
00152 #ifdef __LP64__
00153 typedef int int32;
00154 #else /* __LP64__ */
00155 typedef long int32;
00156 #endif /* __LP64__ */
00157 #endif
00158 
00159 #ifndef FALSE
00160 #define FALSE (0)
00161 #endif
00162 #ifndef TRUE
00163 #define TRUE (1)
00164 #endif
00165 #ifndef NULL
00166 #define NULL (0L)
00167 #endif
00168 
00169 typedef unsigned char    NPBool;
00170 typedef int16            NPError;
00171 typedef int16            NPReason;
00172 #ifndef __SYMBIAN32__
00173 typedef char*                    NPMIMEType;
00174 #else/* __SYMBIAN32__ */
00175 typedef const TDesC8&    NPMIMEType;
00176 #endif
00177 
00178 /*----------------------------------------------------------------------*/
00179 /*             Structures and definitions             */
00180 /*----------------------------------------------------------------------*/
00181 
00182 #if !defined(__LP64__)
00183 #if defined(XP_MAC) || defined(XP_MACOSX)
00184 #pragma options align=mac68k
00185 #endif
00186 #endif /* __LP64__ */
00187 
00188 /*
00189  *  NPP is a plug-in's opaque instance handle
00190  */
00191 #ifdef __SYMBIAN32__ 
00192 #ifndef _NP_RUNTIME_H_NPP
00193 #define _NP_RUNTIME_H_NPP
00194 typedef struct _NPP
00195 {
00196     void*    pdata;            /* plug-in private data */
00197     void*    ndata;            /* netscape private data */
00198 } NPP_t;
00199 
00200 typedef NPP_t*    NPP;
00201 #endif // _NP_RUNTIME_H_NPP
00202 #else
00203 typedef struct _NPP
00204 {
00205     void*    pdata;            /* plug-in private data */
00206     void*    ndata;            /* netscape private data */
00207 } NPP_t;
00208 
00209 typedef NPP_t*    NPP;
00210 #endif //
00211 
00212 typedef struct _NPStream
00213 {
00214     void*        pdata;        /* plug-in private data */
00215     void*        ndata;        /* netscape private data */
00216 #ifndef __SYMBIAN32__ 
00217     const char*  url;
00218 #else /*__SYMBIAN32__*/
00219     HBufC* url;
00220 #endif
00221     uint32       end;
00222     uint32       lastmodified;
00223     void*        notifyData;
00224     const char*  headers;      /* Response headers from host.
00225                                 * Exists only for >= NPVERS_HAS_RESPONSE_HEADERS.
00226                                 * Used for HTTP only; NULL for non-HTTP.
00227                                 * Available from NPP_NewStream onwards.
00228                                 * Plugin should copy this data before storing it.
00229                                 * Includes HTTP status line and all headers,
00230                                 * preferably verbatim as received from server,
00231                                 * headers formatted as in HTTP ("Header: Value"),
00232                                 * and newlines (\n, NOT \r\n) separating lines.
00233                                 * Terminated by \n\0 (NOT \n\n\0). */
00234 } NPStream;
00235 
00236 
00237 typedef struct _NPByteRange
00238 {
00239     int32      offset;         /* negative offset means from the end */
00240     uint32     length;
00241     struct _NPByteRange* next;
00242 } NPByteRange;
00243 
00244 
00245 typedef struct _NPSavedData
00246 {
00247     int32    len;
00248     void*    buf;
00249 } NPSavedData;
00250 
00251 
00252 typedef struct _NPRect
00253 {
00254     uint16    top;
00255     uint16    left;
00256     uint16    bottom;
00257     uint16    right;
00258 } NPRect;
00259 
00260 
00261 #ifdef XP_UNIX
00262 /*
00263  * Unix specific structures and definitions
00264  */
00265 
00266 /*
00267  * Callback Structures.
00268  *
00269  * These are used to pass additional platform specific information.
00270  */
00271 enum {
00272     NP_SETWINDOW = 1,
00273     NP_PRINT
00274 };
00275 
00276 typedef struct
00277 {
00278     int32        type;
00279 } NPAnyCallbackStruct;
00280 
00281 typedef struct
00282 {
00283     int32           type;
00284     Display*        display;
00285     Visual*         visual;
00286     Colormap        colormap;
00287     unsigned int    depth;
00288 } NPSetWindowCallbackStruct;
00289 
00290 typedef struct
00291 {
00292     int32            type;
00293     FILE*            fp;
00294 } NPPrintCallbackStruct;
00295 
00296 #endif /* XP_UNIX */
00297 
00298 /*
00299  *   The following masks are applied on certain platforms to NPNV and 
00300  *   NPPV selectors that pass around pointers to COM interfaces. Newer 
00301  *   compilers on some platforms may generate vtables that are not 
00302  *   compatible with older compilers. To prevent older plugins from 
00303  *   not understanding a new browser's ABI, these masks change the 
00304  *   values of those selectors on those platforms. To remain backwards
00305  *   compatible with differenet versions of the browser, plugins can 
00306  *   use these masks to dynamically determine and use the correct C++
00307  *   ABI that the browser is expecting. This does not apply to Windows 
00308  *   as Microsoft's COM ABI will likely not change.
00309  */
00310 
00311 #define NP_ABI_GCC3_MASK  0x10000000
00312 /*
00313  *   gcc 3.x generated vtables on UNIX and OSX are incompatible with 
00314  *   previous compilers.
00315  */
00316 #if (defined (XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3))
00317 #define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK
00318 #else
00319 #define _NP_ABI_MIXIN_FOR_GCC3 0
00320 #endif
00321 
00322 #define NP_ABI_MACHO_MASK 0x01000000
00323 /*
00324  *   On OSX, the Mach-O executable format is significantly
00325  *   different than CFM. In addition to having a different
00326  *   C++ ABI, it also has has different C calling convention.
00327  *   You must use glue code when calling between CFM and
00328  *   Mach-O C functions. 
00329  */
00330 #if (defined(TARGET_RT_MAC_MACHO))
00331 #define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK
00332 #else
00333 #define _NP_ABI_MIXIN_FOR_MACHO 0
00334 #endif
00335 
00336 
00337 #define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO)
00338 
00339 /*
00340  * List of variable names for which NPP_GetValue shall be implemented
00341  */
00342 typedef enum {
00343     NPPVpluginNameString = 1,
00344     NPPVpluginDescriptionString,
00345     NPPVpluginWindowBool,
00346     NPPVpluginTransparentBool,
00347 
00348     NPPVjavaClass,                /* Not implemented in WebKit */
00349     NPPVpluginWindowSize,         /* Not implemented in WebKit */
00350     NPPVpluginTimerInterval,      /* Not implemented in WebKit */
00351 
00352     NPPVpluginScriptableInstance = (10 | NP_ABI_MASK), /* Not implemented in WebKit */
00353     NPPVpluginScriptableIID = 11, /* Not implemented in WebKit */
00354 
00355     /* 12 and over are available on Mozilla builds starting with 0.9.9 */
00356     NPPVjavascriptPushCallerBool = 12,  /* Not implemented in WebKit */
00357     NPPVpluginKeepLibraryInMemory = 13, /* Not implemented in WebKit */
00358     NPPVpluginNeedsXEmbed         = 14, /* Not implemented in WebKit */
00359 
00360     /* Get the NPObject for scripting the plugin. */
00361     NPPVpluginScriptableNPObject  = 15,
00362 
00363 #ifdef __SYMBIAN32__
00364     // Custom NPP variables, starting from 100 till 1000
00365     NPPVPluginFocusPosition = 100,    
00366     NPPVPluginDeactivate = 101,
00367     NPPVPluginZoom = 102,
00368     NPPVPluginPointerEvent = 103,
00369     NPPVpluginInteractiveBool = 1000,
00370 #endif
00371 
00372     /* Get the plugin value (as \0-terminated UTF-8 string data) for
00373      * form submission if the plugin is part of a form. Use
00374      * NPN_MemAlloc() to allocate memory for the string data.
00375      */
00376     NPPVformValue = 16,    /* Not implemented in WebKit */
00377     NPPVpluginFullScreenBool = 17 /* Not implemented in WebKit */
00378 } NPPVariable;
00379 
00380 /*
00381  * List of variable names for which NPN_GetValue is implemented by Mozilla
00382  */
00383 typedef enum {
00384     NPNVxDisplay = 1,
00385     NPNVxtAppContext,
00386     NPNVnetscapeWindow,
00387     NPNVjavascriptEnabledBool,
00388     NPNVasdEnabledBool,
00389     NPNVisOfflineBool,
00390 
00391     /* 10 and over are available on Mozilla builds starting with 0.9.4 */
00392     NPNVserviceManager = (10 | NP_ABI_MASK),  /* Not implemented in WebKit */
00393     NPNVDOMElement     = (11 | NP_ABI_MASK),  /* Not implemented in WebKit */
00394     NPNVDOMWindow      = (12 | NP_ABI_MASK),  /* Not implemented in WebKit */
00395     NPNVToolkit        = (13 | NP_ABI_MASK),  /* Not implemented in WebKit */
00396     NPNVSupportsXEmbedBool = 14,              /* Not implemented in WebKit */
00397 
00398     /* Get the NPObject wrapper for the browser window. */
00399     NPNVWindowNPObject = 15,
00400 
00401     /* Get the NPObject wrapper for the plugins DOM element. */
00402     NPNVPluginElementNPObject,
00403 
00404 #ifdef XP_MACOSX
00405     , NPNVpluginDrawingModel = 1000 /* The NPDrawingModel specified by the plugin */
00406 
00407 #ifndef NP_NO_QUICKDRAW
00408     , NPNVsupportsQuickDrawBool = 2000 /* TRUE if the browser supports the QuickDraw drawing model */
00409 #endif
00410     , NPNVsupportsCoreGraphicsBool = 2001 /* TRUE if the browser supports the CoreGraphics drawing model */
00411     , NPNVsupportsOpenGLBool = 2002 /* TRUE if the browser supports the OpenGL drawing model (CGL on Mac) */
00412 #endif /* XP_MACOSX */
00413     
00414     /* Get the id of the currently connected access point */
00415     NPNNetworkAccess,
00416     NPNVGenericParameter        
00417 } NPNVariable;
00418 
00419 #ifdef GENERIC_CONTEXTS
00420 
00421 union  NPN_GenericParam {
00422 
00423     NPN_GenericParam(int aIntValue)
00424     :intValue(aIntValue)
00425         {
00426         
00427         }
00428     
00429     NPN_GenericParam(bool aBoolValue)
00430     :boolValue(aBoolValue)
00431         {
00432         
00433         }
00434             
00435     NPN_GenericParam(const TDesC& aStrValue)
00436     :strValue(aStrValue)
00437         {
00438         
00439         }
00440         
00441     NPN_GenericParam(void*  aVoidValue)
00442     :voidValue(aVoidValue)
00443         {
00444         
00445         }
00446     int intValue;
00447     bool   boolValue;
00448     const TDesC& strValue;
00449     void*  voidValue;
00450 };
00451 
00452 
00453 typedef struct NPN_GenericElement{          
00454 
00455     NPN_GenericElement(const TDesC& aElementId, int aElementValue)
00456     :genericElementId(aElementId), genericElementValue(aElementValue)
00457         {
00458         
00459         }
00460     
00461     NPN_GenericElement(const TDesC& aElementId, bool aElementValue)
00462     :genericElementId(aElementId), genericElementValue(aElementValue)
00463         {
00464         
00465         }
00466 
00467     NPN_GenericElement(const TDesC& aElementId, void* aElementValue)
00468     :genericElementId(aElementId), genericElementValue(aElementValue)
00469         {
00470         
00471         }
00472                         
00473     NPN_GenericElement(const TDesC& aElementId, const TDesC& aElementValue)
00474     :genericElementId(aElementId), genericElementValue(aElementValue)
00475         {
00476         
00477         }
00478     const TDesC&  genericElementId;          
00479     NPN_GenericParam genericElementValue;
00480 } GenericEntry;
00481 #endif
00482 /*
00483  * The type of a NPWindow - it specifies the type of the data structure
00484  * returned in the window field.
00485  */
00486 typedef enum {
00487     NPWindowTypeWindow = 1,
00488     NPWindowTypeDrawable
00489 } NPWindowType;
00490 
00491 #ifdef XP_MACOSX
00492 
00493 /*
00494  * The drawing model for a Mac OS X plugin.  These are the possible values for the NPNVpluginDrawingModel variable.
00495  */
00496  
00497 typedef enum {
00498 #ifndef NP_NO_QUICKDRAW
00499     NPDrawingModelQuickDraw = 0,
00500 #endif
00501     NPDrawingModelCoreGraphics = 1,
00502     NPDrawingModelOpenGL = 2
00503 } NPDrawingModel;
00504 
00505 #endif
00506 
00507 typedef struct _NPWindow
00508 {
00509     void*    window;     /* Platform specific window handle */
00510     int32    x;            /* Position of top left corner relative */
00511     int32    y;            /*    to a netscape page.                    */
00512     uint32    width;        /* Maximum window size */
00513     uint32    height;
00514     NPRect    clipRect;    /* Clipping rectangle in port coordinates */
00515                         /* Used by MAC only.              */
00516 #ifdef XP_UNIX
00517     void *    ws_info;    /* Platform-dependent additonal data */
00518 #endif /* XP_UNIX */
00519     NPWindowType type;    /* Is this a window or a drawable? */
00520 } NPWindow;
00521 
00522 
00523 typedef struct _NPFullPrint
00524 {
00525     NPBool    pluginPrinted;    /* Set TRUE if plugin handled fullscreen */
00526                             /*    printing                             */
00527     NPBool    printOne;        /* TRUE if plugin should print one copy  */
00528                             /*    to default printer                     */
00529     void*    platformPrint;    /* Platform-specific printing info */
00530 } NPFullPrint;
00531 
00532 typedef struct _NPEmbedPrint
00533 {
00534     NPWindow    window;
00535     void*    platformPrint;    /* Platform-specific printing info */
00536 } NPEmbedPrint;
00537 
00538 typedef struct _NPPrint
00539 {
00540     uint16    mode;                        /* NP_FULL or NP_EMBED */
00541     union
00542     {
00543         NPFullPrint     fullPrint;        /* if mode is NP_FULL */
00544         NPEmbedPrint    embedPrint;        /* if mode is NP_EMBED */
00545     } print;
00546 } NPPrint;
00547 
00548 #if defined(XP_MAC) || defined(XP_MACOSX)
00549 typedef EventRecord    NPEvent;
00550 #elif defined(XP_WIN)
00551 typedef struct _NPEvent
00552 {
00553     uint16   event;
00554     uint32   wParam;
00555     uint32   lParam;
00556 } NPEvent;
00557 #elif defined (XP_UNIX)
00558 typedef XEvent NPEvent;
00559 #elif defined (__SYMBIAN32__)
00560 typedef struct _NPEvent
00561 {
00562     uint32   event;
00563     void*    param;
00564 } NPEvent;
00565 #else
00566 typedef void*            NPEvent;
00567 #endif /* XP_MAC */
00568 
00569 #if defined(XP_MAC)
00570 typedef RgnHandle NPRegion;
00571 #elif defined(XP_MACOSX)
00572 /* 
00573  * NPRegion's type depends on the drawing model specified by the plugin (see NPNVpluginDrawingModel).
00574  * NPQDRegion represents a QuickDraw RgnHandle and is used with the QuickDraw drawing model.
00575  * NPCGRegion repesents a graphical region when using any other drawing model.
00576  */
00577 typedef void *NPRegion;
00578 #ifndef NP_NO_QUICKDRAW
00579 typedef RgnHandle NPQDRegion;
00580 #endif
00581 typedef CGPathRef NPCGRegion;
00582 #elif defined(XP_WIN)
00583 typedef HRGN NPRegion;
00584 #elif defined(XP_UNIX)
00585 typedef Region NPRegion;
00586 #else
00587 typedef void *NPRegion;
00588 #endif /* XP_MAC */
00589 
00590 #ifdef XP_MACOSX
00591 
00592 /* 
00593  * NP_CGContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelCoreGraphics
00594  * as its drawing model.
00595  */
00596 
00597 typedef struct NP_CGContext
00598 {
00599     CGContextRef context;
00600     WindowRef window;
00601 } NP_CGContext;
00602 
00603 /* 
00604  * NP_GLContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelOpenGL as its
00605  * drawing model.
00606  */
00607 
00608 typedef struct NP_GLContext
00609 {
00610     CGLContextObj context;
00611     WindowRef window;
00612 } NP_GLContext;
00613 
00614 #endif /* XP_MACOSX */
00615 
00616 #if defined(XP_MAC) || defined(XP_MACOSX)
00617 
00618 /*
00619  *  Mac-specific structures and definitions.
00620  */
00621 
00622 #ifndef NP_NO_QUICKDRAW
00623 
00624 /* 
00625  * NP_Port is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelQuickDraw as its
00626  * drawing model, or the plugin does not specify a drawing model.
00627  *
00628  * It is not recommended that new plugins use NPDrawingModelQuickDraw or NP_Port, as QuickDraw has been
00629  * deprecated in Mac OS X 10.5.  CoreGraphics is the preferred drawing API.
00630  *
00631  * NP_Port is not available in 64-bit.
00632  */
00633  
00634 typedef struct NP_Port
00635 {
00636     CGrafPtr     port;        /* Grafport */
00637     int32        portx;        /* position inside the topmost window */
00638     int32        porty;
00639 } NP_Port;
00640 
00641 #endif /* NP_NO_QUICKDRAW */
00642 
00643 /*
00644  *  Non-standard event types that can be passed to HandleEvent
00645  */
00646 #define getFocusEvent        (osEvt + 16)
00647 #define loseFocusEvent        (osEvt + 17)
00648 #define adjustCursorEvent   (osEvt + 18)
00649 
00650 #endif /* XP_MAC */
00651 
00652 
00653 /*
00654  * Values for mode passed to NPP_New:
00655  */
00656 #define NP_EMBED        1
00657 #define NP_FULL         2
00658 
00659 /*
00660  * Values for stream type passed to NPP_NewStream:
00661  */
00662 #define NP_NORMAL        1
00663 #define NP_SEEK         2
00664 #define NP_ASFILE        3
00665 #define NP_ASFILEONLY        4
00666 
00667 #define NP_MAXREADY    (((unsigned)(~0)<<1)>>1)
00668 
00669 #if !defined(__LP64__)
00670 #if defined(XP_MAC) || defined(XP_MACOSX)
00671 #pragma options align=reset
00672 #endif
00673 #endif /* __LP64__ */
00674 
00675 
00676 /*----------------------------------------------------------------------*/
00677 /*             Error and Reason Code definitions            */
00678 /*----------------------------------------------------------------------*/
00679 
00680 /*
00681  *    Values of type NPError:
00682  */
00683 #define NPERR_BASE                            0
00684 #define NPERR_NO_ERROR                        (NPERR_BASE + 0)
00685 #define NPERR_GENERIC_ERROR                    (NPERR_BASE + 1)
00686 #define NPERR_INVALID_INSTANCE_ERROR        (NPERR_BASE + 2)
00687 #define NPERR_INVALID_FUNCTABLE_ERROR        (NPERR_BASE + 3)
00688 #define NPERR_MODULE_LOAD_FAILED_ERROR        (NPERR_BASE + 4)
00689 #define NPERR_OUT_OF_MEMORY_ERROR            (NPERR_BASE + 5)
00690 #define NPERR_INVALID_PLUGIN_ERROR            (NPERR_BASE + 6)
00691 #define NPERR_INVALID_PLUGIN_DIR_ERROR        (NPERR_BASE + 7)
00692 #define NPERR_INCOMPATIBLE_VERSION_ERROR    (NPERR_BASE + 8)
00693 #define NPERR_INVALID_PARAM                (NPERR_BASE + 9)
00694 #define NPERR_INVALID_URL                    (NPERR_BASE + 10)
00695 #define NPERR_FILE_NOT_FOUND                (NPERR_BASE + 11)
00696 #define NPERR_NO_DATA                        (NPERR_BASE + 12)
00697 #define NPERR_STREAM_NOT_SEEKABLE            (NPERR_BASE + 13)
00698 
00699 /*
00700  *    Values of type NPReason:
00701  */
00702 #define NPRES_BASE                0
00703 #define NPRES_DONE                    (NPRES_BASE + 0)
00704 #define NPRES_NETWORK_ERR            (NPRES_BASE + 1)
00705 #define NPRES_USER_BREAK            (NPRES_BASE + 2)
00706 
00707 /*
00708  *      Don't use these obsolete error codes any more.
00709  */
00710 #define NP_NOERR  NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
00711 #define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
00712 #define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
00713 
00714 /*
00715  * Version feature information
00716  */
00717 #define NPVERS_HAS_STREAMOUTPUT     8
00718 #define NPVERS_HAS_NOTIFICATION     9
00719 #define NPVERS_HAS_LIVECONNECT        9
00720 #define NPVERS_WIN16_HAS_LIVECONNECT    9
00721 #define NPVERS_68K_HAS_LIVECONNECT    11
00722 #define NPVERS_HAS_WINDOWLESS       11
00723 #define NPVERS_HAS_XPCONNECT_SCRIPTING    13  /* Not implemented in WebKit */
00724 #define NPVERS_HAS_NPRUNTIME_SCRIPTING    14
00725 #define NPVERS_HAS_FORM_VALUES            15  /* Not implemented in WebKit; see bug 13061 */
00726 #define NPVERS_HAS_POPUPS_ENABLED_STATE   16  /* Not implemented in WebKit */
00727 #define NPVERS_HAS_RESPONSE_HEADERS       17
00728 #define NPVERS_HAS_NPOBJECT_ENUM          18
00729 
00730 
00731 /*----------------------------------------------------------------------*/
00732 /*             Function Prototypes                */
00733 /*----------------------------------------------------------------------*/
00734 
00735 #if defined(_WINDOWS) && !defined(WIN32)
00736 #define NP_LOADDS  _loadds
00737 #else
00738 #define NP_LOADDS
00739 #endif
00740 
00741 #ifndef __SYMBIAN32__
00742  #ifdef __cplusplus
00743  extern "C" {
00744  #endif
00745 #endif
00746 
00747 /*
00748  * NPP_* functions are provided by the plugin and called by the navigator.
00749  */
00750 
00751 #ifdef XP_UNIX
00752 char*                    NPP_GetMIMEDescription(void);
00753 #endif /* XP_UNIX */
00754 
00755 #ifdef __SYMBIAN32__
00756 #include <badesca.h>
00757 IMPORT_C const TDesC* NPP_GetMIMEDescription(void);
00758 #endif /* __SYMBIAN32__ */
00759 
00760 NPError     NPP_Initialize(void);
00761 #ifdef __SYMBIAN32__
00762 IMPORT_C
00763 #endif /* __SYMBIAN32__ */
00764 void        NPP_Shutdown(void);
00765 
00766 #ifndef __SYMBIAN32__
00767 NPError     NP_LOADDS    NPP_New(NPMIMEType pluginType, NPP instance,
00768                                 uint16 mode, int16 argc, char* argn[],
00769                                 char* argv[], NPSavedData* saved);
00770 #else
00771 NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance,
00772               uint16 mode, CDesCArray* argn,
00773               CDesCArray* argv, NPSavedData* saved);
00774 #endif /* __SYMBIAN32__ */
00775 
00776 NPError     NP_LOADDS    NPP_Destroy(NPP instance, NPSavedData** save);
00777 NPError     NP_LOADDS    NPP_SetWindow(NPP instance, NPWindow* window);
00778 NPError     NP_LOADDS    NPP_NewStream(NPP instance, NPMIMEType type,
00779                                       NPStream* stream, NPBool seekable,
00780                                       uint16* stype);
00781 NPError     NP_LOADDS    NPP_DestroyStream(NPP instance, NPStream* stream,
00782                                           NPReason reason);
00783 int32        NP_LOADDS    NPP_WriteReady(NPP instance, NPStream* stream);
00784 int32        NP_LOADDS    NPP_Write(NPP instance, NPStream* stream, int32 offset,
00785                                   int32 len, void* buffer);
00786 
00787 #ifndef __SYMBIAN32__
00788 void        NP_LOADDS    NPP_StreamAsFile(NPP instance, NPStream* stream,
00789                                          const char* fname);
00790 #else/* __SYMBIAN32__ */
00791 void    NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream,
00792                                    const TDesC& fname);
00793 #endif /* __SYMBIAN32__ */
00794 
00795 void        NP_LOADDS    NPP_Print(NPP instance, NPPrint* platformPrint);
00796 int16            NPP_HandleEvent(NPP instance, void* event);
00797 
00798 #ifndef __SYMBIAN32__
00799 void        NP_LOADDS    NPP_URLNotify(NPP instance, const char* url,
00800                                       NPReason reason, void* notifyData);
00801 jref        NP_LOADDS            NPP_GetJavaClass(void);
00802 #else/* __SYMBIAN32__ */
00803 void    NP_LOADDS NPP_URLNotify(NPP instance, const TDesC& url,
00804                                 NPReason reason, void* notifyData);
00805 #endif /* __SYMBIAN32__ */
00806 
00807 
00808 #ifdef __SYMBIAN32__
00809 IMPORT_C
00810 #endif /* __SYMBIAN32__ */
00811 NPError     NPP_GetValue(NPP instance, NPPVariable variable,
00812                                      void *value);
00813 NPError     NPP_SetValue(NPP instance, NPNVariable variable,
00814                                      void *value);
00815 
00816 /*
00817  * NPN_* functions are provided by the navigator and called by the plugin.
00818  */
00819 
00820 void        NPN_Version(int* plugin_major, int* plugin_minor,
00821                             int* netscape_major, int* netscape_minor);
00822 
00823 #ifndef __SYMBIAN32__
00824 NPError     NPN_GetURLNotify(NPP instance, const char* url,
00825                                  const char* target, void* notifyData);
00826 NPError     NPN_GetURL(NPP instance, const char* url,
00827                            const char* target);
00828 NPError     NPN_PostURLNotify(NPP instance, const char* url,
00829                                   const char* target, uint32 len,
00830                                   const char* buf, NPBool file,
00831                                   void* notifyData);
00832 NPError     NPN_PostURL(NPP instance, const char* url,
00833                             const char* target, uint32 len,
00834                             const char* buf, NPBool file);
00835 #else/* __SYMBIAN32__ */
00836 NPError NP_LOADDS NPN_GetURLNotify(NPP instance, const TDesC& url,
00837                                    const TDesC* target, void* notifyData);
00838 NPError NP_LOADDS NPN_GetURL(NPP instance, const TDesC& url,
00839                              const TDesC* target);
00840 NPError NP_LOADDS NPN_PostURLNotify(NPP instance, const TDesC& url,
00841                                     const TDesC* target,
00842                                     const TDesC& buf, NPBool file,
00843                                     void* notifyData);
00844 NPError NP_LOADDS NPN_PostURL(NPP instance, const TDesC& url,
00845                               const TDesC* target,
00846                               const TDesC& buf, NPBool file);
00847 #endif /* __SYMBIAN32__ */
00848 
00849 NPError     NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
00850 
00851 #ifndef __SYMBIAN32__
00852 NPError     NPN_NewStream(NPP instance, NPMIMEType type,
00853                               const char* target, NPStream** stream);
00854 #else/* __SYMBIAN32__ */
00855 NPError NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type,
00856                                 const TDesC* target, NPStream** stream);
00857 #endif /* __SYMBIAN32__ */
00858 
00859 int32   NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer);
00860 NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPReason reason);
00861 
00862 #ifndef __SYMBIAN32__
00863 void        NPN_Status(NPP instance, const char* message);
00864 #else/* __SYMBIAN32__ */
00865 void    NP_LOADDS NPN_Status(NPP instance, const TDesC& message);
00866 #endif /* __SYMBIAN32__ */
00867 
00868 #ifndef __SYMBIAN32__
00869 const char*    NPN_UserAgent(NPP instance);
00870 #else/* __SYMBIAN32__ */
00871 const TDesC* NP_LOADDS  NPN_UserAgent(NPP instance);
00872 #endif /* __SYMBIAN32__ */
00873 
00874 
00875 void*        NPN_MemAlloc(uint32 size);
00876 void        NPN_MemFree(void* ptr);
00877 uint32        NPN_MemFlush(uint32 size);
00878 void        NPN_ReloadPlugins(NPBool reloadPages);
00879 #ifndef __SYMBIAN32__
00880 JRIEnv*     NPN_GetJavaEnv(void);
00881 jref        NPN_GetJavaPeer(NPP instance);
00882 #endif
00883 NPError     NPN_GetValue(NPP instance, NPNVariable variable,
00884                              void *value);
00885 NPError     NPN_SetValue(NPP instance, NPPVariable variable,
00886                              void *value);
00887 void        NPN_InvalidateRect(NPP instance, NPRect *invalidRect);
00888 void        NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion);
00889 void        NPN_ForceRedraw(NPP instance);
00890 void        NPN_PushPopupsEnabledState(NPP instance, NPBool enabled);
00891 void        NPN_PopPopupsEnabledState(NPP instance);
00892 
00893 #ifndef __SYMBIAN32__
00894  #ifdef __cplusplus
00895  }  /* end extern "C" */
00896  #endif
00897 #endif
00898 
00899 #endif /* _NPAPI_H_ */

Copyright © Nokia Corporation 2001-2007
Back to top