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 | #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 | */ |
---|
388 | typedef 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 | , NPNVsupportsUpdatedCocoaTextInputBool = 3002 /* TRUE if the browser supports the updated |
---|
429 | Cocoa text input specification. */ |
---|
430 | #endif |
---|
431 | #if (MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6) |
---|
432 | , NPNVSupportsWindowlessLocal = 2002 |
---|
433 | #endif |
---|
434 | } NPNVariable; |
---|
435 | |
---|
436 | typedef enum { |
---|
437 | NPNURLVCookie = 501, |
---|
438 | NPNURLVProxy |
---|
439 | } NPNURLVariable; |
---|
440 | |
---|
441 | /* |
---|
442 | * The type of Toolkit the widgets use |
---|
443 | */ |
---|
444 | typedef enum { |
---|
445 | NPNVGtk12 = 1, |
---|
446 | NPNVGtk2 |
---|
447 | } NPNToolkitType; |
---|
448 | |
---|
449 | /* |
---|
450 | * The type of a NPWindow - it specifies the type of the data structure |
---|
451 | * returned in the window field. |
---|
452 | */ |
---|
453 | typedef enum { |
---|
454 | NPWindowTypeWindow = 1, |
---|
455 | NPWindowTypeDrawable |
---|
456 | } NPWindowType; |
---|
457 | |
---|
458 | typedef struct _NPWindow |
---|
459 | { |
---|
460 | void* window; /* Platform specific window handle */ |
---|
461 | /* OS/2: x - Position of bottom left corner */ |
---|
462 | /* OS/2: y - relative to visible netscape window */ |
---|
463 | int32_t x; /* Position of top left corner relative */ |
---|
464 | int32_t y; /* to a netscape page. */ |
---|
465 | uint32_t width; /* Maximum window size */ |
---|
466 | uint32_t height; |
---|
467 | NPRect clipRect; /* Clipping rectangle in port coordinates */ |
---|
468 | #if (defined(XP_UNIX) || defined(XP_SYMBIAN)) && !defined(XP_MACOSX) |
---|
469 | void * ws_info; /* Platform-dependent additional data */ |
---|
470 | #endif /* XP_UNIX */ |
---|
471 | NPWindowType type; /* Is this a window or a drawable? */ |
---|
472 | } NPWindow; |
---|
473 | |
---|
474 | typedef struct _NPImageExpose |
---|
475 | { |
---|
476 | char* data; /* image pointer */ |
---|
477 | int32_t stride; /* Stride of data image pointer */ |
---|
478 | int32_t depth; /* Depth of image pointer */ |
---|
479 | int32_t x; /* Expose x */ |
---|
480 | int32_t y; /* Expose y */ |
---|
481 | uint32_t width; /* Expose width */ |
---|
482 | uint32_t height; /* Expose height */ |
---|
483 | NPSize dataSize; /* Data buffer size */ |
---|
484 | float translateX; /* translate X matrix value */ |
---|
485 | float translateY; /* translate Y matrix value */ |
---|
486 | float scaleX; /* scale X matrix value */ |
---|
487 | float scaleY; /* scale Y matrix value */ |
---|
488 | } NPImageExpose; |
---|
489 | |
---|
490 | typedef struct _NPFullPrint |
---|
491 | { |
---|
492 | NPBool pluginPrinted;/* Set TRUE if plugin handled fullscreen printing */ |
---|
493 | NPBool printOne; /* TRUE if plugin should print one copy to default |
---|
494 | printer */ |
---|
495 | void* platformPrint; /* Platform-specific printing info */ |
---|
496 | } NPFullPrint; |
---|
497 | |
---|
498 | typedef struct _NPEmbedPrint |
---|
499 | { |
---|
500 | NPWindow window; |
---|
501 | void* platformPrint; /* Platform-specific printing info */ |
---|
502 | } NPEmbedPrint; |
---|
503 | |
---|
504 | typedef struct _NPPrint |
---|
505 | { |
---|
506 | uint16_t mode; /* NP_FULL or NP_EMBED */ |
---|
507 | union |
---|
508 | { |
---|
509 | NPFullPrint fullPrint; /* if mode is NP_FULL */ |
---|
510 | NPEmbedPrint embedPrint; /* if mode is NP_EMBED */ |
---|
511 | } print; |
---|
512 | } NPPrint; |
---|
513 | |
---|
514 | #if defined(XP_MACOSX) |
---|
515 | #ifndef NP_NO_CARBON |
---|
516 | typedef EventRecord NPEvent; |
---|
517 | #endif |
---|
518 | #elif defined(XP_SYMBIAN) |
---|
519 | typedef QEvent NPEvent; |
---|
520 | #elif defined(XP_WIN) |
---|
521 | typedef struct _NPEvent |
---|
522 | { |
---|
523 | uint16_t event; |
---|
524 | uintptr_t wParam; |
---|
525 | uintptr_t lParam; |
---|
526 | } NPEvent; |
---|
527 | #elif defined(XP_OS2) |
---|
528 | typedef struct _NPEvent |
---|
529 | { |
---|
530 | uint32_t event; |
---|
531 | uint32_t wParam; |
---|
532 | uint32_t lParam; |
---|
533 | } NPEvent; |
---|
534 | #elif defined(XP_UNIX) && defined(MOZ_X11) |
---|
535 | typedef XEvent NPEvent; |
---|
536 | #else |
---|
537 | typedef void* NPEvent; |
---|
538 | #endif |
---|
539 | |
---|
540 | #if defined(XP_MACOSX) |
---|
541 | typedef void* NPRegion; |
---|
542 | #ifndef NP_NO_QUICKDRAW |
---|
543 | typedef RgnHandle NPQDRegion; |
---|
544 | #endif |
---|
545 | typedef CGPathRef NPCGRegion; |
---|
546 | #elif defined(XP_WIN) |
---|
547 | typedef HRGN NPRegion; |
---|
548 | #elif defined(XP_UNIX) && defined(MOZ_X11) |
---|
549 | typedef Region NPRegion; |
---|
550 | #elif defined(XP_SYMBIAN) |
---|
551 | typedef QRegion* NPRegion; |
---|
552 | #else |
---|
553 | typedef void *NPRegion; |
---|
554 | #endif |
---|
555 | |
---|
556 | typedef struct _NPNSString NPNSString; |
---|
557 | typedef struct _NPNSWindow NPNSWindow; |
---|
558 | typedef struct _NPNSMenu NPNSMenu; |
---|
559 | |
---|
560 | #if defined(XP_MACOSX) |
---|
561 | typedef NPNSMenu NPMenu; |
---|
562 | #else |
---|
563 | typedef void *NPMenu; |
---|
564 | #endif |
---|
565 | |
---|
566 | typedef enum { |
---|
567 | NPCoordinateSpacePlugin = 1, |
---|
568 | NPCoordinateSpaceWindow, |
---|
569 | NPCoordinateSpaceFlippedWindow, |
---|
570 | NPCoordinateSpaceScreen, |
---|
571 | NPCoordinateSpaceFlippedScreen |
---|
572 | } NPCoordinateSpace; |
---|
573 | |
---|
574 | #if defined(XP_MACOSX) |
---|
575 | |
---|
576 | #ifndef NP_NO_QUICKDRAW |
---|
577 | typedef struct NP_Port |
---|
578 | { |
---|
579 | CGrafPtr port; |
---|
580 | int32_t portx; /* position inside the topmost window */ |
---|
581 | int32_t porty; |
---|
582 | } NP_Port; |
---|
583 | #endif /* NP_NO_QUICKDRAW */ |
---|
584 | |
---|
585 | /* |
---|
586 | * NP_CGContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelCoreGraphics |
---|
587 | * as its drawing model. |
---|
588 | */ |
---|
589 | |
---|
590 | typedef struct NP_CGContext |
---|
591 | { |
---|
592 | CGContextRef context; |
---|
593 | void *window; /* A WindowRef under the Carbon event model. */ |
---|
594 | } NP_CGContext; |
---|
595 | |
---|
596 | /* |
---|
597 | * NP_GLContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelOpenGL as its |
---|
598 | * drawing model. |
---|
599 | */ |
---|
600 | |
---|
601 | typedef struct NP_GLContext |
---|
602 | { |
---|
603 | CGLContextObj context; |
---|
604 | #ifdef NP_NO_CARBON |
---|
605 | NPNSWindow *window; |
---|
606 | #else |
---|
607 | void *window; /* Can be either an NSWindow or a WindowRef depending on the event model */ |
---|
608 | #endif |
---|
609 | } NP_GLContext; |
---|
610 | |
---|
611 | typedef enum { |
---|
612 | NPCocoaEventDrawRect = 1, |
---|
613 | NPCocoaEventMouseDown, |
---|
614 | NPCocoaEventMouseUp, |
---|
615 | NPCocoaEventMouseMoved, |
---|
616 | NPCocoaEventMouseEntered, |
---|
617 | NPCocoaEventMouseExited, |
---|
618 | NPCocoaEventMouseDragged, |
---|
619 | NPCocoaEventKeyDown, |
---|
620 | NPCocoaEventKeyUp, |
---|
621 | NPCocoaEventFlagsChanged, |
---|
622 | NPCocoaEventFocusChanged, |
---|
623 | NPCocoaEventWindowFocusChanged, |
---|
624 | NPCocoaEventScrollWheel, |
---|
625 | NPCocoaEventTextInput |
---|
626 | } NPCocoaEventType; |
---|
627 | |
---|
628 | typedef struct _NPCocoaEvent { |
---|
629 | NPCocoaEventType type; |
---|
630 | uint32_t version; |
---|
631 | union { |
---|
632 | struct { |
---|
633 | uint32_t modifierFlags; |
---|
634 | double pluginX; |
---|
635 | double pluginY; |
---|
636 | int32_t buttonNumber; |
---|
637 | int32_t clickCount; |
---|
638 | double deltaX; |
---|
639 | double deltaY; |
---|
640 | double deltaZ; |
---|
641 | } mouse; |
---|
642 | struct { |
---|
643 | uint32_t modifierFlags; |
---|
644 | NPNSString *characters; |
---|
645 | NPNSString *charactersIgnoringModifiers; |
---|
646 | NPBool isARepeat; |
---|
647 | uint16_t keyCode; |
---|
648 | } key; |
---|
649 | struct { |
---|
650 | CGContextRef context; |
---|
651 | double x; |
---|
652 | double y; |
---|
653 | double width; |
---|
654 | double height; |
---|
655 | } draw; |
---|
656 | struct { |
---|
657 | NPBool hasFocus; |
---|
658 | } focus; |
---|
659 | struct { |
---|
660 | NPNSString *text; |
---|
661 | } text; |
---|
662 | } data; |
---|
663 | } NPCocoaEvent; |
---|
664 | |
---|
665 | #ifndef NP_NO_CARBON |
---|
666 | /* Non-standard event types that can be passed to HandleEvent */ |
---|
667 | enum NPEventType { |
---|
668 | NPEventType_GetFocusEvent = (osEvt + 16), |
---|
669 | NPEventType_LoseFocusEvent, |
---|
670 | NPEventType_AdjustCursorEvent, |
---|
671 | NPEventType_MenuCommandEvent, |
---|
672 | NPEventType_ClippingChangedEvent, |
---|
673 | NPEventType_ScrollingBeginsEvent = 1000, |
---|
674 | NPEventType_ScrollingEndsEvent |
---|
675 | }; |
---|
676 | #endif /* NP_NO_CARBON */ |
---|
677 | |
---|
678 | #endif /* XP_MACOSX */ |
---|
679 | |
---|
680 | /* |
---|
681 | * Values for mode passed to NPP_New: |
---|
682 | */ |
---|
683 | #define NP_EMBED 1 |
---|
684 | #define NP_FULL 2 |
---|
685 | |
---|
686 | /* |
---|
687 | * Values for stream type passed to NPP_NewStream: |
---|
688 | */ |
---|
689 | #define NP_NORMAL 1 |
---|
690 | #define NP_SEEK 2 |
---|
691 | #define NP_ASFILE 3 |
---|
692 | #define NP_ASFILEONLY 4 |
---|
693 | |
---|
694 | #define NP_MAXREADY (((unsigned)(~0)<<1)>>1) |
---|
695 | |
---|
696 | /* |
---|
697 | * Flags for NPP_ClearSiteData. |
---|
698 | */ |
---|
699 | #define NP_CLEAR_ALL 0 |
---|
700 | #define NP_CLEAR_CACHE (1 << 0) |
---|
701 | |
---|
702 | #if !defined(__LP64__) |
---|
703 | #if defined(XP_MACOSX) |
---|
704 | #pragma options align=reset |
---|
705 | #endif |
---|
706 | #endif /* __LP64__ */ |
---|
707 | |
---|
708 | /*----------------------------------------------------------------------*/ |
---|
709 | /* Error and Reason Code definitions */ |
---|
710 | /*----------------------------------------------------------------------*/ |
---|
711 | |
---|
712 | /* |
---|
713 | * Values of type NPError: |
---|
714 | */ |
---|
715 | #define NPERR_BASE 0 |
---|
716 | #define NPERR_NO_ERROR (NPERR_BASE + 0) |
---|
717 | #define NPERR_GENERIC_ERROR (NPERR_BASE + 1) |
---|
718 | #define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2) |
---|
719 | #define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3) |
---|
720 | #define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4) |
---|
721 | #define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5) |
---|
722 | #define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6) |
---|
723 | #define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7) |
---|
724 | #define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8) |
---|
725 | #define NPERR_INVALID_PARAM (NPERR_BASE + 9) |
---|
726 | #define NPERR_INVALID_URL (NPERR_BASE + 10) |
---|
727 | #define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11) |
---|
728 | #define NPERR_NO_DATA (NPERR_BASE + 12) |
---|
729 | #define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13) |
---|
730 | #define NPERR_TIME_RANGE_NOT_SUPPORTED (NPERR_BASE + 14) |
---|
731 | #define NPERR_MALFORMED_SITE (NPERR_BASE + 15) |
---|
732 | |
---|
733 | /* |
---|
734 | * Values of type NPReason: |
---|
735 | */ |
---|
736 | #define NPRES_BASE 0 |
---|
737 | #define NPRES_DONE (NPRES_BASE + 0) |
---|
738 | #define NPRES_NETWORK_ERR (NPRES_BASE + 1) |
---|
739 | #define NPRES_USER_BREAK (NPRES_BASE + 2) |
---|
740 | |
---|
741 | /* |
---|
742 | * Don't use these obsolete error codes any more. |
---|
743 | */ |
---|
744 | #define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR |
---|
745 | #define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR |
---|
746 | #define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK |
---|
747 | |
---|
748 | /* |
---|
749 | * Version feature information |
---|
750 | */ |
---|
751 | #define NPVERS_HAS_STREAMOUTPUT 8 |
---|
752 | #define NPVERS_HAS_NOTIFICATION 9 |
---|
753 | #define NPVERS_HAS_LIVECONNECT 9 |
---|
754 | #define NPVERS_68K_HAS_LIVECONNECT 11 |
---|
755 | #define NPVERS_HAS_WINDOWLESS 11 |
---|
756 | #define NPVERS_HAS_XPCONNECT_SCRIPTING 13 |
---|
757 | #define NPVERS_HAS_NPRUNTIME_SCRIPTING 14 |
---|
758 | #define NPVERS_HAS_FORM_VALUES 15 |
---|
759 | #define NPVERS_HAS_POPUPS_ENABLED_STATE 16 |
---|
760 | #define NPVERS_HAS_RESPONSE_HEADERS 17 |
---|
761 | #define NPVERS_HAS_NPOBJECT_ENUM 18 |
---|
762 | #define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19 |
---|
763 | #define NPVERS_HAS_ALL_NETWORK_STREAMS 20 |
---|
764 | #define NPVERS_HAS_URL_AND_AUTH_INFO 21 |
---|
765 | #define NPVERS_HAS_PRIVATE_MODE 22 |
---|
766 | #define NPVERS_MACOSX_HAS_COCOA_EVENTS 23 |
---|
767 | #define NPVERS_HAS_ADVANCED_KEY_HANDLING 25 |
---|
768 | #define NPVERS_HAS_URL_REDIRECT_HANDLING 26 |
---|
769 | #define NPVERS_HAS_CLEAR_SITE_DATA 27 |
---|
770 | |
---|
771 | /*----------------------------------------------------------------------*/ |
---|
772 | /* Function Prototypes */ |
---|
773 | /*----------------------------------------------------------------------*/ |
---|
774 | |
---|
775 | #if defined(__OS2__) |
---|
776 | #define NP_LOADDS _System |
---|
777 | #else |
---|
778 | #define NP_LOADDS |
---|
779 | #endif |
---|
780 | |
---|
781 | #ifdef __cplusplus |
---|
782 | extern "C" { |
---|
783 | #endif |
---|
784 | |
---|
785 | /* NPP_* functions are provided by the plugin and called by the navigator. */ |
---|
786 | |
---|
787 | #if defined(XP_UNIX) |
---|
788 | const char* NPP_GetMIMEDescription(void); |
---|
789 | #endif |
---|
790 | |
---|
791 | NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, |
---|
792 | uint16_t mode, int16_t argc, char* argn[], |
---|
793 | char* argv[], NPSavedData* saved); |
---|
794 | NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save); |
---|
795 | NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window); |
---|
796 | NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type, |
---|
797 | NPStream* stream, NPBool seekable, |
---|
798 | uint16_t* stype); |
---|
799 | NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream, |
---|
800 | NPReason reason); |
---|
801 | int32_t NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream); |
---|
802 | int32_t NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32_t offset, |
---|
803 | int32_t len, void* buffer); |
---|
804 | void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream, |
---|
805 | const char* fname); |
---|
806 | void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint); |
---|
807 | int16_t NP_LOADDS NPP_HandleEvent(NPP instance, void* event); |
---|
808 | void NP_LOADDS NPP_URLNotify(NPP instance, const char* url, |
---|
809 | NPReason reason, void* notifyData); |
---|
810 | NPError NP_LOADDS NPP_GetValue(NPP instance, NPPVariable variable, void *value); |
---|
811 | NPError NP_LOADDS NPP_SetValue(NPP instance, NPNVariable variable, void *value); |
---|
812 | NPBool NP_LOADDS NPP_GotFocus(NPP instance, NPFocusDirection direction); |
---|
813 | void NP_LOADDS NPP_LostFocus(NPP instance); |
---|
814 | void NP_LOADDS NPP_URLRedirectNotify(NPP instance, const char* url, int32_t status, void* notifyData); |
---|
815 | NPError NP_LOADDS NPP_ClearSiteData(const char* site, uint64_t flags, uint64_t maxAge); |
---|
816 | char** NP_LOADDS NPP_GetSitesWithData(void); |
---|
817 | |
---|
818 | /* NPN_* functions are provided by the navigator and called by the plugin. */ |
---|
819 | void NP_LOADDS NPN_Version(int* plugin_major, int* plugin_minor, |
---|
820 | int* netscape_major, int* netscape_minor); |
---|
821 | NPError NP_LOADDS NPN_GetURLNotify(NPP instance, const char* url, |
---|
822 | const char* target, void* notifyData); |
---|
823 | NPError NP_LOADDS NPN_GetURL(NPP instance, const char* url, |
---|
824 | const char* target); |
---|
825 | NPError NP_LOADDS NPN_PostURLNotify(NPP instance, const char* url, |
---|
826 | const char* target, uint32_t len, |
---|
827 | const char* buf, NPBool file, |
---|
828 | void* notifyData); |
---|
829 | NPError NP_LOADDS NPN_PostURL(NPP instance, const char* url, |
---|
830 | const char* target, uint32_t len, |
---|
831 | const char* buf, NPBool file); |
---|
832 | NPError NP_LOADDS NPN_RequestRead(NPStream* stream, NPByteRange* rangeList); |
---|
833 | NPError NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type, |
---|
834 | const char* target, NPStream** stream); |
---|
835 | int32_t NP_LOADDS NPN_Write(NPP instance, NPStream* stream, int32_t len, |
---|
836 | void* buffer); |
---|
837 | NPError NP_LOADDS NPN_DestroyStream(NPP instance, NPStream* stream, |
---|
838 | NPReason reason); |
---|
839 | void NP_LOADDS NPN_Status(NPP instance, const char* message); |
---|
840 | const char* NP_LOADDS NPN_UserAgent(NPP instance); |
---|
841 | void* NP_LOADDS NPN_MemAlloc(uint32_t size); |
---|
842 | void NP_LOADDS NPN_MemFree(void* ptr); |
---|
843 | uint32_t NP_LOADDS NPN_MemFlush(uint32_t size); |
---|
844 | void NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages); |
---|
845 | NPError NP_LOADDS NPN_GetValue(NPP instance, NPNVariable variable, |
---|
846 | void *value); |
---|
847 | NPError NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable, |
---|
848 | void *value); |
---|
849 | void NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect); |
---|
850 | void NP_LOADDS NPN_InvalidateRegion(NPP instance, |
---|
851 | NPRegion invalidRegion); |
---|
852 | void NP_LOADDS NPN_ForceRedraw(NPP instance); |
---|
853 | void NP_LOADDS NPN_PushPopupsEnabledState(NPP instance, NPBool enabled); |
---|
854 | void NP_LOADDS NPN_PopPopupsEnabledState(NPP instance); |
---|
855 | void NP_LOADDS NPN_PluginThreadAsyncCall(NPP instance, |
---|
856 | void (*func) (void *), |
---|
857 | void *userData); |
---|
858 | NPError NP_LOADDS NPN_GetValueForURL(NPP instance, NPNURLVariable variable, |
---|
859 | const char *url, char **value, |
---|
860 | uint32_t *len); |
---|
861 | NPError NP_LOADDS NPN_SetValueForURL(NPP instance, NPNURLVariable variable, |
---|
862 | const char *url, const char *value, |
---|
863 | uint32_t len); |
---|
864 | NPError NP_LOADDS NPN_GetAuthenticationInfo(NPP instance, |
---|
865 | const char *protocol, |
---|
866 | const char *host, int32_t port, |
---|
867 | const char *scheme, |
---|
868 | const char *realm, |
---|
869 | char **username, uint32_t *ulen, |
---|
870 | char **password, |
---|
871 | uint32_t *plen); |
---|
872 | uint32_t NP_LOADDS NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID)); |
---|
873 | void NP_LOADDS NPN_UnscheduleTimer(NPP instance, uint32_t timerID); |
---|
874 | NPError NP_LOADDS NPN_PopUpContextMenu(NPP instance, NPMenu* menu); |
---|
875 | NPBool NP_LOADDS NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace); |
---|
876 | NPBool NP_LOADDS NPN_HandleEvent(NPP instance, void *event, NPBool handled); |
---|
877 | NPBool NP_LOADDS NPN_UnfocusInstance(NPP instance, NPFocusDirection direction); |
---|
878 | void NP_LOADDS NPN_URLRedirectResponse(NPP instance, void* notifyData, NPBool allow); |
---|
879 | |
---|
880 | #ifdef __cplusplus |
---|
881 | } /* end extern "C" */ |
---|
882 | #endif |
---|
883 | |
---|
884 | #endif /* RC_INVOKED */ |
---|
885 | #if defined(__OS2__) |
---|
886 | #pragma pack() |
---|
887 | #endif |
---|
888 | |
---|
889 | #endif /* npapi_h_ */ |
---|