diff --git a/BUILD.gn b/BUILD.gn index b1b57fc06..d4ee2490b 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -374,12 +374,16 @@ static_library("libcef_static") { "libcef/browser/download_item_impl.h", "libcef/browser/download_manager_delegate.cc", "libcef/browser/download_manager_delegate.h", + "libcef/browser/extension_impl.cc", + "libcef/browser/extension_impl.h", "libcef/browser/extensions/api/tabs/tabs_api.cc", "libcef/browser/extensions/api/tabs/tabs_api.h", "libcef/browser/extensions/browser_context_keyed_service_factories.cc", "libcef/browser/extensions/browser_context_keyed_service_factories.h", "libcef/browser/extensions/browser_extensions_util.cc", "libcef/browser/extensions/browser_extensions_util.h", + "libcef/browser/extensions/browser_platform_delegate_background.cc", + "libcef/browser/extensions/browser_platform_delegate_background.h", "libcef/browser/extensions/chrome_api_registration.cc", "libcef/browser/extensions/chrome_api_registration.h", "libcef/browser/extensions/component_extension_resource_manager.cc", @@ -388,10 +392,18 @@ static_library("libcef_static") { "libcef/browser/extensions/extensions_api_client.h", "libcef/browser/extensions/extensions_browser_client.cc", "libcef/browser/extensions/extensions_browser_client.h", + "libcef/browser/extensions/extension_background_host.cc", + "libcef/browser/extensions/extension_background_host.h", + "libcef/browser/extensions/extension_function_details.cc", + "libcef/browser/extensions/extension_function_details.h", + "libcef/browser/extensions/extension_host_delegate.cc", + "libcef/browser/extensions/extension_host_delegate.h", "libcef/browser/extensions/extension_system.cc", "libcef/browser/extensions/extension_system.h", "libcef/browser/extensions/extension_system_factory.cc", "libcef/browser/extensions/extension_system_factory.h", + "libcef/browser/extensions/extension_view_host.cc", + "libcef/browser/extensions/extension_view_host.h", "libcef/browser/extensions/extension_web_contents_observer.cc", "libcef/browser/extensions/extension_web_contents_observer.h", "libcef/browser/extensions/mime_handler_view_guest_delegate.cc", @@ -1578,6 +1590,13 @@ if (is_mac) { ] } + bundle_data("cefclient_resources_bundle_data_extensions_set_page_color") { + sources = gypi_paths2.cefclient_sources_resources_extensions_set_page_color + outputs = [ + "{{bundle_resources_dir}}/extensions/set_page_color/{{source_file_part}}", + ] + } + bundle_data("cefclient_resources_bundle_data_english") { sources = [ "tests/cefclient/resources/mac/English.lproj/InfoPlist.strings", @@ -1622,6 +1641,7 @@ if (is_mac) { gypi_paths2.cefclient_sources_mac deps = [ ":cefclient_resources_bundle_data", + ":cefclient_resources_bundle_data_extensions_set_page_color", ":cefclient_resources_bundle_data_english", ":cefclient_xibs", ":libcef_dll_wrapper", @@ -1785,6 +1805,11 @@ if (is_mac) { gypi_paths2.cefclient_sources_resources outputs = [ "${root_out_dir}/cefclient_files/{{source_file_part}}" ] } + + copy("copy_cefclient_files_extensions_set_page_color") { + sources = gypi_paths2.cefclient_sources_resources_extensions_set_page_color + outputs = [ "${root_out_dir}/cefclient_files/extensions/set_page_color/{{source_file_part}}" ] + } } executable("cefclient") { @@ -1797,7 +1822,8 @@ if (is_mac) { gypi_paths2.cefclient_sources_browser + gypi_paths2.cefclient_sources_common + gypi_paths2.cefclient_sources_renderer + - gypi_paths2.cefclient_sources_resources + gypi_paths2.cefclient_sources_resources + + gypi_paths2.cefclient_sources_resources_extensions_set_page_color deps = [ ":libcef", @@ -1845,6 +1871,7 @@ if (is_mac) { deps += [ ":copy_cefclient_files", + ":copy_cefclient_files_extensions_set_page_color", ] libs = [ diff --git a/cef_paths.gypi b/cef_paths.gypi index 664cf5e22..e8861ded1 100644 --- a/cef_paths.gypi +++ b/cef_paths.gypi @@ -8,7 +8,7 @@ # by hand. See the translator.README.txt file in the tools directory for # more information. # -# $hash=20588ad142633d169a929c7631888e287ab66b9a$ +# $hash=2a6e7c37a8421d3c0d032cc907fb3058790ac71d$ # { @@ -32,6 +32,8 @@ 'include/cef_download_item.h', 'include/cef_drag_data.h', 'include/cef_drag_handler.h', + 'include/cef_extension.h', + 'include/cef_extension_handler.h', 'include/cef_file_util.h', 'include/cef_find_handler.h', 'include/cef_focus_handler.h', @@ -122,6 +124,8 @@ 'include/capi/cef_download_item_capi.h', 'include/capi/cef_drag_data_capi.h', 'include/capi/cef_drag_handler_capi.h', + 'include/capi/cef_extension_capi.h', + 'include/capi/cef_extension_handler_capi.h', 'include/capi/cef_file_util_capi.h', 'include/capi/cef_find_handler_capi.h', 'include/capi/cef_focus_handler_capi.h', @@ -266,6 +270,10 @@ 'libcef_dll/ctocpp/drag_handler_ctocpp.h', 'libcef_dll/ctocpp/end_tracing_callback_ctocpp.cc', 'libcef_dll/ctocpp/end_tracing_callback_ctocpp.h', + 'libcef_dll/cpptoc/extension_cpptoc.cc', + 'libcef_dll/cpptoc/extension_cpptoc.h', + 'libcef_dll/ctocpp/extension_handler_ctocpp.cc', + 'libcef_dll/ctocpp/extension_handler_ctocpp.h', 'libcef_dll/cpptoc/file_dialog_callback_cpptoc.cc', 'libcef_dll/cpptoc/file_dialog_callback_cpptoc.h', 'libcef_dll/cpptoc/views/fill_layout_cpptoc.cc', @@ -280,6 +288,8 @@ 'libcef_dll/cpptoc/geolocation_callback_cpptoc.h', 'libcef_dll/ctocpp/geolocation_handler_ctocpp.cc', 'libcef_dll/ctocpp/geolocation_handler_ctocpp.h', + 'libcef_dll/cpptoc/get_extension_resource_callback_cpptoc.cc', + 'libcef_dll/cpptoc/get_extension_resource_callback_cpptoc.h', 'libcef_dll/ctocpp/get_geolocation_callback_ctocpp.cc', 'libcef_dll/ctocpp/get_geolocation_callback_ctocpp.h', 'libcef_dll/cpptoc/image_cpptoc.cc', @@ -304,6 +314,8 @@ 'libcef_dll/cpptoc/views/menu_button_cpptoc.h', 'libcef_dll/ctocpp/views/menu_button_delegate_ctocpp.cc', 'libcef_dll/ctocpp/views/menu_button_delegate_ctocpp.h', + 'libcef_dll/cpptoc/views/menu_button_pressed_lock_cpptoc.cc', + 'libcef_dll/cpptoc/views/menu_button_pressed_lock_cpptoc.h', 'libcef_dll/cpptoc/menu_model_cpptoc.cc', 'libcef_dll/cpptoc/menu_model_cpptoc.h', 'libcef_dll/ctocpp/menu_model_delegate_ctocpp.cc', @@ -540,6 +552,10 @@ 'libcef_dll/cpptoc/drag_handler_cpptoc.h', 'libcef_dll/cpptoc/end_tracing_callback_cpptoc.cc', 'libcef_dll/cpptoc/end_tracing_callback_cpptoc.h', + 'libcef_dll/ctocpp/extension_ctocpp.cc', + 'libcef_dll/ctocpp/extension_ctocpp.h', + 'libcef_dll/cpptoc/extension_handler_cpptoc.cc', + 'libcef_dll/cpptoc/extension_handler_cpptoc.h', 'libcef_dll/ctocpp/file_dialog_callback_ctocpp.cc', 'libcef_dll/ctocpp/file_dialog_callback_ctocpp.h', 'libcef_dll/ctocpp/views/fill_layout_ctocpp.cc', @@ -554,6 +570,8 @@ 'libcef_dll/ctocpp/geolocation_callback_ctocpp.h', 'libcef_dll/cpptoc/geolocation_handler_cpptoc.cc', 'libcef_dll/cpptoc/geolocation_handler_cpptoc.h', + 'libcef_dll/ctocpp/get_extension_resource_callback_ctocpp.cc', + 'libcef_dll/ctocpp/get_extension_resource_callback_ctocpp.h', 'libcef_dll/cpptoc/get_geolocation_callback_cpptoc.cc', 'libcef_dll/cpptoc/get_geolocation_callback_cpptoc.h', 'libcef_dll/ctocpp/image_ctocpp.cc', @@ -578,6 +596,8 @@ 'libcef_dll/ctocpp/views/menu_button_ctocpp.h', 'libcef_dll/cpptoc/views/menu_button_delegate_cpptoc.cc', 'libcef_dll/cpptoc/views/menu_button_delegate_cpptoc.h', + 'libcef_dll/ctocpp/views/menu_button_pressed_lock_ctocpp.cc', + 'libcef_dll/ctocpp/views/menu_button_pressed_lock_ctocpp.h', 'libcef_dll/ctocpp/menu_model_ctocpp.cc', 'libcef_dll/ctocpp/menu_model_ctocpp.h', 'libcef_dll/cpptoc/menu_model_delegate_cpptoc.cc', diff --git a/cef_paths2.gypi b/cef_paths2.gypi index 36ffbc142..e08af4bfd 100644 --- a/cef_paths2.gypi +++ b/cef_paths2.gypi @@ -146,6 +146,10 @@ 'shared_sources_browser': [ 'tests/shared/browser/client_app_browser.cc', 'tests/shared/browser/client_app_browser.h', + 'tests/shared/browser/extension_util.cc', + 'tests/shared/browser/extension_util.h', + 'tests/shared/browser/file_util.cc', + 'tests/shared/browser/file_util.h', 'tests/shared/browser/geometry_util.cc', 'tests/shared/browser/geometry_util.h', 'tests/shared/browser/main_message_loop.cc', @@ -155,7 +159,6 @@ 'tests/shared/browser/main_message_loop_std.cc', 'tests/shared/browser/main_message_loop_std.h', 'tests/shared/browser/resource_util.h', - 'tests/shared/browser/resource_util.cc', 'tests/shared/browser/resource_util.h', ], 'shared_sources_common': [ @@ -216,6 +219,8 @@ 'tests/cefclient/browser/dialog_test.h', 'tests/cefclient/browser/drm_test.cc', 'tests/cefclient/browser/drm_test.h', + 'tests/cefclient/browser/image_cache.cc', + 'tests/cefclient/browser/image_cache.h', 'tests/cefclient/browser/main_context.cc', 'tests/cefclient/browser/main_context.h', 'tests/cefclient/browser/main_context_impl.cc', @@ -278,6 +283,13 @@ 'tests/cefclient/resources/window.html', 'tests/cefclient/resources/xmlhttprequest.html', ], + 'cefclient_sources_resources_extensions_set_page_color': [ + 'tests/cefclient/resources/extensions/set_page_color/icon.png', + 'tests/cefclient/resources/extensions/set_page_color/manifest.json', + 'tests/cefclient/resources/extensions/set_page_color/popup.html', + 'tests/cefclient/resources/extensions/set_page_color/popup.js', + 'tests/cefclient/resources/extensions/set_page_color/README.md', + ], 'cefclient_sources_win': [ 'tests/cefclient/browser/browser_window_osr_win.cc', 'tests/cefclient/browser/browser_window_osr_win.h', @@ -417,8 +429,11 @@ 'tests/ceftests/dom_unittest.cc', 'tests/ceftests/download_unittest.cc', 'tests/ceftests/draggable_regions_unittest.cc', - 'tests/ceftests/file_util.cc', - 'tests/ceftests/file_util.h', + 'tests/ceftests/extensions/background_unittest.cc', + 'tests/ceftests/extensions/chrome_tabs_unittest.cc', + 'tests/ceftests/extensions/extension_test_handler.cc', + 'tests/ceftests/extensions/extension_test_handler.h', + 'tests/ceftests/extensions/view_unittest.cc', 'tests/ceftests/file_util_unittest.cc', 'tests/ceftests/frame_unittest.cc', 'tests/ceftests/geolocation_unittest.cc', @@ -494,15 +509,14 @@ 'tests/ceftests/run_all_unittests_mac.mm', ], 'ceftests_sources_mac_helper': [ - 'tests/shared/browser/resource_util.cc', + 'tests/shared/browser/file_util.cc', + 'tests/shared/browser/file_util.h', 'tests/shared/browser/resource_util.h', 'tests/shared/browser/resource_util_mac.mm', 'tests/shared/browser/resource_util_posix.cc', 'tests/ceftests/client_app_delegates.cc', 'tests/ceftests/cookie_unittest.cc', 'tests/ceftests/dom_unittest.cc', - 'tests/ceftests/file_util.cc', - 'tests/ceftests/file_util.h', 'tests/ceftests/frame_unittest.cc', 'tests/ceftests/message_router_unittest.cc', 'tests/ceftests/navigation_unittest.cc', diff --git a/include/capi/cef_browser_capi.h b/include/capi/cef_browser_capi.h index 3c830bc0e..721b99c2d 100644 --- a/include/capi/cef_browser_capi.h +++ b/include/capi/cef_browser_capi.h @@ -33,7 +33,7 @@ // by hand. See the translator.README.txt file in the tools directory for // more information. // -// $hash=b6308ab5e97eb9f7af95f1f4c371fd6e7edbf852$ +// $hash=a4831deeb05bc0a022c1a0ee6f1c484b338c741c$ // #ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_ @@ -115,7 +115,8 @@ typedef struct _cef_browser_t { void(CEF_CALLBACK* stop_load)(struct _cef_browser_t* self); /// - // Returns the globally unique identifier for this browser. + // Returns the globally unique identifier for this browser. This value is also + // used as the tabId for extension APIs. /// int(CEF_CALLBACK* get_identifier)(struct _cef_browser_t* self); @@ -812,6 +813,30 @@ typedef struct _cef_browser_host_t { /// void(CEF_CALLBACK* set_accessibility_state)(struct _cef_browser_host_t* self, cef_state_t accessibility_state); + + /// + // Enable notifications of auto resize via + // cef_display_handler_t::OnAutoResize. Notifications are disabled by default. + // |min_size| and |max_size| define the range of allowed sizes. + /// + void(CEF_CALLBACK* set_auto_resize_enabled)(struct _cef_browser_host_t* self, + int enabled, + const cef_size_t* min_size, + const cef_size_t* max_size); + + /// + // Returns the extension hosted in this browser or NULL if no extension is + // hosted. See cef_request_tContext::LoadExtension for details. + /// + struct _cef_extension_t*(CEF_CALLBACK* get_extension)( + struct _cef_browser_host_t* self); + + /// + // Returns true (1) if this browser is hosting an extension background script. + // Background hosts do not have a window and are not displayable. See + // cef_request_tContext::LoadExtension for details. + /// + int(CEF_CALLBACK* is_background_host)(struct _cef_browser_host_t* self); } cef_browser_host_t; /// diff --git a/include/capi/cef_display_handler_capi.h b/include/capi/cef_display_handler_capi.h index 4a9907654..412b1abf6 100644 --- a/include/capi/cef_display_handler_capi.h +++ b/include/capi/cef_display_handler_capi.h @@ -33,7 +33,7 @@ // by hand. See the translator.README.txt file in the tools directory for // more information. // -// $hash=f0f3fd4cab00c0eb11956e674a111cb30d3af100$ +// $hash=979968e494e9d7c4d5117a1753acade5d0e79215$ // #ifndef CEF_INCLUDE_CAPI_CEF_DISPLAY_HANDLER_CAPI_H_ @@ -121,6 +121,16 @@ typedef struct _cef_display_handler_t { const cef_string_t* message, const cef_string_t* source, int line); + + /// + // Called when auto-resize is enabled via + // cef_browser_host_t::SetAutoResizeEnabled and the contents have auto- + // resized. |new_size| will be the desired size in view coordinates. Return + // true (1) if the resize was handled or false (0) for default handling. + /// + int(CEF_CALLBACK* on_auto_resize)(struct _cef_display_handler_t* self, + struct _cef_browser_t* browser, + const cef_size_t* new_size); } cef_display_handler_t; #ifdef __cplusplus diff --git a/include/capi/cef_extension_capi.h b/include/capi/cef_extension_capi.h new file mode 100644 index 000000000..a97f19e88 --- /dev/null +++ b/include/capi/cef_extension_capi.h @@ -0,0 +1,130 @@ +// Copyright (c) 2017 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// +// $hash=aef2f0bc7a2491b5745b5eae8d02e2e8bd7335af$ +// + +#ifndef CEF_INCLUDE_CAPI_CEF_EXTENSION_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_EXTENSION_CAPI_H_ +#pragma once + +#include "include/capi/cef_base_capi.h" +#include "include/capi/cef_values_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct _cef_extension_handler_t; +struct _cef_request_context_t; + +/// +// Object representing an extension. Methods may be called on any thread unless +// otherwise indicated. +/// +typedef struct _cef_extension_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Returns the unique extension identifier. This is calculated based on the + // extension public key, if available, or on the extension path. See + // https://developer.chrome.com/extensions/manifest/key for details. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_identifier)( + struct _cef_extension_t* self); + + /// + // Returns the absolute path to the extension directory on disk. This value + // will be prefixed with PK_DIR_RESOURCES if a relative path was passed to + // cef_request_tContext::LoadExtension. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_path)(struct _cef_extension_t* self); + + /// + // Returns the extension manifest contents as a cef_dictionary_value_t object. + // See https://developer.chrome.com/extensions/manifest for details. + /// + struct _cef_dictionary_value_t*(CEF_CALLBACK* get_manifest)( + struct _cef_extension_t* self); + + /// + // Returns true (1) if this object is the same extension as |that| object. + // Extensions are considered the same if identifier, path and loader context + // match. + /// + int(CEF_CALLBACK* is_same)(struct _cef_extension_t* self, + struct _cef_extension_t* that); + + /// + // Returns the handler for this extension. Will return NULL for internal + // extensions or if no handler was passed to + // cef_request_tContext::LoadExtension. + /// + struct _cef_extension_handler_t*(CEF_CALLBACK* get_handler)( + struct _cef_extension_t* self); + + /// + // Returns the request context that loaded this extension. Will return NULL + // for internal extensions or if the extension has been unloaded. See the + // cef_request_tContext::LoadExtension documentation for more information + // about loader contexts. Must be called on the browser process UI thread. + /// + struct _cef_request_context_t*(CEF_CALLBACK* get_loader_context)( + struct _cef_extension_t* self); + + /// + // Returns true (1) if this extension is currently loaded. Must be called on + // the browser process UI thread. + /// + int(CEF_CALLBACK* is_loaded)(struct _cef_extension_t* self); + + /// + // Unload this extension if it is not an internal extension and is currently + // loaded. Will result in a call to + // cef_extension_tHandler::OnExtensionUnloaded on success. + /// + void(CEF_CALLBACK* unload)(struct _cef_extension_t* self); +} cef_extension_t; + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_EXTENSION_CAPI_H_ diff --git a/include/capi/cef_extension_handler_capi.h b/include/capi/cef_extension_handler_capi.h new file mode 100644 index 000000000..b0328fa64 --- /dev/null +++ b/include/capi/cef_extension_handler_capi.h @@ -0,0 +1,183 @@ +// Copyright (c) 2017 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// +// $hash=b49f4c91db8eccdfe9ded503d8bb32ee0e433f60$ +// + +#ifndef CEF_INCLUDE_CAPI_CEF_EXTENSION_HANDLER_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_EXTENSION_HANDLER_CAPI_H_ +#pragma once + +#include "include/capi/cef_base_capi.h" +#include "include/capi/cef_browser_capi.h" +#include "include/capi/cef_extension_capi.h" +#include "include/capi/cef_stream_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct _cef_client_t; + +/// +// Callback structure used for asynchronous continuation of +// cef_extension_tHandler::GetExtensionResource. +/// +typedef struct _cef_get_extension_resource_callback_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Continue the request. Read the resource contents from |stream|. + /// + void(CEF_CALLBACK* cont)(struct _cef_get_extension_resource_callback_t* self, + struct _cef_stream_reader_t* stream); + + /// + // Cancel the request. + /// + void(CEF_CALLBACK* cancel)( + struct _cef_get_extension_resource_callback_t* self); +} cef_get_extension_resource_callback_t; + +/// +// Implement this structure to handle events related to browser extensions. The +// functions of this structure will be called on the UI thread. See +// cef_request_tContext::LoadExtension for information about extension loading. +/// +typedef struct _cef_extension_handler_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Called if the cef_request_tContext::LoadExtension request fails. |result| + // will be the error code. + /// + void(CEF_CALLBACK* on_extension_load_failed)( + struct _cef_extension_handler_t* self, + cef_errorcode_t result); + + /// + // Called if the cef_request_tContext::LoadExtension request succeeds. + // |extension| is the loaded extension. + /// + void(CEF_CALLBACK* on_extension_loaded)(struct _cef_extension_handler_t* self, + struct _cef_extension_t* extension); + + /// + // Called after the cef_extension_t::Unload request has completed. + /// + void(CEF_CALLBACK* on_extension_unloaded)( + struct _cef_extension_handler_t* self, + struct _cef_extension_t* extension); + + /// + // Called when an extension needs a browser to host a background script + // specified via the "background" manifest key. The browser will have no + // visible window and cannot be displayed. |extension| is the extension that + // is loading the background script. |url| is an internally generated + // reference to an HTML page that will be used to load the background script + // via a + +
+