| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 // This header specifies the Chrome Plugin API. It is based heavily on NPAPI. | 5 // This header specifies the Chrome Plugin API. It is based heavily on NPAPI. |
| 6 // The key difference is that Chrome plugins can be loaded for the lifetime | 6 // The key difference is that Chrome plugins can be loaded for the lifetime |
| 7 // of the browser, and are not tied to a specific web page. | 7 // of the browser, and are not tied to a specific web page. |
| 8 // | 8 // |
| 9 // NOTE: This API is not final and may change or go away at any point. | 9 // NOTE: This API is not final and may change or go away at any point. |
| 10 // | 10 // |
| 11 // All strings in the API are UTF8-encoded unless otherwise noted. | 11 // All strings in the API are UTF8-encoded unless otherwise noted. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 23 #endif // WIN32 | 23 #endif // WIN32 |
| 24 #endif // STDCALL | 24 #endif // STDCALL |
| 25 | 25 |
| 26 #ifdef __cplusplus | 26 #ifdef __cplusplus |
| 27 extern "C" { | 27 extern "C" { |
| 28 #endif | 28 #endif |
| 29 | 29 |
| 30 // The current version of the API, used by the 'version' field of CPPluginFuncs | 30 // The current version of the API, used by the 'version' field of CPPluginFuncs |
| 31 // and CPBrowserFuncs. | 31 // and CPBrowserFuncs. |
| 32 #define CP_MAJOR_VERSION 0 | 32 #define CP_MAJOR_VERSION 0 |
| 33 #define CP_MINOR_VERSION 10 | 33 #define CP_MINOR_VERSION 11 |
| 34 #define CP_VERSION ((CP_MAJOR_VERSION << 8) | (CP_MINOR_VERSION)) | 34 #define CP_VERSION ((CP_MAJOR_VERSION << 8) | (CP_MINOR_VERSION)) |
| 35 | 35 |
| 36 #define CP_GET_MAJOR_VERSION(version) ((version & 0xff00) >> 8) | 36 #define CP_GET_MAJOR_VERSION(version) ((version & 0xff00) >> 8) |
| 37 #define CP_GET_MINOR_VERSION(version) (version & 0x00ff) | 37 #define CP_GET_MINOR_VERSION(version) (version & 0x00ff) |
| 38 | 38 |
| 39 typedef unsigned char CPBool; | 39 typedef unsigned char CPBool; |
| 40 | 40 |
| 41 // Chrome plugins can be loaded into different process types. | 41 // Chrome plugins can be loaded into different process types. |
| 42 typedef enum { | 42 typedef enum { |
| 43 CP_PROCESS_BROWSER = 0, | 43 CP_PROCESS_BROWSER = 0, |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 // so-called "copy" and "none" effects. When 'effect' is non-zero, the "copy" | 438 // so-called "copy" and "none" effects. When 'effect' is non-zero, the "copy" |
| 439 // effect is shown. Otherwise, the "none" effect is shown, which prevents the | 439 // effect is shown. Otherwise, the "none" effect is shown, which prevents the |
| 440 // subsequent drop event from succeeding. Returns CPError on failure, meaning | 440 // subsequent drop event from succeeding. Returns CPError on failure, meaning |
| 441 // the 'event' is an invalid drag event. | 441 // the 'event' is an invalid drag event. |
| 442 // | 442 // |
| 443 // Note: 'effect' is int to allow for new effects in future. For example, the | 443 // Note: 'effect' is int to allow for new effects in future. For example, the |
| 444 // HTML5-defined drop effects "move" and "link". | 444 // HTML5-defined drop effects "move" and "link". |
| 445 typedef CPError (STDCALL *CPB_SetDropEffectFunc)( | 445 typedef CPError (STDCALL *CPB_SetDropEffectFunc)( |
| 446 CPID id, CPBrowsingContext context, struct NPObject* event, int effect); | 446 CPID id, CPBrowsingContext context, struct NPObject* event, int effect); |
| 447 | 447 |
| 448 // For drag type "Files", the drag data returned by CPB_GetDragDataFunc() is a |
| 449 // backspace delimited list of file paths. Use this routine to pass that data |
| 450 // to the browser process to verify that the renderer has permission to access |
| 451 // the files. Returns CPERR_SUCCESS if access is allowed. |
| 452 typedef CPError (STDCALL *CPB_AllowFileDropFunc)( |
| 453 CPID id, CPBrowsingContext context, const char* file_drag_data); |
| 454 |
| 448 // Function table for issuing requests using via the other side's network stack. | 455 // Function table for issuing requests using via the other side's network stack. |
| 449 // For the plugin, this functions deal with issuing requests through the | 456 // For the plugin, this functions deal with issuing requests through the |
| 450 // browser. For the browser, these functions deal with allowing the plugin to | 457 // browser. For the browser, these functions deal with allowing the plugin to |
| 451 // intercept requests. | 458 // intercept requests. |
| 452 typedef struct _CPRequestFuncs { | 459 typedef struct _CPRequestFuncs { |
| 453 uint16 size; | 460 uint16 size; |
| 454 CPR_SetExtraRequestHeadersFunc set_extra_request_headers; | 461 CPR_SetExtraRequestHeadersFunc set_extra_request_headers; |
| 455 CPR_SetRequestLoadFlagsFunc set_request_load_flags; | 462 CPR_SetRequestLoadFlagsFunc set_request_load_flags; |
| 456 CPR_AppendDataToUploadFunc append_data_to_upload; | 463 CPR_AppendDataToUploadFunc append_data_to_upload; |
| 457 CPR_StartRequestFunc start_request; | 464 CPR_StartRequestFunc start_request; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 CPB_GetBrowsingContextFromNPPFunc get_browsing_context_from_npp; | 521 CPB_GetBrowsingContextFromNPPFunc get_browsing_context_from_npp; |
| 515 CPB_GetBrowsingContextInfoFunc get_browsing_context_info; | 522 CPB_GetBrowsingContextInfoFunc get_browsing_context_info; |
| 516 CPB_GetCommandLineArgumentsFunc get_command_line_arguments; | 523 CPB_GetCommandLineArgumentsFunc get_command_line_arguments; |
| 517 CPB_AddUICommandFunc add_ui_command; | 524 CPB_AddUICommandFunc add_ui_command; |
| 518 CPB_HandleCommandFunc handle_command; | 525 CPB_HandleCommandFunc handle_command; |
| 519 CPB_SendSyncMessageFunc send_sync_message; | 526 CPB_SendSyncMessageFunc send_sync_message; |
| 520 CPB_PluginThreadAsyncCallFunc plugin_thread_async_call; | 527 CPB_PluginThreadAsyncCallFunc plugin_thread_async_call; |
| 521 CPB_OpenFileDialogFunc open_file_dialog; | 528 CPB_OpenFileDialogFunc open_file_dialog; |
| 522 CPB_GetDragDataFunc get_drag_data; | 529 CPB_GetDragDataFunc get_drag_data; |
| 523 CPB_SetDropEffectFunc set_drop_effect; | 530 CPB_SetDropEffectFunc set_drop_effect; |
| 531 CPB_AllowFileDropFunc allow_file_drop; |
| 524 } CPBrowserFuncs; | 532 } CPBrowserFuncs; |
| 525 | 533 |
| 526 | 534 |
| 527 // | 535 // |
| 528 // DLL exports | 536 // DLL exports |
| 529 // | 537 // |
| 530 | 538 |
| 531 // This export is optional. | 539 // This export is optional. |
| 532 // Prior to calling CP_Initialize, the browser may negotiate with the plugin | 540 // Prior to calling CP_Initialize, the browser may negotiate with the plugin |
| 533 // regarding which version of the CPAPI to utilize. 'min_version' is the | 541 // regarding which version of the CPAPI to utilize. 'min_version' is the |
| (...skipping 15 matching lines...) Expand all Loading... |
| 549 // plugin should not attempt to call a browser function from a thread other | 557 // plugin should not attempt to call a browser function from a thread other |
| 550 // than the one CP_InitializeFunc is called from. | 558 // than the one CP_InitializeFunc is called from. |
| 551 typedef CPError (STDCALL *CP_InitializeFunc)( | 559 typedef CPError (STDCALL *CP_InitializeFunc)( |
| 552 CPID id, const CPBrowserFuncs* bfuncs, CPPluginFuncs* pfuncs); | 560 CPID id, const CPBrowserFuncs* bfuncs, CPPluginFuncs* pfuncs); |
| 553 | 561 |
| 554 #ifdef __cplusplus | 562 #ifdef __cplusplus |
| 555 } // extern "C" | 563 } // extern "C" |
| 556 #endif | 564 #endif |
| 557 | 565 |
| 558 #endif // CHROME_COMMON_CHROME_PLUGIN_API_H__ | 566 #endif // CHROME_COMMON_CHROME_PLUGIN_API_H__ |
| OLD | NEW |