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