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