epoc32/include/mw/npapi.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 npapi.h
     1 /* ***** BEGIN LICENSE BLOCK *****
       
     2  * Version: NPL 1.1/GPL 2.0/LGPL 2.1
       
     3  *
       
     4  * The contents of this file are subject to the Netscape Public License
       
     5  * Version 1.1 (the "License"); you may not use this file except in
       
     6  * compliance with the License. You may obtain a copy of the License at
       
     7  * http://www.mozilla.org/NPL/
       
     8  *
       
     9  * Software distributed under the License is distributed on an "AS IS" basis,
       
    10  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
       
    11  * for the specific language governing rights and limitations under the
       
    12  * License.
       
    13  *
       
    14  * The Original Code is mozilla.org code.
       
    15  *
       
    16  * The Initial Developer of the Original Code is
       
    17  * Netscape Communications Corporation.
       
    18  * Portions created by the Initial Developer are Copyright (C) 1998
       
    19  * the Initial Developer. All Rights Reserved.
       
    20  *
       
    21  * Contributor(s):
       
    22  *    Portions Copyright (c) 2004-2006, Nokia Corporation
       
    23  *
       
    24  *
       
    25  * Alternatively, the contents of this file may be used under the terms of
       
    26  * either the GNU General Public License Version 2 or later (the "GPL"), or
       
    27  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
       
    28  * in which case the provisions of the GPL or the LGPL are applicable instead
       
    29  * of those above. If you wish to allow use of your version of this file only
       
    30  * under the terms of either the GPL or the LGPL, and not to allow others to
       
    31  * use your version of this file under the terms of the NPL, indicate your
       
    32  * decision by deleting the provisions above and replace them with the notice
       
    33  * and other provisions required by the GPL or the LGPL. If you do not delete
       
    34  * the provisions above, a recipient may use your version of this file under
       
    35  * the terms of any one of the NPL, the GPL or the LGPL.
       
    36  *
       
    37  * ***** END LICENSE BLOCK ***** */
       
    38 
       
    39 /* NOTES:
       
    40  * Nokia modified this file, by changing certain variables for the purpose of
       
    41  * porting the file to the Symbian platform on May 1st, 2004.
       
    42  */
       
    43 
       
    44  /*
       
    45   *  Netscape client plug-in API spec
       
    46   */
       
    47 
       
    48 #ifndef _NPAPI_H_
       
    49 #define _NPAPI_H_
       
    50 
       
    51 #ifdef INCLUDE_JAVA
       
    52 #include "jri.h"                /* Java Runtime Interface */
       
    53 #else
       
    54 #ifndef __SYMBIAN32__
       
    55 #define jref    void *
       
    56 #define JRIEnv  void
       
    57 #endif
       
    58 #endif
       
    59 
       
    60 #ifdef _WIN32
       
    61 #    ifndef XP_WIN
       
    62 #        define XP_WIN 1
       
    63 #    endif /* XP_WIN */
       
    64 #endif /* _WIN32 */
       
    65 
       
    66 #ifdef __MWERKS__
       
    67 #    define _declspec __declspec
       
    68 #    ifdef macintosh
       
    69 #        ifndef XP_MAC
       
    70 #            define XP_MAC 1
       
    71 #        endif /* XP_MAC */
       
    72 #    endif /* macintosh */
       
    73 #    ifdef __INTEL__
       
    74 #        undef NULL
       
    75 #        ifndef XP_WIN
       
    76 #            define XP_WIN 1
       
    77 #        endif /* __INTEL__ */
       
    78 #    endif /* XP_PC */
       
    79 #endif /* __MWERKS__ */
       
    80 
       
    81 #ifdef __SYMBIAN32__
       
    82 #undef XP_WIN
       
    83 #endif
       
    84 
       
    85 #if defined(__APPLE_CC__) && !defined(__MACOS_CLASSIC__)
       
    86 #   define XP_MACOSX
       
    87 #endif
       
    88 
       
    89 #ifdef XP_MAC
       
    90     #include <Quickdraw.h>
       
    91     #include <Events.h>
       
    92 #endif
       
    93 
       
    94 #ifdef XP_MACOSX
       
    95     #include <Carbon/Carbon.h>
       
    96     #include <ApplicationServices/ApplicationServices.h>
       
    97     #include <OpenGL/OpenGL.h>
       
    98 #endif
       
    99 
       
   100 #ifdef XP_UNIX
       
   101     #include <X11/Xlib.h>
       
   102     #include <X11/Xutil.h>
       
   103 #endif
       
   104 
       
   105 #ifdef XP_WIN
       
   106     #include <windows.h>
       
   107 #endif
       
   108 
       
   109 #ifdef __SYMBIAN32__
       
   110 #include <np_defines.h>
       
   111 #endif
       
   112 #if defined(XP_MACOSX) && defined(__LP64__)
       
   113 #error 64-bit Netscape plug-ins are not supported on Mac OS X
       
   114 #endif
       
   115 
       
   116 /*----------------------------------------------------------------------*/
       
   117 /*             Plugin Version Constants                                 */
       
   118 /*----------------------------------------------------------------------*/
       
   119 
       
   120 #define NP_VERSION_MAJOR 0
       
   121 #define NP_VERSION_MINOR 18
       
   122 
       
   123 
       
   124 
       
   125 /*----------------------------------------------------------------------*/
       
   126 /*             Definition of Basic Types                                */
       
   127 /*----------------------------------------------------------------------*/
       
   128 
       
   129 #ifndef _UINT16
       
   130 #define _UINT16
       
   131 typedef unsigned short uint16;
       
   132 #endif
       
   133 
       
   134 #ifndef _UINT32
       
   135 #define _UINT32
       
   136 #ifdef __LP64__
       
   137 typedef unsigned int uint32;
       
   138 #else /* __LP64__ */
       
   139 typedef unsigned long uint32;
       
   140 #endif /* __LP64__ */
       
   141 #endif
       
   142 
       
   143 #ifndef _INT16
       
   144 #define _INT16
       
   145 typedef short int16;
       
   146 #endif
       
   147 
       
   148 #ifndef _INT32
       
   149 #define _INT32
       
   150 #ifdef __LP64__
       
   151 typedef int int32;
       
   152 #else /* __LP64__ */
       
   153 typedef long int32;
       
   154 #endif /* __LP64__ */
       
   155 #endif
       
   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            NPError;
       
   169 typedef int16            NPReason;
       
   170 #ifndef __SYMBIAN32__
       
   171 typedef char*     		 NPMIMEType;
       
   172 #else/* __SYMBIAN32__ */
       
   173 typedef const TDesC8& 	 NPMIMEType;
       
   174 #endif
       
   175 
       
   176 /*----------------------------------------------------------------------*/
       
   177 /*             Structures and definitions             */
       
   178 /*----------------------------------------------------------------------*/
       
   179 
       
   180 #if !defined(__LP64__)
       
   181 #if defined(XP_MAC) || defined(XP_MACOSX)
       
   182 #pragma options align=mac68k
       
   183 #endif
       
   184 #endif /* __LP64__ */
       
   185 
       
   186 /*
       
   187  *  NPP is a plug-in's opaque instance handle
       
   188  */
       
   189 #ifdef __SYMBIAN32__ 
       
   190 #ifndef _NP_RUNTIME_H_NPP
       
   191 #define _NP_RUNTIME_H_NPP
       
   192 typedef struct _NPP
       
   193 {
       
   194     void*    pdata;            /* plug-in private data */
       
   195     void*    ndata;            /* netscape private data */
       
   196 } NPP_t;
       
   197 
       
   198 typedef NPP_t*    NPP;
       
   199 #endif // _NP_RUNTIME_H_NPP
       
   200 #else
       
   201 typedef struct _NPP
       
   202 {
       
   203     void*    pdata;            /* plug-in private data */
       
   204     void*    ndata;            /* netscape private data */
       
   205 } NPP_t;
       
   206 
       
   207 typedef NPP_t*    NPP;
       
   208 #endif //
       
   209 
       
   210 typedef struct _NPStream
       
   211 {
       
   212     void*        pdata;        /* plug-in private data */
       
   213     void*        ndata;        /* netscape private data */
       
   214 #ifndef __SYMBIAN32__ 
       
   215     const char*  url;
       
   216 #else /*__SYMBIAN32__*/
       
   217     HBufC* url;
       
   218 #endif
       
   219     uint32       end;
       
   220     uint32       lastmodified;
       
   221     void*        notifyData;
       
   222     const char*  headers;      /* Response headers from host.
       
   223                                 * Exists only for >= NPVERS_HAS_RESPONSE_HEADERS.
       
   224                                 * Used for HTTP only; NULL for non-HTTP.
       
   225                                 * Available from NPP_NewStream onwards.
       
   226                                 * Plugin should copy this data before storing it.
       
   227                                 * Includes HTTP status line and all headers,
       
   228                                 * preferably verbatim as received from server,
       
   229                                 * headers formatted as in HTTP ("Header: Value"),
       
   230                                 * and newlines (\n, NOT \r\n) separating lines.
       
   231                                 * Terminated by \n\0 (NOT \n\n\0). */
       
   232 } NPStream;
       
   233 
       
   234 
       
   235 typedef struct _NPByteRange
       
   236 {
       
   237     int32      offset;         /* negative offset means from the end */
       
   238     uint32     length;
       
   239     struct _NPByteRange* next;
       
   240 } NPByteRange;
       
   241 
       
   242 
       
   243 typedef struct _NPSavedData
       
   244 {
       
   245     int32    len;
       
   246     void*    buf;
       
   247 } NPSavedData;
       
   248 
       
   249 
       
   250 typedef struct _NPRect
       
   251 {
       
   252     uint16    top;
       
   253     uint16    left;
       
   254     uint16    bottom;
       
   255     uint16    right;
       
   256 } NPRect;
       
   257 
       
   258 
       
   259 #ifdef XP_UNIX
       
   260 /*
       
   261  * Unix specific structures and definitions
       
   262  */
       
   263 
       
   264 /*
       
   265  * Callback Structures.
       
   266  *
       
   267  * These are used to pass additional platform specific information.
       
   268  */
       
   269 enum {
       
   270     NP_SETWINDOW = 1,
       
   271     NP_PRINT
       
   272 };
       
   273 
       
   274 typedef struct
       
   275 {
       
   276     int32        type;
       
   277 } NPAnyCallbackStruct;
       
   278 
       
   279 typedef struct
       
   280 {
       
   281     int32           type;
       
   282     Display*        display;
       
   283     Visual*         visual;
       
   284     Colormap        colormap;
       
   285     unsigned int    depth;
       
   286 } NPSetWindowCallbackStruct;
       
   287 
       
   288 typedef struct
       
   289 {
       
   290     int32            type;
       
   291     FILE*            fp;
       
   292 } NPPrintCallbackStruct;
       
   293 
       
   294 #endif /* XP_UNIX */
       
   295 
       
   296 /*
       
   297  *   The following masks are applied on certain platforms to NPNV and 
       
   298  *   NPPV selectors that pass around pointers to COM interfaces. Newer 
       
   299  *   compilers on some platforms may generate vtables that are not 
       
   300  *   compatible with older compilers. To prevent older plugins from 
       
   301  *   not understanding a new browser's ABI, these masks change the 
       
   302  *   values of those selectors on those platforms. To remain backwards
       
   303  *   compatible with differenet versions of the browser, plugins can 
       
   304  *   use these masks to dynamically determine and use the correct C++
       
   305  *   ABI that the browser is expecting. This does not apply to Windows 
       
   306  *   as Microsoft's COM ABI will likely not change.
       
   307  */
       
   308 
       
   309 #define NP_ABI_GCC3_MASK  0x10000000
       
   310 /*
       
   311  *   gcc 3.x generated vtables on UNIX and OSX are incompatible with 
       
   312  *   previous compilers.
       
   313  */
       
   314 #if (defined (XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3))
       
   315 #define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK
       
   316 #else
       
   317 #define _NP_ABI_MIXIN_FOR_GCC3 0
       
   318 #endif
       
   319 
       
   320 #define NP_ABI_MACHO_MASK 0x01000000
       
   321 /*
       
   322  *   On OSX, the Mach-O executable format is significantly
       
   323  *   different than CFM. In addition to having a different
       
   324  *   C++ ABI, it also has has different C calling convention.
       
   325  *   You must use glue code when calling between CFM and
       
   326  *   Mach-O C functions. 
       
   327  */
       
   328 #if (defined(TARGET_RT_MAC_MACHO))
       
   329 #define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK
       
   330 #else
       
   331 #define _NP_ABI_MIXIN_FOR_MACHO 0
       
   332 #endif
       
   333 
       
   334 
       
   335 #define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO)
       
   336 
       
   337 /*
       
   338  * List of variable names for which NPP_GetValue shall be implemented
       
   339  */
       
   340 typedef enum {
       
   341     NPPVpluginNameString = 1,
       
   342     NPPVpluginDescriptionString,
       
   343     NPPVpluginWindowBool,
       
   344     NPPVpluginTransparentBool,
       
   345 
       
   346     NPPVjavaClass,                /* Not implemented in WebKit */
       
   347     NPPVpluginWindowSize,         /* Not implemented in WebKit */
       
   348     NPPVpluginTimerInterval,      /* Not implemented in WebKit */
       
   349 
       
   350     NPPVpluginScriptableInstance = (10 | NP_ABI_MASK), /* Not implemented in WebKit */
       
   351     NPPVpluginScriptableIID = 11, /* Not implemented in WebKit */
       
   352 
       
   353     /* 12 and over are available on Mozilla builds starting with 0.9.9 */
       
   354     NPPVjavascriptPushCallerBool = 12,  /* Not implemented in WebKit */
       
   355     NPPVpluginKeepLibraryInMemory = 13, /* Not implemented in WebKit */
       
   356     NPPVpluginNeedsXEmbed         = 14, /* Not implemented in WebKit */
       
   357 
       
   358     /* Get the NPObject for scripting the plugin. */
       
   359     NPPVpluginScriptableNPObject  = 15,
       
   360 
       
   361 #ifdef __SYMBIAN32__
       
   362     // Custom NPP variables, starting from 100 till 1000
       
   363     NPPVPluginFocusPosition = 100,    
       
   364     NPPVPluginDeactivate = 101,
       
   365     NPPVPluginZoom = 102,
       
   366     NPPVPluginPointerEvent = 103,
       
   367     NPPVpluginInteractiveBool = 1000,
       
   368 #endif
       
   369 
       
   370     /* Get the plugin value (as \0-terminated UTF-8 string data) for
       
   371      * form submission if the plugin is part of a form. Use
       
   372      * NPN_MemAlloc() to allocate memory for the string data.
       
   373      */
       
   374     NPPVformValue = 16,    /* Not implemented in WebKit */
       
   375     NPPVpluginFullScreenBool = 17 /* Not implemented in WebKit */
       
   376 } NPPVariable;
       
   377 
       
   378 /*
       
   379  * List of variable names for which NPN_GetValue is implemented by Mozilla
       
   380  */
       
   381 typedef enum {
       
   382     NPNVxDisplay = 1,
       
   383     NPNVxtAppContext,
       
   384     NPNVnetscapeWindow,
       
   385     NPNVjavascriptEnabledBool,
       
   386     NPNVasdEnabledBool,
       
   387     NPNVisOfflineBool,
       
   388 
       
   389     /* 10 and over are available on Mozilla builds starting with 0.9.4 */
       
   390     NPNVserviceManager = (10 | NP_ABI_MASK),  /* Not implemented in WebKit */
       
   391     NPNVDOMElement     = (11 | NP_ABI_MASK),  /* Not implemented in WebKit */
       
   392     NPNVDOMWindow      = (12 | NP_ABI_MASK),  /* Not implemented in WebKit */
       
   393     NPNVToolkit        = (13 | NP_ABI_MASK),  /* Not implemented in WebKit */
       
   394     NPNVSupportsXEmbedBool = 14,              /* Not implemented in WebKit */
       
   395 
       
   396     /* Get the NPObject wrapper for the browser window. */
       
   397     NPNVWindowNPObject = 15,
       
   398 
       
   399     /* Get the NPObject wrapper for the plugins DOM element. */
       
   400     NPNVPluginElementNPObject,
       
   401 
       
   402 #ifdef XP_MACOSX
       
   403     , NPNVpluginDrawingModel = 1000 /* The NPDrawingModel specified by the plugin */
       
   404 
       
   405 #ifndef NP_NO_QUICKDRAW
       
   406     , NPNVsupportsQuickDrawBool = 2000 /* TRUE if the browser supports the QuickDraw drawing model */
       
   407 #endif
       
   408     , NPNVsupportsCoreGraphicsBool = 2001 /* TRUE if the browser supports the CoreGraphics drawing model */
       
   409     , NPNVsupportsOpenGLBool = 2002 /* TRUE if the browser supports the OpenGL drawing model (CGL on Mac) */
       
   410 #endif /* XP_MACOSX */
       
   411     
       
   412     /* Get the id of the currently connected access point */
       
   413     NPNNetworkAccess
       
   414 } NPNVariable;
       
   415 
       
   416 /*
       
   417  * The type of a NPWindow - it specifies the type of the data structure
       
   418  * returned in the window field.
       
   419  */
       
   420 typedef enum {
       
   421     NPWindowTypeWindow = 1,
       
   422     NPWindowTypeDrawable
       
   423 } NPWindowType;
       
   424 
       
   425 #ifdef XP_MACOSX
       
   426 
       
   427 /*
       
   428  * The drawing model for a Mac OS X plugin.  These are the possible values for the NPNVpluginDrawingModel variable.
       
   429  */
       
   430  
       
   431 typedef enum {
       
   432 #ifndef NP_NO_QUICKDRAW
       
   433     NPDrawingModelQuickDraw = 0,
       
   434 #endif
       
   435     NPDrawingModelCoreGraphics = 1,
       
   436     NPDrawingModelOpenGL = 2
       
   437 } NPDrawingModel;
       
   438 
       
   439 #endif
       
   440 
       
   441 typedef struct _NPWindow
       
   442 {
       
   443     void*    window;     /* Platform specific window handle */
       
   444     int32    x;            /* Position of top left corner relative */
       
   445     int32    y;            /*    to a netscape page.                    */
       
   446     uint32    width;        /* Maximum window size */
       
   447     uint32    height;
       
   448     NPRect    clipRect;    /* Clipping rectangle in port coordinates */
       
   449                         /* Used by MAC only.              */
       
   450 #ifdef XP_UNIX
       
   451     void *    ws_info;    /* Platform-dependent additonal data */
       
   452 #endif /* XP_UNIX */
       
   453     NPWindowType type;    /* Is this a window or a drawable? */
       
   454 } NPWindow;
       
   455 
       
   456 
       
   457 typedef struct _NPFullPrint
       
   458 {
       
   459     NPBool    pluginPrinted;    /* Set TRUE if plugin handled fullscreen */
       
   460                             /*    printing                             */
       
   461     NPBool    printOne;        /* TRUE if plugin should print one copy  */
       
   462                             /*    to default printer                     */
       
   463     void*    platformPrint;    /* Platform-specific printing info */
       
   464 } NPFullPrint;
       
   465 
       
   466 typedef struct _NPEmbedPrint
       
   467 {
       
   468     NPWindow    window;
       
   469     void*    platformPrint;    /* Platform-specific printing info */
       
   470 } NPEmbedPrint;
       
   471 
       
   472 typedef struct _NPPrint
       
   473 {
       
   474     uint16    mode;                        /* NP_FULL or NP_EMBED */
       
   475     union
       
   476     {
       
   477         NPFullPrint     fullPrint;        /* if mode is NP_FULL */
       
   478         NPEmbedPrint    embedPrint;        /* if mode is NP_EMBED */
       
   479     } print;
       
   480 } NPPrint;
       
   481 
       
   482 #if defined(XP_MAC) || defined(XP_MACOSX)
       
   483 typedef EventRecord    NPEvent;
       
   484 #elif defined(XP_WIN)
       
   485 typedef struct _NPEvent
       
   486 {
       
   487     uint16   event;
       
   488     uint32   wParam;
       
   489     uint32   lParam;
       
   490 } NPEvent;
       
   491 #elif defined (XP_UNIX)
       
   492 typedef XEvent NPEvent;
       
   493 #elif defined (__SYMBIAN32__)
       
   494 typedef struct _NPEvent
       
   495 {
       
   496     uint32   event;
       
   497     void*    param;
       
   498 } NPEvent;
       
   499 #else
       
   500 typedef void*            NPEvent;
       
   501 #endif /* XP_MAC */
       
   502 
       
   503 #if defined(XP_MAC)
       
   504 typedef RgnHandle NPRegion;
       
   505 #elif defined(XP_MACOSX)
       
   506 /* 
       
   507  * NPRegion's type depends on the drawing model specified by the plugin (see NPNVpluginDrawingModel).
       
   508  * NPQDRegion represents a QuickDraw RgnHandle and is used with the QuickDraw drawing model.
       
   509  * NPCGRegion repesents a graphical region when using any other drawing model.
       
   510  */
       
   511 typedef void *NPRegion;
       
   512 #ifndef NP_NO_QUICKDRAW
       
   513 typedef RgnHandle NPQDRegion;
       
   514 #endif
       
   515 typedef CGPathRef NPCGRegion;
       
   516 #elif defined(XP_WIN)
       
   517 typedef HRGN NPRegion;
       
   518 #elif defined(XP_UNIX)
       
   519 typedef Region NPRegion;
       
   520 #else
       
   521 typedef void *NPRegion;
       
   522 #endif /* XP_MAC */
       
   523 
       
   524 #ifdef XP_MACOSX
       
   525 
       
   526 /* 
       
   527  * NP_CGContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelCoreGraphics
       
   528  * as its drawing model.
       
   529  */
       
   530 
       
   531 typedef struct NP_CGContext
       
   532 {
       
   533     CGContextRef context;
       
   534     WindowRef window;
       
   535 } NP_CGContext;
       
   536 
       
   537 /* 
       
   538  * NP_GLContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelOpenGL as its
       
   539  * drawing model.
       
   540  */
       
   541 
       
   542 typedef struct NP_GLContext
       
   543 {
       
   544     CGLContextObj context;
       
   545     WindowRef window;
       
   546 } NP_GLContext;
       
   547 
       
   548 #endif /* XP_MACOSX */
       
   549 
       
   550 #if defined(XP_MAC) || defined(XP_MACOSX)
       
   551 
       
   552 /*
       
   553  *  Mac-specific structures and definitions.
       
   554  */
       
   555 
       
   556 #ifndef NP_NO_QUICKDRAW
       
   557 
       
   558 /* 
       
   559  * NP_Port is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelQuickDraw as its
       
   560  * drawing model, or the plugin does not specify a drawing model.
       
   561  *
       
   562  * It is not recommended that new plugins use NPDrawingModelQuickDraw or NP_Port, as QuickDraw has been
       
   563  * deprecated in Mac OS X 10.5.  CoreGraphics is the preferred drawing API.
       
   564  *
       
   565  * NP_Port is not available in 64-bit.
       
   566  */
       
   567  
       
   568 typedef struct NP_Port
       
   569 {
       
   570     CGrafPtr     port;        /* Grafport */
       
   571     int32        portx;        /* position inside the topmost window */
       
   572     int32        porty;
       
   573 } NP_Port;
       
   574 
       
   575 #endif /* NP_NO_QUICKDRAW */
       
   576 
       
   577 /*
       
   578  *  Non-standard event types that can be passed to HandleEvent
       
   579  */
       
   580 #define getFocusEvent        (osEvt + 16)
       
   581 #define loseFocusEvent        (osEvt + 17)
       
   582 #define adjustCursorEvent   (osEvt + 18)
       
   583 
       
   584 #endif /* XP_MAC */
       
   585 
       
   586 
       
   587 /*
       
   588  * Values for mode passed to NPP_New:
       
   589  */
       
   590 #define NP_EMBED        1
       
   591 #define NP_FULL         2
       
   592 
       
   593 /*
       
   594  * Values for stream type passed to NPP_NewStream:
       
   595  */
       
   596 #define NP_NORMAL        1
       
   597 #define NP_SEEK         2
       
   598 #define NP_ASFILE        3
       
   599 #define NP_ASFILEONLY        4
       
   600 
       
   601 #define NP_MAXREADY    (((unsigned)(~0)<<1)>>1)
       
   602 
       
   603 #if !defined(__LP64__)
       
   604 #if defined(XP_MAC) || defined(XP_MACOSX)
       
   605 #pragma options align=reset
       
   606 #endif
       
   607 #endif /* __LP64__ */
       
   608 
       
   609 
       
   610 /*----------------------------------------------------------------------*/
       
   611 /*             Error and Reason Code definitions            */
       
   612 /*----------------------------------------------------------------------*/
       
   613 
       
   614 /*
       
   615  *    Values of type NPError:
       
   616  */
       
   617 #define NPERR_BASE                            0
       
   618 #define NPERR_NO_ERROR                        (NPERR_BASE + 0)
       
   619 #define NPERR_GENERIC_ERROR                    (NPERR_BASE + 1)
       
   620 #define NPERR_INVALID_INSTANCE_ERROR        (NPERR_BASE + 2)
       
   621 #define NPERR_INVALID_FUNCTABLE_ERROR        (NPERR_BASE + 3)
       
   622 #define NPERR_MODULE_LOAD_FAILED_ERROR        (NPERR_BASE + 4)
       
   623 #define NPERR_OUT_OF_MEMORY_ERROR            (NPERR_BASE + 5)
       
   624 #define NPERR_INVALID_PLUGIN_ERROR            (NPERR_BASE + 6)
       
   625 #define NPERR_INVALID_PLUGIN_DIR_ERROR        (NPERR_BASE + 7)
       
   626 #define NPERR_INCOMPATIBLE_VERSION_ERROR    (NPERR_BASE + 8)
       
   627 #define NPERR_INVALID_PARAM                (NPERR_BASE + 9)
       
   628 #define NPERR_INVALID_URL                    (NPERR_BASE + 10)
       
   629 #define NPERR_FILE_NOT_FOUND                (NPERR_BASE + 11)
       
   630 #define NPERR_NO_DATA                        (NPERR_BASE + 12)
       
   631 #define NPERR_STREAM_NOT_SEEKABLE            (NPERR_BASE + 13)
       
   632 
       
   633 /*
       
   634  *    Values of type NPReason:
       
   635  */
       
   636 #define NPRES_BASE                0
       
   637 #define NPRES_DONE                    (NPRES_BASE + 0)
       
   638 #define NPRES_NETWORK_ERR            (NPRES_BASE + 1)
       
   639 #define NPRES_USER_BREAK            (NPRES_BASE + 2)
       
   640 
       
   641 /*
       
   642  *      Don't use these obsolete error codes any more.
       
   643  */
       
   644 #define NP_NOERR  NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
       
   645 #define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
       
   646 #define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
       
   647 
       
   648 /*
       
   649  * Version feature information
       
   650  */
       
   651 #define NPVERS_HAS_STREAMOUTPUT     8
       
   652 #define NPVERS_HAS_NOTIFICATION     9
       
   653 #define NPVERS_HAS_LIVECONNECT        9
       
   654 #define NPVERS_WIN16_HAS_LIVECONNECT    9
       
   655 #define NPVERS_68K_HAS_LIVECONNECT    11
       
   656 #define NPVERS_HAS_WINDOWLESS       11
       
   657 #define NPVERS_HAS_XPCONNECT_SCRIPTING    13  /* Not implemented in WebKit */
       
   658 #define NPVERS_HAS_NPRUNTIME_SCRIPTING    14
       
   659 #define NPVERS_HAS_FORM_VALUES            15  /* Not implemented in WebKit; see bug 13061 */
       
   660 #define NPVERS_HAS_POPUPS_ENABLED_STATE   16  /* Not implemented in WebKit */
       
   661 #define NPVERS_HAS_RESPONSE_HEADERS       17
       
   662 #define NPVERS_HAS_NPOBJECT_ENUM          18
       
   663 
       
   664 
       
   665 /*----------------------------------------------------------------------*/
       
   666 /*             Function Prototypes                */
       
   667 /*----------------------------------------------------------------------*/
       
   668 
       
   669 #if defined(_WINDOWS) && !defined(WIN32)
       
   670 #define NP_LOADDS  _loadds
       
   671 #else
       
   672 #define NP_LOADDS
       
   673 #endif
       
   674 
       
   675 #ifndef __SYMBIAN32__
       
   676  #ifdef __cplusplus
       
   677  extern "C" {
       
   678  #endif
       
   679 #endif
       
   680 
       
   681 /*
       
   682  * NPP_* functions are provided by the plugin and called by the navigator.
       
   683  */
       
   684 
       
   685 #ifdef XP_UNIX
       
   686 char*                    NPP_GetMIMEDescription(void);
       
   687 #endif /* XP_UNIX */
       
   688 
       
   689 #ifdef __SYMBIAN32__
       
   690 #include <badesca.h>
       
   691 IMPORT_C const TDesC* NPP_GetMIMEDescription(void);
       
   692 #endif /* __SYMBIAN32__ */
       
   693 
       
   694 NPError     NPP_Initialize(void);
       
   695 #ifdef __SYMBIAN32__
       
   696 IMPORT_C
       
   697 #endif /* __SYMBIAN32__ */
       
   698 void        NPP_Shutdown(void);
       
   699 
       
   700 #ifndef __SYMBIAN32__
       
   701 NPError     NP_LOADDS    NPP_New(NPMIMEType pluginType, NPP instance,
       
   702                                 uint16 mode, int16 argc, char* argn[],
       
   703                                 char* argv[], NPSavedData* saved);
       
   704 #else
       
   705 NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance,
       
   706               uint16 mode, CDesCArray* argn,
       
   707               CDesCArray* argv, NPSavedData* saved);
       
   708 #endif /* __SYMBIAN32__ */
       
   709 
       
   710 NPError     NP_LOADDS    NPP_Destroy(NPP instance, NPSavedData** save);
       
   711 NPError     NP_LOADDS    NPP_SetWindow(NPP instance, NPWindow* window);
       
   712 NPError     NP_LOADDS    NPP_NewStream(NPP instance, NPMIMEType type,
       
   713                                       NPStream* stream, NPBool seekable,
       
   714                                       uint16* stype);
       
   715 NPError     NP_LOADDS    NPP_DestroyStream(NPP instance, NPStream* stream,
       
   716                                           NPReason reason);
       
   717 int32        NP_LOADDS    NPP_WriteReady(NPP instance, NPStream* stream);
       
   718 int32        NP_LOADDS    NPP_Write(NPP instance, NPStream* stream, int32 offset,
       
   719                                   int32 len, void* buffer);
       
   720 
       
   721 #ifndef __SYMBIAN32__
       
   722 void        NP_LOADDS    NPP_StreamAsFile(NPP instance, NPStream* stream,
       
   723                                          const char* fname);
       
   724 #else/* __SYMBIAN32__ */
       
   725 void    NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream,
       
   726                                    const TDesC& fname);
       
   727 #endif /* __SYMBIAN32__ */
       
   728 
       
   729 void        NP_LOADDS    NPP_Print(NPP instance, NPPrint* platformPrint);
       
   730 int16            NPP_HandleEvent(NPP instance, void* event);
       
   731 
       
   732 #ifndef __SYMBIAN32__
       
   733 void        NP_LOADDS    NPP_URLNotify(NPP instance, const char* url,
       
   734                                       NPReason reason, void* notifyData);
       
   735 jref        NP_LOADDS            NPP_GetJavaClass(void);
       
   736 #else/* __SYMBIAN32__ */
       
   737 void    NP_LOADDS NPP_URLNotify(NPP instance, const TDesC& url,
       
   738                                 NPReason reason, void* notifyData);
       
   739 #endif /* __SYMBIAN32__ */
       
   740 
       
   741 
       
   742 #ifdef __SYMBIAN32__
       
   743 IMPORT_C
       
   744 #endif /* __SYMBIAN32__ */
       
   745 NPError     NPP_GetValue(NPP instance, NPPVariable variable,
       
   746                                      void *value);
       
   747 NPError     NPP_SetValue(NPP instance, NPNVariable variable,
       
   748                                      void *value);
       
   749 
       
   750 /*
       
   751  * NPN_* functions are provided by the navigator and called by the plugin.
       
   752  */
       
   753 
       
   754 void        NPN_Version(int* plugin_major, int* plugin_minor,
       
   755                             int* netscape_major, int* netscape_minor);
       
   756 
       
   757 #ifndef __SYMBIAN32__
       
   758 NPError     NPN_GetURLNotify(NPP instance, const char* url,
       
   759                                  const char* target, void* notifyData);
       
   760 NPError     NPN_GetURL(NPP instance, const char* url,
       
   761                            const char* target);
       
   762 NPError     NPN_PostURLNotify(NPP instance, const char* url,
       
   763                                   const char* target, uint32 len,
       
   764                                   const char* buf, NPBool file,
       
   765                                   void* notifyData);
       
   766 NPError     NPN_PostURL(NPP instance, const char* url,
       
   767                             const char* target, uint32 len,
       
   768                             const char* buf, NPBool file);
       
   769 #else/* __SYMBIAN32__ */
       
   770 NPError NP_LOADDS NPN_GetURLNotify(NPP instance, const TDesC& url,
       
   771                                    const TDesC* target, void* notifyData);
       
   772 NPError NP_LOADDS NPN_GetURL(NPP instance, const TDesC& url,
       
   773                              const TDesC* target);
       
   774 NPError NP_LOADDS NPN_PostURLNotify(NPP instance, const TDesC& url,
       
   775                                     const TDesC* target,
       
   776                                     const TDesC& buf, NPBool file,
       
   777                                     void* notifyData);
       
   778 NPError NP_LOADDS NPN_PostURL(NPP instance, const TDesC& url,
       
   779                               const TDesC* target,
       
   780                               const TDesC& buf, NPBool file);
       
   781 #endif /* __SYMBIAN32__ */
       
   782 
       
   783 NPError     NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
       
   784 
       
   785 #ifndef __SYMBIAN32__
       
   786 NPError     NPN_NewStream(NPP instance, NPMIMEType type,
       
   787                               const char* target, NPStream** stream);
       
   788 #else/* __SYMBIAN32__ */
       
   789 NPError NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type,
       
   790                                 const TDesC* target, NPStream** stream);
       
   791 #endif /* __SYMBIAN32__ */
       
   792 
       
   793 int32   NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer);
       
   794 NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPReason reason);
       
   795 
       
   796 #ifndef __SYMBIAN32__
       
   797 void        NPN_Status(NPP instance, const char* message);
       
   798 #else/* __SYMBIAN32__ */
       
   799 void    NP_LOADDS NPN_Status(NPP instance, const TDesC& message);
       
   800 #endif /* __SYMBIAN32__ */
       
   801 
       
   802 #ifndef __SYMBIAN32__
       
   803 const char*    NPN_UserAgent(NPP instance);
       
   804 #else/* __SYMBIAN32__ */
       
   805 const TDesC* NP_LOADDS  NPN_UserAgent(NPP instance);
       
   806 #endif /* __SYMBIAN32__ */
       
   807 
       
   808 
       
   809 void*        NPN_MemAlloc(uint32 size);
       
   810 void        NPN_MemFree(void* ptr);
       
   811 uint32        NPN_MemFlush(uint32 size);
       
   812 void        NPN_ReloadPlugins(NPBool reloadPages);
       
   813 #ifndef __SYMBIAN32__
       
   814 JRIEnv*     NPN_GetJavaEnv(void);
       
   815 jref        NPN_GetJavaPeer(NPP instance);
       
   816 #endif
       
   817 NPError     NPN_GetValue(NPP instance, NPNVariable variable,
       
   818                              void *value);
       
   819 NPError     NPN_SetValue(NPP instance, NPPVariable variable,
       
   820                              void *value);
       
   821 void        NPN_InvalidateRect(NPP instance, NPRect *invalidRect);
       
   822 void        NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion);
       
   823 void        NPN_ForceRedraw(NPP instance);
       
   824 void        NPN_PushPopupsEnabledState(NPP instance, NPBool enabled);
       
   825 void        NPN_PopPopupsEnabledState(NPP instance);
       
   826 
       
   827 #ifndef __SYMBIAN32__
       
   828  #ifdef __cplusplus
       
   829  }  /* end extern "C" */
       
   830  #endif
       
   831 #endif
       
   832 
       
   833 #endif /* _NPAPI_H_ */