OLD | NEW |
1 /* Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 */ | 4 */ |
5 | 5 |
6 #ifndef _NP_EXTENSIONS_H_ | 6 #ifndef _NP_EXTENSIONS_H_ |
7 #define _NP_EXTENSIONS_H_ | 7 #define _NP_EXTENSIONS_H_ |
8 | 8 |
9 // Use the shorter include path here so that this file can be used in non- | 9 // Use the shorter include path here so that this file can be used in non- |
10 // Chromium projects, such as the Native Client SDK. | 10 // Chromium projects, such as the Native Client SDK. |
11 #include "npapi.h" | 11 #include "npapi.h" |
12 | 12 |
13 /* | 13 /* |
14 * A fake "enum" value for getting browser-implemented Pepper extensions. | 14 * A fake "enum" value for getting browser-implemented Pepper extensions. |
15 * The variable returns a pointer to an NPPepperExtensions structure | 15 * The variable returns a pointer to an NPNExtensions structure. */ |
16 */ | |
17 #define NPNVPepperExtensions ((NPNVariable) 4000) | 16 #define NPNVPepperExtensions ((NPNVariable) 4000) |
18 | 17 |
19 /* | 18 /* |
20 * A fake "enum" value for getting plugin-implemented Pepper extensions. | 19 * A fake "enum" value for getting plugin-implemented Pepper extensions. |
21 * The variable returns a pointer to an NPPPepperExtensions structure | 20 * The variable returns a pointer to an NPPExtensions structure. */ |
22 */ | |
23 #define NPPVPepperExtensions ((NPPVariable) 4001) | 21 #define NPPVPepperExtensions ((NPPVariable) 4001) |
24 | 22 |
25 typedef void NPDeviceConfig; | 23 typedef void NPDeviceConfig; |
26 typedef void NPDeviceContext; | 24 typedef void NPDeviceContext; |
27 typedef void NPUserData; | 25 typedef void NPUserData; |
28 | 26 |
29 /* unique id for each device interface */ | 27 /* unique id for each device interface */ |
30 typedef int32 NPDeviceID; | 28 typedef int32 NPDeviceID; |
31 | 29 |
32 typedef struct _NPPoint { | 30 typedef struct _NPPoint { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 int* height); | 144 int* height); |
147 /* Draw a themed item (i.e. scrollbar arrow). */ | 145 /* Draw a themed item (i.e. scrollbar arrow). */ |
148 typedef NPError (*NPDeviceThemePaint)( | 146 typedef NPError (*NPDeviceThemePaint)( |
149 NPP instance, | 147 NPP instance, |
150 NPDeviceContext* context, | 148 NPDeviceContext* context, |
151 NPThemeParams* params); | 149 NPThemeParams* params); |
152 | 150 |
153 | 151 |
154 /* forward decl typdef structs */ | 152 /* forward decl typdef structs */ |
155 typedef struct NPDevice NPDevice; | 153 typedef struct NPDevice NPDevice; |
156 typedef struct NPExtensions NPExtensions; | 154 typedef struct NPNExtensions NPNExtensions; |
| 155 |
| 156 // DEPRECATED: this typedef is just for the NaCl code until they switch to NPNEx
tensions. |
| 157 // PLEASE REMOVE THIS WHEN THE NACL CODE IS UPDATED. |
| 158 typedef struct NPNExtensions NPExtensions; |
157 | 159 |
158 /* generic device interface */ | 160 /* generic device interface */ |
159 struct NPDevice { | 161 struct NPDevice { |
160 NPDeviceQueryCapabilityPtr queryCapability; | 162 NPDeviceQueryCapabilityPtr queryCapability; |
161 NPDeviceQueryConfigPtr queryConfig; | 163 NPDeviceQueryConfigPtr queryConfig; |
162 NPDeviceInitializeContextPtr initializeContext; | 164 NPDeviceInitializeContextPtr initializeContext; |
163 NPDeviceSetStateContextPtr setStateContext; | 165 NPDeviceSetStateContextPtr setStateContext; |
164 NPDeviceGetStateContextPtr getStateContext; | 166 NPDeviceGetStateContextPtr getStateContext; |
165 NPDeviceFlushContextPtr flushContext; | 167 NPDeviceFlushContextPtr flushContext; |
166 NPDeviceDestroyContextPtr destroyContext; | 168 NPDeviceDestroyContextPtr destroyContext; |
167 NPDeviceCreateBufferPtr createBuffer; | 169 NPDeviceCreateBufferPtr createBuffer; |
168 NPDeviceDestroyBufferPtr destroyBuffer; | 170 NPDeviceDestroyBufferPtr destroyBuffer; |
169 NPDeviceMapBufferPtr mapBuffer; | 171 NPDeviceMapBufferPtr mapBuffer; |
170 NPDeviceThemeGetSize themeGetSize; | 172 NPDeviceThemeGetSize themeGetSize; |
171 NPDeviceThemePaint themePaint; | 173 NPDeviceThemePaint themePaint; |
172 }; | 174 }; |
173 | 175 |
174 /* returns NULL if deviceID unavailable / unrecognized */ | 176 /* returns NULL if deviceID unavailable / unrecognized */ |
175 typedef NPDevice* (*NPAcquireDevicePtr)( | 177 typedef NPDevice* (*NPAcquireDevicePtr)( |
176 NPP instance, | 178 NPP instance, |
177 NPDeviceID device); | 179 NPDeviceID device); |
178 | 180 |
179 /* Copy UTF-8 string into clipboard */ | 181 /* Copy UTF-8 string into clipboard */ |
180 typedef void (*NPCopyTextToClipboardPtr)( | 182 typedef void (*NPCopyTextToClipboardPtr)( |
181 NPP instance, | 183 NPP instance, |
182 const char* content); | 184 const char* content); |
183 | 185 |
| 186 /* Updates the number of find results for the current search term. If |
| 187 * there are no matches 0 should be passed in. Only when the plugin has |
| 188 * finished searching should it pass in the final count with finalResult set to |
| 189 * true. */ |
| 190 typedef void (*NPNumberOfFindResultsChangedPtr)( |
| 191 NPP instance, |
| 192 int total, |
| 193 bool finalResult); |
| 194 |
| 195 /* Updates the index of the currently selected search item. */ |
| 196 typedef void (*NPSelectedFindResultChangedPtr)( |
| 197 NPP instance, |
| 198 int index); |
| 199 |
184 /* Pepper extensions */ | 200 /* Pepper extensions */ |
185 struct NPExtensions { | 201 struct NPNExtensions { |
186 /* Device interface acquisition */ | 202 /* Device interface acquisition */ |
187 NPAcquireDevicePtr acquireDevice; | 203 NPAcquireDevicePtr acquireDevice; |
188 /* Clipboard functionality */ | 204 /* Clipboard functionality */ |
189 NPCopyTextToClipboardPtr copyTextToClipboard; | 205 NPCopyTextToClipboardPtr copyTextToClipboard; |
| 206 /* Find */ |
| 207 NPNumberOfFindResultsChangedPtr numberOfFindResultsChanged; |
| 208 NPSelectedFindResultChangedPtr selectedFindResultChanged; |
190 }; | 209 }; |
191 | 210 |
192 /* Events -------------------------------------------------------------------*/ | 211 /* Events -------------------------------------------------------------------*/ |
193 | 212 |
194 typedef enum { | 213 typedef enum { |
195 NPMouseButton_None = -1, | 214 NPMouseButton_None = -1, |
196 NPMouseButton_Left = 0, | 215 NPMouseButton_Left = 0, |
197 NPMouseButton_Middle = 1, | 216 NPMouseButton_Middle = 1, |
198 NPMouseButton_Right = 2 | 217 NPMouseButton_Right = 2 |
199 } NPMouseButtons; | 218 } NPMouseButtons; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 | 310 |
292 /* 2D -----------------------------------------------------------------------*/ | 311 /* 2D -----------------------------------------------------------------------*/ |
293 | 312 |
294 #define NPPepper2DDevice 1 | 313 #define NPPepper2DDevice 1 |
295 | 314 |
296 typedef struct _NPDeviceContext2DConfig { | 315 typedef struct _NPDeviceContext2DConfig { |
297 } NPDeviceContext2DConfig; | 316 } NPDeviceContext2DConfig; |
298 | 317 |
299 typedef struct _NPDeviceContext2D | 318 typedef struct _NPDeviceContext2D |
300 { | 319 { |
301 /* Internal value used by the browser to identify this device. | 320 /* Internal value used by the browser to identify this device. */ |
302 */ | |
303 void* reserved; | 321 void* reserved; |
304 | 322 |
305 /* A pointer to the pixel data. This data is 8-bit values in BGRA order in | 323 /* A pointer to the pixel data. This data is 8-bit values in BGRA order in |
306 * memory. Each row will start |stride| bytes after the previous one. | 324 * memory. Each row will start |stride| bytes after the previous one. |
307 * | 325 * |
308 * THIS DATA USES PREMULTIPLIED ALPHA. This means that each color channel has | 326 * THIS DATA USES PREMULTIPLIED ALPHA. This means that each color channel has |
309 * been multiplied with the corresponding alpha, which makes compositing | 327 * been multiplied with the corresponding alpha, which makes compositing |
310 * easier. If any color channels have a value greater than the alpha value, | 328 * easier. If any color channels have a value greater than the alpha value, |
311 * you'll likely get crazy colors and weird artifacts. | 329 * you'll likely get crazy colors and weird artifacts. */ |
312 */ | |
313 void* region; | 330 void* region; |
314 | 331 |
315 /* Length of each row of pixels in bytes. This may be larger than width * 4 | 332 /* Length of each row of pixels in bytes. This may be larger than width * 4 |
316 * if there is padding at the end of each row to help with alignment. | 333 * if there is padding at the end of each row to help with alignment. */ |
317 */ | |
318 int32 stride; | 334 int32 stride; |
319 | 335 |
320 /* The dirty region that the plugin has painted into the buffer. This | 336 /* The dirty region that the plugin has painted into the buffer. This |
321 * will be initialized to the size of the plugin image in | 337 * will be initialized to the size of the plugin image in |
322 * initializeContextPtr. The plugin can change the values to only | 338 * initializeContextPtr. The plugin can change the values to only |
323 * update portions of the image. | 339 * update portions of the image. */ |
324 */ | |
325 struct { | 340 struct { |
326 int32 left; | 341 int32 left; |
327 int32 top; | 342 int32 top; |
328 int32 right; | 343 int32 right; |
329 int32 bottom; | 344 int32 bottom; |
330 } dirty; | 345 } dirty; |
331 } NPDeviceContext2D; | 346 } NPDeviceContext2D; |
332 | 347 |
333 /* 3D -----------------------------------------------------------------------*/ | 348 /* 3D -----------------------------------------------------------------------*/ |
334 | 349 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 void *inBuffer; | 502 void *inBuffer; |
488 void *reserved; | 503 void *reserved; |
489 }; | 504 }; |
490 | 505 |
491 /* Printing related APIs ---------------------------------------------------*/ | 506 /* Printing related APIs ---------------------------------------------------*/ |
492 | 507 |
493 /* Being a print operation. Returns the total number of pages to print at the | 508 /* Being a print operation. Returns the total number of pages to print at the |
494 * given printableArea size and DPI. printableArea is in points (a point is 1/72 | 509 * given printableArea size and DPI. printableArea is in points (a point is 1/72 |
495 * of an inch). The plugin is expected to remember the values of printableArea | 510 * of an inch). The plugin is expected to remember the values of printableArea |
496 * and printerDPI for use in subsequent print interface calls. These values | 511 * and printerDPI for use in subsequent print interface calls. These values |
497 * should be cleared in printEnd*/ | 512 * should be cleared in printEnd. */ |
498 typedef NPError (*NPPPrintBeginPtr) ( | 513 typedef NPError (*NPPPrintBeginPtr) ( |
499 NPP instance, | 514 NPP instance, |
500 NPRect* printableArea, | 515 NPRect* printableArea, |
501 int32 printerDPI, | 516 int32 printerDPI, |
502 int32* numPages); | 517 int32* numPages); |
503 /* Returns the required raster dimensions for the given page. */ | 518 /* Returns the required raster dimensions for the given page. */ |
504 typedef NPError (*NPPGetRasterDimensionsPtr) ( | 519 typedef NPError (*NPPGetRasterDimensionsPtr) ( |
505 NPP instance, | 520 NPP instance, |
506 int32 pageNumber, | 521 int32 pageNumber, |
507 int32* widthInPixels, | 522 int32* widthInPixels, |
508 int32* heightInPixels); | 523 int32* heightInPixels); |
509 /* Prints the specified page This allows the plugin to print a raster output. */ | 524 /* Prints the specified page This allows the plugin to print a raster output. */ |
510 typedef NPError (*NPPPrintPageRasterPtr) ( | 525 typedef NPError (*NPPPrintPageRasterPtr) ( |
511 NPP instance, | 526 NPP instance, |
512 int32 pageNumber, | 527 int32 pageNumber, |
513 NPDeviceContext2D* printSurface); | 528 NPDeviceContext2D* printSurface); |
514 /* Ends the print operation */ | 529 /* Ends the print operation */ |
515 typedef NPError (*NPPPrintEndPtr) (NPP instance); | 530 typedef NPError (*NPPPrintEndPtr) (NPP instance); |
516 | 531 |
517 /* TODO(sanjeevr) : Provide a vector interface for printing. We need to decide | 532 /* TODO(sanjeevr) : Provide a vector interface for printing. We need to decide |
518 * on a vector format that can support embedded fonts. A vector format will | 533 * on a vector format that can support embedded fonts. A vector format will |
519 * greatly reduce the size of the required output buffer | 534 * greatly reduce the size of the required output buffer. */ |
520 */ | |
521 | 535 |
522 typedef struct _NPPPrintExtensions { | 536 typedef struct _NPPPrintExtensions { |
523 NPPPrintBeginPtr printBegin; | 537 NPPPrintBeginPtr printBegin; |
524 NPPGetRasterDimensionsPtr getRasterDimensions; | 538 NPPGetRasterDimensionsPtr getRasterDimensions; |
525 NPPPrintPageRasterPtr printPageRaster; | 539 NPPPrintPageRasterPtr printPageRaster; |
526 NPPPrintEndPtr printEnd; | 540 NPPPrintEndPtr printEnd; |
527 } NPPPrintExtensions; | 541 } NPPPrintExtensions; |
528 | 542 |
529 /* Returns NULL if the plugin does not support print extensions */ | 543 /* Returns NULL if the plugin does not support print extensions */ |
530 typedef NPPPrintExtensions* (*NPPGetPrintExtensionsPtr)(NPP instance); | 544 typedef NPPPrintExtensions* (*NPPGetPrintExtensionsPtr)(NPP instance); |
531 | 545 |
| 546 /* Find ---------------------------------------------------------------------*/ |
| 547 |
| 548 /* Finds the given UTF-8 text starting at the current selection. The number of |
| 549 * results will be updated asynchronously via numberOfFindResultsChanged. Note |
| 550 * that multiple StartFind calls can happen before StopFind is called in the |
| 551 * case of the search term changing. */ |
| 552 typedef NPError (*NPPStartFindPtr) ( |
| 553 NPP instance, |
| 554 const char* text, |
| 555 bool caseSensitive); |
| 556 |
| 557 /* Go to the next/previous result. */ |
| 558 typedef NPError (*NPPSelectFindResultPtr) ( |
| 559 NPP instance, |
| 560 bool forward); |
| 561 |
| 562 /* Tells the plugin that the find operation has stopped, so it should clear |
| 563 * any highlighting. */ |
| 564 typedef NPError (*NPPStopFindPtr) ( |
| 565 NPP instance); |
| 566 |
| 567 typedef struct _NPPFindExtensions { |
| 568 NPPStartFindPtr startFind; |
| 569 NPPSelectFindResultPtr selectFindResult; |
| 570 NPPStopFindPtr stopFind; |
| 571 } NPPFindExtensions; |
| 572 |
| 573 /* Returns NULL if the plugin does not support find extensions. */ |
| 574 typedef NPPFindExtensions* (*NPPGetFindExtensionsPtr)(NPP instance); |
| 575 |
532 typedef struct _NPPExtensions { | 576 typedef struct _NPPExtensions { |
533 NPPGetPrintExtensionsPtr getPrintExtensions; | 577 NPPGetPrintExtensionsPtr getPrintExtensions; |
| 578 NPPGetFindExtensionsPtr getFindExtensions; |
534 } NPPExtensions; | 579 } NPPExtensions; |
535 | 580 |
536 #endif /* _NP_EXTENSIONS_H_ */ | 581 #endif /* _NP_EXTENSIONS_H_ */ |
OLD | NEW |