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