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 27
|
---|
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 |
|
---|
113 | AN EXAMPLE:
|
---|
114 |
|
---|
115 | RCDATA NP_INFO_ProductVersion { 1,0,0,1,}
|
---|
116 |
|
---|
117 | RCDATA NP_INFO_MIMEType { "video/x-video|",
|
---|
118 | "video/x-flick\0" }
|
---|
119 | RCDATA NP_INFO_FileExtents { "avi|",
|
---|
120 | "flc\0" }
|
---|
121 | RCDATA NP_INFO_FileOpenName{ "MMOS2 video player(*.avi)|",
|
---|
122 | "MMOS2 Flc/Fli player(*.flc)\0" }
|
---|
123 |
|
---|
124 | RCDATA NP_INFO_FileVersion { 1,0,0,1 }
|
---|
125 | RCDATA NP_INFO_CompanyName { "Netscape Communications\0" }
|
---|
126 | RCDATA NP_INFO_FileDescription { "NPAVI32 Extension DLL\0"
|
---|
127 | RCDATA NP_INFO_InternalName { "NPAVI32\0" )
|
---|
128 | RCDATA NP_INFO_LegalCopyright { "Copyright Netscape Communications \251 1996\0"
|
---|
129 | RCDATA NP_INFO_OriginalFilename { "NVAPI32.DLL" }
|
---|
130 | RCDATA 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 |
|
---|
153 | typedef unsigned char NPBool;
|
---|
154 | typedef int16_t NPError;
|
---|
155 | typedef int16_t NPReason;
|
---|
156 | typedef 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 | */
|
---|
171 | typedef struct _NPP
|
---|
172 | {
|
---|
173 | void* pdata; /* plug-in private data */
|
---|
174 | void* ndata; /* netscape private data */
|
---|
175 | } NPP_t;
|
---|
176 |
|
---|
177 | typedef NPP_t* NPP;
|
---|
178 |
|
---|
179 | typedef 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 |
|
---|
199 | typedef struct _NPByteRange
|
---|
200 | {
|
---|
201 | int32_t offset; /* negative offset means from the end */
|
---|
202 | uint32_t length;
|
---|
203 | struct _NPByteRange* next;
|
---|
204 | } NPByteRange;
|
---|
205 |
|
---|
206 | typedef struct _NPSavedData
|
---|
207 | {
|
---|
208 | int32_t len;
|
---|
209 | void* buf;
|
---|
210 | } NPSavedData;
|
---|
211 |
|
---|
212 | typedef struct _NPRect
|
---|
213 | {
|
---|
214 | uint16_t top;
|
---|
215 | uint16_t left;
|
---|
216 | uint16_t bottom;
|
---|
217 | uint16_t right;
|
---|
218 | } NPRect;
|
---|
219 |
|
---|
220 | typedef struct _NPSize
|
---|
221 | {
|
---|
222 | int32_t width;
|
---|
223 | int32_t height;
|
---|
224 | } NPSize;
|
---|
225 |
|
---|
226 | typedef 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 | */
|
---|
247 | enum {
|
---|
248 | NP_SETWINDOW = 1,
|
---|
249 | NP_PRINT
|
---|
250 | };
|
---|
251 |
|
---|
252 | typedef struct
|
---|
253 | {
|
---|
254 | int32_t type;
|
---|
255 | } NPAnyCallbackStruct;
|
---|
256 |
|
---|
257 | typedef 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 |
|
---|
268 | typedef struct
|
---|
269 | {
|
---|
270 | int32_t type;
|
---|
271 | FILE* fp;
|
---|
272 | } NPPrintCallbackStruct;
|
---|
273 |
|
---|
274 | #endif /* XP_UNIX */
|
---|
275 |
|
---|
276 | #if defined(XP_MACOSX)
|
---|
277 | typedef 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 |
|
---|
287 | typedef 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 | */
|
---|
331 | typedef 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 | NPPVpluginUsesDOMForCursorBool = 22
|
---|
372 |
|
---|
373 | #if defined(XP_MACOSX)
|
---|
374 | /* Used for negotiating drawing models */
|
---|
375 | , NPPVpluginDrawingModel = 1000
|
---|
376 | /* Used for negotiating event models */
|
---|
377 | , NPPVpluginEventModel = 1001
|
---|
378 | /* In the NPDrawingModelCoreAnimation drawing model, the browser asks the plug-in for a Core Animation layer. */
|
---|
379 | , NPPVpluginCoreAnimationLayer = 1003
|
---|
380 | #endif
|
---|
381 |
|
---|
382 | #if (MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6)
|
---|
383 | , NPPVpluginWindowlessLocalBool = 2002
|
---|
384 | #endif
|
---|
385 | } NPPVariable;
|
---|
386 |
|
---|
387 | /*
|
---|
388 | * List of variable names for which NPN_GetValue should be implemented.
|
---|
389 | */
|
---|
390 | typedef enum {
|
---|
391 | NPNVxDisplay = 1,
|
---|
392 | NPNVxtAppContext,
|
---|
393 | NPNVnetscapeWindow,
|
---|
394 | NPNVjavascriptEnabledBool,
|
---|
395 | NPNVasdEnabledBool,
|
---|
396 | NPNVisOfflineBool,
|
---|
397 |
|
---|
398 | NPNVserviceManager = (10 | NP_ABI_MASK),
|
---|
399 | NPNVDOMElement = (11 | NP_ABI_MASK),
|
---|
400 | NPNVDOMWindow = (12 | NP_ABI_MASK),
|
---|
401 | NPNVToolkit = (13 | NP_ABI_MASK),
|
---|
402 | NPNVSupportsXEmbedBool = 14,
|
---|
403 |
|
---|
404 | /* Get the NPObject wrapper for the browser window. */
|
---|
405 | NPNVWindowNPObject = 15,
|
---|
406 |
|
---|
407 | /* Get the NPObject wrapper for the plugins DOM element. */
|
---|
408 | NPNVPluginElementNPObject = 16,
|
---|
409 |
|
---|
410 | NPNVSupportsWindowless = 17,
|
---|
411 |
|
---|
412 | NPNVprivateModeBool = 18,
|
---|
413 |
|
---|
414 | NPNVsupportsAdvancedKeyHandling = 21,
|
---|
415 |
|
---|
416 | NPNVdocumentOrigin = 22
|
---|
417 |
|
---|
418 | #if defined(XP_MACOSX)
|
---|
419 | /* Used for negotiating drawing models */
|
---|
420 | , NPNVpluginDrawingModel = 1000
|
---|
421 | #ifndef NP_NO_QUICKDRAW
|
---|
422 | , NPNVsupportsQuickDrawBool = 2000
|
---|
423 | #endif
|
---|
424 | , NPNVsupportsCoreGraphicsBool = 2001
|
---|
425 | , NPNVsupportsOpenGLBool = 2002
|
---|
426 | , NPNVsupportsCoreAnimationBool = 2003
|
---|
427 | , NPNVsupportsInvalidatingCoreAnimationBool = 2004
|
---|
428 | #ifndef NP_NO_CARBON
|
---|
429 | , NPNVsupportsCarbonBool = 3000 /* TRUE if the browser supports the Carbon event model */
|
---|
430 | #endif
|
---|
431 | , NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */
|
---|
432 | , NPNVsupportsUpdatedCocoaTextInputBool = 3002 /* TRUE if the browser supports the updated
|
---|
433 | Cocoa text input specification. */
|
---|
434 | , NPNVsupportsCompositingCoreAnimationPluginsBool = 74656 /* TRUE if the browser supports
|
---|
435 | CA model compositing */
|
---|
436 | #endif
|
---|
437 | #if (MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6)
|
---|
438 | , NPNVSupportsWindowlessLocal = 2002
|
---|
439 | #endif
|
---|
440 | } NPNVariable;
|
---|
441 |
|
---|
442 | typedef enum {
|
---|
443 | NPNURLVCookie = 501,
|
---|
444 | NPNURLVProxy
|
---|
445 | } NPNURLVariable;
|
---|
446 |
|
---|
447 | /*
|
---|
448 | * The type of Toolkit the widgets use
|
---|
449 | */
|
---|
450 | typedef enum {
|
---|
451 | NPNVGtk12 = 1,
|
---|
452 | NPNVGtk2
|
---|
453 | } NPNToolkitType;
|
---|
454 |
|
---|
455 | /*
|
---|
456 | * The type of a NPWindow - it specifies the type of the data structure
|
---|
457 | * returned in the window field.
|
---|
458 | */
|
---|
459 | typedef enum {
|
---|
460 | NPWindowTypeWindow = 1,
|
---|
461 | NPWindowTypeDrawable
|
---|
462 | } NPWindowType;
|
---|
463 |
|
---|
464 | typedef struct _NPWindow
|
---|
465 | {
|
---|
466 | void* window; /* Platform specific window handle */
|
---|
467 | /* OS/2: x - Position of bottom left corner */
|
---|
468 | /* OS/2: y - relative to visible netscape window */
|
---|
469 | int32_t x; /* Position of top left corner relative */
|
---|
470 | int32_t y; /* to a netscape page. */
|
---|
471 | uint32_t width; /* Maximum window size */
|
---|
472 | uint32_t height;
|
---|
473 | NPRect clipRect; /* Clipping rectangle in port coordinates */
|
---|
474 | #if (defined(XP_UNIX) || defined(XP_SYMBIAN)) && !defined(XP_MACOSX)
|
---|
475 | void * ws_info; /* Platform-dependent additional data */
|
---|
476 | #endif /* XP_UNIX */
|
---|
477 | NPWindowType type; /* Is this a window or a drawable? */
|
---|
478 | } NPWindow;
|
---|
479 |
|
---|
480 | typedef struct _NPImageExpose
|
---|
481 | {
|
---|
482 | char* data; /* image pointer */
|
---|
483 | int32_t stride; /* Stride of data image pointer */
|
---|
484 | int32_t depth; /* Depth of image pointer */
|
---|
485 | int32_t x; /* Expose x */
|
---|
486 | int32_t y; /* Expose y */
|
---|
487 | uint32_t width; /* Expose width */
|
---|
488 | uint32_t height; /* Expose height */
|
---|
489 | NPSize dataSize; /* Data buffer size */
|
---|
490 | float translateX; /* translate X matrix value */
|
---|
491 | float translateY; /* translate Y matrix value */
|
---|
492 | float scaleX; /* scale X matrix value */
|
---|
493 | float scaleY; /* scale Y matrix value */
|
---|
494 | } NPImageExpose;
|
---|
495 |
|
---|
496 | typedef struct _NPFullPrint
|
---|
497 | {
|
---|
498 | NPBool pluginPrinted;/* Set TRUE if plugin handled fullscreen printing */
|
---|
499 | NPBool printOne; /* TRUE if plugin should print one copy to default
|
---|
500 | printer */
|
---|
501 | void* platformPrint; /* Platform-specific printing info */
|
---|
502 | } NPFullPrint;
|
---|
503 |
|
---|
504 | typedef struct _NPEmbedPrint
|
---|
505 | {
|
---|
506 | NPWindow window;
|
---|
507 | void* platformPrint; /* Platform-specific printing info */
|
---|
508 | } NPEmbedPrint;
|
---|
509 |
|
---|
510 | typedef struct _NPPrint
|
---|
511 | {
|
---|
512 | uint16_t mode; /* NP_FULL or NP_EMBED */
|
---|
513 | union
|
---|
514 | {
|
---|
515 | NPFullPrint fullPrint; /* if mode is NP_FULL */
|
---|
516 | NPEmbedPrint embedPrint; /* if mode is NP_EMBED */
|
---|
517 | } print;
|
---|
518 | } NPPrint;
|
---|
519 |
|
---|
520 | #if defined(XP_MACOSX)
|
---|
521 | #ifndef NP_NO_CARBON
|
---|
522 | typedef EventRecord NPEvent;
|
---|
523 | #endif
|
---|
524 | #elif defined(XP_SYMBIAN)
|
---|
525 | typedef QEvent NPEvent;
|
---|
526 | #elif defined(XP_WIN)
|
---|
527 | typedef struct _NPEvent
|
---|
528 | {
|
---|
529 | uint16_t event;
|
---|
530 | uintptr_t wParam;
|
---|
531 | uintptr_t lParam;
|
---|
532 | } NPEvent;
|
---|
533 | #elif defined(XP_OS2)
|
---|
534 | typedef struct _NPEvent
|
---|
535 | {
|
---|
536 | uint32_t event;
|
---|
537 | uint32_t wParam;
|
---|
538 | uint32_t lParam;
|
---|
539 | } NPEvent;
|
---|
540 | #elif defined(XP_UNIX) && defined(MOZ_X11)
|
---|
541 | typedef XEvent NPEvent;
|
---|
542 | #else
|
---|
543 | typedef void* NPEvent;
|
---|
544 | #endif
|
---|
545 |
|
---|
546 | #if defined(XP_MACOSX)
|
---|
547 | typedef void* NPRegion;
|
---|
548 | #ifndef NP_NO_QUICKDRAW
|
---|
549 | typedef RgnHandle NPQDRegion;
|
---|
550 | #endif
|
---|
551 | typedef CGPathRef NPCGRegion;
|
---|
552 | #elif defined(XP_WIN)
|
---|
553 | typedef HRGN NPRegion;
|
---|
554 | #elif defined(XP_UNIX) && defined(MOZ_X11)
|
---|
555 | typedef Region NPRegion;
|
---|
556 | #elif defined(XP_SYMBIAN)
|
---|
557 | typedef QRegion* NPRegion;
|
---|
558 | #else
|
---|
559 | typedef void *NPRegion;
|
---|
560 | #endif
|
---|
561 |
|
---|
562 | typedef struct _NPNSString NPNSString;
|
---|
563 | typedef struct _NPNSWindow NPNSWindow;
|
---|
564 | typedef struct _NPNSMenu NPNSMenu;
|
---|
565 |
|
---|
566 | #if defined(XP_MACOSX)
|
---|
567 | typedef NPNSMenu NPMenu;
|
---|
568 | #else
|
---|
569 | typedef void *NPMenu;
|
---|
570 | #endif
|
---|
571 |
|
---|
572 | typedef enum {
|
---|
573 | NPCoordinateSpacePlugin = 1,
|
---|
574 | NPCoordinateSpaceWindow,
|
---|
575 | NPCoordinateSpaceFlippedWindow,
|
---|
576 | NPCoordinateSpaceScreen,
|
---|
577 | NPCoordinateSpaceFlippedScreen
|
---|
578 | } NPCoordinateSpace;
|
---|
579 |
|
---|
580 | #if defined(XP_MACOSX)
|
---|
581 |
|
---|
582 | #ifndef NP_NO_QUICKDRAW
|
---|
583 | typedef struct NP_Port
|
---|
584 | {
|
---|
585 | CGrafPtr port;
|
---|
586 | int32_t portx; /* position inside the topmost window */
|
---|
587 | int32_t porty;
|
---|
588 | } NP_Port;
|
---|
589 | #endif /* NP_NO_QUICKDRAW */
|
---|
590 |
|
---|
591 | /*
|
---|
592 | * NP_CGContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelCoreGraphics
|
---|
593 | * as its drawing model.
|
---|
594 | */
|
---|
595 |
|
---|
596 | typedef struct NP_CGContext
|
---|
597 | {
|
---|
598 | CGContextRef context;
|
---|
599 | void *window; /* A WindowRef under the Carbon event model. */
|
---|
600 | } NP_CGContext;
|
---|
601 |
|
---|
602 | /*
|
---|
603 | * NP_GLContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelOpenGL as its
|
---|
604 | * drawing model.
|
---|
605 | */
|
---|
606 |
|
---|
607 | typedef struct NP_GLContext
|
---|
608 | {
|
---|
609 | CGLContextObj context;
|
---|
610 | #ifdef NP_NO_CARBON
|
---|
611 | NPNSWindow *window;
|
---|
612 | #else
|
---|
613 | void *window; /* Can be either an NSWindow or a WindowRef depending on the event model */
|
---|
614 | #endif
|
---|
615 | } NP_GLContext;
|
---|
616 |
|
---|
617 | typedef enum {
|
---|
618 | NPCocoaEventDrawRect = 1,
|
---|
619 | NPCocoaEventMouseDown,
|
---|
620 | NPCocoaEventMouseUp,
|
---|
621 | NPCocoaEventMouseMoved,
|
---|
622 | NPCocoaEventMouseEntered,
|
---|
623 | NPCocoaEventMouseExited,
|
---|
624 | NPCocoaEventMouseDragged,
|
---|
625 | NPCocoaEventKeyDown,
|
---|
626 | NPCocoaEventKeyUp,
|
---|
627 | NPCocoaEventFlagsChanged,
|
---|
628 | NPCocoaEventFocusChanged,
|
---|
629 | NPCocoaEventWindowFocusChanged,
|
---|
630 | NPCocoaEventScrollWheel,
|
---|
631 | NPCocoaEventTextInput
|
---|
632 | } NPCocoaEventType;
|
---|
633 |
|
---|
634 | typedef struct _NPCocoaEvent {
|
---|
635 | NPCocoaEventType type;
|
---|
636 | uint32_t version;
|
---|
637 | union {
|
---|
638 | struct {
|
---|
639 | uint32_t modifierFlags;
|
---|
640 | double pluginX;
|
---|
641 | double pluginY;
|
---|
642 | int32_t buttonNumber;
|
---|
643 | int32_t clickCount;
|
---|
644 | double deltaX;
|
---|
645 | double deltaY;
|
---|
646 | double deltaZ;
|
---|
647 | } mouse;
|
---|
648 | struct {
|
---|
649 | uint32_t modifierFlags;
|
---|
650 | NPNSString *characters;
|
---|
651 | NPNSString *charactersIgnoringModifiers;
|
---|
652 | NPBool isARepeat;
|
---|
653 | uint16_t keyCode;
|
---|
654 | } key;
|
---|
655 | struct {
|
---|
656 | CGContextRef context;
|
---|
657 | double x;
|
---|
658 | double y;
|
---|
659 | double width;
|
---|
660 | double height;
|
---|
661 | } draw;
|
---|
662 | struct {
|
---|
663 | NPBool hasFocus;
|
---|
664 | } focus;
|
---|
665 | struct {
|
---|
666 | NPNSString *text;
|
---|
667 | } text;
|
---|
668 | } data;
|
---|
669 | } NPCocoaEvent;
|
---|
670 |
|
---|
671 | #ifndef NP_NO_CARBON
|
---|
672 | /* Non-standard event types that can be passed to HandleEvent */
|
---|
673 | enum NPEventType {
|
---|
674 | NPEventType_GetFocusEvent = (osEvt + 16),
|
---|
675 | NPEventType_LoseFocusEvent,
|
---|
676 | NPEventType_AdjustCursorEvent,
|
---|
677 | NPEventType_MenuCommandEvent,
|
---|
678 | NPEventType_ClippingChangedEvent,
|
---|
679 | NPEventType_ScrollingBeginsEvent = 1000,
|
---|
680 | NPEventType_ScrollingEndsEvent
|
---|
681 | };
|
---|
682 | #endif /* NP_NO_CARBON */
|
---|
683 |
|
---|
684 | #endif /* XP_MACOSX */
|
---|
685 |
|
---|
686 | /*
|
---|
687 | * Values for mode passed to NPP_New:
|
---|
688 | */
|
---|
689 | #define NP_EMBED 1
|
---|
690 | #define NP_FULL 2
|
---|
691 |
|
---|
692 | /*
|
---|
693 | * Values for stream type passed to NPP_NewStream:
|
---|
694 | */
|
---|
695 | #define NP_NORMAL 1
|
---|
696 | #define NP_SEEK 2
|
---|
697 | #define NP_ASFILE 3
|
---|
698 | #define NP_ASFILEONLY 4
|
---|
699 |
|
---|
700 | #define NP_MAXREADY (((unsigned)(~0)<<1)>>1)
|
---|
701 |
|
---|
702 | /*
|
---|
703 | * Flags for NPP_ClearSiteData.
|
---|
704 | */
|
---|
705 | #define NP_CLEAR_ALL 0
|
---|
706 | #define NP_CLEAR_CACHE (1 << 0)
|
---|
707 |
|
---|
708 | #if !defined(__LP64__)
|
---|
709 | #if defined(XP_MACOSX)
|
---|
710 | #pragma options align=reset
|
---|
711 | #endif
|
---|
712 | #endif /* __LP64__ */
|
---|
713 |
|
---|
714 | /*----------------------------------------------------------------------*/
|
---|
715 | /* Error and Reason Code definitions */
|
---|
716 | /*----------------------------------------------------------------------*/
|
---|
717 |
|
---|
718 | /*
|
---|
719 | * Values of type NPError:
|
---|
720 | */
|
---|
721 | #define NPERR_BASE 0
|
---|
722 | #define NPERR_NO_ERROR (NPERR_BASE + 0)
|
---|
723 | #define NPERR_GENERIC_ERROR (NPERR_BASE + 1)
|
---|
724 | #define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2)
|
---|
725 | #define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3)
|
---|
726 | #define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4)
|
---|
727 | #define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5)
|
---|
728 | #define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6)
|
---|
729 | #define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7)
|
---|
730 | #define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8)
|
---|
731 | #define NPERR_INVALID_PARAM (NPERR_BASE + 9)
|
---|
732 | #define NPERR_INVALID_URL (NPERR_BASE + 10)
|
---|
733 | #define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11)
|
---|
734 | #define NPERR_NO_DATA (NPERR_BASE + 12)
|
---|
735 | #define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13)
|
---|
736 | #define NPERR_TIME_RANGE_NOT_SUPPORTED (NPERR_BASE + 14)
|
---|
737 | #define NPERR_MALFORMED_SITE (NPERR_BASE + 15)
|
---|
738 |
|
---|
739 | /*
|
---|
740 | * Values of type NPReason:
|
---|
741 | */
|
---|
742 | #define NPRES_BASE 0
|
---|
743 | #define NPRES_DONE (NPRES_BASE + 0)
|
---|
744 | #define NPRES_NETWORK_ERR (NPRES_BASE + 1)
|
---|
745 | #define NPRES_USER_BREAK (NPRES_BASE + 2)
|
---|
746 |
|
---|
747 | /*
|
---|
748 | * Don't use these obsolete error codes any more.
|
---|
749 | */
|
---|
750 | #define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
|
---|
751 | #define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
|
---|
752 | #define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
|
---|
753 |
|
---|
754 | /*
|
---|
755 | * Version feature information
|
---|
756 | */
|
---|
757 | #define NPVERS_HAS_STREAMOUTPUT 8
|
---|
758 | #define NPVERS_HAS_NOTIFICATION 9
|
---|
759 | #define NPVERS_HAS_LIVECONNECT 9
|
---|
760 | #define NPVERS_68K_HAS_LIVECONNECT 11
|
---|
761 | #define NPVERS_HAS_WINDOWLESS 11
|
---|
762 | #define NPVERS_HAS_XPCONNECT_SCRIPTING 13
|
---|
763 | #define NPVERS_HAS_NPRUNTIME_SCRIPTING 14
|
---|
764 | #define NPVERS_HAS_FORM_VALUES 15
|
---|
765 | #define NPVERS_HAS_POPUPS_ENABLED_STATE 16
|
---|
766 | #define NPVERS_HAS_RESPONSE_HEADERS 17
|
---|
767 | #define NPVERS_HAS_NPOBJECT_ENUM 18
|
---|
768 | #define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19
|
---|
769 | #define NPVERS_HAS_ALL_NETWORK_STREAMS 20
|
---|
770 | #define NPVERS_HAS_URL_AND_AUTH_INFO 21
|
---|
771 | #define NPVERS_HAS_PRIVATE_MODE 22
|
---|
772 | #define NPVERS_MACOSX_HAS_COCOA_EVENTS 23
|
---|
773 | #define NPVERS_HAS_ADVANCED_KEY_HANDLING 25
|
---|
774 | #define NPVERS_HAS_URL_REDIRECT_HANDLING 26
|
---|
775 | #define NPVERS_HAS_CLEAR_SITE_DATA 27
|
---|
776 |
|
---|
777 | /*----------------------------------------------------------------------*/
|
---|
778 | /* Function Prototypes */
|
---|
779 | /*----------------------------------------------------------------------*/
|
---|
780 |
|
---|
781 | #if defined(__OS2__)
|
---|
782 | #define NP_LOADDS _System
|
---|
783 | #else
|
---|
784 | #define NP_LOADDS
|
---|
785 | #endif
|
---|
786 |
|
---|
787 | #ifdef __cplusplus
|
---|
788 | extern "C" {
|
---|
789 | #endif
|
---|
790 |
|
---|
791 | /* NPP_* functions are provided by the plugin and called by the navigator. */
|
---|
792 |
|
---|
793 | #if defined(XP_UNIX)
|
---|
794 | const char* NPP_GetMIMEDescription(void);
|
---|
795 | #endif
|
---|
796 |
|
---|
797 | NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance,
|
---|
798 | uint16_t mode, int16_t argc, char* argn[],
|
---|
799 | char* argv[], NPSavedData* saved);
|
---|
800 | NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save);
|
---|
801 | NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window);
|
---|
802 | NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type,
|
---|
803 | NPStream* stream, NPBool seekable,
|
---|
804 | uint16_t* stype);
|
---|
805 | NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream,
|
---|
806 | NPReason reason);
|
---|
807 | int32_t NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream);
|
---|
808 | int32_t NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32_t offset,
|
---|
809 | int32_t len, void* buffer);
|
---|
810 | void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream,
|
---|
811 | const char* fname);
|
---|
812 | void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint);
|
---|
813 | int16_t NP_LOADDS NPP_HandleEvent(NPP instance, void* event);
|
---|
814 | void NP_LOADDS NPP_URLNotify(NPP instance, const char* url,
|
---|
815 | NPReason reason, void* notifyData);
|
---|
816 | NPError NP_LOADDS NPP_GetValue(NPP instance, NPPVariable variable, void *value);
|
---|
817 | NPError NP_LOADDS NPP_SetValue(NPP instance, NPNVariable variable, void *value);
|
---|
818 | NPBool NP_LOADDS NPP_GotFocus(NPP instance, NPFocusDirection direction);
|
---|
819 | void NP_LOADDS NPP_LostFocus(NPP instance);
|
---|
820 | void NP_LOADDS NPP_URLRedirectNotify(NPP instance, const char* url, int32_t status, void* notifyData);
|
---|
821 | NPError NP_LOADDS NPP_ClearSiteData(const char* site, uint64_t flags, uint64_t maxAge);
|
---|
822 | char** NP_LOADDS NPP_GetSitesWithData(void);
|
---|
823 |
|
---|
824 | /* NPN_* functions are provided by the navigator and called by the plugin. */
|
---|
825 | void NP_LOADDS NPN_Version(int* plugin_major, int* plugin_minor,
|
---|
826 | int* netscape_major, int* netscape_minor);
|
---|
827 | NPError NP_LOADDS NPN_GetURLNotify(NPP instance, const char* url,
|
---|
828 | const char* target, void* notifyData);
|
---|
829 | NPError NP_LOADDS NPN_GetURL(NPP instance, const char* url,
|
---|
830 | const char* target);
|
---|
831 | NPError NP_LOADDS NPN_PostURLNotify(NPP instance, const char* url,
|
---|
832 | const char* target, uint32_t len,
|
---|
833 | const char* buf, NPBool file,
|
---|
834 | void* notifyData);
|
---|
835 | NPError NP_LOADDS NPN_PostURL(NPP instance, const char* url,
|
---|
836 | const char* target, uint32_t len,
|
---|
837 | const char* buf, NPBool file);
|
---|
838 | NPError NP_LOADDS NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
|
---|
839 | NPError NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type,
|
---|
840 | const char* target, NPStream** stream);
|
---|
841 | int32_t NP_LOADDS NPN_Write(NPP instance, NPStream* stream, int32_t len,
|
---|
842 | void* buffer);
|
---|
843 | NPError NP_LOADDS NPN_DestroyStream(NPP instance, NPStream* stream,
|
---|
844 | NPReason reason);
|
---|
845 | void NP_LOADDS NPN_Status(NPP instance, const char* message);
|
---|
846 | const char* NP_LOADDS NPN_UserAgent(NPP instance);
|
---|
847 | void* NP_LOADDS NPN_MemAlloc(uint32_t size);
|
---|
848 | void NP_LOADDS NPN_MemFree(void* ptr);
|
---|
849 | uint32_t NP_LOADDS NPN_MemFlush(uint32_t size);
|
---|
850 | void NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages);
|
---|
851 | NPError NP_LOADDS NPN_GetValue(NPP instance, NPNVariable variable,
|
---|
852 | void *value);
|
---|
853 | NPError NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable,
|
---|
854 | void *value);
|
---|
855 | void NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect);
|
---|
856 | void NP_LOADDS NPN_InvalidateRegion(NPP instance,
|
---|
857 | NPRegion invalidRegion);
|
---|
858 | void NP_LOADDS NPN_ForceRedraw(NPP instance);
|
---|
859 | void NP_LOADDS NPN_PushPopupsEnabledState(NPP instance, NPBool enabled);
|
---|
860 | void NP_LOADDS NPN_PopPopupsEnabledState(NPP instance);
|
---|
861 | void NP_LOADDS NPN_PluginThreadAsyncCall(NPP instance,
|
---|
862 | void (*func) (void *),
|
---|
863 | void *userData);
|
---|
864 | NPError NP_LOADDS NPN_GetValueForURL(NPP instance, NPNURLVariable variable,
|
---|
865 | const char *url, char **value,
|
---|
866 | uint32_t *len);
|
---|
867 | NPError NP_LOADDS NPN_SetValueForURL(NPP instance, NPNURLVariable variable,
|
---|
868 | const char *url, const char *value,
|
---|
869 | uint32_t len);
|
---|
870 | NPError NP_LOADDS NPN_GetAuthenticationInfo(NPP instance,
|
---|
871 | const char *protocol,
|
---|
872 | const char *host, int32_t port,
|
---|
873 | const char *scheme,
|
---|
874 | const char *realm,
|
---|
875 | char **username, uint32_t *ulen,
|
---|
876 | char **password,
|
---|
877 | uint32_t *plen);
|
---|
878 | uint32_t NP_LOADDS NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
|
---|
879 | void NP_LOADDS NPN_UnscheduleTimer(NPP instance, uint32_t timerID);
|
---|
880 | NPError NP_LOADDS NPN_PopUpContextMenu(NPP instance, NPMenu* menu);
|
---|
881 | NPBool NP_LOADDS NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
|
---|
882 | NPBool NP_LOADDS NPN_HandleEvent(NPP instance, void *event, NPBool handled);
|
---|
883 | NPBool NP_LOADDS NPN_UnfocusInstance(NPP instance, NPFocusDirection direction);
|
---|
884 | void NP_LOADDS NPN_URLRedirectResponse(NPP instance, void* notifyData, NPBool allow);
|
---|
885 |
|
---|
886 | #ifdef __cplusplus
|
---|
887 | } /* end extern "C" */
|
---|
888 | #endif
|
---|
889 |
|
---|
890 | #endif /* RC_INVOKED */
|
---|
891 | #if defined(__OS2__)
|
---|
892 | #pragma pack()
|
---|
893 | #endif
|
---|
894 |
|
---|
895 | #endif /* npapi_h_ */
|
---|