dom/plugins/base/npapi.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial