1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/plugins/base/npapi.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,882 @@ 1.4 +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef npapi_h_ 1.10 +#define npapi_h_ 1.11 + 1.12 +#include "nptypes.h" 1.13 + 1.14 +#if defined(_WIN32) && !defined(__SYMBIAN32__) 1.15 +#include <windef.h> 1.16 +#ifndef XP_WIN 1.17 +#define XP_WIN 1 1.18 +#endif 1.19 +#endif 1.20 + 1.21 +#if defined(__SYMBIAN32__) 1.22 +#ifndef XP_SYMBIAN 1.23 +#define XP_SYMBIAN 1 1.24 +#undef XP_WIN 1.25 +#endif 1.26 +#endif 1.27 + 1.28 +#if defined(__APPLE_CC__) && !defined(XP_UNIX) 1.29 +#ifndef XP_MACOSX 1.30 +#define XP_MACOSX 1 1.31 +#endif 1.32 +#endif 1.33 + 1.34 +#if defined(XP_MACOSX) && defined(__LP64__) 1.35 +#define NP_NO_QUICKDRAW 1.36 +#define NP_NO_CARBON 1.37 +#endif 1.38 + 1.39 +#if defined(XP_MACOSX) 1.40 +#include <ApplicationServices/ApplicationServices.h> 1.41 +#include <OpenGL/OpenGL.h> 1.42 +#ifndef NP_NO_CARBON 1.43 +#include <Carbon/Carbon.h> 1.44 +#endif 1.45 +#endif 1.46 + 1.47 +#if defined(XP_UNIX) 1.48 +#include <stdio.h> 1.49 +#if defined(MOZ_X11) 1.50 +#include <X11/Xlib.h> 1.51 +#include <X11/Xutil.h> 1.52 +#endif 1.53 +#endif 1.54 + 1.55 +#if defined(XP_SYMBIAN) 1.56 +#include <QEvent> 1.57 +#include <QRegion> 1.58 +#endif 1.59 + 1.60 +/*----------------------------------------------------------------------*/ 1.61 +/* Plugin Version Constants */ 1.62 +/*----------------------------------------------------------------------*/ 1.63 + 1.64 +#define NP_VERSION_MAJOR 0 1.65 +#define NP_VERSION_MINOR 27 1.66 + 1.67 + 1.68 +/* The OS/2 version of Netscape uses RC_DATA to define the 1.69 + mime types, file extensions, etc that are required. 1.70 + Use a vertical bar to separate types, end types with \0. 1.71 + FileVersion and ProductVersion are 32bit ints, all other 1.72 + entries are strings that MUST be terminated with a \0. 1.73 + 1.74 +AN EXAMPLE: 1.75 + 1.76 +RCDATA NP_INFO_ProductVersion { 1,0,0,1,} 1.77 + 1.78 +RCDATA NP_INFO_MIMEType { "video/x-video|", 1.79 + "video/x-flick\0" } 1.80 +RCDATA NP_INFO_FileExtents { "avi|", 1.81 + "flc\0" } 1.82 +RCDATA NP_INFO_FileOpenName{ "MMOS2 video player(*.avi)|", 1.83 + "MMOS2 Flc/Fli player(*.flc)\0" } 1.84 + 1.85 +RCDATA NP_INFO_FileVersion { 1,0,0,1 } 1.86 +RCDATA NP_INFO_CompanyName { "Netscape Communications\0" } 1.87 +RCDATA NP_INFO_FileDescription { "NPAVI32 Extension DLL\0" 1.88 +RCDATA NP_INFO_InternalName { "NPAVI32\0" ) 1.89 +RCDATA NP_INFO_LegalCopyright { "Copyright Netscape Communications \251 1996\0" 1.90 +RCDATA NP_INFO_OriginalFilename { "NVAPI32.DLL" } 1.91 +RCDATA NP_INFO_ProductName { "NPAVI32 Dynamic Link Library\0" } 1.92 +*/ 1.93 +/* RC_DATA types for version info - required */ 1.94 +#define NP_INFO_ProductVersion 1 1.95 +#define NP_INFO_MIMEType 2 1.96 +#define NP_INFO_FileOpenName 3 1.97 +#define NP_INFO_FileExtents 4 1.98 +/* RC_DATA types for version info - used if found */ 1.99 +#define NP_INFO_FileDescription 5 1.100 +#define NP_INFO_ProductName 6 1.101 +/* RC_DATA types for version info - optional */ 1.102 +#define NP_INFO_CompanyName 7 1.103 +#define NP_INFO_FileVersion 8 1.104 +#define NP_INFO_InternalName 9 1.105 +#define NP_INFO_LegalCopyright 10 1.106 +#define NP_INFO_OriginalFilename 11 1.107 + 1.108 +#ifndef RC_INVOKED 1.109 + 1.110 +/*----------------------------------------------------------------------*/ 1.111 +/* Definition of Basic Types */ 1.112 +/*----------------------------------------------------------------------*/ 1.113 + 1.114 +typedef unsigned char NPBool; 1.115 +typedef int16_t NPError; 1.116 +typedef int16_t NPReason; 1.117 +typedef char* NPMIMEType; 1.118 + 1.119 +/*----------------------------------------------------------------------*/ 1.120 +/* Structures and definitions */ 1.121 +/*----------------------------------------------------------------------*/ 1.122 + 1.123 +#if !defined(__LP64__) 1.124 +#if defined(XP_MACOSX) 1.125 +#pragma options align=mac68k 1.126 +#endif 1.127 +#endif /* __LP64__ */ 1.128 + 1.129 +/* 1.130 + * NPP is a plug-in's opaque instance handle 1.131 + */ 1.132 +typedef struct _NPP 1.133 +{ 1.134 + void* pdata; /* plug-in private data */ 1.135 + void* ndata; /* netscape private data */ 1.136 +} NPP_t; 1.137 + 1.138 +typedef NPP_t* NPP; 1.139 + 1.140 +typedef struct _NPStream 1.141 +{ 1.142 + void* pdata; /* plug-in private data */ 1.143 + void* ndata; /* netscape private data */ 1.144 + const char* url; 1.145 + uint32_t end; 1.146 + uint32_t lastmodified; 1.147 + void* notifyData; 1.148 + const char* headers; /* Response headers from host. 1.149 + * Exists only for >= NPVERS_HAS_RESPONSE_HEADERS. 1.150 + * Used for HTTP only; nullptr for non-HTTP. 1.151 + * Available from NPP_NewStream onwards. 1.152 + * Plugin should copy this data before storing it. 1.153 + * Includes HTTP status line and all headers, 1.154 + * preferably verbatim as received from server, 1.155 + * headers formatted as in HTTP ("Header: Value"), 1.156 + * and newlines (\n, NOT \r\n) separating lines. 1.157 + * Terminated by \n\0 (NOT \n\n\0). */ 1.158 +} NPStream; 1.159 + 1.160 +typedef struct _NPByteRange 1.161 +{ 1.162 + int32_t offset; /* negative offset means from the end */ 1.163 + uint32_t length; 1.164 + struct _NPByteRange* next; 1.165 +} NPByteRange; 1.166 + 1.167 +typedef struct _NPSavedData 1.168 +{ 1.169 + int32_t len; 1.170 + void* buf; 1.171 +} NPSavedData; 1.172 + 1.173 +typedef struct _NPRect 1.174 +{ 1.175 + uint16_t top; 1.176 + uint16_t left; 1.177 + uint16_t bottom; 1.178 + uint16_t right; 1.179 +} NPRect; 1.180 + 1.181 +typedef struct _NPSize 1.182 +{ 1.183 + int32_t width; 1.184 + int32_t height; 1.185 +} NPSize; 1.186 + 1.187 +typedef enum { 1.188 + NPFocusNext = 0, 1.189 + NPFocusPrevious = 1 1.190 +} NPFocusDirection; 1.191 + 1.192 +/* These formats describe the format in the memory byte-order. This means if 1.193 + * a 32-bit value of a pixel is viewed on a little-endian system the layout will 1.194 + * be 0xAARRGGBB. The Alpha channel will be stored in the most significant 1.195 + * bits. */ 1.196 +typedef enum { 1.197 + /* 32-bit per pixel 8-bit per channel - premultiplied alpha */ 1.198 + NPImageFormatBGRA32 = 0x1, 1.199 + /* 32-bit per pixel 8-bit per channel - 1 unused channel */ 1.200 + NPImageFormatBGRX32 = 0x2 1.201 +} NPImageFormat; 1.202 + 1.203 +typedef struct _NPAsyncSurface 1.204 +{ 1.205 + uint32_t version; 1.206 + NPSize size; 1.207 + NPImageFormat format; 1.208 + union { 1.209 + struct { 1.210 + uint32_t stride; 1.211 + void *data; 1.212 + } bitmap; 1.213 +#if defined(XP_WIN) 1.214 + HANDLE sharedHandle; 1.215 +#endif 1.216 + }; 1.217 +} NPAsyncSurface; 1.218 + 1.219 +/* Return values for NPP_HandleEvent */ 1.220 +#define kNPEventNotHandled 0 1.221 +#define kNPEventHandled 1 1.222 +/* Exact meaning must be spec'd in event model. */ 1.223 +#define kNPEventStartIME 2 1.224 + 1.225 +#if defined(XP_UNIX) 1.226 +/* 1.227 + * Unix specific structures and definitions 1.228 + */ 1.229 + 1.230 +/* 1.231 + * Callback Structures. 1.232 + * 1.233 + * These are used to pass additional platform specific information. 1.234 + */ 1.235 +enum { 1.236 + NP_SETWINDOW = 1, 1.237 + NP_PRINT 1.238 +}; 1.239 + 1.240 +typedef struct 1.241 +{ 1.242 + int32_t type; 1.243 +} NPAnyCallbackStruct; 1.244 + 1.245 +typedef struct 1.246 +{ 1.247 + int32_t type; 1.248 +#if defined(MOZ_X11) 1.249 + Display* display; 1.250 + Visual* visual; 1.251 + Colormap colormap; 1.252 + unsigned int depth; 1.253 +#endif 1.254 +} NPSetWindowCallbackStruct; 1.255 + 1.256 +typedef struct 1.257 +{ 1.258 + int32_t type; 1.259 + FILE* fp; 1.260 +} NPPrintCallbackStruct; 1.261 + 1.262 +#endif /* XP_UNIX */ 1.263 + 1.264 +typedef enum { 1.265 +#if defined(XP_MACOSX) 1.266 +#ifndef NP_NO_QUICKDRAW 1.267 + NPDrawingModelQuickDraw = 0, 1.268 +#endif 1.269 + NPDrawingModelCoreGraphics = 1, 1.270 + NPDrawingModelOpenGL = 2, 1.271 + NPDrawingModelCoreAnimation = 3, 1.272 + NPDrawingModelInvalidatingCoreAnimation = 4, 1.273 +#endif 1.274 +#if defined(XP_WIN) 1.275 + NPDrawingModelSyncWin = 5, 1.276 +#endif 1.277 +#if defined(MOZ_X11) 1.278 + NPDrawingModelSyncX = 6, 1.279 +#endif 1.280 + NPDrawingModelAsyncBitmapSurface = 7 1.281 +#if defined(XP_WIN) 1.282 + , NPDrawingModelAsyncWindowsDXGISurface = 8 1.283 +#endif 1.284 +} NPDrawingModel; 1.285 + 1.286 +#ifdef XP_MACOSX 1.287 +typedef enum { 1.288 +#ifndef NP_NO_CARBON 1.289 + NPEventModelCarbon = 0, 1.290 +#endif 1.291 + NPEventModelCocoa = 1 1.292 +} NPEventModel; 1.293 +#endif 1.294 + 1.295 +/* 1.296 + * The following masks are applied on certain platforms to NPNV and 1.297 + * NPPV selectors that pass around pointers to COM interfaces. Newer 1.298 + * compilers on some platforms may generate vtables that are not 1.299 + * compatible with older compilers. To prevent older plugins from 1.300 + * not understanding a new browser's ABI, these masks change the 1.301 + * values of those selectors on those platforms. To remain backwards 1.302 + * compatible with different versions of the browser, plugins can 1.303 + * use these masks to dynamically determine and use the correct C++ 1.304 + * ABI that the browser is expecting. This does not apply to Windows 1.305 + * as Microsoft's COM ABI will likely not change. 1.306 + */ 1.307 + 1.308 +#define NP_ABI_GCC3_MASK 0x10000000 1.309 +/* 1.310 + * gcc 3.x generated vtables on UNIX and OSX are incompatible with 1.311 + * previous compilers. 1.312 + */ 1.313 +#if (defined(XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3)) 1.314 +#define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK 1.315 +#else 1.316 +#define _NP_ABI_MIXIN_FOR_GCC3 0 1.317 +#endif 1.318 + 1.319 +#if defined(XP_MACOSX) 1.320 +#define NP_ABI_MACHO_MASK 0x01000000 1.321 +#define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK 1.322 +#else 1.323 +#define _NP_ABI_MIXIN_FOR_MACHO 0 1.324 +#endif 1.325 + 1.326 +#define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO) 1.327 + 1.328 +/* 1.329 + * List of variable names for which NPP_GetValue shall be implemented 1.330 + */ 1.331 +typedef enum { 1.332 + NPPVpluginNameString = 1, 1.333 + NPPVpluginDescriptionString, 1.334 + NPPVpluginWindowBool, 1.335 + NPPVpluginTransparentBool, 1.336 + NPPVjavaClass, 1.337 + NPPVpluginWindowSize, 1.338 + NPPVpluginTimerInterval, 1.339 + NPPVpluginScriptableInstance = (10 | NP_ABI_MASK), 1.340 + NPPVpluginScriptableIID = 11, 1.341 + NPPVjavascriptPushCallerBool = 12, 1.342 + NPPVpluginKeepLibraryInMemory = 13, 1.343 + NPPVpluginNeedsXEmbed = 14, 1.344 + 1.345 + /* Get the NPObject for scripting the plugin. Introduced in NPAPI minor version 14. 1.346 + */ 1.347 + NPPVpluginScriptableNPObject = 15, 1.348 + 1.349 + /* Get the plugin value (as \0-terminated UTF-8 string data) for 1.350 + * form submission if the plugin is part of a form. Use 1.351 + * NPN_MemAlloc() to allocate memory for the string data. Introduced 1.352 + * in NPAPI minor version 15. 1.353 + */ 1.354 + NPPVformValue = 16, 1.355 + 1.356 + NPPVpluginUrlRequestsDisplayedBool = 17, 1.357 + 1.358 + /* Checks if the plugin is interested in receiving the http body of 1.359 + * all http requests (including failed ones, http status != 200). 1.360 + */ 1.361 + NPPVpluginWantsAllNetworkStreams = 18, 1.362 + 1.363 + /* Browsers can retrieve a native ATK accessibility plug ID via this variable. */ 1.364 + NPPVpluginNativeAccessibleAtkPlugId = 19, 1.365 + 1.366 + /* Checks to see if the plug-in would like the browser to load the "src" attribute. */ 1.367 + NPPVpluginCancelSrcStream = 20, 1.368 + 1.369 + NPPVsupportsAdvancedKeyHandling = 21, 1.370 + 1.371 + NPPVpluginUsesDOMForCursorBool = 22, 1.372 + 1.373 + /* Used for negotiating drawing models */ 1.374 + NPPVpluginDrawingModel = 1000 1.375 +#if defined(XP_MACOSX) 1.376 + /* Used for negotiating event models */ 1.377 + , NPPVpluginEventModel = 1001 1.378 + /* In the NPDrawingModelCoreAnimation drawing model, the browser asks the plug-in for a Core Animation layer. */ 1.379 + , NPPVpluginCoreAnimationLayer = 1003 1.380 +#endif 1.381 + 1.382 +} NPPVariable; 1.383 + 1.384 +/* 1.385 + * List of variable names for which NPN_GetValue should be implemented. 1.386 + */ 1.387 +typedef enum { 1.388 + NPNVxDisplay = 1, 1.389 + NPNVxtAppContext, 1.390 + NPNVnetscapeWindow, 1.391 + NPNVjavascriptEnabledBool, 1.392 + NPNVasdEnabledBool, 1.393 + NPNVisOfflineBool, 1.394 + 1.395 + NPNVserviceManager = (10 | NP_ABI_MASK), 1.396 + NPNVDOMElement = (11 | NP_ABI_MASK), 1.397 + NPNVDOMWindow = (12 | NP_ABI_MASK), 1.398 + NPNVToolkit = (13 | NP_ABI_MASK), 1.399 + NPNVSupportsXEmbedBool = 14, 1.400 + 1.401 + /* Get the NPObject wrapper for the browser window. */ 1.402 + NPNVWindowNPObject = 15, 1.403 + 1.404 + /* Get the NPObject wrapper for the plugins DOM element. */ 1.405 + NPNVPluginElementNPObject = 16, 1.406 + 1.407 + NPNVSupportsWindowless = 17, 1.408 + 1.409 + NPNVprivateModeBool = 18, 1.410 + 1.411 + NPNVsupportsAdvancedKeyHandling = 21, 1.412 + 1.413 + NPNVdocumentOrigin = 22, 1.414 + 1.415 + NPNVpluginDrawingModel = 1000 /* Get the current drawing model (NPDrawingModel) */ 1.416 +#if defined(XP_MACOSX) 1.417 + , NPNVcontentsScaleFactor = 1001 1.418 +#ifndef NP_NO_QUICKDRAW 1.419 + , NPNVsupportsQuickDrawBool = 2000 1.420 +#endif 1.421 + , NPNVsupportsCoreGraphicsBool = 2001 1.422 + , NPNVsupportsOpenGLBool = 2002 1.423 + , NPNVsupportsCoreAnimationBool = 2003 1.424 + , NPNVsupportsInvalidatingCoreAnimationBool = 2004 1.425 +#endif 1.426 + , NPNVsupportsAsyncBitmapSurfaceBool = 2007 1.427 +#if defined(XP_WIN) 1.428 + , NPNVsupportsAsyncWindowsDXGISurfaceBool = 2008 1.429 +#endif 1.430 +#if defined(XP_MACOSX) 1.431 +#ifndef NP_NO_CARBON 1.432 + , NPNVsupportsCarbonBool = 3000 /* TRUE if the browser supports the Carbon event model */ 1.433 +#endif 1.434 + , NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */ 1.435 + , NPNVsupportsUpdatedCocoaTextInputBool = 3002 /* TRUE if the browser supports the updated 1.436 + Cocoa text input specification. */ 1.437 + , NPNVsupportsCompositingCoreAnimationPluginsBool = 74656 /* TRUE if the browser supports 1.438 + CA model compositing */ 1.439 +#endif 1.440 +} NPNVariable; 1.441 + 1.442 +typedef enum { 1.443 + NPNURLVCookie = 501, 1.444 + NPNURLVProxy 1.445 +} NPNURLVariable; 1.446 + 1.447 +/* 1.448 + * The type of Toolkit the widgets use 1.449 + */ 1.450 +typedef enum { 1.451 + NPNVGtk12 = 1, 1.452 + NPNVGtk2 1.453 +} NPNToolkitType; 1.454 + 1.455 +/* 1.456 + * The type of a NPWindow - it specifies the type of the data structure 1.457 + * returned in the window field. 1.458 + */ 1.459 +typedef enum { 1.460 + NPWindowTypeWindow = 1, 1.461 + NPWindowTypeDrawable 1.462 +} NPWindowType; 1.463 + 1.464 +typedef struct _NPWindow 1.465 +{ 1.466 + void* window; /* Platform specific window handle */ 1.467 + /* OS/2: x - Position of bottom left corner */ 1.468 + /* OS/2: y - relative to visible netscape window */ 1.469 + int32_t x; /* Position of top left corner relative */ 1.470 + int32_t y; /* to a netscape page. */ 1.471 + uint32_t width; /* Maximum window size */ 1.472 + uint32_t height; 1.473 + NPRect clipRect; /* Clipping rectangle in port coordinates */ 1.474 +#if (defined(XP_UNIX) || defined(XP_SYMBIAN)) && !defined(XP_MACOSX) 1.475 + void * ws_info; /* Platform-dependent additional data */ 1.476 +#endif /* XP_UNIX */ 1.477 + NPWindowType type; /* Is this a window or a drawable? */ 1.478 +} NPWindow; 1.479 + 1.480 +typedef struct _NPImageExpose 1.481 +{ 1.482 + char* data; /* image pointer */ 1.483 + int32_t stride; /* Stride of data image pointer */ 1.484 + int32_t depth; /* Depth of image pointer */ 1.485 + int32_t x; /* Expose x */ 1.486 + int32_t y; /* Expose y */ 1.487 + uint32_t width; /* Expose width */ 1.488 + uint32_t height; /* Expose height */ 1.489 + NPSize dataSize; /* Data buffer size */ 1.490 + float translateX; /* translate X matrix value */ 1.491 + float translateY; /* translate Y matrix value */ 1.492 + float scaleX; /* scale X matrix value */ 1.493 + float scaleY; /* scale Y matrix value */ 1.494 +} NPImageExpose; 1.495 + 1.496 +typedef struct _NPFullPrint 1.497 +{ 1.498 + NPBool pluginPrinted;/* Set TRUE if plugin handled fullscreen printing */ 1.499 + NPBool printOne; /* TRUE if plugin should print one copy to default 1.500 + printer */ 1.501 + void* platformPrint; /* Platform-specific printing info */ 1.502 +} NPFullPrint; 1.503 + 1.504 +typedef struct _NPEmbedPrint 1.505 +{ 1.506 + NPWindow window; 1.507 + void* platformPrint; /* Platform-specific printing info */ 1.508 +} NPEmbedPrint; 1.509 + 1.510 +typedef struct _NPPrint 1.511 +{ 1.512 + uint16_t mode; /* NP_FULL or NP_EMBED */ 1.513 + union 1.514 + { 1.515 + NPFullPrint fullPrint; /* if mode is NP_FULL */ 1.516 + NPEmbedPrint embedPrint; /* if mode is NP_EMBED */ 1.517 + } print; 1.518 +} NPPrint; 1.519 + 1.520 +#if defined(XP_MACOSX) 1.521 +#ifndef NP_NO_CARBON 1.522 +typedef EventRecord NPEvent; 1.523 +#endif 1.524 +#elif defined(XP_SYMBIAN) 1.525 +typedef QEvent NPEvent; 1.526 +#elif defined(XP_WIN) 1.527 +typedef struct _NPEvent 1.528 +{ 1.529 + uint16_t event; 1.530 + uintptr_t wParam; 1.531 + uintptr_t lParam; 1.532 +} NPEvent; 1.533 +#elif defined(XP_UNIX) && defined(MOZ_X11) 1.534 +typedef XEvent NPEvent; 1.535 +#else 1.536 +typedef void* NPEvent; 1.537 +#endif 1.538 + 1.539 +#if defined(XP_MACOSX) 1.540 +typedef void* NPRegion; 1.541 +#ifndef NP_NO_QUICKDRAW 1.542 +typedef RgnHandle NPQDRegion; 1.543 +#endif 1.544 +typedef CGPathRef NPCGRegion; 1.545 +#elif defined(XP_WIN) 1.546 +typedef HRGN NPRegion; 1.547 +#elif defined(XP_UNIX) && defined(MOZ_X11) 1.548 +typedef Region NPRegion; 1.549 +#elif defined(XP_SYMBIAN) 1.550 +typedef QRegion* NPRegion; 1.551 +#else 1.552 +typedef void *NPRegion; 1.553 +#endif 1.554 + 1.555 +typedef struct _NPNSString NPNSString; 1.556 +typedef struct _NPNSWindow NPNSWindow; 1.557 +typedef struct _NPNSMenu NPNSMenu; 1.558 + 1.559 +#if defined(XP_MACOSX) 1.560 +typedef NPNSMenu NPMenu; 1.561 +#else 1.562 +typedef void *NPMenu; 1.563 +#endif 1.564 + 1.565 +typedef enum { 1.566 + NPCoordinateSpacePlugin = 1, 1.567 + NPCoordinateSpaceWindow, 1.568 + NPCoordinateSpaceFlippedWindow, 1.569 + NPCoordinateSpaceScreen, 1.570 + NPCoordinateSpaceFlippedScreen 1.571 +} NPCoordinateSpace; 1.572 + 1.573 +#if defined(XP_MACOSX) 1.574 + 1.575 +#ifndef NP_NO_QUICKDRAW 1.576 +typedef struct NP_Port 1.577 +{ 1.578 + CGrafPtr port; 1.579 + int32_t portx; /* position inside the topmost window */ 1.580 + int32_t porty; 1.581 +} NP_Port; 1.582 +#endif /* NP_NO_QUICKDRAW */ 1.583 + 1.584 +/* 1.585 + * NP_CGContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelCoreGraphics 1.586 + * as its drawing model. 1.587 + */ 1.588 + 1.589 +typedef struct NP_CGContext 1.590 +{ 1.591 + CGContextRef context; 1.592 + void *window; /* A WindowRef under the Carbon event model. */ 1.593 +} NP_CGContext; 1.594 + 1.595 +/* 1.596 + * NP_GLContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelOpenGL as its 1.597 + * drawing model. 1.598 + */ 1.599 + 1.600 +typedef struct NP_GLContext 1.601 +{ 1.602 + CGLContextObj context; 1.603 +#ifdef NP_NO_CARBON 1.604 + NPNSWindow *window; 1.605 +#else 1.606 + void *window; /* Can be either an NSWindow or a WindowRef depending on the event model */ 1.607 +#endif 1.608 +} NP_GLContext; 1.609 + 1.610 +typedef enum { 1.611 + NPCocoaEventDrawRect = 1, 1.612 + NPCocoaEventMouseDown, 1.613 + NPCocoaEventMouseUp, 1.614 + NPCocoaEventMouseMoved, 1.615 + NPCocoaEventMouseEntered, 1.616 + NPCocoaEventMouseExited, 1.617 + NPCocoaEventMouseDragged, 1.618 + NPCocoaEventKeyDown, 1.619 + NPCocoaEventKeyUp, 1.620 + NPCocoaEventFlagsChanged, 1.621 + NPCocoaEventFocusChanged, 1.622 + NPCocoaEventWindowFocusChanged, 1.623 + NPCocoaEventScrollWheel, 1.624 + NPCocoaEventTextInput 1.625 +} NPCocoaEventType; 1.626 + 1.627 +typedef struct _NPCocoaEvent { 1.628 + NPCocoaEventType type; 1.629 + uint32_t version; 1.630 + union { 1.631 + struct { 1.632 + uint32_t modifierFlags; 1.633 + double pluginX; 1.634 + double pluginY; 1.635 + int32_t buttonNumber; 1.636 + int32_t clickCount; 1.637 + double deltaX; 1.638 + double deltaY; 1.639 + double deltaZ; 1.640 + } mouse; 1.641 + struct { 1.642 + uint32_t modifierFlags; 1.643 + NPNSString *characters; 1.644 + NPNSString *charactersIgnoringModifiers; 1.645 + NPBool isARepeat; 1.646 + uint16_t keyCode; 1.647 + } key; 1.648 + struct { 1.649 + CGContextRef context; 1.650 + double x; 1.651 + double y; 1.652 + double width; 1.653 + double height; 1.654 + } draw; 1.655 + struct { 1.656 + NPBool hasFocus; 1.657 + } focus; 1.658 + struct { 1.659 + NPNSString *text; 1.660 + } text; 1.661 + } data; 1.662 +} NPCocoaEvent; 1.663 + 1.664 +#ifndef NP_NO_CARBON 1.665 +/* Non-standard event types that can be passed to HandleEvent */ 1.666 +enum NPEventType { 1.667 + NPEventType_GetFocusEvent = (osEvt + 16), 1.668 + NPEventType_LoseFocusEvent, 1.669 + NPEventType_AdjustCursorEvent, 1.670 + NPEventType_MenuCommandEvent, 1.671 + NPEventType_ClippingChangedEvent, 1.672 + NPEventType_ScrollingBeginsEvent = 1000, 1.673 + NPEventType_ScrollingEndsEvent 1.674 +}; 1.675 +#endif /* NP_NO_CARBON */ 1.676 + 1.677 +#endif /* XP_MACOSX */ 1.678 + 1.679 +/* 1.680 + * Values for mode passed to NPP_New: 1.681 + */ 1.682 +#define NP_EMBED 1 1.683 +#define NP_FULL 2 1.684 + 1.685 +/* 1.686 + * Values for stream type passed to NPP_NewStream: 1.687 + */ 1.688 +#define NP_NORMAL 1 1.689 +#define NP_SEEK 2 1.690 +#define NP_ASFILE 3 1.691 +#define NP_ASFILEONLY 4 1.692 + 1.693 +#define NP_MAXREADY (((unsigned)(~0)<<1)>>1) 1.694 + 1.695 +/* 1.696 + * Flags for NPP_ClearSiteData. 1.697 + */ 1.698 +#define NP_CLEAR_ALL 0 1.699 +#define NP_CLEAR_CACHE (1 << 0) 1.700 + 1.701 +#if !defined(__LP64__) 1.702 +#if defined(XP_MACOSX) 1.703 +#pragma options align=reset 1.704 +#endif 1.705 +#endif /* __LP64__ */ 1.706 + 1.707 +/*----------------------------------------------------------------------*/ 1.708 +/* Error and Reason Code definitions */ 1.709 +/*----------------------------------------------------------------------*/ 1.710 + 1.711 +/* 1.712 + * Values of type NPError: 1.713 + */ 1.714 +#define NPERR_BASE 0 1.715 +#define NPERR_NO_ERROR (NPERR_BASE + 0) 1.716 +#define NPERR_GENERIC_ERROR (NPERR_BASE + 1) 1.717 +#define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2) 1.718 +#define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3) 1.719 +#define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4) 1.720 +#define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5) 1.721 +#define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6) 1.722 +#define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7) 1.723 +#define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8) 1.724 +#define NPERR_INVALID_PARAM (NPERR_BASE + 9) 1.725 +#define NPERR_INVALID_URL (NPERR_BASE + 10) 1.726 +#define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11) 1.727 +#define NPERR_NO_DATA (NPERR_BASE + 12) 1.728 +#define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13) 1.729 +#define NPERR_TIME_RANGE_NOT_SUPPORTED (NPERR_BASE + 14) 1.730 +#define NPERR_MALFORMED_SITE (NPERR_BASE + 15) 1.731 + 1.732 +/* 1.733 + * Values of type NPReason: 1.734 + */ 1.735 +#define NPRES_BASE 0 1.736 +#define NPRES_DONE (NPRES_BASE + 0) 1.737 +#define NPRES_NETWORK_ERR (NPRES_BASE + 1) 1.738 +#define NPRES_USER_BREAK (NPRES_BASE + 2) 1.739 + 1.740 +/* 1.741 + * Don't use these obsolete error codes any more. 1.742 + */ 1.743 +#define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR 1.744 +#define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR 1.745 +#define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK 1.746 + 1.747 +/* 1.748 + * Version feature information 1.749 + */ 1.750 +#define NPVERS_HAS_STREAMOUTPUT 8 1.751 +#define NPVERS_HAS_NOTIFICATION 9 1.752 +#define NPVERS_HAS_LIVECONNECT 9 1.753 +#define NPVERS_68K_HAS_LIVECONNECT 11 1.754 +#define NPVERS_HAS_WINDOWLESS 11 1.755 +#define NPVERS_HAS_XPCONNECT_SCRIPTING 13 1.756 +#define NPVERS_HAS_NPRUNTIME_SCRIPTING 14 1.757 +#define NPVERS_HAS_FORM_VALUES 15 1.758 +#define NPVERS_HAS_POPUPS_ENABLED_STATE 16 1.759 +#define NPVERS_HAS_RESPONSE_HEADERS 17 1.760 +#define NPVERS_HAS_NPOBJECT_ENUM 18 1.761 +#define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19 1.762 +#define NPVERS_HAS_ALL_NETWORK_STREAMS 20 1.763 +#define NPVERS_HAS_URL_AND_AUTH_INFO 21 1.764 +#define NPVERS_HAS_PRIVATE_MODE 22 1.765 +#define NPVERS_MACOSX_HAS_COCOA_EVENTS 23 1.766 +#define NPVERS_HAS_ADVANCED_KEY_HANDLING 25 1.767 +#define NPVERS_HAS_URL_REDIRECT_HANDLING 26 1.768 +#define NPVERS_HAS_CLEAR_SITE_DATA 27 1.769 + 1.770 +/*----------------------------------------------------------------------*/ 1.771 +/* Function Prototypes */ 1.772 +/*----------------------------------------------------------------------*/ 1.773 + 1.774 +#ifdef __cplusplus 1.775 +extern "C" { 1.776 +#endif 1.777 + 1.778 +/* NPP_* functions are provided by the plugin and called by the navigator. */ 1.779 + 1.780 +#if defined(XP_UNIX) 1.781 +const char* NPP_GetMIMEDescription(void); 1.782 +#endif 1.783 + 1.784 +NPError NPP_New(NPMIMEType pluginType, NPP instance, 1.785 + uint16_t mode, int16_t argc, char* argn[], 1.786 + char* argv[], NPSavedData* saved); 1.787 +NPError NPP_Destroy(NPP instance, NPSavedData** save); 1.788 +NPError NPP_SetWindow(NPP instance, NPWindow* window); 1.789 +NPError NPP_NewStream(NPP instance, NPMIMEType type, 1.790 + NPStream* stream, NPBool seekable, 1.791 + uint16_t* stype); 1.792 +NPError NPP_DestroyStream(NPP instance, NPStream* stream, 1.793 + NPReason reason); 1.794 +int32_t NPP_WriteReady(NPP instance, NPStream* stream); 1.795 +int32_t NPP_Write(NPP instance, NPStream* stream, int32_t offset, 1.796 + int32_t len, void* buffer); 1.797 +void NPP_StreamAsFile(NPP instance, NPStream* stream, 1.798 + const char* fname); 1.799 +void NPP_Print(NPP instance, NPPrint* platformPrint); 1.800 +int16_t NPP_HandleEvent(NPP instance, void* event); 1.801 +void NPP_URLNotify(NPP instance, const char* url, 1.802 + NPReason reason, void* notifyData); 1.803 +NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value); 1.804 +NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value); 1.805 +NPBool NPP_GotFocus(NPP instance, NPFocusDirection direction); 1.806 +void NPP_LostFocus(NPP instance); 1.807 +void NPP_URLRedirectNotify(NPP instance, const char* url, int32_t status, void* notifyData); 1.808 +NPError NPP_ClearSiteData(const char* site, uint64_t flags, uint64_t maxAge); 1.809 +char** NPP_GetSitesWithData(void); 1.810 +void NPP_DidComposite(NPP instance); 1.811 + 1.812 +/* NPN_* functions are provided by the navigator and called by the plugin. */ 1.813 +void NPN_Version(int* plugin_major, int* plugin_minor, 1.814 + int* netscape_major, int* netscape_minor); 1.815 +NPError NPN_GetURLNotify(NPP instance, const char* url, 1.816 + const char* target, void* notifyData); 1.817 +NPError NPN_GetURL(NPP instance, const char* url, 1.818 + const char* target); 1.819 +NPError NPN_PostURLNotify(NPP instance, const char* url, 1.820 + const char* target, uint32_t len, 1.821 + const char* buf, NPBool file, 1.822 + void* notifyData); 1.823 +NPError NPN_PostURL(NPP instance, const char* url, 1.824 + const char* target, uint32_t len, 1.825 + const char* buf, NPBool file); 1.826 +NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList); 1.827 +NPError NPN_NewStream(NPP instance, NPMIMEType type, 1.828 + const char* target, NPStream** stream); 1.829 +int32_t NPN_Write(NPP instance, NPStream* stream, int32_t len, 1.830 + void* buffer); 1.831 +NPError NPN_DestroyStream(NPP instance, NPStream* stream, 1.832 + NPReason reason); 1.833 +void NPN_Status(NPP instance, const char* message); 1.834 +const char* NPN_UserAgent(NPP instance); 1.835 +void* NPN_MemAlloc(uint32_t size); 1.836 +void NPN_MemFree(void* ptr); 1.837 +uint32_t NPN_MemFlush(uint32_t size); 1.838 +void NPN_ReloadPlugins(NPBool reloadPages); 1.839 +NPError NPN_GetValue(NPP instance, NPNVariable variable, 1.840 + void *value); 1.841 +NPError NPN_SetValue(NPP instance, NPPVariable variable, 1.842 + void *value); 1.843 +void NPN_InvalidateRect(NPP instance, NPRect *invalidRect); 1.844 +void NPN_InvalidateRegion(NPP instance, 1.845 + NPRegion invalidRegion); 1.846 +void NPN_ForceRedraw(NPP instance); 1.847 +void NPN_PushPopupsEnabledState(NPP instance, NPBool enabled); 1.848 +void NPN_PopPopupsEnabledState(NPP instance); 1.849 +void NPN_PluginThreadAsyncCall(NPP instance, 1.850 + void (*func) (void *), 1.851 + void *userData); 1.852 +NPError NPN_GetValueForURL(NPP instance, NPNURLVariable variable, 1.853 + const char *url, char **value, 1.854 + uint32_t *len); 1.855 +NPError NPN_SetValueForURL(NPP instance, NPNURLVariable variable, 1.856 + const char *url, const char *value, 1.857 + uint32_t len); 1.858 +NPError NPN_GetAuthenticationInfo(NPP instance, 1.859 + const char *protocol, 1.860 + const char *host, int32_t port, 1.861 + const char *scheme, 1.862 + const char *realm, 1.863 + char **username, uint32_t *ulen, 1.864 + char **password, 1.865 + uint32_t *plen); 1.866 +uint32_t NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID)); 1.867 +void NPN_UnscheduleTimer(NPP instance, uint32_t timerID); 1.868 +NPError NPN_PopUpContextMenu(NPP instance, NPMenu* menu); 1.869 +NPBool NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace); 1.870 +NPBool NPN_HandleEvent(NPP instance, void *event, NPBool handled); 1.871 +NPBool NPN_UnfocusInstance(NPP instance, NPFocusDirection direction); 1.872 +void NPN_URLRedirectResponse(NPP instance, void* notifyData, NPBool allow); 1.873 +NPError NPN_InitAsyncSurface(NPP instance, NPSize *size, 1.874 + NPImageFormat format, void *initData, 1.875 + NPAsyncSurface *surface); 1.876 +NPError NPN_FinalizeAsyncSurface(NPP instance, NPAsyncSurface *surface); 1.877 +void NPN_SetCurrentAsyncSurface(NPP instance, NPAsyncSurface *surface, NPRect *changed); 1.878 + 1.879 +#ifdef __cplusplus 1.880 +} /* end extern "C" */ 1.881 +#endif 1.882 + 1.883 +#endif /* RC_INVOKED */ 1.884 + 1.885 +#endif /* npapi_h_ */