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