mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
47 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
19ba7216a0 | ||
|
3c44b04c4e | ||
|
7a604aacf4 | ||
|
f03d75a333 | ||
|
c53c523f4d | ||
|
5c92ffb78d | ||
|
044c82849e | ||
|
02ae4597d8 | ||
|
f2f0bfbdb5 | ||
|
d330790ec6 | ||
|
af832bf118 | ||
|
cd9342c39f | ||
|
74c66a3a43 | ||
|
f718c8947c | ||
|
c6a4331904 | ||
|
af0e86206a | ||
|
e37ceabdf8 | ||
|
7823df5a45 | ||
|
691c9c2dcc | ||
|
c48a79756c | ||
|
d4386da6c3 | ||
|
8656f19907 | ||
|
df150f8ae0 | ||
|
d98971fc9e | ||
|
10b7a443cb | ||
|
fe5b0df2fa | ||
|
5bfcfaab73 | ||
|
f048a5ddba | ||
|
9f05dc2447 | ||
|
4d20de09f3 | ||
|
c04a578821 | ||
|
44829818b0 | ||
|
cd40496573 | ||
|
210c1d6b4f | ||
|
c04592e2a7 | ||
|
6ad29642e2 | ||
|
1b36d3538c | ||
|
d399c7220a | ||
|
1cd3f8a3af | ||
|
35a360fe66 | ||
|
2ecefdf30b | ||
|
0ad85c19aa | ||
|
1232df3646 | ||
|
dc12a89f28 | ||
|
4011b1e2ab | ||
|
8d23e96edf | ||
|
2e4c4750b6 |
71
BUILD.gn
71
BUILD.gn
@@ -125,6 +125,7 @@ if (is_mac) {
|
|||||||
import("//build/config/mac/rules.gni")
|
import("//build/config/mac/rules.gni")
|
||||||
import("//build/util/version.gni")
|
import("//build/util/version.gni")
|
||||||
import("//media/cdm/library_cdm/cdm_paths.gni")
|
import("//media/cdm/library_cdm/cdm_paths.gni")
|
||||||
|
import("//build/config/mac/base_rules.gni")
|
||||||
|
|
||||||
# Template to compile .xib and .storyboard files.
|
# Template to compile .xib and .storyboard files.
|
||||||
#
|
#
|
||||||
@@ -261,6 +262,12 @@ if (is_clang) {
|
|||||||
assert(!clang_use_chrome_plugins)
|
assert(!clang_use_chrome_plugins)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_mac) {
|
||||||
|
# Always generate dSYM files. The make_distrib script will fail if
|
||||||
|
# enable_dsyms=true is not explicitly set when is_official_build=false.
|
||||||
|
assert(enable_dsyms)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Local variables.
|
# Local variables.
|
||||||
@@ -357,9 +364,6 @@ if (is_win) {
|
|||||||
|
|
||||||
# Required by content_switches.cc
|
# Required by content_switches.cc
|
||||||
"//media:media_buildflags",
|
"//media:media_buildflags",
|
||||||
|
|
||||||
# Required by crash_keys.cc (from base/stl_util.h)
|
|
||||||
"//third_party/abseil-cpp:absl",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -428,8 +432,6 @@ static_library("libcef_static") {
|
|||||||
"libcef/browser/browser_context.h",
|
"libcef/browser/browser_context.h",
|
||||||
"libcef/browser/browser_context_keyed_service_factories.cc",
|
"libcef/browser/browser_context_keyed_service_factories.cc",
|
||||||
"libcef/browser/browser_context_keyed_service_factories.h",
|
"libcef/browser/browser_context_keyed_service_factories.h",
|
||||||
"libcef/browser/browser_frame.cc",
|
|
||||||
"libcef/browser/browser_frame.h",
|
|
||||||
"libcef/browser/browser_host_base.cc",
|
"libcef/browser/browser_host_base.cc",
|
||||||
"libcef/browser/browser_host_base.h",
|
"libcef/browser/browser_host_base.h",
|
||||||
"libcef/browser/browser_host_create.cc",
|
"libcef/browser/browser_host_create.cc",
|
||||||
@@ -437,8 +439,8 @@ static_library("libcef_static") {
|
|||||||
"libcef/browser/browser_info.h",
|
"libcef/browser/browser_info.h",
|
||||||
"libcef/browser/browser_info_manager.cc",
|
"libcef/browser/browser_info_manager.cc",
|
||||||
"libcef/browser/browser_info_manager.h",
|
"libcef/browser/browser_info_manager.h",
|
||||||
"libcef/browser/browser_manager.cc",
|
"libcef/browser/browser_message_filter.cc",
|
||||||
"libcef/browser/browser_manager.h",
|
"libcef/browser/browser_message_filter.h",
|
||||||
"libcef/browser/browser_message_loop.cc",
|
"libcef/browser/browser_message_loop.cc",
|
||||||
"libcef/browser/browser_message_loop.h",
|
"libcef/browser/browser_message_loop.h",
|
||||||
"libcef/browser/browser_platform_delegate.cc",
|
"libcef/browser/browser_platform_delegate.cc",
|
||||||
@@ -486,8 +488,6 @@ static_library("libcef_static") {
|
|||||||
"libcef/browser/extensions/api/storage/sync_value_store_cache.h",
|
"libcef/browser/extensions/api/storage/sync_value_store_cache.h",
|
||||||
"libcef/browser/extensions/api/tabs/tabs_api.cc",
|
"libcef/browser/extensions/api/tabs/tabs_api.cc",
|
||||||
"libcef/browser/extensions/api/tabs/tabs_api.h",
|
"libcef/browser/extensions/api/tabs/tabs_api.h",
|
||||||
"libcef/browser/extensions/alloy_extensions_util.cc",
|
|
||||||
"libcef/browser/extensions/alloy_extensions_util.h",
|
|
||||||
"libcef/browser/extensions/browser_extensions_util.cc",
|
"libcef/browser/extensions/browser_extensions_util.cc",
|
||||||
"libcef/browser/extensions/browser_extensions_util.h",
|
"libcef/browser/extensions/browser_extensions_util.h",
|
||||||
"libcef/browser/extensions/browser_platform_delegate_background.cc",
|
"libcef/browser/extensions/browser_platform_delegate_background.cc",
|
||||||
@@ -561,6 +561,8 @@ static_library("libcef_static") {
|
|||||||
"libcef/browser/native/browser_platform_delegate_native.h",
|
"libcef/browser/native/browser_platform_delegate_native.h",
|
||||||
"libcef/browser/native/cursor_util.h",
|
"libcef/browser/native/cursor_util.h",
|
||||||
"libcef/browser/native/cursor_util.cc",
|
"libcef/browser/native/cursor_util.cc",
|
||||||
|
"libcef/browser/navigate_params.cc",
|
||||||
|
"libcef/browser/navigate_params.h",
|
||||||
"libcef/browser/navigation_entry_impl.cc",
|
"libcef/browser/navigation_entry_impl.cc",
|
||||||
"libcef/browser/navigation_entry_impl.h",
|
"libcef/browser/navigation_entry_impl.h",
|
||||||
"libcef/browser/net/chrome_scheme_handler.cc",
|
"libcef/browser/net/chrome_scheme_handler.cc",
|
||||||
@@ -674,6 +676,10 @@ static_library("libcef_static") {
|
|||||||
"libcef/common/app_manager.cc",
|
"libcef/common/app_manager.cc",
|
||||||
"libcef/common/app_manager.h",
|
"libcef/common/app_manager.h",
|
||||||
"libcef/common/base_impl.cc",
|
"libcef/common/base_impl.cc",
|
||||||
|
"libcef/common/cef_message_generator.cc",
|
||||||
|
"libcef/common/cef_message_generator.h",
|
||||||
|
"libcef/common/cef_messages.cc",
|
||||||
|
"libcef/common/cef_messages.h",
|
||||||
"libcef/common/cef_switches.cc",
|
"libcef/common/cef_switches.cc",
|
||||||
"libcef/common/cef_switches.h",
|
"libcef/common/cef_switches.h",
|
||||||
"libcef/common/chrome/chrome_content_client_cef.cc",
|
"libcef/common/chrome/chrome_content_client_cef.cc",
|
||||||
@@ -710,6 +716,10 @@ static_library("libcef_static") {
|
|||||||
"libcef/common/net/net_resource_provider.h",
|
"libcef/common/net/net_resource_provider.h",
|
||||||
"libcef/common/net/scheme_registration.cc",
|
"libcef/common/net/scheme_registration.cc",
|
||||||
"libcef/common/net/scheme_registration.h",
|
"libcef/common/net/scheme_registration.h",
|
||||||
|
"libcef/common/net/upload_data.cc",
|
||||||
|
"libcef/common/net/upload_data.h",
|
||||||
|
"libcef/common/net/upload_element.cc",
|
||||||
|
"libcef/common/net/upload_element.h",
|
||||||
"libcef/common/net/url_util.cc",
|
"libcef/common/net/url_util.cc",
|
||||||
"libcef/common/net/url_util.h",
|
"libcef/common/net/url_util.h",
|
||||||
"libcef/common/net_service/net_service_util.cc",
|
"libcef/common/net_service/net_service_util.cc",
|
||||||
@@ -727,14 +737,14 @@ static_library("libcef_static") {
|
|||||||
"libcef/common/resource_util.h",
|
"libcef/common/resource_util.h",
|
||||||
"libcef/common/response_impl.cc",
|
"libcef/common/response_impl.cc",
|
||||||
"libcef/common/response_impl.h",
|
"libcef/common/response_impl.h",
|
||||||
|
"libcef/common/response_manager.cc",
|
||||||
|
"libcef/common/response_manager.h",
|
||||||
"libcef/common/scheme_registrar_impl.cc",
|
"libcef/common/scheme_registrar_impl.cc",
|
||||||
"libcef/common/scheme_registrar_impl.h",
|
"libcef/common/scheme_registrar_impl.h",
|
||||||
"libcef/common/string_list_impl.cc",
|
"libcef/common/string_list_impl.cc",
|
||||||
"libcef/common/string_map_impl.cc",
|
"libcef/common/string_map_impl.cc",
|
||||||
"libcef/common/string_multimap_impl.cc",
|
"libcef/common/string_multimap_impl.cc",
|
||||||
"libcef/common/string_types_impl.cc",
|
"libcef/common/string_types_impl.cc",
|
||||||
"libcef/common/string_util.cc",
|
|
||||||
"libcef/common/string_util.h",
|
|
||||||
"libcef/common/task_impl.cc",
|
"libcef/common/task_impl.cc",
|
||||||
"libcef/common/task_runner_impl.cc",
|
"libcef/common/task_runner_impl.cc",
|
||||||
"libcef/common/task_runner_impl.h",
|
"libcef/common/task_runner_impl.h",
|
||||||
@@ -760,12 +770,16 @@ static_library("libcef_static") {
|
|||||||
"libcef/features/runtime_checks.h",
|
"libcef/features/runtime_checks.h",
|
||||||
"libcef/renderer/alloy/alloy_content_renderer_client.cc",
|
"libcef/renderer/alloy/alloy_content_renderer_client.cc",
|
||||||
"libcef/renderer/alloy/alloy_content_renderer_client.h",
|
"libcef/renderer/alloy/alloy_content_renderer_client.h",
|
||||||
|
"libcef/renderer/alloy/alloy_render_frame_observer.cc",
|
||||||
|
"libcef/renderer/alloy/alloy_render_frame_observer.h",
|
||||||
"libcef/renderer/alloy/alloy_render_thread_observer.cc",
|
"libcef/renderer/alloy/alloy_render_thread_observer.cc",
|
||||||
"libcef/renderer/alloy/alloy_render_thread_observer.h",
|
"libcef/renderer/alloy/alloy_render_thread_observer.h",
|
||||||
"libcef/renderer/alloy/url_loader_throttle_provider_impl.cc",
|
"libcef/renderer/alloy/url_loader_throttle_provider_impl.cc",
|
||||||
"libcef/renderer/alloy/url_loader_throttle_provider_impl.h",
|
"libcef/renderer/alloy/url_loader_throttle_provider_impl.h",
|
||||||
"libcef/renderer/browser_impl.cc",
|
"libcef/renderer/browser_impl.cc",
|
||||||
"libcef/renderer/browser_impl.h",
|
"libcef/renderer/browser_impl.h",
|
||||||
|
"libcef/renderer/browser_manager.cc",
|
||||||
|
"libcef/renderer/browser_manager.h",
|
||||||
"libcef/renderer/chrome/chrome_content_renderer_client_cef.cc",
|
"libcef/renderer/chrome/chrome_content_renderer_client_cef.cc",
|
||||||
"libcef/renderer/chrome/chrome_content_renderer_client_cef.h",
|
"libcef/renderer/chrome/chrome_content_renderer_client_cef.h",
|
||||||
"libcef/renderer/dom_document_impl.cc",
|
"libcef/renderer/dom_document_impl.cc",
|
||||||
@@ -784,8 +798,8 @@ static_library("libcef_static") {
|
|||||||
"libcef/renderer/render_frame_observer.h",
|
"libcef/renderer/render_frame_observer.h",
|
||||||
"libcef/renderer/render_frame_util.cc",
|
"libcef/renderer/render_frame_util.cc",
|
||||||
"libcef/renderer/render_frame_util.h",
|
"libcef/renderer/render_frame_util.h",
|
||||||
"libcef/renderer/render_manager.cc",
|
"libcef/renderer/render_thread_observer.cc",
|
||||||
"libcef/renderer/render_manager.h",
|
"libcef/renderer/render_thread_observer.h",
|
||||||
"libcef/renderer/render_urlrequest_impl.cc",
|
"libcef/renderer/render_urlrequest_impl.cc",
|
||||||
"libcef/renderer/render_urlrequest_impl.h",
|
"libcef/renderer/render_urlrequest_impl.h",
|
||||||
"libcef/renderer/thread_util.h",
|
"libcef/renderer/thread_util.h",
|
||||||
@@ -795,10 +809,6 @@ static_library("libcef_static") {
|
|||||||
# For Chrome runtime support.
|
# For Chrome runtime support.
|
||||||
"//chrome/app/chrome_main_delegate.cc",
|
"//chrome/app/chrome_main_delegate.cc",
|
||||||
"//chrome/app/chrome_main_delegate.h",
|
"//chrome/app/chrome_main_delegate.h",
|
||||||
|
|
||||||
# Part of //content//test::test_support which is testingonly.
|
|
||||||
"//content/public/test/scoped_web_ui_controller_factory_registration.cc",
|
|
||||||
"//content/public/test/scoped_web_ui_controller_factory_registration.h",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
configs += [
|
configs += [
|
||||||
@@ -825,7 +835,6 @@ static_library("libcef_static") {
|
|||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":cef_make_headers",
|
":cef_make_headers",
|
||||||
"libcef/common/mojom",
|
|
||||||
|
|
||||||
":libcef_static_unittested",
|
":libcef_static_unittested",
|
||||||
|
|
||||||
@@ -1654,29 +1663,6 @@ if (is_mac) {
|
|||||||
# Executable/app targets.
|
# Executable/app targets.
|
||||||
#
|
#
|
||||||
|
|
||||||
# Source files for TeamCity GTest integration.
|
|
||||||
# See tests/gtest/teamcity/README.cef for details.
|
|
||||||
source_set("gtest_teamcity") {
|
|
||||||
testonly = true
|
|
||||||
|
|
||||||
sources = [
|
|
||||||
"tests/gtest/teamcity/include/teamcity_gtest.h",
|
|
||||||
"tests/gtest/teamcity/src/teamcity_gtest.cpp",
|
|
||||||
"tests/gtest/teamcity/src/teamcity_gtest.h",
|
|
||||||
"tests/gtest/teamcity/src/teamcity_messages.cpp",
|
|
||||||
"tests/gtest/teamcity/src/teamcity_messages.h",
|
|
||||||
]
|
|
||||||
|
|
||||||
deps = [
|
|
||||||
"//testing/gtest",
|
|
||||||
]
|
|
||||||
|
|
||||||
configs += [
|
|
||||||
"libcef/features:config",
|
|
||||||
"//build/config:precompiled_headers",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_mac) {
|
if (is_mac) {
|
||||||
# Helper for generating the CEF app bundle.
|
# Helper for generating the CEF app bundle.
|
||||||
template("cef_app") {
|
template("cef_app") {
|
||||||
@@ -2004,7 +1990,6 @@ if (is_mac) {
|
|||||||
gypi_paths2.shared_sources_mac_helper +
|
gypi_paths2.shared_sources_mac_helper +
|
||||||
gypi_paths2.ceftests_sources_mac_helper
|
gypi_paths2.ceftests_sources_mac_helper
|
||||||
helper_deps = [
|
helper_deps = [
|
||||||
":gtest_teamcity",
|
|
||||||
"//testing/gtest",
|
"//testing/gtest",
|
||||||
]
|
]
|
||||||
helper_defines = [
|
helper_defines = [
|
||||||
@@ -2025,7 +2010,6 @@ if (is_mac) {
|
|||||||
":ceftests_resources_bundle_data",
|
":ceftests_resources_bundle_data",
|
||||||
":ceftests_resources_bundle_data_english",
|
":ceftests_resources_bundle_data_english",
|
||||||
":ceftests_xibs",
|
":ceftests_xibs",
|
||||||
":gtest_teamcity",
|
|
||||||
"//testing/gtest",
|
"//testing/gtest",
|
||||||
]
|
]
|
||||||
frameworks = [
|
frameworks = [
|
||||||
@@ -2244,7 +2228,6 @@ if (is_mac) {
|
|||||||
deps = [
|
deps = [
|
||||||
":libcef",
|
":libcef",
|
||||||
":libcef_dll_wrapper",
|
":libcef_dll_wrapper",
|
||||||
":gtest_teamcity",
|
|
||||||
"//testing/gtest",
|
"//testing/gtest",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@@ -7,6 +7,6 @@
|
|||||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||||
|
|
||||||
{
|
{
|
||||||
'chromium_checkout': 'refs/tags/92.0.4515.159',
|
'chromium_checkout': 'refs/tags/90.0.4430.212',
|
||||||
'depot_tools_checkout': '58542b7fef'
|
'depot_tools_checkout': '9757ad5883'
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
# by hand. See the translator.README.txt file in the tools directory for
|
# by hand. See the translator.README.txt file in the tools directory for
|
||||||
# more information.
|
# more information.
|
||||||
#
|
#
|
||||||
# $hash=d723a9f6637cec523b158a6750d3a64698b407c3$
|
# $hash=f1877c7a493342351e284cb6c14e6f223461facb$
|
||||||
#
|
#
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -40,7 +40,6 @@
|
|||||||
'include/cef_find_handler.h',
|
'include/cef_find_handler.h',
|
||||||
'include/cef_focus_handler.h',
|
'include/cef_focus_handler.h',
|
||||||
'include/cef_frame.h',
|
'include/cef_frame.h',
|
||||||
'include/cef_frame_handler.h',
|
|
||||||
'include/cef_image.h',
|
'include/cef_image.h',
|
||||||
'include/cef_jsdialog_handler.h',
|
'include/cef_jsdialog_handler.h',
|
||||||
'include/cef_keyboard_handler.h',
|
'include/cef_keyboard_handler.h',
|
||||||
@@ -138,7 +137,6 @@
|
|||||||
'include/capi/cef_find_handler_capi.h',
|
'include/capi/cef_find_handler_capi.h',
|
||||||
'include/capi/cef_focus_handler_capi.h',
|
'include/capi/cef_focus_handler_capi.h',
|
||||||
'include/capi/cef_frame_capi.h',
|
'include/capi/cef_frame_capi.h',
|
||||||
'include/capi/cef_frame_handler_capi.h',
|
|
||||||
'include/capi/cef_image_capi.h',
|
'include/capi/cef_image_capi.h',
|
||||||
'include/capi/cef_jsdialog_handler_capi.h',
|
'include/capi/cef_jsdialog_handler_capi.h',
|
||||||
'include/capi/cef_keyboard_handler_capi.h',
|
'include/capi/cef_keyboard_handler_capi.h',
|
||||||
@@ -302,8 +300,6 @@
|
|||||||
'libcef_dll/ctocpp/focus_handler_ctocpp.h',
|
'libcef_dll/ctocpp/focus_handler_ctocpp.h',
|
||||||
'libcef_dll/cpptoc/frame_cpptoc.cc',
|
'libcef_dll/cpptoc/frame_cpptoc.cc',
|
||||||
'libcef_dll/cpptoc/frame_cpptoc.h',
|
'libcef_dll/cpptoc/frame_cpptoc.h',
|
||||||
'libcef_dll/ctocpp/frame_handler_ctocpp.cc',
|
|
||||||
'libcef_dll/ctocpp/frame_handler_ctocpp.h',
|
|
||||||
'libcef_dll/cpptoc/get_extension_resource_callback_cpptoc.cc',
|
'libcef_dll/cpptoc/get_extension_resource_callback_cpptoc.cc',
|
||||||
'libcef_dll/cpptoc/get_extension_resource_callback_cpptoc.h',
|
'libcef_dll/cpptoc/get_extension_resource_callback_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/image_cpptoc.cc',
|
'libcef_dll/cpptoc/image_cpptoc.cc',
|
||||||
@@ -614,8 +610,6 @@
|
|||||||
'libcef_dll/cpptoc/focus_handler_cpptoc.h',
|
'libcef_dll/cpptoc/focus_handler_cpptoc.h',
|
||||||
'libcef_dll/ctocpp/frame_ctocpp.cc',
|
'libcef_dll/ctocpp/frame_ctocpp.cc',
|
||||||
'libcef_dll/ctocpp/frame_ctocpp.h',
|
'libcef_dll/ctocpp/frame_ctocpp.h',
|
||||||
'libcef_dll/cpptoc/frame_handler_cpptoc.cc',
|
|
||||||
'libcef_dll/cpptoc/frame_handler_cpptoc.h',
|
|
||||||
'libcef_dll/ctocpp/get_extension_resource_callback_ctocpp.cc',
|
'libcef_dll/ctocpp/get_extension_resource_callback_ctocpp.cc',
|
||||||
'libcef_dll/ctocpp/get_extension_resource_callback_ctocpp.h',
|
'libcef_dll/ctocpp/get_extension_resource_callback_ctocpp.h',
|
||||||
'libcef_dll/ctocpp/image_ctocpp.cc',
|
'libcef_dll/ctocpp/image_ctocpp.cc',
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
'include/base/cef_platform_thread.h',
|
'include/base/cef_platform_thread.h',
|
||||||
'include/base/cef_ref_counted.h',
|
'include/base/cef_ref_counted.h',
|
||||||
'include/base/cef_scoped_ptr.h',
|
'include/base/cef_scoped_ptr.h',
|
||||||
|
'include/base/cef_string16.h',
|
||||||
'include/base/cef_template_util.h',
|
'include/base/cef_template_util.h',
|
||||||
'include/base/cef_thread_checker.h',
|
'include/base/cef_thread_checker.h',
|
||||||
'include/base/cef_trace_event.h',
|
'include/base/cef_trace_event.h',
|
||||||
@@ -127,6 +128,7 @@
|
|||||||
'libcef_dll/base/cef_lock_impl.cc',
|
'libcef_dll/base/cef_lock_impl.cc',
|
||||||
'libcef_dll/base/cef_logging.cc',
|
'libcef_dll/base/cef_logging.cc',
|
||||||
'libcef_dll/base/cef_ref_counted.cc',
|
'libcef_dll/base/cef_ref_counted.cc',
|
||||||
|
'libcef_dll/base/cef_string16.cc',
|
||||||
'libcef_dll/base/cef_thread_checker_impl.cc',
|
'libcef_dll/base/cef_thread_checker_impl.cc',
|
||||||
'libcef_dll/base/cef_weak_ptr.cc',
|
'libcef_dll/base/cef_weak_ptr.cc',
|
||||||
],
|
],
|
||||||
@@ -471,7 +473,6 @@
|
|||||||
'tests/ceftests/extensions/extension_test_handler.h',
|
'tests/ceftests/extensions/extension_test_handler.h',
|
||||||
'tests/ceftests/extensions/view_unittest.cc',
|
'tests/ceftests/extensions/view_unittest.cc',
|
||||||
'tests/ceftests/file_util_unittest.cc',
|
'tests/ceftests/file_util_unittest.cc',
|
||||||
'tests/ceftests/frame_handler_unittest.cc',
|
|
||||||
'tests/ceftests/frame_unittest.cc',
|
'tests/ceftests/frame_unittest.cc',
|
||||||
'tests/ceftests/image_unittest.cc',
|
'tests/ceftests/image_unittest.cc',
|
||||||
'tests/ceftests/image_util.cc',
|
'tests/ceftests/image_util.cc',
|
||||||
|
@@ -75,6 +75,7 @@ typedef unsigned short uint16;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// UTF-16 character type.
|
// UTF-16 character type.
|
||||||
|
// This should be kept synchronized with base/strings/string16.h
|
||||||
#ifndef char16
|
#ifndef char16
|
||||||
#if defined(WCHAR_T_IS_UTF16)
|
#if defined(WCHAR_T_IS_UTF16)
|
||||||
typedef wchar_t char16;
|
typedef wchar_t char16;
|
||||||
|
223
include/base/cef_string16.h
Normal file
223
include/base/cef_string16.h
Normal file
@@ -0,0 +1,223 @@
|
|||||||
|
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2013
|
||||||
|
// Google Inc. 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.
|
||||||
|
|
||||||
|
#ifndef CEF_INCLUDE_BASE_CEF_STRING16_H_
|
||||||
|
#define CEF_INCLUDE_BASE_CEF_STRING16_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if defined(BASE_STRINGS_STRING16_H_)
|
||||||
|
// Do nothing if the Chromium header has already been included.
|
||||||
|
// This can happen in cases where Chromium code is used directly by the
|
||||||
|
// client application. When using Chromium code directly always include
|
||||||
|
// the Chromium header first to avoid type conflicts.
|
||||||
|
#elif defined(USING_CHROMIUM_INCLUDES)
|
||||||
|
// When building CEF include the Chromium header directly.
|
||||||
|
#include "base/strings/string16.h"
|
||||||
|
#else // !USING_CHROMIUM_INCLUDES
|
||||||
|
// The following is substantially similar to the Chromium implementation.
|
||||||
|
// If the Chromium implementation diverges the below implementation should be
|
||||||
|
// updated to match.
|
||||||
|
// WHAT:
|
||||||
|
// A version of std::basic_string that provides 2-byte characters even when
|
||||||
|
// wchar_t is not implemented as a 2-byte type. You can access this class as
|
||||||
|
// string16. We also define char16, which string16 is based upon.
|
||||||
|
//
|
||||||
|
// WHY:
|
||||||
|
// On Windows, wchar_t is 2 bytes, and it can conveniently handle UTF-16/UCS-2
|
||||||
|
// data. Plenty of existing code operates on strings encoded as UTF-16.
|
||||||
|
//
|
||||||
|
// On many other platforms, sizeof(wchar_t) is 4 bytes by default. We can make
|
||||||
|
// it 2 bytes by using the GCC flag -fshort-wchar. But then std::wstring fails
|
||||||
|
// at run time, because it calls some functions (like wcslen) that come from
|
||||||
|
// the system's native C library -- which was built with a 4-byte wchar_t!
|
||||||
|
// It's wasteful to use 4-byte wchar_t strings to carry UTF-16 data, and it's
|
||||||
|
// entirely improper on those systems where the encoding of wchar_t is defined
|
||||||
|
// as UTF-32.
|
||||||
|
//
|
||||||
|
// Here, we define string16, which is similar to std::wstring but replaces all
|
||||||
|
// libc functions with custom, 2-byte-char compatible routines. It is capable
|
||||||
|
// of carrying UTF-16-encoded data.
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "include/base/cef_basictypes.h"
|
||||||
|
|
||||||
|
#if defined(WCHAR_T_IS_UTF16)
|
||||||
|
|
||||||
|
namespace base {
|
||||||
|
|
||||||
|
typedef wchar_t char16;
|
||||||
|
typedef std::wstring string16;
|
||||||
|
typedef std::char_traits<wchar_t> string16_char_traits;
|
||||||
|
|
||||||
|
} // namespace base
|
||||||
|
|
||||||
|
#elif defined(WCHAR_T_IS_UTF32)
|
||||||
|
|
||||||
|
#include <stdint.h> // For uint16_t
|
||||||
|
|
||||||
|
#include "include/base/cef_macros.h"
|
||||||
|
|
||||||
|
namespace cef {
|
||||||
|
namespace base {
|
||||||
|
|
||||||
|
typedef uint16_t char16;
|
||||||
|
|
||||||
|
// char16 versions of the functions required by string16_char_traits; these
|
||||||
|
// are based on the wide character functions of similar names ("w" or "wcs"
|
||||||
|
// instead of "c16").
|
||||||
|
int c16memcmp(const char16* s1, const char16* s2, size_t n);
|
||||||
|
size_t c16len(const char16* s);
|
||||||
|
const char16* c16memchr(const char16* s, char16 c, size_t n);
|
||||||
|
char16* c16memmove(char16* s1, const char16* s2, size_t n);
|
||||||
|
char16* c16memcpy(char16* s1, const char16* s2, size_t n);
|
||||||
|
char16* c16memset(char16* s, char16 c, size_t n);
|
||||||
|
|
||||||
|
struct string16_char_traits {
|
||||||
|
typedef char16 char_type;
|
||||||
|
typedef int int_type;
|
||||||
|
|
||||||
|
// int_type needs to be able to hold each possible value of char_type, and in
|
||||||
|
// addition, the distinct value of eof().
|
||||||
|
COMPILE_ASSERT(sizeof(int_type) > sizeof(char_type), unexpected_type_width);
|
||||||
|
|
||||||
|
typedef std::streamoff off_type;
|
||||||
|
typedef mbstate_t state_type;
|
||||||
|
typedef std::fpos<state_type> pos_type;
|
||||||
|
|
||||||
|
static void assign(char_type& c1, const char_type& c2) { c1 = c2; }
|
||||||
|
|
||||||
|
static bool eq(const char_type& c1, const char_type& c2) { return c1 == c2; }
|
||||||
|
static bool lt(const char_type& c1, const char_type& c2) { return c1 < c2; }
|
||||||
|
|
||||||
|
static int compare(const char_type* s1, const char_type* s2, size_t n) {
|
||||||
|
return c16memcmp(s1, s2, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
static size_t length(const char_type* s) { return c16len(s); }
|
||||||
|
|
||||||
|
static const char_type* find(const char_type* s,
|
||||||
|
size_t n,
|
||||||
|
const char_type& a) {
|
||||||
|
return c16memchr(s, a, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
static char_type* move(char_type* s1, const char_type* s2, int_type n) {
|
||||||
|
return c16memmove(s1, s2, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
static char_type* copy(char_type* s1, const char_type* s2, size_t n) {
|
||||||
|
return c16memcpy(s1, s2, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
static char_type* assign(char_type* s, size_t n, char_type a) {
|
||||||
|
return c16memset(s, a, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int_type not_eof(const int_type& c) {
|
||||||
|
return eq_int_type(c, eof()) ? 0 : c;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char_type to_char_type(const int_type& c) { return char_type(c); }
|
||||||
|
|
||||||
|
static int_type to_int_type(const char_type& c) { return int_type(c); }
|
||||||
|
|
||||||
|
static bool eq_int_type(const int_type& c1, const int_type& c2) {
|
||||||
|
return c1 == c2;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int_type eof() { return static_cast<int_type>(EOF); }
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::basic_string<char16, string16_char_traits> string16;
|
||||||
|
|
||||||
|
} // namespace base
|
||||||
|
} // namespace cef
|
||||||
|
|
||||||
|
namespace base {
|
||||||
|
|
||||||
|
typedef cef::base::char16 char16;
|
||||||
|
typedef cef::base::string16 string16;
|
||||||
|
|
||||||
|
extern std::ostream& operator<<(std::ostream& out, const string16& str);
|
||||||
|
|
||||||
|
// This is required by googletest to print a readable output on test failures.
|
||||||
|
extern void PrintTo(const string16& str, std::ostream* out);
|
||||||
|
|
||||||
|
} // namespace base
|
||||||
|
|
||||||
|
// The string class will be explicitly instantiated only once, in string16.cc.
|
||||||
|
//
|
||||||
|
// std::basic_string<> in GNU libstdc++ contains a static data member,
|
||||||
|
// _S_empty_rep_storage, to represent empty strings. When an operation such
|
||||||
|
// as assignment or destruction is performed on a string, causing its existing
|
||||||
|
// data member to be invalidated, it must not be freed if this static data
|
||||||
|
// member is being used. Otherwise, it counts as an attempt to free static
|
||||||
|
// (and not allocated) data, which is a memory error.
|
||||||
|
//
|
||||||
|
// Generally, due to C++ template magic, _S_empty_rep_storage will be marked
|
||||||
|
// as a coalesced symbol, meaning that the linker will combine multiple
|
||||||
|
// instances into a single one when generating output.
|
||||||
|
//
|
||||||
|
// If a string class is used by multiple shared libraries, a problem occurs.
|
||||||
|
// Each library will get its own copy of _S_empty_rep_storage. When strings
|
||||||
|
// are passed across a library boundary for alteration or destruction, memory
|
||||||
|
// errors will result. GNU libstdc++ contains a configuration option,
|
||||||
|
// --enable-fully-dynamic-string (_GLIBCXX_FULLY_DYNAMIC_STRING), which
|
||||||
|
// disables the static data member optimization, but it's a good optimization
|
||||||
|
// and non-STL code is generally at the mercy of the system's STL
|
||||||
|
// configuration. Fully-dynamic strings are not the default for GNU libstdc++
|
||||||
|
// libstdc++ itself or for the libstdc++ installations on the systems we care
|
||||||
|
// about, such as Mac OS X and relevant flavors of Linux.
|
||||||
|
//
|
||||||
|
// See also http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24196 .
|
||||||
|
//
|
||||||
|
// To avoid problems, string classes need to be explicitly instantiated only
|
||||||
|
// once, in exactly one library. All other string users see it via an "extern"
|
||||||
|
// declaration. This is precisely how GNU libstdc++ handles
|
||||||
|
// std::basic_string<char> (string) and std::basic_string<wchar_t> (wstring).
|
||||||
|
//
|
||||||
|
// This also works around a Mac OS X linker bug in ld64-85.2.1 (Xcode 3.1.2),
|
||||||
|
// in which the linker does not fully coalesce symbols when dead code
|
||||||
|
// stripping is enabled. This bug causes the memory errors described above
|
||||||
|
// to occur even when a std::basic_string<> does not cross shared library
|
||||||
|
// boundaries, such as in statically-linked executables.
|
||||||
|
//
|
||||||
|
// TODO(mark): File this bug with Apple and update this note with a bug number.
|
||||||
|
|
||||||
|
extern template class std::basic_string<cef::base::char16,
|
||||||
|
cef::base::string16_char_traits>;
|
||||||
|
|
||||||
|
#endif // WCHAR_T_IS_UTF32
|
||||||
|
|
||||||
|
#endif // !USING_CHROMIUM_INCLUDES
|
||||||
|
|
||||||
|
#endif // CEF_INCLUDE_BASE_CEF_STRING16_H_
|
@@ -33,7 +33,7 @@
|
|||||||
// by hand. See the translator.README.txt file in the tools directory for
|
// by hand. See the translator.README.txt file in the tools directory for
|
||||||
// more information.
|
// more information.
|
||||||
//
|
//
|
||||||
// $hash=6e192c6e8a59c37e98e458578a287dd36b8ed90f$
|
// $hash=09b6ebd4116e983b4af634f1efa17b326a3fc517$
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_
|
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_
|
||||||
@@ -57,10 +57,10 @@ struct _cef_browser_host_t;
|
|||||||
struct _cef_client_t;
|
struct _cef_client_t;
|
||||||
|
|
||||||
///
|
///
|
||||||
// Structure used to represent a browser. When used in the browser process the
|
// Structure used to represent a browser window. When used in the browser
|
||||||
// functions of this structure may be called on any thread unless otherwise
|
// process the functions of this structure may be called on any thread unless
|
||||||
// indicated in the comments. When used in the render process the functions of
|
// otherwise indicated in the comments. When used in the render process the
|
||||||
// this structure may only be called on the main thread.
|
// functions of this structure may only be called on the main thread.
|
||||||
///
|
///
|
||||||
typedef struct _cef_browser_t {
|
typedef struct _cef_browser_t {
|
||||||
///
|
///
|
||||||
@@ -68,12 +68,6 @@ typedef struct _cef_browser_t {
|
|||||||
///
|
///
|
||||||
cef_base_ref_counted_t base;
|
cef_base_ref_counted_t base;
|
||||||
|
|
||||||
///
|
|
||||||
// True if this object is currently valid. This will return false (0) after
|
|
||||||
// cef_life_span_handler_t::OnBeforeClose is called.
|
|
||||||
///
|
|
||||||
int(CEF_CALLBACK* is_valid)(struct _cef_browser_t* self);
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Returns the browser host object. This function can only be called in the
|
// Returns the browser host object. This function can only be called in the
|
||||||
// browser process.
|
// browser process.
|
||||||
@@ -135,7 +129,7 @@ typedef struct _cef_browser_t {
|
|||||||
struct _cef_browser_t* that);
|
struct _cef_browser_t* that);
|
||||||
|
|
||||||
///
|
///
|
||||||
// Returns true (1) if the browser is a popup.
|
// Returns true (1) if the window is a popup window.
|
||||||
///
|
///
|
||||||
int(CEF_CALLBACK* is_popup)(struct _cef_browser_t* self);
|
int(CEF_CALLBACK* is_popup)(struct _cef_browser_t* self);
|
||||||
|
|
||||||
@@ -145,19 +139,13 @@ typedef struct _cef_browser_t {
|
|||||||
int(CEF_CALLBACK* has_document)(struct _cef_browser_t* self);
|
int(CEF_CALLBACK* has_document)(struct _cef_browser_t* self);
|
||||||
|
|
||||||
///
|
///
|
||||||
// Returns the main (top-level) frame for the browser. In the browser process
|
// Returns the main (top-level) frame for the browser window.
|
||||||
// this will return a valid object until after
|
|
||||||
// cef_life_span_handler_t::OnBeforeClose is called. In the renderer process
|
|
||||||
// this will return NULL if the main frame is hosted in a different renderer
|
|
||||||
// process (e.g. for cross-origin sub-frames). The main frame object will
|
|
||||||
// change during cross-origin navigation or re-navigation after renderer
|
|
||||||
// process termination (due to crashes, etc).
|
|
||||||
///
|
///
|
||||||
struct _cef_frame_t*(CEF_CALLBACK* get_main_frame)(
|
struct _cef_frame_t*(CEF_CALLBACK* get_main_frame)(
|
||||||
struct _cef_browser_t* self);
|
struct _cef_browser_t* self);
|
||||||
|
|
||||||
///
|
///
|
||||||
// Returns the focused frame for the browser.
|
// Returns the focused frame for the browser window.
|
||||||
///
|
///
|
||||||
struct _cef_frame_t*(CEF_CALLBACK* get_focused_frame)(
|
struct _cef_frame_t*(CEF_CALLBACK* get_focused_frame)(
|
||||||
struct _cef_browser_t* self);
|
struct _cef_browser_t* self);
|
||||||
@@ -286,10 +274,10 @@ typedef struct _cef_download_image_callback_t {
|
|||||||
} cef_download_image_callback_t;
|
} cef_download_image_callback_t;
|
||||||
|
|
||||||
///
|
///
|
||||||
// Structure used to represent the browser process aspects of a browser. The
|
// Structure used to represent the browser process aspects of a browser window.
|
||||||
// functions of this structure can only be called in the browser process. They
|
// The functions of this structure can only be called in the browser process.
|
||||||
// may be called on any thread in that process unless otherwise indicated in the
|
// They may be called on any thread in that process unless otherwise indicated
|
||||||
// comments.
|
// in the comments.
|
||||||
///
|
///
|
||||||
typedef struct _cef_browser_host_t {
|
typedef struct _cef_browser_host_t {
|
||||||
///
|
///
|
||||||
@@ -318,12 +306,11 @@ typedef struct _cef_browser_host_t {
|
|||||||
|
|
||||||
///
|
///
|
||||||
// Helper for closing a browser. Call this function from the top-level window
|
// Helper for closing a browser. Call this function from the top-level window
|
||||||
// close handler (if any). Internally this calls CloseBrowser(false (0)) if
|
// close handler. Internally this calls CloseBrowser(false (0)) if the close
|
||||||
// the close has not yet been initiated. This function returns false (0) while
|
// has not yet been initiated. This function returns false (0) while the close
|
||||||
// the close is pending and true (1) after the close has completed. See
|
// is pending and true (1) after the close has completed. See close_browser()
|
||||||
// close_browser() and cef_life_span_handler_t::do_close() documentation for
|
// and cef_life_span_handler_t::do_close() documentation for additional usage
|
||||||
// additional usage information. This function must be called on the browser
|
// information. This function must be called on the browser process UI thread.
|
||||||
// process UI thread.
|
|
||||||
///
|
///
|
||||||
int(CEF_CALLBACK* try_close_browser)(struct _cef_browser_host_t* self);
|
int(CEF_CALLBACK* try_close_browser)(struct _cef_browser_host_t* self);
|
||||||
|
|
||||||
@@ -333,19 +320,18 @@ typedef struct _cef_browser_host_t {
|
|||||||
void(CEF_CALLBACK* set_focus)(struct _cef_browser_host_t* self, int focus);
|
void(CEF_CALLBACK* set_focus)(struct _cef_browser_host_t* self, int focus);
|
||||||
|
|
||||||
///
|
///
|
||||||
// Retrieve the window handle (if any) for this browser. If this browser is
|
// Retrieve the window handle for this browser. If this browser is wrapped in
|
||||||
// wrapped in a cef_browser_view_t this function should be called on the
|
// a cef_browser_view_t this function should be called on the browser process
|
||||||
// browser process UI thread and it will return the handle for the top-level
|
// UI thread and it will return the handle for the top-level native window.
|
||||||
// native window.
|
|
||||||
///
|
///
|
||||||
cef_window_handle_t(CEF_CALLBACK* get_window_handle)(
|
cef_window_handle_t(CEF_CALLBACK* get_window_handle)(
|
||||||
struct _cef_browser_host_t* self);
|
struct _cef_browser_host_t* self);
|
||||||
|
|
||||||
///
|
///
|
||||||
// Retrieve the window handle (if any) of the browser that opened this
|
// Retrieve the window handle of the browser that opened this browser. Will
|
||||||
// browser. Will return NULL for non-popup browsers or if this browser is
|
// return NULL for non-popup windows or if this browser is wrapped in a
|
||||||
// wrapped in a cef_browser_view_t. This function can be used in combination
|
// cef_browser_view_t. This function can be used in combination with custom
|
||||||
// with custom handling of modal windows.
|
// handling of modal windows.
|
||||||
///
|
///
|
||||||
cef_window_handle_t(CEF_CALLBACK* get_opener_window_handle)(
|
cef_window_handle_t(CEF_CALLBACK* get_opener_window_handle)(
|
||||||
struct _cef_browser_host_t* self);
|
struct _cef_browser_host_t* self);
|
||||||
@@ -923,9 +909,9 @@ typedef struct _cef_browser_host_t {
|
|||||||
} cef_browser_host_t;
|
} cef_browser_host_t;
|
||||||
|
|
||||||
///
|
///
|
||||||
// Create a new browser using the window parameters specified by |windowInfo|.
|
// Create a new browser window using the window parameters specified by
|
||||||
// All values will be copied internally and the actual window (if any) will be
|
// |windowInfo|. All values will be copied internally and the actual window will
|
||||||
// created on the UI thread. If |request_context| is NULL the global request
|
// be created on the UI thread. If |request_context| is NULL the global request
|
||||||
// context will be used. This function can be called on any browser process
|
// context will be used. This function can be called on any browser process
|
||||||
// thread and will not block. The optional |extra_info| parameter provides an
|
// thread and will not block. The optional |extra_info| parameter provides an
|
||||||
// opportunity to specify extra information specific to the created browser that
|
// opportunity to specify extra information specific to the created browser that
|
||||||
@@ -941,11 +927,11 @@ CEF_EXPORT int cef_browser_host_create_browser(
|
|||||||
struct _cef_request_context_t* request_context);
|
struct _cef_request_context_t* request_context);
|
||||||
|
|
||||||
///
|
///
|
||||||
// Create a new browser using the window parameters specified by |windowInfo|.
|
// Create a new browser window using the window parameters specified by
|
||||||
// If |request_context| is NULL the global request context will be used. This
|
// |windowInfo|. If |request_context| is NULL the global request context will be
|
||||||
// function can only be called on the browser process UI thread. The optional
|
// used. This function can only be called on the browser process UI thread. The
|
||||||
// |extra_info| parameter provides an opportunity to specify extra information
|
// optional |extra_info| parameter provides an opportunity to specify extra
|
||||||
// specific to the created browser that will be passed to
|
// information specific to the created browser that will be passed to
|
||||||
// cef_render_process_handler_t::on_browser_created() in the render process.
|
// cef_render_process_handler_t::on_browser_created() in the render process.
|
||||||
///
|
///
|
||||||
CEF_EXPORT cef_browser_t* cef_browser_host_create_browser_sync(
|
CEF_EXPORT cef_browser_t* cef_browser_host_create_browser_sync(
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
// by hand. See the translator.README.txt file in the tools directory for
|
// by hand. See the translator.README.txt file in the tools directory for
|
||||||
// more information.
|
// more information.
|
||||||
//
|
//
|
||||||
// $hash=845a1d1dda63a06f4ae33ed39acfd2599b46a885$
|
// $hash=14eca959988209ba8f95037a47192fd50d64f2f1$
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_
|
#ifndef CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_
|
||||||
@@ -49,7 +49,6 @@
|
|||||||
#include "include/capi/cef_drag_handler_capi.h"
|
#include "include/capi/cef_drag_handler_capi.h"
|
||||||
#include "include/capi/cef_find_handler_capi.h"
|
#include "include/capi/cef_find_handler_capi.h"
|
||||||
#include "include/capi/cef_focus_handler_capi.h"
|
#include "include/capi/cef_focus_handler_capi.h"
|
||||||
#include "include/capi/cef_frame_handler_capi.h"
|
|
||||||
#include "include/capi/cef_jsdialog_handler_capi.h"
|
#include "include/capi/cef_jsdialog_handler_capi.h"
|
||||||
#include "include/capi/cef_keyboard_handler_capi.h"
|
#include "include/capi/cef_keyboard_handler_capi.h"
|
||||||
#include "include/capi/cef_life_span_handler_capi.h"
|
#include "include/capi/cef_life_span_handler_capi.h"
|
||||||
@@ -123,14 +122,6 @@ typedef struct _cef_client_t {
|
|||||||
struct _cef_focus_handler_t*(CEF_CALLBACK* get_focus_handler)(
|
struct _cef_focus_handler_t*(CEF_CALLBACK* get_focus_handler)(
|
||||||
struct _cef_client_t* self);
|
struct _cef_client_t* self);
|
||||||
|
|
||||||
///
|
|
||||||
// Return the handler for events related to cef_frame_t lifespan. This
|
|
||||||
// function will be called once during cef_browser_t creation and the result
|
|
||||||
// will be cached for performance reasons.
|
|
||||||
///
|
|
||||||
struct _cef_frame_handler_t*(CEF_CALLBACK* get_frame_handler)(
|
|
||||||
struct _cef_client_t* self);
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Return the handler for JavaScript dialogs. If no handler is provided the
|
// Return the handler for JavaScript dialogs. If no handler is provided the
|
||||||
// default implementation will be used.
|
// default implementation will be used.
|
||||||
@@ -177,8 +168,8 @@ typedef struct _cef_client_t {
|
|||||||
|
|
||||||
///
|
///
|
||||||
// Called when a new message is received from a different process. Return true
|
// Called when a new message is received from a different process. Return true
|
||||||
// (1) if the message was handled or false (0) otherwise. It is safe to keep
|
// (1) if the message was handled or false (0) otherwise. Do not keep a
|
||||||
// a reference to |message| outside of this callback.
|
// reference to or attempt to access the message outside of this callback.
|
||||||
///
|
///
|
||||||
int(CEF_CALLBACK* on_process_message_received)(
|
int(CEF_CALLBACK* on_process_message_received)(
|
||||||
struct _cef_client_t* self,
|
struct _cef_client_t* self,
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
// by hand. See the translator.README.txt file in the tools directory for
|
// by hand. See the translator.README.txt file in the tools directory for
|
||||||
// more information.
|
// more information.
|
||||||
//
|
//
|
||||||
// $hash=872fd1e811d41f56f03da0da75a8f2e89cad40cd$
|
// $hash=bce865a34f45e6dee8f413f0d6bd7f4c37ab55c0$
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef CEF_INCLUDE_CAPI_CEF_FRAME_CAPI_H_
|
#ifndef CEF_INCLUDE_CAPI_CEF_FRAME_CAPI_H_
|
||||||
@@ -242,12 +242,10 @@ typedef struct _cef_frame_t {
|
|||||||
struct _cef_urlrequest_client_t* client);
|
struct _cef_urlrequest_client_t* client);
|
||||||
|
|
||||||
///
|
///
|
||||||
// Send a message to the specified |target_process|. Ownership of the message
|
// Send a message to the specified |target_process|. Message delivery is not
|
||||||
// contents will be transferred and the |message| reference will be
|
// guaranteed in all cases (for example, if the browser is closing,
|
||||||
// invalidated. Message delivery is not guaranteed in all cases (for example,
|
// navigating, or if the target process crashes). Send an ACK message back
|
||||||
// if the browser is closing, navigating, or if the target process crashes).
|
// from the target process if confirmation is required.
|
||||||
// Send an ACK message back from the target process if confirmation is
|
|
||||||
// required.
|
|
||||||
///
|
///
|
||||||
void(CEF_CALLBACK* send_process_message)(
|
void(CEF_CALLBACK* send_process_message)(
|
||||||
struct _cef_frame_t* self,
|
struct _cef_frame_t* self,
|
||||||
|
@@ -1,191 +0,0 @@
|
|||||||
// Copyright (c) 2021 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=503984bf98aa52ff67ce52f26a560bbb1d4439bc$
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef CEF_INCLUDE_CAPI_CEF_FRAME_HANDLER_CAPI_H_
|
|
||||||
#define CEF_INCLUDE_CAPI_CEF_FRAME_HANDLER_CAPI_H_
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "include/capi/cef_base_capi.h"
|
|
||||||
#include "include/capi/cef_browser_capi.h"
|
|
||||||
#include "include/capi/cef_frame_capi.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
///
|
|
||||||
// Implement this structure to handle events related to cef_frame_t life span.
|
|
||||||
// The order of callbacks is:
|
|
||||||
//
|
|
||||||
// (1) During initial cef_browser_host_t creation and navigation of the main
|
|
||||||
// frame: - cef_frame_handler_t::OnFrameCreated => The initial main frame object
|
|
||||||
// has been
|
|
||||||
// created. Any commands will be queued until the frame is attached.
|
|
||||||
// - cef_frame_handler_t::OnMainFrameChanged => The initial main frame object
|
|
||||||
// has
|
|
||||||
// been assigned to the browser.
|
|
||||||
// - cef_life_span_handler_t::OnAfterCreated => The browser is now valid and can
|
|
||||||
// be
|
|
||||||
// used.
|
|
||||||
// - cef_frame_handler_t::OnFrameAttached => The initial main frame object is
|
|
||||||
// now
|
|
||||||
// connected to its peer in the renderer process. Commands can be routed.
|
|
||||||
//
|
|
||||||
// (2) During further cef_browser_host_t navigation/loading of the main frame
|
|
||||||
// and/or sub-frames: - cef_frame_handler_t::OnFrameCreated => A new main frame
|
|
||||||
// or sub-frame object has
|
|
||||||
// been created. Any commands will be queued until the frame is attached.
|
|
||||||
// - cef_frame_handler_t::OnFrameAttached => A new main frame or sub-frame
|
|
||||||
// object is
|
|
||||||
// now connected to its peer in the renderer process. Commands can be routed.
|
|
||||||
// - cef_frame_handler_t::OnFrameDetached => An existing main frame or sub-frame
|
|
||||||
// object has lost its connection to the renderer process. If multiple objects
|
|
||||||
// are detached at the same time then notifications will be sent for any
|
|
||||||
// sub-frame objects before the main frame object. Commands can no longer be
|
|
||||||
// routed and will be discarded.
|
|
||||||
// - cef_frame_handler_t::OnMainFrameChanged => A new main frame object has been
|
|
||||||
// assigned to the browser. This will only occur with cross-origin navigation
|
|
||||||
// or re-navigation after renderer process termination (due to crashes, etc).
|
|
||||||
//
|
|
||||||
// (3) During final cef_browser_host_t destruction of the main frame: -
|
|
||||||
// cef_frame_handler_t::OnFrameDetached => Any sub-frame objects have lost their
|
|
||||||
// connection to the renderer process. Commands can no longer be routed and
|
|
||||||
// will be discarded.
|
|
||||||
// - cef_life_span_handler_t::OnBeforeClose => The browser has been destroyed. -
|
|
||||||
// cef_frame_handler_t::OnFrameDetached => The main frame object have lost its
|
|
||||||
// connection to the renderer process. Notifications will be sent for any
|
|
||||||
// sub-frame objects before the main frame object. Commands can no longer be
|
|
||||||
// routed and will be discarded.
|
|
||||||
// - cef_frame_handler_t::OnMainFrameChanged => The final main frame object has
|
|
||||||
// been
|
|
||||||
// removed from the browser.
|
|
||||||
//
|
|
||||||
// Cross-origin navigation and/or loading receives special handling.
|
|
||||||
//
|
|
||||||
// When the main frame navigates to a different origin the OnMainFrameChanged
|
|
||||||
// callback (2) will be executed with the old and new main frame objects.
|
|
||||||
//
|
|
||||||
// When a new sub-frame is loaded in, or an existing sub-frame is navigated to,
|
|
||||||
// a different origin from the parent frame, a temporary sub-frame object will
|
|
||||||
// first be created in the parent's renderer process. That temporary sub-frame
|
|
||||||
// will then be discarded after the real cross-origin sub-frame is created in
|
|
||||||
// the new/target renderer process. The client will receive cross-origin
|
|
||||||
// navigation callbacks (2) for the transition from the temporary sub-frame to
|
|
||||||
// the real sub-frame. The temporary sub-frame will not recieve or execute
|
|
||||||
// commands during this transitional period (any sent commands will be
|
|
||||||
// discarded).
|
|
||||||
//
|
|
||||||
// When a new popup browser is created in a different origin from the parent
|
|
||||||
// browser, a temporary main frame object for the popup will first be created in
|
|
||||||
// the parent's renderer process. That temporary main frame will then be
|
|
||||||
// discarded after the real cross-origin main frame is created in the new/target
|
|
||||||
// renderer process. The client will recieve creation and initial navigation
|
|
||||||
// callbacks (1) for the temporary main frame, followed by cross-origin
|
|
||||||
// navigation callbacks (2) for the transition from the temporary main frame to
|
|
||||||
// the real main frame. The temporary main frame may receive and execute
|
|
||||||
// commands during this transitional period (any sent commands may be executed,
|
|
||||||
// but the behavior is potentially undesirable since they execute in the parent
|
|
||||||
// browser's renderer process and not the new/target renderer process).
|
|
||||||
//
|
|
||||||
// Callbacks will not be executed for placeholders that may be created during
|
|
||||||
// pre-commit navigation for sub-frames that do not yet exist in the renderer
|
|
||||||
// process. Placeholders will have cef_frame_t::get_identifier() == -4.
|
|
||||||
//
|
|
||||||
// The functions of this structure will be called on the UI thread unless
|
|
||||||
// otherwise indicated.
|
|
||||||
///
|
|
||||||
typedef struct _cef_frame_handler_t {
|
|
||||||
///
|
|
||||||
// Base structure.
|
|
||||||
///
|
|
||||||
cef_base_ref_counted_t base;
|
|
||||||
|
|
||||||
///
|
|
||||||
// Called when a new frame is created. This will be the first notification
|
|
||||||
// that references |frame|. Any commands that require transport to the
|
|
||||||
// associated renderer process (LoadRequest, SendProcessMessage, GetSource,
|
|
||||||
// etc.) will be queued until OnFrameAttached is called for |frame|.
|
|
||||||
///
|
|
||||||
void(CEF_CALLBACK* on_frame_created)(struct _cef_frame_handler_t* self,
|
|
||||||
struct _cef_browser_t* browser,
|
|
||||||
struct _cef_frame_t* frame);
|
|
||||||
|
|
||||||
///
|
|
||||||
// Called when a frame can begin routing commands to/from the associated
|
|
||||||
// renderer process. Any commands that were queued have now been dispatched.
|
|
||||||
///
|
|
||||||
void(CEF_CALLBACK* on_frame_attached)(struct _cef_frame_handler_t* self,
|
|
||||||
struct _cef_browser_t* browser,
|
|
||||||
struct _cef_frame_t* frame);
|
|
||||||
|
|
||||||
///
|
|
||||||
// Called when a frame loses its connection to the renderer process and will
|
|
||||||
// be destroyed. Any pending or future commands will be discarded and
|
|
||||||
// cef_frame_t::is_valid() will now return false (0) for |frame|. If called
|
|
||||||
// after cef_life_span_handler_t::on_before_close() during browser destruction
|
|
||||||
// then cef_browser_t::is_valid() will return false (0) for |browser|.
|
|
||||||
///
|
|
||||||
void(CEF_CALLBACK* on_frame_detached)(struct _cef_frame_handler_t* self,
|
|
||||||
struct _cef_browser_t* browser,
|
|
||||||
struct _cef_frame_t* frame);
|
|
||||||
|
|
||||||
///
|
|
||||||
// Called when the main frame changes due to (a) initial browser creation, (b)
|
|
||||||
// final browser destruction, (c) cross-origin navigation or (d) re-navigation
|
|
||||||
// after renderer process termination (due to crashes, etc). |old_frame| will
|
|
||||||
// be NULL and |new_frame| will be non-NULL when a main frame is assigned to
|
|
||||||
// |browser| for the first time. |old_frame| will be non-NULL and |new_frame|
|
|
||||||
// will be NULL and when a main frame is removed from |browser| for the last
|
|
||||||
// time. Both |old_frame| and |new_frame| will be non-NULL for cross-origin
|
|
||||||
// navigations or re-navigation after renderer process termination. This
|
|
||||||
// function will be called after on_frame_created() for |new_frame| and/or
|
|
||||||
// after on_frame_detached() for |old_frame|. If called after
|
|
||||||
// cef_life_span_handler_t::on_before_close() during browser destruction then
|
|
||||||
// cef_browser_t::is_valid() will return false (0) for |browser|.
|
|
||||||
///
|
|
||||||
void(CEF_CALLBACK* on_main_frame_changed)(struct _cef_frame_handler_t* self,
|
|
||||||
struct _cef_browser_t* browser,
|
|
||||||
struct _cef_frame_t* old_frame,
|
|
||||||
struct _cef_frame_t* new_frame);
|
|
||||||
} cef_frame_handler_t;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // CEF_INCLUDE_CAPI_CEF_FRAME_HANDLER_CAPI_H_
|
|
@@ -33,7 +33,7 @@
|
|||||||
// by hand. See the translator.README.txt file in the tools directory for
|
// by hand. See the translator.README.txt file in the tools directory for
|
||||||
// more information.
|
// more information.
|
||||||
//
|
//
|
||||||
// $hash=e44bb89a337942c82bfa246275b4b033821b2782$
|
// $hash=d7521ac4f73dabd876344400a165d15954c770b0$
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef CEF_INCLUDE_CAPI_CEF_LIFE_SPAN_HANDLER_CAPI_H_
|
#ifndef CEF_INCLUDE_CAPI_CEF_LIFE_SPAN_HANDLER_CAPI_H_
|
||||||
@@ -101,10 +101,8 @@ typedef struct _cef_life_span_handler_t {
|
|||||||
int* no_javascript_access);
|
int* no_javascript_access);
|
||||||
|
|
||||||
///
|
///
|
||||||
// Called after a new browser is created. It is now safe to begin performing
|
// Called after a new browser is created. This callback will be the first
|
||||||
// actions with |browser|. cef_frame_handler_t callbacks related to initial
|
// notification that references |browser|.
|
||||||
// main frame creation will arrive before this callback. See
|
|
||||||
// cef_frame_handler_t documentation for additional usage information.
|
|
||||||
///
|
///
|
||||||
void(CEF_CALLBACK* on_after_created)(struct _cef_life_span_handler_t* self,
|
void(CEF_CALLBACK* on_after_created)(struct _cef_life_span_handler_t* self,
|
||||||
struct _cef_browser_t* browser);
|
struct _cef_browser_t* browser);
|
||||||
@@ -204,14 +202,13 @@ typedef struct _cef_life_span_handler_t {
|
|||||||
///
|
///
|
||||||
// Called just before a browser is destroyed. Release all references to the
|
// Called just before a browser is destroyed. Release all references to the
|
||||||
// browser object and do not attempt to execute any functions on the browser
|
// browser object and do not attempt to execute any functions on the browser
|
||||||
// object (other than IsValid, GetIdentifier or IsSame) after this callback
|
// object (other than GetIdentifier or IsSame) after this callback returns.
|
||||||
// returns. cef_frame_handler_t callbacks related to final main frame
|
// This callback will be the last notification that references |browser| on
|
||||||
// destruction will arrive after this callback and cef_browser_t::IsValid will
|
// the UI thread. Any in-progress network requests associated with |browser|
|
||||||
// return false (0) at that time. Any in-progress network requests associated
|
// will be aborted when the browser is destroyed, and
|
||||||
// with |browser| will be aborted when the browser is destroyed, and
|
|
||||||
// cef_resource_request_handler_t callbacks related to those requests may
|
// cef_resource_request_handler_t callbacks related to those requests may
|
||||||
// still arrive on the IO thread after this callback. See cef_frame_handler_t
|
// still arrive on the IO thread after this function is called. See do_close()
|
||||||
// and do_close() documentation for additional usage information.
|
// documentation for additional usage information.
|
||||||
///
|
///
|
||||||
void(CEF_CALLBACK* on_before_close)(struct _cef_life_span_handler_t* self,
|
void(CEF_CALLBACK* on_before_close)(struct _cef_life_span_handler_t* self,
|
||||||
struct _cef_browser_t* browser);
|
struct _cef_browser_t* browser);
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
// by hand. See the translator.README.txt file in the tools directory for
|
// by hand. See the translator.README.txt file in the tools directory for
|
||||||
// more information.
|
// more information.
|
||||||
//
|
//
|
||||||
// $hash=4ebf99611a11cc8714d710c37417fbd9f50f0618$
|
// $hash=41339414bca54054046a8f7fbce402a0e0dd8020$
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef CEF_INCLUDE_CAPI_CEF_RENDER_PROCESS_HANDLER_CAPI_H_
|
#ifndef CEF_INCLUDE_CAPI_CEF_RENDER_PROCESS_HANDLER_CAPI_H_
|
||||||
@@ -73,7 +73,7 @@ typedef struct _cef_render_process_handler_t {
|
|||||||
///
|
///
|
||||||
// Called after a browser has been created. When browsing cross-origin a new
|
// Called after a browser has been created. When browsing cross-origin a new
|
||||||
// browser will be created before the old browser with the same identifier is
|
// browser will be created before the old browser with the same identifier is
|
||||||
// destroyed. |extra_info| is an optional read-only value originating from
|
// destroyed. |extra_info| is a read-only value originating from
|
||||||
// cef_browser_host_t::cef_browser_host_create_browser(),
|
// cef_browser_host_t::cef_browser_host_create_browser(),
|
||||||
// cef_browser_host_t::cef_browser_host_create_browser_sync(),
|
// cef_browser_host_t::cef_browser_host_create_browser_sync(),
|
||||||
// cef_life_span_handler_t::on_before_popup() or
|
// cef_life_span_handler_t::on_before_popup() or
|
||||||
@@ -150,8 +150,8 @@ typedef struct _cef_render_process_handler_t {
|
|||||||
|
|
||||||
///
|
///
|
||||||
// Called when a new message is received from a different process. Return true
|
// Called when a new message is received from a different process. Return true
|
||||||
// (1) if the message was handled or false (0) otherwise. It is safe to keep a
|
// (1) if the message was handled or false (0) otherwise. Do not keep a
|
||||||
// reference to |message| outside of this callback.
|
// reference to or attempt to access the message outside of this callback.
|
||||||
///
|
///
|
||||||
int(CEF_CALLBACK* on_process_message_received)(
|
int(CEF_CALLBACK* on_process_message_received)(
|
||||||
struct _cef_render_process_handler_t* self,
|
struct _cef_render_process_handler_t* self,
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
// by hand. See the translator.README.txt file in the tools directory for
|
// by hand. See the translator.README.txt file in the tools directory for
|
||||||
// more information.
|
// more information.
|
||||||
//
|
//
|
||||||
// $hash=f74bf4d33914d56d760f1bf5aadcf2651740c711$
|
// $hash=d8b5b641cc036a9cd9375442254d558b066ada69$
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef CEF_INCLUDE_CAPI_CEF_WEB_PLUGIN_CAPI_H_
|
#ifndef CEF_INCLUDE_CAPI_CEF_WEB_PLUGIN_CAPI_H_
|
||||||
@@ -214,7 +214,7 @@ CEF_EXPORT void cef_is_web_plugin_unstable(
|
|||||||
// D. "x-cdm-interface-versions": Interface API version (e.g. "8").
|
// D. "x-cdm-interface-versions": Interface API version (e.g. "8").
|
||||||
// E. "x-cdm-host-versions": Host API version (e.g. "8").
|
// E. "x-cdm-host-versions": Host API version (e.g. "8").
|
||||||
// F. "version": CDM version (e.g. "1.4.8.903").
|
// F. "version": CDM version (e.g. "1.4.8.903").
|
||||||
// G. "x-cdm-codecs": List of supported codecs (e.g. "vp8,vp09,avc1").
|
// G. "x-cdm-codecs": List of supported codecs (e.g. "vp8,vp9.0,avc1").
|
||||||
//
|
//
|
||||||
// A through E are used to verify compatibility with the current Chromium
|
// A through E are used to verify compatibility with the current Chromium
|
||||||
// version. If the CDM is not compatible the registration will fail and
|
// version. If the CDM is not compatible the registration will fail and
|
||||||
|
@@ -42,13 +42,13 @@
|
|||||||
// way that may cause binary incompatibility with other builds. The universal
|
// way that may cause binary incompatibility with other builds. The universal
|
||||||
// hash value will change if any platform is affected whereas the platform hash
|
// hash value will change if any platform is affected whereas the platform hash
|
||||||
// values will change only if that particular platform is affected.
|
// values will change only if that particular platform is affected.
|
||||||
#define CEF_API_HASH_UNIVERSAL "7fb6a7510f39c359767b3a893c9ebfb5fb5973d7"
|
#define CEF_API_HASH_UNIVERSAL "d026196d35d8894a836ab3a3d033b84195cdb835"
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#define CEF_API_HASH_PLATFORM "0a848e5b676ddc931dbb5b174a64eb7be7f7dfbf"
|
#define CEF_API_HASH_PLATFORM "4150bd26e7bf639a9b1f3e5860af8c76eeae8570"
|
||||||
#elif defined(OS_MAC)
|
#elif defined(OS_MAC)
|
||||||
#define CEF_API_HASH_PLATFORM "4c666fab20ab43dddf2f7ac6543197a1fecee389"
|
#define CEF_API_HASH_PLATFORM "5cc32f88bd134410eff86b21095138b339d572f2"
|
||||||
#elif defined(OS_LINUX)
|
#elif defined(OS_LINUX)
|
||||||
#define CEF_API_HASH_PLATFORM "5f756efd08c6e10629fe1f81e9266c7af71aa5ce"
|
#define CEF_API_HASH_PLATFORM "b227b3fdd6142a9d8ff0f2252a71425f15960800"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@@ -52,21 +52,14 @@ class CefBrowserHost;
|
|||||||
class CefClient;
|
class CefClient;
|
||||||
|
|
||||||
///
|
///
|
||||||
// Class used to represent a browser. When used in the browser process the
|
// Class used to represent a browser window. When used in the browser process
|
||||||
// methods of this class may be called on any thread unless otherwise indicated
|
// the methods of this class may be called on any thread unless otherwise
|
||||||
// in the comments. When used in the render process the methods of this class
|
// indicated in the comments. When used in the render process the methods of
|
||||||
// may only be called on the main thread.
|
// this class may only be called on the main thread.
|
||||||
///
|
///
|
||||||
/*--cef(source=library)--*/
|
/*--cef(source=library)--*/
|
||||||
class CefBrowser : public virtual CefBaseRefCounted {
|
class CefBrowser : public virtual CefBaseRefCounted {
|
||||||
public:
|
public:
|
||||||
///
|
|
||||||
// True if this object is currently valid. This will return false after
|
|
||||||
// CefLifeSpanHandler::OnBeforeClose is called.
|
|
||||||
///
|
|
||||||
/*--cef()--*/
|
|
||||||
virtual bool IsValid() = 0;
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Returns the browser host object. This method can only be called in the
|
// Returns the browser host object. This method can only be called in the
|
||||||
// browser process.
|
// browser process.
|
||||||
@@ -137,7 +130,7 @@ class CefBrowser : public virtual CefBaseRefCounted {
|
|||||||
virtual bool IsSame(CefRefPtr<CefBrowser> that) = 0;
|
virtual bool IsSame(CefRefPtr<CefBrowser> that) = 0;
|
||||||
|
|
||||||
///
|
///
|
||||||
// Returns true if the browser is a popup.
|
// Returns true if the window is a popup window.
|
||||||
///
|
///
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual bool IsPopup() = 0;
|
virtual bool IsPopup() = 0;
|
||||||
@@ -149,19 +142,13 @@ class CefBrowser : public virtual CefBaseRefCounted {
|
|||||||
virtual bool HasDocument() = 0;
|
virtual bool HasDocument() = 0;
|
||||||
|
|
||||||
///
|
///
|
||||||
// Returns the main (top-level) frame for the browser. In the browser process
|
// Returns the main (top-level) frame for the browser window.
|
||||||
// this will return a valid object until after
|
|
||||||
// CefLifeSpanHandler::OnBeforeClose is called. In the renderer process this
|
|
||||||
// will return NULL if the main frame is hosted in a different renderer
|
|
||||||
// process (e.g. for cross-origin sub-frames). The main frame object will
|
|
||||||
// change during cross-origin navigation or re-navigation after renderer
|
|
||||||
// process termination (due to crashes, etc).
|
|
||||||
///
|
///
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual CefRefPtr<CefFrame> GetMainFrame() = 0;
|
virtual CefRefPtr<CefFrame> GetMainFrame() = 0;
|
||||||
|
|
||||||
///
|
///
|
||||||
// Returns the focused frame for the browser.
|
// Returns the focused frame for the browser window.
|
||||||
///
|
///
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual CefRefPtr<CefFrame> GetFocusedFrame() = 0;
|
virtual CefRefPtr<CefFrame> GetFocusedFrame() = 0;
|
||||||
@@ -274,9 +261,10 @@ class CefDownloadImageCallback : public virtual CefBaseRefCounted {
|
|||||||
};
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
// Class used to represent the browser process aspects of a browser. The methods
|
// Class used to represent the browser process aspects of a browser window. The
|
||||||
// of this class can only be called in the browser process. They may be called
|
// methods of this class can only be called in the browser process. They may be
|
||||||
// on any thread in that process unless otherwise indicated in the comments.
|
// called on any thread in that process unless otherwise indicated in the
|
||||||
|
// comments.
|
||||||
///
|
///
|
||||||
/*--cef(source=library)--*/
|
/*--cef(source=library)--*/
|
||||||
class CefBrowserHost : public virtual CefBaseRefCounted {
|
class CefBrowserHost : public virtual CefBaseRefCounted {
|
||||||
@@ -287,14 +275,14 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
|
|||||||
typedef cef_paint_element_type_t PaintElementType;
|
typedef cef_paint_element_type_t PaintElementType;
|
||||||
|
|
||||||
///
|
///
|
||||||
// Create a new browser using the window parameters specified by |windowInfo|.
|
// Create a new browser window using the window parameters specified by
|
||||||
// All values will be copied internally and the actual window (if any) will be
|
// |windowInfo|. All values will be copied internally and the actual window
|
||||||
// created on the UI thread. If |request_context| is empty the global request
|
// will be created on the UI thread. If |request_context| is empty the
|
||||||
// context will be used. This method can be called on any browser process
|
// global request context will be used. This method can be called on any
|
||||||
// thread and will not block. The optional |extra_info| parameter provides an
|
// browser process thread and will not block. The optional |extra_info|
|
||||||
// opportunity to specify extra information specific to the created browser
|
// parameter provides an opportunity to specify extra information specific
|
||||||
// that will be passed to CefRenderProcessHandler::OnBrowserCreated() in the
|
// to the created browser that will be passed to
|
||||||
// render process.
|
// CefRenderProcessHandler::OnBrowserCreated() in the render process.
|
||||||
///
|
///
|
||||||
/*--cef(optional_param=client,optional_param=url,
|
/*--cef(optional_param=client,optional_param=url,
|
||||||
optional_param=request_context,optional_param=extra_info)--*/
|
optional_param=request_context,optional_param=extra_info)--*/
|
||||||
@@ -306,12 +294,13 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
|
|||||||
CefRefPtr<CefRequestContext> request_context);
|
CefRefPtr<CefRequestContext> request_context);
|
||||||
|
|
||||||
///
|
///
|
||||||
// Create a new browser using the window parameters specified by |windowInfo|.
|
// Create a new browser window using the window parameters specified by
|
||||||
// If |request_context| is empty the global request context will be used. This
|
// |windowInfo|. If |request_context| is empty the global request context
|
||||||
// method can only be called on the browser process UI thread. The optional
|
// will be used. This method can only be called on the browser process UI
|
||||||
// |extra_info| parameter provides an opportunity to specify extra information
|
// thread. The optional |extra_info| parameter provides an opportunity to
|
||||||
// specific to the created browser that will be passed to
|
// specify extra information specific to the created browser that will be
|
||||||
// CefRenderProcessHandler::OnBrowserCreated() in the render process.
|
// passed to CefRenderProcessHandler::OnBrowserCreated() in the render
|
||||||
|
// process.
|
||||||
///
|
///
|
||||||
/*--cef(optional_param=client,optional_param=url,
|
/*--cef(optional_param=client,optional_param=url,
|
||||||
optional_param=request_context,optional_param=extra_info)--*/
|
optional_param=request_context,optional_param=extra_info)--*/
|
||||||
@@ -344,9 +333,9 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
|
|||||||
|
|
||||||
///
|
///
|
||||||
// Helper for closing a browser. Call this method from the top-level window
|
// Helper for closing a browser. Call this method from the top-level window
|
||||||
// close handler (if any). Internally this calls CloseBrowser(false) if the
|
// close handler. Internally this calls CloseBrowser(false) if the close has
|
||||||
// close has not yet been initiated. This method returns false while the close
|
// not yet been initiated. This method returns false while the close is
|
||||||
// is pending and true after the close has completed. See CloseBrowser() and
|
// pending and true after the close has completed. See CloseBrowser() and
|
||||||
// CefLifeSpanHandler::DoClose() documentation for additional usage
|
// CefLifeSpanHandler::DoClose() documentation for additional usage
|
||||||
// information. This method must be called on the browser process UI thread.
|
// information. This method must be called on the browser process UI thread.
|
||||||
///
|
///
|
||||||
@@ -360,19 +349,18 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
|
|||||||
virtual void SetFocus(bool focus) = 0;
|
virtual void SetFocus(bool focus) = 0;
|
||||||
|
|
||||||
///
|
///
|
||||||
// Retrieve the window handle (if any) for this browser. If this browser is
|
// Retrieve the window handle for this browser. If this browser is wrapped in
|
||||||
// wrapped in a CefBrowserView this method should be called on the browser
|
// a CefBrowserView this method should be called on the browser process UI
|
||||||
// process UI thread and it will return the handle for the top-level native
|
// thread and it will return the handle for the top-level native window.
|
||||||
// window.
|
|
||||||
///
|
///
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual CefWindowHandle GetWindowHandle() = 0;
|
virtual CefWindowHandle GetWindowHandle() = 0;
|
||||||
|
|
||||||
///
|
///
|
||||||
// Retrieve the window handle (if any) of the browser that opened this
|
// Retrieve the window handle of the browser that opened this browser. Will
|
||||||
// browser. Will return NULL for non-popup browsers or if this browser is
|
// return NULL for non-popup windows or if this browser is wrapped in a
|
||||||
// wrapped in a CefBrowserView. This method can be used in combination with
|
// CefBrowserView. This method can be used in combination with custom handling
|
||||||
// custom handling of modal windows.
|
// of modal windows.
|
||||||
///
|
///
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual CefWindowHandle GetOpenerWindowHandle() = 0;
|
virtual CefWindowHandle GetOpenerWindowHandle() = 0;
|
||||||
|
@@ -47,7 +47,6 @@
|
|||||||
#include "include/cef_drag_handler.h"
|
#include "include/cef_drag_handler.h"
|
||||||
#include "include/cef_find_handler.h"
|
#include "include/cef_find_handler.h"
|
||||||
#include "include/cef_focus_handler.h"
|
#include "include/cef_focus_handler.h"
|
||||||
#include "include/cef_frame_handler.h"
|
|
||||||
#include "include/cef_jsdialog_handler.h"
|
#include "include/cef_jsdialog_handler.h"
|
||||||
#include "include/cef_keyboard_handler.h"
|
#include "include/cef_keyboard_handler.h"
|
||||||
#include "include/cef_life_span_handler.h"
|
#include "include/cef_life_span_handler.h"
|
||||||
@@ -116,14 +115,6 @@ class CefClient : public virtual CefBaseRefCounted {
|
|||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual CefRefPtr<CefFocusHandler> GetFocusHandler() { return nullptr; }
|
virtual CefRefPtr<CefFocusHandler> GetFocusHandler() { return nullptr; }
|
||||||
|
|
||||||
///
|
|
||||||
// Return the handler for events related to CefFrame lifespan. This method
|
|
||||||
// will be called once during CefBrowser creation and the result will be
|
|
||||||
// cached for performance reasons.
|
|
||||||
///
|
|
||||||
/*--cef()--*/
|
|
||||||
virtual CefRefPtr<CefFrameHandler> GetFrameHandler() { return nullptr; }
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Return the handler for JavaScript dialogs. If no handler is provided the
|
// Return the handler for JavaScript dialogs. If no handler is provided the
|
||||||
// default implementation will be used.
|
// default implementation will be used.
|
||||||
@@ -170,8 +161,8 @@ class CefClient : public virtual CefBaseRefCounted {
|
|||||||
|
|
||||||
///
|
///
|
||||||
// Called when a new message is received from a different process. Return true
|
// Called when a new message is received from a different process. Return true
|
||||||
// if the message was handled or false otherwise. It is safe to keep a
|
// if the message was handled or false otherwise. Do not keep a reference to
|
||||||
// reference to |message| outside of this callback.
|
// or attempt to access the message outside of this callback.
|
||||||
///
|
///
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
|
virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
|
||||||
|
@@ -246,12 +246,10 @@ class CefFrame : public virtual CefBaseRefCounted {
|
|||||||
CefRefPtr<CefURLRequestClient> client) = 0;
|
CefRefPtr<CefURLRequestClient> client) = 0;
|
||||||
|
|
||||||
///
|
///
|
||||||
// Send a message to the specified |target_process|. Ownership of the message
|
// Send a message to the specified |target_process|. Message delivery is not
|
||||||
// contents will be transferred and the |message| reference will be
|
// guaranteed in all cases (for example, if the browser is closing,
|
||||||
// invalidated. Message delivery is not guaranteed in all cases (for example,
|
// navigating, or if the target process crashes). Send an ACK message back
|
||||||
// if the browser is closing, navigating, or if the target process crashes).
|
// from the target process if confirmation is required.
|
||||||
// Send an ACK message back from the target process if confirmation is
|
|
||||||
// required.
|
|
||||||
///
|
///
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual void SendProcessMessage(CefProcessId target_process,
|
virtual void SendProcessMessage(CefProcessId target_process,
|
||||||
|
@@ -1,172 +0,0 @@
|
|||||||
// Copyright (c) 2021 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.
|
|
||||||
//
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// The contents of this file must follow a specific format in order to
|
|
||||||
// support the CEF translator tool. See the translator.README.txt file in the
|
|
||||||
// tools directory for more information.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef CEF_INCLUDE_CEF_FRAME_HANDLER_H_
|
|
||||||
#define CEF_INCLUDE_CEF_FRAME_HANDLER_H_
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "include/cef_base.h"
|
|
||||||
#include "include/cef_browser.h"
|
|
||||||
#include "include/cef_frame.h"
|
|
||||||
|
|
||||||
///
|
|
||||||
// Implement this interface to handle events related to CefFrame life span. The
|
|
||||||
// order of callbacks is:
|
|
||||||
//
|
|
||||||
// (1) During initial CefBrowserHost creation and navigation of the main frame:
|
|
||||||
// - CefFrameHandler::OnFrameCreated => The initial main frame object has been
|
|
||||||
// created. Any commands will be queued until the frame is attached.
|
|
||||||
// - CefFrameHandler::OnMainFrameChanged => The initial main frame object has
|
|
||||||
// been assigned to the browser.
|
|
||||||
// - CefLifeSpanHandler::OnAfterCreated => The browser is now valid and can be
|
|
||||||
// used.
|
|
||||||
// - CefFrameHandler::OnFrameAttached => The initial main frame object is now
|
|
||||||
// connected to its peer in the renderer process. Commands can be routed.
|
|
||||||
//
|
|
||||||
// (2) During further CefBrowserHost navigation/loading of the main frame and/or
|
|
||||||
// sub-frames:
|
|
||||||
// - CefFrameHandler::OnFrameCreated => A new main frame or sub-frame object has
|
|
||||||
// been created. Any commands will be queued until the frame is attached.
|
|
||||||
// - CefFrameHandler::OnFrameAttached => A new main frame or sub-frame object is
|
|
||||||
// now connected to its peer in the renderer process. Commands can be routed.
|
|
||||||
// - CefFrameHandler::OnFrameDetached => An existing main frame or sub-frame
|
|
||||||
// object has lost its connection to the renderer process. If multiple objects
|
|
||||||
// are detached at the same time then notifications will be sent for any
|
|
||||||
// sub-frame objects before the main frame object. Commands can no longer be
|
|
||||||
// routed and will be discarded.
|
|
||||||
// - CefFrameHandler::OnMainFrameChanged => A new main frame object has been
|
|
||||||
// assigned to the browser. This will only occur with cross-origin navigation
|
|
||||||
// or re-navigation after renderer process termination (due to crashes, etc).
|
|
||||||
//
|
|
||||||
// (3) During final CefBrowserHost destruction of the main frame:
|
|
||||||
// - CefFrameHandler::OnFrameDetached => Any sub-frame objects have lost their
|
|
||||||
// connection to the renderer process. Commands can no longer be routed and
|
|
||||||
// will be discarded.
|
|
||||||
// - CefLifeSpanHandler::OnBeforeClose => The browser has been destroyed.
|
|
||||||
// - CefFrameHandler::OnFrameDetached => The main frame object have lost its
|
|
||||||
// connection to the renderer process. Notifications will be sent for any
|
|
||||||
// sub-frame objects before the main frame object. Commands can no longer be
|
|
||||||
// routed and will be discarded.
|
|
||||||
// - CefFrameHandler::OnMainFrameChanged => The final main frame object has been
|
|
||||||
// removed from the browser.
|
|
||||||
//
|
|
||||||
// Cross-origin navigation and/or loading receives special handling.
|
|
||||||
//
|
|
||||||
// When the main frame navigates to a different origin the OnMainFrameChanged
|
|
||||||
// callback (2) will be executed with the old and new main frame objects.
|
|
||||||
//
|
|
||||||
// When a new sub-frame is loaded in, or an existing sub-frame is navigated to,
|
|
||||||
// a different origin from the parent frame, a temporary sub-frame object will
|
|
||||||
// first be created in the parent's renderer process. That temporary sub-frame
|
|
||||||
// will then be discarded after the real cross-origin sub-frame is created in
|
|
||||||
// the new/target renderer process. The client will receive cross-origin
|
|
||||||
// navigation callbacks (2) for the transition from the temporary sub-frame to
|
|
||||||
// the real sub-frame. The temporary sub-frame will not recieve or execute
|
|
||||||
// commands during this transitional period (any sent commands will be
|
|
||||||
// discarded).
|
|
||||||
//
|
|
||||||
// When a new popup browser is created in a different origin from the parent
|
|
||||||
// browser, a temporary main frame object for the popup will first be created in
|
|
||||||
// the parent's renderer process. That temporary main frame will then be
|
|
||||||
// discarded after the real cross-origin main frame is created in the new/target
|
|
||||||
// renderer process. The client will recieve creation and initial navigation
|
|
||||||
// callbacks (1) for the temporary main frame, followed by cross-origin
|
|
||||||
// navigation callbacks (2) for the transition from the temporary main frame to
|
|
||||||
// the real main frame. The temporary main frame may receive and execute
|
|
||||||
// commands during this transitional period (any sent commands may be executed,
|
|
||||||
// but the behavior is potentially undesirable since they execute in the parent
|
|
||||||
// browser's renderer process and not the new/target renderer process).
|
|
||||||
//
|
|
||||||
// Callbacks will not be executed for placeholders that may be created during
|
|
||||||
// pre-commit navigation for sub-frames that do not yet exist in the renderer
|
|
||||||
// process. Placeholders will have CefFrame::GetIdentifier() == -4.
|
|
||||||
//
|
|
||||||
// The methods of this class will be called on the UI thread unless otherwise
|
|
||||||
// indicated.
|
|
||||||
///
|
|
||||||
/*--cef(source=client)--*/
|
|
||||||
class CefFrameHandler : public virtual CefBaseRefCounted {
|
|
||||||
public:
|
|
||||||
///
|
|
||||||
// Called when a new frame is created. This will be the first notification
|
|
||||||
// that references |frame|. Any commands that require transport to the
|
|
||||||
// associated renderer process (LoadRequest, SendProcessMessage, GetSource,
|
|
||||||
// etc.) will be queued until OnFrameAttached is called for |frame|.
|
|
||||||
///
|
|
||||||
/*--cef()--*/
|
|
||||||
virtual void OnFrameCreated(CefRefPtr<CefBrowser> browser,
|
|
||||||
CefRefPtr<CefFrame> frame) {}
|
|
||||||
|
|
||||||
///
|
|
||||||
// Called when a frame can begin routing commands to/from the associated
|
|
||||||
// renderer process. Any commands that were queued have now been dispatched.
|
|
||||||
///
|
|
||||||
/*--cef()--*/
|
|
||||||
virtual void OnFrameAttached(CefRefPtr<CefBrowser> browser,
|
|
||||||
CefRefPtr<CefFrame> frame) {}
|
|
||||||
|
|
||||||
///
|
|
||||||
// Called when a frame loses its connection to the renderer process and will
|
|
||||||
// be destroyed. Any pending or future commands will be discarded and
|
|
||||||
// CefFrame::IsValid() will now return false for |frame|. If called after
|
|
||||||
// CefLifeSpanHandler::OnBeforeClose() during browser destruction then
|
|
||||||
// CefBrowser::IsValid() will return false for |browser|.
|
|
||||||
///
|
|
||||||
/*--cef()--*/
|
|
||||||
virtual void OnFrameDetached(CefRefPtr<CefBrowser> browser,
|
|
||||||
CefRefPtr<CefFrame> frame) {}
|
|
||||||
|
|
||||||
///
|
|
||||||
// Called when the main frame changes due to (a) initial browser creation, (b)
|
|
||||||
// final browser destruction, (c) cross-origin navigation or (d) re-navigation
|
|
||||||
// after renderer process termination (due to crashes, etc). |old_frame| will
|
|
||||||
// be NULL and |new_frame| will be non-NULL when a main frame is assigned to
|
|
||||||
// |browser| for the first time. |old_frame| will be non-NULL and |new_frame|
|
|
||||||
// will be NULL and when a main frame is removed from |browser| for the last
|
|
||||||
// time. Both |old_frame| and |new_frame| will be non-NULL for cross-origin
|
|
||||||
// navigations or re-navigation after renderer process termination. This
|
|
||||||
// method will be called after OnFrameCreated() for |new_frame| and/or after
|
|
||||||
// OnFrameDetached() for |old_frame|. If called after
|
|
||||||
// CefLifeSpanHandler::OnBeforeClose() during browser destruction then
|
|
||||||
// CefBrowser::IsValid() will return false for |browser|.
|
|
||||||
///
|
|
||||||
/*--cef(optional_param=old_frame,optional_param=new_frame)--*/
|
|
||||||
virtual void OnMainFrameChanged(CefRefPtr<CefBrowser> browser,
|
|
||||||
CefRefPtr<CefFrame> old_frame,
|
|
||||||
CefRefPtr<CefFrame> new_frame) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // CEF_INCLUDE_CEF_FRAME_HANDLER_H_
|
|
@@ -95,10 +95,8 @@ class CefLifeSpanHandler : public virtual CefBaseRefCounted {
|
|||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
// Called after a new browser is created. It is now safe to begin performing
|
// Called after a new browser is created. This callback will be the first
|
||||||
// actions with |browser|. CefFrameHandler callbacks related to initial main
|
// notification that references |browser|.
|
||||||
// frame creation will arrive before this callback. See CefFrameHandler
|
|
||||||
// documentation for additional usage information.
|
|
||||||
///
|
///
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser) {}
|
virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser) {}
|
||||||
@@ -197,14 +195,13 @@ class CefLifeSpanHandler : public virtual CefBaseRefCounted {
|
|||||||
///
|
///
|
||||||
// Called just before a browser is destroyed. Release all references to the
|
// Called just before a browser is destroyed. Release all references to the
|
||||||
// browser object and do not attempt to execute any methods on the browser
|
// browser object and do not attempt to execute any methods on the browser
|
||||||
// object (other than IsValid, GetIdentifier or IsSame) after this callback
|
// object (other than GetIdentifier or IsSame) after this callback returns.
|
||||||
// returns. CefFrameHandler callbacks related to final main frame destruction
|
// This callback will be the last notification that references |browser| on
|
||||||
// will arrive after this callback and CefBrowser::IsValid will return false
|
// the UI thread. Any in-progress network requests associated with |browser|
|
||||||
// at that time. Any in-progress network requests associated with |browser|
|
|
||||||
// will be aborted when the browser is destroyed, and
|
// will be aborted when the browser is destroyed, and
|
||||||
// CefResourceRequestHandler callbacks related to those requests may still
|
// CefResourceRequestHandler callbacks related to those requests may still
|
||||||
// arrive on the IO thread after this callback. See CefFrameHandler and
|
// arrive on the IO thread after this method is called. See DoClose()
|
||||||
// DoClose() documentation for additional usage information.
|
// documentation for additional usage information.
|
||||||
///
|
///
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) {}
|
virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) {}
|
||||||
|
@@ -66,11 +66,11 @@ class CefRenderProcessHandler : public virtual CefBaseRefCounted {
|
|||||||
///
|
///
|
||||||
// Called after a browser has been created. When browsing cross-origin a new
|
// Called after a browser has been created. When browsing cross-origin a new
|
||||||
// browser will be created before the old browser with the same identifier is
|
// browser will be created before the old browser with the same identifier is
|
||||||
// destroyed. |extra_info| is an optional read-only value originating from
|
// destroyed. |extra_info| is a read-only value originating from
|
||||||
// CefBrowserHost::CreateBrowser(), CefBrowserHost::CreateBrowserSync(),
|
// CefBrowserHost::CreateBrowser(), CefBrowserHost::CreateBrowserSync(),
|
||||||
// CefLifeSpanHandler::OnBeforePopup() or CefBrowserView::CreateBrowserView().
|
// CefLifeSpanHandler::OnBeforePopup() or CefBrowserView::CreateBrowserView().
|
||||||
///
|
///
|
||||||
/*--cef(optional_param=extra_info)--*/
|
/*--cef()--*/
|
||||||
virtual void OnBrowserCreated(CefRefPtr<CefBrowser> browser,
|
virtual void OnBrowserCreated(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefDictionaryValue> extra_info) {}
|
CefRefPtr<CefDictionaryValue> extra_info) {}
|
||||||
|
|
||||||
@@ -134,8 +134,8 @@ class CefRenderProcessHandler : public virtual CefBaseRefCounted {
|
|||||||
|
|
||||||
///
|
///
|
||||||
// Called when a new message is received from a different process. Return true
|
// Called when a new message is received from a different process. Return true
|
||||||
// if the message was handled or false otherwise. It is safe to keep a
|
// if the message was handled or false otherwise. Do not keep a reference to
|
||||||
// reference to |message| outside of this callback.
|
// or attempt to access the message outside of this callback.
|
||||||
///
|
///
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
|
virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
|
||||||
|
@@ -191,7 +191,7 @@ class CefRegisterCdmCallback : public virtual CefBaseRefCounted {
|
|||||||
// D. "x-cdm-interface-versions": Interface API version (e.g. "8").
|
// D. "x-cdm-interface-versions": Interface API version (e.g. "8").
|
||||||
// E. "x-cdm-host-versions": Host API version (e.g. "8").
|
// E. "x-cdm-host-versions": Host API version (e.g. "8").
|
||||||
// F. "version": CDM version (e.g. "1.4.8.903").
|
// F. "version": CDM version (e.g. "1.4.8.903").
|
||||||
// G. "x-cdm-codecs": List of supported codecs (e.g. "vp8,vp09,avc1").
|
// G. "x-cdm-codecs": List of supported codecs (e.g. "vp8,vp9.0,avc1").
|
||||||
//
|
//
|
||||||
// A through E are used to verify compatibility with the current Chromium
|
// A through E are used to verify compatibility with the current Chromium
|
||||||
// version. If the CDM is not compatible the registration will fail and
|
// version. If the CDM is not compatible the registration will fail and
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "include/base/cef_string16.h"
|
||||||
#include "include/internal/cef_string_types.h"
|
#include "include/internal/cef_string_types.h"
|
||||||
|
|
||||||
#if defined(USING_CHROMIUM_INCLUDES)
|
#if defined(USING_CHROMIUM_INCLUDES)
|
||||||
@@ -79,63 +80,45 @@ struct CefStringTraitsWide {
|
|||||||
cef_string_utf8_clear(&cstr);
|
cef_string_utf8_clear(&cstr);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
static inline bool from_string(const std::string::value_type* data,
|
|
||||||
size_t length,
|
|
||||||
struct_type* s) {
|
|
||||||
return cef_string_utf8_to_wide(data, length, s) ? true : false;
|
|
||||||
}
|
|
||||||
static inline bool from_string(const std::string& str, struct_type* s) {
|
static inline bool from_string(const std::string& str, struct_type* s) {
|
||||||
return from_string(str.data(), str.length(), s);
|
return cef_string_utf8_to_wide(str.c_str(), str.length(), s) ? true : false;
|
||||||
}
|
}
|
||||||
static inline std::wstring to_wstring(const struct_type* s) {
|
static inline std::wstring to_wstring(const struct_type* s) {
|
||||||
return std::wstring(s->str, s->length);
|
return std::wstring(s->str, s->length);
|
||||||
}
|
}
|
||||||
static inline bool from_wstring(const std::wstring::value_type* data,
|
|
||||||
size_t length,
|
|
||||||
struct_type* s) {
|
|
||||||
return cef_string_wide_set(data, length, s, true) ? true : false;
|
|
||||||
}
|
|
||||||
static inline bool from_wstring(const std::wstring& str, struct_type* s) {
|
static inline bool from_wstring(const std::wstring& str, struct_type* s) {
|
||||||
return from_wstring(str.data(), str.length(), s);
|
return cef_string_wide_set(str.c_str(), str.length(), s, true) ? true
|
||||||
|
: false;
|
||||||
}
|
}
|
||||||
#if defined(WCHAR_T_IS_UTF32)
|
#if defined(WCHAR_T_IS_UTF32)
|
||||||
static inline std::u16string to_string16(const struct_type* s) {
|
static inline base::string16 to_string16(const struct_type* s) {
|
||||||
cef_string_utf16_t cstr;
|
cef_string_utf16_t cstr;
|
||||||
memset(&cstr, 0, sizeof(cstr));
|
memset(&cstr, 0, sizeof(cstr));
|
||||||
cef_string_wide_to_utf16(s->str, s->length, &cstr);
|
cef_string_wide_to_utf16(s->str, s->length, &cstr);
|
||||||
std::u16string str;
|
base::string16 str;
|
||||||
if (cstr.length > 0) {
|
if (cstr.length > 0) {
|
||||||
str = std::u16string(
|
str = base::string16(
|
||||||
reinterpret_cast<std::u16string::value_type*>(cstr.str), cstr.length);
|
reinterpret_cast<base::string16::value_type*>(cstr.str), cstr.length);
|
||||||
}
|
}
|
||||||
cef_string_utf16_clear(&cstr);
|
cef_string_utf16_clear(&cstr);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
static inline bool from_string16(const std::u16string::value_type* data,
|
static inline bool from_string16(const base::string16& str, struct_type* s) {
|
||||||
size_t length,
|
return cef_string_utf16_to_wide(
|
||||||
struct_type* s) {
|
reinterpret_cast<const char16*>(str.c_str()), str.length(), s)
|
||||||
return cef_string_utf16_to_wide(reinterpret_cast<const char16*>(data),
|
|
||||||
length, s)
|
|
||||||
? true
|
? true
|
||||||
: false;
|
: false;
|
||||||
}
|
}
|
||||||
#else // WCHAR_T_IS_UTF32
|
#else // WCHAR_T_IS_UTF32
|
||||||
static inline std::u16string to_string16(const struct_type* s) {
|
static inline base::string16 to_string16(const struct_type* s) {
|
||||||
return std::u16string(
|
return base::string16(
|
||||||
reinterpret_cast<const std::u16string::value_type*>(s->str), s->length);
|
reinterpret_cast<const base::string16::value_type*>(s->str), s->length);
|
||||||
}
|
}
|
||||||
static inline bool from_string16(const std::u16string::value_type* data,
|
static inline bool from_string16(const base::string16& str, struct_type* s) {
|
||||||
size_t length,
|
return cef_string_wide_set(str.c_str(), str.length(), s, true) ? true
|
||||||
struct_type* s) {
|
: false;
|
||||||
return cef_string_wide_set(reinterpret_cast<const wchar_t*>(data), length,
|
|
||||||
s, true)
|
|
||||||
? true
|
|
||||||
: false;
|
|
||||||
}
|
}
|
||||||
#endif // WCHAR_T_IS_UTF32
|
#endif // WCHAR_T_IS_UTF32
|
||||||
static inline bool from_string16(const std::u16string& str, struct_type* s) {
|
|
||||||
return from_string16(str.data(), str.length(), s);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -170,13 +153,8 @@ struct CefStringTraitsUTF8 {
|
|||||||
static inline std::string to_string(const struct_type* s) {
|
static inline std::string to_string(const struct_type* s) {
|
||||||
return std::string(s->str, s->length);
|
return std::string(s->str, s->length);
|
||||||
}
|
}
|
||||||
static inline bool from_string(const std::string::value_type* data,
|
|
||||||
size_t length,
|
|
||||||
struct_type* s) {
|
|
||||||
return cef_string_utf8_copy(data, length, s) ? true : false;
|
|
||||||
}
|
|
||||||
static inline bool from_string(const std::string& str, struct_type* s) {
|
static inline bool from_string(const std::string& str, struct_type* s) {
|
||||||
return from_string(str.c_str(), str.length(), s);
|
return cef_string_utf8_copy(str.c_str(), str.length(), s) ? true : false;
|
||||||
}
|
}
|
||||||
static inline std::wstring to_wstring(const struct_type* s) {
|
static inline std::wstring to_wstring(const struct_type* s) {
|
||||||
cef_string_wide_t cstr;
|
cef_string_wide_t cstr;
|
||||||
@@ -188,37 +166,27 @@ struct CefStringTraitsUTF8 {
|
|||||||
cef_string_wide_clear(&cstr);
|
cef_string_wide_clear(&cstr);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
static inline bool from_wstring(const std::wstring::value_type* data,
|
|
||||||
size_t length,
|
|
||||||
struct_type* s) {
|
|
||||||
return cef_string_wide_to_utf8(data, length, s) ? true : false;
|
|
||||||
}
|
|
||||||
static inline bool from_wstring(const std::wstring& str, struct_type* s) {
|
static inline bool from_wstring(const std::wstring& str, struct_type* s) {
|
||||||
return from_wstring(str.data(), str.length(), s);
|
return cef_string_wide_to_utf8(str.c_str(), str.length(), s) ? true : false;
|
||||||
}
|
}
|
||||||
static inline std::u16string to_string16(const struct_type* s) {
|
static inline base::string16 to_string16(const struct_type* s) {
|
||||||
cef_string_utf16_t cstr;
|
cef_string_utf16_t cstr;
|
||||||
memset(&cstr, 0, sizeof(cstr));
|
memset(&cstr, 0, sizeof(cstr));
|
||||||
cef_string_utf8_to_utf16(s->str, s->length, &cstr);
|
cef_string_utf8_to_utf16(s->str, s->length, &cstr);
|
||||||
std::u16string str;
|
base::string16 str;
|
||||||
if (cstr.length > 0) {
|
if (cstr.length > 0) {
|
||||||
str = std::u16string(
|
str = base::string16(
|
||||||
reinterpret_cast<std::u16string::value_type*>(cstr.str), cstr.length);
|
reinterpret_cast<base::string16::value_type*>(cstr.str), cstr.length);
|
||||||
}
|
}
|
||||||
cef_string_utf16_clear(&cstr);
|
cef_string_utf16_clear(&cstr);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
static inline bool from_string16(const std::u16string::value_type* data,
|
static inline bool from_string16(const base::string16& str, struct_type* s) {
|
||||||
size_t length,
|
return cef_string_utf16_to_utf8(
|
||||||
struct_type* s) {
|
reinterpret_cast<const char16*>(str.c_str()), str.length(), s)
|
||||||
return cef_string_utf16_to_utf8(reinterpret_cast<const char16*>(data),
|
|
||||||
length, s)
|
|
||||||
? true
|
? true
|
||||||
: false;
|
: false;
|
||||||
}
|
}
|
||||||
static inline bool from_string16(const std::u16string& str, struct_type* s) {
|
|
||||||
return from_string16(str.data(), str.length(), s);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -260,13 +228,9 @@ struct CefStringTraitsUTF16 {
|
|||||||
cef_string_utf8_clear(&cstr);
|
cef_string_utf8_clear(&cstr);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
static inline bool from_string(const std::string::value_type* data,
|
|
||||||
size_t length,
|
|
||||||
struct_type* s) {
|
|
||||||
return cef_string_utf8_to_utf16(data, length, s) ? true : false;
|
|
||||||
}
|
|
||||||
static inline bool from_string(const std::string& str, struct_type* s) {
|
static inline bool from_string(const std::string& str, struct_type* s) {
|
||||||
return from_string(str.data(), str.length(), s);
|
return cef_string_utf8_to_utf16(str.c_str(), str.length(), s) ? true
|
||||||
|
: false;
|
||||||
}
|
}
|
||||||
#if defined(WCHAR_T_IS_UTF32)
|
#if defined(WCHAR_T_IS_UTF32)
|
||||||
static inline std::wstring to_wstring(const struct_type* s) {
|
static inline std::wstring to_wstring(const struct_type* s) {
|
||||||
@@ -279,39 +243,29 @@ struct CefStringTraitsUTF16 {
|
|||||||
cef_string_wide_clear(&cstr);
|
cef_string_wide_clear(&cstr);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
static inline bool from_wstring(const std::wstring::value_type* data,
|
static inline bool from_wstring(const std::wstring& str, struct_type* s) {
|
||||||
size_t length,
|
return cef_string_wide_to_utf16(str.c_str(), str.length(), s) ? true
|
||||||
struct_type* s) {
|
: false;
|
||||||
return cef_string_wide_to_utf16(data, length, s) ? true : false;
|
|
||||||
}
|
}
|
||||||
#else // WCHAR_T_IS_UTF32
|
#else // WCHAR_T_IS_UTF32
|
||||||
static inline std::wstring to_wstring(const struct_type* s) {
|
static inline std::wstring to_wstring(const struct_type* s) {
|
||||||
return std::wstring(s->str, s->length);
|
return std::wstring(s->str, s->length);
|
||||||
}
|
}
|
||||||
static inline bool from_wstring(const std::wstring::value_type* data,
|
static inline bool from_wstring(const std::wstring& str, struct_type* s) {
|
||||||
size_t length,
|
return cef_string_utf16_set(str.c_str(), str.length(), s, true) ? true
|
||||||
struct_type* s) {
|
: false;
|
||||||
return cef_string_utf16_set(data, length, s, true) ? true : false;
|
|
||||||
}
|
}
|
||||||
#endif // WCHAR_T_IS_UTF32
|
#endif // WCHAR_T_IS_UTF32
|
||||||
static inline bool from_wstring(const std::wstring& str, struct_type* s) {
|
static inline base::string16 to_string16(const struct_type* s) {
|
||||||
return from_wstring(str.data(), str.length(), s);
|
return base::string16(
|
||||||
|
reinterpret_cast<const base::string16::value_type*>(s->str), s->length);
|
||||||
}
|
}
|
||||||
static inline std::u16string to_string16(const struct_type* s) {
|
static inline bool from_string16(const base::string16& str, struct_type* s) {
|
||||||
return std::u16string(
|
return cef_string_utf16_set(reinterpret_cast<const char16*>(str.c_str()),
|
||||||
reinterpret_cast<const std::u16string::value_type*>(s->str), s->length);
|
str.length(), s, true)
|
||||||
}
|
|
||||||
static inline bool from_string16(const std::u16string::value_type* data,
|
|
||||||
size_t length,
|
|
||||||
struct_type* s) {
|
|
||||||
return cef_string_utf16_set(reinterpret_cast<const char16*>(data), length,
|
|
||||||
s, true)
|
|
||||||
? true
|
? true
|
||||||
: false;
|
: false;
|
||||||
}
|
}
|
||||||
static inline bool from_string16(const std::u16string& str, struct_type* s) {
|
|
||||||
return from_string16(str.data(), str.length(), s);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -369,10 +323,9 @@ class CefStringBase {
|
|||||||
CefStringBase(const std::string& src) : string_(NULL), owner_(false) {
|
CefStringBase(const std::string& src) : string_(NULL), owner_(false) {
|
||||||
FromString(src);
|
FromString(src);
|
||||||
}
|
}
|
||||||
CefStringBase(const char* src, size_t length = 0)
|
CefStringBase(const char* src) : string_(NULL), owner_(false) {
|
||||||
: string_(NULL), owner_(false) {
|
|
||||||
if (src)
|
if (src)
|
||||||
FromString(src, length);
|
FromString(std::string(src));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -383,32 +336,24 @@ class CefStringBase {
|
|||||||
CefStringBase(const std::wstring& src) : string_(NULL), owner_(false) {
|
CefStringBase(const std::wstring& src) : string_(NULL), owner_(false) {
|
||||||
FromWString(src);
|
FromWString(src);
|
||||||
}
|
}
|
||||||
CefStringBase(const wchar_t* src, size_t length = 0)
|
CefStringBase(const wchar_t* src) : string_(NULL), owner_(false) {
|
||||||
: string_(NULL), owner_(false) {
|
|
||||||
if (src)
|
if (src)
|
||||||
FromWString(src, length);
|
FromWString(std::wstring(src));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(WCHAR_T_IS_UTF32)
|
||||||
///
|
///
|
||||||
// Create a new string from an existing string16. Data will be always
|
// Create a new string from an existing string16. Data will be always
|
||||||
// copied. Translation will occur if necessary based on the underlying string
|
// copied. Translation will occur if necessary based on the underlying string
|
||||||
// type.
|
// type.
|
||||||
///
|
///
|
||||||
CefStringBase(const std::u16string& src) : string_(NULL), owner_(false) {
|
CefStringBase(const base::string16& src) : string_(NULL), owner_(false) {
|
||||||
FromString16(src);
|
FromString16(src);
|
||||||
}
|
}
|
||||||
CefStringBase(const std::u16string::value_type* src, size_t length = 0)
|
CefStringBase(const char16* src) : string_(NULL), owner_(false) {
|
||||||
: string_(NULL), owner_(false) {
|
|
||||||
if (src)
|
if (src)
|
||||||
FromString16(src, length);
|
FromString16(base::string16(
|
||||||
}
|
reinterpret_cast<const base::string16::value_type*>(src)));
|
||||||
#if defined(WCHAR_T_IS_UTF32)
|
|
||||||
CefStringBase(const char16* src, size_t length = 0)
|
|
||||||
: string_(NULL), owner_(false) {
|
|
||||||
if (src) {
|
|
||||||
FromString16(reinterpret_cast<const std::u16string::value_type*>(src),
|
|
||||||
length);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif // WCHAR_T_IS_UTF32
|
#endif // WCHAR_T_IS_UTF32
|
||||||
|
|
||||||
@@ -647,23 +592,6 @@ class CefStringBase {
|
|||||||
return traits::from_string(str, string_);
|
return traits::from_string(str, string_);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
// Set this string's data from existing |data| and optional |length|. Data
|
|
||||||
// will be always copied. Translation will occur if necessary based on the
|
|
||||||
// underlying string type.
|
|
||||||
///
|
|
||||||
bool FromString(const std::string::value_type* data, size_t length = 0) {
|
|
||||||
if (data && length == 0) {
|
|
||||||
length = std::char_traits<std::string::value_type>::length(data);
|
|
||||||
}
|
|
||||||
if (!data || length == 0) {
|
|
||||||
clear();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
AllocIfNeeded();
|
|
||||||
return traits::from_string(data, length, string_);
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Return this string's data as a std::wstring. Translation will occur if
|
// Return this string's data as a std::wstring. Translation will occur if
|
||||||
// necessary based on the underlying string type.
|
// necessary based on the underlying string type.
|
||||||
@@ -688,29 +616,13 @@ class CefStringBase {
|
|||||||
return traits::from_wstring(str, string_);
|
return traits::from_wstring(str, string_);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
// Set this string's data from existing |data| and optional |length|. Data
|
|
||||||
// will be always copied. Translation will occur if necessary based on the
|
|
||||||
// underlying string type.
|
|
||||||
///
|
|
||||||
bool FromWString(const std::wstring::value_type* data, size_t length = 0) {
|
|
||||||
if (data && length == 0) {
|
|
||||||
length = std::char_traits<std::wstring::value_type>::length(data);
|
|
||||||
}
|
|
||||||
if (!data || length == 0) {
|
|
||||||
clear();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
AllocIfNeeded();
|
|
||||||
return traits::from_wstring(data, length, string_);
|
|
||||||
}
|
|
||||||
///
|
///
|
||||||
// Return this string's data as a string16. Translation will occur if
|
// Return this string's data as a string16. Translation will occur if
|
||||||
// necessary based on the underlying string type.
|
// necessary based on the underlying string type.
|
||||||
///
|
///
|
||||||
std::u16string ToString16() const {
|
base::string16 ToString16() const {
|
||||||
if (empty())
|
if (empty())
|
||||||
return std::u16string();
|
return base::string16();
|
||||||
return traits::to_string16(string_);
|
return traits::to_string16(string_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -719,7 +631,7 @@ class CefStringBase {
|
|||||||
// copied. Translation will occur if necessary based on the underlying string
|
// copied. Translation will occur if necessary based on the underlying string
|
||||||
// type.
|
// type.
|
||||||
///
|
///
|
||||||
bool FromString16(const std::u16string& str) {
|
bool FromString16(const base::string16& str) {
|
||||||
if (str.empty()) {
|
if (str.empty()) {
|
||||||
clear();
|
clear();
|
||||||
return true;
|
return true;
|
||||||
@@ -728,23 +640,6 @@ class CefStringBase {
|
|||||||
return traits::from_string16(str, string_);
|
return traits::from_string16(str, string_);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
// Set this string's data from existing |data| and optional |length|. Data
|
|
||||||
// will be always copied. Translation will occur if necessary based on the
|
|
||||||
// underlying string type.
|
|
||||||
///
|
|
||||||
bool FromString16(const std::u16string::value_type* data, size_t length = 0) {
|
|
||||||
if (data && length == 0) {
|
|
||||||
length = std::char_traits<std::u16string::value_type>::length(data);
|
|
||||||
}
|
|
||||||
if (!data || length == 0) {
|
|
||||||
clear();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
AllocIfNeeded();
|
|
||||||
return traits::from_string16(data, length, string_);
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Comparison operator overloads.
|
// Comparison operator overloads.
|
||||||
///
|
///
|
||||||
@@ -775,8 +670,8 @@ class CefStringBase {
|
|||||||
FromString(str);
|
FromString(str);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
CefStringBase& operator=(const std::string::value_type* str) {
|
CefStringBase& operator=(const char* str) {
|
||||||
FromString(str);
|
FromString(std::string(str));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
operator std::wstring() const { return ToWString(); }
|
operator std::wstring() const { return ToWString(); }
|
||||||
@@ -784,22 +679,19 @@ class CefStringBase {
|
|||||||
FromWString(str);
|
FromWString(str);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
CefStringBase& operator=(const std::wstring::value_type* str) {
|
CefStringBase& operator=(const wchar_t* str) {
|
||||||
FromWString(str);
|
FromWString(std::wstring(str));
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
operator std::u16string() const { return ToString16(); }
|
|
||||||
CefStringBase& operator=(const std::u16string& str) {
|
|
||||||
FromString16(str);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
CefStringBase& operator=(const std::u16string::value_type* str) {
|
|
||||||
FromString16(str);
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
#if defined(WCHAR_T_IS_UTF32)
|
#if defined(WCHAR_T_IS_UTF32)
|
||||||
|
operator base::string16() const { return ToString16(); }
|
||||||
|
CefStringBase& operator=(const base::string16& str) {
|
||||||
|
FromString16(str);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
CefStringBase& operator=(const char16* str) {
|
CefStringBase& operator=(const char16* str) {
|
||||||
FromString16(reinterpret_cast<const std::u16string::value_type*>(str));
|
FromString16(base::string16(
|
||||||
|
reinterpret_cast<const base::string16::value_type*>(str)));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
#endif // WCHAR_T_IS_UTF32
|
#endif // WCHAR_T_IS_UTF32
|
||||||
|
@@ -1458,6 +1458,7 @@ typedef enum {
|
|||||||
// CefShutdown() are guaranteed to run.
|
// CefShutdown() are guaranteed to run.
|
||||||
///
|
///
|
||||||
TID_FILE_BACKGROUND,
|
TID_FILE_BACKGROUND,
|
||||||
|
TID_FILE = TID_FILE_BACKGROUND,
|
||||||
|
|
||||||
///
|
///
|
||||||
// Used for blocking tasks (e.g. file system access) that affect UI or
|
// Used for blocking tasks (e.g. file system access) that affect UI or
|
||||||
|
@@ -151,9 +151,10 @@ class CefPoint : public CefStructBase<CefPointTraits> {
|
|||||||
public:
|
public:
|
||||||
typedef CefStructBase<CefPointTraits> parent;
|
typedef CefStructBase<CefPointTraits> parent;
|
||||||
|
|
||||||
CefPoint() {}
|
CefPoint() : parent() {}
|
||||||
CefPoint(const cef_point_t& r) : parent(r) {}
|
CefPoint(const cef_point_t& r) : parent(r) {}
|
||||||
CefPoint(int x, int y) { Set(x, y); }
|
CefPoint(const CefPoint& r) : parent(r) {}
|
||||||
|
CefPoint(int x, int y) : parent() { Set(x, y); }
|
||||||
|
|
||||||
bool IsEmpty() const { return x <= 0 && y <= 0; }
|
bool IsEmpty() const { return x <= 0 && y <= 0; }
|
||||||
void Set(int x_val, int y_val) { x = x_val, y = y_val; }
|
void Set(int x_val, int y_val) { x = x_val, y = y_val; }
|
||||||
@@ -187,9 +188,12 @@ class CefRect : public CefStructBase<CefRectTraits> {
|
|||||||
public:
|
public:
|
||||||
typedef CefStructBase<CefRectTraits> parent;
|
typedef CefStructBase<CefRectTraits> parent;
|
||||||
|
|
||||||
CefRect() {}
|
CefRect() : parent() {}
|
||||||
CefRect(const cef_rect_t& r) : parent(r) {}
|
CefRect(const cef_rect_t& r) : parent(r) {}
|
||||||
CefRect(int x, int y, int width, int height) { Set(x, y, width, height); }
|
CefRect(const CefRect& r) : parent(r) {}
|
||||||
|
CefRect(int x, int y, int width, int height) : parent() {
|
||||||
|
Set(x, y, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
bool IsEmpty() const { return width <= 0 || height <= 0; }
|
bool IsEmpty() const { return width <= 0 || height <= 0; }
|
||||||
void Set(int x_val, int y_val, int width_val, int height_val) {
|
void Set(int x_val, int y_val, int width_val, int height_val) {
|
||||||
@@ -236,9 +240,10 @@ class CefSize : public CefStructBase<CefSizeTraits> {
|
|||||||
public:
|
public:
|
||||||
typedef CefStructBase<CefSizeTraits> parent;
|
typedef CefStructBase<CefSizeTraits> parent;
|
||||||
|
|
||||||
CefSize() {}
|
CefSize() : parent() {}
|
||||||
CefSize(const cef_size_t& r) : parent(r) {}
|
CefSize(const cef_size_t& r) : parent(r) {}
|
||||||
CefSize(int width, int height) { Set(width, height); }
|
CefSize(const CefSize& r) : parent(r) {}
|
||||||
|
CefSize(int width, int height) : parent() { Set(width, height); }
|
||||||
|
|
||||||
bool IsEmpty() const { return width <= 0 || height <= 0; }
|
bool IsEmpty() const { return width <= 0 || height <= 0; }
|
||||||
void Set(int width_val, int height_val) {
|
void Set(int width_val, int height_val) {
|
||||||
@@ -274,9 +279,10 @@ class CefRange : public CefStructBase<CefRangeTraits> {
|
|||||||
public:
|
public:
|
||||||
typedef CefStructBase<CefRangeTraits> parent;
|
typedef CefStructBase<CefRangeTraits> parent;
|
||||||
|
|
||||||
CefRange() {}
|
CefRange() : parent() {}
|
||||||
CefRange(const cef_range_t& r) : parent(r) {}
|
CefRange(const cef_range_t& r) : parent(r) {}
|
||||||
CefRange(int from, int to) { Set(from, to); }
|
CefRange(const CefRange& r) : parent(r) {}
|
||||||
|
CefRange(int from, int to) : parent() { Set(from, to); }
|
||||||
|
|
||||||
void Set(int from_val, int to_val) { from = from_val, to = to_val; }
|
void Set(int from_val, int to_val) { from = from_val, to = to_val; }
|
||||||
};
|
};
|
||||||
@@ -309,9 +315,10 @@ class CefInsets : public CefStructBase<CefInsetsTraits> {
|
|||||||
public:
|
public:
|
||||||
typedef CefStructBase<CefInsetsTraits> parent;
|
typedef CefStructBase<CefInsetsTraits> parent;
|
||||||
|
|
||||||
CefInsets() {}
|
CefInsets() : parent() {}
|
||||||
CefInsets(const cef_insets_t& r) : parent(r) {}
|
CefInsets(const cef_insets_t& r) : parent(r) {}
|
||||||
CefInsets(int top, int left, int bottom, int right) {
|
CefInsets(const CefInsets& r) : parent(r) {}
|
||||||
|
CefInsets(int top, int left, int bottom, int right) : parent() {
|
||||||
Set(top, left, bottom, right);
|
Set(top, left, bottom, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -349,9 +356,10 @@ class CefDraggableRegion : public CefStructBase<CefDraggableRegionTraits> {
|
|||||||
public:
|
public:
|
||||||
typedef CefStructBase<CefDraggableRegionTraits> parent;
|
typedef CefStructBase<CefDraggableRegionTraits> parent;
|
||||||
|
|
||||||
CefDraggableRegion() {}
|
CefDraggableRegion() : parent() {}
|
||||||
CefDraggableRegion(const cef_draggable_region_t& r) : parent(r) {}
|
CefDraggableRegion(const cef_draggable_region_t& r) : parent(r) {}
|
||||||
CefDraggableRegion(const CefRect& bounds, bool draggable) {
|
CefDraggableRegion(const CefDraggableRegion& r) : parent(r) {}
|
||||||
|
CefDraggableRegion(const CefRect& bounds, bool draggable) : parent() {
|
||||||
Set(bounds, draggable);
|
Set(bounds, draggable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,14 +405,16 @@ class CefScreenInfo : public CefStructBase<CefScreenInfoTraits> {
|
|||||||
public:
|
public:
|
||||||
typedef CefStructBase<CefScreenInfoTraits> parent;
|
typedef CefStructBase<CefScreenInfoTraits> parent;
|
||||||
|
|
||||||
CefScreenInfo() {}
|
CefScreenInfo() : parent() {}
|
||||||
CefScreenInfo(const cef_screen_info_t& r) : parent(r) {}
|
CefScreenInfo(const cef_screen_info_t& r) : parent(r) {}
|
||||||
|
CefScreenInfo(const CefScreenInfo& r) : parent(r) {}
|
||||||
CefScreenInfo(float device_scale_factor,
|
CefScreenInfo(float device_scale_factor,
|
||||||
int depth,
|
int depth,
|
||||||
int depth_per_component,
|
int depth_per_component,
|
||||||
bool is_monochrome,
|
bool is_monochrome,
|
||||||
const CefRect& rect,
|
const CefRect& rect,
|
||||||
const CefRect& available_rect) {
|
const CefRect& available_rect)
|
||||||
|
: parent() {
|
||||||
Set(device_scale_factor, depth, depth_per_component, is_monochrome, rect,
|
Set(device_scale_factor, depth, depth_per_component, is_monochrome, rect,
|
||||||
available_rect);
|
available_rect);
|
||||||
}
|
}
|
||||||
@@ -796,10 +806,11 @@ class CefTime : public CefStructBase<CefTimeTraits> {
|
|||||||
public:
|
public:
|
||||||
typedef CefStructBase<CefTimeTraits> parent;
|
typedef CefStructBase<CefTimeTraits> parent;
|
||||||
|
|
||||||
CefTime() {}
|
CefTime() : parent() {}
|
||||||
CefTime(const cef_time_t& r) : parent(r) {}
|
CefTime(const cef_time_t& r) : parent(r) {}
|
||||||
explicit CefTime(time_t r) { SetTimeT(r); }
|
CefTime(const CefTime& r) : parent(r) {}
|
||||||
explicit CefTime(double r) { SetDoubleT(r); }
|
explicit CefTime(time_t r) : parent() { SetTimeT(r); }
|
||||||
|
explicit CefTime(double r) : parent() { SetDoubleT(r); }
|
||||||
|
|
||||||
// Converts to/from time_t.
|
// Converts to/from time_t.
|
||||||
void SetTimeT(time_t r) { cef_time_from_timet(r, this); }
|
void SetTimeT(time_t r) { cef_time_from_timet(r, this); }
|
||||||
|
@@ -48,12 +48,7 @@
|
|||||||
|
|
||||||
#define CEF_REQUIRE_UI_THREAD() DCHECK(CefCurrentlyOn(TID_UI));
|
#define CEF_REQUIRE_UI_THREAD() DCHECK(CefCurrentlyOn(TID_UI));
|
||||||
#define CEF_REQUIRE_IO_THREAD() DCHECK(CefCurrentlyOn(TID_IO));
|
#define CEF_REQUIRE_IO_THREAD() DCHECK(CefCurrentlyOn(TID_IO));
|
||||||
#define CEF_REQUIRE_FILE_BACKGROUND_THREAD() \
|
#define CEF_REQUIRE_FILE_THREAD() DCHECK(CefCurrentlyOn(TID_FILE));
|
||||||
DCHECK(CefCurrentlyOn(TID_FILE_BACKGROUND));
|
|
||||||
#define CEF_REQUIRE_FILE_USER_VISIBLE_THREAD() \
|
|
||||||
DCHECK(CefCurrentlyOn(TID_FILE_USER_VISIBLE));
|
|
||||||
#define CEF_REQUIRE_FILE_USER_BLOCKING_THREAD() \
|
|
||||||
DCHECK(CefCurrentlyOn(TID_FILE_USER_BLOCKING));
|
|
||||||
#define CEF_REQUIRE_RENDERER_THREAD() DCHECK(CefCurrentlyOn(TID_RENDERER));
|
#define CEF_REQUIRE_RENDERER_THREAD() DCHECK(CefCurrentlyOn(TID_RENDERER));
|
||||||
|
|
||||||
// Use this struct in conjuction with refcounted types to ensure that an
|
// Use this struct in conjuction with refcounted types to ensure that an
|
||||||
@@ -91,12 +86,7 @@ struct CefDeleteOnThread {
|
|||||||
|
|
||||||
struct CefDeleteOnUIThread : public CefDeleteOnThread<TID_UI> {};
|
struct CefDeleteOnUIThread : public CefDeleteOnThread<TID_UI> {};
|
||||||
struct CefDeleteOnIOThread : public CefDeleteOnThread<TID_IO> {};
|
struct CefDeleteOnIOThread : public CefDeleteOnThread<TID_IO> {};
|
||||||
struct CefDeleteOnFileBackgroundThread
|
struct CefDeleteOnFileThread : public CefDeleteOnThread<TID_FILE> {};
|
||||||
: public CefDeleteOnThread<TID_FILE_BACKGROUND> {};
|
|
||||||
struct CefDeleteOnFileUserVisibleThread
|
|
||||||
: public CefDeleteOnThread<TID_FILE_USER_VISIBLE> {};
|
|
||||||
struct CefDeleteOnFileUserBlockingThread
|
|
||||||
: public CefDeleteOnThread<TID_FILE_USER_BLOCKING> {};
|
|
||||||
struct CefDeleteOnRendererThread : public CefDeleteOnThread<TID_RENDERER> {};
|
struct CefDeleteOnRendererThread : public CefDeleteOnThread<TID_RENDERER> {};
|
||||||
|
|
||||||
// Same as IMPLEMENT_REFCOUNTING() but using the specified Destructor.
|
// Same as IMPLEMENT_REFCOUNTING() but using the specified Destructor.
|
||||||
@@ -124,6 +114,7 @@ struct CefDeleteOnRendererThread : public CefDeleteOnThread<TID_RENDERER> {};
|
|||||||
#define IMPLEMENT_REFCOUNTING_DELETE_ON_IOT(ClassName) \
|
#define IMPLEMENT_REFCOUNTING_DELETE_ON_IOT(ClassName) \
|
||||||
IMPLEMENT_REFCOUNTING_EX(ClassName, CefDeleteOnIOThread)
|
IMPLEMENT_REFCOUNTING_EX(ClassName, CefDeleteOnIOThread)
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Helper class to manage a scoped copy of |argv|.
|
// Helper class to manage a scoped copy of |argv|.
|
||||||
///
|
///
|
||||||
|
@@ -46,7 +46,7 @@
|
|||||||
// The below classes implement support for routing aynchronous messages between
|
// The below classes implement support for routing aynchronous messages between
|
||||||
// JavaScript running in the renderer process and C++ running in the browser
|
// JavaScript running in the renderer process and C++ running in the browser
|
||||||
// process. An application interacts with the router by passing it data from
|
// process. An application interacts with the router by passing it data from
|
||||||
// standard CEF C++ callbacks (OnBeforeBrowse, OnProcessMessageReceived,
|
// standard CEF C++ callbacks (OnBeforeBrowse, OnProcessMessageRecieved,
|
||||||
// OnContextCreated, etc). The renderer-side router supports generic JavaScript
|
// OnContextCreated, etc). The renderer-side router supports generic JavaScript
|
||||||
// callback registration and execution while the browser-side router supports
|
// callback registration and execution while the browser-side router supports
|
||||||
// application-specific logic via one or more application-provided Handler
|
// application-specific logic via one or more application-provided Handler
|
||||||
|
@@ -309,14 +309,25 @@ AlloyBrowserContext::GetClientHintsControllerDelegate() {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AlloyBrowserContext::SetCorsOriginAccessListForOrigin(
|
||||||
|
TargetBrowserContexts target_mode,
|
||||||
|
const url::Origin& source_origin,
|
||||||
|
std::vector<network::mojom::CorsOriginPatternPtr> allow_patterns,
|
||||||
|
std::vector<network::mojom::CorsOriginPatternPtr> block_patterns,
|
||||||
|
base::OnceClosure closure) {
|
||||||
|
// This method is called for Extension support.
|
||||||
|
base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, std::move(closure));
|
||||||
|
}
|
||||||
|
|
||||||
ChromeZoomLevelPrefs* AlloyBrowserContext::GetZoomLevelPrefs() {
|
ChromeZoomLevelPrefs* AlloyBrowserContext::GetZoomLevelPrefs() {
|
||||||
return static_cast<ChromeZoomLevelPrefs*>(
|
return static_cast<ChromeZoomLevelPrefs*>(
|
||||||
GetStoragePartition(nullptr)->GetZoomLevelDelegate());
|
GetStoragePartition(this, nullptr)->GetZoomLevelDelegate());
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_refptr<network::SharedURLLoaderFactory>
|
scoped_refptr<network::SharedURLLoaderFactory>
|
||||||
AlloyBrowserContext::GetURLLoaderFactory() {
|
AlloyBrowserContext::GetURLLoaderFactory() {
|
||||||
return GetDefaultStoragePartition()->GetURLLoaderFactoryForBrowserProcess();
|
return GetDefaultStoragePartition(this)
|
||||||
|
->GetURLLoaderFactoryForBrowserProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
base::FilePath AlloyBrowserContext::GetPath() {
|
base::FilePath AlloyBrowserContext::GetPath() {
|
||||||
@@ -338,11 +349,18 @@ AlloyBrowserContext::CreateZoomLevelDelegate(
|
|||||||
zoom::ZoomEventManager::GetForBrowserContext(this)->GetWeakPtr()));
|
zoom::ZoomEventManager::GetForBrowserContext(this)->GetWeakPtr()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AlloyBrowserContext::IsOffTheRecord() const {
|
||||||
|
// Alloy contexts are never flagged as off-the-record. It causes problems
|
||||||
|
// for the extension system.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
content::DownloadManagerDelegate*
|
content::DownloadManagerDelegate*
|
||||||
AlloyBrowserContext::GetDownloadManagerDelegate() {
|
AlloyBrowserContext::GetDownloadManagerDelegate() {
|
||||||
if (!download_manager_delegate_) {
|
if (!download_manager_delegate_) {
|
||||||
download_manager_delegate_.reset(
|
content::DownloadManager* manager =
|
||||||
new CefDownloadManagerDelegate(GetDownloadManager()));
|
BrowserContext::GetDownloadManager(this);
|
||||||
|
download_manager_delegate_.reset(new CefDownloadManagerDelegate(manager));
|
||||||
}
|
}
|
||||||
return download_manager_delegate_.get();
|
return download_manager_delegate_.get();
|
||||||
}
|
}
|
||||||
|
@@ -60,10 +60,17 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
|
|||||||
content::ResourceContext* GetResourceContext() override;
|
content::ResourceContext* GetResourceContext() override;
|
||||||
content::ClientHintsControllerDelegate* GetClientHintsControllerDelegate()
|
content::ClientHintsControllerDelegate* GetClientHintsControllerDelegate()
|
||||||
override;
|
override;
|
||||||
|
void SetCorsOriginAccessListForOrigin(
|
||||||
|
TargetBrowserContexts target_mode,
|
||||||
|
const url::Origin& source_origin,
|
||||||
|
std::vector<network::mojom::CorsOriginPatternPtr> allow_patterns,
|
||||||
|
std::vector<network::mojom::CorsOriginPatternPtr> block_patterns,
|
||||||
|
base::OnceClosure closure) override;
|
||||||
base::FilePath GetPath() override;
|
base::FilePath GetPath() override;
|
||||||
base::FilePath GetPath() const override;
|
base::FilePath GetPath() const override;
|
||||||
std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(
|
std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(
|
||||||
const base::FilePath& partition_path) override;
|
const base::FilePath& partition_path) override;
|
||||||
|
bool IsOffTheRecord() const override;
|
||||||
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
|
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
|
||||||
content::BrowserPluginGuestManager* GetGuestManager() override;
|
content::BrowserPluginGuestManager* GetGuestManager() override;
|
||||||
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
|
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
#include "libcef/browser/osr/osr_util.h"
|
#include "libcef/browser/osr/osr_util.h"
|
||||||
#include "libcef/browser/request_context_impl.h"
|
#include "libcef/browser/request_context_impl.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
|
#include "libcef/common/cef_messages.h"
|
||||||
#include "libcef/common/cef_switches.h"
|
#include "libcef/common/cef_switches.h"
|
||||||
#include "libcef/common/drag_data_impl.h"
|
#include "libcef/common/drag_data_impl.h"
|
||||||
#include "libcef/common/net/url_util.h"
|
#include "libcef/common/net/url_util.h"
|
||||||
@@ -639,7 +640,7 @@ void AlloyBrowserHostImpl::SendExternalBeginFrame() {
|
|||||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||||
CEF_POST_TASK(
|
CEF_POST_TASK(
|
||||||
CEF_UIT,
|
CEF_UIT,
|
||||||
base::BindOnce(&AlloyBrowserHostImpl::SendExternalBeginFrame, this));
|
base::Bind(&AlloyBrowserHostImpl::SendExternalBeginFrame, this));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -654,8 +655,8 @@ void AlloyBrowserHostImpl::SendTouchEvent(const CefTouchEvent& event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::SendTouchEvent,
|
CEF_POST_TASK(CEF_UIT, base::Bind(&AlloyBrowserHostImpl::SendTouchEvent,
|
||||||
this, event));
|
this, event));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -800,10 +801,10 @@ bool AlloyBrowserHostImpl::MaybeAllowNavigation(
|
|||||||
// The PDF viewer will load the PDF extension in the guest view, and print
|
// The PDF viewer will load the PDF extension in the guest view, and print
|
||||||
// preview will load chrome://print in the guest view. All other navigations
|
// preview will load chrome://print in the guest view. All other navigations
|
||||||
// are passed to the owner browser.
|
// are passed to the owner browser.
|
||||||
CEF_POST_TASK(CEF_UIT,
|
CEF_POST_TASK(
|
||||||
base::BindOnce(
|
CEF_UIT,
|
||||||
base::IgnoreResult(&AlloyBrowserHostImpl::OpenURLFromTab),
|
base::Bind(base::IgnoreResult(&AlloyBrowserHostImpl::OpenURLFromTab),
|
||||||
this, nullptr, params));
|
this, nullptr, params));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1077,8 +1078,8 @@ void AlloyBrowserHostImpl::DragSourceEndedAt(
|
|||||||
|
|
||||||
void AlloyBrowserHostImpl::SetAudioMuted(bool mute) {
|
void AlloyBrowserHostImpl::SetAudioMuted(bool mute) {
|
||||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::SetAudioMuted,
|
CEF_POST_TASK(CEF_UIT,
|
||||||
this, mute));
|
base::Bind(&AlloyBrowserHostImpl::SetAudioMuted, this, mute));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!web_contents())
|
if (!web_contents())
|
||||||
@@ -1190,9 +1191,9 @@ void AlloyBrowserHostImpl::UpdateTargetURL(content::WebContents* source,
|
|||||||
bool AlloyBrowserHostImpl::DidAddMessageToConsole(
|
bool AlloyBrowserHostImpl::DidAddMessageToConsole(
|
||||||
content::WebContents* source,
|
content::WebContents* source,
|
||||||
blink::mojom::ConsoleMessageLevel level,
|
blink::mojom::ConsoleMessageLevel level,
|
||||||
const std::u16string& message,
|
const base::string16& message,
|
||||||
int32_t line_no,
|
int32_t line_no,
|
||||||
const std::u16string& source_id) {
|
const base::string16& source_id) {
|
||||||
return contents_delegate_->DidAddMessageToConsole(source, level, message,
|
return contents_delegate_->DidAddMessageToConsole(source, level, message,
|
||||||
line_no, source_id);
|
line_no, source_id);
|
||||||
}
|
}
|
||||||
|
@@ -22,11 +22,12 @@
|
|||||||
#include "libcef/browser/menu_manager.h"
|
#include "libcef/browser/menu_manager.h"
|
||||||
#include "libcef/browser/request_context_impl.h"
|
#include "libcef/browser/request_context_impl.h"
|
||||||
|
|
||||||
|
#include "base/strings/string16.h"
|
||||||
#include "base/synchronization/lock.h"
|
#include "base/synchronization/lock.h"
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
#include "content/public/browser/web_contents_delegate.h"
|
#include "content/public/browser/web_contents_delegate.h"
|
||||||
#include "content/public/browser/web_contents_observer.h"
|
#include "content/public/browser/web_contents_observer.h"
|
||||||
#include "extensions/common/mojom/view_type.mojom-forward.h"
|
#include "extensions/common/view_type.h"
|
||||||
|
|
||||||
class CefAudioCapturer;
|
class CefAudioCapturer;
|
||||||
class CefBrowserInfo;
|
class CefBrowserInfo;
|
||||||
@@ -221,9 +222,9 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
|||||||
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
|
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
|
||||||
bool DidAddMessageToConsole(content::WebContents* source,
|
bool DidAddMessageToConsole(content::WebContents* source,
|
||||||
blink::mojom::ConsoleMessageLevel log_level,
|
blink::mojom::ConsoleMessageLevel log_level,
|
||||||
const std::u16string& message,
|
const base::string16& message,
|
||||||
int32_t line_no,
|
int32_t line_no,
|
||||||
const std::u16string& source_id) override;
|
const base::string16& source_id) override;
|
||||||
void BeforeUnloadFired(content::WebContents* source,
|
void BeforeUnloadFired(content::WebContents* source,
|
||||||
bool proceed,
|
bool proceed,
|
||||||
bool* proceed_to_fire_unload) override;
|
bool* proceed_to_fire_unload) override;
|
||||||
|
@@ -25,7 +25,6 @@
|
|||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
#include "base/strings/string_number_conversions.h"
|
||||||
#include "base/task/post_task.h"
|
#include "base/task/post_task.h"
|
||||||
#include "base/task/thread_pool.h"
|
|
||||||
#include "chrome/browser/browser_process.h"
|
#include "chrome/browser/browser_process.h"
|
||||||
#include "chrome/browser/media/router/chrome_media_router_factory.h"
|
#include "chrome/browser/media/router/chrome_media_router_factory.h"
|
||||||
#include "chrome/browser/net/system_network_context_manager.h"
|
#include "chrome/browser/net/system_network_context_manager.h"
|
||||||
@@ -109,7 +108,7 @@ void AlloyBrowserMainParts::ToolkitInitialized() {
|
|||||||
#endif // defined(TOOLKIT_VIEWS)
|
#endif // defined(TOOLKIT_VIEWS)
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlloyBrowserMainParts::PreCreateMainMessageLoop() {
|
void AlloyBrowserMainParts::PreMainMessageLoopStart() {
|
||||||
#if defined(USE_AURA) && defined(USE_X11)
|
#if defined(USE_AURA) && defined(USE_X11)
|
||||||
ui::TouchFactory::SetTouchDeviceListFromCommandLine();
|
ui::TouchFactory::SetTouchDeviceListFromCommandLine();
|
||||||
#endif
|
#endif
|
||||||
@@ -129,7 +128,7 @@ void AlloyBrowserMainParts::PreCreateMainMessageLoop() {
|
|||||||
media_router::ChromeMediaRouterFactory::DoPlatformInit();
|
media_router::ChromeMediaRouterFactory::DoPlatformInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlloyBrowserMainParts::PostCreateMainMessageLoop() {
|
void AlloyBrowserMainParts::PostMainMessageLoopStart() {
|
||||||
#if defined(OS_LINUX)
|
#if defined(OS_LINUX)
|
||||||
printing::PrintingContextLinux::SetCreatePrintDialogFunction(
|
printing::PrintingContextLinux::SetCreatePrintDialogFunction(
|
||||||
&CefPrintDialogLinux::CreatePrintDialog);
|
&CefPrintDialogLinux::CreatePrintDialog);
|
||||||
@@ -153,10 +152,9 @@ int AlloyBrowserMainParts::PreCreateThreads() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AlloyBrowserMainParts::PreMainMessageLoopRun() {
|
void AlloyBrowserMainParts::PreMainMessageLoopRun() {
|
||||||
#if defined(USE_AURA)
|
#if defined(USE_AURA)
|
||||||
screen_ = views::CreateDesktopScreen();
|
display::Screen::SetScreenInstance(views::CreateDesktopScreen());
|
||||||
display::Screen::SetScreenInstance(screen_.get());
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (extensions::ExtensionsEnabled()) {
|
if (extensions::ExtensionsEnabled()) {
|
||||||
@@ -175,14 +173,14 @@ int AlloyBrowserMainParts::PreMainMessageLoopRun() {
|
|||||||
// ChromeBrowserMainExtraPartsProfiles for details.
|
// ChromeBrowserMainExtraPartsProfiles for details.
|
||||||
cef::EnsureBrowserContextKeyedServiceFactoriesBuilt();
|
cef::EnsureBrowserContextKeyedServiceFactoriesBuilt();
|
||||||
|
|
||||||
background_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
|
background_task_runner_ = base::CreateSingleThreadTaskRunner(
|
||||||
{base::TaskPriority::BEST_EFFORT,
|
{base::ThreadPool(), base::TaskPriority::BEST_EFFORT,
|
||||||
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
||||||
user_visible_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
|
user_visible_task_runner_ = base::CreateSingleThreadTaskRunner(
|
||||||
{base::TaskPriority::USER_VISIBLE,
|
{base::ThreadPool(), base::TaskPriority::USER_VISIBLE,
|
||||||
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
||||||
user_blocking_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
|
user_blocking_task_runner_ = base::CreateSingleThreadTaskRunner(
|
||||||
{base::TaskPriority::USER_BLOCKING,
|
{base::ThreadPool(), base::TaskPriority::USER_BLOCKING,
|
||||||
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
||||||
|
|
||||||
CefRequestContextSettings settings;
|
CefRequestContextSettings settings;
|
||||||
@@ -206,8 +204,6 @@ int AlloyBrowserMainParts::PreMainMessageLoopRun() {
|
|||||||
PluginFinder::GetInstance()->Init();
|
PluginFinder::GetInstance()->Init();
|
||||||
|
|
||||||
scheme::RegisterWebUIControllerFactory();
|
scheme::RegisterWebUIControllerFactory();
|
||||||
|
|
||||||
return content::RESULT_CODE_NORMAL_EXIT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlloyBrowserMainParts::PostMainMessageLoopRun() {
|
void AlloyBrowserMainParts::PostMainMessageLoopRun() {
|
||||||
|
@@ -24,9 +24,6 @@ class ExtensionsClient;
|
|||||||
} // namespace extensions
|
} // namespace extensions
|
||||||
|
|
||||||
#if defined(USE_AURA)
|
#if defined(USE_AURA)
|
||||||
namespace display {
|
|
||||||
class Screen;
|
|
||||||
}
|
|
||||||
namespace wm {
|
namespace wm {
|
||||||
class WMState;
|
class WMState;
|
||||||
}
|
}
|
||||||
@@ -50,10 +47,10 @@ class AlloyBrowserMainParts : public content::BrowserMainParts {
|
|||||||
|
|
||||||
int PreEarlyInitialization() override;
|
int PreEarlyInitialization() override;
|
||||||
void ToolkitInitialized() override;
|
void ToolkitInitialized() override;
|
||||||
void PreCreateMainMessageLoop() override;
|
void PreMainMessageLoopStart() override;
|
||||||
void PostCreateMainMessageLoop() override;
|
void PostMainMessageLoopStart() override;
|
||||||
int PreCreateThreads() override;
|
int PreCreateThreads() override;
|
||||||
int PreMainMessageLoopRun() override;
|
void PreMainMessageLoopRun() override;
|
||||||
void PostMainMessageLoopRun() override;
|
void PostMainMessageLoopRun() override;
|
||||||
void PostDestroyThreads() override;
|
void PostDestroyThreads() override;
|
||||||
|
|
||||||
@@ -94,7 +91,6 @@ class AlloyBrowserMainParts : public content::BrowserMainParts {
|
|||||||
scoped_refptr<base::SingleThreadTaskRunner> user_blocking_task_runner_;
|
scoped_refptr<base::SingleThreadTaskRunner> user_blocking_task_runner_;
|
||||||
|
|
||||||
#if defined(USE_AURA)
|
#if defined(USE_AURA)
|
||||||
std::unique_ptr<display::Screen> screen_;
|
|
||||||
std::unique_ptr<wm::WMState> wm_state_;
|
std::unique_ptr<wm::WMState> wm_state_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -12,10 +12,9 @@
|
|||||||
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
|
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
|
||||||
#include "libcef/browser/alloy/alloy_browser_main.h"
|
#include "libcef/browser/alloy/alloy_browser_main.h"
|
||||||
#include "libcef/browser/browser_context.h"
|
#include "libcef/browser/browser_context.h"
|
||||||
#include "libcef/browser/browser_frame.h"
|
|
||||||
#include "libcef/browser/browser_info.h"
|
#include "libcef/browser/browser_info.h"
|
||||||
#include "libcef/browser/browser_info_manager.h"
|
#include "libcef/browser/browser_info_manager.h"
|
||||||
#include "libcef/browser/browser_manager.h"
|
#include "libcef/browser/browser_message_filter.h"
|
||||||
#include "libcef/browser/browser_platform_delegate.h"
|
#include "libcef/browser/browser_platform_delegate.h"
|
||||||
#include "libcef/browser/context.h"
|
#include "libcef/browser/context.h"
|
||||||
#include "libcef/browser/devtools/devtools_manager_delegate.h"
|
#include "libcef/browser/devtools/devtools_manager_delegate.h"
|
||||||
@@ -36,6 +35,7 @@
|
|||||||
#include "libcef/browser/x509_certificate_impl.h"
|
#include "libcef/browser/x509_certificate_impl.h"
|
||||||
#include "libcef/common/alloy/alloy_content_client.h"
|
#include "libcef/common/alloy/alloy_content_client.h"
|
||||||
#include "libcef/common/app_manager.h"
|
#include "libcef/common/app_manager.h"
|
||||||
|
#include "libcef/common/cef_messages.h"
|
||||||
#include "libcef/common/cef_switches.h"
|
#include "libcef/common/cef_switches.h"
|
||||||
#include "libcef/common/command_line_impl.h"
|
#include "libcef/common/command_line_impl.h"
|
||||||
#include "libcef/common/extensions/extensions_util.h"
|
#include "libcef/common/extensions/extensions_util.h"
|
||||||
@@ -98,7 +98,6 @@
|
|||||||
#include "content/public/common/storage_quota_params.h"
|
#include "content/public/common/storage_quota_params.h"
|
||||||
#include "content/public/common/url_constants.h"
|
#include "content/public/common/url_constants.h"
|
||||||
#include "content/public/common/user_agent.h"
|
#include "content/public/common/user_agent.h"
|
||||||
#include "extensions/browser/event_router.h"
|
|
||||||
#include "extensions/browser/extension_message_filter.h"
|
#include "extensions/browser/extension_message_filter.h"
|
||||||
#include "extensions/browser/extension_protocols.h"
|
#include "extensions/browser/extension_protocols.h"
|
||||||
#include "extensions/browser/extension_registry.h"
|
#include "extensions/browser/extension_registry.h"
|
||||||
@@ -239,10 +238,9 @@ class CefAllowCertificateErrorCallbackImpl : public CefRequestCallback {
|
|||||||
RunNow(std::move(callback_), allow);
|
RunNow(std::move(callback_), allow);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CEF_POST_TASK(
|
CEF_POST_TASK(CEF_UIT,
|
||||||
CEF_UIT,
|
base::Bind(&CefAllowCertificateErrorCallbackImpl::Continue,
|
||||||
base::BindOnce(&CefAllowCertificateErrorCallbackImpl::Continue, this,
|
this, allow));
|
||||||
allow));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,7 +253,7 @@ class CefAllowCertificateErrorCallbackImpl : public CefRequestCallback {
|
|||||||
CEF_REQUIRE_UIT();
|
CEF_REQUIRE_UIT();
|
||||||
std::move(callback).Run(
|
std::move(callback).Run(
|
||||||
allow ? content::CERTIFICATE_REQUEST_RESULT_TYPE_CONTINUE
|
allow ? content::CERTIFICATE_REQUEST_RESULT_TYPE_CONTINUE
|
||||||
: content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY);
|
: content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
CallbackType callback_;
|
CallbackType callback_;
|
||||||
@@ -504,6 +502,8 @@ void AlloyContentBrowserClient::RenderProcessWillLaunch(
|
|||||||
const int id = host->GetID();
|
const int id = host->GetID();
|
||||||
Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
|
Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
|
||||||
|
|
||||||
|
host->AddFilter(new CefBrowserMessageFilter(id));
|
||||||
|
|
||||||
if (extensions::ExtensionsEnabled()) {
|
if (extensions::ExtensionsEnabled()) {
|
||||||
host->AddFilter(new extensions::ExtensionMessageFilter(id, profile));
|
host->AddFilter(new extensions::ExtensionMessageFilter(id, profile));
|
||||||
host->AddFilter(
|
host->AddFilter(
|
||||||
@@ -782,7 +782,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
|
|||||||
CefRefPtr<CefCommandLineImpl> commandLinePtr(
|
CefRefPtr<CefCommandLineImpl> commandLinePtr(
|
||||||
new CefCommandLineImpl(command_line, false, false));
|
new CefCommandLineImpl(command_line, false, false));
|
||||||
handler->OnBeforeChildProcessLaunch(commandLinePtr.get());
|
handler->OnBeforeChildProcessLaunch(commandLinePtr.get());
|
||||||
ignore_result(commandLinePtr->Detach(nullptr));
|
commandLinePtr->Detach(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -855,7 +855,7 @@ void AlloyContentBrowserClient::AllowCertificateError(
|
|||||||
// A sub-resource has a certificate error. The user doesn't really
|
// A sub-resource has a certificate error. The user doesn't really
|
||||||
// have a context for making the right decision, so block the request
|
// have a context for making the right decision, so block the request
|
||||||
// hard.
|
// hard.
|
||||||
std::move(callback).Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY);
|
std::move(callback).Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -882,7 +882,7 @@ void AlloyContentBrowserClient::AllowCertificateError(
|
|||||||
// |callback| may be null if the user executed it despite returning false.
|
// |callback| may be null if the user executed it despite returning false.
|
||||||
callback = callbackImpl->Disconnect();
|
callback = callbackImpl->Disconnect();
|
||||||
if (!callback.is_null()) {
|
if (!callback.is_null()) {
|
||||||
std::move(callback).Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY);
|
std::move(callback).Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -988,9 +988,9 @@ void AlloyContentBrowserClient::DidCreatePpapiPlugin(
|
|||||||
new ChromeBrowserPepperHostFactory(browser_host)));
|
new ChromeBrowserPepperHostFactory(browser_host)));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<content::DevToolsManagerDelegate>
|
content::DevToolsManagerDelegate*
|
||||||
AlloyContentBrowserClient::CreateDevToolsManagerDelegate() {
|
AlloyContentBrowserClient::GetDevToolsManagerDelegate() {
|
||||||
return std::make_unique<CefDevToolsManagerDelegate>();
|
return new CefDevToolsManagerDelegate();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::unique_ptr<content::NavigationThrottle>>
|
std::vector<std::unique_ptr<content::NavigationThrottle>>
|
||||||
@@ -1044,14 +1044,6 @@ void AlloyContentBrowserClient::ExposeInterfacesToRenderer(
|
|||||||
content::RenderProcessHost* host) {
|
content::RenderProcessHost* host) {
|
||||||
associated_registry->AddInterface(
|
associated_registry->AddInterface(
|
||||||
base::BindRepeating(&BindPluginInfoHost, host->GetID()));
|
base::BindRepeating(&BindPluginInfoHost, host->GetID()));
|
||||||
|
|
||||||
if (extensions::ExtensionsEnabled()) {
|
|
||||||
associated_registry->AddInterface(base::BindRepeating(
|
|
||||||
&extensions::EventRouter::BindForRenderer, host->GetID()));
|
|
||||||
}
|
|
||||||
|
|
||||||
CefBrowserManager::ExposeInterfacesToRenderer(registry, associated_registry,
|
|
||||||
host);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<net::ClientCertStore>
|
std::unique_ptr<net::ClientCertStore>
|
||||||
@@ -1159,7 +1151,7 @@ bool AlloyContentBrowserClient::WillCreateURLLoaderFactory(
|
|||||||
int render_process_id,
|
int render_process_id,
|
||||||
URLLoaderFactoryType type,
|
URLLoaderFactoryType type,
|
||||||
const url::Origin& request_initiator,
|
const url::Origin& request_initiator,
|
||||||
absl::optional<int64_t> navigation_id,
|
base::Optional<int64_t> navigation_id,
|
||||||
ukm::SourceIdObj ukm_source_id,
|
ukm::SourceIdObj ukm_source_id,
|
||||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
||||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||||
@@ -1252,12 +1244,11 @@ bool AlloyContentBrowserClient::HandleExternalProtocol(
|
|||||||
const GURL& url,
|
const GURL& url,
|
||||||
content::WebContents::OnceGetter web_contents_getter,
|
content::WebContents::OnceGetter web_contents_getter,
|
||||||
int child_id,
|
int child_id,
|
||||||
int frame_tree_node_id,
|
|
||||||
content::NavigationUIData* navigation_data,
|
content::NavigationUIData* navigation_data,
|
||||||
bool is_main_frame,
|
bool is_main_frame,
|
||||||
ui::PageTransition page_transition,
|
ui::PageTransition page_transition,
|
||||||
bool has_user_gesture,
|
bool has_user_gesture,
|
||||||
const absl::optional<url::Origin>& initiating_origin,
|
const base::Optional<url::Origin>& initiating_origin,
|
||||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
|
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
|
||||||
// Call the other HandleExternalProtocol variant.
|
// Call the other HandleExternalProtocol variant.
|
||||||
return false;
|
return false;
|
||||||
@@ -1276,8 +1267,8 @@ bool AlloyContentBrowserClient::HandleExternalProtocol(
|
|||||||
// nothing handles the request.
|
// nothing handles the request.
|
||||||
auto request_handler = net_service::CreateInterceptedRequestHandler(
|
auto request_handler = net_service::CreateInterceptedRequestHandler(
|
||||||
web_contents_getter, frame_tree_node_id, resource_request,
|
web_contents_getter, frame_tree_node_id, resource_request,
|
||||||
base::BindRepeating(CefBrowserPlatformDelegate::HandleExternalProtocol,
|
base::Bind(CefBrowserPlatformDelegate::HandleExternalProtocol,
|
||||||
resource_request.url));
|
resource_request.url));
|
||||||
|
|
||||||
net_service::ProxyURLLoaderFactory::CreateProxy(
|
net_service::ProxyURLLoaderFactory::CreateProxy(
|
||||||
web_contents_getter, std::move(receiver), std::move(request_handler));
|
web_contents_getter, std::move(receiver), std::move(request_handler));
|
||||||
@@ -1300,8 +1291,6 @@ void AlloyContentBrowserClient::RegisterBrowserInterfaceBindersForFrame(
|
|||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
mojo::BinderMapWithContext<content::RenderFrameHost*>* map) {
|
mojo::BinderMapWithContext<content::RenderFrameHost*>* map) {
|
||||||
PopulateChromeFrameBinders(map);
|
PopulateChromeFrameBinders(map);
|
||||||
CefBrowserFrame::RegisterBrowserInterfaceBindersForFrame(render_frame_host,
|
|
||||||
map);
|
|
||||||
|
|
||||||
if (!extensions::ExtensionsEnabled())
|
if (!extensions::ExtensionsEnabled())
|
||||||
return;
|
return;
|
||||||
@@ -1373,7 +1362,7 @@ bool AlloyContentBrowserClient::ArePersistentMediaDeviceIDsAllowed(
|
|||||||
content::BrowserContext* browser_context,
|
content::BrowserContext* browser_context,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
const GURL& site_for_cookies,
|
const GURL& site_for_cookies,
|
||||||
const absl::optional<url::Origin>& top_frame_origin) {
|
const base::Optional<url::Origin>& top_frame_origin) {
|
||||||
// Persistent MediaDevice IDs are allowed if cookies are allowed.
|
// Persistent MediaDevice IDs are allowed if cookies are allowed.
|
||||||
return CookieSettingsFactory::GetForProfile(
|
return CookieSettingsFactory::GetForProfile(
|
||||||
Profile::FromBrowserContext(browser_context))
|
Profile::FromBrowserContext(browser_context))
|
||||||
|
@@ -109,8 +109,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
|||||||
void BrowserURLHandlerCreated(content::BrowserURLHandler* handler) override;
|
void BrowserURLHandlerCreated(content::BrowserURLHandler* handler) override;
|
||||||
std::string GetDefaultDownloadName() override;
|
std::string GetDefaultDownloadName() override;
|
||||||
void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
|
void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
|
||||||
std::unique_ptr<content::DevToolsManagerDelegate>
|
content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override;
|
||||||
CreateDevToolsManagerDelegate() override;
|
|
||||||
std::vector<std::unique_ptr<content::NavigationThrottle>>
|
std::vector<std::unique_ptr<content::NavigationThrottle>>
|
||||||
CreateThrottlesForNavigation(
|
CreateThrottlesForNavigation(
|
||||||
content::NavigationHandle* navigation_handle) override;
|
content::NavigationHandle* navigation_handle) override;
|
||||||
@@ -158,7 +157,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
|||||||
int render_process_id,
|
int render_process_id,
|
||||||
URLLoaderFactoryType type,
|
URLLoaderFactoryType type,
|
||||||
const url::Origin& request_initiator,
|
const url::Origin& request_initiator,
|
||||||
absl::optional<int64_t> navigation_id,
|
base::Optional<int64_t> navigation_id,
|
||||||
ukm::SourceIdObj ukm_source_id,
|
ukm::SourceIdObj ukm_source_id,
|
||||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
||||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||||
@@ -180,12 +179,11 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
|||||||
const GURL& url,
|
const GURL& url,
|
||||||
content::WebContents::OnceGetter web_contents_getter,
|
content::WebContents::OnceGetter web_contents_getter,
|
||||||
int child_id,
|
int child_id,
|
||||||
int frame_tree_node_id,
|
|
||||||
content::NavigationUIData* navigation_data,
|
content::NavigationUIData* navigation_data,
|
||||||
bool is_main_frame,
|
bool is_main_frame,
|
||||||
ui::PageTransition page_transition,
|
ui::PageTransition page_transition,
|
||||||
bool has_user_gesture,
|
bool has_user_gesture,
|
||||||
const absl::optional<url::Origin>& initiating_origin,
|
const base::Optional<url::Origin>& initiating_origin,
|
||||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
|
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
|
||||||
override;
|
override;
|
||||||
bool HandleExternalProtocol(
|
bool HandleExternalProtocol(
|
||||||
@@ -211,7 +209,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
|||||||
content::BrowserContext* browser_context,
|
content::BrowserContext* browser_context,
|
||||||
const GURL& scope,
|
const GURL& scope,
|
||||||
const GURL& site_for_cookies,
|
const GURL& site_for_cookies,
|
||||||
const absl::optional<url::Origin>& top_frame_origin) override;
|
const base::Optional<url::Origin>& top_frame_origin) override;
|
||||||
bool ShouldAllowPluginCreation(
|
bool ShouldAllowPluginCreation(
|
||||||
const url::Origin& embedder_origin,
|
const url::Origin& embedder_origin,
|
||||||
const content::PepperPluginInfo& plugin_info) override;
|
const content::PepperPluginInfo& plugin_info) override;
|
||||||
|
@@ -68,11 +68,10 @@ content::WebContents* CefBrowserPlatformDelegateAlloy::CreateWebContents(
|
|||||||
extensions::GetExtensionForUrl(browser_context, gurl);
|
extensions::GetExtensionForUrl(browser_context, gurl);
|
||||||
}
|
}
|
||||||
if (create_params.extension) {
|
if (create_params.extension) {
|
||||||
if (create_params.extension_host_type ==
|
if (create_params.extension_host_type == extensions::VIEW_TYPE_INVALID) {
|
||||||
extensions::mojom::ViewType::kInvalid) {
|
|
||||||
// Default to dialog behavior.
|
// Default to dialog behavior.
|
||||||
create_params.extension_host_type =
|
create_params.extension_host_type =
|
||||||
extensions::mojom::ViewType::kExtensionDialog;
|
extensions::VIEW_TYPE_EXTENSION_DIALOG;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extension resources will fail to load if we don't use a SiteInstance
|
// Extension resources will fail to load if we don't use a SiteInstance
|
||||||
@@ -192,7 +191,7 @@ void CefBrowserPlatformDelegateAlloy::BrowserCreated(
|
|||||||
void CefBrowserPlatformDelegateAlloy::CreateExtensionHost(
|
void CefBrowserPlatformDelegateAlloy::CreateExtensionHost(
|
||||||
const extensions::Extension* extension,
|
const extensions::Extension* extension,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
extensions::mojom::ViewType host_type) {
|
extensions::ViewType host_type) {
|
||||||
REQUIRE_ALLOY_RUNTIME();
|
REQUIRE_ALLOY_RUNTIME();
|
||||||
DCHECK(primary_);
|
DCHECK(primary_);
|
||||||
|
|
||||||
@@ -203,15 +202,14 @@ void CefBrowserPlatformDelegateAlloy::CreateExtensionHost(
|
|||||||
|
|
||||||
auto alloy_browser = static_cast<AlloyBrowserHostImpl*>(browser_);
|
auto alloy_browser = static_cast<AlloyBrowserHostImpl*>(browser_);
|
||||||
|
|
||||||
if (host_type == extensions::mojom::ViewType::kExtensionDialog ||
|
if (host_type == extensions::VIEW_TYPE_EXTENSION_DIALOG ||
|
||||||
host_type == extensions::mojom::ViewType::kExtensionPopup) {
|
host_type == extensions::VIEW_TYPE_EXTENSION_POPUP) {
|
||||||
// Create an extension host that we own.
|
// Create an extension host that we own.
|
||||||
extension_host_ = new extensions::CefExtensionViewHost(
|
extension_host_ = new extensions::CefExtensionViewHost(
|
||||||
alloy_browser, extension, web_contents_, url, host_type);
|
alloy_browser, extension, web_contents_, url, host_type);
|
||||||
// Trigger load of the extension URL.
|
// Trigger load of the extension URL.
|
||||||
extension_host_->CreateRendererSoon();
|
extension_host_->CreateRendererSoon();
|
||||||
} else if (host_type ==
|
} else if (host_type == extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
|
||||||
extensions::mojom::ViewType::kExtensionBackgroundPage) {
|
|
||||||
is_background_host_ = true;
|
is_background_host_ = true;
|
||||||
alloy_browser->is_background_host_ = true;
|
alloy_browser->is_background_host_ = true;
|
||||||
// Create an extension host that will be owned by ProcessManager.
|
// Create an extension host that will be owned by ProcessManager.
|
||||||
@@ -379,12 +377,12 @@ void CefBrowserPlatformDelegateAlloy::PrintToPDF(
|
|||||||
return;
|
return;
|
||||||
printing::CefPrintViewManager::PdfPrintCallback pdf_callback;
|
printing::CefPrintViewManager::PdfPrintCallback pdf_callback;
|
||||||
if (callback.get()) {
|
if (callback.get()) {
|
||||||
pdf_callback = base::BindOnce(&CefPdfPrintCallback::OnPdfPrintFinished,
|
pdf_callback = base::Bind(&CefPdfPrintCallback::OnPdfPrintFinished,
|
||||||
callback.get(), path);
|
callback.get(), path);
|
||||||
}
|
}
|
||||||
GetPrintViewManager(actionable_contents)
|
GetPrintViewManager(actionable_contents)
|
||||||
->PrintToPDF(actionable_contents->GetMainFrame(), base::FilePath(path),
|
->PrintToPDF(actionable_contents->GetMainFrame(), base::FilePath(path),
|
||||||
settings, std::move(pdf_callback));
|
settings, pdf_callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserPlatformDelegateAlloy::Find(int identifier,
|
void CefBrowserPlatformDelegateAlloy::Find(int identifier,
|
||||||
@@ -453,7 +451,7 @@ void CefBrowserPlatformDelegateAlloy::DestroyExtensionHost() {
|
|||||||
if (!extension_host_)
|
if (!extension_host_)
|
||||||
return;
|
return;
|
||||||
if (extension_host_->extension_host_type() ==
|
if (extension_host_->extension_host_type() ==
|
||||||
extensions::mojom::ViewType::kExtensionBackgroundPage) {
|
extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
|
||||||
DCHECK(is_background_host_);
|
DCHECK(is_background_host_);
|
||||||
// Close notification for background pages arrives via CloseContents.
|
// Close notification for background pages arrives via CloseContents.
|
||||||
// The extension host will be deleted by
|
// The extension host will be deleted by
|
||||||
|
@@ -33,7 +33,7 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
|
|||||||
void BrowserCreated(CefBrowserHostBase* browser) override;
|
void BrowserCreated(CefBrowserHostBase* browser) override;
|
||||||
void CreateExtensionHost(const extensions::Extension* extension,
|
void CreateExtensionHost(const extensions::Extension* extension,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
extensions::mojom::ViewType host_type) override;
|
extensions::ViewType host_type) override;
|
||||||
extensions::ExtensionHost* GetExtensionHost() const override;
|
extensions::ExtensionHost* GetExtensionHost() const override;
|
||||||
void BrowserDestroyed(CefBrowserHostBase* browser) override;
|
void BrowserDestroyed(CefBrowserHostBase* browser) override;
|
||||||
void SendCaptureLostEvent() override;
|
void SendCaptureLostEvent() override;
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
#include "libcef/browser/alloy/chrome_profile_alloy.h"
|
#include "libcef/browser/alloy/chrome_profile_alloy.h"
|
||||||
|
|
||||||
#include "base/no_destructor.h"
|
#include "base/no_destructor.h"
|
||||||
#include "components/profile_metrics/browser_profile_type.h"
|
|
||||||
#include "components/variations/variations_client.h"
|
#include "components/variations/variations_client.h"
|
||||||
#include "components/variations/variations_ids_provider.h"
|
#include "components/variations/variations_ids_provider.h"
|
||||||
#include "net/url_request/url_request_context.h"
|
#include "net/url_request/url_request_context.h"
|
||||||
@@ -36,10 +35,7 @@ class CefVariationsClient : public variations::VariationsClient {
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
ChromeProfileAlloy::ChromeProfileAlloy() {
|
ChromeProfileAlloy::ChromeProfileAlloy() {}
|
||||||
profile_metrics::SetBrowserProfileType(
|
|
||||||
this, profile_metrics::BrowserProfileType::kRegular);
|
|
||||||
}
|
|
||||||
|
|
||||||
ChromeProfileAlloy::~ChromeProfileAlloy() {}
|
ChromeProfileAlloy::~ChromeProfileAlloy() {}
|
||||||
|
|
||||||
@@ -48,15 +44,13 @@ bool ChromeProfileAlloy::IsOffTheRecord() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ChromeProfileAlloy::IsOffTheRecord() const {
|
bool ChromeProfileAlloy::IsOffTheRecord() const {
|
||||||
// Alloy contexts are never flagged as off-the-record. It causes problems
|
|
||||||
// for the extension system.
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Profile::OTRProfileID& ChromeProfileAlloy::GetOTRProfileID() const {
|
const Profile::OTRProfileID& ChromeProfileAlloy::GetOTRProfileID() const {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
static base::NoDestructor<Profile::OTRProfileID> otr_profile_id(
|
static base::NoDestructor<Profile::OTRProfileID> otr_profile_id(
|
||||||
Profile::OTRProfileID::PrimaryID());
|
"ProfileImp::NoOTRProfileID");
|
||||||
return *otr_profile_id;
|
return *otr_profile_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,8 +71,7 @@ std::string ChromeProfileAlloy::GetProfileUserName() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Profile* ChromeProfileAlloy::GetOffTheRecordProfile(
|
Profile* ChromeProfileAlloy::GetOffTheRecordProfile(
|
||||||
const Profile::OTRProfileID& otr_profile_id,
|
const Profile::OTRProfileID& otr_profile_id) {
|
||||||
bool create_if_needed) {
|
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@@ -122,6 +115,11 @@ ChromeProfileAlloy::GetExtensionSpecialStoragePolicy() {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PrefService* ChromeProfileAlloy::GetOffTheRecordPrefs() {
|
||||||
|
NOTREACHED();
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
bool ChromeProfileAlloy::IsSameOrParent(Profile* profile) {
|
bool ChromeProfileAlloy::IsSameOrParent(Profile* profile) {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
return false;
|
return false;
|
||||||
|
@@ -26,8 +26,8 @@ class ChromeProfileAlloy : public Profile {
|
|||||||
variations::VariationsClient* GetVariationsClient() override;
|
variations::VariationsClient* GetVariationsClient() override;
|
||||||
scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner() override;
|
scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner() override;
|
||||||
std::string GetProfileUserName() const override;
|
std::string GetProfileUserName() const override;
|
||||||
Profile* GetOffTheRecordProfile(const Profile::OTRProfileID& otr_profile_id,
|
Profile* GetOffTheRecordProfile(
|
||||||
bool create_if_needed) override;
|
const Profile::OTRProfileID& otr_profile_id) override;
|
||||||
std::vector<Profile*> GetAllOffTheRecordProfiles() override;
|
std::vector<Profile*> GetAllOffTheRecordProfiles() override;
|
||||||
void DestroyOffTheRecordProfile(Profile* otr_profile) override;
|
void DestroyOffTheRecordProfile(Profile* otr_profile) override;
|
||||||
bool HasOffTheRecordProfile(
|
bool HasOffTheRecordProfile(
|
||||||
@@ -38,6 +38,7 @@ class ChromeProfileAlloy : public Profile {
|
|||||||
bool IsSupervised() const override;
|
bool IsSupervised() const override;
|
||||||
bool IsChild() const override;
|
bool IsChild() const override;
|
||||||
ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy() override;
|
ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy() override;
|
||||||
|
PrefService* GetOffTheRecordPrefs() override;
|
||||||
bool IsSameOrParent(Profile* profile) override;
|
bool IsSameOrParent(Profile* profile) override;
|
||||||
base::Time GetStartTime() const override;
|
base::Time GetStartTime() const override;
|
||||||
base::FilePath last_selected_directory() override;
|
base::FilePath last_selected_directory() override;
|
||||||
|
@@ -56,3 +56,10 @@ bool ChromeProfileManagerAlloy::IsValidProfile(const void* profile) {
|
|||||||
return !!CefBrowserContext::FromBrowserContext(
|
return !!CefBrowserContext::FromBrowserContext(
|
||||||
static_cast<const content::BrowserContext*>(profile));
|
static_cast<const content::BrowserContext*>(profile));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Profile* ChromeProfileManagerAlloy::GetLastUsedProfile(
|
||||||
|
const base::FilePath& user_data_dir) {
|
||||||
|
// Override this method to avoid having to register prefs::kProfileLastUsed,
|
||||||
|
// usage of which doesn't make sense for CEF.
|
||||||
|
return GetActiveBrowserContext()->AsProfile();
|
||||||
|
}
|
||||||
|
@@ -18,6 +18,7 @@ class ChromeProfileManagerAlloy : public ProfileManager {
|
|||||||
|
|
||||||
Profile* GetProfile(const base::FilePath& profile_dir) override;
|
Profile* GetProfile(const base::FilePath& profile_dir) override;
|
||||||
bool IsValidProfile(const void* profile) override;
|
bool IsValidProfile(const void* profile) override;
|
||||||
|
Profile* GetLastUsedProfile(const base::FilePath& user_data_dir) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DISALLOW_COPY_AND_ASSIGN(ChromeProfileManagerAlloy);
|
DISALLOW_COPY_AND_ASSIGN(ChromeProfileManagerAlloy);
|
||||||
|
@@ -110,9 +110,7 @@ void CefAudioCapturer::Capture(const media::AudioBus* source,
|
|||||||
pts.InMilliseconds());
|
pts.InMilliseconds());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefAudioCapturer::OnCaptureError(
|
void CefAudioCapturer::OnCaptureError(const std::string& message) {
|
||||||
media::AudioCapturerSource::ErrorCode code,
|
|
||||||
const std::string& message) {
|
|
||||||
audio_handler_->OnAudioStreamError(browser_, message);
|
audio_handler_->OnAudioStreamError(browser_, message);
|
||||||
StopStream();
|
StopStream();
|
||||||
}
|
}
|
||||||
|
@@ -33,8 +33,7 @@ class CefAudioCapturer : public media::AudioCapturerSource::CaptureCallback {
|
|||||||
base::TimeTicks audio_capture_time,
|
base::TimeTicks audio_capture_time,
|
||||||
double volume,
|
double volume,
|
||||||
bool key_pressed) override;
|
bool key_pressed) override;
|
||||||
void OnCaptureError(media::AudioCapturerSource::ErrorCode code,
|
void OnCaptureError(const std::string& message) override;
|
||||||
const std::string& message) override;
|
|
||||||
void OnCaptureMuted(bool is_muted) override {}
|
void OnCaptureMuted(bool is_muted) override {}
|
||||||
|
|
||||||
void StopStream();
|
void StopStream();
|
||||||
|
@@ -44,7 +44,7 @@ class StreamCreatedCallbackAdapter final
|
|||||||
client_receiver,
|
client_receiver,
|
||||||
media::mojom::ReadOnlyAudioDataPipePtr data_pipe,
|
media::mojom::ReadOnlyAudioDataPipePtr data_pipe,
|
||||||
bool initially_muted,
|
bool initially_muted,
|
||||||
const absl::optional<base::UnguessableToken>& stream_id) override {
|
const base::Optional<base::UnguessableToken>& stream_id) override {
|
||||||
DCHECK(!initially_muted); // Loopback streams shouldn't be started muted.
|
DCHECK(!initially_muted); // Loopback streams shouldn't be started muted.
|
||||||
callback_.Run(std::move(stream), std::move(client_receiver),
|
callback_.Run(std::move(stream), std::move(client_receiver),
|
||||||
std::move(data_pipe));
|
std::move(data_pipe));
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
#include "libcef/browser/browser_platform_delegate.h"
|
#include "libcef/browser/browser_platform_delegate.h"
|
||||||
#include "libcef/browser/browser_util.h"
|
#include "libcef/browser/browser_util.h"
|
||||||
|
|
||||||
#include "content/public/browser/focused_node_details.h"
|
|
||||||
#include "content/public/browser/keyboard_event_processing_result.h"
|
#include "content/public/browser/keyboard_event_processing_result.h"
|
||||||
#include "content/public/browser/native_web_keyboard_event.h"
|
#include "content/public/browser/native_web_keyboard_event.h"
|
||||||
#include "content/public/browser/navigation_entry.h"
|
#include "content/public/browser/navigation_entry.h"
|
||||||
@@ -17,8 +16,6 @@
|
|||||||
#include "content/public/browser/notification_source.h"
|
#include "content/public/browser/notification_source.h"
|
||||||
#include "content/public/browser/notification_types.h"
|
#include "content/public/browser/notification_types.h"
|
||||||
#include "content/public/browser/render_view_host.h"
|
#include "content/public/browser/render_view_host.h"
|
||||||
#include "third_party/blink/public/mojom/favicon/favicon_url.mojom.h"
|
|
||||||
#include "third_party/blink/public/mojom/input/focus_type.mojom-blink.h"
|
|
||||||
|
|
||||||
using content::KeyboardEventProcessingResult;
|
using content::KeyboardEventProcessingResult;
|
||||||
|
|
||||||
@@ -130,9 +127,9 @@ void CefBrowserContentsDelegate::UpdateTargetURL(content::WebContents* source,
|
|||||||
bool CefBrowserContentsDelegate::DidAddMessageToConsole(
|
bool CefBrowserContentsDelegate::DidAddMessageToConsole(
|
||||||
content::WebContents* source,
|
content::WebContents* source,
|
||||||
blink::mojom::ConsoleMessageLevel log_level,
|
blink::mojom::ConsoleMessageLevel log_level,
|
||||||
const std::u16string& message,
|
const base::string16& message,
|
||||||
int32_t line_no,
|
int32_t line_no,
|
||||||
const std::u16string& source_id) {
|
const base::string16& source_id) {
|
||||||
if (auto c = client()) {
|
if (auto c = client()) {
|
||||||
if (auto handler = c->GetDisplayHandler()) {
|
if (auto handler = c->GetDisplayHandler()) {
|
||||||
// Use LOGSEVERITY_DEBUG for unrecognized |level| values.
|
// Use LOGSEVERITY_DEBUG for unrecognized |level| values.
|
||||||
@@ -234,6 +231,18 @@ bool CefBrowserContentsDelegate::HandleKeyboardEvent(
|
|||||||
void CefBrowserContentsDelegate::RenderFrameCreated(
|
void CefBrowserContentsDelegate::RenderFrameCreated(
|
||||||
content::RenderFrameHost* render_frame_host) {
|
content::RenderFrameHost* render_frame_host) {
|
||||||
browser_info_->MaybeCreateFrame(render_frame_host, false /* is_guest_view */);
|
browser_info_->MaybeCreateFrame(render_frame_host, false /* is_guest_view */);
|
||||||
|
|
||||||
|
if (render_frame_host->GetParent() == nullptr) {
|
||||||
|
// May be already registered if the renderer crashed previously.
|
||||||
|
auto render_view_host = render_frame_host->GetRenderViewHost();
|
||||||
|
if (!registrar_->IsRegistered(
|
||||||
|
this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
|
||||||
|
content::Source<content::RenderViewHost>(render_view_host))) {
|
||||||
|
registrar_->Add(
|
||||||
|
this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
|
||||||
|
content::Source<content::RenderViewHost>(render_view_host));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserContentsDelegate::RenderFrameHostChanged(
|
void CefBrowserContentsDelegate::RenderFrameHostChanged(
|
||||||
@@ -243,13 +252,6 @@ void CefBrowserContentsDelegate::RenderFrameHostChanged(
|
|||||||
RenderFrameCreated(new_host);
|
RenderFrameCreated(new_host);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserContentsDelegate::RenderFrameHostStateChanged(
|
|
||||||
content::RenderFrameHost* host,
|
|
||||||
content::RenderFrameHost::LifecycleState old_state,
|
|
||||||
content::RenderFrameHost::LifecycleState new_state) {
|
|
||||||
browser_info_->FrameHostStateChanged(host, old_state, new_state);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefBrowserContentsDelegate::RenderFrameDeleted(
|
void CefBrowserContentsDelegate::RenderFrameDeleted(
|
||||||
content::RenderFrameHost* render_frame_host) {
|
content::RenderFrameHost* render_frame_host) {
|
||||||
const auto frame_id = CefFrameHostImpl::MakeFrameId(render_frame_host);
|
const auto frame_id = CefFrameHostImpl::MakeFrameId(render_frame_host);
|
||||||
@@ -261,6 +263,17 @@ void CefBrowserContentsDelegate::RenderFrameDeleted(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefBrowserContentsDelegate::RenderViewDeleted(
|
||||||
|
content::RenderViewHost* render_view_host) {
|
||||||
|
if (registrar_->IsRegistered(
|
||||||
|
this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
|
||||||
|
content::Source<content::RenderViewHost>(render_view_host))) {
|
||||||
|
registrar_->Remove(
|
||||||
|
this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
|
||||||
|
content::Source<content::RenderViewHost>(render_view_host));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CefBrowserContentsDelegate::RenderViewReady() {
|
void CefBrowserContentsDelegate::RenderViewReady() {
|
||||||
if (auto c = client()) {
|
if (auto c = client()) {
|
||||||
if (auto handler = c->GetRequestHandler()) {
|
if (auto handler = c->GetRequestHandler()) {
|
||||||
@@ -315,8 +328,7 @@ void CefBrowserContentsDelegate::OnFrameFocused(
|
|||||||
OnStateChanged(State::kFocusedFrame);
|
OnStateChanged(State::kFocusedFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserContentsDelegate::DocumentAvailableInMainFrame(
|
void CefBrowserContentsDelegate::DocumentAvailableInMainFrame() {
|
||||||
content::RenderFrameHost* render_frame_host) {
|
|
||||||
has_document_ = true;
|
has_document_ = true;
|
||||||
OnStateChanged(State::kDocument);
|
OnStateChanged(State::kDocument);
|
||||||
|
|
||||||
@@ -412,6 +424,18 @@ void CefBrowserContentsDelegate::DidFailLoad(
|
|||||||
OnLoadEnd(frame, validated_url, error_code);
|
OnLoadEnd(frame, validated_url, error_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CefBrowserContentsDelegate::OnMessageReceived(
|
||||||
|
const IPC::Message& message,
|
||||||
|
content::RenderFrameHost* render_frame_host) {
|
||||||
|
// Messages may arrive after a frame is detached. Ignore those messages.
|
||||||
|
auto frame = browser_info_->GetFrameForHost(render_frame_host);
|
||||||
|
if (frame) {
|
||||||
|
return static_cast<CefFrameHostImpl*>(frame.get())
|
||||||
|
->OnMessageReceived(message);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void CefBrowserContentsDelegate::TitleWasSet(content::NavigationEntry* entry) {
|
void CefBrowserContentsDelegate::TitleWasSet(content::NavigationEntry* entry) {
|
||||||
// |entry| may be NULL if a popup is created via window.open and never
|
// |entry| may be NULL if a popup is created via window.open and never
|
||||||
// navigated.
|
// navigated.
|
||||||
@@ -458,13 +482,6 @@ void CefBrowserContentsDelegate::OnWebContentsFocused(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserContentsDelegate::OnFocusChangedInPage(
|
|
||||||
content::FocusedNodeDetails* details) {
|
|
||||||
focus_on_editable_field_ =
|
|
||||||
details->focus_type != blink::mojom::blink::FocusType::kNone &&
|
|
||||||
details->is_editable_node;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefBrowserContentsDelegate::WebContentsDestroyed() {
|
void CefBrowserContentsDelegate::WebContentsDestroyed() {
|
||||||
auto wc = web_contents();
|
auto wc = web_contents();
|
||||||
ObserveWebContents(nullptr);
|
ObserveWebContents(nullptr);
|
||||||
@@ -477,12 +494,15 @@ void CefBrowserContentsDelegate::Observe(
|
|||||||
int type,
|
int type,
|
||||||
const content::NotificationSource& source,
|
const content::NotificationSource& source,
|
||||||
const content::NotificationDetails& details) {
|
const content::NotificationDetails& details) {
|
||||||
DCHECK_EQ(type, content::NOTIFICATION_LOAD_STOP);
|
DCHECK(type == content::NOTIFICATION_LOAD_STOP ||
|
||||||
|
type == content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE);
|
||||||
|
|
||||||
if (type == content::NOTIFICATION_LOAD_STOP) {
|
if (type == content::NOTIFICATION_LOAD_STOP) {
|
||||||
content::NavigationController* controller =
|
content::NavigationController* controller =
|
||||||
content::Source<content::NavigationController>(source).ptr();
|
content::Source<content::NavigationController>(source).ptr();
|
||||||
OnTitleChange(controller->GetWebContents()->GetTitle());
|
OnTitleChange(controller->GetWebContents()->GetTitle());
|
||||||
|
} else if (type == content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE) {
|
||||||
|
focus_on_editable_field_ = *content::Details<bool>(details).ptr();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -572,7 +592,7 @@ void CefBrowserContentsDelegate::OnLoadError(CefRefPtr<CefFrame> frame,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserContentsDelegate::OnTitleChange(const std::u16string& title) {
|
void CefBrowserContentsDelegate::OnTitleChange(const base::string16& title) {
|
||||||
if (auto c = client()) {
|
if (auto c = client()) {
|
||||||
if (auto handler = c->GetDisplayHandler()) {
|
if (auto handler = c->GetDisplayHandler()) {
|
||||||
handler->OnTitleChange(browser(), title);
|
handler->OnTitleChange(browser(), title);
|
||||||
|
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#include "libcef/browser/frame_host_impl.h"
|
#include "libcef/browser/frame_host_impl.h"
|
||||||
|
|
||||||
#include "base/callback_list.h"
|
|
||||||
#include "base/observer_list.h"
|
#include "base/observer_list.h"
|
||||||
#include "content/public/browser/notification_observer.h"
|
#include "content/public/browser/notification_observer.h"
|
||||||
#include "content/public/browser/notification_registrar.h"
|
#include "content/public/browser/notification_registrar.h"
|
||||||
@@ -88,9 +87,9 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
|
|||||||
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
|
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
|
||||||
bool DidAddMessageToConsole(content::WebContents* source,
|
bool DidAddMessageToConsole(content::WebContents* source,
|
||||||
blink::mojom::ConsoleMessageLevel log_level,
|
blink::mojom::ConsoleMessageLevel log_level,
|
||||||
const std::u16string& message,
|
const base::string16& message,
|
||||||
int32_t line_no,
|
int32_t line_no,
|
||||||
const std::u16string& source_id) override;
|
const base::string16& source_id) override;
|
||||||
void DidNavigateMainFramePostCommit(
|
void DidNavigateMainFramePostCommit(
|
||||||
content::WebContents* web_contents) override;
|
content::WebContents* web_contents) override;
|
||||||
void EnterFullscreenModeForTab(
|
void EnterFullscreenModeForTab(
|
||||||
@@ -108,16 +107,12 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
|
|||||||
void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
|
void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
|
||||||
void RenderFrameHostChanged(content::RenderFrameHost* old_host,
|
void RenderFrameHostChanged(content::RenderFrameHost* old_host,
|
||||||
content::RenderFrameHost* new_host) override;
|
content::RenderFrameHost* new_host) override;
|
||||||
void RenderFrameHostStateChanged(
|
|
||||||
content::RenderFrameHost* host,
|
|
||||||
content::RenderFrameHost::LifecycleState old_state,
|
|
||||||
content::RenderFrameHost::LifecycleState new_state) override;
|
|
||||||
void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
|
void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
|
||||||
|
void RenderViewDeleted(content::RenderViewHost* render_view_host) override;
|
||||||
void RenderViewReady() override;
|
void RenderViewReady() override;
|
||||||
void RenderProcessGone(base::TerminationStatus status) override;
|
void RenderProcessGone(base::TerminationStatus status) override;
|
||||||
void OnFrameFocused(content::RenderFrameHost* render_frame_host) override;
|
void OnFrameFocused(content::RenderFrameHost* render_frame_host) override;
|
||||||
void DocumentAvailableInMainFrame(
|
void DocumentAvailableInMainFrame() override;
|
||||||
content::RenderFrameHost* render_frame_host) override;
|
|
||||||
void LoadProgressChanged(double progress) override;
|
void LoadProgressChanged(double progress) override;
|
||||||
void DidStopLoading() override;
|
void DidStopLoading() override;
|
||||||
void DidFinishNavigation(
|
void DidFinishNavigation(
|
||||||
@@ -125,6 +120,8 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
|
|||||||
void DidFailLoad(content::RenderFrameHost* render_frame_host,
|
void DidFailLoad(content::RenderFrameHost* render_frame_host,
|
||||||
const GURL& validated_url,
|
const GURL& validated_url,
|
||||||
int error_code) override;
|
int error_code) override;
|
||||||
|
bool OnMessageReceived(const IPC::Message& message,
|
||||||
|
content::RenderFrameHost* render_frame_host) override;
|
||||||
void TitleWasSet(content::NavigationEntry* entry) override;
|
void TitleWasSet(content::NavigationEntry* entry) override;
|
||||||
void PluginCrashed(const base::FilePath& plugin_path,
|
void PluginCrashed(const base::FilePath& plugin_path,
|
||||||
base::ProcessId plugin_pid) override;
|
base::ProcessId plugin_pid) override;
|
||||||
@@ -133,7 +130,6 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
|
|||||||
const std::vector<blink::mojom::FaviconURLPtr>& candidates) override;
|
const std::vector<blink::mojom::FaviconURLPtr>& candidates) override;
|
||||||
void OnWebContentsFocused(
|
void OnWebContentsFocused(
|
||||||
content::RenderWidgetHost* render_widget_host) override;
|
content::RenderWidgetHost* render_widget_host) override;
|
||||||
void OnFocusChangedInPage(content::FocusedNodeDetails* details) override;
|
|
||||||
void WebContentsDestroyed() override;
|
void WebContentsDestroyed() override;
|
||||||
|
|
||||||
// NotificationObserver methods.
|
// NotificationObserver methods.
|
||||||
@@ -167,7 +163,7 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
|
|||||||
void OnLoadStart(CefRefPtr<CefFrame> frame,
|
void OnLoadStart(CefRefPtr<CefFrame> frame,
|
||||||
ui::PageTransition transition_type);
|
ui::PageTransition transition_type);
|
||||||
void OnLoadError(CefRefPtr<CefFrame> frame, const GURL& url, int error_code);
|
void OnLoadError(CefRefPtr<CefFrame> frame, const GURL& url, int error_code);
|
||||||
void OnTitleChange(const std::u16string& title);
|
void OnTitleChange(const base::string16& title);
|
||||||
void OnFullscreenModeChange(bool fullscreen);
|
void OnFullscreenModeChange(bool fullscreen);
|
||||||
|
|
||||||
void OnStateChanged(State state_changed);
|
void OnStateChanged(State state_changed);
|
||||||
|
@@ -229,9 +229,7 @@ void CefBrowserContext::RemoveCefRequestContext(
|
|||||||
// Delete ourselves when the reference count reaches zero.
|
// Delete ourselves when the reference count reaches zero.
|
||||||
if (request_context_set_.empty()) {
|
if (request_context_set_.empty()) {
|
||||||
Shutdown();
|
Shutdown();
|
||||||
|
delete this;
|
||||||
// Allow the current call stack to unwind before deleting |this|.
|
|
||||||
content::BrowserThread::DeleteSoon(CEF_UIT, FROM_HERE, this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,9 +300,9 @@ void CefBrowserContext::OnRenderFrameCreated(
|
|||||||
frame_tree_node_id, handler);
|
frame_tree_node_id, handler);
|
||||||
|
|
||||||
CEF_POST_TASK(CEF_IOT,
|
CEF_POST_TASK(CEF_IOT,
|
||||||
base::BindOnce(&CefIOThreadState::AddHandler, iothread_state_,
|
base::Bind(&CefIOThreadState::AddHandler, iothread_state_,
|
||||||
render_process_id, render_frame_id,
|
render_process_id, render_frame_id,
|
||||||
frame_tree_node_id, handler));
|
frame_tree_node_id, handler));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,9 +332,9 @@ void CefBrowserContext::OnRenderFrameDeleted(
|
|||||||
handler_map_.RemoveHandler(render_process_id, render_frame_id,
|
handler_map_.RemoveHandler(render_process_id, render_frame_id,
|
||||||
frame_tree_node_id);
|
frame_tree_node_id);
|
||||||
|
|
||||||
CEF_POST_TASK(CEF_IOT, base::BindOnce(&CefIOThreadState::RemoveHandler,
|
CEF_POST_TASK(CEF_IOT, base::Bind(&CefIOThreadState::RemoveHandler,
|
||||||
iothread_state_, render_process_id,
|
iothread_state_, render_process_id,
|
||||||
render_frame_id, frame_tree_node_id));
|
render_frame_id, frame_tree_node_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_main_frame) {
|
if (is_main_frame) {
|
||||||
@@ -440,16 +438,15 @@ void CefBrowserContext::RegisterSchemeHandlerFactory(
|
|||||||
const CefString& scheme_name,
|
const CefString& scheme_name,
|
||||||
const CefString& domain_name,
|
const CefString& domain_name,
|
||||||
CefRefPtr<CefSchemeHandlerFactory> factory) {
|
CefRefPtr<CefSchemeHandlerFactory> factory) {
|
||||||
CEF_POST_TASK(
|
CEF_POST_TASK(CEF_IOT,
|
||||||
CEF_IOT,
|
base::Bind(&CefIOThreadState::RegisterSchemeHandlerFactory,
|
||||||
base::BindOnce(&CefIOThreadState::RegisterSchemeHandlerFactory,
|
iothread_state_, scheme_name, domain_name, factory));
|
||||||
iothread_state_, scheme_name, domain_name, factory));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserContext::ClearSchemeHandlerFactories() {
|
void CefBrowserContext::ClearSchemeHandlerFactories() {
|
||||||
CEF_POST_TASK(CEF_IOT,
|
CEF_POST_TASK(CEF_IOT,
|
||||||
base::BindOnce(&CefIOThreadState::ClearSchemeHandlerFactories,
|
base::Bind(&CefIOThreadState::ClearSchemeHandlerFactories,
|
||||||
iothread_state_));
|
iothread_state_));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserContext::LoadExtension(
|
void CefBrowserContext::LoadExtension(
|
||||||
@@ -485,7 +482,8 @@ bool CefBrowserContext::IsPrintPreviewSupported() const {
|
|||||||
network::mojom::NetworkContext* CefBrowserContext::GetNetworkContext() {
|
network::mojom::NetworkContext* CefBrowserContext::GetNetworkContext() {
|
||||||
CEF_REQUIRE_UIT();
|
CEF_REQUIRE_UIT();
|
||||||
auto browser_context = AsBrowserContext();
|
auto browser_context = AsBrowserContext();
|
||||||
return browser_context->GetDefaultStoragePartition()->GetNetworkContext();
|
return browser_context->GetDefaultStoragePartition(browser_context)
|
||||||
|
->GetNetworkContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
CefMediaRouterManager* CefBrowserContext::GetMediaRouterManager() {
|
CefMediaRouterManager* CefBrowserContext::GetMediaRouterManager() {
|
||||||
@@ -519,7 +517,7 @@ CefBrowserContext::GetGlobalCookieableSchemes() {
|
|||||||
CefString(&settings.cookieable_schemes_list),
|
CefString(&settings.cookieable_schemes_list),
|
||||||
!settings.cookieable_schemes_exclude_defaults);
|
!settings.cookieable_schemes_exclude_defaults);
|
||||||
}
|
}
|
||||||
return absl::nullopt;
|
return base::nullopt;
|
||||||
}());
|
}());
|
||||||
return *schemes;
|
return *schemes;
|
||||||
}
|
}
|
||||||
|
@@ -16,10 +16,9 @@
|
|||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
#include "base/sequenced_task_runner_helpers.h"
|
#include "base/optional.h"
|
||||||
#include "chrome/common/plugin.mojom.h"
|
#include "chrome/common/plugin.mojom.h"
|
||||||
#include "services/network/public/mojom/network_context.mojom.h"
|
#include "services/network/public/mojom/network_context.mojom.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
#include "url/origin.h"
|
#include "url/origin.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -201,7 +200,7 @@ class CefBrowserContext {
|
|||||||
|
|
||||||
CefMediaRouterManager* GetMediaRouterManager();
|
CefMediaRouterManager* GetMediaRouterManager();
|
||||||
|
|
||||||
using CookieableSchemes = absl::optional<std::vector<std::string>>;
|
using CookieableSchemes = base::Optional<std::vector<std::string>>;
|
||||||
|
|
||||||
// Returns the schemes associated with this context specifically, or the
|
// Returns the schemes associated with this context specifically, or the
|
||||||
// global configuration if unset.
|
// global configuration if unset.
|
||||||
@@ -237,9 +236,6 @@ class CefBrowserContext {
|
|||||||
base::FilePath cache_path_;
|
base::FilePath cache_path_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// For DeleteSoon().
|
|
||||||
friend class base::DeleteHelper<CefBrowserContext>;
|
|
||||||
|
|
||||||
scoped_refptr<CefIOThreadState> iothread_state_;
|
scoped_refptr<CefIOThreadState> iothread_state_;
|
||||||
CookieableSchemes cookieable_schemes_;
|
CookieableSchemes cookieable_schemes_;
|
||||||
std::unique_ptr<CefMediaRouterManager> media_router_manager_;
|
std::unique_ptr<CefMediaRouterManager> media_router_manager_;
|
||||||
|
@@ -1,77 +0,0 @@
|
|||||||
// Copyright 2021 The Chromium Embedded Framework Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style license that can be
|
|
||||||
// found in the LICENSE file.
|
|
||||||
|
|
||||||
#include "libcef/browser/browser_frame.h"
|
|
||||||
|
|
||||||
#include "libcef/browser/browser_host_base.h"
|
|
||||||
#include "libcef/browser/thread_util.h"
|
|
||||||
|
|
||||||
#include "content/public/browser/render_frame_host.h"
|
|
||||||
#include "content/public/browser/render_process_host.h"
|
|
||||||
#include "content/public/browser/web_contents.h"
|
|
||||||
#include "content/public/browser/web_contents_observer.h"
|
|
||||||
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
|
|
||||||
|
|
||||||
CefBrowserFrame::CefBrowserFrame(
|
|
||||||
content::RenderFrameHost* render_frame_host,
|
|
||||||
mojo::PendingReceiver<cef::mojom::BrowserFrame> receiver)
|
|
||||||
: FrameServiceBase(render_frame_host, std::move(receiver)) {}
|
|
||||||
|
|
||||||
CefBrowserFrame::~CefBrowserFrame() = default;
|
|
||||||
|
|
||||||
// static
|
|
||||||
void CefBrowserFrame::RegisterBrowserInterfaceBindersForFrame(
|
|
||||||
content::RenderFrameHost* render_frame_host,
|
|
||||||
mojo::BinderMapWithContext<content::RenderFrameHost*>* map) {
|
|
||||||
map->Add<cef::mojom::BrowserFrame>(base::BindRepeating(
|
|
||||||
[](content::RenderFrameHost* frame_host,
|
|
||||||
mojo::PendingReceiver<cef::mojom::BrowserFrame> receiver) {
|
|
||||||
// This object is bound to the lifetime of |frame_host| and the mojo
|
|
||||||
// connection. See FrameServiceBase for details.
|
|
||||||
new CefBrowserFrame(frame_host, std::move(receiver));
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefBrowserFrame::SendMessage(const std::string& name,
|
|
||||||
base::Value arguments) {
|
|
||||||
// Always associate with the newly created RFH, which may be speculative when
|
|
||||||
// navigating cross-origin.
|
|
||||||
if (auto host = GetFrameHost(/*prefer_speculative=*/true)) {
|
|
||||||
host->SendMessage(name, std::move(arguments));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefBrowserFrame::FrameAttached() {
|
|
||||||
// Always send to the newly created RFH, which may be speculative when
|
|
||||||
// navigating cross-origin.
|
|
||||||
if (auto host = GetFrameHost(/*prefer_speculative=*/true)) {
|
|
||||||
host->FrameAttached();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefBrowserFrame::DidFinishFrameLoad(const GURL& validated_url,
|
|
||||||
int http_status_code) {
|
|
||||||
if (auto host = GetFrameHost()) {
|
|
||||||
host->DidFinishFrameLoad(validated_url, http_status_code);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefBrowserFrame::UpdateDraggableRegions(
|
|
||||||
absl::optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions) {
|
|
||||||
if (auto host = GetFrameHost()) {
|
|
||||||
host->UpdateDraggableRegions(std::move(regions));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CefRefPtr<CefFrameHostImpl> CefBrowserFrame::GetFrameHost(
|
|
||||||
bool prefer_speculative) const {
|
|
||||||
CEF_REQUIRE_UIT();
|
|
||||||
auto rfh = render_frame_host();
|
|
||||||
if (auto browser = CefBrowserHostBase::GetBrowserForHost(rfh)) {
|
|
||||||
return browser->browser_info()->GetFrameForHost(rfh, nullptr,
|
|
||||||
prefer_speculative);
|
|
||||||
}
|
|
||||||
NOTREACHED();
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
@@ -1,51 +0,0 @@
|
|||||||
// Copyright 2021 The Chromium Embedded Framework Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style license that can be
|
|
||||||
// found in the LICENSE file.
|
|
||||||
|
|
||||||
#ifndef CEF_LIBCEF_BROWSER_BROWSER_FRAME_H_
|
|
||||||
#define CEF_LIBCEF_BROWSER_BROWSER_FRAME_H_
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "libcef/browser/frame_host_impl.h"
|
|
||||||
|
|
||||||
#include "cef/libcef/common/mojom/cef.mojom.h"
|
|
||||||
#include "content/public/browser/frame_service_base.h"
|
|
||||||
#include "mojo/public/cpp/bindings/binder_map.h"
|
|
||||||
|
|
||||||
// Implementation of the BrowserFrame mojo interface.
|
|
||||||
// This is implemented separately from CefFrameHostImpl to better manage the
|
|
||||||
// association with the RenderFrameHost (which may be speculative, etc.), and so
|
|
||||||
// that messages are always routed to the most appropriate CefFrameHostImpl
|
|
||||||
// instance. Lifespan is tied to the RFH via FrameServiceBase.
|
|
||||||
class CefBrowserFrame
|
|
||||||
: public content::FrameServiceBase<cef::mojom::BrowserFrame> {
|
|
||||||
public:
|
|
||||||
CefBrowserFrame(content::RenderFrameHost* render_frame_host,
|
|
||||||
mojo::PendingReceiver<cef::mojom::BrowserFrame> receiver);
|
|
||||||
~CefBrowserFrame() override;
|
|
||||||
|
|
||||||
// Called from the ContentBrowserClient method of the same name.
|
|
||||||
static void RegisterBrowserInterfaceBindersForFrame(
|
|
||||||
content::RenderFrameHost* render_frame_host,
|
|
||||||
mojo::BinderMapWithContext<content::RenderFrameHost*>* map);
|
|
||||||
|
|
||||||
private:
|
|
||||||
// cef::mojom::BrowserFrame methods:
|
|
||||||
void SendMessage(const std::string& name, base::Value arguments) override;
|
|
||||||
void FrameAttached() override;
|
|
||||||
void DidFinishFrameLoad(const GURL& validated_url,
|
|
||||||
int32_t http_status_code) override;
|
|
||||||
void UpdateDraggableRegions(
|
|
||||||
absl::optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions)
|
|
||||||
override;
|
|
||||||
|
|
||||||
// FrameServiceBase methods:
|
|
||||||
bool ShouldCloseOnFinishNavigation() const override { return false; }
|
|
||||||
|
|
||||||
CefRefPtr<CefFrameHostImpl> GetFrameHost(
|
|
||||||
bool prefer_speculative = false) const;
|
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserFrame);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // CEF_LIBCEF_BROWSER_BROWSER_FRAME_H_
|
|
@@ -232,7 +232,8 @@ void CefBrowserHostBase::StartDownload(const CefString& url) {
|
|||||||
if (!browser_context)
|
if (!browser_context)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
content::DownloadManager* manager = browser_context->GetDownloadManager();
|
content::DownloadManager* manager =
|
||||||
|
content::BrowserContext::GetDownloadManager(browser_context);
|
||||||
if (!manager)
|
if (!manager)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -366,7 +367,7 @@ void CefBrowserHostBase::GetNavigationEntries(
|
|||||||
CefRefPtr<CefNavigationEntryImpl> entry =
|
CefRefPtr<CefNavigationEntryImpl> entry =
|
||||||
new CefNavigationEntryImpl(controller.GetEntryAtIndex(current));
|
new CefNavigationEntryImpl(controller.GetEntryAtIndex(current));
|
||||||
visitor->Visit(entry.get(), true, current, total);
|
visitor->Visit(entry.get(), true, current, total);
|
||||||
ignore_result(entry->Detach(nullptr));
|
entry->Detach(nullptr);
|
||||||
} else {
|
} else {
|
||||||
// Visit all entries.
|
// Visit all entries.
|
||||||
bool cont = true;
|
bool cont = true;
|
||||||
@@ -374,7 +375,7 @@ void CefBrowserHostBase::GetNavigationEntries(
|
|||||||
CefRefPtr<CefNavigationEntryImpl> entry =
|
CefRefPtr<CefNavigationEntryImpl> entry =
|
||||||
new CefNavigationEntryImpl(controller.GetEntryAtIndex(i));
|
new CefNavigationEntryImpl(controller.GetEntryAtIndex(i));
|
||||||
cont = visitor->Visit(entry.get(), (i == current), i, total);
|
cont = visitor->Visit(entry.get(), (i == current), i, total);
|
||||||
ignore_result(entry->Detach(nullptr));
|
entry->Detach(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -496,10 +497,6 @@ void CefBrowserHostBase::SendMouseWheelEvent(const CefMouseEvent& event,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefBrowserHostBase::IsValid() {
|
|
||||||
return browser_info_->browser() == this;
|
|
||||||
}
|
|
||||||
|
|
||||||
CefRefPtr<CefBrowserHost> CefBrowserHostBase::GetHost() {
|
CefRefPtr<CefBrowserHost> CefBrowserHostBase::GetHost() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include "base/observer_list.h"
|
#include "base/observer_list.h"
|
||||||
#include "base/synchronization/lock.h"
|
#include "base/synchronization/lock.h"
|
||||||
#include "extensions/common/mojom/view_type.mojom.h"
|
#include "extensions/common/view_type.h"
|
||||||
|
|
||||||
namespace extensions {
|
namespace extensions {
|
||||||
class Extension;
|
class Extension;
|
||||||
@@ -86,8 +86,7 @@ struct CefBrowserCreateParams {
|
|||||||
// ProcessManager::CreateBackgroundHost. Currently used with the alloy
|
// ProcessManager::CreateBackgroundHost. Currently used with the alloy
|
||||||
// runtime only.
|
// runtime only.
|
||||||
const extensions::Extension* extension = nullptr;
|
const extensions::Extension* extension = nullptr;
|
||||||
extensions::mojom::ViewType extension_host_type =
|
extensions::ViewType extension_host_type = extensions::VIEW_TYPE_INVALID;
|
||||||
extensions::mojom::ViewType::kInvalid;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Base class for CefBrowserHost implementations. Includes functionality that is
|
// Base class for CefBrowserHost implementations. Includes functionality that is
|
||||||
@@ -183,7 +182,6 @@ class CefBrowserHostBase : public CefBrowserHost,
|
|||||||
CefRefPtr<CefNavigationEntry> GetVisibleNavigationEntry() override;
|
CefRefPtr<CefNavigationEntry> GetVisibleNavigationEntry() override;
|
||||||
|
|
||||||
// CefBrowser methods:
|
// CefBrowser methods:
|
||||||
bool IsValid() override;
|
|
||||||
CefRefPtr<CefBrowserHost> GetHost() override;
|
CefRefPtr<CefBrowserHost> GetHost() override;
|
||||||
bool CanGoBack() override;
|
bool CanGoBack() override;
|
||||||
void GoBack() override;
|
void GoBack() override;
|
||||||
|
@@ -15,12 +15,10 @@
|
|||||||
#include "ipc/ipc_message.h"
|
#include "ipc/ipc_message.h"
|
||||||
|
|
||||||
CefBrowserInfo::FrameInfo::~FrameInfo() {
|
CefBrowserInfo::FrameInfo::~FrameInfo() {
|
||||||
#if DCHECK_IS_ON()
|
if (frame_ && !is_main_frame_) {
|
||||||
if (frame_ && !IsCurrentMainFrame()) {
|
// Disassociate sub-frames from the browser.
|
||||||
// Should already be Detached.
|
frame_->Detach();
|
||||||
DCHECK(!frame_->GetRenderFrameHost());
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CefBrowserInfo::CefBrowserInfo(int browser_id,
|
CefBrowserInfo::CefBrowserInfo(int browser_id,
|
||||||
@@ -34,9 +32,7 @@ CefBrowserInfo::CefBrowserInfo(int browser_id,
|
|||||||
DCHECK_GT(browser_id, 0);
|
DCHECK_GT(browser_id, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
CefBrowserInfo::~CefBrowserInfo() {
|
CefBrowserInfo::~CefBrowserInfo() {}
|
||||||
DCHECK(frame_info_set_.empty());
|
|
||||||
}
|
|
||||||
|
|
||||||
CefRefPtr<CefBrowserHostBase> CefBrowserInfo::browser() const {
|
CefRefPtr<CefBrowserHostBase> CefBrowserInfo::browser() const {
|
||||||
base::AutoLock lock_scope(lock_);
|
base::AutoLock lock_scope(lock_);
|
||||||
@@ -44,29 +40,11 @@ CefRefPtr<CefBrowserHostBase> CefBrowserInfo::browser() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserInfo::SetBrowser(CefRefPtr<CefBrowserHostBase> browser) {
|
void CefBrowserInfo::SetBrowser(CefRefPtr<CefBrowserHostBase> browser) {
|
||||||
NotificationStateLock lock_scope(this);
|
base::AutoLock lock_scope(lock_);
|
||||||
|
|
||||||
if (browser) {
|
|
||||||
DCHECK(!browser_);
|
|
||||||
|
|
||||||
// Cache the associated frame handler.
|
|
||||||
if (auto client = browser->GetClient()) {
|
|
||||||
frame_handler_ = client->GetFrameHandler();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
DCHECK(browser_);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto old_browser = browser_;
|
|
||||||
browser_ = browser;
|
browser_ = browser;
|
||||||
|
|
||||||
if (!browser_) {
|
if (!browser) {
|
||||||
RemoveAllFrames(old_browser);
|
RemoveAllFrames();
|
||||||
|
|
||||||
// Any future calls to MaybeExecuteFrameNotification will now fail.
|
|
||||||
// NotificationStateLock already took a reference for the delivery of any
|
|
||||||
// notifications that are currently queued due to RemoveAllFrames.
|
|
||||||
frame_handler_ = nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +68,7 @@ void CefBrowserInfo::MaybeCreateFrame(content::RenderFrameHost* host,
|
|||||||
->render_manager()
|
->render_manager()
|
||||||
->current_frame_host() != host);
|
->current_frame_host() != host);
|
||||||
|
|
||||||
NotificationStateLock lock_scope(this);
|
base::AutoLock lock_scope(lock_);
|
||||||
DCHECK(browser_);
|
DCHECK(browser_);
|
||||||
|
|
||||||
const auto it = frame_id_map_.find(frame_id);
|
const auto it = frame_id_map_.find(frame_id);
|
||||||
@@ -108,8 +86,14 @@ void CefBrowserInfo::MaybeCreateFrame(content::RenderFrameHost* host,
|
|||||||
if (!info->is_guest_view_ && info->is_speculative_ && !is_speculative) {
|
if (!info->is_guest_view_ && info->is_speculative_ && !is_speculative) {
|
||||||
// Upgrade the frame info from speculative to non-speculative.
|
// Upgrade the frame info from speculative to non-speculative.
|
||||||
if (info->is_main_frame_) {
|
if (info->is_main_frame_) {
|
||||||
// Set the main frame object.
|
if (main_frame_) {
|
||||||
SetMainFrame(browser_, info->frame_);
|
// Update the existing main frame object.
|
||||||
|
main_frame_->SetRenderFrameHost(host);
|
||||||
|
info->frame_ = main_frame_;
|
||||||
|
} else {
|
||||||
|
// Set the main frame object.
|
||||||
|
main_frame_ = info->frame_;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
info->is_speculative_ = false;
|
info->is_speculative_ = false;
|
||||||
MaybeUpdateFrameTreeNodeIdMap(info);
|
MaybeUpdateFrameTreeNodeIdMap(info);
|
||||||
@@ -127,13 +111,17 @@ void CefBrowserInfo::MaybeCreateFrame(content::RenderFrameHost* host,
|
|||||||
|
|
||||||
// Guest views don't get their own CefBrowser or CefFrame objects.
|
// Guest views don't get their own CefBrowser or CefFrame objects.
|
||||||
if (!is_guest_view) {
|
if (!is_guest_view) {
|
||||||
// Create a new frame object.
|
if (is_main_frame && main_frame_ && !is_speculative) {
|
||||||
frame_info->frame_ = new CefFrameHostImpl(this, host);
|
// Update the existing main frame object.
|
||||||
MaybeNotifyFrameCreated(frame_info->frame_);
|
main_frame_->SetRenderFrameHost(host);
|
||||||
if (is_main_frame && !is_speculative) {
|
frame_info->frame_ = main_frame_;
|
||||||
SetMainFrame(browser_, frame_info->frame_);
|
} else {
|
||||||
|
// Create a new frame object.
|
||||||
|
frame_info->frame_ = new CefFrameHostImpl(this, host);
|
||||||
|
if (is_main_frame && !is_speculative) {
|
||||||
|
main_frame_ = frame_info->frame_;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DCHECK_IS_ON()
|
#if DCHECK_IS_ON()
|
||||||
// Check that the frame info hasn't changed unexpectedly.
|
// Check that the frame info hasn't changed unexpectedly.
|
||||||
DCHECK_EQ(frame_id, frame_info->frame_->GetIdentifier());
|
DCHECK_EQ(frame_id, frame_info->frame_->GetIdentifier());
|
||||||
@@ -153,36 +141,10 @@ void CefBrowserInfo::MaybeCreateFrame(content::RenderFrameHost* host,
|
|||||||
frame_info_set_.insert(base::WrapUnique(frame_info));
|
frame_info_set_.insert(base::WrapUnique(frame_info));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserInfo::FrameHostStateChanged(
|
|
||||||
content::RenderFrameHost* host,
|
|
||||||
content::RenderFrameHost::LifecycleState old_state,
|
|
||||||
content::RenderFrameHost::LifecycleState new_state) {
|
|
||||||
CEF_REQUIRE_UIT();
|
|
||||||
|
|
||||||
// We currently only care about BackForwardCache state changes.
|
|
||||||
bool added_to_bfcache =
|
|
||||||
new_state ==
|
|
||||||
content::RenderFrameHost::LifecycleState::kInBackForwardCache;
|
|
||||||
bool removed_from_bfcache =
|
|
||||||
old_state ==
|
|
||||||
content::RenderFrameHost::LifecycleState::kInBackForwardCache;
|
|
||||||
if (!added_to_bfcache && !removed_from_bfcache)
|
|
||||||
return;
|
|
||||||
|
|
||||||
base::AutoLock lock_scope(lock_);
|
|
||||||
|
|
||||||
const auto frame_id = CefFrameHostImpl::MakeFrameId(host);
|
|
||||||
auto it = frame_id_map_.find(frame_id);
|
|
||||||
DCHECK(it != frame_id_map_.end());
|
|
||||||
DCHECK((!it->second->is_in_bfcache_ && added_to_bfcache) ||
|
|
||||||
(it->second->is_in_bfcache_ && removed_from_bfcache));
|
|
||||||
it->second->is_in_bfcache_ = added_to_bfcache;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefBrowserInfo::RemoveFrame(content::RenderFrameHost* host) {
|
void CefBrowserInfo::RemoveFrame(content::RenderFrameHost* host) {
|
||||||
CEF_REQUIRE_UIT();
|
CEF_REQUIRE_UIT();
|
||||||
|
|
||||||
NotificationStateLock lock_scope(this);
|
base::AutoLock lock_scope(lock_);
|
||||||
|
|
||||||
const auto frame_id = CefFrameHostImpl::MakeFrameId(host);
|
const auto frame_id = CefFrameHostImpl::MakeFrameId(host);
|
||||||
|
|
||||||
@@ -212,25 +174,19 @@ void CefBrowserInfo::RemoveFrame(content::RenderFrameHost* host) {
|
|||||||
// And finally delete the frame info.
|
// And finally delete the frame info.
|
||||||
{
|
{
|
||||||
auto it2 = frame_info_set_.find(frame_info);
|
auto it2 = frame_info_set_.find(frame_info);
|
||||||
|
|
||||||
// Explicitly Detach everything but the current main frame.
|
|
||||||
const auto& frame_info = *it2;
|
|
||||||
if (frame_info->frame_ && !frame_info->IsCurrentMainFrame()) {
|
|
||||||
if (frame_info->frame_->Detach())
|
|
||||||
MaybeNotifyFrameDetached(browser_, frame_info->frame_);
|
|
||||||
}
|
|
||||||
|
|
||||||
frame_info_set_.erase(it2);
|
frame_info_set_.erase(it2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetMainFrame() {
|
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetMainFrame() {
|
||||||
NotificationStateLock lock_scope(this);
|
base::AutoLock lock_scope(lock_);
|
||||||
// Early exit if called post-destruction.
|
DCHECK(browser_);
|
||||||
if (!browser_)
|
if (!main_frame_) {
|
||||||
return nullptr;
|
// Create a temporary object that will eventually be updated with real
|
||||||
|
// routing information.
|
||||||
CHECK(main_frame_);
|
main_frame_ =
|
||||||
|
new CefFrameHostImpl(this, true, CefFrameHostImpl::kInvalidFrameId);
|
||||||
|
}
|
||||||
return main_frame_;
|
return main_frame_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,29 +195,25 @@ CefRefPtr<CefFrameHostImpl> CefBrowserInfo::CreateTempSubFrame(
|
|||||||
CefRefPtr<CefFrameHostImpl> parent = GetFrameForId(parent_frame_id);
|
CefRefPtr<CefFrameHostImpl> parent = GetFrameForId(parent_frame_id);
|
||||||
if (!parent)
|
if (!parent)
|
||||||
parent = GetMainFrame();
|
parent = GetMainFrame();
|
||||||
// Intentionally not notifying for temporary frames.
|
return new CefFrameHostImpl(this, false, parent->GetIdentifier());
|
||||||
return new CefFrameHostImpl(this, parent->GetIdentifier());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForHost(
|
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForHost(
|
||||||
const content::RenderFrameHost* host,
|
const content::RenderFrameHost* host,
|
||||||
bool* is_guest_view,
|
bool* is_guest_view) const {
|
||||||
bool prefer_speculative) const {
|
|
||||||
if (is_guest_view)
|
if (is_guest_view)
|
||||||
*is_guest_view = false;
|
*is_guest_view = false;
|
||||||
|
|
||||||
if (!host)
|
if (!host)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return GetFrameForId(CefFrameHostImpl::MakeFrameId(host), is_guest_view,
|
return GetFrameForId(CefFrameHostImpl::MakeFrameId(host), is_guest_view);
|
||||||
prefer_speculative);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForRoute(
|
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForRoute(
|
||||||
int32_t render_process_id,
|
int32_t render_process_id,
|
||||||
int32_t render_routing_id,
|
int32_t render_routing_id,
|
||||||
bool* is_guest_view,
|
bool* is_guest_view) const {
|
||||||
bool prefer_speculative) const {
|
|
||||||
if (is_guest_view)
|
if (is_guest_view)
|
||||||
*is_guest_view = false;
|
*is_guest_view = false;
|
||||||
|
|
||||||
@@ -270,13 +222,12 @@ CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForRoute(
|
|||||||
|
|
||||||
return GetFrameForId(
|
return GetFrameForId(
|
||||||
CefFrameHostImpl::MakeFrameId(render_process_id, render_routing_id),
|
CefFrameHostImpl::MakeFrameId(render_process_id, render_routing_id),
|
||||||
is_guest_view, prefer_speculative);
|
is_guest_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForId(
|
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForId(
|
||||||
int64_t frame_id,
|
int64_t frame_id,
|
||||||
bool* is_guest_view,
|
bool* is_guest_view) const {
|
||||||
bool prefer_speculative) const {
|
|
||||||
if (is_guest_view)
|
if (is_guest_view)
|
||||||
*is_guest_view = false;
|
*is_guest_view = false;
|
||||||
|
|
||||||
@@ -295,7 +246,7 @@ CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForId(
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->is_speculative_ && !prefer_speculative) {
|
if (info->is_speculative_) {
|
||||||
if (info->is_main_frame_ && main_frame_) {
|
if (info->is_main_frame_ && main_frame_) {
|
||||||
// Always prefer the non-speculative main frame.
|
// Always prefer the non-speculative main frame.
|
||||||
return main_frame_;
|
return main_frame_;
|
||||||
@@ -340,9 +291,8 @@ CefBrowserInfo::FrameHostList CefBrowserInfo::GetAllFrames() const {
|
|||||||
base::AutoLock lock_scope(lock_);
|
base::AutoLock lock_scope(lock_);
|
||||||
FrameHostList frames;
|
FrameHostList frames;
|
||||||
for (const auto& info : frame_info_set_) {
|
for (const auto& info : frame_info_set_) {
|
||||||
if (info->frame_ && !info->is_speculative_ && !info->is_in_bfcache_) {
|
if (info->frame_ && !info->is_speculative_)
|
||||||
frames.insert(info->frame_);
|
frames.insert(info->frame_);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return frames;
|
return frames;
|
||||||
}
|
}
|
||||||
@@ -378,30 +328,6 @@ bool CefBrowserInfo::IsNavigationLocked(base::OnceClosure pending_action) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserInfo::MaybeExecuteFrameNotification(
|
|
||||||
FrameNotifyOnceAction pending_action) {
|
|
||||||
CefRefPtr<CefFrameHandler> frame_handler;
|
|
||||||
|
|
||||||
{
|
|
||||||
base::AutoLock lock_scope_(notification_lock_);
|
|
||||||
if (!frame_handler_) {
|
|
||||||
// No notifications will be executed.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (notification_state_lock_) {
|
|
||||||
// Queue the notification until the lock is released.
|
|
||||||
notification_state_lock_->queue_.push(std::move(pending_action));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
frame_handler = frame_handler_;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Execute immediately if not locked.
|
|
||||||
std::move(pending_action).Run(frame_handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefBrowserInfo::MaybeUpdateFrameTreeNodeIdMap(FrameInfo* info) {
|
void CefBrowserInfo::MaybeUpdateFrameTreeNodeIdMap(FrameInfo* info) {
|
||||||
lock_.AssertAcquired();
|
lock_.AssertAcquired();
|
||||||
|
|
||||||
@@ -455,150 +381,24 @@ CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForFrameTreeNodeInternal(
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Passing in |browser| here because |browser_| may already be cleared.
|
void CefBrowserInfo::RemoveAllFrames() {
|
||||||
void CefBrowserInfo::SetMainFrame(CefRefPtr<CefBrowserHostBase> browser,
|
|
||||||
CefRefPtr<CefFrameHostImpl> frame) {
|
|
||||||
lock_.AssertAcquired();
|
lock_.AssertAcquired();
|
||||||
DCHECK(browser);
|
|
||||||
DCHECK(!frame || frame->IsMain());
|
|
||||||
|
|
||||||
CefRefPtr<CefFrameHostImpl> old_frame;
|
|
||||||
if (main_frame_) {
|
|
||||||
old_frame = main_frame_;
|
|
||||||
if (old_frame->Detach())
|
|
||||||
MaybeNotifyFrameDetached(browser, old_frame);
|
|
||||||
}
|
|
||||||
|
|
||||||
main_frame_ = frame;
|
|
||||||
|
|
||||||
MaybeNotifyMainFrameChanged(browser, old_frame, main_frame_);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefBrowserInfo::MaybeNotifyFrameCreated(
|
|
||||||
CefRefPtr<CefFrameHostImpl> frame) {
|
|
||||||
CEF_REQUIRE_UIT();
|
|
||||||
|
|
||||||
// Never notify for temporary objects.
|
|
||||||
DCHECK(!frame->is_temporary());
|
|
||||||
|
|
||||||
MaybeExecuteFrameNotification(base::BindOnce(
|
|
||||||
[](scoped_refptr<CefBrowserInfo> self, CefRefPtr<CefFrameHostImpl> frame,
|
|
||||||
CefRefPtr<CefFrameHandler> handler) {
|
|
||||||
if (auto browser = self->browser()) {
|
|
||||||
handler->OnFrameCreated(browser, frame);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
scoped_refptr<CefBrowserInfo>(this), frame));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Passing in |browser| here because |browser_| may already be cleared.
|
|
||||||
void CefBrowserInfo::MaybeNotifyFrameDetached(
|
|
||||||
CefRefPtr<CefBrowserHostBase> browser,
|
|
||||||
CefRefPtr<CefFrameHostImpl> frame) {
|
|
||||||
CEF_REQUIRE_UIT();
|
|
||||||
|
|
||||||
// Never notify for temporary objects.
|
|
||||||
DCHECK(!frame->is_temporary());
|
|
||||||
|
|
||||||
MaybeExecuteFrameNotification(base::BindOnce(
|
|
||||||
[](CefRefPtr<CefBrowserHostBase> browser,
|
|
||||||
CefRefPtr<CefFrameHostImpl> frame,
|
|
||||||
CefRefPtr<CefFrameHandler> handler) {
|
|
||||||
handler->OnFrameDetached(browser, frame);
|
|
||||||
},
|
|
||||||
browser, frame));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Passing in |browser| here because |browser_| may already be cleared.
|
|
||||||
void CefBrowserInfo::MaybeNotifyMainFrameChanged(
|
|
||||||
CefRefPtr<CefBrowserHostBase> browser,
|
|
||||||
CefRefPtr<CefFrameHostImpl> old_frame,
|
|
||||||
CefRefPtr<CefFrameHostImpl> new_frame) {
|
|
||||||
CEF_REQUIRE_UIT();
|
|
||||||
|
|
||||||
// Never notify for temporary objects.
|
|
||||||
DCHECK(!old_frame || !old_frame->is_temporary());
|
|
||||||
DCHECK(!new_frame || !new_frame->is_temporary());
|
|
||||||
|
|
||||||
MaybeExecuteFrameNotification(base::BindOnce(
|
|
||||||
[](CefRefPtr<CefBrowserHostBase> browser,
|
|
||||||
CefRefPtr<CefFrameHostImpl> old_frame,
|
|
||||||
CefRefPtr<CefFrameHostImpl> new_frame,
|
|
||||||
CefRefPtr<CefFrameHandler> handler) {
|
|
||||||
handler->OnMainFrameChanged(browser, old_frame, new_frame);
|
|
||||||
},
|
|
||||||
browser, old_frame, new_frame));
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefBrowserInfo::RemoveAllFrames(
|
|
||||||
CefRefPtr<CefBrowserHostBase> old_browser) {
|
|
||||||
lock_.AssertAcquired();
|
|
||||||
|
|
||||||
// Make sure any callbacks will see the correct state (e.g. like
|
|
||||||
// CefBrowser::GetMainFrame returning nullptr and CefBrowser::IsValid
|
|
||||||
// returning false).
|
|
||||||
DCHECK(!browser_);
|
|
||||||
DCHECK(old_browser);
|
|
||||||
|
|
||||||
// Clear the lookup maps.
|
// Clear the lookup maps.
|
||||||
frame_id_map_.clear();
|
frame_id_map_.clear();
|
||||||
frame_tree_node_id_map_.clear();
|
frame_tree_node_id_map_.clear();
|
||||||
|
|
||||||
// Explicitly Detach everything but the current main frame.
|
// Explicitly Detach main frames.
|
||||||
for (auto& info : frame_info_set_) {
|
for (auto& info : frame_info_set_) {
|
||||||
if (info->frame_ && !info->IsCurrentMainFrame()) {
|
if (info->frame_ && info->is_main_frame_)
|
||||||
if (info->frame_->Detach())
|
info->frame_->Detach();
|
||||||
MaybeNotifyFrameDetached(old_browser, info->frame_);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (main_frame_)
|
if (main_frame_) {
|
||||||
SetMainFrame(old_browser, nullptr);
|
main_frame_->Detach();
|
||||||
|
main_frame_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
// And finally delete the frame info.
|
// And finally delete the frame info.
|
||||||
frame_info_set_.clear();
|
frame_info_set_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
CefBrowserInfo::NotificationStateLock::NotificationStateLock(
|
|
||||||
CefBrowserInfo* browser_info)
|
|
||||||
: browser_info_(browser_info) {
|
|
||||||
// Take the navigation state lock.
|
|
||||||
{
|
|
||||||
base::AutoLock lock_scope_(browser_info_->notification_lock_);
|
|
||||||
CHECK(!browser_info_->notification_state_lock_);
|
|
||||||
browser_info_->notification_state_lock_ = this;
|
|
||||||
// We may need this on destruction, and the original might be cleared.
|
|
||||||
frame_handler_ = browser_info_->frame_handler_;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Take the browser info state lock.
|
|
||||||
browser_info_lock_scope_.reset(new base::AutoLock(browser_info_->lock_));
|
|
||||||
}
|
|
||||||
|
|
||||||
CefBrowserInfo::NotificationStateLock::~NotificationStateLock() {
|
|
||||||
// Unlock in reverse order.
|
|
||||||
browser_info_lock_scope_.reset();
|
|
||||||
|
|
||||||
{
|
|
||||||
base::AutoLock lock_scope_(browser_info_->notification_lock_);
|
|
||||||
CHECK_EQ(this, browser_info_->notification_state_lock_);
|
|
||||||
browser_info_->notification_state_lock_ = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!queue_.empty()) {
|
|
||||||
DCHECK(frame_handler_);
|
|
||||||
|
|
||||||
scoped_refptr<NavigationLock> nav_lock;
|
|
||||||
if (CEF_CURRENTLY_ON_UIT()) {
|
|
||||||
// Don't navigate while inside callbacks.
|
|
||||||
nav_lock = browser_info_->CreateNavigationLock();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Empty the queue of pending actions. Any of these actions might result in
|
|
||||||
// the acquisition of a new NotificationStateLock.
|
|
||||||
while (!queue_.empty()) {
|
|
||||||
std::move(queue_.front()).Run(frame_handler_);
|
|
||||||
queue_.pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
#define CEF_LIBCEF_BROWSER_BROWSER_INFO_H_
|
#define CEF_LIBCEF_BROWSER_BROWSER_INFO_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <queue>
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
@@ -19,10 +18,12 @@
|
|||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
#include "base/synchronization/lock.h"
|
#include "base/synchronization/lock.h"
|
||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
#include "content/public/browser/render_frame_host.h"
|
|
||||||
|
namespace content {
|
||||||
|
class RenderFrameHost;
|
||||||
|
}
|
||||||
|
|
||||||
class CefBrowserHostBase;
|
class CefBrowserHostBase;
|
||||||
class CefFrameHandler;
|
|
||||||
class CefFrameHostImpl;
|
class CefFrameHostImpl;
|
||||||
|
|
||||||
// CefBrowserInfo is used to associate a browser ID and render view/process
|
// CefBrowserInfo is used to associate a browser ID and render view/process
|
||||||
@@ -59,13 +60,6 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
|||||||
// true).
|
// true).
|
||||||
void MaybeCreateFrame(content::RenderFrameHost* host, bool is_guest_view);
|
void MaybeCreateFrame(content::RenderFrameHost* host, bool is_guest_view);
|
||||||
|
|
||||||
// Used to track state changes such as entering/exiting the BackForwardCache.
|
|
||||||
// Called from CefBrowserContentsDelegate::RenderFrameHostStateChanged.
|
|
||||||
void FrameHostStateChanged(
|
|
||||||
content::RenderFrameHost* host,
|
|
||||||
content::RenderFrameHost::LifecycleState old_state,
|
|
||||||
content::RenderFrameHost::LifecycleState new_state);
|
|
||||||
|
|
||||||
// Remove the frame record for |host|. Called for the main frame when the
|
// Remove the frame record for |host|. Called for the main frame when the
|
||||||
// RenderView is destroyed, or for a sub-frame when the associated RenderFrame
|
// RenderView is destroyed, or for a sub-frame when the associated RenderFrame
|
||||||
// is destroyed in the renderer process.
|
// is destroyed in the renderer process.
|
||||||
@@ -94,8 +88,7 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
|||||||
// UI thread.
|
// UI thread.
|
||||||
CefRefPtr<CefFrameHostImpl> GetFrameForHost(
|
CefRefPtr<CefFrameHostImpl> GetFrameForHost(
|
||||||
const content::RenderFrameHost* host,
|
const content::RenderFrameHost* host,
|
||||||
bool* is_guest_view = nullptr,
|
bool* is_guest_view = nullptr) const;
|
||||||
bool prefer_speculative = false) const;
|
|
||||||
|
|
||||||
// Returns the frame object matching the specified IDs or nullptr if no match
|
// Returns the frame object matching the specified IDs or nullptr if no match
|
||||||
// is found. Nullptr will also be returned if a guest view match is found
|
// is found. Nullptr will also be returned if a guest view match is found
|
||||||
@@ -105,8 +98,7 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
|||||||
CefRefPtr<CefFrameHostImpl> GetFrameForRoute(
|
CefRefPtr<CefFrameHostImpl> GetFrameForRoute(
|
||||||
int32_t render_process_id,
|
int32_t render_process_id,
|
||||||
int32_t render_routing_id,
|
int32_t render_routing_id,
|
||||||
bool* is_guest_view = nullptr,
|
bool* is_guest_view = nullptr) const;
|
||||||
bool prefer_speculative = false) const;
|
|
||||||
|
|
||||||
// Returns the frame object matching the specified ID or nullptr if no match
|
// Returns the frame object matching the specified ID or nullptr if no match
|
||||||
// is found. Nullptr will also be returned if a guest view match is found
|
// is found. Nullptr will also be returned if a guest view match is found
|
||||||
@@ -115,8 +107,7 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
|||||||
// thread.
|
// thread.
|
||||||
CefRefPtr<CefFrameHostImpl> GetFrameForId(
|
CefRefPtr<CefFrameHostImpl> GetFrameForId(
|
||||||
int64_t frame_id,
|
int64_t frame_id,
|
||||||
bool* is_guest_view = nullptr,
|
bool* is_guest_view = nullptr) const;
|
||||||
bool prefer_speculative = false) const;
|
|
||||||
|
|
||||||
// Returns the frame object matching the specified ID or nullptr if no match
|
// Returns the frame object matching the specified ID or nullptr if no match
|
||||||
// is found. Nullptr will also be returned if a guest view match is found
|
// is found. Nullptr will also be returned if a guest view match is found
|
||||||
@@ -155,16 +146,6 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
|||||||
// thread.
|
// thread.
|
||||||
bool IsNavigationLocked(base::OnceClosure pending_action);
|
bool IsNavigationLocked(base::OnceClosure pending_action);
|
||||||
|
|
||||||
using FrameNotifyOnceAction =
|
|
||||||
base::OnceCallback<void(CefRefPtr<CefFrameHandler>)>;
|
|
||||||
|
|
||||||
// Specifies a CefFrameHandler notification action whose execution may need
|
|
||||||
// to be blocked on release of a potentially held NotificationStateLock. If no
|
|
||||||
// CefFrameHandler exists then the action will be discarded without executing.
|
|
||||||
// If the NotificationStateLock is not currently held then the action will be
|
|
||||||
// executed immediately.
|
|
||||||
void MaybeExecuteFrameNotification(FrameNotifyOnceAction pending_action);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class base::RefCountedThreadSafe<CefBrowserInfo>;
|
friend class base::RefCountedThreadSafe<CefBrowserInfo>;
|
||||||
|
|
||||||
@@ -173,17 +154,12 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
|||||||
struct FrameInfo {
|
struct FrameInfo {
|
||||||
~FrameInfo();
|
~FrameInfo();
|
||||||
|
|
||||||
inline bool IsCurrentMainFrame() const {
|
|
||||||
return frame_ && is_main_frame_ && !is_speculative_ && !is_in_bfcache_;
|
|
||||||
}
|
|
||||||
|
|
||||||
content::RenderFrameHost* host_;
|
content::RenderFrameHost* host_;
|
||||||
int64_t frame_id_; // Combination of render_process_id + render_routing_id.
|
int64_t frame_id_; // Combination of render_process_id + render_routing_id.
|
||||||
int frame_tree_node_id_;
|
int frame_tree_node_id_;
|
||||||
bool is_guest_view_;
|
bool is_guest_view_;
|
||||||
bool is_main_frame_;
|
bool is_main_frame_;
|
||||||
bool is_speculative_;
|
bool is_speculative_;
|
||||||
bool is_in_bfcache_ = false;
|
|
||||||
CefRefPtr<CefFrameHostImpl> frame_;
|
CefRefPtr<CefFrameHostImpl> frame_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -193,17 +169,7 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
|||||||
int frame_tree_node_id,
|
int frame_tree_node_id,
|
||||||
bool* is_guest_view = nullptr) const;
|
bool* is_guest_view = nullptr) const;
|
||||||
|
|
||||||
void SetMainFrame(CefRefPtr<CefBrowserHostBase> browser,
|
void RemoveAllFrames();
|
||||||
CefRefPtr<CefFrameHostImpl> frame);
|
|
||||||
|
|
||||||
void MaybeNotifyFrameCreated(CefRefPtr<CefFrameHostImpl> frame);
|
|
||||||
void MaybeNotifyFrameDetached(CefRefPtr<CefBrowserHostBase> browser,
|
|
||||||
CefRefPtr<CefFrameHostImpl> frame);
|
|
||||||
void MaybeNotifyMainFrameChanged(CefRefPtr<CefBrowserHostBase> browser,
|
|
||||||
CefRefPtr<CefFrameHostImpl> old_frame,
|
|
||||||
CefRefPtr<CefFrameHostImpl> new_frame);
|
|
||||||
|
|
||||||
void RemoveAllFrames(CefRefPtr<CefBrowserHostBase> old_browser);
|
|
||||||
|
|
||||||
int browser_id_;
|
int browser_id_;
|
||||||
bool is_popup_;
|
bool is_popup_;
|
||||||
@@ -214,29 +180,6 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
|||||||
// Only accessed on the UI thread.
|
// Only accessed on the UI thread.
|
||||||
base::WeakPtr<NavigationLock> navigation_lock_;
|
base::WeakPtr<NavigationLock> navigation_lock_;
|
||||||
|
|
||||||
// Used instead of |base::AutoLock(lock_)| in situations that might generate
|
|
||||||
// CefFrameHandler notifications. Any notifications passed to
|
|
||||||
// MaybeExecuteFrameNotification() will be queued until the lock is released,
|
|
||||||
// and then executed in order.
|
|
||||||
class NotificationStateLock final {
|
|
||||||
public:
|
|
||||||
explicit NotificationStateLock(CefBrowserInfo* browser_info);
|
|
||||||
~NotificationStateLock();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
friend class CefBrowserInfo;
|
|
||||||
CefBrowserInfo* const browser_info_;
|
|
||||||
CefRefPtr<CefFrameHandler> frame_handler_;
|
|
||||||
std::unique_ptr<base::AutoLock> browser_info_lock_scope_;
|
|
||||||
std::queue<FrameNotifyOnceAction> queue_;
|
|
||||||
};
|
|
||||||
|
|
||||||
mutable base::Lock notification_lock_;
|
|
||||||
|
|
||||||
// These members must be protected by |notification_lock_|.
|
|
||||||
NotificationStateLock* notification_state_lock_ = nullptr;
|
|
||||||
CefRefPtr<CefFrameHandler> frame_handler_;
|
|
||||||
|
|
||||||
mutable base::Lock lock_;
|
mutable base::Lock lock_;
|
||||||
|
|
||||||
// The below members must be protected by |lock_|.
|
// The below members must be protected by |lock_|.
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
#include "libcef/browser/browser_platform_delegate.h"
|
#include "libcef/browser/browser_platform_delegate.h"
|
||||||
#include "libcef/browser/extensions/browser_extensions_util.h"
|
#include "libcef/browser/extensions/browser_extensions_util.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
|
#include "libcef/common/cef_messages.h"
|
||||||
#include "libcef/common/cef_switches.h"
|
#include "libcef/common/cef_switches.h"
|
||||||
#include "libcef/common/extensions/extensions_util.h"
|
#include "libcef/common/extensions/extensions_util.h"
|
||||||
#include "libcef/common/values_impl.h"
|
#include "libcef/common/values_impl.h"
|
||||||
@@ -17,7 +18,6 @@
|
|||||||
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/threading/sequenced_task_runner_handle.h"
|
|
||||||
#include "content/public/browser/render_frame_host.h"
|
#include "content/public/browser/render_frame_host.h"
|
||||||
#include "content/public/browser/render_process_host.h"
|
#include "content/public/browser/render_process_host.h"
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
@@ -95,9 +95,9 @@ scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreatePopupBrowserInfo(
|
|||||||
// Continue any pending NewBrowserInfo request.
|
// Continue any pending NewBrowserInfo request.
|
||||||
auto it = pending_new_browser_info_map_.find(frame_id);
|
auto it = pending_new_browser_info_map_.find(frame_id);
|
||||||
if (it != pending_new_browser_info_map_.end()) {
|
if (it != pending_new_browser_info_map_.end()) {
|
||||||
SendNewBrowserInfoResponse(
|
SendNewBrowserInfoResponse(render_process_id, browser_info,
|
||||||
render_process_id, browser_info, /*is_guest_view=*/false,
|
false /* is_guest_view */,
|
||||||
std::move(it->second->callback), it->second->callback_runner);
|
it->second->reply_msg);
|
||||||
pending_new_browser_info_map_.erase(it);
|
pending_new_browser_info_map_.erase(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,15 +262,12 @@ void CefBrowserInfoManager::WebContentsCreated(
|
|||||||
extra_info = pending_popup->extra_info;
|
extra_info = pending_popup->extra_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserInfoManager::OnGetNewBrowserInfo(
|
void CefBrowserInfoManager::OnGetNewBrowserInfo(int render_process_id,
|
||||||
int render_process_id,
|
int render_routing_id,
|
||||||
int render_routing_id,
|
IPC::Message* reply_msg) {
|
||||||
cef::mojom::BrowserManager::GetNewBrowserInfoCallback callback) {
|
|
||||||
DCHECK_NE(render_process_id, content::ChildProcessHost::kInvalidUniqueID);
|
DCHECK_NE(render_process_id, content::ChildProcessHost::kInvalidUniqueID);
|
||||||
DCHECK_GT(render_routing_id, 0);
|
DCHECK_GT(render_routing_id, 0);
|
||||||
DCHECK(callback);
|
DCHECK(reply_msg);
|
||||||
|
|
||||||
auto callback_runner = base::SequencedTaskRunnerHandle::Get();
|
|
||||||
|
|
||||||
base::AutoLock lock_scope(browser_info_lock_);
|
base::AutoLock lock_scope(browser_info_lock_);
|
||||||
|
|
||||||
@@ -282,7 +279,7 @@ void CefBrowserInfoManager::OnGetNewBrowserInfo(
|
|||||||
if (browser_info.get()) {
|
if (browser_info.get()) {
|
||||||
// Send the response immediately.
|
// Send the response immediately.
|
||||||
SendNewBrowserInfoResponse(render_process_id, browser_info, is_guest_view,
|
SendNewBrowserInfoResponse(render_process_id, browser_info, is_guest_view,
|
||||||
std::move(callback), callback_runner);
|
reply_msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,8 +297,7 @@ void CefBrowserInfoManager::OnGetNewBrowserInfo(
|
|||||||
pending->render_process_id = render_process_id;
|
pending->render_process_id = render_process_id;
|
||||||
pending->render_routing_id = render_routing_id;
|
pending->render_routing_id = render_routing_id;
|
||||||
pending->timeout_id = timeout_id;
|
pending->timeout_id = timeout_id;
|
||||||
pending->callback = std::move(callback);
|
pending->reply_msg = reply_msg;
|
||||||
pending->callback_runner = callback_runner;
|
|
||||||
pending_new_browser_info_map_.insert(
|
pending_new_browser_info_map_.insert(
|
||||||
std::make_pair(frame_id, std::move(pending)));
|
std::make_pair(frame_id, std::move(pending)));
|
||||||
|
|
||||||
@@ -441,13 +437,11 @@ void CefBrowserInfoManager::RenderProcessHostDestroyed(
|
|||||||
PendingNewBrowserInfoMap::iterator it =
|
PendingNewBrowserInfoMap::iterator it =
|
||||||
pending_new_browser_info_map_.begin();
|
pending_new_browser_info_map_.begin();
|
||||||
while (it != pending_new_browser_info_map_.end()) {
|
while (it != pending_new_browser_info_map_.end()) {
|
||||||
const auto& info = it->second;
|
auto info = it->second.get();
|
||||||
if (info->render_process_id == render_process_id) {
|
if (info->render_process_id == render_process_id)
|
||||||
CancelNewBrowserInfoResponse(info.get());
|
|
||||||
it = pending_new_browser_info_map_.erase(it);
|
it = pending_new_browser_info_map_.erase(it);
|
||||||
} else {
|
else
|
||||||
++it;
|
++it;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -528,47 +522,44 @@ void CefBrowserInfoManager::SendNewBrowserInfoResponse(
|
|||||||
int render_process_id,
|
int render_process_id,
|
||||||
scoped_refptr<CefBrowserInfo> browser_info,
|
scoped_refptr<CefBrowserInfo> browser_info,
|
||||||
bool is_guest_view,
|
bool is_guest_view,
|
||||||
cef::mojom::BrowserManager::GetNewBrowserInfoCallback callback,
|
IPC::Message* reply_msg) {
|
||||||
scoped_refptr<base::SequencedTaskRunner> callback_runner) {
|
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||||
if (!callback_runner->RunsTasksInCurrentSequence()) {
|
CEF_POST_TASK(
|
||||||
callback_runner->PostTask(
|
CEF_UIT,
|
||||||
FROM_HERE,
|
base::Bind(&CefBrowserInfoManager::SendNewBrowserInfoResponse,
|
||||||
base::BindOnce(&CefBrowserInfoManager::SendNewBrowserInfoResponse,
|
render_process_id, browser_info, is_guest_view, reply_msg));
|
||||||
render_process_id, browser_info, is_guest_view,
|
|
||||||
std::move(callback), callback_runner));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto params = cef::mojom::NewBrowserInfo::New();
|
content::RenderProcessHost* host =
|
||||||
params->is_guest_view = is_guest_view;
|
content::RenderProcessHost::FromID(render_process_id);
|
||||||
|
if (!host) {
|
||||||
|
delete reply_msg;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CefProcessHostMsg_GetNewBrowserInfo_Params params;
|
||||||
|
params.is_guest_view = is_guest_view;
|
||||||
|
|
||||||
if (browser_info) {
|
if (browser_info) {
|
||||||
params->browser_id = browser_info->browser_id();
|
params.browser_id = browser_info->browser_id();
|
||||||
params->is_windowless = browser_info->is_windowless();
|
params.is_windowless = browser_info->is_windowless();
|
||||||
params->is_popup = browser_info->is_popup();
|
params.is_popup = browser_info->is_popup();
|
||||||
|
|
||||||
auto extra_info = browser_info->extra_info();
|
auto extra_info = browser_info->extra_info();
|
||||||
if (extra_info) {
|
if (extra_info) {
|
||||||
auto extra_info_impl =
|
auto extra_info_impl =
|
||||||
static_cast<CefDictionaryValueImpl*>(extra_info.get());
|
static_cast<CefDictionaryValueImpl*>(extra_info.get());
|
||||||
auto extra_info_value = base::WrapUnique(extra_info_impl->CopyValue());
|
auto extra_info_value = extra_info_impl->CopyValue();
|
||||||
params->extra_info = std::move(*extra_info_value);
|
extra_info_value->Swap(¶ms.extra_info);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// The new browser info response has timed out.
|
// The new browser info response has timed out.
|
||||||
params->browser_id = -1;
|
params.browser_id = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::move(callback).Run(std::move(params));
|
CefProcessHostMsg_GetNewBrowserInfo::WriteReplyParams(reply_msg, params);
|
||||||
}
|
host->Send(reply_msg);
|
||||||
|
|
||||||
// static
|
|
||||||
void CefBrowserInfoManager::CancelNewBrowserInfoResponse(
|
|
||||||
PendingNewBrowserInfo* pending_info) {
|
|
||||||
SendNewBrowserInfoResponse(pending_info->render_process_id,
|
|
||||||
/*browser_info=*/nullptr, /*is_guest_view=*/false,
|
|
||||||
std::move(pending_info->callback),
|
|
||||||
pending_info->callback_runner);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
@@ -591,7 +582,9 @@ void CefBrowserInfoManager::TimeoutNewBrowserInfoResponse(int64_t frame_id,
|
|||||||
<< pending_info->render_process_id << " and routing id "
|
<< pending_info->render_process_id << " and routing id "
|
||||||
<< pending_info->render_routing_id;
|
<< pending_info->render_routing_id;
|
||||||
|
|
||||||
CancelNewBrowserInfoResponse(pending_info.get());
|
SendNewBrowserInfoResponse(pending_info->render_process_id, nullptr,
|
||||||
|
false /* is_guest_view */,
|
||||||
|
pending_info->reply_msg);
|
||||||
g_info_manager->pending_new_browser_info_map_.erase(it);
|
g_info_manager->pending_new_browser_info_map_.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -14,9 +14,7 @@
|
|||||||
|
|
||||||
#include "libcef/browser/browser_info.h"
|
#include "libcef/browser/browser_info.h"
|
||||||
|
|
||||||
#include "base/sequenced_task_runner.h"
|
|
||||||
#include "base/synchronization/lock.h"
|
#include "base/synchronization/lock.h"
|
||||||
#include "cef/libcef/common/mojom/cef.mojom.h"
|
|
||||||
#include "content/public/browser/render_process_host_observer.h"
|
#include "content/public/browser/render_process_host_observer.h"
|
||||||
#include "third_party/blink/public/mojom/window_features/window_features.mojom.h"
|
#include "third_party/blink/public/mojom/window_features/window_features.mojom.h"
|
||||||
#include "ui/base/window_open_disposition.h"
|
#include "ui/base/window_open_disposition.h"
|
||||||
@@ -35,6 +33,10 @@ class WebContents;
|
|||||||
class WebContentsView;
|
class WebContentsView;
|
||||||
} // namespace content
|
} // namespace content
|
||||||
|
|
||||||
|
namespace IPC {
|
||||||
|
class Message;
|
||||||
|
}
|
||||||
|
|
||||||
class CefBrowserHostBase;
|
class CefBrowserHostBase;
|
||||||
class CefBrowserPlatformDelegate;
|
class CefBrowserPlatformDelegate;
|
||||||
|
|
||||||
@@ -95,17 +97,16 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
|||||||
std::unique_ptr<CefBrowserPlatformDelegate>& platform_delegate,
|
std::unique_ptr<CefBrowserPlatformDelegate>& platform_delegate,
|
||||||
CefRefPtr<CefDictionaryValue>& extra_info);
|
CefRefPtr<CefDictionaryValue>& extra_info);
|
||||||
|
|
||||||
// Called from CefBrowserManager::GetNewBrowserInfo for delivering
|
// Called from CefBrowserMessageFilter::OnGetNewBrowserInfo for delivering
|
||||||
// browser info to the renderer process. If the browser info already exists
|
// browser info to the renderer process. If the browser info already exists
|
||||||
// the response will be sent immediately. Otherwise, the response will be sent
|
// the response will be sent immediately. Otherwise, the response will be sent
|
||||||
// when CreatePopupBrowserInfo creates the browser info. The info will already
|
// when CreatePopupBrowserInfo creates the browser info. The info will already
|
||||||
// exist for explicitly created browsers and guest views. It may sometimes
|
// exist for explicitly created browsers and guest views. It may sometimes
|
||||||
// already exist for traditional popup browsers depending on timing. See
|
// already exist for traditional popup browsers depending on timing. See
|
||||||
// comments on PendingPopup for more information.
|
// comments on PendingPopup for more information.
|
||||||
void OnGetNewBrowserInfo(
|
void OnGetNewBrowserInfo(int render_process_id,
|
||||||
int render_process_id,
|
int render_routing_id,
|
||||||
int render_routing_id,
|
IPC::Message* reply_msg);
|
||||||
cef::mojom::BrowserManager::GetNewBrowserInfoCallback callback);
|
|
||||||
|
|
||||||
// Called from CefBrowserHostBase::DestroyBrowser() when a browser is
|
// Called from CefBrowserHostBase::DestroyBrowser() when a browser is
|
||||||
// destroyed.
|
// destroyed.
|
||||||
@@ -162,7 +163,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
|||||||
// Creates the OSR views for windowless popups.
|
// Creates the OSR views for windowless popups.
|
||||||
// - WebContentsCreated (UIT):
|
// - WebContentsCreated (UIT):
|
||||||
// Creates the CefBrowserHost representation for the popup.
|
// Creates the CefBrowserHost representation for the popup.
|
||||||
// - CefBrowserManager::GetNewBrowserInfo (IOT)
|
// - CefBrowserMessageFilter::OnGetNewBrowserInfo (IOT)
|
||||||
// Passes information about the popup to the renderer process.
|
// Passes information about the popup to the renderer process.
|
||||||
struct PendingPopup {
|
struct PendingPopup {
|
||||||
// Track the last method that modified this PendingPopup instance. There may
|
// Track the last method that modified this PendingPopup instance. There may
|
||||||
@@ -208,24 +209,19 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
|||||||
int render_process_id,
|
int render_process_id,
|
||||||
scoped_refptr<CefBrowserInfo> browser_info,
|
scoped_refptr<CefBrowserInfo> browser_info,
|
||||||
bool is_guest_view,
|
bool is_guest_view,
|
||||||
cef::mojom::BrowserManager::GetNewBrowserInfoCallback callback,
|
IPC::Message* reply_msg);
|
||||||
scoped_refptr<base::SequencedTaskRunner> callback_runner);
|
|
||||||
|
// Time out a response if it's still pending.
|
||||||
|
static void TimeoutNewBrowserInfoResponse(int64_t frame_id, int timeout_id);
|
||||||
|
|
||||||
// Pending request for OnGetNewBrowserInfo.
|
// Pending request for OnGetNewBrowserInfo.
|
||||||
struct PendingNewBrowserInfo {
|
struct PendingNewBrowserInfo {
|
||||||
int render_process_id;
|
int render_process_id;
|
||||||
int render_routing_id;
|
int render_routing_id;
|
||||||
int timeout_id;
|
int timeout_id;
|
||||||
cef::mojom::BrowserManager::GetNewBrowserInfoCallback callback;
|
IPC::Message* reply_msg;
|
||||||
scoped_refptr<base::SequencedTaskRunner> callback_runner;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Cancel a response that is still pending.
|
|
||||||
static void CancelNewBrowserInfoResponse(PendingNewBrowserInfo* pending_info);
|
|
||||||
|
|
||||||
// Time out a response if it's still pending.
|
|
||||||
static void TimeoutNewBrowserInfoResponse(int64_t frame_id, int timeout_id);
|
|
||||||
|
|
||||||
mutable base::Lock browser_info_lock_;
|
mutable base::Lock browser_info_lock_;
|
||||||
|
|
||||||
// Access to the below members must be protected by |browser_info_lock_|.
|
// Access to the below members must be protected by |browser_info_lock_|.
|
||||||
|
@@ -1,56 +0,0 @@
|
|||||||
// Copyright 2021 The Chromium Embedded Framework Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style license that can be
|
|
||||||
// found in the LICENSE file.
|
|
||||||
|
|
||||||
#include "libcef/browser/browser_manager.h"
|
|
||||||
|
|
||||||
#include "libcef/browser/browser_info_manager.h"
|
|
||||||
#include "libcef/browser/origin_whitelist_impl.h"
|
|
||||||
|
|
||||||
#include "content/public/browser/render_process_host.h"
|
|
||||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
|
||||||
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
|
|
||||||
#include "services/service_manager/public/cpp/binder_registry.h"
|
|
||||||
|
|
||||||
CefBrowserManager::CefBrowserManager(int render_process_id)
|
|
||||||
: render_process_id_(render_process_id) {}
|
|
||||||
|
|
||||||
CefBrowserManager::~CefBrowserManager() = default;
|
|
||||||
|
|
||||||
// static
|
|
||||||
void CefBrowserManager::ExposeInterfacesToRenderer(
|
|
||||||
service_manager::BinderRegistry* registry,
|
|
||||||
blink::AssociatedInterfaceRegistry* associated_registry,
|
|
||||||
content::RenderProcessHost* host) {
|
|
||||||
registry->AddInterface(base::BindRepeating(
|
|
||||||
[](int render_process_id,
|
|
||||||
mojo::PendingReceiver<cef::mojom::BrowserManager> receiver) {
|
|
||||||
mojo::MakeSelfOwnedReceiver(
|
|
||||||
std::make_unique<CefBrowserManager>(render_process_id),
|
|
||||||
std::move(receiver));
|
|
||||||
},
|
|
||||||
host->GetID()));
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
mojo::Remote<cef::mojom::RenderManager>
|
|
||||||
CefBrowserManager::GetRenderManagerForProcess(
|
|
||||||
content::RenderProcessHost* host) {
|
|
||||||
mojo::Remote<cef::mojom::RenderManager> client;
|
|
||||||
host->BindReceiver(client.BindNewPipeAndPassReceiver());
|
|
||||||
return client;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefBrowserManager::GetNewRenderThreadInfo(
|
|
||||||
cef::mojom::BrowserManager::GetNewRenderThreadInfoCallback callback) {
|
|
||||||
auto info = cef::mojom::NewRenderThreadInfo::New();
|
|
||||||
GetCrossOriginWhitelistEntries(&info->cross_origin_whitelist_entries);
|
|
||||||
std::move(callback).Run(std::move(info));
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefBrowserManager::GetNewBrowserInfo(
|
|
||||||
int32_t render_frame_routing_id,
|
|
||||||
cef::mojom::BrowserManager::GetNewBrowserInfoCallback callback) {
|
|
||||||
CefBrowserInfoManager::GetInstance()->OnGetNewBrowserInfo(
|
|
||||||
render_process_id_, render_frame_routing_id, std::move(callback));
|
|
||||||
}
|
|
@@ -1,54 +0,0 @@
|
|||||||
// Copyright 2021 The Chromium Embedded Framework Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style license that can be
|
|
||||||
// found in the LICENSE file.
|
|
||||||
|
|
||||||
#ifndef CEF_LIBCEF_BROWSER_BROWSER_MANAGER_H_
|
|
||||||
#define CEF_LIBCEF_BROWSER_BROWSER_MANAGER_H_
|
|
||||||
|
|
||||||
#include "cef/libcef/common/mojom/cef.mojom.h"
|
|
||||||
#include "mojo/public/cpp/bindings/remote.h"
|
|
||||||
#include "services/service_manager/public/cpp/binder_registry.h"
|
|
||||||
|
|
||||||
namespace blink {
|
|
||||||
class AssociatedInterfaceRegistry;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace content {
|
|
||||||
class RenderProcessHost;
|
|
||||||
}
|
|
||||||
|
|
||||||
class CefBrowserManager : public cef::mojom::BrowserManager {
|
|
||||||
public:
|
|
||||||
explicit CefBrowserManager(int render_process_id);
|
|
||||||
~CefBrowserManager() override;
|
|
||||||
|
|
||||||
// Called from the ContentBrowserClient method of the same name.
|
|
||||||
// |associated_registry| is used for interfaces which must be associated with
|
|
||||||
// some IPC::ChannelProxy, meaning that messages on the interface retain FIFO
|
|
||||||
// with respect to legacy Chrome IPC messages sent or dispatched on the
|
|
||||||
// channel.
|
|
||||||
static void ExposeInterfacesToRenderer(
|
|
||||||
service_manager::BinderRegistry* registry,
|
|
||||||
blink::AssociatedInterfaceRegistry* associated_registry,
|
|
||||||
content::RenderProcessHost* host);
|
|
||||||
|
|
||||||
// Connects to CefRenderManager in the render process.
|
|
||||||
static mojo::Remote<cef::mojom::RenderManager> GetRenderManagerForProcess(
|
|
||||||
content::RenderProcessHost* host);
|
|
||||||
|
|
||||||
private:
|
|
||||||
// cef::mojom::BrowserManager methods:
|
|
||||||
void GetNewRenderThreadInfo(
|
|
||||||
cef::mojom::BrowserManager::GetNewRenderThreadInfoCallback callback)
|
|
||||||
override;
|
|
||||||
void GetNewBrowserInfo(
|
|
||||||
int32_t render_frame_routing_id,
|
|
||||||
cef::mojom::BrowserManager::GetNewBrowserInfoCallback callback) override;
|
|
||||||
|
|
||||||
// The process ID of the renderer.
|
|
||||||
const int render_process_id_;
|
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserManager);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // CEF_LIBCEF_BROWSER_BROWSER_MANAGER_H_
|
|
55
libcef/browser/browser_message_filter.cc
Normal file
55
libcef/browser/browser_message_filter.cc
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors.
|
||||||
|
// Portions (c) 2011 The Chromium Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "libcef/browser/browser_message_filter.h"
|
||||||
|
|
||||||
|
#include "libcef/browser/browser_info_manager.h"
|
||||||
|
#include "libcef/browser/origin_whitelist_impl.h"
|
||||||
|
#include "libcef/common/app_manager.h"
|
||||||
|
#include "libcef/common/cef_messages.h"
|
||||||
|
#include "libcef/common/values_impl.h"
|
||||||
|
|
||||||
|
#include "base/bind.h"
|
||||||
|
#include "base/compiler_specific.h"
|
||||||
|
#include "content/public/common/child_process_host.h"
|
||||||
|
|
||||||
|
CefBrowserMessageFilter::CefBrowserMessageFilter(int render_process_id)
|
||||||
|
: content::BrowserMessageFilter(ExtensionMsgStart),
|
||||||
|
render_process_id_(render_process_id) {}
|
||||||
|
|
||||||
|
CefBrowserMessageFilter::~CefBrowserMessageFilter() {}
|
||||||
|
|
||||||
|
void CefBrowserMessageFilter::OnFilterRemoved() {
|
||||||
|
render_process_id_ = content::ChildProcessHost::kInvalidUniqueID;
|
||||||
|
content::BrowserMessageFilter::OnFilterRemoved();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CefBrowserMessageFilter::OnMessageReceived(const IPC::Message& message) {
|
||||||
|
bool handled = true;
|
||||||
|
|
||||||
|
IPC_BEGIN_MESSAGE_MAP(CefBrowserMessageFilter, message)
|
||||||
|
IPC_MESSAGE_HANDLER(CefProcessHostMsg_GetNewRenderThreadInfo,
|
||||||
|
OnGetNewRenderThreadInfo)
|
||||||
|
IPC_MESSAGE_HANDLER_DELAY_REPLY(CefProcessHostMsg_GetNewBrowserInfo,
|
||||||
|
OnGetNewBrowserInfo)
|
||||||
|
IPC_MESSAGE_UNHANDLED(handled = false)
|
||||||
|
IPC_END_MESSAGE_MAP()
|
||||||
|
return handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefBrowserMessageFilter::OnGetNewRenderThreadInfo(
|
||||||
|
CefProcessHostMsg_GetNewRenderThreadInfo_Params* params) {
|
||||||
|
GetCrossOriginWhitelistEntries(¶ms->cross_origin_whitelist_entries);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefBrowserMessageFilter::OnGetNewBrowserInfo(int render_frame_routing_id,
|
||||||
|
IPC::Message* reply_msg) {
|
||||||
|
if (render_process_id_ != content::ChildProcessHost::kInvalidUniqueID) {
|
||||||
|
CefBrowserInfoManager::GetInstance()->OnGetNewBrowserInfo(
|
||||||
|
render_process_id_, render_frame_routing_id, reply_msg);
|
||||||
|
} else {
|
||||||
|
delete reply_msg;
|
||||||
|
}
|
||||||
|
}
|
40
libcef/browser/browser_message_filter.h
Normal file
40
libcef/browser/browser_message_filter.h
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors.
|
||||||
|
// Portions copyright (c) 2011 The Chromium Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#ifndef CEF_LIBCEF_BROWSER_BROWSER_MESSAGE_FILTER_H_
|
||||||
|
#define CEF_LIBCEF_BROWSER_BROWSER_MESSAGE_FILTER_H_
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "content/public/browser/browser_message_filter.h"
|
||||||
|
|
||||||
|
struct CefProcessHostMsg_GetNewBrowserInfo_Params;
|
||||||
|
struct CefProcessHostMsg_GetNewRenderThreadInfo_Params;
|
||||||
|
|
||||||
|
// This class sends and receives control messages on the browser process.
|
||||||
|
class CefBrowserMessageFilter : public content::BrowserMessageFilter {
|
||||||
|
public:
|
||||||
|
explicit CefBrowserMessageFilter(int render_process_id);
|
||||||
|
~CefBrowserMessageFilter() override;
|
||||||
|
|
||||||
|
// IPC::ChannelProxy::MessageFilter implementation.
|
||||||
|
void OnFilterRemoved() override;
|
||||||
|
bool OnMessageReceived(const IPC::Message& message) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Message handlers.
|
||||||
|
void OnGetNewRenderThreadInfo(
|
||||||
|
CefProcessHostMsg_GetNewRenderThreadInfo_Params* params);
|
||||||
|
void OnGetNewBrowserInfo(int render_frame_routing_id,
|
||||||
|
IPC::Message* reply_msg);
|
||||||
|
|
||||||
|
int render_process_id_;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefBrowserMessageFilter);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CEF_LIBCEF_BROWSER_BROWSER_MESSAGE_FILTER_H_
|
@@ -76,7 +76,7 @@ void CefBrowserPlatformDelegate::BrowserCreated(CefBrowserHostBase* browser) {
|
|||||||
void CefBrowserPlatformDelegate::CreateExtensionHost(
|
void CefBrowserPlatformDelegate::CreateExtensionHost(
|
||||||
const extensions::Extension* extension,
|
const extensions::Extension* extension,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
extensions::mojom::ViewType host_type) {
|
extensions::ViewType host_type) {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
#include "include/views/cef_browser_view.h"
|
#include "include/views/cef_browser_view.h"
|
||||||
|
|
||||||
#include "base/callback_forward.h"
|
#include "base/callback_forward.h"
|
||||||
#include "extensions/common/mojom/view_type.mojom-forward.h"
|
#include "extensions/common/view_type.h"
|
||||||
#include "third_party/blink/public/common/page/drag_operation.h"
|
#include "third_party/blink/public/common/page/drag_operation.h"
|
||||||
#include "third_party/blink/public/mojom/page/drag.mojom-forward.h"
|
#include "third_party/blink/public/mojom/page/drag.mojom-forward.h"
|
||||||
#include "third_party/skia/include/core/SkColor.h"
|
#include "third_party/skia/include/core/SkColor.h"
|
||||||
@@ -134,7 +134,7 @@ class CefBrowserPlatformDelegate {
|
|||||||
// Called from AlloyBrowserHostImpl::Create.
|
// Called from AlloyBrowserHostImpl::Create.
|
||||||
virtual void CreateExtensionHost(const extensions::Extension* extension,
|
virtual void CreateExtensionHost(const extensions::Extension* extension,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
extensions::mojom::ViewType host_type);
|
extensions::ViewType host_type);
|
||||||
|
|
||||||
// Returns the current extension host.
|
// Returns the current extension host.
|
||||||
virtual extensions::ExtensionHost* GetExtensionHost() const;
|
virtual extensions::ExtensionHost* GetExtensionHost() const;
|
||||||
|
@@ -115,7 +115,7 @@ std::unique_ptr<CefBrowserPlatformDelegate> CefBrowserPlatformDelegate::Create(
|
|||||||
}
|
}
|
||||||
return std::move(native_delegate);
|
return std::move(native_delegate);
|
||||||
} else if (create_params.extension_host_type ==
|
} else if (create_params.extension_host_type ==
|
||||||
extensions::mojom::ViewType::kExtensionBackgroundPage) {
|
extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
|
||||||
// Creating a background extension host without a window.
|
// Creating a background extension host without a window.
|
||||||
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate =
|
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate =
|
||||||
CreateNativeDelegate(CefWindowInfo(), background_color);
|
CreateNativeDelegate(CefWindowInfo(), background_color);
|
||||||
|
@@ -6,11 +6,8 @@
|
|||||||
|
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
|
|
||||||
#include "base/threading/thread_restrictions.h"
|
|
||||||
#include "chrome/browser/browser_process.h"
|
#include "chrome/browser/browser_process.h"
|
||||||
#include "chrome/browser/profiles/off_the_record_profile_impl.h"
|
#include "chrome/browser/profiles/off_the_record_profile_impl.h"
|
||||||
#include "chrome/browser/profiles/profile_keep_alive_types.h"
|
|
||||||
#include "chrome/browser/profiles/scoped_profile_keep_alive.h"
|
|
||||||
|
|
||||||
ChromeBrowserContext::ChromeBrowserContext(
|
ChromeBrowserContext::ChromeBrowserContext(
|
||||||
const CefRequestContextSettings& settings)
|
const CefRequestContextSettings& settings)
|
||||||
@@ -19,18 +16,15 @@ ChromeBrowserContext::ChromeBrowserContext(
|
|||||||
ChromeBrowserContext::~ChromeBrowserContext() = default;
|
ChromeBrowserContext::~ChromeBrowserContext() = default;
|
||||||
|
|
||||||
content::BrowserContext* ChromeBrowserContext::AsBrowserContext() {
|
content::BrowserContext* ChromeBrowserContext::AsBrowserContext() {
|
||||||
CHECK(!destroyed_);
|
|
||||||
return profile_;
|
return profile_;
|
||||||
}
|
}
|
||||||
|
|
||||||
Profile* ChromeBrowserContext::AsProfile() {
|
Profile* ChromeBrowserContext::AsProfile() {
|
||||||
CHECK(!destroyed_);
|
|
||||||
return profile_;
|
return profile_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChromeBrowserContext::IsInitialized() const {
|
bool ChromeBrowserContext::IsInitialized() const {
|
||||||
CEF_REQUIRE_UIT();
|
CEF_REQUIRE_UIT();
|
||||||
CHECK(!destroyed_);
|
|
||||||
return !!profile_;
|
return !!profile_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,8 +57,9 @@ void ChromeBrowserContext::InitializeAsync(base::OnceClosure initialized_cb) {
|
|||||||
// synchronously or asynchronously.
|
// synchronously or asynchronously.
|
||||||
profile_manager->CreateProfileAsync(
|
profile_manager->CreateProfileAsync(
|
||||||
cache_path_,
|
cache_path_,
|
||||||
base::BindRepeating(&ChromeBrowserContext::ProfileCreated,
|
base::Bind(&ChromeBrowserContext::ProfileCreated,
|
||||||
weak_ptr_factory_.GetWeakPtr()));
|
weak_ptr_factory_.GetWeakPtr()),
|
||||||
|
/*name=*/base::string16(), /*icon_url=*/std::string());
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
// All profile directories must be relative to |user_data_dir|.
|
// All profile directories must be relative to |user_data_dir|.
|
||||||
@@ -79,21 +74,13 @@ void ChromeBrowserContext::InitializeAsync(base::OnceClosure initialized_cb) {
|
|||||||
|
|
||||||
void ChromeBrowserContext::Shutdown() {
|
void ChromeBrowserContext::Shutdown() {
|
||||||
CefBrowserContext::Shutdown();
|
CefBrowserContext::Shutdown();
|
||||||
|
|
||||||
// Allow potential deletion of the Profile at some future point (controlled
|
|
||||||
// by ProfileManager).
|
|
||||||
profile_keep_alive_.reset();
|
|
||||||
|
|
||||||
// |g_browser_process| may be nullptr during shutdown.
|
// |g_browser_process| may be nullptr during shutdown.
|
||||||
if (g_browser_process) {
|
if (should_destroy_ && g_browser_process) {
|
||||||
if (should_destroy_) {
|
g_browser_process->profile_manager()
|
||||||
g_browser_process->profile_manager()
|
->GetPrimaryUserProfile()
|
||||||
->GetPrimaryUserProfile()
|
->DestroyOffTheRecordProfile(profile_);
|
||||||
->DestroyOffTheRecordProfile(profile_);
|
|
||||||
} else if (profile_) {
|
|
||||||
OnProfileWillBeDestroyed(profile_);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
profile_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChromeBrowserContext::ProfileCreated(Profile* profile,
|
void ChromeBrowserContext::ProfileCreated(Profile* profile,
|
||||||
@@ -106,16 +93,12 @@ void ChromeBrowserContext::ProfileCreated(Profile* profile,
|
|||||||
CHECK(!profile);
|
CHECK(!profile);
|
||||||
CHECK(!profile_);
|
CHECK(!profile_);
|
||||||
|
|
||||||
// Profile creation may access the filesystem.
|
|
||||||
base::ScopedAllowBlockingForTesting allow_blocking;
|
|
||||||
|
|
||||||
// Creation of a disk-based profile failed for some reason. Create a
|
// Creation of a disk-based profile failed for some reason. Create a
|
||||||
// new/unique OffTheRecord profile instead.
|
// new/unique OffTheRecord profile instead.
|
||||||
const auto& profile_id = Profile::OTRProfileID::CreateUniqueForCEF();
|
const auto& profile_id = Profile::OTRProfileID::CreateUniqueForCEF();
|
||||||
parent_profile =
|
parent_profile =
|
||||||
g_browser_process->profile_manager()->GetPrimaryUserProfile();
|
g_browser_process->profile_manager()->GetPrimaryUserProfile();
|
||||||
profile_ = parent_profile->GetOffTheRecordProfile(
|
profile_ = parent_profile->GetOffTheRecordProfile(profile_id);
|
||||||
profile_id, /*create_if_needed=*/true);
|
|
||||||
otr_profile = static_cast<OffTheRecordProfileImpl*>(profile_);
|
otr_profile = static_cast<OffTheRecordProfileImpl*>(profile_);
|
||||||
status = Profile::CreateStatus::CREATE_STATUS_INITIALIZED;
|
status = Profile::CreateStatus::CREATE_STATUS_INITIALIZED;
|
||||||
should_destroy_ = true;
|
should_destroy_ = true;
|
||||||
@@ -124,9 +107,6 @@ void ChromeBrowserContext::ProfileCreated(Profile* profile,
|
|||||||
// *CREATED isn't always sent for a disk-based profile that already
|
// *CREATED isn't always sent for a disk-based profile that already
|
||||||
// exists.
|
// exists.
|
||||||
profile_ = profile;
|
profile_ = profile;
|
||||||
profile_->AddObserver(this);
|
|
||||||
profile_keep_alive_.reset(new ScopedProfileKeepAlive(
|
|
||||||
profile_, ProfileKeepAliveOrigin::kAppWindow));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == Profile::CreateStatus::CREATE_STATUS_INITIALIZED) {
|
if (status == Profile::CreateStatus::CREATE_STATUS_INITIALIZED) {
|
||||||
@@ -148,10 +128,3 @@ void ChromeBrowserContext::ProfileCreated(Profile* profile,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChromeBrowserContext::OnProfileWillBeDestroyed(Profile* profile) {
|
|
||||||
CHECK_EQ(profile_, profile);
|
|
||||||
profile_->RemoveObserver(this);
|
|
||||||
profile_ = nullptr;
|
|
||||||
destroyed_ = true;
|
|
||||||
}
|
|
||||||
|
@@ -10,13 +10,10 @@
|
|||||||
|
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
#include "chrome/browser/profiles/profile_manager.h"
|
#include "chrome/browser/profiles/profile_manager.h"
|
||||||
#include "chrome/browser/profiles/profile_observer.h"
|
|
||||||
|
|
||||||
class ScopedProfileKeepAlive;
|
|
||||||
|
|
||||||
// See CefBrowserContext documentation for usage. Only accessed on the UI thread
|
// See CefBrowserContext documentation for usage. Only accessed on the UI thread
|
||||||
// unless otherwise indicated.
|
// unless otherwise indicated.
|
||||||
class ChromeBrowserContext : public CefBrowserContext, public ProfileObserver {
|
class ChromeBrowserContext : public CefBrowserContext {
|
||||||
public:
|
public:
|
||||||
explicit ChromeBrowserContext(const CefRequestContextSettings& settings);
|
explicit ChromeBrowserContext(const CefRequestContextSettings& settings);
|
||||||
|
|
||||||
@@ -29,9 +26,6 @@ class ChromeBrowserContext : public CefBrowserContext, public ProfileObserver {
|
|||||||
void StoreOrTriggerInitCallback(base::OnceClosure callback) override;
|
void StoreOrTriggerInitCallback(base::OnceClosure callback) override;
|
||||||
void Shutdown() override;
|
void Shutdown() override;
|
||||||
|
|
||||||
// ProfileObserver overrides.
|
|
||||||
void OnProfileWillBeDestroyed(Profile* profile) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
~ChromeBrowserContext() override;
|
~ChromeBrowserContext() override;
|
||||||
|
|
||||||
@@ -41,9 +35,6 @@ class ChromeBrowserContext : public CefBrowserContext, public ProfileObserver {
|
|||||||
Profile* profile_ = nullptr;
|
Profile* profile_ = nullptr;
|
||||||
bool should_destroy_ = false;
|
bool should_destroy_ = false;
|
||||||
|
|
||||||
bool destroyed_ = false;
|
|
||||||
std::unique_ptr<ScopedProfileKeepAlive> profile_keep_alive_;
|
|
||||||
|
|
||||||
std::vector<base::OnceClosure> init_callbacks_;
|
std::vector<base::OnceClosure> init_callbacks_;
|
||||||
|
|
||||||
base::WeakPtrFactory<ChromeBrowserContext> weak_ptr_factory_;
|
base::WeakPtrFactory<ChromeBrowserContext> weak_ptr_factory_;
|
||||||
|
@@ -156,9 +156,9 @@ void ChromeBrowserDelegate::UpdateTargetURL(content::WebContents* source,
|
|||||||
bool ChromeBrowserDelegate::DidAddMessageToConsole(
|
bool ChromeBrowserDelegate::DidAddMessageToConsole(
|
||||||
content::WebContents* source,
|
content::WebContents* source,
|
||||||
blink::mojom::ConsoleMessageLevel log_level,
|
blink::mojom::ConsoleMessageLevel log_level,
|
||||||
const std::u16string& message,
|
const base::string16& message,
|
||||||
int32_t line_no,
|
int32_t line_no,
|
||||||
const std::u16string& source_id) {
|
const base::string16& source_id) {
|
||||||
if (auto delegate = GetDelegateForWebContents(source)) {
|
if (auto delegate = GetDelegateForWebContents(source)) {
|
||||||
return delegate->DidAddMessageToConsole(source, log_level, message, line_no,
|
return delegate->DidAddMessageToConsole(source, log_level, message, line_no,
|
||||||
source_id);
|
source_id);
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
#include "libcef/browser/browser_info.h"
|
#include "libcef/browser/browser_info.h"
|
||||||
#include "libcef/browser/chrome/browser_delegate.h"
|
#include "libcef/browser/chrome/browser_delegate.h"
|
||||||
|
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
#include "base/optional.h"
|
||||||
|
|
||||||
class CefBrowserContentsDelegate;
|
class CefBrowserContentsDelegate;
|
||||||
class CefRequestContextImpl;
|
class CefRequestContextImpl;
|
||||||
@@ -70,9 +70,9 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
|
|||||||
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
|
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
|
||||||
bool DidAddMessageToConsole(content::WebContents* source,
|
bool DidAddMessageToConsole(content::WebContents* source,
|
||||||
blink::mojom::ConsoleMessageLevel log_level,
|
blink::mojom::ConsoleMessageLevel log_level,
|
||||||
const std::u16string& message,
|
const base::string16& message,
|
||||||
int32_t line_no,
|
int32_t line_no,
|
||||||
const std::u16string& source_id) override;
|
const base::string16& source_id) override;
|
||||||
void DidNavigateMainFramePostCommit(
|
void DidNavigateMainFramePostCommit(
|
||||||
content::WebContents* web_contents) override;
|
content::WebContents* web_contents) override;
|
||||||
void EnterFullscreenModeForTab(
|
void EnterFullscreenModeForTab(
|
||||||
|
@@ -9,7 +9,6 @@
|
|||||||
#include "libcef/browser/net/chrome_scheme_handler.h"
|
#include "libcef/browser/net/chrome_scheme_handler.h"
|
||||||
|
|
||||||
#include "base/task/post_task.h"
|
#include "base/task/post_task.h"
|
||||||
#include "base/task/thread_pool.h"
|
|
||||||
|
|
||||||
ChromeBrowserMainExtraPartsCef::ChromeBrowserMainExtraPartsCef() = default;
|
ChromeBrowserMainExtraPartsCef::ChromeBrowserMainExtraPartsCef() = default;
|
||||||
|
|
||||||
@@ -25,14 +24,14 @@ void ChromeBrowserMainExtraPartsCef::PostProfileInit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ChromeBrowserMainExtraPartsCef::PreMainMessageLoopRun() {
|
void ChromeBrowserMainExtraPartsCef::PreMainMessageLoopRun() {
|
||||||
background_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
|
background_task_runner_ = base::CreateSingleThreadTaskRunner(
|
||||||
{base::TaskPriority::BEST_EFFORT,
|
{base::ThreadPool(), base::TaskPriority::BEST_EFFORT,
|
||||||
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
||||||
user_visible_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
|
user_visible_task_runner_ = base::CreateSingleThreadTaskRunner(
|
||||||
{base::TaskPriority::USER_VISIBLE,
|
{base::ThreadPool(), base::TaskPriority::USER_VISIBLE,
|
||||||
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
||||||
user_blocking_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
|
user_blocking_task_runner_ = base::CreateSingleThreadTaskRunner(
|
||||||
{base::TaskPriority::USER_BLOCKING,
|
{base::ThreadPool(), base::TaskPriority::USER_BLOCKING,
|
||||||
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
||||||
|
|
||||||
scheme::RegisterWebUIControllerFactory();
|
scheme::RegisterWebUIControllerFactory();
|
||||||
|
@@ -5,9 +5,8 @@
|
|||||||
|
|
||||||
#include "libcef/browser/chrome/chrome_content_browser_client_cef.h"
|
#include "libcef/browser/chrome/chrome_content_browser_client_cef.h"
|
||||||
|
|
||||||
#include "libcef/browser/browser_frame.h"
|
|
||||||
#include "libcef/browser/browser_info_manager.h"
|
#include "libcef/browser/browser_info_manager.h"
|
||||||
#include "libcef/browser/browser_manager.h"
|
#include "libcef/browser/browser_message_filter.h"
|
||||||
#include "libcef/browser/chrome/chrome_browser_host_impl.h"
|
#include "libcef/browser/chrome/chrome_browser_host_impl.h"
|
||||||
#include "libcef/browser/chrome/chrome_browser_main_extra_parts_cef.h"
|
#include "libcef/browser/chrome/chrome_browser_main_extra_parts_cef.h"
|
||||||
#include "libcef/browser/context.h"
|
#include "libcef/browser/context.h"
|
||||||
@@ -42,15 +41,13 @@ namespace {
|
|||||||
void HandleExternalProtocolHelper(
|
void HandleExternalProtocolHelper(
|
||||||
ChromeContentBrowserClientCef* self,
|
ChromeContentBrowserClientCef* self,
|
||||||
content::WebContents::OnceGetter web_contents_getter,
|
content::WebContents::OnceGetter web_contents_getter,
|
||||||
int frame_tree_node_id,
|
|
||||||
content::NavigationUIData* navigation_data,
|
content::NavigationUIData* navigation_data,
|
||||||
const network::ResourceRequest& resource_request) {
|
const network::ResourceRequest& resource_request) {
|
||||||
// Match the logic of the original call in
|
// Match the logic of the original call in
|
||||||
// NavigationURLLoaderImpl::PrepareForNonInterceptedRequest.
|
// NavigationURLLoaderImpl::PrepareForNonInterceptedRequest.
|
||||||
self->HandleExternalProtocol(
|
self->HandleExternalProtocol(
|
||||||
resource_request.url, std::move(web_contents_getter),
|
resource_request.url, std::move(web_contents_getter),
|
||||||
content::ChildProcessHost::kInvalidUniqueID, frame_tree_node_id,
|
content::ChildProcessHost::kInvalidUniqueID, navigation_data,
|
||||||
navigation_data,
|
|
||||||
resource_request.resource_type ==
|
resource_request.resource_type ==
|
||||||
static_cast<int>(blink::mojom::ResourceType::kMainFrame),
|
static_cast<int>(blink::mojom::ResourceType::kMainFrame),
|
||||||
static_cast<ui::PageTransition>(resource_request.transition_type),
|
static_cast<ui::PageTransition>(resource_request.transition_type),
|
||||||
@@ -123,7 +120,7 @@ void ChromeContentBrowserClientCef::AppendExtraCommandLineSwitches(
|
|||||||
CefRefPtr<CefCommandLineImpl> commandLinePtr(
|
CefRefPtr<CefCommandLineImpl> commandLinePtr(
|
||||||
new CefCommandLineImpl(command_line, false, false));
|
new CefCommandLineImpl(command_line, false, false));
|
||||||
handler->OnBeforeChildProcessLaunch(commandLinePtr.get());
|
handler->OnBeforeChildProcessLaunch(commandLinePtr.get());
|
||||||
ignore_result(commandLinePtr->Detach(nullptr));
|
commandLinePtr->Detach(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -132,6 +129,9 @@ void ChromeContentBrowserClientCef::RenderProcessWillLaunch(
|
|||||||
content::RenderProcessHost* host) {
|
content::RenderProcessHost* host) {
|
||||||
ChromeContentBrowserClient::RenderProcessWillLaunch(host);
|
ChromeContentBrowserClient::RenderProcessWillLaunch(host);
|
||||||
|
|
||||||
|
const int id = host->GetID();
|
||||||
|
host->AddFilter(new CefBrowserMessageFilter(id));
|
||||||
|
|
||||||
// If the renderer process crashes then the host may already have
|
// If the renderer process crashes then the host may already have
|
||||||
// CefBrowserInfoManager as an observer. Try to remove it first before adding
|
// CefBrowserInfoManager as an observer. Try to remove it first before adding
|
||||||
// to avoid DCHECKs.
|
// to avoid DCHECKs.
|
||||||
@@ -199,7 +199,7 @@ bool ChromeContentBrowserClientCef::WillCreateURLLoaderFactory(
|
|||||||
int render_process_id,
|
int render_process_id,
|
||||||
URLLoaderFactoryType type,
|
URLLoaderFactoryType type,
|
||||||
const url::Origin& request_initiator,
|
const url::Origin& request_initiator,
|
||||||
absl::optional<int64_t> navigation_id,
|
base::Optional<int64_t> navigation_id,
|
||||||
ukm::SourceIdObj ukm_source_id,
|
ukm::SourceIdObj ukm_source_id,
|
||||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
||||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||||
@@ -238,12 +238,11 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
|
|||||||
const GURL& url,
|
const GURL& url,
|
||||||
content::WebContents::OnceGetter web_contents_getter,
|
content::WebContents::OnceGetter web_contents_getter,
|
||||||
int child_id,
|
int child_id,
|
||||||
int frame_tree_node_id,
|
|
||||||
content::NavigationUIData* navigation_data,
|
content::NavigationUIData* navigation_data,
|
||||||
bool is_main_frame,
|
bool is_main_frame,
|
||||||
ui::PageTransition page_transition,
|
ui::PageTransition page_transition,
|
||||||
bool has_user_gesture,
|
bool has_user_gesture,
|
||||||
const absl::optional<url::Origin>& initiating_origin,
|
const base::Optional<url::Origin>& initiating_origin,
|
||||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
|
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
|
||||||
// |out_factory| will be non-nullptr when this method is initially called
|
// |out_factory| will be non-nullptr when this method is initially called
|
||||||
// from NavigationURLLoaderImpl::PrepareForNonInterceptedRequest.
|
// from NavigationURLLoaderImpl::PrepareForNonInterceptedRequest.
|
||||||
@@ -256,9 +255,9 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
|
|||||||
// HandleExternalProtocolHelper. Forward to the chrome layer for default
|
// HandleExternalProtocolHelper. Forward to the chrome layer for default
|
||||||
// handling.
|
// handling.
|
||||||
return ChromeContentBrowserClient::HandleExternalProtocol(
|
return ChromeContentBrowserClient::HandleExternalProtocol(
|
||||||
url, std::move(web_contents_getter), child_id, frame_tree_node_id,
|
url, std::move(web_contents_getter), child_id, navigation_data,
|
||||||
navigation_data, is_main_frame, page_transition, has_user_gesture,
|
is_main_frame, page_transition, has_user_gesture, initiating_origin,
|
||||||
initiating_origin, nullptr);
|
nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChromeContentBrowserClientCef::HandleExternalProtocol(
|
bool ChromeContentBrowserClientCef::HandleExternalProtocol(
|
||||||
@@ -273,9 +272,8 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
|
|||||||
// HandleExternalProtocolHelper may be called if nothing handles the request.
|
// HandleExternalProtocolHelper may be called if nothing handles the request.
|
||||||
auto request_handler = net_service::CreateInterceptedRequestHandler(
|
auto request_handler = net_service::CreateInterceptedRequestHandler(
|
||||||
web_contents_getter, frame_tree_node_id, resource_request,
|
web_contents_getter, frame_tree_node_id, resource_request,
|
||||||
base::BindRepeating(HandleExternalProtocolHelper, base::Unretained(this),
|
base::Bind(HandleExternalProtocolHelper, base::Unretained(this),
|
||||||
web_contents_getter, frame_tree_node_id,
|
web_contents_getter, navigation_data, resource_request));
|
||||||
navigation_data, resource_request));
|
|
||||||
|
|
||||||
net_service::ProxyURLLoaderFactory::CreateProxy(
|
net_service::ProxyURLLoaderFactory::CreateProxy(
|
||||||
web_contents_getter, std::move(receiver), std::move(request_handler));
|
web_contents_getter, std::move(receiver), std::move(request_handler));
|
||||||
@@ -355,27 +353,6 @@ bool ChromeContentBrowserClientCef::IsWebUIAllowedToMakeNetworkRequests(
|
|||||||
return scheme::IsWebUIAllowedToMakeNetworkRequests(origin);
|
return scheme::IsWebUIAllowedToMakeNetworkRequests(origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChromeContentBrowserClientCef::ExposeInterfacesToRenderer(
|
|
||||||
service_manager::BinderRegistry* registry,
|
|
||||||
blink::AssociatedInterfaceRegistry* associated_registry,
|
|
||||||
content::RenderProcessHost* host) {
|
|
||||||
ChromeContentBrowserClient::ExposeInterfacesToRenderer(
|
|
||||||
registry, associated_registry, host);
|
|
||||||
|
|
||||||
CefBrowserManager::ExposeInterfacesToRenderer(registry, associated_registry,
|
|
||||||
host);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChromeContentBrowserClientCef::RegisterBrowserInterfaceBindersForFrame(
|
|
||||||
content::RenderFrameHost* render_frame_host,
|
|
||||||
mojo::BinderMapWithContext<content::RenderFrameHost*>* map) {
|
|
||||||
ChromeContentBrowserClient::RegisterBrowserInterfaceBindersForFrame(
|
|
||||||
render_frame_host, map);
|
|
||||||
|
|
||||||
CefBrowserFrame::RegisterBrowserInterfaceBindersForFrame(render_frame_host,
|
|
||||||
map);
|
|
||||||
}
|
|
||||||
|
|
||||||
CefRefPtr<CefRequestContextImpl>
|
CefRefPtr<CefRequestContextImpl>
|
||||||
ChromeContentBrowserClientCef::request_context() const {
|
ChromeContentBrowserClientCef::request_context() const {
|
||||||
return browser_main_parts_->request_context();
|
return browser_main_parts_->request_context();
|
||||||
|
@@ -48,7 +48,7 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
|
|||||||
int render_process_id,
|
int render_process_id,
|
||||||
URLLoaderFactoryType type,
|
URLLoaderFactoryType type,
|
||||||
const url::Origin& request_initiator,
|
const url::Origin& request_initiator,
|
||||||
absl::optional<int64_t> navigation_id,
|
base::Optional<int64_t> navigation_id,
|
||||||
ukm::SourceIdObj ukm_source_id,
|
ukm::SourceIdObj ukm_source_id,
|
||||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
||||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||||
@@ -60,12 +60,11 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
|
|||||||
const GURL& url,
|
const GURL& url,
|
||||||
content::WebContents::OnceGetter web_contents_getter,
|
content::WebContents::OnceGetter web_contents_getter,
|
||||||
int child_id,
|
int child_id,
|
||||||
int frame_tree_node_id,
|
|
||||||
content::NavigationUIData* navigation_data,
|
content::NavigationUIData* navigation_data,
|
||||||
bool is_main_frame,
|
bool is_main_frame,
|
||||||
ui::PageTransition page_transition,
|
ui::PageTransition page_transition,
|
||||||
bool has_user_gesture,
|
bool has_user_gesture,
|
||||||
const absl::optional<url::Origin>& initiating_origin,
|
const base::Optional<url::Origin>& initiating_origin,
|
||||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
|
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
|
||||||
override;
|
override;
|
||||||
bool HandleExternalProtocol(
|
bool HandleExternalProtocol(
|
||||||
@@ -96,13 +95,6 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
|
|||||||
LoginAuthRequiredCallback auth_required_callback) override;
|
LoginAuthRequiredCallback auth_required_callback) override;
|
||||||
void BrowserURLHandlerCreated(content::BrowserURLHandler* handler) override;
|
void BrowserURLHandlerCreated(content::BrowserURLHandler* handler) override;
|
||||||
bool IsWebUIAllowedToMakeNetworkRequests(const url::Origin& origin) override;
|
bool IsWebUIAllowedToMakeNetworkRequests(const url::Origin& origin) override;
|
||||||
void ExposeInterfacesToRenderer(
|
|
||||||
service_manager::BinderRegistry* registry,
|
|
||||||
blink::AssociatedInterfaceRegistry* associated_registry,
|
|
||||||
content::RenderProcessHost* render_process_host) override;
|
|
||||||
void RegisterBrowserInterfaceBindersForFrame(
|
|
||||||
content::RenderFrameHost* render_frame_host,
|
|
||||||
mojo::BinderMapWithContext<content::RenderFrameHost*>* map) override;
|
|
||||||
|
|
||||||
CefRefPtr<CefRequestContextImpl> request_context() const;
|
CefRefPtr<CefRequestContextImpl> request_context() const;
|
||||||
|
|
||||||
|
@@ -111,7 +111,7 @@ class CefContextMenuObserver : public RenderViewContextMenuObserver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SetAccelerator(int command_id,
|
void SetAccelerator(int command_id,
|
||||||
absl::optional<ui::Accelerator> accel) override {
|
base::Optional<ui::Accelerator> accel) override {
|
||||||
// No-op if already at the default state.
|
// No-op if already at the default state.
|
||||||
if (!accel && !GetItemInfo(command_id))
|
if (!accel && !GetItemInfo(command_id))
|
||||||
return;
|
return;
|
||||||
@@ -127,7 +127,7 @@ class CefContextMenuObserver : public RenderViewContextMenuObserver,
|
|||||||
ItemInfo() {}
|
ItemInfo() {}
|
||||||
|
|
||||||
bool checked = false;
|
bool checked = false;
|
||||||
absl::optional<ui::Accelerator> accel;
|
base::Optional<ui::Accelerator> accel;
|
||||||
};
|
};
|
||||||
|
|
||||||
ItemInfo* GetItemInfo(int command_id) {
|
ItemInfo* GetItemInfo(int command_id) {
|
||||||
|
@@ -74,7 +74,7 @@ ToolbarView* ChromeBrowserView::OverrideCreateToolbar(
|
|||||||
BrowserView* browser_view) {
|
BrowserView* browser_view) {
|
||||||
if (cef_delegate()) {
|
if (cef_delegate()) {
|
||||||
auto toolbar_type = cef_delegate()->GetChromeToolbarType();
|
auto toolbar_type = cef_delegate()->GetChromeToolbarType();
|
||||||
absl::optional<ToolbarView::DisplayMode> display_mode;
|
base::Optional<ToolbarView::DisplayMode> display_mode;
|
||||||
switch (toolbar_type) {
|
switch (toolbar_type) {
|
||||||
case CEF_CTT_NORMAL:
|
case CEF_CTT_NORMAL:
|
||||||
display_mode = ToolbarView::DisplayMode::NORMAL;
|
display_mode = ToolbarView::DisplayMode::NORMAL;
|
||||||
|
@@ -9,7 +9,7 @@ CefRefPtr<CefToolbarViewImpl> CefToolbarViewImpl::Create(
|
|||||||
CefRefPtr<CefViewDelegate> delegate,
|
CefRefPtr<CefViewDelegate> delegate,
|
||||||
Browser* browser,
|
Browser* browser,
|
||||||
BrowserView* browser_view,
|
BrowserView* browser_view,
|
||||||
absl::optional<ToolbarView::DisplayMode> display_mode) {
|
base::Optional<ToolbarView::DisplayMode> display_mode) {
|
||||||
CEF_REQUIRE_UIT_RETURN(nullptr);
|
CEF_REQUIRE_UIT_RETURN(nullptr);
|
||||||
CefRefPtr<CefToolbarViewImpl> view =
|
CefRefPtr<CefToolbarViewImpl> view =
|
||||||
new CefToolbarViewImpl(delegate, browser, browser_view, display_mode);
|
new CefToolbarViewImpl(delegate, browser, browser_view, display_mode);
|
||||||
@@ -24,7 +24,7 @@ CefToolbarViewImpl::CefToolbarViewImpl(
|
|||||||
CefRefPtr<CefViewDelegate> delegate,
|
CefRefPtr<CefViewDelegate> delegate,
|
||||||
Browser* browser,
|
Browser* browser,
|
||||||
BrowserView* browser_view,
|
BrowserView* browser_view,
|
||||||
absl::optional<ToolbarView::DisplayMode> display_mode)
|
base::Optional<ToolbarView::DisplayMode> display_mode)
|
||||||
: ParentClass(delegate),
|
: ParentClass(delegate),
|
||||||
browser_(browser),
|
browser_(browser),
|
||||||
browser_view_(browser_view),
|
browser_view_(browser_view),
|
||||||
|
@@ -24,7 +24,7 @@ class CefToolbarViewImpl
|
|||||||
CefRefPtr<CefViewDelegate> delegate,
|
CefRefPtr<CefViewDelegate> delegate,
|
||||||
Browser* browser,
|
Browser* browser,
|
||||||
BrowserView* browser_view,
|
BrowserView* browser_view,
|
||||||
absl::optional<ToolbarView::DisplayMode> display_mode);
|
base::Optional<ToolbarView::DisplayMode> display_mode);
|
||||||
|
|
||||||
static const char* const kTypeString;
|
static const char* const kTypeString;
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ class CefToolbarViewImpl
|
|||||||
CefToolbarViewImpl(CefRefPtr<CefViewDelegate> delegate,
|
CefToolbarViewImpl(CefRefPtr<CefViewDelegate> delegate,
|
||||||
Browser* browser,
|
Browser* browser,
|
||||||
BrowserView* browser_view,
|
BrowserView* browser_view,
|
||||||
absl::optional<ToolbarView::DisplayMode> display_mode);
|
base::Optional<ToolbarView::DisplayMode> display_mode);
|
||||||
|
|
||||||
// CefViewImpl methods:
|
// CefViewImpl methods:
|
||||||
CefToolbarViewView* CreateRootView() override;
|
CefToolbarViewView* CreateRootView() override;
|
||||||
@@ -46,7 +46,7 @@ class CefToolbarViewImpl
|
|||||||
|
|
||||||
Browser* const browser_;
|
Browser* const browser_;
|
||||||
BrowserView* const browser_view_;
|
BrowserView* const browser_view_;
|
||||||
absl::optional<ToolbarView::DisplayMode> const display_mode_;
|
base::Optional<ToolbarView::DisplayMode> const display_mode_;
|
||||||
|
|
||||||
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefToolbarViewImpl);
|
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefToolbarViewImpl);
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefToolbarViewImpl);
|
DISALLOW_COPY_AND_ASSIGN(CefToolbarViewImpl);
|
||||||
|
@@ -7,5 +7,5 @@
|
|||||||
CefToolbarViewView::CefToolbarViewView(CefViewDelegate* cef_delegate,
|
CefToolbarViewView::CefToolbarViewView(CefViewDelegate* cef_delegate,
|
||||||
Browser* browser,
|
Browser* browser,
|
||||||
BrowserView* browser_view,
|
BrowserView* browser_view,
|
||||||
absl::optional<DisplayMode> display_mode)
|
base::Optional<DisplayMode> display_mode)
|
||||||
: ParentClass(cef_delegate, browser, browser_view, display_mode) {}
|
: ParentClass(cef_delegate, browser, browser_view, display_mode) {}
|
||||||
|
@@ -18,7 +18,7 @@ class CefToolbarViewView : public CefViewView<ToolbarView, CefViewDelegate> {
|
|||||||
explicit CefToolbarViewView(CefViewDelegate* cef_delegate,
|
explicit CefToolbarViewView(CefViewDelegate* cef_delegate,
|
||||||
Browser* browser,
|
Browser* browser,
|
||||||
BrowserView* browser_view,
|
BrowserView* browser_view,
|
||||||
absl::optional<DisplayMode> display_mode);
|
base::Optional<DisplayMode> display_mode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefToolbarViewView);
|
DISALLOW_COPY_AND_ASSIGN(CefToolbarViewView);
|
||||||
|
@@ -294,12 +294,10 @@ void CefSetOSModalLoop(bool osModalLoop) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
if (CEF_CURRENTLY_ON_UIT())
|
||||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(CefSetOSModalLoop, osModalLoop));
|
base::CurrentThread::Get()->set_os_modal_loop(osModalLoop);
|
||||||
return;
|
else
|
||||||
}
|
CEF_POST_TASK(CEF_UIT, base::Bind(CefSetOSModalLoop, osModalLoop));
|
||||||
|
|
||||||
base::CurrentThread::Get()->set_os_modal_loop(osModalLoop);
|
|
||||||
#endif // defined(OS_WIN)
|
#endif // defined(OS_WIN)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -119,7 +119,7 @@ bool CefContextMenuParamsImpl::GetDictionarySuggestions(
|
|||||||
if (const_value().dictionary_suggestions.empty())
|
if (const_value().dictionary_suggestions.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::vector<std::u16string>::const_iterator it =
|
std::vector<base::string16>::const_iterator it =
|
||||||
const_value().dictionary_suggestions.begin();
|
const_value().dictionary_suggestions.begin();
|
||||||
for (; it != const_value().dictionary_suggestions.end(); ++it)
|
for (; it != const_value().dictionary_suggestions.end(); ++it)
|
||||||
suggestions.push_back(*it);
|
suggestions.push_back(*it);
|
||||||
|
@@ -91,7 +91,7 @@ void CefDevToolsController::RemoveObserver(Observer* observer) {
|
|||||||
void CefDevToolsController::DispatchProtocolMessage(
|
void CefDevToolsController::DispatchProtocolMessage(
|
||||||
content::DevToolsAgentHost* agent_host,
|
content::DevToolsAgentHost* agent_host,
|
||||||
base::span<const uint8_t> message) {
|
base::span<const uint8_t> message) {
|
||||||
if (observers_.empty())
|
if (!observers_.might_have_observers())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
base::StringPiece str_message(reinterpret_cast<const char*>(message.data()),
|
base::StringPiece str_message(reinterpret_cast<const char*>(message.data()),
|
||||||
|
@@ -15,7 +15,6 @@
|
|||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "base/task/post_task.h"
|
#include "base/task/post_task.h"
|
||||||
#include "base/task/thread_pool.h"
|
|
||||||
#include "base/threading/sequenced_task_runner_handle.h"
|
#include "base/threading/sequenced_task_runner_handle.h"
|
||||||
#include "base/util/values/values_util.h"
|
#include "base/util/values/values_util.h"
|
||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
@@ -35,7 +34,7 @@ void WriteToFile(const base::FilePath& path, const std::string& content) {
|
|||||||
|
|
||||||
void AppendToFile(const base::FilePath& path, const std::string& content) {
|
void AppendToFile(const base::FilePath& path, const std::string& content) {
|
||||||
DCHECK(!path.empty());
|
DCHECK(!path.empty());
|
||||||
base::AppendToFile(path, base::StringPiece(content));
|
base::AppendToFile(path, content.c_str(), content.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
@@ -45,35 +44,35 @@ CefDevToolsFileManager::CefDevToolsFileManager(
|
|||||||
PrefService* prefs)
|
PrefService* prefs)
|
||||||
: browser_impl_(browser_impl),
|
: browser_impl_(browser_impl),
|
||||||
prefs_(prefs),
|
prefs_(prefs),
|
||||||
file_task_runner_(
|
file_task_runner_(base::CreateSequencedTaskRunner(
|
||||||
base::ThreadPool::CreateSequencedTaskRunner({base::MayBlock()})),
|
{base::ThreadPool(), base::MayBlock()})),
|
||||||
weak_factory_(this) {}
|
weak_factory_(this) {}
|
||||||
|
|
||||||
void CefDevToolsFileManager::SaveToFile(const std::string& url,
|
void CefDevToolsFileManager::SaveToFile(const std::string& url,
|
||||||
const std::string& content,
|
const std::string& content,
|
||||||
bool save_as) {
|
bool save_as) {
|
||||||
Save(url, content, save_as,
|
Save(url, content, save_as,
|
||||||
base::BindOnce(&CefDevToolsFileManager::FileSavedAs,
|
base::Bind(&CefDevToolsFileManager::FileSavedAs,
|
||||||
weak_factory_.GetWeakPtr(), url),
|
weak_factory_.GetWeakPtr(), url),
|
||||||
base::BindOnce(&CefDevToolsFileManager::CanceledFileSaveAs,
|
base::Bind(&CefDevToolsFileManager::CanceledFileSaveAs,
|
||||||
weak_factory_.GetWeakPtr(), url));
|
weak_factory_.GetWeakPtr(), url));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefDevToolsFileManager::AppendToFile(const std::string& url,
|
void CefDevToolsFileManager::AppendToFile(const std::string& url,
|
||||||
const std::string& content) {
|
const std::string& content) {
|
||||||
Append(url, content,
|
Append(url, content,
|
||||||
base::BindOnce(&CefDevToolsFileManager::AppendedTo,
|
base::Bind(&CefDevToolsFileManager::AppendedTo,
|
||||||
weak_factory_.GetWeakPtr(), url));
|
weak_factory_.GetWeakPtr(), url));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefDevToolsFileManager::Save(const std::string& url,
|
void CefDevToolsFileManager::Save(const std::string& url,
|
||||||
const std::string& content,
|
const std::string& content,
|
||||||
bool save_as,
|
bool save_as,
|
||||||
SaveCallback saveCallback,
|
const SaveCallback& saveCallback,
|
||||||
CancelCallback cancelCallback) {
|
const CancelCallback& cancelCallback) {
|
||||||
auto it = saved_files_.find(url);
|
auto it = saved_files_.find(url);
|
||||||
if (it != saved_files_.end() && !save_as) {
|
if (it != saved_files_.end() && !save_as) {
|
||||||
SaveAsFileSelected(url, content, std::move(saveCallback), it->second);
|
SaveAsFileSelected(url, content, saveCallback, it->second);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +82,7 @@ void CefDevToolsFileManager::Save(const std::string& url,
|
|||||||
|
|
||||||
const base::Value* path_value;
|
const base::Value* path_value;
|
||||||
if (file_map->Get(base::MD5String(url), &path_value)) {
|
if (file_map->Get(base::MD5String(url), &path_value)) {
|
||||||
absl::optional<base::FilePath> path = util::ValueToFilePath(*path_value);
|
base::Optional<base::FilePath> path = util::ValueToFilePath(*path_value);
|
||||||
if (path)
|
if (path)
|
||||||
initial_path = std::move(*path);
|
initial_path = std::move(*path);
|
||||||
}
|
}
|
||||||
@@ -116,29 +115,28 @@ void CefDevToolsFileManager::Save(const std::string& url,
|
|||||||
}
|
}
|
||||||
|
|
||||||
browser_impl_->RunFileChooser(
|
browser_impl_->RunFileChooser(
|
||||||
params,
|
params, base::Bind(&CefDevToolsFileManager::SaveAsDialogDismissed,
|
||||||
base::BindOnce(&CefDevToolsFileManager::SaveAsDialogDismissed,
|
weak_factory_.GetWeakPtr(), url, content, saveCallback,
|
||||||
weak_factory_.GetWeakPtr(), url, content,
|
cancelCallback));
|
||||||
std::move(saveCallback), std::move(cancelCallback)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefDevToolsFileManager::SaveAsDialogDismissed(
|
void CefDevToolsFileManager::SaveAsDialogDismissed(
|
||||||
const std::string& url,
|
const std::string& url,
|
||||||
const std::string& content,
|
const std::string& content,
|
||||||
SaveCallback saveCallback,
|
const SaveCallback& saveCallback,
|
||||||
CancelCallback cancelCallback,
|
const CancelCallback& cancelCallback,
|
||||||
int selected_accept_filter,
|
int selected_accept_filter,
|
||||||
const std::vector<base::FilePath>& file_paths) {
|
const std::vector<base::FilePath>& file_paths) {
|
||||||
if (file_paths.size() == 1) {
|
if (file_paths.size() == 1) {
|
||||||
SaveAsFileSelected(url, content, std::move(saveCallback), file_paths[0]);
|
SaveAsFileSelected(url, content, saveCallback, file_paths[0]);
|
||||||
} else {
|
} else {
|
||||||
std::move(cancelCallback).Run();
|
cancelCallback.Run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefDevToolsFileManager::SaveAsFileSelected(const std::string& url,
|
void CefDevToolsFileManager::SaveAsFileSelected(const std::string& url,
|
||||||
const std::string& content,
|
const std::string& content,
|
||||||
SaveCallback callback,
|
const SaveCallback& callback,
|
||||||
const base::FilePath& path) {
|
const base::FilePath& path) {
|
||||||
*g_last_save_path.Pointer() = path;
|
*g_last_save_path.Pointer() = path;
|
||||||
saved_files_[url] = path;
|
saved_files_[url] = path;
|
||||||
@@ -147,7 +145,7 @@ void CefDevToolsFileManager::SaveAsFileSelected(const std::string& url,
|
|||||||
base::DictionaryValue* files_map = update.Get();
|
base::DictionaryValue* files_map = update.Get();
|
||||||
files_map->SetKey(base::MD5String(url), util::FilePathToValue(path));
|
files_map->SetKey(base::MD5String(url), util::FilePathToValue(path));
|
||||||
std::string file_system_path = path.AsUTF8Unsafe();
|
std::string file_system_path = path.AsUTF8Unsafe();
|
||||||
std::move(callback).Run(file_system_path);
|
callback.Run(file_system_path);
|
||||||
file_task_runner_->PostTask(FROM_HERE,
|
file_task_runner_->PostTask(FROM_HERE,
|
||||||
base::BindOnce(&::WriteToFile, path, content));
|
base::BindOnce(&::WriteToFile, path, content));
|
||||||
}
|
}
|
||||||
@@ -168,11 +166,11 @@ void CefDevToolsFileManager::CanceledFileSaveAs(const std::string& url) {
|
|||||||
|
|
||||||
void CefDevToolsFileManager::Append(const std::string& url,
|
void CefDevToolsFileManager::Append(const std::string& url,
|
||||||
const std::string& content,
|
const std::string& content,
|
||||||
AppendCallback callback) {
|
const AppendCallback& callback) {
|
||||||
auto it = saved_files_.find(url);
|
auto it = saved_files_.find(url);
|
||||||
if (it == saved_files_.end())
|
if (it == saved_files_.end())
|
||||||
return;
|
return;
|
||||||
std::move(callback).Run();
|
callback.Run();
|
||||||
file_task_runner_->PostTask(
|
file_task_runner_->PostTask(
|
||||||
FROM_HERE, base::BindOnce(&::AppendToFile, it->second, content));
|
FROM_HERE, base::BindOnce(&::AppendToFile, it->second, content));
|
||||||
}
|
}
|
||||||
|
@@ -36,31 +36,31 @@ class CefDevToolsFileManager {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// SaveToFile implementation:
|
// SaveToFile implementation:
|
||||||
typedef base::OnceCallback<void(const std::string&)> SaveCallback;
|
typedef base::Callback<void(const std::string&)> SaveCallback;
|
||||||
typedef base::OnceCallback<void()> CancelCallback;
|
typedef base::Callback<void()> CancelCallback;
|
||||||
void Save(const std::string& url,
|
void Save(const std::string& url,
|
||||||
const std::string& content,
|
const std::string& content,
|
||||||
bool save_as,
|
bool save_as,
|
||||||
SaveCallback saveCallback,
|
const SaveCallback& saveCallback,
|
||||||
CancelCallback cancelCallback);
|
const CancelCallback& cancelCallback);
|
||||||
void SaveAsDialogDismissed(const std::string& url,
|
void SaveAsDialogDismissed(const std::string& url,
|
||||||
const std::string& content,
|
const std::string& content,
|
||||||
SaveCallback saveCallback,
|
const SaveCallback& saveCallback,
|
||||||
CancelCallback cancelCallback,
|
const CancelCallback& cancelCallback,
|
||||||
int selected_accept_filter,
|
int selected_accept_filter,
|
||||||
const std::vector<base::FilePath>& file_paths);
|
const std::vector<base::FilePath>& file_paths);
|
||||||
void SaveAsFileSelected(const std::string& url,
|
void SaveAsFileSelected(const std::string& url,
|
||||||
const std::string& content,
|
const std::string& content,
|
||||||
SaveCallback callback,
|
const SaveCallback& callback,
|
||||||
const base::FilePath& path);
|
const base::FilePath& path);
|
||||||
void FileSavedAs(const std::string& url, const std::string& file_system_path);
|
void FileSavedAs(const std::string& url, const std::string& file_system_path);
|
||||||
void CanceledFileSaveAs(const std::string& url);
|
void CanceledFileSaveAs(const std::string& url);
|
||||||
|
|
||||||
// AppendToFile implementation:
|
// AppendToFile implementation:
|
||||||
typedef base::OnceCallback<void(void)> AppendCallback;
|
typedef base::Callback<void(void)> AppendCallback;
|
||||||
void Append(const std::string& url,
|
void Append(const std::string& url,
|
||||||
const std::string& content,
|
const std::string& content,
|
||||||
AppendCallback callback);
|
const AppendCallback& callback);
|
||||||
void AppendedTo(const std::string& url);
|
void AppendedTo(const std::string& url);
|
||||||
|
|
||||||
void CallClientFunction(const std::string& function_name,
|
void CallClientFunction(const std::string& function_name,
|
||||||
|
@@ -160,7 +160,7 @@ void LogProtocolMessage(const base::FilePath& log_file,
|
|||||||
WriteTimestamp(stream);
|
WriteTimestamp(stream);
|
||||||
stream << ": " << type_label << ": " << to_log << "\n";
|
stream << ": " << type_label << ": " << to_log << "\n";
|
||||||
const std::string& str = stream.str();
|
const std::string& str = stream.str();
|
||||||
if (!base::AppendToFile(log_file, base::StringPiece(str))) {
|
if (!base::AppendToFile(log_file, str.c_str(), str.size())) {
|
||||||
LOG(ERROR) << "Failed to write file " << log_file.value();
|
LOG(ERROR) << "Failed to write file " << log_file.value();
|
||||||
log_error = true;
|
log_error = true;
|
||||||
}
|
}
|
||||||
@@ -294,8 +294,8 @@ void CefDevToolsFrontend::InspectElementAt(int x, int y) {
|
|||||||
|
|
||||||
void CefDevToolsFrontend::Close() {
|
void CefDevToolsFrontend::Close() {
|
||||||
base::PostTask(FROM_HERE, {content::BrowserThread::UI},
|
base::PostTask(FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::BindOnce(&AlloyBrowserHostImpl::CloseBrowser,
|
base::Bind(&AlloyBrowserHostImpl::CloseBrowser,
|
||||||
frontend_browser_.get(), true));
|
frontend_browser_.get(), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
CefDevToolsFrontend::CefDevToolsFrontend(
|
CefDevToolsFrontend::CefDevToolsFrontend(
|
||||||
@@ -323,8 +323,8 @@ void CefDevToolsFrontend::ReadyToCommitNavigation(
|
|||||||
content::RenderFrameHost* frame = navigation_handle->GetRenderFrameHost();
|
content::RenderFrameHost* frame = navigation_handle->GetRenderFrameHost();
|
||||||
if (navigation_handle->IsInMainFrame()) {
|
if (navigation_handle->IsInMainFrame()) {
|
||||||
frontend_host_ = content::DevToolsFrontendHost::Create(
|
frontend_host_ = content::DevToolsFrontendHost::Create(
|
||||||
frame, base::BindRepeating(
|
frame,
|
||||||
&CefDevToolsFrontend::HandleMessageFromDevToolsFrontend,
|
base::Bind(&CefDevToolsFrontend::HandleMessageFromDevToolsFrontend,
|
||||||
base::Unretained(this)));
|
base::Unretained(this)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -338,8 +338,7 @@ void CefDevToolsFrontend::ReadyToCommitNavigation(
|
|||||||
content::DevToolsFrontendHost::SetupExtensionsAPI(frame, script);
|
content::DevToolsFrontendHost::SetupExtensionsAPI(frame, script);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefDevToolsFrontend::DocumentAvailableInMainFrame(
|
void CefDevToolsFrontend::DocumentAvailableInMainFrame() {
|
||||||
content::RenderFrameHost* render_frame_host) {
|
|
||||||
// Don't call AttachClient multiple times for the same DevToolsAgentHost.
|
// Don't call AttachClient multiple times for the same DevToolsAgentHost.
|
||||||
// Otherwise it will call AgentHostClosed which closes the DevTools window.
|
// Otherwise it will call AgentHostClosed which closes the DevTools window.
|
||||||
// This may happen in cases where the DevTools content fails to load.
|
// This may happen in cases where the DevTools content fails to load.
|
||||||
@@ -367,11 +366,13 @@ void CefDevToolsFrontend::WebContentsDestroyed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||||
base::Value message) {
|
const std::string& message) {
|
||||||
std::string method;
|
std::string method;
|
||||||
base::ListValue* params = nullptr;
|
base::ListValue* params = nullptr;
|
||||||
base::DictionaryValue* dict = nullptr;
|
base::DictionaryValue* dict = nullptr;
|
||||||
if (!message.GetAsDictionary(&dict) || !dict->GetString("method", &method)) {
|
base::Optional<base::Value> parsed_message = base::JSONReader::Read(message);
|
||||||
|
if (!parsed_message || !parsed_message->GetAsDictionary(&dict) ||
|
||||||
|
!dict->GetString("method", &method)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int request_id = 0;
|
int request_id = 0;
|
||||||
@@ -389,7 +390,8 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
|||||||
this, base::as_bytes(base::make_span(protocol_message)));
|
this, base::as_bytes(base::make_span(protocol_message)));
|
||||||
} else if (method == "loadCompleted") {
|
} else if (method == "loadCompleted") {
|
||||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
||||||
u"DevToolsAPI.setUseSoftMenu(true);", base::NullCallback());
|
base::ASCIIToUTF16("DevToolsAPI.setUseSoftMenu(true);"),
|
||||||
|
base::NullCallback());
|
||||||
} else if (method == "loadNetworkResource" && params->GetSize() == 3) {
|
} else if (method == "loadNetworkResource" && params->GetSize() == 3) {
|
||||||
// TODO(pfeldman): handle some of the embedder messages in content.
|
// TODO(pfeldman): handle some of the embedder messages in content.
|
||||||
std::string url;
|
std::string url;
|
||||||
@@ -459,8 +461,8 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
|||||||
SendMessageAck(request_id, &response);
|
SendMessageAck(request_id, &response);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
auto* partition =
|
auto* partition = content::BrowserContext::GetStoragePartitionForSite(
|
||||||
web_contents()->GetBrowserContext()->GetStoragePartitionForUrl(gurl);
|
web_contents()->GetBrowserContext(), gurl);
|
||||||
url_loader_factory = partition->GetURLLoaderFactoryForBrowserProcess();
|
url_loader_factory = partition->GetURLLoaderFactoryForBrowserProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -491,7 +493,8 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
|||||||
update.Get()->RemoveWithoutPathExpansion(name, nullptr);
|
update.Get()->RemoveWithoutPathExpansion(name, nullptr);
|
||||||
} else if (method == "requestFileSystems") {
|
} else if (method == "requestFileSystems") {
|
||||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
||||||
u"DevToolsAPI.fileSystemsLoaded([]);", base::NullCallback());
|
base::ASCIIToUTF16("DevToolsAPI.fileSystemsLoaded([]);"),
|
||||||
|
base::NullCallback());
|
||||||
} else if (method == "reattach") {
|
} else if (method == "reattach") {
|
||||||
if (!agent_host_)
|
if (!agent_host_)
|
||||||
return;
|
return;
|
||||||
@@ -549,7 +552,7 @@ void CefDevToolsFrontend::DispatchProtocolMessage(
|
|||||||
std::string param;
|
std::string param;
|
||||||
base::EscapeJSONString(str_message, true, ¶m);
|
base::EscapeJSONString(str_message, true, ¶m);
|
||||||
std::string code = "DevToolsAPI.dispatchMessage(" + param + ");";
|
std::string code = "DevToolsAPI.dispatchMessage(" + param + ");";
|
||||||
std::u16string javascript = base::UTF8ToUTF16(code);
|
base::string16 javascript = base::UTF8ToUTF16(code);
|
||||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
||||||
javascript, base::NullCallback());
|
javascript, base::NullCallback());
|
||||||
return;
|
return;
|
||||||
@@ -563,7 +566,7 @@ void CefDevToolsFrontend::DispatchProtocolMessage(
|
|||||||
¶m);
|
¶m);
|
||||||
std::string code = "DevToolsAPI.dispatchMessageChunk(" + param + "," +
|
std::string code = "DevToolsAPI.dispatchMessageChunk(" + param + "," +
|
||||||
std::to_string(pos ? 0 : total_size) + ");";
|
std::to_string(pos ? 0 : total_size) + ");";
|
||||||
std::u16string javascript = base::UTF8ToUTF16(code);
|
base::string16 javascript = base::UTF8ToUTF16(code);
|
||||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
||||||
javascript, base::NullCallback());
|
javascript, base::NullCallback());
|
||||||
}
|
}
|
||||||
@@ -606,7 +609,7 @@ void CefDevToolsFrontend::LogProtocolMessage(ProtocolMessageType type,
|
|||||||
const base::StringPiece& message) {
|
const base::StringPiece& message) {
|
||||||
DCHECK(ProtocolLoggingEnabled());
|
DCHECK(ProtocolLoggingEnabled());
|
||||||
|
|
||||||
std::string to_log(message.substr(0, kMaxLogLineLength));
|
std::string to_log = message.substr(0, kMaxLogLineLength).as_string();
|
||||||
|
|
||||||
// Execute in an ordered context that allows blocking.
|
// Execute in an ordered context that allows blocking.
|
||||||
auto task_runner = CefTaskRunnerManager::Get()->GetBackgroundTaskRunner();
|
auto task_runner = CefTaskRunnerManager::Get()->GetBackgroundTaskRunner();
|
||||||
|
@@ -70,14 +70,13 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
|
|||||||
void AgentHostClosed(content::DevToolsAgentHost* agent_host) override;
|
void AgentHostClosed(content::DevToolsAgentHost* agent_host) override;
|
||||||
void DispatchProtocolMessage(content::DevToolsAgentHost* agent_host,
|
void DispatchProtocolMessage(content::DevToolsAgentHost* agent_host,
|
||||||
base::span<const uint8_t> message) override;
|
base::span<const uint8_t> message) override;
|
||||||
void HandleMessageFromDevToolsFrontend(base::Value message);
|
void HandleMessageFromDevToolsFrontend(const std::string& message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// WebContentsObserver overrides
|
// WebContentsObserver overrides
|
||||||
void ReadyToCommitNavigation(
|
void ReadyToCommitNavigation(
|
||||||
content::NavigationHandle* navigation_handle) override;
|
content::NavigationHandle* navigation_handle) override;
|
||||||
void DocumentAvailableInMainFrame(
|
void DocumentAvailableInMainFrame() override;
|
||||||
content::RenderFrameHost* render_frame_host) override;
|
|
||||||
void WebContentsDestroyed() override;
|
void WebContentsDestroyed() override;
|
||||||
|
|
||||||
void SendMessageAck(int request_id, const base::Value* arg1);
|
void SendMessageAck(int request_id, const base::Value* arg1);
|
||||||
|
@@ -62,7 +62,7 @@ class CefDevToolsRegistrationImpl : public CefRegistration,
|
|||||||
void OnDevToolsEvent(const base::StringPiece& method,
|
void OnDevToolsEvent(const base::StringPiece& method,
|
||||||
const base::StringPiece& params) override {
|
const base::StringPiece& params) override {
|
||||||
CEF_REQUIRE_UIT();
|
CEF_REQUIRE_UIT();
|
||||||
observer_->OnDevToolsEvent(browser_, std::string(method), params.data(),
|
observer_->OnDevToolsEvent(browser_, method.as_string(), params.data(),
|
||||||
params.size());
|
params.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -83,7 +83,7 @@ TEST(DevToolsUtil, ProtocolParser_Initialize_IsEvent) {
|
|||||||
EXPECT_TRUE(parser.Initialize(message));
|
EXPECT_TRUE(parser.Initialize(message));
|
||||||
EXPECT_TRUE(parser.IsInitialized());
|
EXPECT_TRUE(parser.IsInitialized());
|
||||||
EXPECT_TRUE(parser.IsEvent());
|
EXPECT_TRUE(parser.IsEvent());
|
||||||
EXPECT_STREQ("Test.myMethod", parser.method_.data());
|
EXPECT_STREQ("Test.myMethod", parser.method_.as_string().data());
|
||||||
EXPECT_TRUE(parser.params_.empty());
|
EXPECT_TRUE(parser.params_.empty());
|
||||||
|
|
||||||
parser.Reset();
|
parser.Reset();
|
||||||
@@ -94,8 +94,8 @@ TEST(DevToolsUtil, ProtocolParser_Initialize_IsEvent) {
|
|||||||
EXPECT_TRUE(parser.Initialize(message));
|
EXPECT_TRUE(parser.Initialize(message));
|
||||||
EXPECT_TRUE(parser.IsInitialized());
|
EXPECT_TRUE(parser.IsInitialized());
|
||||||
EXPECT_TRUE(parser.IsEvent());
|
EXPECT_TRUE(parser.IsEvent());
|
||||||
EXPECT_STREQ("Test.myMethod2", parser.method_.data());
|
EXPECT_STREQ("Test.myMethod2", parser.method_.as_string().data());
|
||||||
EXPECT_STREQ("{}", parser.params_.data());
|
EXPECT_STREQ("{}", parser.params_.as_string().data());
|
||||||
|
|
||||||
parser.Reset();
|
parser.Reset();
|
||||||
EXPECT_FALSE(parser.IsInitialized());
|
EXPECT_FALSE(parser.IsInitialized());
|
||||||
@@ -105,8 +105,8 @@ TEST(DevToolsUtil, ProtocolParser_Initialize_IsEvent) {
|
|||||||
EXPECT_TRUE(parser.Initialize(message));
|
EXPECT_TRUE(parser.Initialize(message));
|
||||||
EXPECT_TRUE(parser.IsInitialized());
|
EXPECT_TRUE(parser.IsInitialized());
|
||||||
EXPECT_TRUE(parser.IsEvent());
|
EXPECT_TRUE(parser.IsEvent());
|
||||||
EXPECT_STREQ("Test.myMethod3", parser.method_.data());
|
EXPECT_STREQ("Test.myMethod3", parser.method_.as_string().data());
|
||||||
EXPECT_STREQ("{\"foo\":\"bar\"}", parser.params_.data());
|
EXPECT_STREQ("{\"foo\":\"bar\"}", parser.params_.as_string().data());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DevToolsUtil, ProtocolParser_Initialize_IsFailure_ResultMalformed) {
|
TEST(DevToolsUtil, ProtocolParser_Initialize_IsFailure_ResultMalformed) {
|
||||||
@@ -162,7 +162,7 @@ TEST(DevToolsUtil, ProtocolParser_Initialize_IsResult_Result) {
|
|||||||
EXPECT_TRUE(parser.IsResult());
|
EXPECT_TRUE(parser.IsResult());
|
||||||
EXPECT_EQ(1, parser.message_id_);
|
EXPECT_EQ(1, parser.message_id_);
|
||||||
EXPECT_TRUE(parser.success_);
|
EXPECT_TRUE(parser.success_);
|
||||||
EXPECT_STREQ("{}", parser.params_.data());
|
EXPECT_STREQ("{}", parser.params_.as_string().data());
|
||||||
|
|
||||||
parser.Reset();
|
parser.Reset();
|
||||||
EXPECT_FALSE(parser.IsInitialized());
|
EXPECT_FALSE(parser.IsInitialized());
|
||||||
@@ -174,7 +174,7 @@ TEST(DevToolsUtil, ProtocolParser_Initialize_IsResult_Result) {
|
|||||||
EXPECT_TRUE(parser.IsResult());
|
EXPECT_TRUE(parser.IsResult());
|
||||||
EXPECT_EQ(2, parser.message_id_);
|
EXPECT_EQ(2, parser.message_id_);
|
||||||
EXPECT_TRUE(parser.success_);
|
EXPECT_TRUE(parser.success_);
|
||||||
EXPECT_STREQ("{\"foo\":\"bar\"}", parser.params_.data());
|
EXPECT_STREQ("{\"foo\":\"bar\"}", parser.params_.as_string().data());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DevToolsUtil, ProtocolParser_Initialize_IsResult_Error) {
|
TEST(DevToolsUtil, ProtocolParser_Initialize_IsResult_Error) {
|
||||||
@@ -188,7 +188,7 @@ TEST(DevToolsUtil, ProtocolParser_Initialize_IsResult_Error) {
|
|||||||
EXPECT_TRUE(parser.IsResult());
|
EXPECT_TRUE(parser.IsResult());
|
||||||
EXPECT_EQ(1, parser.message_id_);
|
EXPECT_EQ(1, parser.message_id_);
|
||||||
EXPECT_FALSE(parser.success_);
|
EXPECT_FALSE(parser.success_);
|
||||||
EXPECT_STREQ("{}", parser.params_.data());
|
EXPECT_STREQ("{}", parser.params_.as_string().data());
|
||||||
|
|
||||||
parser.Reset();
|
parser.Reset();
|
||||||
EXPECT_FALSE(parser.IsInitialized());
|
EXPECT_FALSE(parser.IsInitialized());
|
||||||
@@ -200,5 +200,5 @@ TEST(DevToolsUtil, ProtocolParser_Initialize_IsResult_Error) {
|
|||||||
EXPECT_TRUE(parser.IsResult());
|
EXPECT_TRUE(parser.IsResult());
|
||||||
EXPECT_EQ(2, parser.message_id_);
|
EXPECT_EQ(2, parser.message_id_);
|
||||||
EXPECT_FALSE(parser.success_);
|
EXPECT_FALSE(parser.success_);
|
||||||
EXPECT_STREQ("{\"foo\":\"bar\"}", parser.params_.data());
|
EXPECT_STREQ("{\"foo\":\"bar\"}", parser.params_.as_string().data());
|
||||||
}
|
}
|
||||||
|
@@ -153,7 +153,7 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
|||||||
suggested_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
suggested_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
||||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||||
download::DownloadItem::MixedContentStatus::UNKNOWN, suggested_path,
|
download::DownloadItem::MixedContentStatus::UNKNOWN, suggested_path,
|
||||||
absl::nullopt /*download_schedule*/,
|
base::nullopt /*download_schedule*/,
|
||||||
download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -172,7 +172,7 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
|||||||
std::move(callback).Run(path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
std::move(callback).Run(path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
||||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||||
download::DownloadItem::MixedContentStatus::UNKNOWN,
|
download::DownloadItem::MixedContentStatus::UNKNOWN,
|
||||||
path, absl::nullopt /*download_schedule*/,
|
path, base::nullopt /*download_schedule*/,
|
||||||
download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,17 +195,17 @@ class CefDownloadItemCallbackImpl : public CefDownloadItemCallback {
|
|||||||
|
|
||||||
void Cancel() override {
|
void Cancel() override {
|
||||||
CEF_POST_TASK(CEF_UIT,
|
CEF_POST_TASK(CEF_UIT,
|
||||||
base::BindOnce(&CefDownloadItemCallbackImpl::DoCancel, this));
|
base::Bind(&CefDownloadItemCallbackImpl::DoCancel, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pause() override {
|
void Pause() override {
|
||||||
CEF_POST_TASK(CEF_UIT,
|
CEF_POST_TASK(CEF_UIT,
|
||||||
base::BindOnce(&CefDownloadItemCallbackImpl::DoPause, this));
|
base::Bind(&CefDownloadItemCallbackImpl::DoPause, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Resume() override {
|
void Resume() override {
|
||||||
CEF_POST_TASK(CEF_UIT,
|
CEF_POST_TASK(CEF_UIT,
|
||||||
base::BindOnce(&CefDownloadItemCallbackImpl::DoResume, this));
|
base::Bind(&CefDownloadItemCallbackImpl::DoResume, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -289,7 +289,7 @@ void CefDownloadManagerDelegate::OnDownloadUpdated(DownloadItem* download) {
|
|||||||
|
|
||||||
handler->OnDownloadUpdated(browser.get(), download_item.get(), callback);
|
handler->OnDownloadUpdated(browser.get(), download_item.get(), callback);
|
||||||
|
|
||||||
ignore_result(download_item->Detach(nullptr));
|
download_item->Detach(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -358,7 +358,7 @@ bool CefDownloadManagerDelegate::DetermineDownloadTarget(
|
|||||||
item->GetForcedFilePath(), DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
item->GetForcedFilePath(), DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
||||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||||
download::DownloadItem::MixedContentStatus::UNKNOWN,
|
download::DownloadItem::MixedContentStatus::UNKNOWN,
|
||||||
item->GetForcedFilePath(), absl::nullopt /*download_schedule*/,
|
item->GetForcedFilePath(), base::nullopt /*download_schedule*/,
|
||||||
download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -384,7 +384,7 @@ bool CefDownloadManagerDelegate::DetermineDownloadTarget(
|
|||||||
handler->OnBeforeDownload(browser.get(), download_item.get(),
|
handler->OnBeforeDownload(browser.get(), download_item.get(),
|
||||||
suggested_name.value(), callbackObj);
|
suggested_name.value(), callbackObj);
|
||||||
|
|
||||||
ignore_result(download_item->Detach(nullptr));
|
download_item->Detach(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@@ -1,20 +0,0 @@
|
|||||||
// Copyright 2021 The Chromium Embedded Framework Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style license that can be found
|
|
||||||
// in the LICENSE file.
|
|
||||||
|
|
||||||
#include "libcef/browser/extensions/alloy_extensions_util.h"
|
|
||||||
|
|
||||||
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
|
|
||||||
|
|
||||||
namespace extensions {
|
|
||||||
namespace alloy {
|
|
||||||
|
|
||||||
int GetTabIdForWebContents(content::WebContents* web_contents) {
|
|
||||||
auto browser = AlloyBrowserHostImpl::GetBrowserForContents(web_contents);
|
|
||||||
if (!browser)
|
|
||||||
return -1;
|
|
||||||
return browser->GetIdentifier();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace alloy
|
|
||||||
} // namespace extensions
|
|
@@ -1,21 +0,0 @@
|
|||||||
// Copyright 2021 The Chromium Embedded Framework Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style license that can be found
|
|
||||||
// in the LICENSE file.
|
|
||||||
|
|
||||||
#ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_ALLOY_EXTENSIONS_UTIL_H_
|
|
||||||
#define CEF_LIBCEF_BROWSER_EXTENSIONS_ALLOY_EXTENSIONS_UTIL_H_
|
|
||||||
|
|
||||||
namespace content {
|
|
||||||
class WebContents;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace extensions {
|
|
||||||
namespace alloy {
|
|
||||||
|
|
||||||
// Returns the tabId for |web_contents|, or -1 if not found.
|
|
||||||
int GetTabIdForWebContents(content::WebContents* web_contents);
|
|
||||||
|
|
||||||
} // namespace alloy
|
|
||||||
} // namespace extensions
|
|
||||||
|
|
||||||
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_ALLOY_EXTENSIONS_UTIL_H_
|
|
@@ -56,7 +56,7 @@ void SyncValueStoreCache::RunWithValueStoreForExtension(
|
|||||||
// A neat way to implement unlimited storage; if the extension has the
|
// A neat way to implement unlimited storage; if the extension has the
|
||||||
// unlimited storage permission, force through all calls to Set().
|
// unlimited storage permission, force through all calls to Set().
|
||||||
if (extension->permissions_data()->HasAPIPermission(
|
if (extension->permissions_data()->HasAPIPermission(
|
||||||
mojom::APIPermissionID::kUnlimitedStorage)) {
|
APIPermission::kUnlimitedStorage)) {
|
||||||
WeakUnlimitedSettingsStorage unlimited_storage(storage);
|
WeakUnlimitedSettingsStorage unlimited_storage(storage);
|
||||||
std::move(callback).Run(&unlimited_storage);
|
std::move(callback).Run(&unlimited_storage);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -6,15 +6,10 @@
|
|||||||
|
|
||||||
#include "libcef/browser/extensions/extension_web_contents_observer.h"
|
#include "libcef/browser/extensions/extension_web_contents_observer.h"
|
||||||
|
|
||||||
#include "base/notreached.h"
|
|
||||||
#include "base/strings/string_number_conversions.h"
|
#include "base/strings/string_number_conversions.h"
|
||||||
#include "chrome/browser/extensions/api/tabs/tabs_constants.h"
|
#include "chrome/browser/extensions/api/tabs/tabs_constants.h"
|
||||||
#include "chrome/browser/extensions/extension_tab_util.h"
|
|
||||||
#include "components/zoom/zoom_controller.h"
|
#include "components/zoom/zoom_controller.h"
|
||||||
#include "content/public/browser/navigation_controller.h"
|
|
||||||
#include "content/public/browser/navigation_entry.h"
|
|
||||||
#include "content/public/browser/render_frame_host.h"
|
#include "content/public/browser/render_frame_host.h"
|
||||||
#include "content/public/browser/site_instance.h"
|
|
||||||
#include "extensions/browser/extension_api_frame_id_map.h"
|
#include "extensions/browser/extension_api_frame_id_map.h"
|
||||||
#include "extensions/browser/extension_zoom_request_client.h"
|
#include "extensions/browser/extension_zoom_request_client.h"
|
||||||
#include "extensions/common/error_utils.h"
|
#include "extensions/common/error_utils.h"
|
||||||
@@ -22,8 +17,6 @@
|
|||||||
#include "extensions/common/permissions/permissions_data.h"
|
#include "extensions/common/permissions/permissions_data.h"
|
||||||
#include "third_party/blink/public/common/page/page_zoom.h"
|
#include "third_party/blink/public/common/page/page_zoom.h"
|
||||||
|
|
||||||
using zoom::ZoomController;
|
|
||||||
|
|
||||||
namespace extensions {
|
namespace extensions {
|
||||||
namespace cef {
|
namespace cef {
|
||||||
|
|
||||||
@@ -104,148 +97,6 @@ ExtensionFunction::ResponseAction TabsCreateFunction::Run() {
|
|||||||
: NoArguments());
|
: NoArguments());
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseAPIFunction::BaseAPIFunction() : cef_details_(this) {}
|
|
||||||
|
|
||||||
content::WebContents* BaseAPIFunction::GetWebContents(int tab_id) {
|
|
||||||
// Find a browser that we can access, or set |error_| and return nullptr.
|
|
||||||
CefRefPtr<AlloyBrowserHostImpl> browser =
|
|
||||||
cef_details_.GetBrowserForTabIdFirstTime(tab_id, &error_);
|
|
||||||
if (!browser)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
return browser->web_contents();
|
|
||||||
}
|
|
||||||
|
|
||||||
ExtensionFunction::ResponseAction TabsUpdateFunction::Run() {
|
|
||||||
std::unique_ptr<tabs::Update::Params> params(
|
|
||||||
tabs::Update::Params::Create(*args_));
|
|
||||||
EXTENSION_FUNCTION_VALIDATE(params.get());
|
|
||||||
|
|
||||||
tab_id_ = params->tab_id ? *params->tab_id : -1;
|
|
||||||
content::WebContents* web_contents = GetWebContents(tab_id_);
|
|
||||||
if (!web_contents)
|
|
||||||
return RespondNow(Error(std::move(error_)));
|
|
||||||
|
|
||||||
web_contents_ = web_contents;
|
|
||||||
|
|
||||||
// TODO(rafaelw): handle setting remaining tab properties:
|
|
||||||
// -title
|
|
||||||
// -favIconUrl
|
|
||||||
|
|
||||||
// Navigate the tab to a new location if the url is different.
|
|
||||||
if (params->update_properties.url.get()) {
|
|
||||||
std::string updated_url = *params->update_properties.url;
|
|
||||||
if (!UpdateURL(updated_url, tab_id_, &error_))
|
|
||||||
return RespondNow(Error(std::move(error_)));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool active = false;
|
|
||||||
// TODO(rafaelw): Setting |active| from js doesn't make much sense.
|
|
||||||
// Move tab selection management up to window.
|
|
||||||
if (params->update_properties.selected.get())
|
|
||||||
active = *params->update_properties.selected;
|
|
||||||
|
|
||||||
// The 'active' property has replaced 'selected'.
|
|
||||||
if (params->update_properties.active.get())
|
|
||||||
active = *params->update_properties.active;
|
|
||||||
|
|
||||||
if (active) {
|
|
||||||
// TODO: Activate the tab at |tab_id_|.
|
|
||||||
NOTIMPLEMENTED();
|
|
||||||
return RespondNow(Error(tabs_constants::kTabStripNotEditableError));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params->update_properties.highlighted.get() &&
|
|
||||||
*params->update_properties.highlighted) {
|
|
||||||
// TODO: Highlight the tab at |tab_id_|.
|
|
||||||
NOTIMPLEMENTED();
|
|
||||||
return RespondNow(Error(tabs_constants::kTabStripNotEditableError));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params->update_properties.pinned.get() &&
|
|
||||||
*params->update_properties.pinned) {
|
|
||||||
// TODO: Pin the tab at |tab_id_|.
|
|
||||||
NOTIMPLEMENTED();
|
|
||||||
return RespondNow(Error(tabs_constants::kTabStripNotEditableError));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params->update_properties.muted.get()) {
|
|
||||||
// TODO: Mute/unmute the tab at |tab_id_|.
|
|
||||||
NOTIMPLEMENTED();
|
|
||||||
return RespondNow(Error(ErrorUtils::FormatErrorMessage(
|
|
||||||
tabs_constants::kCannotUpdateMuteCaptured,
|
|
||||||
base::NumberToString(tab_id_))));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params->update_properties.opener_tab_id.get()) {
|
|
||||||
int opener_id = *params->update_properties.opener_tab_id;
|
|
||||||
if (opener_id == tab_id_)
|
|
||||||
return RespondNow(Error("Cannot set a tab's opener to itself."));
|
|
||||||
|
|
||||||
// TODO: Set the opener for the tab at |tab_id_|.
|
|
||||||
NOTIMPLEMENTED();
|
|
||||||
return RespondNow(Error(tabs_constants::kTabStripNotEditableError));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params->update_properties.auto_discardable.get()) {
|
|
||||||
// TODO: Set auto-discardable state for the tab at |tab_id_|.
|
|
||||||
NOTIMPLEMENTED();
|
|
||||||
}
|
|
||||||
|
|
||||||
return RespondNow(GetResult());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TabsUpdateFunction::UpdateURL(const std::string& url_string,
|
|
||||||
int tab_id,
|
|
||||||
std::string* error) {
|
|
||||||
GURL url;
|
|
||||||
if (!ExtensionTabUtil::PrepareURLForNavigation(url_string, extension(), &url,
|
|
||||||
error)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool is_javascript_scheme = url.SchemeIs(url::kJavaScriptScheme);
|
|
||||||
// JavaScript URLs are forbidden in chrome.tabs.update().
|
|
||||||
if (is_javascript_scheme) {
|
|
||||||
*error = tabs_constants::kJavaScriptUrlsNotAllowedInTabsUpdate;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
content::NavigationController::LoadURLParams load_params(url);
|
|
||||||
|
|
||||||
// Treat extension-initiated navigations as renderer-initiated so that the URL
|
|
||||||
// does not show in the omnibox until it commits. This avoids URL spoofs
|
|
||||||
// since URLs can be opened on behalf of untrusted content.
|
|
||||||
load_params.is_renderer_initiated = true;
|
|
||||||
// All renderer-initiated navigations need to have an initiator origin.
|
|
||||||
load_params.initiator_origin = extension()->origin();
|
|
||||||
// |source_site_instance| needs to be set so that a renderer process
|
|
||||||
// compatible with |initiator_origin| is picked by Site Isolation.
|
|
||||||
load_params.source_site_instance = content::SiteInstance::CreateForURL(
|
|
||||||
web_contents_->GetBrowserContext(),
|
|
||||||
load_params.initiator_origin->GetURL());
|
|
||||||
|
|
||||||
// Marking the navigation as initiated via an API means that the focus
|
|
||||||
// will stay in the omnibox - see https://crbug.com/1085779.
|
|
||||||
load_params.transition_type = ui::PAGE_TRANSITION_FROM_API;
|
|
||||||
|
|
||||||
web_contents_->GetController().LoadURLWithParams(load_params);
|
|
||||||
|
|
||||||
DCHECK_EQ(url,
|
|
||||||
web_contents_->GetController().GetPendingEntry()->GetVirtualURL());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
ExtensionFunction::ResponseValue TabsUpdateFunction::GetResult() {
|
|
||||||
if (!has_callback())
|
|
||||||
return NoArguments();
|
|
||||||
|
|
||||||
return ArgumentList(tabs::Get::Results::Create(*cef_details_.CreateTabObject(
|
|
||||||
AlloyBrowserHostImpl::GetBrowserForContents(web_contents_),
|
|
||||||
/*opener_browser_id=*/-1, /*active=*/true, tab_id_)));
|
|
||||||
}
|
|
||||||
|
|
||||||
ExecuteCodeInTabFunction::ExecuteCodeInTabFunction()
|
ExecuteCodeInTabFunction::ExecuteCodeInTabFunction()
|
||||||
: cef_details_(this), execute_tab_id_(-1) {}
|
: cef_details_(this), execute_tab_id_(-1) {}
|
||||||
|
|
||||||
@@ -277,8 +128,7 @@ ExecuteCodeFunction::InitResult ExecuteCodeInTabFunction::Init() {
|
|||||||
|
|
||||||
execute_tab_id_ = browser->GetIdentifier();
|
execute_tab_id_ = browser->GetIdentifier();
|
||||||
details_ = std::move(details);
|
details_ = std::move(details);
|
||||||
set_host_id(
|
set_host_id(HostID(HostID::EXTENSIONS, extension()->id()));
|
||||||
mojom::HostID(mojom::HostID::HostType::kExtensions, extension()->id()));
|
|
||||||
return set_init_result(SUCCESS);
|
return set_init_result(SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,7 +182,7 @@ bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage(std::string* error) {
|
|||||||
execute_tab_id_, error)) {
|
execute_tab_id_, error)) {
|
||||||
if (is_about_url &&
|
if (is_about_url &&
|
||||||
extension()->permissions_data()->active_permissions().HasAPIPermission(
|
extension()->permissions_data()->active_permissions().HasAPIPermission(
|
||||||
mojom::APIPermissionID::kTab)) {
|
APIPermission::kTab)) {
|
||||||
*error = ErrorUtils::FormatErrorMessage(
|
*error = ErrorUtils::FormatErrorMessage(
|
||||||
manifest_errors::kCannotAccessAboutUrl,
|
manifest_errors::kCannotAccessAboutUrl,
|
||||||
rfh->GetLastCommittedURL().spec(),
|
rfh->GetLastCommittedURL().spec(),
|
||||||
@@ -393,124 +243,165 @@ bool TabsRemoveCSSFunction::ShouldRemoveCSS() const {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtensionFunction::ResponseAction TabsSetZoomFunction::Run() {
|
ZoomAPIFunction::ZoomAPIFunction() : cef_details_(this) {}
|
||||||
|
|
||||||
|
content::WebContents* ZoomAPIFunction::GetWebContents(int tab_id) {
|
||||||
|
// Find a browser that we can access, or set |error_| and return nullptr.
|
||||||
|
CefRefPtr<AlloyBrowserHostImpl> browser =
|
||||||
|
cef_details_.GetBrowserForTabIdFirstTime(tab_id, &error_);
|
||||||
|
if (!browser)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
return browser->web_contents();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZoomAPIFunction::SendResponse(bool success) {
|
||||||
|
ResponseValue response;
|
||||||
|
if (success) {
|
||||||
|
response = ArgumentList(std::move(results_));
|
||||||
|
} else {
|
||||||
|
response = results_ ? ErrorWithArguments(std::move(results_), error_)
|
||||||
|
: Error(error_);
|
||||||
|
}
|
||||||
|
Respond(std::move(response));
|
||||||
|
}
|
||||||
|
|
||||||
|
ExtensionFunction::ResponseAction ZoomAPIFunction::Run() {
|
||||||
|
if (RunAsync())
|
||||||
|
return RespondLater();
|
||||||
|
// TODO(devlin): Track these down and eliminate them if possible. We
|
||||||
|
// shouldn't return results and an error.
|
||||||
|
if (results_)
|
||||||
|
return RespondNow(ErrorWithArguments(std::move(results_), error_));
|
||||||
|
return RespondNow(Error(error_));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TabsSetZoomFunction::RunAsync() {
|
||||||
std::unique_ptr<tabs::SetZoom::Params> params(
|
std::unique_ptr<tabs::SetZoom::Params> params(
|
||||||
tabs::SetZoom::Params::Create(*args_));
|
tabs::SetZoom::Params::Create(*args_));
|
||||||
EXTENSION_FUNCTION_VALIDATE(params);
|
EXTENSION_FUNCTION_PRERUN_VALIDATE(params);
|
||||||
|
|
||||||
int tab_id = params->tab_id ? *params->tab_id : -1;
|
int tab_id = params->tab_id ? *params->tab_id : -1;
|
||||||
content::WebContents* web_contents = GetWebContents(tab_id);
|
content::WebContents* web_contents = GetWebContents(tab_id);
|
||||||
if (!web_contents)
|
if (!web_contents)
|
||||||
return RespondNow(Error(std::move(error_)));
|
return false;
|
||||||
|
|
||||||
GURL url(web_contents->GetVisibleURL());
|
GURL url(web_contents->GetVisibleURL());
|
||||||
if (extension()->permissions_data()->IsRestrictedUrl(url, &error_))
|
if (extension()->permissions_data()->IsRestrictedUrl(url, &error_))
|
||||||
return RespondNow(Error(std::move(error_)));
|
return false;
|
||||||
|
|
||||||
ZoomController* zoom_controller =
|
zoom::ZoomController* zoom_controller =
|
||||||
ZoomController::FromWebContents(web_contents);
|
zoom::ZoomController::FromWebContents(web_contents);
|
||||||
double zoom_level =
|
double zoom_level =
|
||||||
params->zoom_factor > 0
|
params->zoom_factor > 0
|
||||||
? blink::PageZoomFactorToZoomLevel(params->zoom_factor)
|
? blink::PageZoomFactorToZoomLevel(params->zoom_factor)
|
||||||
: zoom_controller->GetDefaultZoomLevel();
|
: zoom_controller->GetDefaultZoomLevel();
|
||||||
|
|
||||||
auto client = base::MakeRefCounted<ExtensionZoomRequestClient>(extension());
|
scoped_refptr<extensions::ExtensionZoomRequestClient> client(
|
||||||
|
new extensions::ExtensionZoomRequestClient(extension()));
|
||||||
if (!zoom_controller->SetZoomLevelByClient(zoom_level, client)) {
|
if (!zoom_controller->SetZoomLevelByClient(zoom_level, client)) {
|
||||||
// Tried to zoom a tab in disabled mode.
|
// Tried to zoom a tab in disabled mode.
|
||||||
return RespondNow(Error(tabs_constants::kCannotZoomDisabledTabError));
|
error_ = keys::kCannotZoomDisabledTabError;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RespondNow(NoArguments());
|
SendResponse(true);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtensionFunction::ResponseAction TabsGetZoomFunction::Run() {
|
bool TabsGetZoomFunction::RunAsync() {
|
||||||
std::unique_ptr<tabs::GetZoom::Params> params(
|
std::unique_ptr<tabs::GetZoom::Params> params(
|
||||||
tabs::GetZoom::Params::Create(*args_));
|
tabs::GetZoom::Params::Create(*args_));
|
||||||
EXTENSION_FUNCTION_VALIDATE(params);
|
EXTENSION_FUNCTION_PRERUN_VALIDATE(params);
|
||||||
|
|
||||||
int tab_id = params->tab_id ? *params->tab_id : -1;
|
int tab_id = params->tab_id ? *params->tab_id : -1;
|
||||||
content::WebContents* web_contents = GetWebContents(tab_id);
|
content::WebContents* web_contents = GetWebContents(tab_id);
|
||||||
if (!web_contents)
|
if (!web_contents)
|
||||||
return RespondNow(Error(std::move(error_)));
|
return false;
|
||||||
|
|
||||||
double zoom_level =
|
double zoom_level =
|
||||||
zoom::ZoomController::FromWebContents(web_contents)->GetZoomLevel();
|
zoom::ZoomController::FromWebContents(web_contents)->GetZoomLevel();
|
||||||
double zoom_factor = blink::PageZoomLevelToZoomFactor(zoom_level);
|
double zoom_factor = blink::PageZoomLevelToZoomFactor(zoom_level);
|
||||||
|
results_ = tabs::GetZoom::Results::Create(zoom_factor);
|
||||||
return RespondNow(ArgumentList(tabs::GetZoom::Results::Create(zoom_factor)));
|
SendResponse(true);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtensionFunction::ResponseAction TabsSetZoomSettingsFunction::Run() {
|
bool TabsSetZoomSettingsFunction::RunAsync() {
|
||||||
using api::tabs::ZoomSettings;
|
using api::tabs::ZoomSettings;
|
||||||
|
|
||||||
std::unique_ptr<tabs::SetZoomSettings::Params> params(
|
std::unique_ptr<tabs::SetZoomSettings::Params> params(
|
||||||
tabs::SetZoomSettings::Params::Create(*args_));
|
tabs::SetZoomSettings::Params::Create(*args_));
|
||||||
EXTENSION_FUNCTION_VALIDATE(params);
|
EXTENSION_FUNCTION_PRERUN_VALIDATE(params);
|
||||||
|
|
||||||
int tab_id = params->tab_id ? *params->tab_id : -1;
|
int tab_id = params->tab_id ? *params->tab_id : -1;
|
||||||
content::WebContents* web_contents = GetWebContents(tab_id);
|
content::WebContents* web_contents = GetWebContents(tab_id);
|
||||||
if (!web_contents)
|
if (!web_contents)
|
||||||
return RespondNow(Error(std::move(error_)));
|
return false;
|
||||||
|
|
||||||
GURL url(web_contents->GetVisibleURL());
|
GURL url(web_contents->GetVisibleURL());
|
||||||
std::string error;
|
|
||||||
if (extension()->permissions_data()->IsRestrictedUrl(url, &error_))
|
if (extension()->permissions_data()->IsRestrictedUrl(url, &error_))
|
||||||
return RespondNow(Error(std::move(error_)));
|
return false;
|
||||||
|
|
||||||
// "per-origin" scope is only available in "automatic" mode.
|
// "per-origin" scope is only available in "automatic" mode.
|
||||||
if (params->zoom_settings.scope == tabs::ZOOM_SETTINGS_SCOPE_PER_ORIGIN &&
|
if (params->zoom_settings.scope == tabs::ZOOM_SETTINGS_SCOPE_PER_ORIGIN &&
|
||||||
params->zoom_settings.mode != tabs::ZOOM_SETTINGS_MODE_AUTOMATIC &&
|
params->zoom_settings.mode != tabs::ZOOM_SETTINGS_MODE_AUTOMATIC &&
|
||||||
params->zoom_settings.mode != tabs::ZOOM_SETTINGS_MODE_NONE) {
|
params->zoom_settings.mode != tabs::ZOOM_SETTINGS_MODE_NONE) {
|
||||||
return RespondNow(Error(tabs_constants::kPerOriginOnlyInAutomaticError));
|
error_ = keys::kPerOriginOnlyInAutomaticError;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine the correct internal zoom mode to set |web_contents| to from the
|
// Determine the correct internal zoom mode to set |web_contents| to from the
|
||||||
// user-specified |zoom_settings|.
|
// user-specified |zoom_settings|.
|
||||||
ZoomController::ZoomMode zoom_mode = ZoomController::ZOOM_MODE_DEFAULT;
|
zoom::ZoomController::ZoomMode zoom_mode =
|
||||||
|
zoom::ZoomController::ZOOM_MODE_DEFAULT;
|
||||||
switch (params->zoom_settings.mode) {
|
switch (params->zoom_settings.mode) {
|
||||||
case tabs::ZOOM_SETTINGS_MODE_NONE:
|
case tabs::ZOOM_SETTINGS_MODE_NONE:
|
||||||
case tabs::ZOOM_SETTINGS_MODE_AUTOMATIC:
|
case tabs::ZOOM_SETTINGS_MODE_AUTOMATIC:
|
||||||
switch (params->zoom_settings.scope) {
|
switch (params->zoom_settings.scope) {
|
||||||
case tabs::ZOOM_SETTINGS_SCOPE_NONE:
|
case tabs::ZOOM_SETTINGS_SCOPE_NONE:
|
||||||
case tabs::ZOOM_SETTINGS_SCOPE_PER_ORIGIN:
|
case tabs::ZOOM_SETTINGS_SCOPE_PER_ORIGIN:
|
||||||
zoom_mode = ZoomController::ZOOM_MODE_DEFAULT;
|
zoom_mode = zoom::ZoomController::ZOOM_MODE_DEFAULT;
|
||||||
break;
|
break;
|
||||||
case tabs::ZOOM_SETTINGS_SCOPE_PER_TAB:
|
case tabs::ZOOM_SETTINGS_SCOPE_PER_TAB:
|
||||||
zoom_mode = ZoomController::ZOOM_MODE_ISOLATED;
|
zoom_mode = zoom::ZoomController::ZOOM_MODE_ISOLATED;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case tabs::ZOOM_SETTINGS_MODE_MANUAL:
|
case tabs::ZOOM_SETTINGS_MODE_MANUAL:
|
||||||
zoom_mode = ZoomController::ZOOM_MODE_MANUAL;
|
zoom_mode = zoom::ZoomController::ZOOM_MODE_MANUAL;
|
||||||
break;
|
break;
|
||||||
case tabs::ZOOM_SETTINGS_MODE_DISABLED:
|
case tabs::ZOOM_SETTINGS_MODE_DISABLED:
|
||||||
zoom_mode = ZoomController::ZOOM_MODE_DISABLED;
|
zoom_mode = zoom::ZoomController::ZOOM_MODE_DISABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZoomController::FromWebContents(web_contents)->SetZoomMode(zoom_mode);
|
zoom::ZoomController::FromWebContents(web_contents)->SetZoomMode(zoom_mode);
|
||||||
|
|
||||||
return RespondNow(NoArguments());
|
SendResponse(true);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtensionFunction::ResponseAction TabsGetZoomSettingsFunction::Run() {
|
bool TabsGetZoomSettingsFunction::RunAsync() {
|
||||||
std::unique_ptr<tabs::GetZoomSettings::Params> params(
|
std::unique_ptr<tabs::GetZoomSettings::Params> params(
|
||||||
tabs::GetZoomSettings::Params::Create(*args_));
|
tabs::GetZoomSettings::Params::Create(*args_));
|
||||||
EXTENSION_FUNCTION_VALIDATE(params);
|
EXTENSION_FUNCTION_PRERUN_VALIDATE(params);
|
||||||
|
|
||||||
int tab_id = params->tab_id ? *params->tab_id : -1;
|
int tab_id = params->tab_id ? *params->tab_id : -1;
|
||||||
content::WebContents* web_contents = GetWebContents(tab_id);
|
content::WebContents* web_contents = GetWebContents(tab_id);
|
||||||
if (!web_contents)
|
if (!web_contents)
|
||||||
return RespondNow(Error(std::move(error_)));
|
return false;
|
||||||
ZoomController* zoom_controller =
|
zoom::ZoomController* zoom_controller =
|
||||||
ZoomController::FromWebContents(web_contents);
|
zoom::ZoomController::FromWebContents(web_contents);
|
||||||
|
|
||||||
ZoomController::ZoomMode zoom_mode = zoom_controller->zoom_mode();
|
zoom::ZoomController::ZoomMode zoom_mode = zoom_controller->zoom_mode();
|
||||||
api::tabs::ZoomSettings zoom_settings;
|
api::tabs::ZoomSettings zoom_settings;
|
||||||
ZoomModeToZoomSettings(zoom_mode, &zoom_settings);
|
ZoomModeToZoomSettings(zoom_mode, &zoom_settings);
|
||||||
zoom_settings.default_zoom_factor = std::make_unique<double>(
|
zoom_settings.default_zoom_factor.reset(
|
||||||
blink::PageZoomLevelToZoomFactor(zoom_controller->GetDefaultZoomLevel()));
|
new double(blink::PageZoomLevelToZoomFactor(
|
||||||
|
zoom_controller->GetDefaultZoomLevel())));
|
||||||
|
|
||||||
return RespondNow(
|
results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings);
|
||||||
ArgumentList(api::tabs::GetZoomSettings::Results::Create(zoom_settings)));
|
SendResponse(true);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace cef
|
} // namespace cef
|
||||||
|
@@ -42,37 +42,6 @@ class TabsCreateFunction : public ExtensionFunction {
|
|||||||
const CefExtensionFunctionDetails cef_details_;
|
const CefExtensionFunctionDetails cef_details_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class BaseAPIFunction : public ExtensionFunction {
|
|
||||||
public:
|
|
||||||
BaseAPIFunction();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
~BaseAPIFunction() override {}
|
|
||||||
|
|
||||||
// Gets the WebContents for |tab_id| if it is specified. Otherwise get the
|
|
||||||
// WebContents for the active tab in the current window. Calling this function
|
|
||||||
// may set |error_|.
|
|
||||||
content::WebContents* GetWebContents(int tab_id);
|
|
||||||
|
|
||||||
std::string error_;
|
|
||||||
const CefExtensionFunctionDetails cef_details_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class TabsUpdateFunction : public BaseAPIFunction {
|
|
||||||
private:
|
|
||||||
~TabsUpdateFunction() override {}
|
|
||||||
|
|
||||||
ResponseAction Run() override;
|
|
||||||
|
|
||||||
bool UpdateURL(const std::string& url, int tab_id, std::string* error);
|
|
||||||
ResponseValue GetResult();
|
|
||||||
|
|
||||||
DECLARE_EXTENSION_FUNCTION("tabs.update", TABS_UPDATE)
|
|
||||||
|
|
||||||
int tab_id_ = -1;
|
|
||||||
content::WebContents* web_contents_ = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Implement API calls tabs.executeScript, tabs.insertCSS, and tabs.removeCSS.
|
// Implement API calls tabs.executeScript, tabs.insertCSS, and tabs.removeCSS.
|
||||||
class ExecuteCodeInTabFunction : public ExecuteCodeFunction {
|
class ExecuteCodeInTabFunction : public ExecuteCodeFunction {
|
||||||
public:
|
public:
|
||||||
@@ -139,44 +108,58 @@ class ZoomAPIFunction : public ExtensionFunction {
|
|||||||
// may set |error_|.
|
// may set |error_|.
|
||||||
content::WebContents* GetWebContents(int tab_id);
|
content::WebContents* GetWebContents(int tab_id);
|
||||||
|
|
||||||
|
virtual bool RunAsync() = 0;
|
||||||
|
|
||||||
|
// Responds with success/failure. |results_| or |error_| should be set
|
||||||
|
// accordingly.
|
||||||
|
void SendResponse(bool success);
|
||||||
|
|
||||||
|
// Exposed versions of ExtensionFunction::results_ and
|
||||||
|
// ExtensionFunction::error_ that are curried into the response.
|
||||||
|
// These need to keep the same name to avoid breaking existing
|
||||||
|
// implementations, but this should be temporary with crbug.com/648275
|
||||||
|
// and crbug.com/634140.
|
||||||
|
std::unique_ptr<base::ListValue> results_;
|
||||||
std::string error_;
|
std::string error_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
ResponseAction Run() final;
|
||||||
|
|
||||||
const CefExtensionFunctionDetails cef_details_;
|
const CefExtensionFunctionDetails cef_details_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TabsSetZoomFunction : public BaseAPIFunction {
|
class TabsSetZoomFunction : public ZoomAPIFunction {
|
||||||
private:
|
private:
|
||||||
~TabsSetZoomFunction() override {}
|
~TabsSetZoomFunction() override {}
|
||||||
|
|
||||||
ResponseAction Run() override;
|
bool RunAsync() override;
|
||||||
|
|
||||||
DECLARE_EXTENSION_FUNCTION("tabs.setZoom", TABS_SETZOOM)
|
DECLARE_EXTENSION_FUNCTION("tabs.setZoom", TABS_SETZOOM)
|
||||||
};
|
};
|
||||||
|
|
||||||
class TabsGetZoomFunction : public BaseAPIFunction {
|
class TabsGetZoomFunction : public ZoomAPIFunction {
|
||||||
private:
|
private:
|
||||||
~TabsGetZoomFunction() override {}
|
~TabsGetZoomFunction() override {}
|
||||||
|
|
||||||
ResponseAction Run() override;
|
bool RunAsync() override;
|
||||||
|
|
||||||
DECLARE_EXTENSION_FUNCTION("tabs.getZoom", TABS_GETZOOM)
|
DECLARE_EXTENSION_FUNCTION("tabs.getZoom", TABS_GETZOOM)
|
||||||
};
|
};
|
||||||
|
|
||||||
class TabsSetZoomSettingsFunction : public BaseAPIFunction {
|
class TabsSetZoomSettingsFunction : public ZoomAPIFunction {
|
||||||
private:
|
private:
|
||||||
~TabsSetZoomSettingsFunction() override {}
|
~TabsSetZoomSettingsFunction() override {}
|
||||||
|
|
||||||
ResponseAction Run() override;
|
bool RunAsync() override;
|
||||||
|
|
||||||
DECLARE_EXTENSION_FUNCTION("tabs.setZoomSettings", TABS_SETZOOMSETTINGS)
|
DECLARE_EXTENSION_FUNCTION("tabs.setZoomSettings", TABS_SETZOOMSETTINGS)
|
||||||
};
|
};
|
||||||
|
|
||||||
class TabsGetZoomSettingsFunction : public BaseAPIFunction {
|
class TabsGetZoomSettingsFunction : public ZoomAPIFunction {
|
||||||
private:
|
private:
|
||||||
~TabsGetZoomSettingsFunction() override {}
|
~TabsGetZoomSettingsFunction() override {}
|
||||||
|
|
||||||
ResponseAction Run() override;
|
bool RunAsync() override;
|
||||||
|
|
||||||
DECLARE_EXTENSION_FUNCTION("tabs.getZoomSettings", TABS_GETZOOMSETTINGS)
|
DECLARE_EXTENSION_FUNCTION("tabs.getZoomSettings", TABS_GETZOOMSETTINGS)
|
||||||
};
|
};
|
||||||
|
@@ -54,8 +54,8 @@ void GetAllGuestsForOwnerContents(content::WebContents* owner,
|
|||||||
std::vector<content::WebContents*>* guests) {
|
std::vector<content::WebContents*>* guests) {
|
||||||
content::BrowserPluginGuestManager* plugin_guest_manager =
|
content::BrowserPluginGuestManager* plugin_guest_manager =
|
||||||
owner->GetBrowserContext()->GetGuestManager();
|
owner->GetBrowserContext()->GetGuestManager();
|
||||||
plugin_guest_manager->ForEachGuest(
|
plugin_guest_manager->ForEachGuest(owner,
|
||||||
owner, base::BindRepeating(InsertWebContents, guests));
|
base::Bind(InsertWebContents, guests));
|
||||||
}
|
}
|
||||||
|
|
||||||
content::WebContents* GetOwnerForGuestContents(content::WebContents* guest) {
|
content::WebContents* GetOwnerForGuestContents(content::WebContents* guest) {
|
||||||
|
@@ -29,8 +29,8 @@ void CefBrowserPlatformDelegateBackground::CloseHostWindow() {
|
|||||||
// No host window, so continue browser destruction now. Do it asynchronously
|
// No host window, so continue browser destruction now. Do it asynchronously
|
||||||
// so the call stack has a chance to unwind.
|
// so the call stack has a chance to unwind.
|
||||||
CEF_POST_TASK(CEF_UIT,
|
CEF_POST_TASK(CEF_UIT,
|
||||||
base::BindOnce(&AlloyBrowserHostImpl::WindowDestroyed,
|
base::Bind(&AlloyBrowserHostImpl::WindowDestroyed,
|
||||||
static_cast<AlloyBrowserHostImpl*>(browser_)));
|
static_cast<AlloyBrowserHostImpl*>(browser_)));
|
||||||
}
|
}
|
||||||
|
|
||||||
CefWindowHandle CefBrowserPlatformDelegateBackground::GetHostWindowHandle()
|
CefWindowHandle CefBrowserPlatformDelegateBackground::GetHostWindowHandle()
|
||||||
|
@@ -51,7 +51,6 @@ const char* const kSupportedAPIs[] = {
|
|||||||
"tabs",
|
"tabs",
|
||||||
EXTENSION_FUNCTION_NAME(cefimpl::TabsGetFunction),
|
EXTENSION_FUNCTION_NAME(cefimpl::TabsGetFunction),
|
||||||
EXTENSION_FUNCTION_NAME(cefimpl::TabsCreateFunction),
|
EXTENSION_FUNCTION_NAME(cefimpl::TabsCreateFunction),
|
||||||
EXTENSION_FUNCTION_NAME(cefimpl::TabsUpdateFunction),
|
|
||||||
EXTENSION_FUNCTION_NAME(cefimpl::TabsExecuteScriptFunction),
|
EXTENSION_FUNCTION_NAME(cefimpl::TabsExecuteScriptFunction),
|
||||||
EXTENSION_FUNCTION_NAME(cefimpl::TabsInsertCSSFunction),
|
EXTENSION_FUNCTION_NAME(cefimpl::TabsInsertCSSFunction),
|
||||||
EXTENSION_FUNCTION_NAME(cefimpl::TabsRemoveCSSFunction),
|
EXTENSION_FUNCTION_NAME(cefimpl::TabsRemoveCSSFunction),
|
||||||
@@ -96,7 +95,6 @@ void ChromeFunctionRegistry::RegisterAll(ExtensionFunctionRegistry* registry) {
|
|||||||
registry->RegisterFunction<cefimpl::TabsRemoveCSSFunction>();
|
registry->RegisterFunction<cefimpl::TabsRemoveCSSFunction>();
|
||||||
registry->RegisterFunction<cefimpl::TabsGetFunction>();
|
registry->RegisterFunction<cefimpl::TabsGetFunction>();
|
||||||
registry->RegisterFunction<cefimpl::TabsCreateFunction>();
|
registry->RegisterFunction<cefimpl::TabsCreateFunction>();
|
||||||
registry->RegisterFunction<cefimpl::TabsUpdateFunction>();
|
|
||||||
registry->RegisterFunction<cefimpl::TabsSetZoomFunction>();
|
registry->RegisterFunction<cefimpl::TabsSetZoomFunction>();
|
||||||
registry->RegisterFunction<cefimpl::TabsGetZoomFunction>();
|
registry->RegisterFunction<cefimpl::TabsGetZoomFunction>();
|
||||||
registry->RegisterFunction<cefimpl::TabsSetZoomSettingsFunction>();
|
registry->RegisterFunction<cefimpl::TabsSetZoomSettingsFunction>();
|
||||||
|
@@ -23,7 +23,7 @@ CefComponentExtensionResourceManager::CefComponentExtensionResourceManager() {
|
|||||||
base::Value dict(base::Value::Type::DICTIONARY);
|
base::Value dict(base::Value::Type::DICTIONARY);
|
||||||
pdf_extension_util::AddStrings(
|
pdf_extension_util::AddStrings(
|
||||||
pdf_extension_util::PdfViewerContext::kPdfViewer, &dict);
|
pdf_extension_util::PdfViewerContext::kPdfViewer, &dict);
|
||||||
pdf_extension_util::AddAdditionalData(/*enable_annotations=*/true, &dict);
|
pdf_extension_util::AddAdditionalData(&dict);
|
||||||
|
|
||||||
ui::TemplateReplacements pdf_viewer_replacements;
|
ui::TemplateReplacements pdf_viewer_replacements;
|
||||||
ui::TemplateReplacementsFromDictionaryValue(
|
ui::TemplateReplacementsFromDictionaryValue(
|
||||||
|
@@ -17,7 +17,7 @@ CefExtensionBackgroundHost::CefExtensionBackgroundHost(
|
|||||||
const Extension* extension,
|
const Extension* extension,
|
||||||
content::WebContents* host_contents,
|
content::WebContents* host_contents,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
mojom::ViewType host_type)
|
ViewType host_type)
|
||||||
: ExtensionHost(new CefExtensionHostDelegate(browser),
|
: ExtensionHost(new CefExtensionHostDelegate(browser),
|
||||||
extension,
|
extension,
|
||||||
host_contents->GetBrowserContext(),
|
host_contents->GetBrowserContext(),
|
||||||
@@ -28,7 +28,7 @@ CefExtensionBackgroundHost::CefExtensionBackgroundHost(
|
|||||||
DCHECK(!deleted_callback_.is_null());
|
DCHECK(!deleted_callback_.is_null());
|
||||||
|
|
||||||
// Only used for background pages.
|
// Only used for background pages.
|
||||||
DCHECK(host_type == mojom::ViewType::kExtensionBackgroundPage);
|
DCHECK(host_type == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
CefExtensionBackgroundHost::~CefExtensionBackgroundHost() {
|
CefExtensionBackgroundHost::~CefExtensionBackgroundHost() {
|
||||||
|
@@ -29,7 +29,7 @@ class CefExtensionBackgroundHost : public ExtensionHost {
|
|||||||
const Extension* extension,
|
const Extension* extension,
|
||||||
content::WebContents* host_contents,
|
content::WebContents* host_contents,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
mojom::ViewType host_type);
|
ViewType host_type);
|
||||||
~CefExtensionBackgroundHost() override;
|
~CefExtensionBackgroundHost() override;
|
||||||
|
|
||||||
// content::WebContentsDelegate methods:
|
// content::WebContentsDelegate methods:
|
||||||
|
@@ -7,11 +7,11 @@
|
|||||||
#include "libcef/browser/browser_context.h"
|
#include "libcef/browser/browser_context.h"
|
||||||
#include "libcef/browser/extensions/browser_extensions_util.h"
|
#include "libcef/browser/extensions/browser_extensions_util.h"
|
||||||
#include "libcef/browser/extensions/extension_system.h"
|
#include "libcef/browser/extensions/extension_system.h"
|
||||||
|
#include "libcef/browser/navigate_params.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
|
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "base/task/post_task.h"
|
#include "base/task/post_task.h"
|
||||||
#include "base/task/thread_pool.h"
|
|
||||||
#include "chrome/browser/extensions/api/tabs/tabs_constants.h"
|
#include "chrome/browser/extensions/api/tabs/tabs_constants.h"
|
||||||
#include "chrome/browser/extensions/extension_tab_util.h"
|
#include "chrome/browser/extensions/extension_tab_util.h"
|
||||||
#include "chrome/browser/profiles/profile.h"
|
#include "chrome/browser/profiles/profile.h"
|
||||||
@@ -81,9 +81,10 @@ class CefGetExtensionLoadFileCallbackImpl
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
base::ThreadPool::PostTaskAndReplyWithResult(
|
base::PostTaskAndReplyWithResult(
|
||||||
FROM_HERE,
|
FROM_HERE,
|
||||||
{base::MayBlock(), base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
|
{base::ThreadPool(), base::MayBlock(),
|
||||||
|
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
|
||||||
base::BindOnce(LoadFileFromStream, file, stream), std::move(callback));
|
base::BindOnce(LoadFileFromStream, file, stream), std::move(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,12 +319,24 @@ base::DictionaryValue* CefExtensionFunctionDetails::OpenTab(
|
|||||||
GURL url;
|
GURL url;
|
||||||
if (params.url.get()) {
|
if (params.url.get()) {
|
||||||
std::string url_string = *params.url;
|
std::string url_string = *params.url;
|
||||||
if (!ExtensionTabUtil::PrepareURLForNavigation(
|
url = ExtensionTabUtil::ResolvePossiblyRelativeURL(url_string,
|
||||||
url_string, function()->extension(), &url, error_message)) {
|
function()->extension());
|
||||||
|
if (!url.is_valid()) {
|
||||||
|
if (error_message) {
|
||||||
|
*error_message =
|
||||||
|
ErrorUtils::FormatErrorMessage(keys::kInvalidUrlError, url_string);
|
||||||
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't let extensions crash the browser or renderers.
|
||||||
|
if (ExtensionTabUtil::IsKillURL(url)) {
|
||||||
|
if (error_message)
|
||||||
|
*error_message = keys::kNoCrashBrowserError;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
// Default to foreground for the new tab. The presence of 'active' property
|
// Default to foreground for the new tab. The presence of 'active' property
|
||||||
// will override this default.
|
// will override this default.
|
||||||
bool active = true;
|
bool active = true;
|
||||||
|
@@ -13,7 +13,6 @@
|
|||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
#include "libcef/common/extensions/extensions_util.h"
|
#include "libcef/common/extensions/extensions_util.h"
|
||||||
|
|
||||||
#include "base/bind.h"
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
@@ -447,10 +446,10 @@ void CefExtensionSystem::RegisterExtensionWithRequestContexts(
|
|||||||
// manifest settings.
|
// manifest settings.
|
||||||
content::GetIOThreadTaskRunner({})->PostTaskAndReply(
|
content::GetIOThreadTaskRunner({})->PostTaskAndReply(
|
||||||
FROM_HERE,
|
FROM_HERE,
|
||||||
base::BindOnce(&InfoMap::AddExtension, info_map(),
|
base::Bind(&InfoMap::AddExtension, info_map(),
|
||||||
base::RetainedRef(extension), base::Time::Now(),
|
base::RetainedRef(extension), base::Time::Now(),
|
||||||
true, // incognito_enabled
|
true, // incognito_enabled
|
||||||
false), // notifications_disabled
|
false), // notifications_disabled
|
||||||
std::move(callback));
|
std::move(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -460,8 +459,8 @@ void CefExtensionSystem::UnregisterExtensionWithRequestContexts(
|
|||||||
const std::string& extension_id,
|
const std::string& extension_id,
|
||||||
const UnloadedExtensionReason reason) {
|
const UnloadedExtensionReason reason) {
|
||||||
content::GetIOThreadTaskRunner({})->PostTask(
|
content::GetIOThreadTaskRunner({})->PostTask(
|
||||||
FROM_HERE, base::BindOnce(&InfoMap::RemoveExtension, info_map(),
|
FROM_HERE,
|
||||||
extension_id, reason));
|
base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason));
|
||||||
}
|
}
|
||||||
|
|
||||||
const base::OneShotEvent& CefExtensionSystem::ready() const {
|
const base::OneShotEvent& CefExtensionSystem::ready() const {
|
||||||
@@ -548,8 +547,7 @@ scoped_refptr<const Extension> CefExtensionSystem::CreateExtension(
|
|||||||
// Tests should continue to use the Manifest::COMMAND_LINE value here
|
// Tests should continue to use the Manifest::COMMAND_LINE value here
|
||||||
// Some Chrome APIs will cause undesired effects if this is incorrect
|
// Some Chrome APIs will cause undesired effects if this is incorrect
|
||||||
// e.g.: alarms API has 1 minute minimum applied to Packed Extensions
|
// e.g.: alarms API has 1 minute minimum applied to Packed Extensions
|
||||||
info.internal ? mojom::ManifestLocation::kComponent
|
info.internal ? Manifest::COMPONENT : Manifest::COMMAND_LINE,
|
||||||
: mojom::ManifestLocation::kCommandLine,
|
|
||||||
*info.manifest, flags, utf8_error);
|
*info.manifest, flags, utf8_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -635,9 +633,9 @@ void CefExtensionSystem::NotifyExtensionLoaded(const Extension* extension) {
|
|||||||
// extension.
|
// extension.
|
||||||
RegisterExtensionWithRequestContexts(
|
RegisterExtensionWithRequestContexts(
|
||||||
extension,
|
extension,
|
||||||
base::BindOnce(
|
base::Bind(&CefExtensionSystem::OnExtensionRegisteredWithRequestContexts,
|
||||||
&CefExtensionSystem::OnExtensionRegisteredWithRequestContexts,
|
weak_ptr_factory_.GetWeakPtr(),
|
||||||
weak_ptr_factory_.GetWeakPtr(), base::WrapRefCounted(extension)));
|
base::WrapRefCounted(extension)));
|
||||||
|
|
||||||
// Tell renderers about the loaded extension.
|
// Tell renderers about the loaded extension.
|
||||||
renderer_helper_->OnExtensionLoaded(*extension);
|
renderer_helper_->OnExtensionLoaded(*extension);
|
||||||
|
@@ -25,7 +25,7 @@ CefExtensionViewHost::CefExtensionViewHost(AlloyBrowserHostImpl* browser,
|
|||||||
const Extension* extension,
|
const Extension* extension,
|
||||||
content::WebContents* host_contents,
|
content::WebContents* host_contents,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
mojom::ViewType host_type)
|
ViewType host_type)
|
||||||
: ExtensionHost(new CefExtensionHostDelegate(browser),
|
: ExtensionHost(new CefExtensionHostDelegate(browser),
|
||||||
extension,
|
extension,
|
||||||
host_contents->GetBrowserContext(),
|
host_contents->GetBrowserContext(),
|
||||||
@@ -33,8 +33,8 @@ CefExtensionViewHost::CefExtensionViewHost(AlloyBrowserHostImpl* browser,
|
|||||||
url,
|
url,
|
||||||
host_type) {
|
host_type) {
|
||||||
// Only used for dialogs and popups.
|
// Only used for dialogs and popups.
|
||||||
DCHECK(host_type == mojom::ViewType::kExtensionDialog ||
|
DCHECK(host_type == VIEW_TYPE_EXTENSION_DIALOG ||
|
||||||
host_type == mojom::ViewType::kExtensionPopup);
|
host_type == VIEW_TYPE_EXTENSION_POPUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
CefExtensionViewHost::~CefExtensionViewHost() {}
|
CefExtensionViewHost::~CefExtensionViewHost() {}
|
||||||
@@ -76,7 +76,7 @@ bool CefExtensionViewHost::PreHandleGestureEvent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
WebContents* CefExtensionViewHost::GetVisibleWebContents() const {
|
WebContents* CefExtensionViewHost::GetVisibleWebContents() const {
|
||||||
if (extension_host_type() == mojom::ViewType::kExtensionPopup)
|
if (extension_host_type() == VIEW_TYPE_EXTENSION_POPUP)
|
||||||
return host_contents();
|
return host_contents();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,7 @@ class CefExtensionViewHost : public ExtensionHost,
|
|||||||
const Extension* extension,
|
const Extension* extension,
|
||||||
content::WebContents* host_contents,
|
content::WebContents* host_contents,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
mojom::ViewType host_type);
|
ViewType host_type);
|
||||||
~CefExtensionViewHost() override;
|
~CefExtensionViewHost() override;
|
||||||
|
|
||||||
// ExtensionHost methods:
|
// ExtensionHost methods:
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user