mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
b62bacfe38 | ||
|
86e55c2449 | ||
|
c6e5dd88db | ||
|
e20b240523 | ||
|
9f75be141d | ||
|
50c3c5c5fa | ||
|
98f22d3b7b | ||
|
5fa3d519c9 | ||
|
2e39487ad6 | ||
|
b469c3bf69 | ||
|
2ff59af429 | ||
|
eef2fcc940 | ||
|
e1c74c2e47 | ||
|
8c3bd38177 | ||
|
2aa4651426 | ||
|
67aea923c9 | ||
|
660ad50470 | ||
|
c67d0fe8fa | ||
|
e8fe60af56 | ||
|
819eb61e73 | ||
|
62d140e525 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -46,6 +46,5 @@ Thumbs.db
|
||||
/binary_distrib
|
||||
/docs
|
||||
# CEF generated files
|
||||
/include/cef_config.h
|
||||
/include/cef_version.h
|
||||
.ccls-cache/
|
||||
.ccls-cache/
|
225
BUILD.gn
225
BUILD.gn
@@ -100,7 +100,6 @@ import("//build/config/sanitizers/sanitizers.gni")
|
||||
import("//build/config/ui.gni")
|
||||
import("//cef/cef_repack_locales.gni")
|
||||
import("//chrome/common/features.gni")
|
||||
import("//content/public/app/mac_helpers.gni")
|
||||
import("//extensions/buildflags/buildflags.gni")
|
||||
import("//media/media_options.gni")
|
||||
import("//mojo/public/tools/bindings/mojom.gni")
|
||||
@@ -197,13 +196,10 @@ gypi_paths2 = exec_script("//cef/tools/gypi_to_gn.py",
|
||||
group("cef") {
|
||||
testonly = true
|
||||
deps = [
|
||||
":cefclient",
|
||||
":cefsimple",
|
||||
":ceftests",
|
||||
]
|
||||
|
||||
if (!is_linux || use_x11) {
|
||||
deps += [ ":cefclient" ]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -262,8 +258,12 @@ static_library("libcef_static") {
|
||||
"libcef/browser/audio_push_sink.h",
|
||||
"libcef/browser/browser_context.cc",
|
||||
"libcef/browser/browser_context.h",
|
||||
"libcef/browser/browser_context_impl.cc",
|
||||
"libcef/browser/browser_context_impl.h",
|
||||
"libcef/browser/browser_context_keyed_service_factories.cc",
|
||||
"libcef/browser/browser_context_keyed_service_factories.h",
|
||||
"libcef/browser/browser_context_proxy.cc",
|
||||
"libcef/browser/browser_context_proxy.h",
|
||||
"libcef/browser/browser_host_impl.cc",
|
||||
"libcef/browser/browser_host_impl.h",
|
||||
"libcef/browser/browser_info.cc",
|
||||
@@ -279,6 +279,8 @@ static_library("libcef_static") {
|
||||
"libcef/browser/browser_platform_delegate.cc",
|
||||
"libcef/browser/browser_platform_delegate.h",
|
||||
"libcef/browser/browser_platform_delegate_create.cc",
|
||||
"libcef/browser/browser_urlrequest_impl.cc",
|
||||
"libcef/browser/browser_urlrequest_impl.h",
|
||||
"libcef/browser/browser_util.cc",
|
||||
"libcef/browser/browser_util.h",
|
||||
"libcef/browser/chrome_browser_process_stub.cc",
|
||||
@@ -294,6 +296,8 @@ static_library("libcef_static") {
|
||||
"libcef/browser/context.h",
|
||||
"libcef/browser/context_menu_params_impl.cc",
|
||||
"libcef/browser/context_menu_params_impl.h",
|
||||
"libcef/browser/cookie_manager_impl.cc",
|
||||
"libcef/browser/cookie_manager_impl.h",
|
||||
"libcef/browser/devtools/devtools_file_manager.cc",
|
||||
"libcef/browser/devtools/devtools_file_manager.h",
|
||||
"libcef/browser/devtools/devtools_frontend.cc",
|
||||
@@ -371,12 +375,12 @@ static_library("libcef_static") {
|
||||
"libcef/browser/navigate_params.h",
|
||||
"libcef/browser/navigation_entry_impl.cc",
|
||||
"libcef/browser/navigation_entry_impl.h",
|
||||
"libcef/browser/net/browser_urlrequest_old_impl.cc",
|
||||
"libcef/browser/net/browser_urlrequest_old_impl.h",
|
||||
"libcef/browser/net/chrome_scheme_handler.cc",
|
||||
"libcef/browser/net/chrome_scheme_handler.h",
|
||||
"libcef/browser/net/cookie_manager_old_impl.cc",
|
||||
"libcef/browser/net/cookie_manager_old_impl.h",
|
||||
"libcef/browser/net/cookie_store_proxy.cc",
|
||||
"libcef/browser/net/cookie_store_proxy.h",
|
||||
"libcef/browser/net/cookie_store_source.cc",
|
||||
"libcef/browser/net/cookie_store_source.h",
|
||||
"libcef/browser/net/crlset_file_util_impl.cc",
|
||||
"libcef/browser/net/devtools_scheme_handler.cc",
|
||||
"libcef/browser/net/devtools_scheme_handler.h",
|
||||
@@ -394,40 +398,24 @@ static_library("libcef_static") {
|
||||
"libcef/browser/net/source_stream.h",
|
||||
"libcef/browser/net/url_request_context.cc",
|
||||
"libcef/browser/net/url_request_context.h",
|
||||
"libcef/browser/net/url_request_context_getter.cc",
|
||||
"libcef/browser/net/url_request_context_getter.h",
|
||||
"libcef/browser/net/url_request_context_getter_impl.cc",
|
||||
"libcef/browser/net/url_request_context_getter_impl.h",
|
||||
"libcef/browser/net/url_request_context_getter_proxy.cc",
|
||||
"libcef/browser/net/url_request_context_getter_proxy.h",
|
||||
"libcef/browser/net/url_request_context_impl.h",
|
||||
"libcef/browser/net/url_request_context_proxy.cc",
|
||||
"libcef/browser/net/url_request_context_proxy.h",
|
||||
"libcef/browser/net/url_request_interceptor.cc",
|
||||
"libcef/browser/net/url_request_interceptor.h",
|
||||
"libcef/browser/net/url_request_manager.cc",
|
||||
"libcef/browser/net/url_request_manager.h",
|
||||
"libcef/browser/net/url_request_user_data.cc",
|
||||
"libcef/browser/net/url_request_user_data.h",
|
||||
"libcef/browser/net_service/browser_urlrequest_impl.cc",
|
||||
"libcef/browser/net_service/browser_urlrequest_impl.h",
|
||||
"libcef/browser/net_service/cookie_helper.cc",
|
||||
"libcef/browser/net_service/cookie_helper.h",
|
||||
"libcef/browser/net_service/cookie_manager_impl.cc",
|
||||
"libcef/browser/net_service/cookie_manager_impl.h",
|
||||
"libcef/browser/net_service/login_delegate.cc",
|
||||
"libcef/browser/net_service/login_delegate.h",
|
||||
"libcef/browser/net_service/proxy_url_loader_factory.cc",
|
||||
"libcef/browser/net_service/proxy_url_loader_factory.h",
|
||||
"libcef/browser/net_service/resource_handler_wrapper.cc",
|
||||
"libcef/browser/net_service/resource_handler_wrapper.h",
|
||||
"libcef/browser/net_service/resource_request_handler_wrapper.cc",
|
||||
"libcef/browser/net_service/resource_request_handler_wrapper.h",
|
||||
"libcef/browser/net_service/response_filter_wrapper.cc",
|
||||
"libcef/browser/net_service/response_filter_wrapper.h",
|
||||
"libcef/browser/net_service/stream_reader_url_loader.cc",
|
||||
"libcef/browser/net_service/stream_reader_url_loader.h",
|
||||
"libcef/browser/net_service/url_loader_factory_getter.cc",
|
||||
"libcef/browser/net_service/url_loader_factory_getter.h",
|
||||
"libcef/browser/origin_whitelist_impl.cc",
|
||||
"libcef/browser/origin_whitelist_impl.h",
|
||||
"libcef/browser/osr/browser_platform_delegate_osr.cc",
|
||||
"libcef/browser/osr/browser_platform_delegate_osr.h",
|
||||
"libcef/browser/osr/host_display_client_osr.cc",
|
||||
"libcef/browser/osr/host_display_client_osr.h",
|
||||
"libcef/browser/osr/motion_event_osr.cc",
|
||||
"libcef/browser/osr/motion_event_osr.h",
|
||||
"libcef/browser/osr/osr_accessibility_util.cc",
|
||||
@@ -436,10 +424,10 @@ static_library("libcef_static") {
|
||||
"libcef/browser/osr/osr_util.h",
|
||||
"libcef/browser/osr/render_widget_host_view_osr.cc",
|
||||
"libcef/browser/osr/render_widget_host_view_osr.h",
|
||||
"libcef/browser/osr/software_output_device_osr.cc",
|
||||
"libcef/browser/osr/software_output_device_osr.h",
|
||||
"libcef/browser/osr/synthetic_gesture_target_osr.cc",
|
||||
"libcef/browser/osr/synthetic_gesture_target_osr.h",
|
||||
"libcef/browser/osr/video_consumer_osr.cc",
|
||||
"libcef/browser/osr/video_consumer_osr.h",
|
||||
"libcef/browser/osr/web_contents_view_osr.cc",
|
||||
"libcef/browser/osr/web_contents_view_osr.h",
|
||||
"libcef/browser/path_util_impl.cc",
|
||||
@@ -477,6 +465,8 @@ static_library("libcef_static") {
|
||||
"libcef/browser/ssl_info_impl.h",
|
||||
"libcef/browser/ssl_status_impl.cc",
|
||||
"libcef/browser/ssl_status_impl.h",
|
||||
"libcef/browser/storage_partition_proxy.cc",
|
||||
"libcef/browser/storage_partition_proxy.h",
|
||||
"libcef/browser/stream_impl.cc",
|
||||
"libcef/browser/stream_impl.h",
|
||||
"libcef/browser/trace_impl.cc",
|
||||
@@ -519,8 +509,6 @@ static_library("libcef_static") {
|
||||
"libcef/common/extensions/extensions_util.cc",
|
||||
"libcef/common/extensions/extensions_util.h",
|
||||
"libcef/common/file_util_impl.cc",
|
||||
"libcef/common/frame_util.cc",
|
||||
"libcef/common/frame_util.h",
|
||||
"libcef/common/json_impl.cc",
|
||||
"libcef/common/main_delegate.cc",
|
||||
"libcef/common/main_delegate.h",
|
||||
@@ -534,10 +522,6 @@ static_library("libcef_static") {
|
||||
"libcef/common/net/upload_data.h",
|
||||
"libcef/common/net/upload_element.cc",
|
||||
"libcef/common/net/upload_element.h",
|
||||
"libcef/common/net_service/net_service_util.cc",
|
||||
"libcef/common/net_service/net_service_util.h",
|
||||
"libcef/common/net_service/util.cc",
|
||||
"libcef/common/net_service/util.h",
|
||||
"libcef/common/parser_impl.cc",
|
||||
"libcef/common/process_message_impl.cc",
|
||||
"libcef/common/process_message_impl.h",
|
||||
@@ -601,8 +585,6 @@ static_library("libcef_static") {
|
||||
"libcef/renderer/render_urlrequest_impl.cc",
|
||||
"libcef/renderer/render_urlrequest_impl.h",
|
||||
"libcef/renderer/thread_util.h",
|
||||
"libcef/renderer/url_loader_throttle_provider_impl.cc",
|
||||
"libcef/renderer/url_loader_throttle_provider_impl.h",
|
||||
"libcef/renderer/v8_impl.cc",
|
||||
"libcef/renderer/v8_impl.h",
|
||||
"libcef/utility/content_utility_client.cc",
|
||||
@@ -770,7 +752,7 @@ static_library("libcef_static") {
|
||||
|
||||
deps += [
|
||||
"//chrome/install_static:secondary_module",
|
||||
"//chrome/chrome_elf",
|
||||
"//chrome_elf",
|
||||
]
|
||||
|
||||
if (is_component_build) {
|
||||
@@ -799,25 +781,14 @@ static_library("libcef_static") {
|
||||
"libcef/browser/osr/render_widget_host_view_osr_linux.cc",
|
||||
"libcef/browser/printing/print_dialog_linux.cc",
|
||||
"libcef/browser/printing/print_dialog_linux.h",
|
||||
"libcef/browser/native/window_x11.cc",
|
||||
"libcef/browser/native/window_x11.h",
|
||||
]
|
||||
|
||||
if (use_x11) {
|
||||
sources += [
|
||||
"libcef/browser/native/window_x11.cc",
|
||||
"libcef/browser/native/window_x11.h",
|
||||
]
|
||||
}
|
||||
|
||||
deps += [
|
||||
"//build/config/freetype",
|
||||
"//third_party/fontconfig",
|
||||
]
|
||||
|
||||
if (is_linux && !use_x11) {
|
||||
deps += [
|
||||
"//third_party/angle:libEGL",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if (is_mac) {
|
||||
@@ -832,6 +803,7 @@ static_library("libcef_static") {
|
||||
"libcef/browser/native/menu_runner_mac.mm",
|
||||
"libcef/browser/osr/browser_platform_delegate_osr_mac.h",
|
||||
"libcef/browser/osr/browser_platform_delegate_osr_mac.mm",
|
||||
"libcef/browser/osr/render_widget_host_view_osr_mac.mm",
|
||||
"libcef/common/util_mac.h",
|
||||
"libcef/common/util_mac.mm",
|
||||
]
|
||||
@@ -934,15 +906,6 @@ static_library("libcef_static") {
|
||||
"//ui/aura/test/ui_controls_factory_aura.h",
|
||||
]
|
||||
|
||||
if (is_linux && !use_x11) {
|
||||
sources += [
|
||||
"//ui/aura/test/mus/window_tree_client_test_api.h",
|
||||
"//ui/aura/test/mus/window_tree_client_test_api.cc",
|
||||
"//ui/aura/test/ui_controls_factory_ozone.cc",
|
||||
"//ui/events/test/events_test_utils.cc"
|
||||
]
|
||||
}
|
||||
|
||||
deps += [
|
||||
"//ui/aura",
|
||||
"//ui/events",
|
||||
@@ -980,23 +943,16 @@ static_library("libcef_static") {
|
||||
# Part of //ui/aura:test_support which is testingonly.
|
||||
"//ui/aura/test/aura_test_utils.cc",
|
||||
"//ui/aura/test/aura_test_utils.h",
|
||||
"//ui/aura/test/ui_controls_factory_aurax11.cc",
|
||||
"//ui/aura/test/x11_event_sender.cc",
|
||||
"//ui/aura/test/x11_event_sender.h",
|
||||
# Part of //ui/events:test_support which is testingonly.
|
||||
"//ui/events/test/platform_event_waiter.cc",
|
||||
"//ui/events/test/platform_event_waiter.h",
|
||||
# Part of //ui/views:test_support which is testingonly.
|
||||
"//ui/views/test/ui_controls_factory_desktop_aurax11.cc",
|
||||
"//ui/views/test/ui_controls_factory_desktop_aurax11.h",
|
||||
]
|
||||
|
||||
if (use_x11) {
|
||||
sources += [
|
||||
# Support for UI input events.
|
||||
# Part of //ui/aura:test_support which is testingonly.
|
||||
"//ui/aura/test/ui_controls_factory_aurax11.cc",
|
||||
"//ui/aura/test/x11_event_sender.cc",
|
||||
"//ui/aura/test/x11_event_sender.h",
|
||||
# Part of //ui/views:test_support which is testingonly.
|
||||
"//ui/views/test/ui_controls_factory_desktop_aurax11.cc",
|
||||
"//ui/views/test/ui_controls_factory_desktop_aurax11.h",
|
||||
]
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sources += [
|
||||
@@ -1151,10 +1107,10 @@ source_set("cef_content_utility_overlay_manifest") {
|
||||
]
|
||||
}
|
||||
|
||||
source_set("builtin_service_manifests") {
|
||||
source_set("cef_packaged_service_manifests") {
|
||||
sources = [
|
||||
"libcef/common/service_manifests/builtin_service_manifests.cc",
|
||||
"libcef/common/service_manifests/builtin_service_manifests.h",
|
||||
"libcef/common/service_manifests/cef_packaged_service_manifests.cc",
|
||||
"libcef/common/service_manifests/cef_packaged_service_manifests.h",
|
||||
]
|
||||
|
||||
configs += [
|
||||
@@ -1199,7 +1155,7 @@ source_set("cef_service_manifests") {
|
||||
":cef_content_gpu_overlay_manifest",
|
||||
":cef_content_renderer_overlay_manifest",
|
||||
":cef_content_utility_overlay_manifest",
|
||||
":builtin_service_manifests",
|
||||
":cef_packaged_service_manifests",
|
||||
":cef_renderer_manifest",
|
||||
]
|
||||
}
|
||||
@@ -1704,60 +1660,32 @@ if (is_mac) {
|
||||
]
|
||||
}
|
||||
|
||||
template("cef_helper_app") {
|
||||
mac_app_bundle(target_name) {
|
||||
assert(defined(invoker.helper_sources))
|
||||
assert(defined(invoker.helper_name_suffix))
|
||||
assert(defined(invoker.helper_bundle_id_suffix))
|
||||
mac_app_bundle("${app_name}_helper_app") {
|
||||
testonly = app_testonly
|
||||
output_name = app_helper_name
|
||||
|
||||
testonly = app_testonly
|
||||
output_name = app_helper_name + invoker.helper_name_suffix
|
||||
sources = invoker.helper_sources
|
||||
|
||||
sources = invoker.helper_sources
|
||||
|
||||
extra_substitutions = [
|
||||
"BUNDLE_ID_SUFFIX=${invoker.helper_bundle_id_suffix}",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":cef_make_headers",
|
||||
":cef_sandbox",
|
||||
":libcef_dll_wrapper",
|
||||
]
|
||||
if (defined(invoker.helper_deps)) {
|
||||
deps += invoker.helper_deps
|
||||
}
|
||||
|
||||
ldflags = [
|
||||
# The helper is in $app_name.app/Contents/Frameworks/$app_name Helper.app/Contents/MacOS/
|
||||
# so set rpath up to the base.
|
||||
"-rpath",
|
||||
"@executable_path/../../../../../..",
|
||||
]
|
||||
|
||||
info_plist_target = ":${app_name}_helper_plist"
|
||||
|
||||
if (defined(invoker.helper_defines)) {
|
||||
defines = invoker.helper_defines
|
||||
}
|
||||
deps = [
|
||||
":cef_make_headers",
|
||||
":cef_sandbox",
|
||||
":libcef_dll_wrapper",
|
||||
]
|
||||
if (defined(invoker.helper_deps)) {
|
||||
deps += invoker.helper_deps
|
||||
}
|
||||
}
|
||||
|
||||
foreach(helper_params, content_mac_helpers) {
|
||||
_helper_target = helper_params[0]
|
||||
_helper_bundle_id = helper_params[1]
|
||||
_helper_suffix = helper_params[2]
|
||||
cef_helper_app("${app_name}_helper_app_${_helper_target}") {
|
||||
helper_sources = invoker.helper_sources
|
||||
if (defined(invoker.helper_deps)) {
|
||||
helper_deps = invoker.helper_deps
|
||||
}
|
||||
if (defined(invoker.helper_defines)) {
|
||||
helper_defines = invoker.helper_defines
|
||||
}
|
||||
ldflags = [
|
||||
# The helper is in $app_name.app/Contents/Frameworks/$app_name Helper.app/Contents/MacOS/
|
||||
# so set rpath up to the base.
|
||||
"-rpath",
|
||||
"@executable_path/../../../../../..",
|
||||
]
|
||||
|
||||
helper_name_suffix = _helper_suffix
|
||||
helper_bundle_id_suffix = _helper_bundle_id
|
||||
info_plist_target = ":${app_name}_helper_plist"
|
||||
|
||||
if (defined(invoker.helper_defines)) {
|
||||
defines = invoker.helper_defines
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1765,19 +1693,14 @@ if (is_mac) {
|
||||
testonly = app_testonly
|
||||
sources = [
|
||||
"$root_out_dir/$cef_framework_name.framework",
|
||||
"$root_out_dir/$app_helper_name.app",
|
||||
]
|
||||
|
||||
public_deps = [
|
||||
":cef_framework",
|
||||
":${app_name}_helper_app",
|
||||
]
|
||||
|
||||
foreach(helper_params, content_mac_helpers) {
|
||||
sources += [
|
||||
"$root_out_dir/${app_helper_name}${helper_params[2]}.app",
|
||||
]
|
||||
public_deps += [ ":${app_name}_helper_app_${helper_params[0]}" ]
|
||||
}
|
||||
|
||||
outputs = [
|
||||
"{{bundle_contents_dir}}/Frameworks/{{source_file_part}}",
|
||||
]
|
||||
@@ -2041,12 +1964,6 @@ if (is_mac) {
|
||||
# The cefclient target depends on packages that are not available in the
|
||||
# default sysroot environment.
|
||||
if (is_linux && !use_sysroot) {
|
||||
pkg_config("glib") {
|
||||
packages = [
|
||||
"glib-2.0",
|
||||
]
|
||||
}
|
||||
|
||||
pkg_config("gtk") {
|
||||
packages = [
|
||||
"gmodule-2.0",
|
||||
@@ -2206,11 +2123,9 @@ if (is_mac) {
|
||||
sources += gypi_paths2.includes_linux +
|
||||
gypi_paths2.cefsimple_sources_linux
|
||||
|
||||
if (use_x11) {
|
||||
libs = [
|
||||
"X11",
|
||||
]
|
||||
}
|
||||
libs = [
|
||||
"X11",
|
||||
]
|
||||
|
||||
if (!is_component_build) {
|
||||
# Set rpath to find our own libfreetype even in a non-component build.
|
||||
@@ -2267,15 +2182,9 @@ if (is_mac) {
|
||||
sources += gypi_paths2.shared_sources_linux +
|
||||
gypi_paths2.ceftests_sources_linux
|
||||
|
||||
if (use_x11) {
|
||||
libs = [
|
||||
"X11",
|
||||
]
|
||||
} else {
|
||||
if (!use_sysroot) {
|
||||
configs += [ ":glib" ]
|
||||
}
|
||||
}
|
||||
libs = [
|
||||
"X11",
|
||||
]
|
||||
|
||||
deps += [
|
||||
":copy_ceftests_files",
|
||||
|
@@ -7,5 +7,5 @@
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'refs/tags/76.0.3809.132'
|
||||
'chromium_checkout': 'refs/tags/74.0.3729.157'
|
||||
}
|
||||
|
@@ -61,5 +61,15 @@
|
||||
],
|
||||
# Patterns that should not be found in the chromium/src directory after
|
||||
# applying patch files.
|
||||
'patterns': [],
|
||||
'patterns': [
|
||||
{
|
||||
# New instances of this static_cast are added to the Chromium sources with
|
||||
# some regularity. If unfixed they will result in runtime crashes.
|
||||
'pattern': 'static_cast<StoragePartitionImpl\*>(',
|
||||
'exclude_matches': '^(.+?)test(.+?):',
|
||||
'message': 'New instances in non-test files should be converted to ' +\
|
||||
'call StoragePartition methods.' +\
|
||||
'\nSee storage_partition_1973.patch.',
|
||||
},
|
||||
],
|
||||
}
|
||||
|
@@ -200,14 +200,11 @@ add_subdirectory(${CEF_LIBCEF_DLL_WRAPPER_PATH} libcef_dll_wrapper)
|
||||
# Comes from the <target>/CMakeLists.txt file in the current directory.
|
||||
# TODO: Change these lines to match your project target when you copy this file.
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
|
||||
add_subdirectory(tests/cefclient)
|
||||
add_subdirectory(tests/cefsimple)
|
||||
add_subdirectory(tests/gtest)
|
||||
add_subdirectory(tests/ceftests)
|
||||
endif()
|
||||
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests/cefclient")
|
||||
add_subdirectory(tests/cefclient)
|
||||
endif()
|
||||
|
||||
# Display configuration settings.
|
||||
PRINT_CEF_CONFIG()
|
||||
|
@@ -8,7 +8,7 @@
|
||||
# by hand. See the translator.README.txt file in the tools directory for
|
||||
# more information.
|
||||
#
|
||||
# $hash=a8e80ae73a0d30776c2e6aaceaf9dbd4031f6c74$
|
||||
# $hash=61795daa573f965b6b94dea5b8220eeca37f62a0$
|
||||
#
|
||||
|
||||
{
|
||||
@@ -57,14 +57,12 @@
|
||||
'include/cef_render_handler.h',
|
||||
'include/cef_render_process_handler.h',
|
||||
'include/cef_request.h',
|
||||
'include/cef_request_callback.h',
|
||||
'include/cef_request_context.h',
|
||||
'include/cef_request_context_handler.h',
|
||||
'include/cef_request_handler.h',
|
||||
'include/cef_resource_bundle.h',
|
||||
'include/cef_resource_bundle_handler.h',
|
||||
'include/cef_resource_handler.h',
|
||||
'include/cef_resource_request_handler.h',
|
||||
'include/cef_response.h',
|
||||
'include/cef_response_filter.h',
|
||||
'include/cef_scheme.h',
|
||||
@@ -151,14 +149,12 @@
|
||||
'include/capi/cef_render_handler_capi.h',
|
||||
'include/capi/cef_render_process_handler_capi.h',
|
||||
'include/capi/cef_request_capi.h',
|
||||
'include/capi/cef_request_callback_capi.h',
|
||||
'include/capi/cef_request_context_capi.h',
|
||||
'include/capi/cef_request_context_handler_capi.h',
|
||||
'include/capi/cef_request_handler_capi.h',
|
||||
'include/capi/cef_resource_bundle_capi.h',
|
||||
'include/capi/cef_resource_bundle_handler_capi.h',
|
||||
'include/capi/cef_resource_handler_capi.h',
|
||||
'include/capi/cef_resource_request_handler_capi.h',
|
||||
'include/capi/cef_response_capi.h',
|
||||
'include/capi/cef_response_filter_capi.h',
|
||||
'include/capi/cef_scheme_capi.h',
|
||||
@@ -242,8 +238,6 @@
|
||||
'libcef_dll/ctocpp/context_menu_handler_ctocpp.h',
|
||||
'libcef_dll/cpptoc/context_menu_params_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/context_menu_params_cpptoc.h',
|
||||
'libcef_dll/ctocpp/cookie_access_filter_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/cookie_access_filter_ctocpp.h',
|
||||
'libcef_dll/cpptoc/cookie_manager_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/cookie_manager_cpptoc.h',
|
||||
'libcef_dll/ctocpp/cookie_visitor_ctocpp.cc',
|
||||
@@ -372,12 +366,6 @@
|
||||
'libcef_dll/ctocpp/resource_bundle_handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/resource_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/resource_handler_ctocpp.h',
|
||||
'libcef_dll/cpptoc/resource_read_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/resource_read_callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/resource_request_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/resource_request_handler_ctocpp.h',
|
||||
'libcef_dll/cpptoc/resource_skip_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/resource_skip_callback_cpptoc.h',
|
||||
'libcef_dll/cpptoc/response_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/response_cpptoc.h',
|
||||
'libcef_dll/ctocpp/response_filter_ctocpp.cc',
|
||||
@@ -534,8 +522,6 @@
|
||||
'libcef_dll/cpptoc/context_menu_handler_cpptoc.h',
|
||||
'libcef_dll/ctocpp/context_menu_params_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/context_menu_params_ctocpp.h',
|
||||
'libcef_dll/cpptoc/cookie_access_filter_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/cookie_access_filter_cpptoc.h',
|
||||
'libcef_dll/ctocpp/cookie_manager_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/cookie_manager_ctocpp.h',
|
||||
'libcef_dll/cpptoc/cookie_visitor_cpptoc.cc',
|
||||
@@ -664,12 +650,6 @@
|
||||
'libcef_dll/cpptoc/resource_bundle_handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/resource_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/resource_handler_cpptoc.h',
|
||||
'libcef_dll/ctocpp/resource_read_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/resource_read_callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/resource_request_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/resource_request_handler_cpptoc.h',
|
||||
'libcef_dll/ctocpp/resource_skip_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/resource_skip_callback_ctocpp.h',
|
||||
'libcef_dll/ctocpp/response_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/response_ctocpp.h',
|
||||
'libcef_dll/cpptoc/response_filter_cpptoc.cc',
|
||||
|
@@ -36,7 +36,6 @@
|
||||
'include/base/internal/cef_thread_checker_impl.h',
|
||||
'include/cef_api_hash.h',
|
||||
'include/cef_base.h',
|
||||
'include/cef_config.h',
|
||||
'include/cef_version.h',
|
||||
'include/internal/cef_export.h',
|
||||
'include/internal/cef_logging_internal.h',
|
||||
@@ -88,7 +87,6 @@
|
||||
'includes_linux': [
|
||||
'include/base/internal/cef_atomicops_atomicword_compat.h',
|
||||
'include/base/internal/cef_atomicops_arm_gcc.h',
|
||||
'include/base/internal/cef_atomicops_arm64_gcc.h',
|
||||
'include/base/internal/cef_atomicops_x86_gcc.h',
|
||||
'include/internal/cef_linux.h',
|
||||
'include/internal/cef_types_linux.h',
|
||||
@@ -488,7 +486,6 @@
|
||||
'tests/ceftests/request_unittest.cc',
|
||||
'tests/ceftests/resource.h',
|
||||
'tests/ceftests/resource_manager_unittest.cc',
|
||||
'tests/ceftests/resource_request_handler_unittest.cc',
|
||||
'tests/ceftests/routing_test_handler.cc',
|
||||
'tests/ceftests/routing_test_handler.h',
|
||||
'tests/ceftests/run_all_unittests.cc',
|
||||
@@ -547,7 +544,6 @@
|
||||
'tests/shared/browser/resource_util.h',
|
||||
'tests/shared/browser/resource_util_mac.mm',
|
||||
'tests/shared/browser/resource_util_posix.cc',
|
||||
'tests/ceftests/audio_output_unittest.cc',
|
||||
'tests/ceftests/client_app_delegates.cc',
|
||||
'tests/ceftests/cookie_unittest.cc',
|
||||
'tests/ceftests/dom_unittest.cc',
|
||||
@@ -559,7 +555,6 @@
|
||||
'tests/ceftests/process_message_unittest.cc',
|
||||
'tests/ceftests/request_handler_unittest.cc',
|
||||
'tests/ceftests/request_unittest.cc',
|
||||
'tests/ceftests/resource_request_handler_unittest.cc',
|
||||
'tests/ceftests/routing_test_handler.cc',
|
||||
'tests/ceftests/routing_test_handler.h',
|
||||
'tests/ceftests/scheme_handler_unittest.cc',
|
||||
|
@@ -346,15 +346,6 @@ if(OS_MACOSX)
|
||||
set(CEF_SANDBOX_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/cef_sandbox.a")
|
||||
set(CEF_SANDBOX_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/cef_sandbox.a")
|
||||
endif()
|
||||
|
||||
# CEF Helper app suffixes.
|
||||
# Format is "<name suffix>:<target suffix>:<plist suffix>".
|
||||
set(CEF_HELPER_APP_SUFFIXES
|
||||
"::"
|
||||
" (GPU):_gpu:.gpu"
|
||||
" (Plugin):_plugin:.plugin"
|
||||
" (Renderer):_renderer:.renderer"
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -383,9 +374,6 @@ if(OS_WINDOWS)
|
||||
1913 # VS2017 version 15.6
|
||||
1914 # VS2017 version 15.7
|
||||
1915 # VS2017 version 15.8
|
||||
1916 # VS2017 version 15.9
|
||||
1920 # VS2019 version 16.0
|
||||
1921 # VS2018 version 16.1
|
||||
)
|
||||
list(FIND supported_msvc_versions ${MSVC_VERSION} _index)
|
||||
if (${_index} EQUAL -1)
|
||||
@@ -501,10 +489,7 @@ if(OS_WINDOWS)
|
||||
# Libraries required by cef_sandbox.lib.
|
||||
set(CEF_SANDBOX_STANDARD_LIBS
|
||||
dbghelp.lib
|
||||
PowrProf.lib
|
||||
Propsys.lib
|
||||
psapi.lib
|
||||
SetupAPI.lib
|
||||
version.lib
|
||||
wbemuuid.lib
|
||||
winmm.lib
|
||||
|
@@ -182,8 +182,6 @@ Atomic64 Release_Load(volatile const Atomic64* ptr);
|
||||
#include "include/base/internal/cef_atomicops_mac.h"
|
||||
#elif defined(COMPILER_GCC) && defined(ARCH_CPU_X86_FAMILY)
|
||||
#include "include/base/internal/cef_atomicops_x86_gcc.h"
|
||||
#elif defined(COMPILER_GCC) && defined(__ARM_ARCH_ISA_A64)
|
||||
#include "include/base/internal/cef_atomicops_arm64_gcc.h"
|
||||
#elif defined(COMPILER_GCC) && defined(__ARM_ARCH)
|
||||
#include "include/base/internal/cef_atomicops_arm_gcc.h"
|
||||
#else
|
||||
|
@@ -1,335 +0,0 @@
|
||||
// Copyright (c) 2012 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.
|
||||
//
|
||||
// Do not include this header file directly. Use base/cef_atomicops.h
|
||||
// instead.
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_INTERNAL_CEF_ATOMICOPS_ARM64_GCC_H_
|
||||
#define CEF_INCLUDE_BASE_INTERNAL_CEF_ATOMICOPS_ARM64_GCC_H_
|
||||
|
||||
namespace base {
|
||||
namespace subtle {
|
||||
|
||||
inline void MemoryBarrier() {
|
||||
__asm__ __volatile__ ("dmb ish" ::: "memory"); // NOLINT
|
||||
}
|
||||
|
||||
// NoBarrier versions of the operation include "memory" in the clobber list.
|
||||
// This is not required for direct usage of the NoBarrier versions of the
|
||||
// operations. However this is required for correctness when they are used as
|
||||
// part of the Acquire or Release versions, to ensure that nothing from outside
|
||||
// the call is reordered between the operation and the memory barrier. This does
|
||||
// not change the code generated, so has no or minimal impact on the
|
||||
// NoBarrier operations.
|
||||
|
||||
inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
|
||||
Atomic32 old_value,
|
||||
Atomic32 new_value) {
|
||||
Atomic32 prev;
|
||||
int32_t temp;
|
||||
|
||||
__asm__ __volatile__ ( // NOLINT
|
||||
"0: \n\t"
|
||||
"ldxr %w[prev], %[ptr] \n\t" // Load the previous value.
|
||||
"cmp %w[prev], %w[old_value] \n\t"
|
||||
"bne 1f \n\t"
|
||||
"stxr %w[temp], %w[new_value], %[ptr] \n\t" // Try to store the new value.
|
||||
"cbnz %w[temp], 0b \n\t" // Retry if it did not work.
|
||||
"1: \n\t"
|
||||
: [prev]"=&r" (prev),
|
||||
[temp]"=&r" (temp),
|
||||
[ptr]"+Q" (*ptr)
|
||||
: [old_value]"IJr" (old_value),
|
||||
[new_value]"r" (new_value)
|
||||
: "cc", "memory"
|
||||
); // NOLINT
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
|
||||
Atomic32 new_value) {
|
||||
Atomic32 result;
|
||||
int32_t temp;
|
||||
|
||||
__asm__ __volatile__ ( // NOLINT
|
||||
"0: \n\t"
|
||||
"ldxr %w[result], %[ptr] \n\t" // Load the previous value.
|
||||
"stxr %w[temp], %w[new_value], %[ptr] \n\t" // Try to store the new value.
|
||||
"cbnz %w[temp], 0b \n\t" // Retry if it did not work.
|
||||
: [result]"=&r" (result),
|
||||
[temp]"=&r" (temp),
|
||||
[ptr]"+Q" (*ptr)
|
||||
: [new_value]"r" (new_value)
|
||||
: "memory"
|
||||
); // NOLINT
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
|
||||
Atomic32 increment) {
|
||||
Atomic32 result;
|
||||
int32_t temp;
|
||||
|
||||
__asm__ __volatile__ ( // NOLINT
|
||||
"0: \n\t"
|
||||
"ldxr %w[result], %[ptr] \n\t" // Load the previous value.
|
||||
"add %w[result], %w[result], %w[increment]\n\t"
|
||||
"stxr %w[temp], %w[result], %[ptr] \n\t" // Try to store the result.
|
||||
"cbnz %w[temp], 0b \n\t" // Retry on failure.
|
||||
: [result]"=&r" (result),
|
||||
[temp]"=&r" (temp),
|
||||
[ptr]"+Q" (*ptr)
|
||||
: [increment]"IJr" (increment)
|
||||
: "memory"
|
||||
); // NOLINT
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
|
||||
Atomic32 increment) {
|
||||
Atomic32 result;
|
||||
|
||||
MemoryBarrier();
|
||||
result = NoBarrier_AtomicIncrement(ptr, increment);
|
||||
MemoryBarrier();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
|
||||
Atomic32 old_value,
|
||||
Atomic32 new_value) {
|
||||
Atomic32 prev;
|
||||
|
||||
prev = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
|
||||
MemoryBarrier();
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
|
||||
Atomic32 old_value,
|
||||
Atomic32 new_value) {
|
||||
Atomic32 prev;
|
||||
|
||||
MemoryBarrier();
|
||||
prev = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
|
||||
*ptr = value;
|
||||
}
|
||||
|
||||
inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
|
||||
*ptr = value;
|
||||
MemoryBarrier();
|
||||
}
|
||||
|
||||
inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
|
||||
__asm__ __volatile__ ( // NOLINT
|
||||
"stlr %w[value], %[ptr] \n\t"
|
||||
: [ptr]"=Q" (*ptr)
|
||||
: [value]"r" (value)
|
||||
: "memory"
|
||||
); // NOLINT
|
||||
}
|
||||
|
||||
inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
|
||||
Atomic32 value;
|
||||
|
||||
__asm__ __volatile__ ( // NOLINT
|
||||
"ldar %w[value], %[ptr] \n\t"
|
||||
: [value]"=r" (value)
|
||||
: [ptr]"Q" (*ptr)
|
||||
: "memory"
|
||||
); // NOLINT
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
|
||||
MemoryBarrier();
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
// 64-bit versions of the operations.
|
||||
// See the 32-bit versions for comments.
|
||||
|
||||
inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
|
||||
Atomic64 old_value,
|
||||
Atomic64 new_value) {
|
||||
Atomic64 prev;
|
||||
int32_t temp;
|
||||
|
||||
__asm__ __volatile__ ( // NOLINT
|
||||
"0: \n\t"
|
||||
"ldxr %[prev], %[ptr] \n\t"
|
||||
"cmp %[prev], %[old_value] \n\t"
|
||||
"bne 1f \n\t"
|
||||
"stxr %w[temp], %[new_value], %[ptr] \n\t"
|
||||
"cbnz %w[temp], 0b \n\t"
|
||||
"1: \n\t"
|
||||
: [prev]"=&r" (prev),
|
||||
[temp]"=&r" (temp),
|
||||
[ptr]"+Q" (*ptr)
|
||||
: [old_value]"IJr" (old_value),
|
||||
[new_value]"r" (new_value)
|
||||
: "cc", "memory"
|
||||
); // NOLINT
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr,
|
||||
Atomic64 new_value) {
|
||||
Atomic64 result;
|
||||
int32_t temp;
|
||||
|
||||
__asm__ __volatile__ ( // NOLINT
|
||||
"0: \n\t"
|
||||
"ldxr %[result], %[ptr] \n\t"
|
||||
"stxr %w[temp], %[new_value], %[ptr] \n\t"
|
||||
"cbnz %w[temp], 0b \n\t"
|
||||
: [result]"=&r" (result),
|
||||
[temp]"=&r" (temp),
|
||||
[ptr]"+Q" (*ptr)
|
||||
: [new_value]"r" (new_value)
|
||||
: "memory"
|
||||
); // NOLINT
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr,
|
||||
Atomic64 increment) {
|
||||
Atomic64 result;
|
||||
int32_t temp;
|
||||
|
||||
__asm__ __volatile__ ( // NOLINT
|
||||
"0: \n\t"
|
||||
"ldxr %[result], %[ptr] \n\t"
|
||||
"add %[result], %[result], %[increment] \n\t"
|
||||
"stxr %w[temp], %[result], %[ptr] \n\t"
|
||||
"cbnz %w[temp], 0b \n\t"
|
||||
: [result]"=&r" (result),
|
||||
[temp]"=&r" (temp),
|
||||
[ptr]"+Q" (*ptr)
|
||||
: [increment]"IJr" (increment)
|
||||
: "memory"
|
||||
); // NOLINT
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr,
|
||||
Atomic64 increment) {
|
||||
Atomic64 result;
|
||||
|
||||
MemoryBarrier();
|
||||
result = NoBarrier_AtomicIncrement(ptr, increment);
|
||||
MemoryBarrier();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
|
||||
Atomic64 old_value,
|
||||
Atomic64 new_value) {
|
||||
Atomic64 prev;
|
||||
|
||||
prev = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
|
||||
MemoryBarrier();
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr,
|
||||
Atomic64 old_value,
|
||||
Atomic64 new_value) {
|
||||
Atomic64 prev;
|
||||
|
||||
MemoryBarrier();
|
||||
prev = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) {
|
||||
*ptr = value;
|
||||
}
|
||||
|
||||
inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) {
|
||||
*ptr = value;
|
||||
MemoryBarrier();
|
||||
}
|
||||
|
||||
inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) {
|
||||
__asm__ __volatile__ ( // NOLINT
|
||||
"stlr %x[value], %[ptr] \n\t"
|
||||
: [ptr]"=Q" (*ptr)
|
||||
: [value]"r" (value)
|
||||
: "memory"
|
||||
); // NOLINT
|
||||
}
|
||||
|
||||
inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) {
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
|
||||
Atomic64 value;
|
||||
|
||||
__asm__ __volatile__ ( // NOLINT
|
||||
"ldar %x[value], %[ptr] \n\t"
|
||||
: [value]"=r" (value)
|
||||
: [ptr]"Q" (*ptr)
|
||||
: "memory"
|
||||
); // NOLINT
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
inline Atomic64 Release_Load(volatile const Atomic64* ptr) {
|
||||
MemoryBarrier();
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
} } // namespace base::subtle
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_INTERNAL_CEF_ATOMICOPS_ARM64_GCC_H_
|
||||
|
@@ -1,8 +0,0 @@
|
||||
// Copyright (c) 2019 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 net error codes from the Chromium source location. When creating a
|
||||
// CEF binary distribution this file will be replaced with the Chromium version.
|
||||
|
||||
#include "net/base/net_error_list.h"
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=623d324a1ef5637353ae74761fdc04eac4d99716$
|
||||
// $hash=15f23de47af54fa690b6c5810e3049f97ae2aabd$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_
|
||||
@@ -45,6 +45,7 @@
|
||||
#include "include/capi/cef_frame_capi.h"
|
||||
#include "include/capi/cef_image_capi.h"
|
||||
#include "include/capi/cef_navigation_entry_capi.h"
|
||||
#include "include/capi/cef_process_message_capi.h"
|
||||
#include "include/capi/cef_request_context_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -178,6 +179,15 @@ typedef struct _cef_browser_t {
|
||||
///
|
||||
void(CEF_CALLBACK* get_frame_names)(struct _cef_browser_t* self,
|
||||
cef_string_list_t names);
|
||||
|
||||
///
|
||||
// Send a message to the specified |target_process|. Returns true (1) if the
|
||||
// message was sent successfully.
|
||||
///
|
||||
int(CEF_CALLBACK* send_process_message)(
|
||||
struct _cef_browser_t* self,
|
||||
cef_process_id_t target_process,
|
||||
struct _cef_process_message_t* message);
|
||||
} cef_browser_t;
|
||||
|
||||
///
|
||||
@@ -859,33 +869,25 @@ typedef struct _cef_browser_host_t {
|
||||
// |windowInfo|. All values will be copied internally and the actual window will
|
||||
// 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
|
||||
// thread and will not block. The optional |extra_info| parameter provides an
|
||||
// opportunity to specify extra information specific to the created browser that
|
||||
// will be passed to cef_render_process_handler_t::on_browser_created() in the
|
||||
// render process.
|
||||
// thread and will not block.
|
||||
///
|
||||
CEF_EXPORT int cef_browser_host_create_browser(
|
||||
const cef_window_info_t* windowInfo,
|
||||
struct _cef_client_t* client,
|
||||
const cef_string_t* url,
|
||||
const struct _cef_browser_settings_t* settings,
|
||||
struct _cef_dictionary_value_t* extra_info,
|
||||
struct _cef_request_context_t* request_context);
|
||||
|
||||
///
|
||||
// Create a new browser window using the window parameters specified by
|
||||
// |windowInfo|. If |request_context| is NULL the global request context will be
|
||||
// used. This function can only be called on the browser process UI thread. The
|
||||
// optional |extra_info| parameter provides an opportunity to specify extra
|
||||
// information specific to the created browser that will be passed to
|
||||
// cef_render_process_handler_t::on_browser_created() in the render process.
|
||||
// used. This function can only be called on the browser process UI thread.
|
||||
///
|
||||
CEF_EXPORT cef_browser_t* cef_browser_host_create_browser_sync(
|
||||
const cef_window_info_t* windowInfo,
|
||||
struct _cef_client_t* client,
|
||||
const cef_string_t* url,
|
||||
const struct _cef_browser_settings_t* settings,
|
||||
struct _cef_dictionary_value_t* extra_info,
|
||||
struct _cef_request_context_t* request_context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=c8b6ce6786bb8369c3d9bb9e932a115fb379b145$
|
||||
// $hash=485de431252b72e5516f3f7f16a8d6f416801dfd$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_
|
||||
@@ -166,7 +166,6 @@ typedef struct _cef_client_t {
|
||||
int(CEF_CALLBACK* on_process_message_received)(
|
||||
struct _cef_client_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
cef_process_id_t source_process,
|
||||
struct _cef_process_message_t* message);
|
||||
} cef_client_t;
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=ef1fc4ab41a3fc6046a8754ce1a64bc2732332e6$
|
||||
// $hash=48b5fa68109eed1ea30fa0c805218ebd258c0573$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_COOKIE_CAPI_H_
|
||||
@@ -62,22 +62,18 @@ typedef struct _cef_cookie_manager_t {
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Set the schemes supported by this manager. If |include_defaults| is true
|
||||
// (1) the default schemes ("http", "https", "ws" and "wss") will also be
|
||||
// supported. Calling this function with an NULL |schemes| value and
|
||||
// |include_defaults| set to false (0) will disable all loading and saving of
|
||||
// cookies for this manager. If |callback| is non-NULL it will be executed
|
||||
// asnychronously on the UI thread after the change has been applied. Must be
|
||||
// called before any cookies are accessed.
|
||||
// Set the schemes supported by this manager. The default schemes ("http",
|
||||
// "https", "ws" and "wss") will always be supported. If |callback| is non-
|
||||
// NULL it will be executed asnychronously on the IO thread after the change
|
||||
// has been applied. Must be called before any cookies are accessed.
|
||||
///
|
||||
void(CEF_CALLBACK* set_supported_schemes)(
|
||||
struct _cef_cookie_manager_t* self,
|
||||
cef_string_list_t schemes,
|
||||
int include_defaults,
|
||||
struct _cef_completion_callback_t* callback);
|
||||
|
||||
///
|
||||
// Visit all cookies on the UI thread. The returned cookies are ordered by
|
||||
// Visit all cookies on the IO thread. The returned cookies are ordered by
|
||||
// longest path, then by earliest creation date. Returns false (0) if cookies
|
||||
// cannot be accessed.
|
||||
///
|
||||
@@ -85,7 +81,7 @@ typedef struct _cef_cookie_manager_t {
|
||||
struct _cef_cookie_visitor_t* visitor);
|
||||
|
||||
///
|
||||
// Visit a subset of cookies on the UI thread. The results are filtered by the
|
||||
// Visit a subset of cookies on the IO thread. The results are filtered by the
|
||||
// given url scheme, host, domain and path. If |includeHttpOnly| is true (1)
|
||||
// HTTP-only cookies will also be included in the results. The returned
|
||||
// cookies are ordered by longest path, then by earliest creation date.
|
||||
@@ -102,7 +98,7 @@ typedef struct _cef_cookie_manager_t {
|
||||
// check for disallowed characters (e.g. the ';' character is disallowed
|
||||
// within the cookie value attribute) and fail without setting the cookie if
|
||||
// such characters are found. If |callback| is non-NULL it will be executed
|
||||
// asnychronously on the UI thread after the cookie has been set. Returns
|
||||
// asnychronously on the IO thread after the cookie has been set. Returns
|
||||
// false (0) if an invalid URL is specified or if cookies cannot be accessed.
|
||||
///
|
||||
int(CEF_CALLBACK* set_cookie)(struct _cef_cookie_manager_t* self,
|
||||
@@ -116,7 +112,7 @@ typedef struct _cef_cookie_manager_t {
|
||||
// both will be deleted. If only |url| is specified all host cookies (but not
|
||||
// domain cookies) irrespective of path will be deleted. If |url| is NULL all
|
||||
// cookies for all hosts and domains will be deleted. If |callback| is non-
|
||||
// NULL it will be executed asnychronously on the UI thread after the cookies
|
||||
// NULL it will be executed asnychronously on the IO thread after the cookies
|
||||
// have been deleted. Returns false (0) if a non-NULL invalid URL is specified
|
||||
// or if cookies cannot be accessed. Cookies can alternately be deleted using
|
||||
// the Visit*Cookies() functions.
|
||||
@@ -127,9 +123,25 @@ typedef struct _cef_cookie_manager_t {
|
||||
const cef_string_t* cookie_name,
|
||||
struct _cef_delete_cookies_callback_t* callback);
|
||||
|
||||
///
|
||||
// Sets the directory path that will be used for storing cookie data. If
|
||||
// |path| is NULL data will be stored in memory only. Otherwise, data will be
|
||||
// stored at the specified |path|. To persist session cookies (cookies without
|
||||
// an expiry date or validity interval) set |persist_session_cookies| to true
|
||||
// (1). Session cookies are generally intended to be transient and most Web
|
||||
// browsers do not persist them. If |callback| is non-NULL it will be executed
|
||||
// asnychronously on the IO thread after the manager's storage has been
|
||||
// initialized. Returns false (0) if cookies cannot be accessed.
|
||||
///
|
||||
int(CEF_CALLBACK* set_storage_path)(
|
||||
struct _cef_cookie_manager_t* self,
|
||||
const cef_string_t* path,
|
||||
int persist_session_cookies,
|
||||
struct _cef_completion_callback_t* callback);
|
||||
|
||||
///
|
||||
// Flush the backing store (if any) to disk. If |callback| is non-NULL it will
|
||||
// be executed asnychronously on the UI thread after the flush is complete.
|
||||
// be executed asnychronously on the IO thread after the flush is complete.
|
||||
// Returns false (0) if cookies cannot be accessed.
|
||||
///
|
||||
int(CEF_CALLBACK* flush_store)(struct _cef_cookie_manager_t* self,
|
||||
@@ -139,17 +151,41 @@ typedef struct _cef_cookie_manager_t {
|
||||
///
|
||||
// Returns the global cookie manager. By default data will be stored at
|
||||
// CefSettings.cache_path if specified or in memory otherwise. If |callback| is
|
||||
// non-NULL it will be executed asnychronously on the UI thread after the
|
||||
// non-NULL it will be executed asnychronously on the IO thread after the
|
||||
// manager's storage has been initialized. Using this function is equivalent to
|
||||
// calling cef_request_tContext::cef_request_context_get_global_context()->GetDe
|
||||
// faultCookieManager().
|
||||
// calling cef_request_tContext::cef_request_context_get_global_context()->get_d
|
||||
// efault_cookie_manager().
|
||||
///
|
||||
CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_global_manager(
|
||||
struct _cef_completion_callback_t* callback);
|
||||
|
||||
///
|
||||
// Returns a cookie manager that neither stores nor retrieves cookies. All usage
|
||||
// of cookies will be blocked including cookies accessed via the network
|
||||
// (request/response headers), via JavaScript (document.cookie), and via
|
||||
// cef_cookie_manager_t functions. No cookies will be displayed in DevTools. If
|
||||
// you wish to only block cookies sent via the network use the
|
||||
// cef_request_tHandler CanGetCookies and CanSetCookie functions instead.
|
||||
///
|
||||
CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_blocking_manager();
|
||||
|
||||
///
|
||||
// Creates a new cookie manager. If |path| is NULL data will be stored in memory
|
||||
// only. Otherwise, data will be stored at the specified |path|. To persist
|
||||
// session cookies (cookies without an expiry date or validity interval) set
|
||||
// |persist_session_cookies| to true (1). Session cookies are generally intended
|
||||
// to be transient and most Web browsers do not persist them. If |callback| is
|
||||
// non-NULL it will be executed asnychronously on the IO thread after the
|
||||
// manager's storage has been initialized.
|
||||
///
|
||||
CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_create_manager(
|
||||
const cef_string_t* path,
|
||||
int persist_session_cookies,
|
||||
struct _cef_completion_callback_t* callback);
|
||||
|
||||
///
|
||||
// Structure to implement for visiting cookie values. The functions of this
|
||||
// structure will always be called on the UI thread.
|
||||
// structure will always be called on the IO thread.
|
||||
///
|
||||
typedef struct _cef_cookie_visitor_t {
|
||||
///
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=5c7eb1cee72dcb8b7657007b3f9db64680ea8c4d$
|
||||
// $hash=22ebb1d811a4e0a834eb115859d797c72a5c4ca3$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_DRAG_HANDLER_CAPI_H_
|
||||
@@ -43,7 +43,6 @@
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_browser_capi.h"
|
||||
#include "include/capi/cef_drag_data_capi.h"
|
||||
#include "include/capi/cef_frame_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -80,7 +79,6 @@ typedef struct _cef_drag_handler_t {
|
||||
void(CEF_CALLBACK* on_draggable_regions_changed)(
|
||||
struct _cef_drag_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
size_t regionsCount,
|
||||
cef_draggable_region_t const* regions);
|
||||
} cef_drag_handler_t;
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=6bef924a259845dbf03e9cf5084ff7feb2771034$
|
||||
// $hash=d3fcf9a928adb588443a52d82a48c188a67d3231$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_FRAME_CAPI_H_
|
||||
@@ -42,7 +42,6 @@
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_dom_capi.h"
|
||||
#include "include/capi/cef_process_message_capi.h"
|
||||
#include "include/capi/cef_request_capi.h"
|
||||
#include "include/capi/cef_stream_capi.h"
|
||||
#include "include/capi/cef_string_visitor_capi.h"
|
||||
@@ -52,8 +51,6 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
struct _cef_browser_t;
|
||||
struct _cef_urlrequest_client_t;
|
||||
struct _cef_urlrequest_t;
|
||||
struct _cef_v8context_t;
|
||||
|
||||
///
|
||||
@@ -218,44 +215,6 @@ typedef struct _cef_frame_t {
|
||||
///
|
||||
void(CEF_CALLBACK* visit_dom)(struct _cef_frame_t* self,
|
||||
struct _cef_domvisitor_t* visitor);
|
||||
|
||||
///
|
||||
// Create a new URL request that will be treated as originating from this
|
||||
// frame and the associated browser. This request may be intercepted by the
|
||||
// client via cef_resource_request_handler_t or cef_scheme_handler_factory_t.
|
||||
// Use cef_urlrequest_t::Create instead if you do not want the request to have
|
||||
// this association, in which case it may be handled differently (see
|
||||
// documentation on that function). Requests may originate from both the
|
||||
// browser process and the render process.
|
||||
//
|
||||
// For requests originating from the browser process:
|
||||
// - POST data may only contain a single element of type PDE_TYPE_FILE or
|
||||
// PDE_TYPE_BYTES.
|
||||
// For requests originating from the render process:
|
||||
// - POST data may only contain a single element of type PDE_TYPE_BYTES.
|
||||
// - If the response contains Content-Disposition or Mime-Type header values
|
||||
// that would not normally be rendered then the response may receive
|
||||
// special handling inside the browser (for example, via the file download
|
||||
// code path instead of the URL request code path).
|
||||
//
|
||||
// The |request| object will be marked as read-only after calling this
|
||||
// function.
|
||||
///
|
||||
struct _cef_urlrequest_t*(CEF_CALLBACK* create_urlrequest)(
|
||||
struct _cef_frame_t* self,
|
||||
struct _cef_request_t* request,
|
||||
struct _cef_urlrequest_client_t* client);
|
||||
|
||||
///
|
||||
// Send a message to the specified |target_process|. Message delivery is not
|
||||
// guaranteed in all cases (for example, if the browser is closing,
|
||||
// navigating, or if the target process crashes). Send an ACK message back
|
||||
// from the target process if confirmation is required.
|
||||
///
|
||||
void(CEF_CALLBACK* send_process_message)(
|
||||
struct _cef_frame_t* self,
|
||||
cef_process_id_t target_process,
|
||||
struct _cef_process_message_t* message);
|
||||
} cef_frame_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=85d9f30e93e1c3759213074cc5876f848cf4b012$
|
||||
// $hash=a1648c803a6d72e004e523cd4c02530702635d1e$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_LIFE_SPAN_HANDLER_CAPI_H_
|
||||
@@ -80,10 +80,7 @@ typedef struct _cef_life_span_handler_t {
|
||||
// modifications to |windowInfo| will be ignored if the parent browser is
|
||||
// wrapped in a cef_browser_view_t. Popup browser creation will be canceled if
|
||||
// the parent browser is destroyed before the popup browser creation completes
|
||||
// (indicated by a call to OnAfterCreated for the popup browser). The
|
||||
// |extra_info| parameter provides an opportunity to specify extra information
|
||||
// specific to the created popup browser that will be passed to
|
||||
// cef_render_process_handler_t::on_browser_created() in the render process.
|
||||
// (indicated by a call to OnAfterCreated for the popup browser).
|
||||
///
|
||||
int(CEF_CALLBACK* on_before_popup)(
|
||||
struct _cef_life_span_handler_t* self,
|
||||
@@ -97,7 +94,6 @@ typedef struct _cef_life_span_handler_t {
|
||||
struct _cef_window_info_t* windowInfo,
|
||||
struct _cef_client_t** client,
|
||||
struct _cef_browser_settings_t* settings,
|
||||
struct _cef_dictionary_value_t** extra_info,
|
||||
int* no_javascript_access);
|
||||
|
||||
///
|
||||
@@ -202,13 +198,9 @@ typedef struct _cef_life_span_handler_t {
|
||||
///
|
||||
// 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
|
||||
// object (other than GetIdentifier or IsSame) after this callback returns.
|
||||
// This callback will be the last notification that references |browser| on
|
||||
// the UI thread. Any in-progress network requests associated with |browser|
|
||||
// will be aborted when the browser is destroyed, and
|
||||
// cef_resource_request_handler_t callbacks related to those requests may
|
||||
// still arrive on the IO thread after this function is called. See do_close()
|
||||
// documentation for additional usage information.
|
||||
// object after this callback returns. This callback will be the last
|
||||
// notification that references |browser|. See do_close() documentation for
|
||||
// additional usage information.
|
||||
///
|
||||
void(CEF_CALLBACK* on_before_close)(struct _cef_life_span_handler_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=6c6efd722dda7480a5449ef31f1d6d9a16fd3465$
|
||||
// $hash=63544b02e263d0aeb2f6553bf40c52bcf72d9f0b$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_RENDER_PROCESS_HANDLER_CAPI_H_
|
||||
@@ -83,16 +83,11 @@ typedef struct _cef_render_process_handler_t {
|
||||
///
|
||||
// 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
|
||||
// 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_sync(),
|
||||
// cef_life_span_handler_t::on_before_popup() or
|
||||
// cef_browser_view_t::cef_browser_view_create().
|
||||
// destroyed.
|
||||
///
|
||||
void(CEF_CALLBACK* on_browser_created)(
|
||||
struct _cef_render_process_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_dictionary_value_t* extra_info);
|
||||
struct _cef_browser_t* browser);
|
||||
|
||||
///
|
||||
// Called before a browser is destroyed.
|
||||
@@ -166,7 +161,6 @@ typedef struct _cef_render_process_handler_t {
|
||||
int(CEF_CALLBACK* on_process_message_received)(
|
||||
struct _cef_render_process_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
cef_process_id_t source_process,
|
||||
struct _cef_process_message_t* message);
|
||||
} cef_render_process_handler_t;
|
||||
|
@@ -1,74 +0,0 @@
|
||||
// Copyright (c) 2019 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=2602018f3322a2d983a02421cf55e0dc0a1357e9$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CALLBACK_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_REQUEST_CALLBACK_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
// Callback structure used for asynchronous continuation of url requests.
|
||||
///
|
||||
typedef struct _cef_request_callback_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Continue the url request. If |allow| is true (1) the request will be
|
||||
// continued. Otherwise, the request will be canceled.
|
||||
///
|
||||
void(CEF_CALLBACK* cont)(struct _cef_request_callback_t* self, int allow);
|
||||
|
||||
///
|
||||
// Cancel the url request.
|
||||
///
|
||||
void(CEF_CALLBACK* cancel)(struct _cef_request_callback_t* self);
|
||||
} cef_request_callback_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_REQUEST_CALLBACK_CAPI_H_
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=3a1ab8264989d7f68504dc60ad6dc52c31d323a4$
|
||||
// $hash=580e0e91bf4052f0e996dc42f63079ca1a6390cf$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CAPI_H_
|
||||
@@ -136,27 +136,6 @@ typedef struct _cef_request_t {
|
||||
void(CEF_CALLBACK* set_header_map)(struct _cef_request_t* self,
|
||||
cef_string_multimap_t headerMap);
|
||||
|
||||
///
|
||||
// Returns the first header value for |name| or an NULL string if not found.
|
||||
// Will not return the Referer value if any. Use GetHeaderMap instead if
|
||||
// |name| might have multiple values.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_header_by_name)(
|
||||
struct _cef_request_t* self,
|
||||
const cef_string_t* name);
|
||||
|
||||
///
|
||||
// Set the header |name| to |value|. If |overwrite| is true (1) any existing
|
||||
// values will be replaced with the new value. If |overwrite| is false (0) any
|
||||
// existing values will not be overwritten. The Referer value cannot be set
|
||||
// using this function.
|
||||
///
|
||||
void(CEF_CALLBACK* set_header_by_name)(struct _cef_request_t* self,
|
||||
const cef_string_t* name,
|
||||
const cef_string_t* value,
|
||||
int overwrite);
|
||||
|
||||
///
|
||||
// Set all values at one time.
|
||||
///
|
||||
@@ -210,8 +189,8 @@ typedef struct _cef_request_t {
|
||||
|
||||
///
|
||||
// Returns the globally unique identifier for this request or 0 if not
|
||||
// specified. Can be used by cef_resource_request_handler_t implementations in
|
||||
// the browser process to track a single request across multiple callbacks.
|
||||
// specified. Can be used by cef_request_tHandler implementations in the
|
||||
// browser process to track a single request across multiple callbacks.
|
||||
///
|
||||
uint64(CEF_CALLBACK* get_identifier)(struct _cef_request_t* self);
|
||||
} cef_request_t;
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=fdfce3e4e33a1d4e1170497d2a476f0837994060$
|
||||
// $hash=f7f1ec971c726a6a74bcc7f5cee7a8eb1911078d$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_CAPI_H_
|
||||
@@ -44,13 +44,13 @@
|
||||
#include "include/capi/cef_cookie_capi.h"
|
||||
#include "include/capi/cef_extension_capi.h"
|
||||
#include "include/capi/cef_extension_handler_capi.h"
|
||||
#include "include/capi/cef_request_context_handler_capi.h"
|
||||
#include "include/capi/cef_values_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _cef_request_context_handler_t;
|
||||
struct _cef_scheme_handler_factory_t;
|
||||
|
||||
///
|
||||
@@ -130,11 +130,14 @@ typedef struct _cef_request_context_t {
|
||||
struct _cef_request_context_t* self);
|
||||
|
||||
///
|
||||
// Returns the cookie manager for this object. If |callback| is non-NULL it
|
||||
// will be executed asnychronously on the IO thread after the manager's
|
||||
// storage has been initialized.
|
||||
// Returns the default cookie manager for this object. This will be the global
|
||||
// cookie manager if this object is the global request context. Otherwise,
|
||||
// this will be the default cookie manager used when this request context does
|
||||
// not receive a value via cef_request_tContextHandler::get_cookie_manager().
|
||||
// If |callback| is non-NULL it will be executed asnychronously on the IO
|
||||
// thread after the manager's storage has been initialized.
|
||||
///
|
||||
struct _cef_cookie_manager_t*(CEF_CALLBACK* get_cookie_manager)(
|
||||
struct _cef_cookie_manager_t*(CEF_CALLBACK* get_default_cookie_manager)(
|
||||
struct _cef_request_context_t* self,
|
||||
struct _cef_completion_callback_t* callback);
|
||||
|
||||
@@ -238,15 +241,6 @@ typedef struct _cef_request_context_t {
|
||||
struct _cef_request_context_t* self,
|
||||
struct _cef_completion_callback_t* callback);
|
||||
|
||||
///
|
||||
// Clears all HTTP authentication credentials that were added as part of
|
||||
// handling GetAuthCredentials. If |callback| is non-NULL it will be executed
|
||||
// on the UI thread after completion.
|
||||
///
|
||||
void(CEF_CALLBACK* clear_http_auth_credentials)(
|
||||
struct _cef_request_context_t* self,
|
||||
struct _cef_completion_callback_t* callback);
|
||||
|
||||
///
|
||||
// Clears all active and idle connections that Chromium currently has. This is
|
||||
// only recommended if you have released all other CEF objects but don't yet
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=d3a339e3f85077d971e5814eb5a164a87c647810$
|
||||
// $hash=03c829d89f0b5b7ab12634fa2f11c4903cd8edb2$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_HANDLER_CAPI_H_
|
||||
@@ -41,16 +41,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_browser_capi.h"
|
||||
#include "include/capi/cef_frame_capi.h"
|
||||
#include "include/capi/cef_request_capi.h"
|
||||
#include "include/capi/cef_resource_request_handler_capi.h"
|
||||
#include "include/capi/cef_cookie_capi.h"
|
||||
#include "include/capi/cef_web_plugin_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _cef_request_context_t;
|
||||
|
||||
///
|
||||
// Implement this structure to provide handler implementations. The handler
|
||||
// instance will not be released until all objects related to the context have
|
||||
@@ -70,6 +69,14 @@ typedef struct _cef_request_context_handler_t {
|
||||
struct _cef_request_context_handler_t* self,
|
||||
struct _cef_request_context_t* request_context);
|
||||
|
||||
///
|
||||
// Called on the browser process IO thread to retrieve the cookie manager. If
|
||||
// this function returns NULL the default cookie manager retrievable via
|
||||
// cef_request_tContext::get_default_cookie_manager() will be used.
|
||||
///
|
||||
struct _cef_cookie_manager_t*(CEF_CALLBACK* get_cookie_manager)(
|
||||
struct _cef_request_context_handler_t* self);
|
||||
|
||||
///
|
||||
// Called on multiple browser process threads before a plugin instance is
|
||||
// loaded. |mime_type| is the mime type of the plugin that will be loaded.
|
||||
@@ -97,35 +104,6 @@ typedef struct _cef_request_context_handler_t {
|
||||
const cef_string_t* top_origin_url,
|
||||
struct _cef_web_plugin_info_t* plugin_info,
|
||||
cef_plugin_policy_t* plugin_policy);
|
||||
|
||||
///
|
||||
// Called on the browser process IO thread before a resource request is
|
||||
// initiated. The |browser| and |frame| values represent the source of the
|
||||
// request, and may be NULL for requests originating from service workers or
|
||||
// cef_urlrequest_t. |request| represents the request contents and cannot be
|
||||
// modified in this callback. |is_navigation| will be true (1) if the resource
|
||||
// request is a navigation. |is_download| will be true (1) if the resource
|
||||
// request is a download. |request_initiator| is the origin (scheme + domain)
|
||||
// of the page that initiated the request. Set |disable_default_handling| to
|
||||
// true (1) to disable default handling of the request, in which case it will
|
||||
// need to be handled via cef_resource_request_handler_t::GetResourceHandler
|
||||
// or it will be canceled. To allow the resource load to proceed with default
|
||||
// handling return NULL. To specify a handler for the resource return a
|
||||
// cef_resource_request_handler_t object. This function will not be called if
|
||||
// the client associated with |browser| returns a non-NULL value from
|
||||
// cef_request_tHandler::GetResourceRequestHandler for the same request
|
||||
// (identified by cef_request_t::GetIdentifier).
|
||||
///
|
||||
struct _cef_resource_request_handler_t*(
|
||||
CEF_CALLBACK* get_resource_request_handler)(
|
||||
struct _cef_request_context_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request,
|
||||
int is_navigation,
|
||||
int is_download,
|
||||
const cef_string_t* request_initiator,
|
||||
int* disable_default_handling);
|
||||
} cef_request_context_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=d9c4e8591ee39bd9d8c1714c0ca2417a7d2a38ea$
|
||||
// $hash=64631c0b1776a951da838f8b08a4c71ef33a15cc$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_
|
||||
@@ -44,9 +44,10 @@
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_browser_capi.h"
|
||||
#include "include/capi/cef_frame_capi.h"
|
||||
#include "include/capi/cef_request_callback_capi.h"
|
||||
#include "include/capi/cef_request_capi.h"
|
||||
#include "include/capi/cef_resource_request_handler_capi.h"
|
||||
#include "include/capi/cef_resource_handler_capi.h"
|
||||
#include "include/capi/cef_response_capi.h"
|
||||
#include "include/capi/cef_response_filter_capi.h"
|
||||
#include "include/capi/cef_ssl_info_capi.h"
|
||||
#include "include/capi/cef_x509_certificate_capi.h"
|
||||
|
||||
@@ -54,6 +55,27 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
// Callback structure used for asynchronous continuation of url requests.
|
||||
///
|
||||
typedef struct _cef_request_callback_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Continue the url request. If |allow| is true (1) the request will be
|
||||
// continued. Otherwise, the request will be canceled.
|
||||
///
|
||||
void(CEF_CALLBACK* cont)(struct _cef_request_callback_t* self, int allow);
|
||||
|
||||
///
|
||||
// Cancel the url request.
|
||||
///
|
||||
void(CEF_CALLBACK* cancel)(struct _cef_request_callback_t* self);
|
||||
} cef_request_callback_t;
|
||||
|
||||
///
|
||||
// Callback structure used to select a client certificate for authentication.
|
||||
///
|
||||
@@ -126,39 +148,92 @@ typedef struct _cef_request_handler_t {
|
||||
int user_gesture);
|
||||
|
||||
///
|
||||
// Called on the browser process IO thread before a resource request is
|
||||
// initiated. The |browser| and |frame| values represent the source of the
|
||||
// request. |request| represents the request contents and cannot be modified
|
||||
// in this callback. |is_navigation| will be true (1) if the resource request
|
||||
// is a navigation. |is_download| will be true (1) if the resource request is
|
||||
// a download. |request_initiator| is the origin (scheme + domain) of the page
|
||||
// that initiated the request. Set |disable_default_handling| to true (1) to
|
||||
// disable default handling of the request, in which case it will need to be
|
||||
// handled via cef_resource_request_handler_t::GetResourceHandler or it will
|
||||
// be canceled. To allow the resource load to proceed with default handling
|
||||
// return NULL. To specify a handler for the resource return a
|
||||
// cef_resource_request_handler_t object. If this callback returns NULL the
|
||||
// same function will be called on the associated cef_request_tContextHandler,
|
||||
// if any.
|
||||
// Called on the IO thread before a resource request is loaded. The |request|
|
||||
// object may be modified. Return RV_CONTINUE to continue the request
|
||||
// immediately. Return RV_CONTINUE_ASYNC and call cef_request_tCallback::
|
||||
// cont() at a later time to continue or cancel the request asynchronously.
|
||||
// Return RV_CANCEL to cancel the request immediately.
|
||||
//
|
||||
///
|
||||
struct _cef_resource_request_handler_t*(
|
||||
CEF_CALLBACK* get_resource_request_handler)(
|
||||
cef_return_value_t(CEF_CALLBACK* on_before_resource_load)(
|
||||
struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request,
|
||||
int is_navigation,
|
||||
int is_download,
|
||||
const cef_string_t* request_initiator,
|
||||
int* disable_default_handling);
|
||||
struct _cef_request_callback_t* callback);
|
||||
|
||||
///
|
||||
// Called on the IO thread before a resource is loaded. To allow the resource
|
||||
// to load normally return NULL. To specify a handler for the resource return
|
||||
// a cef_resource_handler_t object. The |request| object should not be
|
||||
// modified in this callback.
|
||||
///
|
||||
struct _cef_resource_handler_t*(CEF_CALLBACK* get_resource_handler)(
|
||||
struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request);
|
||||
|
||||
///
|
||||
// Called on the IO thread when a resource load is redirected. The |request|
|
||||
// parameter will contain the old URL and other request-related information.
|
||||
// The |response| parameter will contain the response that resulted in the
|
||||
// redirect. The |new_url| parameter will contain the new URL and can be
|
||||
// changed if desired. The |request| object cannot be modified in this
|
||||
// callback.
|
||||
///
|
||||
void(CEF_CALLBACK* on_resource_redirect)(struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request,
|
||||
struct _cef_response_t* response,
|
||||
cef_string_t* new_url);
|
||||
|
||||
///
|
||||
// Called on the IO thread when a resource response is received. To allow the
|
||||
// resource to load normally return false (0). To redirect or retry the
|
||||
// resource modify |request| (url, headers or post body) and return true (1).
|
||||
// The |response| object cannot be modified in this callback.
|
||||
///
|
||||
int(CEF_CALLBACK* on_resource_response)(struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request,
|
||||
struct _cef_response_t* response);
|
||||
|
||||
///
|
||||
// Called on the IO thread to optionally filter resource response content.
|
||||
// |request| and |response| represent the request and response respectively
|
||||
// and cannot be modified in this callback.
|
||||
///
|
||||
struct _cef_response_filter_t*(CEF_CALLBACK* get_resource_response_filter)(
|
||||
struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request,
|
||||
struct _cef_response_t* response);
|
||||
|
||||
///
|
||||
// Called on the IO thread when a resource load has completed. |request| and
|
||||
// |response| represent the request and response respectively and cannot be
|
||||
// modified in this callback. |status| indicates the load completion status.
|
||||
// |received_content_length| is the number of response bytes actually read.
|
||||
///
|
||||
void(CEF_CALLBACK* on_resource_load_complete)(
|
||||
struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request,
|
||||
struct _cef_response_t* response,
|
||||
cef_urlrequest_status_t status,
|
||||
int64 received_content_length);
|
||||
|
||||
///
|
||||
// Called on the IO thread when the browser needs credentials from the user.
|
||||
// |origin_url| is the origin making this authentication request. |isProxy|
|
||||
// indicates whether the host is a proxy server. |host| contains the hostname
|
||||
// and |port| contains the port number. |realm| is the realm of the challenge
|
||||
// and may be NULL. |scheme| is the authentication scheme used, such as
|
||||
// "basic" or "digest", and will be NULL if the source of the request is an
|
||||
// |isProxy| indicates whether the host is a proxy server. |host| contains the
|
||||
// hostname and |port| contains the port number. |realm| is the realm of the
|
||||
// challenge and may be NULL. |scheme| is the authentication scheme used, such
|
||||
// as "basic" or "digest", and will be NULL if the source of the request is an
|
||||
// FTP server. Return true (1) to continue the request and call
|
||||
// cef_auth_callback_t::cont() either in this function or at a later time when
|
||||
// the authentication information is available. Return false (0) to cancel the
|
||||
@@ -167,7 +242,7 @@ typedef struct _cef_request_handler_t {
|
||||
int(CEF_CALLBACK* get_auth_credentials)(
|
||||
struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_string_t* origin_url,
|
||||
struct _cef_frame_t* frame,
|
||||
int isProxy,
|
||||
const cef_string_t* host,
|
||||
int port,
|
||||
@@ -175,6 +250,29 @@ typedef struct _cef_request_handler_t {
|
||||
const cef_string_t* scheme,
|
||||
struct _cef_auth_callback_t* callback);
|
||||
|
||||
///
|
||||
// Called on the IO thread before sending a network request with a "Cookie"
|
||||
// request header. Return true (1) to allow cookies to be included in the
|
||||
// network request or false (0) to block cookies. The |request| object should
|
||||
// not be modified in this callback.
|
||||
///
|
||||
int(CEF_CALLBACK* can_get_cookies)(struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request);
|
||||
|
||||
///
|
||||
// Called on the IO thread when receiving a network request with a "Set-
|
||||
// Cookie" response header value represented by |cookie|. Return true (1) to
|
||||
// allow the cookie to be stored or false (0) to block the cookie. The
|
||||
// |request| object should not be modified in this callback.
|
||||
///
|
||||
int(CEF_CALLBACK* can_set_cookie)(struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request,
|
||||
const struct _cef_cookie_t* cookie);
|
||||
|
||||
///
|
||||
// Called on the IO thread when JavaScript requests a specific storage quota
|
||||
// size via the webkitStorageInfo.requestQuota function. |origin_url| is the
|
||||
@@ -190,6 +288,18 @@ typedef struct _cef_request_handler_t {
|
||||
int64 new_size,
|
||||
struct _cef_request_callback_t* callback);
|
||||
|
||||
///
|
||||
// Called on the UI thread to handle requests for URLs with an unknown
|
||||
// protocol component. Set |allow_os_execution| to true (1) to attempt
|
||||
// execution via the registered OS protocol handler, if any. SECURITY WARNING:
|
||||
// YOU SHOULD USE THIS METHOD TO ENFORCE RESTRICTIONS BASED ON SCHEME, HOST OR
|
||||
// OTHER URL ANALYSIS BEFORE ALLOWING OS EXECUTION.
|
||||
///
|
||||
void(CEF_CALLBACK* on_protocol_execution)(struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_string_t* url,
|
||||
int* allow_os_execution);
|
||||
|
||||
///
|
||||
// Called on the UI thread to handle requests for URLs with an invalid SSL
|
||||
// certificate. Return true (1) and call cef_request_tCallback::cont() either
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=8c6ffeab9c9183cc5f77929839643767ce5c5c2f$
|
||||
// $hash=706e3ebbdb4e3b01f3f3bb18eb85c1897c8b5ade$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_RESOURCE_HANDLER_CAPI_H_
|
||||
@@ -51,48 +51,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
// Callback for asynchronous continuation of cef_resource_handler_t::skip().
|
||||
///
|
||||
typedef struct _cef_resource_skip_callback_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Callback for asynchronous continuation of skip(). If |bytes_skipped| > 0
|
||||
// then either skip() will be called again until the requested number of bytes
|
||||
// have been skipped or the request will proceed. If |bytes_skipped| <= 0 the
|
||||
// request will fail with ERR_REQUEST_RANGE_NOT_SATISFIABLE.
|
||||
///
|
||||
void(CEF_CALLBACK* cont)(struct _cef_resource_skip_callback_t* self,
|
||||
int64 bytes_skipped);
|
||||
} cef_resource_skip_callback_t;
|
||||
|
||||
///
|
||||
// Callback for asynchronous continuation of cef_resource_handler_t::read().
|
||||
///
|
||||
typedef struct _cef_resource_read_callback_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Callback for asynchronous continuation of read(). If |bytes_read| == 0 the
|
||||
// response will be considered complete. If |bytes_read| > 0 then read() will
|
||||
// be called again until the request is complete (based on either the result
|
||||
// or the expected content length). If |bytes_read| < 0 then the request will
|
||||
// fail and the |bytes_read| value will be treated as the error code.
|
||||
///
|
||||
void(CEF_CALLBACK* cont)(struct _cef_resource_read_callback_t* self,
|
||||
int bytes_read);
|
||||
} cef_resource_read_callback_t;
|
||||
|
||||
///
|
||||
// Structure used to implement a custom request handler structure. The functions
|
||||
// of this structure will be called on the IO thread unless otherwise indicated.
|
||||
// of this structure will always be called on the IO thread.
|
||||
///
|
||||
typedef struct _cef_resource_handler_t {
|
||||
///
|
||||
@@ -100,29 +61,12 @@ typedef struct _cef_resource_handler_t {
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Open the response stream. To handle the request immediately set
|
||||
// |handle_request| to true (1) and return true (1). To decide at a later time
|
||||
// set |handle_request| to false (0), return true (1), and execute |callback|
|
||||
// to continue or cancel the request. To cancel the request immediately set
|
||||
// |handle_request| to true (1) and return false (0). This function will be
|
||||
// called in sequence but not from a dedicated thread. For backwards
|
||||
// compatibility set |handle_request| to false (0) and return false (0) and
|
||||
// the ProcessRequest function will be called.
|
||||
///
|
||||
int(CEF_CALLBACK* open)(struct _cef_resource_handler_t* self,
|
||||
struct _cef_request_t* request,
|
||||
int* handle_request,
|
||||
struct _cef_callback_t* callback);
|
||||
|
||||
///
|
||||
// Begin processing the request. To handle the request return true (1) and
|
||||
// call cef_callback_t::cont() once the response header information is
|
||||
// available (cef_callback_t::cont() can also be called from inside this
|
||||
// function if header information is available immediately). To cancel the
|
||||
// request return false (0).
|
||||
//
|
||||
// WARNING: This function is deprecated. Use Open instead.
|
||||
///
|
||||
int(CEF_CALLBACK* process_request)(struct _cef_resource_handler_t* self,
|
||||
struct _cef_request_t* request,
|
||||
@@ -148,47 +92,12 @@ typedef struct _cef_resource_handler_t {
|
||||
int64* response_length,
|
||||
cef_string_t* redirectUrl);
|
||||
|
||||
///
|
||||
// Skip response data when requested by a Range header. Skip over and discard
|
||||
// |bytes_to_skip| bytes of response data. If data is available immediately
|
||||
// set |bytes_skipped| to the number of bytes skipped and return true (1). To
|
||||
// read the data at a later time set |bytes_skipped| to 0, return true (1) and
|
||||
// execute |callback| when the data is available. To indicate failure set
|
||||
// |bytes_skipped| to < 0 (e.g. -2 for ERR_FAILED) and return false (0). This
|
||||
// function will be called in sequence but not from a dedicated thread.
|
||||
///
|
||||
int(CEF_CALLBACK* skip)(struct _cef_resource_handler_t* self,
|
||||
int64 bytes_to_skip,
|
||||
int64* bytes_skipped,
|
||||
struct _cef_resource_skip_callback_t* callback);
|
||||
|
||||
///
|
||||
// Read response data. If data is available immediately copy up to
|
||||
// |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of
|
||||
// bytes copied, and return true (1). To read the data at a later time keep a
|
||||
// pointer to |data_out|, set |bytes_read| to 0, return true (1) and execute
|
||||
// |callback| when the data is available (|data_out| will remain valid until
|
||||
// the callback is executed). To indicate response completion set |bytes_read|
|
||||
// to 0 and return false (0). To indicate failure set |bytes_read| to < 0
|
||||
// (e.g. -2 for ERR_FAILED) and return false (0). This function will be called
|
||||
// in sequence but not from a dedicated thread. For backwards compatibility
|
||||
// set |bytes_read| to -1 and return false (0) and the ReadResponse function
|
||||
// will be called.
|
||||
///
|
||||
int(CEF_CALLBACK* read)(struct _cef_resource_handler_t* self,
|
||||
void* data_out,
|
||||
int bytes_to_read,
|
||||
int* bytes_read,
|
||||
struct _cef_resource_read_callback_t* callback);
|
||||
|
||||
///
|
||||
// Read response data. If data is available immediately copy up to
|
||||
// |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of
|
||||
// bytes copied, and return true (1). To read the data at a later time set
|
||||
// |bytes_read| to 0, return true (1) and call cef_callback_t::cont() when the
|
||||
// data is available. To indicate response completion return false (0).
|
||||
//
|
||||
// WARNING: This function is deprecated. Use Skip and Read instead.
|
||||
///
|
||||
int(CEF_CALLBACK* read_response)(struct _cef_resource_handler_t* self,
|
||||
void* data_out,
|
||||
@@ -196,6 +105,21 @@ typedef struct _cef_resource_handler_t {
|
||||
int* bytes_read,
|
||||
struct _cef_callback_t* callback);
|
||||
|
||||
///
|
||||
// Return true (1) if the specified cookie can be sent with the request or
|
||||
// false (0) otherwise. If false (0) is returned for any cookie then no
|
||||
// cookies will be sent with the request.
|
||||
///
|
||||
int(CEF_CALLBACK* can_get_cookie)(struct _cef_resource_handler_t* self,
|
||||
const struct _cef_cookie_t* cookie);
|
||||
|
||||
///
|
||||
// Return true (1) if the specified cookie returned with the response can be
|
||||
// set or false (0) otherwise.
|
||||
///
|
||||
int(CEF_CALLBACK* can_set_cookie)(struct _cef_resource_handler_t* self,
|
||||
const struct _cef_cookie_t* cookie);
|
||||
|
||||
///
|
||||
// Request processing has been canceled.
|
||||
///
|
||||
|
@@ -1,254 +0,0 @@
|
||||
// Copyright (c) 2019 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=adb3ca1e315a28efed7b2305c8aceb9c5eafdc66$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_RESOURCE_REQUEST_HANDLER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_RESOURCE_REQUEST_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"
|
||||
#include "include/capi/cef_request_callback_capi.h"
|
||||
#include "include/capi/cef_request_capi.h"
|
||||
#include "include/capi/cef_resource_handler_capi.h"
|
||||
#include "include/capi/cef_response_capi.h"
|
||||
#include "include/capi/cef_response_filter_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _cef_cookie_access_filter_t;
|
||||
|
||||
///
|
||||
// Implement this structure to handle events related to browser requests. The
|
||||
// functions of this structure will be called on the IO thread unless otherwise
|
||||
// indicated.
|
||||
///
|
||||
typedef struct _cef_resource_request_handler_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Called on the IO thread before a resource request is loaded. The |browser|
|
||||
// and |frame| values represent the source of the request, and may be NULL for
|
||||
// requests originating from service workers or cef_urlrequest_t. To
|
||||
// optionally filter cookies for the request return a
|
||||
// cef_cookie_access_filter_t object. The |request| object cannot not be
|
||||
// modified in this callback.
|
||||
///
|
||||
struct _cef_cookie_access_filter_t*(CEF_CALLBACK* get_cookie_access_filter)(
|
||||
struct _cef_resource_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request);
|
||||
|
||||
///
|
||||
// Called on the IO thread before a resource request is loaded. The |browser|
|
||||
// and |frame| values represent the source of the request, and may be NULL for
|
||||
// requests originating from service workers or cef_urlrequest_t. To redirect
|
||||
// or change the resource load optionally modify |request|. Modification of
|
||||
// the request URL will be treated as a redirect. Return RV_CONTINUE to
|
||||
// continue the request immediately. Return RV_CONTINUE_ASYNC and call
|
||||
// cef_request_tCallback:: cont() at a later time to continue or cancel the
|
||||
// request asynchronously. Return RV_CANCEL to cancel the request immediately.
|
||||
//
|
||||
///
|
||||
cef_return_value_t(CEF_CALLBACK* on_before_resource_load)(
|
||||
struct _cef_resource_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request,
|
||||
struct _cef_request_callback_t* callback);
|
||||
|
||||
///
|
||||
// Called on the IO thread before a resource is loaded. The |browser| and
|
||||
// |frame| values represent the source of the request, and may be NULL for
|
||||
// requests originating from service workers or cef_urlrequest_t. To allow the
|
||||
// resource to load using the default network loader return NULL. To specify a
|
||||
// handler for the resource return a cef_resource_handler_t object. The
|
||||
// |request| object cannot not be modified in this callback.
|
||||
///
|
||||
struct _cef_resource_handler_t*(CEF_CALLBACK* get_resource_handler)(
|
||||
struct _cef_resource_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request);
|
||||
|
||||
///
|
||||
// Called on the IO thread when a resource load is redirected. The |browser|
|
||||
// and |frame| values represent the source of the request, and may be NULL for
|
||||
// requests originating from service workers or cef_urlrequest_t. The
|
||||
// |request| parameter will contain the old URL and other request-related
|
||||
// information. The |response| parameter will contain the response that
|
||||
// resulted in the redirect. The |new_url| parameter will contain the new URL
|
||||
// and can be changed if desired. The |request| and |response| objects cannot
|
||||
// be modified in this callback.
|
||||
///
|
||||
void(CEF_CALLBACK* on_resource_redirect)(
|
||||
struct _cef_resource_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request,
|
||||
struct _cef_response_t* response,
|
||||
cef_string_t* new_url);
|
||||
|
||||
///
|
||||
// Called on the IO thread when a resource response is received. The |browser|
|
||||
// and |frame| values represent the source of the request, and may be NULL for
|
||||
// requests originating from service workers or cef_urlrequest_t. To allow the
|
||||
// resource load to proceed without modification return false (0). To redirect
|
||||
// or retry the resource load optionally modify |request| and return true (1).
|
||||
// Modification of the request URL will be treated as a redirect. Requests
|
||||
// handled using the default network loader cannot be redirected in this
|
||||
// callback. The |response| object cannot be modified in this callback.
|
||||
//
|
||||
// WARNING: Redirecting using this function is deprecated. Use
|
||||
// OnBeforeResourceLoad or GetResourceHandler to perform redirects.
|
||||
///
|
||||
int(CEF_CALLBACK* on_resource_response)(
|
||||
struct _cef_resource_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request,
|
||||
struct _cef_response_t* response);
|
||||
|
||||
///
|
||||
// Called on the IO thread to optionally filter resource response content. The
|
||||
// |browser| and |frame| values represent the source of the request, and may
|
||||
// be NULL for requests originating from service workers or cef_urlrequest_t.
|
||||
// |request| and |response| represent the request and response respectively
|
||||
// and cannot be modified in this callback.
|
||||
///
|
||||
struct _cef_response_filter_t*(CEF_CALLBACK* get_resource_response_filter)(
|
||||
struct _cef_resource_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request,
|
||||
struct _cef_response_t* response);
|
||||
|
||||
///
|
||||
// Called on the IO thread when a resource load has completed. The |browser|
|
||||
// and |frame| values represent the source of the request, and may be NULL for
|
||||
// requests originating from service workers or cef_urlrequest_t. |request|
|
||||
// and |response| represent the request and response respectively and cannot
|
||||
// be modified in this callback. |status| indicates the load completion
|
||||
// status. |received_content_length| is the number of response bytes actually
|
||||
// read. This function will be called for all requests, including requests
|
||||
// that are aborted due to CEF shutdown or destruction of the associated
|
||||
// browser. In cases where the associated browser is destroyed this callback
|
||||
// may arrive after the cef_life_span_handler_t::OnBeforeClose callback for
|
||||
// that browser. The cef_frame_t::IsValid function can be used to test for
|
||||
// this situation, and care should be taken not to call |browser| or |frame|
|
||||
// functions that modify state (like LoadURL, SendProcessMessage, etc.) if the
|
||||
// frame is invalid.
|
||||
///
|
||||
void(CEF_CALLBACK* on_resource_load_complete)(
|
||||
struct _cef_resource_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request,
|
||||
struct _cef_response_t* response,
|
||||
cef_urlrequest_status_t status,
|
||||
int64 received_content_length);
|
||||
|
||||
///
|
||||
// Called on the IO thread to handle requests for URLs with an unknown
|
||||
// protocol component. The |browser| and |frame| values represent the source
|
||||
// of the request, and may be NULL for requests originating from service
|
||||
// workers or cef_urlrequest_t. |request| cannot be modified in this callback.
|
||||
// Set |allow_os_execution| to true (1) to attempt execution via the
|
||||
// registered OS protocol handler, if any. SECURITY WARNING: YOU SHOULD USE
|
||||
// THIS METHOD TO ENFORCE RESTRICTIONS BASED ON SCHEME, HOST OR OTHER URL
|
||||
// ANALYSIS BEFORE ALLOWING OS EXECUTION.
|
||||
///
|
||||
void(CEF_CALLBACK* on_protocol_execution)(
|
||||
struct _cef_resource_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request,
|
||||
int* allow_os_execution);
|
||||
} cef_resource_request_handler_t;
|
||||
|
||||
///
|
||||
// Implement this structure to filter cookies that may be sent or received from
|
||||
// resource requests. The functions of this structure will be called on the IO
|
||||
// thread unless otherwise indicated.
|
||||
///
|
||||
typedef struct _cef_cookie_access_filter_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Called on the IO thread before a resource request is sent. The |browser|
|
||||
// and |frame| values represent the source of the request, and may be NULL for
|
||||
// requests originating from service workers or cef_urlrequest_t. |request|
|
||||
// cannot be modified in this callback. Return true (1) if the specified
|
||||
// cookie can be sent with the request or false (0) otherwise.
|
||||
///
|
||||
int(CEF_CALLBACK* can_send_cookie)(struct _cef_cookie_access_filter_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request,
|
||||
const struct _cef_cookie_t* cookie);
|
||||
|
||||
///
|
||||
// Called on the IO thread after a resource response is received. The
|
||||
// |browser| and |frame| values represent the source of the request, and may
|
||||
// be NULL for requests originating from service workers or cef_urlrequest_t.
|
||||
// |request| cannot be modified in this callback. Return true (1) if the
|
||||
// specified cookie returned with the response can be saved or false (0)
|
||||
// otherwise.
|
||||
///
|
||||
int(CEF_CALLBACK* can_save_cookie)(struct _cef_cookie_access_filter_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request,
|
||||
struct _cef_response_t* response,
|
||||
const struct _cef_cookie_t* cookie);
|
||||
} cef_cookie_access_filter_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_RESOURCE_REQUEST_HANDLER_CAPI_H_
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=cc5ec5ca76adb568adb08c3b58fb3289a94b2ecd$
|
||||
// $hash=0c99415ddb1bf7d10135545c7b0ccfb7eec2264d$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_RESPONSE_CAPI_H_
|
||||
@@ -109,19 +109,6 @@ typedef struct _cef_response_t {
|
||||
void(CEF_CALLBACK* set_mime_type)(struct _cef_response_t* self,
|
||||
const cef_string_t* mimeType);
|
||||
|
||||
///
|
||||
// Get the response charset.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_charset)(
|
||||
struct _cef_response_t* self);
|
||||
|
||||
///
|
||||
// Set the response charset.
|
||||
///
|
||||
void(CEF_CALLBACK* set_charset)(struct _cef_response_t* self,
|
||||
const cef_string_t* charset);
|
||||
|
||||
///
|
||||
// Get the value for the specified response header field.
|
||||
///
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=bf5c2a51aa80e831382bfe08e8dd5ec6331f0fdc$
|
||||
// $hash=1d4a363735a7274fb957905f47841c63301507f0$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_SCHEME_CAPI_H_
|
||||
@@ -94,7 +94,7 @@ typedef struct _cef_scheme_handler_factory_t {
|
||||
// will be the browser window and frame respectively that originated the
|
||||
// request or NULL if the request did not originate from a browser window (for
|
||||
// example, if the request came from cef_urlrequest_t). The |request| object
|
||||
// passed to this function cannot be modified.
|
||||
// passed to this function will not contain cookie data.
|
||||
///
|
||||
struct _cef_resource_handler_t*(CEF_CALLBACK* create)(
|
||||
struct _cef_scheme_handler_factory_t* self,
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=77ac3a2aaea32b649185a58e4c2bbb13b7fe0540$
|
||||
// $hash=fa6b1185c566277ff593e7e537dff2b8085d1f3a$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_URLREQUEST_CAPI_H_
|
||||
@@ -112,25 +112,19 @@ typedef struct _cef_urlrequest_t {
|
||||
} cef_urlrequest_t;
|
||||
|
||||
///
|
||||
// Create a new URL request that is not associated with a specific browser or
|
||||
// frame. Use cef_frame_t::CreateURLRequest instead if you want the request to
|
||||
// have this association, in which case it may be handled differently (see
|
||||
// documentation on that function). Requests may originate from the both browser
|
||||
// process and the render process.
|
||||
//
|
||||
// For requests originating from the browser process:
|
||||
// - It may be intercepted by the client via CefResourceRequestHandler or
|
||||
// CefSchemeHandlerFactory.
|
||||
// - POST data may only contain only a single element of type PDE_TYPE_FILE
|
||||
// or PDE_TYPE_BYTES.
|
||||
// - If |request_context| is empty the global request context will be used.
|
||||
// For requests originating from the render process:
|
||||
// - It cannot be intercepted by the client so only http(s) and blob schemes
|
||||
// are supported.
|
||||
// - POST data may only contain a single element of type PDE_TYPE_BYTES.
|
||||
// - The |request_context| parameter must be NULL.
|
||||
//
|
||||
// The |request| object will be marked as read-only after calling this function.
|
||||
// Create a new URL request. Only GET, POST, HEAD, DELETE and PUT request
|
||||
// functions are supported. Multiple post data elements are not supported and
|
||||
// elements of type PDE_TYPE_FILE are only supported for requests originating
|
||||
// from the browser process. Requests originating from the render process will
|
||||
// receive the same handling as requests originating from Web content -- if the
|
||||
// response contains Content-Disposition or Mime-Type header values that would
|
||||
// not normally be rendered then the response may receive special handling
|
||||
// inside the browser (for example, via the file download code path instead of
|
||||
// the URL request code path). The |request| object will be marked as read-only
|
||||
// after calling this function. In the browser process if |request_context| is
|
||||
// NULL the global request context will be used. In the render process
|
||||
// |request_context| must be NULL and the context associated with the current
|
||||
// renderer process' browser will be used.
|
||||
///
|
||||
CEF_EXPORT cef_urlrequest_t* cef_urlrequest_create(
|
||||
struct _cef_request_t* request,
|
||||
@@ -193,11 +187,9 @@ typedef struct _cef_urlrequest_client_t {
|
||||
// |isProxy| indicates whether the host is a proxy server. |host| contains the
|
||||
// hostname and |port| contains the port number. Return true (1) to continue
|
||||
// the request and call cef_auth_callback_t::cont() when the authentication
|
||||
// information is available. If the request has an associated browser/frame
|
||||
// then returning false (0) will result in a call to GetAuthCredentials on the
|
||||
// cef_request_tHandler associated with that browser, if any. Otherwise,
|
||||
// returning false (0) will cancel the request immediately. This function will
|
||||
// only be called for requests initiated from the browser process.
|
||||
// information is available. Return false (0) to cancel the request. This
|
||||
// function will only be called for requests initiated from the browser
|
||||
// process.
|
||||
///
|
||||
int(CEF_CALLBACK* get_auth_credentials)(
|
||||
struct _cef_urlrequest_client_t* self,
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=400746f8fac7fa3dba7ee889c10ae6ca22b93fe1$
|
||||
// $hash=c499099d6f628e58d2eed207537817758161af5d$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_BROWSER_VIEW_CAPI_H_
|
||||
@@ -80,16 +80,12 @@ typedef struct _cef_browser_view_t {
|
||||
|
||||
///
|
||||
// Create a new BrowserView. The underlying cef_browser_t will not be created
|
||||
// until this view is added to the views hierarchy. The optional |extra_info|
|
||||
// parameter provides an opportunity to specify extra information specific to
|
||||
// the created browser that will be passed to
|
||||
// cef_render_process_handler_t::on_browser_created() in the render process.
|
||||
// until this view is added to the views hierarchy.
|
||||
///
|
||||
CEF_EXPORT cef_browser_view_t* cef_browser_view_create(
|
||||
struct _cef_client_t* client,
|
||||
const cef_string_t* url,
|
||||
const struct _cef_browser_settings_t* settings,
|
||||
struct _cef_dictionary_value_t* extra_info,
|
||||
struct _cef_request_context_t* request_context,
|
||||
struct _cef_browser_view_delegate_t* delegate);
|
||||
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=973d3f764a42f1bf255b52dcd1041aaba1f1475b$
|
||||
// $hash=81babf6211a1e99886028bfc4fb9107ef7517c1f$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_LABEL_BUTTON_CAPI_H_
|
||||
@@ -148,11 +148,16 @@ typedef struct _cef_label_button_t {
|
||||
///
|
||||
// Create a new LabelButton. A |delegate| must be provided to handle the button
|
||||
// click. |text| will be shown on the LabelButton and used as the default
|
||||
// accessible name.
|
||||
// accessible name. If |with_frame| is true (1) the button will have a visible
|
||||
// frame at all times, center alignment, additional padding and a default
|
||||
// minimum size of 70x33 DIP. If |with_frame| is false (0) the button will only
|
||||
// have a visible frame on hover/press, left alignment, less padding and no
|
||||
// default minimum size.
|
||||
///
|
||||
CEF_EXPORT cef_label_button_t* cef_label_button_create(
|
||||
struct _cef_button_delegate_t* delegate,
|
||||
const cef_string_t* text);
|
||||
const cef_string_t* text,
|
||||
int with_frame);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=889104f0418508aaa66ed8808b627fdd6652102c$
|
||||
// $hash=f375009823015557083997f5a1c2033739de9c22$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_MENU_BUTTON_CAPI_H_
|
||||
@@ -89,7 +89,8 @@ typedef struct _cef_menu_button_t {
|
||||
///
|
||||
CEF_EXPORT cef_menu_button_t* cef_menu_button_create(
|
||||
struct _cef_menu_button_delegate_t* delegate,
|
||||
const cef_string_t* text);
|
||||
const cef_string_t* text,
|
||||
int with_frame);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -34,7 +34,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=23774ff0da7e40bab8244ff4b661b1d9fed24107$
|
||||
// $hash=b5fa5783096eaa1af5e76645e2557e123af56848$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_API_HASH_H_
|
||||
@@ -47,13 +47,13 @@
|
||||
// way that may cause binary incompatibility with other builds. The universal
|
||||
// hash value will change if any platform is affected whereas the platform hash
|
||||
// values will change only if that particular platform is affected.
|
||||
#define CEF_API_HASH_UNIVERSAL "d04fc15ff27c5a8ee71fee4a88383e5c4bbb7b10"
|
||||
#define CEF_API_HASH_UNIVERSAL "8ae24aac4bd16d2e2d87e7d6561985064990670e"
|
||||
#if defined(OS_WIN)
|
||||
#define CEF_API_HASH_PLATFORM "031426ad8eb80ee32fcf3605837cff8d3bbae3a4"
|
||||
#define CEF_API_HASH_PLATFORM "fe476e7a38a8270fe783981b4bc6fac4284ab9fe"
|
||||
#elif defined(OS_MACOSX)
|
||||
#define CEF_API_HASH_PLATFORM "47422c9703f7c32013642707b976d299c72f42cb"
|
||||
#define CEF_API_HASH_PLATFORM "ab1b4d8c4578b0bcdc97f28f13a10384057bdf95"
|
||||
#elif defined(OS_LINUX)
|
||||
#define CEF_API_HASH_PLATFORM "d333fdd7eee13c06f58e586513061ce121121e0b"
|
||||
#define CEF_API_HASH_PLATFORM "73f24626e0179a3f5664d64ffe0fa2aab9edf7cf"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -44,6 +44,7 @@
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/cef_image.h"
|
||||
#include "include/cef_navigation_entry.h"
|
||||
#include "include/cef_process_message.h"
|
||||
#include "include/cef_request_context.h"
|
||||
|
||||
class CefBrowserHost;
|
||||
@@ -180,6 +181,14 @@ class CefBrowser : public virtual CefBaseRefCounted {
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void GetFrameNames(std::vector<CefString>& names) = 0;
|
||||
|
||||
///
|
||||
// Send a message to the specified |target_process|. Returns true if the
|
||||
// message was sent successfully.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool SendProcessMessage(CefProcessId target_process,
|
||||
CefRefPtr<CefProcessMessage> message) = 0;
|
||||
};
|
||||
|
||||
///
|
||||
@@ -277,37 +286,29 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
|
||||
// |windowInfo|. All values will be copied internally and the actual window
|
||||
// will be created on the UI thread. If |request_context| is empty the
|
||||
// global request context will be used. This method can be called on any
|
||||
// browser process thread and will not block. The optional |extra_info|
|
||||
// parameter provides an opportunity to specify extra information specific
|
||||
// to the created browser that will be passed to
|
||||
// CefRenderProcessHandler::OnBrowserCreated() in the render process.
|
||||
// browser process thread and will not block.
|
||||
///
|
||||
/*--cef(optional_param=client,optional_param=url,
|
||||
optional_param=request_context,optional_param=extra_info)--*/
|
||||
optional_param=request_context)--*/
|
||||
static bool CreateBrowser(const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefString& url,
|
||||
const CefBrowserSettings& settings,
|
||||
CefRefPtr<CefDictionaryValue> extra_info,
|
||||
CefRefPtr<CefRequestContext> request_context);
|
||||
|
||||
///
|
||||
// Create a new browser window using the window parameters specified by
|
||||
// |windowInfo|. If |request_context| is empty the global request context
|
||||
// will be used. This method can only be called on the browser process UI
|
||||
// thread. The optional |extra_info| parameter provides an opportunity to
|
||||
// specify extra information specific to the created browser that will be
|
||||
// passed to CefRenderProcessHandler::OnBrowserCreated() in the render
|
||||
// process.
|
||||
// thread.
|
||||
///
|
||||
/*--cef(optional_param=client,optional_param=url,
|
||||
optional_param=request_context,optional_param=extra_info)--*/
|
||||
optional_param=request_context)--*/
|
||||
static CefRefPtr<CefBrowser> CreateBrowserSync(
|
||||
const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefString& url,
|
||||
const CefBrowserSettings& settings,
|
||||
CefRefPtr<CefDictionaryValue> extra_info,
|
||||
CefRefPtr<CefRequestContext> request_context);
|
||||
|
||||
///
|
||||
|
@@ -158,7 +158,6 @@ class CefClient : public virtual CefBaseRefCounted {
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message) {
|
||||
return false;
|
||||
|
@@ -56,7 +56,7 @@ class CefCookieManager : public virtual CefBaseRefCounted {
|
||||
///
|
||||
// Returns the global cookie manager. By default data will be stored at
|
||||
// CefSettings.cache_path if specified or in memory otherwise. If |callback|
|
||||
// is non-NULL it will be executed asnychronously on the UI thread after the
|
||||
// is non-NULL it will be executed asnychronously on the IO thread after the
|
||||
// manager's storage has been initialized. Using this method is equivalent to
|
||||
// calling CefRequestContext::GetGlobalContext()->GetDefaultCookieManager().
|
||||
///
|
||||
@@ -65,22 +65,44 @@ class CefCookieManager : public virtual CefBaseRefCounted {
|
||||
CefRefPtr<CefCompletionCallback> callback);
|
||||
|
||||
///
|
||||
// Set the schemes supported by this manager. If |include_defaults| is true
|
||||
// the default schemes ("http", "https", "ws" and "wss") will also be
|
||||
// supported. Calling this method with an empty |schemes| value and
|
||||
// |include_defaults| set to false will disable all loading and saving of
|
||||
// cookies for this manager. If |callback| is non-NULL it will be executed
|
||||
// asnychronously on the UI thread after the change has been applied. Must be
|
||||
// called before any cookies are accessed.
|
||||
// Returns a cookie manager that neither stores nor retrieves cookies. All
|
||||
// usage of cookies will be blocked including cookies accessed via the network
|
||||
// (request/response headers), via JavaScript (document.cookie), and via
|
||||
// CefCookieManager methods. No cookies will be displayed in DevTools. If you
|
||||
// wish to only block cookies sent via the network use the CefRequestHandler
|
||||
// CanGetCookies and CanSetCookie methods instead.
|
||||
///
|
||||
/*--cef()--*/
|
||||
static CefRefPtr<CefCookieManager> GetBlockingManager();
|
||||
|
||||
///
|
||||
// Creates a new cookie manager. If |path| is empty data will be stored in
|
||||
// memory only. Otherwise, data will be stored at the specified |path|. To
|
||||
// persist session cookies (cookies without an expiry date or validity
|
||||
// interval) set |persist_session_cookies| to true. Session cookies are
|
||||
// generally intended to be transient and most Web browsers do not persist
|
||||
// them. If |callback| is non-NULL it will be executed asnychronously on the
|
||||
// IO thread after the manager's storage has been initialized.
|
||||
///
|
||||
/*--cef(optional_param=path,optional_param=callback)--*/
|
||||
static CefRefPtr<CefCookieManager> CreateManager(
|
||||
const CefString& path,
|
||||
bool persist_session_cookies,
|
||||
CefRefPtr<CefCompletionCallback> callback);
|
||||
|
||||
///
|
||||
// Set the schemes supported by this manager. The default schemes ("http",
|
||||
// "https", "ws" and "wss") will always be supported. If |callback| is non-
|
||||
// NULL it will be executed asnychronously on the IO thread after the change
|
||||
// has been applied. Must be called before any cookies are accessed.
|
||||
///
|
||||
/*--cef(optional_param=callback)--*/
|
||||
virtual void SetSupportedSchemes(
|
||||
const std::vector<CefString>& schemes,
|
||||
bool include_defaults,
|
||||
CefRefPtr<CefCompletionCallback> callback) = 0;
|
||||
|
||||
///
|
||||
// Visit all cookies on the UI thread. The returned cookies are ordered by
|
||||
// Visit all cookies on the IO thread. The returned cookies are ordered by
|
||||
// longest path, then by earliest creation date. Returns false if cookies
|
||||
// cannot be accessed.
|
||||
///
|
||||
@@ -88,7 +110,7 @@ class CefCookieManager : public virtual CefBaseRefCounted {
|
||||
virtual bool VisitAllCookies(CefRefPtr<CefCookieVisitor> visitor) = 0;
|
||||
|
||||
///
|
||||
// Visit a subset of cookies on the UI thread. The results are filtered by the
|
||||
// Visit a subset of cookies on the IO thread. The results are filtered by the
|
||||
// given url scheme, host, domain and path. If |includeHttpOnly| is true
|
||||
// HTTP-only cookies will also be included in the results. The returned
|
||||
// cookies are ordered by longest path, then by earliest creation date.
|
||||
@@ -105,7 +127,7 @@ class CefCookieManager : public virtual CefBaseRefCounted {
|
||||
// check for disallowed characters (e.g. the ';' character is disallowed
|
||||
// within the cookie value attribute) and fail without setting the cookie if
|
||||
// such characters are found. If |callback| is non-NULL it will be executed
|
||||
// asnychronously on the UI thread after the cookie has been set. Returns
|
||||
// asnychronously on the IO thread after the cookie has been set. Returns
|
||||
// false if an invalid URL is specified or if cookies cannot be accessed.
|
||||
///
|
||||
/*--cef(optional_param=callback)--*/
|
||||
@@ -119,7 +141,7 @@ class CefCookieManager : public virtual CefBaseRefCounted {
|
||||
// both will be deleted. If only |url| is specified all host cookies (but not
|
||||
// domain cookies) irrespective of path will be deleted. If |url| is empty all
|
||||
// cookies for all hosts and domains will be deleted. If |callback| is
|
||||
// non-NULL it will be executed asnychronously on the UI thread after the
|
||||
// non-NULL it will be executed asnychronously on the IO thread after the
|
||||
// cookies have been deleted. Returns false if a non-empty invalid URL is
|
||||
// specified or if cookies cannot be accessed. Cookies can alternately be
|
||||
// deleted using the Visit*Cookies() methods.
|
||||
@@ -130,9 +152,24 @@ class CefCookieManager : public virtual CefBaseRefCounted {
|
||||
const CefString& cookie_name,
|
||||
CefRefPtr<CefDeleteCookiesCallback> callback) = 0;
|
||||
|
||||
///
|
||||
// Sets the directory path that will be used for storing cookie data. If
|
||||
// |path| is empty data will be stored in memory only. Otherwise, data will be
|
||||
// stored at the specified |path|. To persist session cookies (cookies without
|
||||
// an expiry date or validity interval) set |persist_session_cookies| to true.
|
||||
// Session cookies are generally intended to be transient and most Web
|
||||
// browsers do not persist them. If |callback| is non-NULL it will be executed
|
||||
// asnychronously on the IO thread after the manager's storage has been
|
||||
// initialized. Returns false if cookies cannot be accessed.
|
||||
///
|
||||
/*--cef(optional_param=path,optional_param=callback)--*/
|
||||
virtual bool SetStoragePath(const CefString& path,
|
||||
bool persist_session_cookies,
|
||||
CefRefPtr<CefCompletionCallback> callback) = 0;
|
||||
|
||||
///
|
||||
// Flush the backing store (if any) to disk. If |callback| is non-NULL it will
|
||||
// be executed asnychronously on the UI thread after the flush is complete.
|
||||
// be executed asnychronously on the IO thread after the flush is complete.
|
||||
// Returns false if cookies cannot be accessed.
|
||||
///
|
||||
/*--cef(optional_param=callback)--*/
|
||||
@@ -141,7 +178,7 @@ class CefCookieManager : public virtual CefBaseRefCounted {
|
||||
|
||||
///
|
||||
// Interface to implement for visiting cookie values. The methods of this class
|
||||
// will always be called on the UI thread.
|
||||
// will always be called on the IO thread.
|
||||
///
|
||||
/*--cef(source=client)--*/
|
||||
class CefCookieVisitor : public virtual CefBaseRefCounted {
|
||||
|
@@ -41,7 +41,6 @@
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_drag_data.h"
|
||||
#include "include/cef_frame.h"
|
||||
|
||||
///
|
||||
// Implement this interface to handle events related to dragging. The methods of
|
||||
@@ -75,7 +74,6 @@ class CefDragHandler : public virtual CefBaseRefCounted {
|
||||
/*--cef()--*/
|
||||
virtual void OnDraggableRegionsChanged(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
const std::vector<CefDraggableRegion>& regions) {}
|
||||
};
|
||||
|
||||
|
@@ -40,14 +40,11 @@
|
||||
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_dom.h"
|
||||
#include "include/cef_process_message.h"
|
||||
#include "include/cef_request.h"
|
||||
#include "include/cef_stream.h"
|
||||
#include "include/cef_string_visitor.h"
|
||||
|
||||
class CefBrowser;
|
||||
class CefURLRequest;
|
||||
class CefURLRequestClient;
|
||||
class CefV8Context;
|
||||
|
||||
///
|
||||
@@ -223,42 +220,6 @@ class CefFrame : public virtual CefBaseRefCounted {
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void VisitDOM(CefRefPtr<CefDOMVisitor> visitor) = 0;
|
||||
|
||||
///
|
||||
// Create a new URL request that will be treated as originating from this
|
||||
// frame and the associated browser. This request may be intercepted by the
|
||||
// client via CefResourceRequestHandler or CefSchemeHandlerFactory. Use
|
||||
// CefURLRequest::Create instead if you do not want the request to have this
|
||||
// association, in which case it may be handled differently (see documentation
|
||||
// on that method). Requests may originate from both the browser process and
|
||||
// the render process.
|
||||
//
|
||||
// For requests originating from the browser process:
|
||||
// - POST data may only contain a single element of type PDE_TYPE_FILE or
|
||||
// PDE_TYPE_BYTES.
|
||||
// For requests originating from the render process:
|
||||
// - POST data may only contain a single element of type PDE_TYPE_BYTES.
|
||||
// - If the response contains Content-Disposition or Mime-Type header values
|
||||
// that would not normally be rendered then the response may receive
|
||||
// special handling inside the browser (for example, via the file download
|
||||
// code path instead of the URL request code path).
|
||||
//
|
||||
// The |request| object will be marked as read-only after calling this method.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefURLRequest> CreateURLRequest(
|
||||
CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefURLRequestClient> client) = 0;
|
||||
|
||||
///
|
||||
// Send a message to the specified |target_process|. Message delivery is not
|
||||
// guaranteed in all cases (for example, if the browser is closing,
|
||||
// navigating, or if the target process crashes). Send an ACK message back
|
||||
// from the target process if confirmation is required.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SendProcessMessage(CefProcessId target_process,
|
||||
CefRefPtr<CefProcessMessage> message) = 0;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_FRAME_H_
|
||||
|
@@ -73,10 +73,7 @@ class CefLifeSpanHandler : public virtual CefBaseRefCounted {
|
||||
// |windowInfo| will be ignored if the parent browser is wrapped in a
|
||||
// CefBrowserView. Popup browser creation will be canceled if the parent
|
||||
// browser is destroyed before the popup browser creation completes (indicated
|
||||
// by a call to OnAfterCreated for the popup browser). The |extra_info|
|
||||
// parameter provides an opportunity to specify extra information specific
|
||||
// to the created popup browser that will be passed to
|
||||
// CefRenderProcessHandler::OnBrowserCreated() in the render process.
|
||||
// by a call to OnAfterCreated for the popup browser).
|
||||
///
|
||||
/*--cef(optional_param=target_url,optional_param=target_frame_name)--*/
|
||||
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser,
|
||||
@@ -89,7 +86,6 @@ class CefLifeSpanHandler : public virtual CefBaseRefCounted {
|
||||
CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient>& client,
|
||||
CefBrowserSettings& settings,
|
||||
CefRefPtr<CefDictionaryValue>& extra_info,
|
||||
bool* no_javascript_access) {
|
||||
return false;
|
||||
}
|
||||
@@ -195,13 +191,9 @@ class CefLifeSpanHandler : public virtual CefBaseRefCounted {
|
||||
///
|
||||
// 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
|
||||
// object (other than GetIdentifier or IsSame) after this callback returns.
|
||||
// This callback will be the last notification that references |browser| on
|
||||
// the UI thread. Any in-progress network requests associated with |browser|
|
||||
// will be aborted when the browser is destroyed, and
|
||||
// CefResourceRequestHandler callbacks related to those requests may still
|
||||
// arrive on the IO thread after this method is called. See DoClose()
|
||||
// documentation for additional usage information.
|
||||
// object after this callback returns. This callback will be the last
|
||||
// notification that references |browser|. See DoClose() documentation for
|
||||
// additional usage information.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) {}
|
||||
|
@@ -75,13 +75,10 @@ class CefRenderProcessHandler : public virtual CefBaseRefCounted {
|
||||
///
|
||||
// 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
|
||||
// destroyed. |extra_info| is a read-only value originating from
|
||||
// CefBrowserHost::CreateBrowser(), CefBrowserHost::CreateBrowserSync(),
|
||||
// CefLifeSpanHandler::OnBeforePopup() or CefBrowserView::CreateBrowserView().
|
||||
// destroyed.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnBrowserCreated(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDictionaryValue> extra_info) {}
|
||||
virtual void OnBrowserCreated(CefRefPtr<CefBrowser> browser) {}
|
||||
|
||||
///
|
||||
// Called before a browser is destroyed.
|
||||
@@ -148,7 +145,6 @@ class CefRenderProcessHandler : public virtual CefBaseRefCounted {
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message) {
|
||||
return false;
|
||||
|
@@ -99,7 +99,7 @@ class CefRequest : public virtual CefBaseRefCounted {
|
||||
// fully qualified with an HTTP or HTTPS scheme component. Any username,
|
||||
// password or ref component will be removed.
|
||||
///
|
||||
/*--cef(optional_param=referrer_url)--*/
|
||||
/*--cef()--*/
|
||||
virtual void SetReferrer(const CefString& referrer_url,
|
||||
ReferrerPolicy policy) = 0;
|
||||
|
||||
@@ -140,25 +140,6 @@ class CefRequest : public virtual CefBaseRefCounted {
|
||||
/*--cef()--*/
|
||||
virtual void SetHeaderMap(const HeaderMap& headerMap) = 0;
|
||||
|
||||
///
|
||||
// Returns the first header value for |name| or an empty string if not found.
|
||||
// Will not return the Referer value if any. Use GetHeaderMap instead if
|
||||
// |name| might have multiple values.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefString GetHeaderByName(const CefString& name) = 0;
|
||||
|
||||
///
|
||||
// Set the header |name| to |value|. If |overwrite| is true any existing
|
||||
// values will be replaced with the new value. If |overwrite| is false any
|
||||
// existing values will not be overwritten. The Referer value cannot be set
|
||||
// using this method.
|
||||
///
|
||||
/*--cef(optional_param=value)--*/
|
||||
virtual void SetHeaderByName(const CefString& name,
|
||||
const CefString& value,
|
||||
bool overwrite) = 0;
|
||||
|
||||
///
|
||||
// Set all values at one time.
|
||||
///
|
||||
@@ -193,7 +174,7 @@ class CefRequest : public virtual CefBaseRefCounted {
|
||||
// Set the URL to the first party for cookies used in combination with
|
||||
// CefURLRequest.
|
||||
///
|
||||
/*--cef(optional_param=url)--*/
|
||||
/*--cef()--*/
|
||||
virtual void SetFirstPartyForCookies(const CefString& url) = 0;
|
||||
|
||||
///
|
||||
@@ -213,8 +194,8 @@ class CefRequest : public virtual CefBaseRefCounted {
|
||||
|
||||
///
|
||||
// Returns the globally unique identifier for this request or 0 if not
|
||||
// specified. Can be used by CefResourceRequestHandler implementations in the
|
||||
// browser process to track a single request across multiple callbacks.
|
||||
// specified. Can be used by CefRequestHandler implementations in the browser
|
||||
// process to track a single request across multiple callbacks.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual uint64 GetIdentifier() = 0;
|
||||
|
@@ -1,63 +0,0 @@
|
||||
// Copyright (c) 2011 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_REQUEST_CALLBACK_H_
|
||||
#define CEF_INCLUDE_CEF_REQUEST_CALLBACK_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
|
||||
///
|
||||
// Callback interface used for asynchronous continuation of url requests.
|
||||
///
|
||||
/*--cef(source=library)--*/
|
||||
class CefRequestCallback : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Continue the url request. If |allow| is true the request will be continued.
|
||||
// Otherwise, the request will be canceled.
|
||||
///
|
||||
/*--cef(capi_name=cont)--*/
|
||||
virtual void Continue(bool allow) = 0;
|
||||
|
||||
///
|
||||
// Cancel the url request.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void Cancel() = 0;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_REQUEST_CALLBACK_H_
|
@@ -44,9 +44,9 @@
|
||||
#include "include/cef_cookie.h"
|
||||
#include "include/cef_extension.h"
|
||||
#include "include/cef_extension_handler.h"
|
||||
#include "include/cef_request_context_handler.h"
|
||||
#include "include/cef_values.h"
|
||||
|
||||
class CefRequestContextHandler;
|
||||
class CefSchemeHandlerFactory;
|
||||
|
||||
///
|
||||
@@ -144,12 +144,15 @@ class CefRequestContext : public virtual CefBaseRefCounted {
|
||||
virtual CefString GetCachePath() = 0;
|
||||
|
||||
///
|
||||
// Returns the cookie manager for this object. If |callback| is non-NULL it
|
||||
// will be executed asnychronously on the IO thread after the manager's
|
||||
// storage has been initialized.
|
||||
// Returns the default cookie manager for this object. This will be the global
|
||||
// cookie manager if this object is the global request context. Otherwise,
|
||||
// this will be the default cookie manager used when this request context does
|
||||
// not receive a value via CefRequestContextHandler::GetCookieManager(). If
|
||||
// |callback| is non-NULL it will be executed asnychronously on the IO thread
|
||||
// after the manager's storage has been initialized.
|
||||
///
|
||||
/*--cef(optional_param=callback)--*/
|
||||
virtual CefRefPtr<CefCookieManager> GetCookieManager(
|
||||
virtual CefRefPtr<CefCookieManager> GetDefaultCookieManager(
|
||||
CefRefPtr<CefCompletionCallback> callback) = 0;
|
||||
|
||||
///
|
||||
@@ -249,15 +252,6 @@ class CefRequestContext : public virtual CefBaseRefCounted {
|
||||
virtual void ClearCertificateExceptions(
|
||||
CefRefPtr<CefCompletionCallback> callback) = 0;
|
||||
|
||||
///
|
||||
// Clears all HTTP authentication credentials that were added as part of
|
||||
// handling GetAuthCredentials. If |callback| is non-NULL it will be executed
|
||||
// on the UI thread after completion.
|
||||
///
|
||||
/*--cef(optional_param=callback)--*/
|
||||
virtual void ClearHttpAuthCredentials(
|
||||
CefRefPtr<CefCompletionCallback> callback) = 0;
|
||||
|
||||
///
|
||||
// Clears all active and idle connections that Chromium currently has.
|
||||
// This is only recommended if you have released all other CEF objects but
|
||||
|
@@ -39,12 +39,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/cef_request.h"
|
||||
#include "include/cef_resource_request_handler.h"
|
||||
#include "include/cef_cookie.h"
|
||||
#include "include/cef_web_plugin.h"
|
||||
|
||||
class CefRequestContext;
|
||||
|
||||
///
|
||||
// Implement this interface to provide handler implementations. The handler
|
||||
// instance will not be released until all objects related to the context have
|
||||
@@ -63,6 +62,14 @@ class CefRequestContextHandler : public virtual CefBaseRefCounted {
|
||||
virtual void OnRequestContextInitialized(
|
||||
CefRefPtr<CefRequestContext> request_context) {}
|
||||
|
||||
///
|
||||
// Called on the browser process IO thread to retrieve the cookie manager. If
|
||||
// this method returns NULL the default cookie manager retrievable via
|
||||
// CefRequestContext::GetDefaultCookieManager() will be used.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefCookieManager> GetCookieManager() { return NULL; }
|
||||
|
||||
///
|
||||
// Called on multiple browser process threads before a plugin instance is
|
||||
// loaded. |mime_type| is the mime type of the plugin that will be loaded.
|
||||
@@ -90,37 +97,6 @@ class CefRequestContextHandler : public virtual CefBaseRefCounted {
|
||||
PluginPolicy* plugin_policy) {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the browser process IO thread before a resource request is
|
||||
// initiated. The |browser| and |frame| values represent the source of the
|
||||
// request, and may be NULL for requests originating from service workers or
|
||||
// CefURLRequest. |request| represents the request contents and cannot be
|
||||
// modified in this callback. |is_navigation| will be true if the resource
|
||||
// request is a navigation. |is_download| will be true if the resource request
|
||||
// is a download. |request_initiator| is the origin (scheme + domain) of the
|
||||
// page that initiated the request. Set |disable_default_handling| to true to
|
||||
// disable default handling of the request, in which case it will need to be
|
||||
// handled via CefResourceRequestHandler::GetResourceHandler or it will be
|
||||
// canceled. To allow the resource load to proceed with default handling
|
||||
// return NULL. To specify a handler for the resource return a
|
||||
// CefResourceRequestHandler object. This method will not be called if the
|
||||
// client associated with |browser| returns a non-NULL value from
|
||||
// CefRequestHandler::GetResourceRequestHandler for the same request
|
||||
// (identified by CefRequest::GetIdentifier).
|
||||
///
|
||||
/*--cef(optional_param=browser,optional_param=frame,
|
||||
optional_param=request_initiator)--*/
|
||||
virtual CefRefPtr<CefResourceRequestHandler> GetResourceRequestHandler(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
bool is_navigation,
|
||||
bool is_download,
|
||||
const CefString& request_initiator,
|
||||
bool& disable_default_handling) {
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_REQUEST_CONTEXT_HANDLER_H_
|
||||
|
@@ -45,11 +45,32 @@
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/cef_request.h"
|
||||
#include "include/cef_request_callback.h"
|
||||
#include "include/cef_resource_request_handler.h"
|
||||
#include "include/cef_resource_handler.h"
|
||||
#include "include/cef_response.h"
|
||||
#include "include/cef_response_filter.h"
|
||||
#include "include/cef_ssl_info.h"
|
||||
#include "include/cef_x509_certificate.h"
|
||||
|
||||
///
|
||||
// Callback interface used for asynchronous continuation of url requests.
|
||||
///
|
||||
/*--cef(source=library)--*/
|
||||
class CefRequestCallback : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Continue the url request. If |allow| is true the request will be continued.
|
||||
// Otherwise, the request will be canceled.
|
||||
///
|
||||
/*--cef(capi_name=cont)--*/
|
||||
virtual void Continue(bool allow) = 0;
|
||||
|
||||
///
|
||||
// Cancel the url request.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void Cancel() = 0;
|
||||
};
|
||||
|
||||
///
|
||||
// Callback interface used to select a client certificate for authentication.
|
||||
///
|
||||
@@ -71,7 +92,9 @@ class CefSelectClientCertificateCallback : public virtual CefBaseRefCounted {
|
||||
/*--cef(source=client)--*/
|
||||
class CefRequestHandler : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
typedef cef_return_value_t ReturnValue;
|
||||
typedef cef_termination_status_t TerminationStatus;
|
||||
typedef cef_urlrequest_status_t URLRequestStatus;
|
||||
typedef cef_window_open_disposition_t WindowOpenDisposition;
|
||||
typedef std::vector<CefRefPtr<CefX509Certificate>> X509CertificateList;
|
||||
|
||||
@@ -122,47 +145,107 @@ class CefRequestHandler : public virtual CefBaseRefCounted {
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the browser process IO thread before a resource request is
|
||||
// initiated. The |browser| and |frame| values represent the source of the
|
||||
// request. |request| represents the request contents and cannot be modified
|
||||
// in this callback. |is_navigation| will be true if the resource request is a
|
||||
// navigation. |is_download| will be true if the resource request is a
|
||||
// download. |request_initiator| is the origin (scheme + domain) of the page
|
||||
// that initiated the request. Set |disable_default_handling| to true to
|
||||
// disable default handling of the request, in which case it will need to be
|
||||
// handled via CefResourceRequestHandler::GetResourceHandler or it will be
|
||||
// canceled. To allow the resource load to proceed with default handling
|
||||
// return NULL. To specify a handler for the resource return a
|
||||
// CefResourceRequestHandler object. If this callback returns NULL the same
|
||||
// method will be called on the associated CefRequestContextHandler, if any.
|
||||
// Called on the IO thread before a resource request is loaded. The |request|
|
||||
// object may be modified. Return RV_CONTINUE to continue the request
|
||||
// immediately. Return RV_CONTINUE_ASYNC and call CefRequestCallback::
|
||||
// Continue() at a later time to continue or cancel the request
|
||||
// asynchronously. Return RV_CANCEL to cancel the request immediately.
|
||||
//
|
||||
///
|
||||
/*--cef(optional_param=request_initiator)--*/
|
||||
virtual CefRefPtr<CefResourceRequestHandler> GetResourceRequestHandler(
|
||||
/*--cef(default_retval=RV_CONTINUE)--*/
|
||||
virtual ReturnValue OnBeforeResourceLoad(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
bool is_navigation,
|
||||
bool is_download,
|
||||
const CefString& request_initiator,
|
||||
bool& disable_default_handling) {
|
||||
CefRefPtr<CefRequestCallback> callback) {
|
||||
return RV_CONTINUE;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the IO thread before a resource is loaded. To allow the resource
|
||||
// to load normally return NULL. To specify a handler for the resource return
|
||||
// a CefResourceHandler object. The |request| object should not be modified in
|
||||
// this callback.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefResourceHandler> GetResourceHandler(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the IO thread when a resource load is redirected. The |request|
|
||||
// parameter will contain the old URL and other request-related information.
|
||||
// The |response| parameter will contain the response that resulted in the
|
||||
// redirect. The |new_url| parameter will contain the new URL and can be
|
||||
// changed if desired. The |request| object cannot be modified in this
|
||||
// callback.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnResourceRedirect(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefResponse> response,
|
||||
CefString& new_url) {}
|
||||
|
||||
///
|
||||
// Called on the IO thread when a resource response is received. To allow the
|
||||
// resource to load normally return false. To redirect or retry the resource
|
||||
// modify |request| (url, headers or post body) and return true. The
|
||||
// |response| object cannot be modified in this callback.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool OnResourceResponse(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefResponse> response) {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the IO thread to optionally filter resource response content.
|
||||
// |request| and |response| represent the request and response respectively
|
||||
// and cannot be modified in this callback.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefResponseFilter> GetResourceResponseFilter(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefResponse> response) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the IO thread when a resource load has completed. |request| and
|
||||
// |response| represent the request and response respectively and cannot be
|
||||
// modified in this callback. |status| indicates the load completion status.
|
||||
// |received_content_length| is the number of response bytes actually read.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnResourceLoadComplete(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefResponse> response,
|
||||
URLRequestStatus status,
|
||||
int64 received_content_length) {}
|
||||
|
||||
///
|
||||
// Called on the IO thread when the browser needs credentials from the user.
|
||||
// |origin_url| is the origin making this authentication request. |isProxy|
|
||||
// indicates whether the host is a proxy server. |host| contains the hostname
|
||||
// and |port| contains the port number. |realm| is the realm of the challenge
|
||||
// and may be empty. |scheme| is the authentication scheme used, such as
|
||||
// "basic" or "digest", and will be empty if the source of the request is an
|
||||
// FTP server. Return true to continue the request and call
|
||||
// |isProxy| indicates whether the host is a proxy server. |host| contains the
|
||||
// hostname and |port| contains the port number. |realm| is the realm of the
|
||||
// challenge and may be empty. |scheme| is the authentication scheme used,
|
||||
// such as "basic" or "digest", and will be empty if the source of the request
|
||||
// is an FTP server. Return true to continue the request and call
|
||||
// CefAuthCallback::Continue() either in this method or at a later time when
|
||||
// the authentication information is available. Return false to cancel the
|
||||
// request immediately.
|
||||
///
|
||||
/*--cef(optional_param=realm,optional_param=scheme)--*/
|
||||
virtual bool GetAuthCredentials(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& origin_url,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
bool isProxy,
|
||||
const CefString& host,
|
||||
int port,
|
||||
@@ -172,6 +255,33 @@ class CefRequestHandler : public virtual CefBaseRefCounted {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the IO thread before sending a network request with a "Cookie"
|
||||
// request header. Return true to allow cookies to be included in the network
|
||||
// request or false to block cookies. The |request| object should not be
|
||||
// modified in this callback.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool CanGetCookies(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request) {
|
||||
return true;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the IO thread when receiving a network request with a
|
||||
// "Set-Cookie" response header value represented by |cookie|. Return true to
|
||||
// allow the cookie to be stored or false to block the cookie. The |request|
|
||||
// object should not be modified in this callback.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool CanSetCookie(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
const CefCookie& cookie) {
|
||||
return true;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the IO thread when JavaScript requests a specific storage quota
|
||||
// size via the webkitStorageInfo.requestQuota function. |origin_url| is the
|
||||
@@ -188,6 +298,18 @@ class CefRequestHandler : public virtual CefBaseRefCounted {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the UI thread to handle requests for URLs with an unknown
|
||||
// protocol component. Set |allow_os_execution| to true to attempt execution
|
||||
// via the registered OS protocol handler, if any.
|
||||
// SECURITY WARNING: YOU SHOULD USE THIS METHOD TO ENFORCE RESTRICTIONS BASED
|
||||
// ON SCHEME, HOST OR OTHER URL ANALYSIS BEFORE ALLOWING OS EXECUTION.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnProtocolExecution(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& url,
|
||||
bool& allow_os_execution) {}
|
||||
|
||||
///
|
||||
// Called on the UI thread to handle requests for URLs with an invalid
|
||||
// SSL certificate. Return true and call CefRequestCallback::Continue() either
|
||||
|
@@ -45,79 +45,23 @@
|
||||
#include "include/cef_request.h"
|
||||
#include "include/cef_response.h"
|
||||
|
||||
///
|
||||
// Callback for asynchronous continuation of CefResourceHandler::Skip().
|
||||
///
|
||||
/*--cef(source=library)--*/
|
||||
class CefResourceSkipCallback : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Callback for asynchronous continuation of Skip(). If |bytes_skipped| > 0
|
||||
// then either Skip() will be called again until the requested number of
|
||||
// bytes have been skipped or the request will proceed. If |bytes_skipped|
|
||||
// <= 0 the request will fail with ERR_REQUEST_RANGE_NOT_SATISFIABLE.
|
||||
///
|
||||
/*--cef(capi_name=cont)--*/
|
||||
virtual void Continue(int64 bytes_skipped) = 0;
|
||||
};
|
||||
|
||||
///
|
||||
// Callback for asynchronous continuation of CefResourceHandler::Read().
|
||||
///
|
||||
/*--cef(source=library)--*/
|
||||
class CefResourceReadCallback : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Callback for asynchronous continuation of Read(). If |bytes_read| == 0
|
||||
// the response will be considered complete. If |bytes_read| > 0 then Read()
|
||||
// will be called again until the request is complete (based on either the
|
||||
// result or the expected content length). If |bytes_read| < 0 then the
|
||||
// request will fail and the |bytes_read| value will be treated as the error
|
||||
// code.
|
||||
///
|
||||
/*--cef(capi_name=cont)--*/
|
||||
virtual void Continue(int bytes_read) = 0;
|
||||
};
|
||||
|
||||
///
|
||||
// Class used to implement a custom request handler interface. The methods of
|
||||
// this class will be called on the IO thread unless otherwise indicated.
|
||||
// this class will always be called on the IO thread.
|
||||
///
|
||||
/*--cef(source=client)--*/
|
||||
class CefResourceHandler : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Open the response stream. To handle the request immediately set
|
||||
// |handle_request| to true and return true. To decide at a later time set
|
||||
// |handle_request| to false, return true, and execute |callback| to continue
|
||||
// or cancel the request. To cancel the request immediately set
|
||||
// |handle_request| to true and return false. This method will be called in
|
||||
// sequence but not from a dedicated thread. For backwards compatibility set
|
||||
// |handle_request| to false and return false and the ProcessRequest method
|
||||
// will be called.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool Open(CefRefPtr<CefRequest> request,
|
||||
bool& handle_request,
|
||||
CefRefPtr<CefCallback> callback) {
|
||||
handle_request = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
// Begin processing the request. To handle the request return true and call
|
||||
// CefCallback::Continue() once the response header information is available
|
||||
// (CefCallback::Continue() can also be called from inside this method if
|
||||
// header information is available immediately). To cancel the request return
|
||||
// false.
|
||||
//
|
||||
// WARNING: This method is deprecated. Use Open instead.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool ProcessRequest(CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefCallback> callback) {
|
||||
return false;
|
||||
}
|
||||
CefRefPtr<CefCallback> callback) = 0;
|
||||
|
||||
///
|
||||
// Retrieve response header information. If the response length is not known
|
||||
@@ -139,62 +83,33 @@ class CefResourceHandler : public virtual CefBaseRefCounted {
|
||||
int64& response_length,
|
||||
CefString& redirectUrl) = 0;
|
||||
|
||||
///
|
||||
// Skip response data when requested by a Range header. Skip over and discard
|
||||
// |bytes_to_skip| bytes of response data. If data is available immediately
|
||||
// set |bytes_skipped| to the number of bytes skipped and return true. To
|
||||
// read the data at a later time set |bytes_skipped| to 0, return true and
|
||||
// execute |callback| when the data is available. To indicate failure set
|
||||
// |bytes_skipped| to < 0 (e.g. -2 for ERR_FAILED) and return false. This
|
||||
// method will be called in sequence but not from a dedicated thread.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool Skip(int64 bytes_to_skip,
|
||||
int64& bytes_skipped,
|
||||
CefRefPtr<CefResourceSkipCallback> callback) {
|
||||
bytes_skipped = -2;
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
// Read response data. If data is available immediately copy up to
|
||||
// |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of
|
||||
// bytes copied, and return true. To read the data at a later time keep a
|
||||
// pointer to |data_out|, set |bytes_read| to 0, return true and execute
|
||||
// |callback| when the data is available (|data_out| will remain valid until
|
||||
// the callback is executed). To indicate response completion set |bytes_read|
|
||||
// to 0 and return false. To indicate failure set |bytes_read| to < 0 (e.g. -2
|
||||
// for ERR_FAILED) and return false. This method will be called in sequence
|
||||
// but not from a dedicated thread. For backwards compatibility set
|
||||
// |bytes_read| to -1 and return false and the ReadResponse method will be
|
||||
// called.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool Read(void* data_out,
|
||||
int bytes_to_read,
|
||||
int& bytes_read,
|
||||
CefRefPtr<CefResourceReadCallback> callback) {
|
||||
bytes_read = -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
// Read response data. If data is available immediately copy up to
|
||||
// |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of
|
||||
// bytes copied, and return true. To read the data at a later time set
|
||||
// |bytes_read| to 0, return true and call CefCallback::Continue() when the
|
||||
// data is available. To indicate response completion return false.
|
||||
//
|
||||
// WARNING: This method is deprecated. Use Skip and Read instead.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool ReadResponse(void* data_out,
|
||||
int bytes_to_read,
|
||||
int& bytes_read,
|
||||
CefRefPtr<CefCallback> callback) {
|
||||
bytes_read = -2;
|
||||
return false;
|
||||
}
|
||||
CefRefPtr<CefCallback> callback) = 0;
|
||||
|
||||
///
|
||||
// Return true if the specified cookie can be sent with the request or false
|
||||
// otherwise. If false is returned for any cookie then no cookies will be sent
|
||||
// with the request.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool CanGetCookie(const CefCookie& cookie) { return true; }
|
||||
|
||||
///
|
||||
// Return true if the specified cookie returned with the response can be set
|
||||
// or false otherwise.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool CanSetCookie(const CefCookie& cookie) { return true; }
|
||||
|
||||
///
|
||||
// Request processing has been canceled.
|
||||
|
@@ -1,249 +0,0 @@
|
||||
// Copyright (c) 2011 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_RESOURCE_REQUEST_HANDLER_H_
|
||||
#define CEF_INCLUDE_CEF_RESOURCE_REQUEST_HANDLER_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/cef_request.h"
|
||||
#include "include/cef_request_callback.h"
|
||||
#include "include/cef_resource_handler.h"
|
||||
#include "include/cef_response.h"
|
||||
#include "include/cef_response_filter.h"
|
||||
|
||||
class CefCookieAccessFilter;
|
||||
|
||||
///
|
||||
// Implement this interface to handle events related to browser requests. The
|
||||
// methods of this class will be called on the IO thread unless otherwise
|
||||
// indicated.
|
||||
///
|
||||
/*--cef(source=client,no_debugct_check)--*/
|
||||
class CefResourceRequestHandler : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
typedef cef_return_value_t ReturnValue;
|
||||
typedef cef_urlrequest_status_t URLRequestStatus;
|
||||
|
||||
///
|
||||
// Called on the IO thread before a resource request is loaded. The |browser|
|
||||
// and |frame| values represent the source of the request, and may be NULL for
|
||||
// requests originating from service workers or CefURLRequest. To optionally
|
||||
// filter cookies for the request return a CefCookieAccessFilter object. The
|
||||
// |request| object cannot not be modified in this callback.
|
||||
///
|
||||
/*--cef(optional_param=browser,optional_param=frame)--*/
|
||||
virtual CefRefPtr<CefCookieAccessFilter> GetCookieAccessFilter(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the IO thread before a resource request is loaded. The |browser|
|
||||
// and |frame| values represent the source of the request, and may be NULL for
|
||||
// requests originating from service workers or CefURLRequest. To redirect or
|
||||
// change the resource load optionally modify |request|. Modification of the
|
||||
// request URL will be treated as a redirect. Return RV_CONTINUE to continue
|
||||
// the request immediately. Return RV_CONTINUE_ASYNC and call
|
||||
// CefRequestCallback:: Continue() at a later time to continue or cancel the
|
||||
// request asynchronously. Return RV_CANCEL to cancel the request immediately.
|
||||
//
|
||||
///
|
||||
/*--cef(optional_param=browser,optional_param=frame,
|
||||
default_retval=RV_CONTINUE)--*/
|
||||
virtual ReturnValue OnBeforeResourceLoad(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefRequestCallback> callback) {
|
||||
return RV_CONTINUE;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the IO thread before a resource is loaded. The |browser| and
|
||||
// |frame| values represent the source of the request, and may be NULL for
|
||||
// requests originating from service workers or CefURLRequest. To allow the
|
||||
// resource to load using the default network loader return NULL. To specify a
|
||||
// handler for the resource return a CefResourceHandler object. The |request|
|
||||
// object cannot not be modified in this callback.
|
||||
///
|
||||
/*--cef(optional_param=browser,optional_param=frame)--*/
|
||||
virtual CefRefPtr<CefResourceHandler> GetResourceHandler(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the IO thread when a resource load is redirected. The |browser|
|
||||
// and |frame| values represent the source of the request, and may be NULL for
|
||||
// requests originating from service workers or CefURLRequest. The |request|
|
||||
// parameter will contain the old URL and other request-related information.
|
||||
// The |response| parameter will contain the response that resulted in the
|
||||
// redirect. The |new_url| parameter will contain the new URL and can be
|
||||
// changed if desired. The |request| and |response| objects cannot be modified
|
||||
// in this callback.
|
||||
///
|
||||
/*--cef(optional_param=browser,optional_param=frame)--*/
|
||||
virtual void OnResourceRedirect(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefResponse> response,
|
||||
CefString& new_url) {}
|
||||
|
||||
///
|
||||
// Called on the IO thread when a resource response is received. The |browser|
|
||||
// and |frame| values represent the source of the request, and may be NULL for
|
||||
// requests originating from service workers or CefURLRequest. To allow the
|
||||
// resource load to proceed without modification return false. To redirect or
|
||||
// retry the resource load optionally modify |request| and return true.
|
||||
// Modification of the request URL will be treated as a redirect. Requests
|
||||
// handled using the default network loader cannot be redirected in this
|
||||
// callback. The |response| object cannot be modified in this callback.
|
||||
//
|
||||
// WARNING: Redirecting using this method is deprecated. Use
|
||||
// OnBeforeResourceLoad or GetResourceHandler to perform redirects.
|
||||
///
|
||||
/*--cef(optional_param=browser,optional_param=frame)--*/
|
||||
virtual bool OnResourceResponse(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefResponse> response) {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the IO thread to optionally filter resource response content. The
|
||||
// |browser| and |frame| values represent the source of the request, and may
|
||||
// be NULL for requests originating from service workers or CefURLRequest.
|
||||
// |request| and |response| represent the request and response respectively
|
||||
// and cannot be modified in this callback.
|
||||
///
|
||||
/*--cef(optional_param=browser,optional_param=frame)--*/
|
||||
virtual CefRefPtr<CefResponseFilter> GetResourceResponseFilter(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefResponse> response) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the IO thread when a resource load has completed. The |browser|
|
||||
// and |frame| values represent the source of the request, and may be NULL for
|
||||
// requests originating from service workers or CefURLRequest. |request| and
|
||||
// |response| represent the request and response respectively and cannot be
|
||||
// modified in this callback. |status| indicates the load completion status.
|
||||
// |received_content_length| is the number of response bytes actually read.
|
||||
// This method will be called for all requests, including requests that are
|
||||
// aborted due to CEF shutdown or destruction of the associated browser. In
|
||||
// cases where the associated browser is destroyed this callback may arrive
|
||||
// after the CefLifeSpanHandler::OnBeforeClose callback for that browser. The
|
||||
// CefFrame::IsValid method can be used to test for this situation, and care
|
||||
// should be taken not to call |browser| or |frame| methods that modify state
|
||||
// (like LoadURL, SendProcessMessage, etc.) if the frame is invalid.
|
||||
///
|
||||
/*--cef(optional_param=browser,optional_param=frame)--*/
|
||||
virtual void OnResourceLoadComplete(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefResponse> response,
|
||||
URLRequestStatus status,
|
||||
int64 received_content_length) {}
|
||||
|
||||
///
|
||||
// Called on the IO thread to handle requests for URLs with an unknown
|
||||
// protocol component. The |browser| and |frame| values represent the source
|
||||
// of the request, and may be NULL for requests originating from service
|
||||
// workers or CefURLRequest. |request| cannot be modified in this callback.
|
||||
// Set |allow_os_execution| to true to attempt execution via the registered OS
|
||||
// protocol handler, if any.
|
||||
// SECURITY WARNING: YOU SHOULD USE THIS METHOD TO ENFORCE RESTRICTIONS BASED
|
||||
// ON SCHEME, HOST OR OTHER URL ANALYSIS BEFORE ALLOWING OS EXECUTION.
|
||||
///
|
||||
/*--cef(optional_param=browser,optional_param=frame)--*/
|
||||
virtual void OnProtocolExecution(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
bool& allow_os_execution) {}
|
||||
};
|
||||
|
||||
///
|
||||
// Implement this interface to filter cookies that may be sent or received from
|
||||
// resource requests. The methods of this class will be called on the IO thread
|
||||
// unless otherwise indicated.
|
||||
///
|
||||
/*--cef(source=client,no_debugct_check)--*/
|
||||
class CefCookieAccessFilter : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Called on the IO thread before a resource request is sent. The |browser|
|
||||
// and |frame| values represent the source of the request, and may be NULL for
|
||||
// requests originating from service workers or CefURLRequest. |request|
|
||||
// cannot be modified in this callback. Return true if the specified cookie
|
||||
// can be sent with the request or false otherwise.
|
||||
///
|
||||
/*--cef(optional_param=browser,optional_param=frame)--*/
|
||||
virtual bool CanSendCookie(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
const CefCookie& cookie) {
|
||||
return true;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the IO thread after a resource response is received. The
|
||||
// |browser| and |frame| values represent the source of the request, and may
|
||||
// be NULL for requests originating from service workers or CefURLRequest.
|
||||
// |request| cannot be modified in this callback. Return true if the specified
|
||||
// cookie returned with the response can be saved or false otherwise.
|
||||
///
|
||||
/*--cef(optional_param=browser,optional_param=frame)--*/
|
||||
virtual bool CanSaveCookie(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefResponse> response,
|
||||
const CefCookie& cookie) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_RESOURCE_REQUEST_HANDLER_H_
|
@@ -96,7 +96,7 @@ class CefResponse : public virtual CefBaseRefCounted {
|
||||
///
|
||||
// Set the response status text.
|
||||
///
|
||||
/*--cef(optional_param=statusText)--*/
|
||||
/*--cef()--*/
|
||||
virtual void SetStatusText(const CefString& statusText) = 0;
|
||||
|
||||
///
|
||||
@@ -108,20 +108,8 @@ class CefResponse : public virtual CefBaseRefCounted {
|
||||
///
|
||||
// Set the response mime type.
|
||||
///
|
||||
/*--cef(optional_param=mimeType)--*/
|
||||
virtual void SetMimeType(const CefString& mimeType) = 0;
|
||||
|
||||
///
|
||||
// Get the response charset.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefString GetCharset() = 0;
|
||||
|
||||
///
|
||||
// Set the response charset.
|
||||
///
|
||||
/*--cef(optional_param=charset)--*/
|
||||
virtual void SetCharset(const CefString& charset) = 0;
|
||||
virtual void SetMimeType(const CefString& mimeType) = 0;
|
||||
|
||||
///
|
||||
// Get the value for the specified response header field.
|
||||
@@ -150,7 +138,7 @@ class CefResponse : public virtual CefBaseRefCounted {
|
||||
///
|
||||
// Set the resolved URL after redirects or changed as a result of HSTS.
|
||||
///
|
||||
/*--cef(optional_param=url)--*/
|
||||
/*--cef()--*/
|
||||
virtual void SetURL(const CefString& url) = 0;
|
||||
};
|
||||
|
||||
|
@@ -109,7 +109,7 @@ class CefSchemeHandlerFactory : public virtual CefBaseRefCounted {
|
||||
// will be the browser window and frame respectively that originated the
|
||||
// request or NULL if the request did not originate from a browser window
|
||||
// (for example, if the request came from CefURLRequest). The |request| object
|
||||
// passed to this method cannot be modified.
|
||||
// passed to this method will not contain cookie data.
|
||||
///
|
||||
/*--cef(optional_param=browser,optional_param=frame)--*/
|
||||
virtual CefRefPtr<CefResourceHandler> Create(
|
||||
|
@@ -60,25 +60,19 @@ class CefURLRequest : public virtual CefBaseRefCounted {
|
||||
typedef cef_errorcode_t ErrorCode;
|
||||
|
||||
///
|
||||
// Create a new URL request that is not associated with a specific browser or
|
||||
// frame. Use CefFrame::CreateURLRequest instead if you want the request to
|
||||
// have this association, in which case it may be handled differently (see
|
||||
// documentation on that method). Requests may originate from the both browser
|
||||
// process and the render process.
|
||||
//
|
||||
// For requests originating from the browser process:
|
||||
// - It may be intercepted by the client via CefResourceRequestHandler or
|
||||
// CefSchemeHandlerFactory.
|
||||
// - POST data may only contain only a single element of type PDE_TYPE_FILE
|
||||
// or PDE_TYPE_BYTES.
|
||||
// - If |request_context| is empty the global request context will be used.
|
||||
// For requests originating from the render process:
|
||||
// - It cannot be intercepted by the client so only http(s) and blob schemes
|
||||
// are supported.
|
||||
// - POST data may only contain a single element of type PDE_TYPE_BYTES.
|
||||
// - The |request_context| parameter must be NULL.
|
||||
//
|
||||
// The |request| object will be marked as read-only after calling this method.
|
||||
// Create a new URL request. Only GET, POST, HEAD, DELETE and PUT request
|
||||
// methods are supported. Multiple post data elements are not supported and
|
||||
// elements of type PDE_TYPE_FILE are only supported for requests originating
|
||||
// from the browser process. Requests originating from the render process will
|
||||
// receive the same handling as requests originating from Web content -- if
|
||||
// the response contains Content-Disposition or Mime-Type header values that
|
||||
// would not normally be rendered then the response may receive special
|
||||
// handling inside the browser (for example, via the file download code path
|
||||
// instead of the URL request code path). The |request| object will be marked
|
||||
// as read-only after calling this method. In the browser process if
|
||||
// |request_context| is empty the global request context will be used. In the
|
||||
// render process |request_context| must be empty and the context associated
|
||||
// with the current renderer process' browser will be used.
|
||||
///
|
||||
/*--cef(optional_param=request_context)--*/
|
||||
static CefRefPtr<CefURLRequest> Create(
|
||||
@@ -186,11 +180,8 @@ class CefURLRequestClient : public virtual CefBaseRefCounted {
|
||||
// |isProxy| indicates whether the host is a proxy server. |host| contains the
|
||||
// hostname and |port| contains the port number. Return true to continue the
|
||||
// request and call CefAuthCallback::Continue() when the authentication
|
||||
// information is available. If the request has an associated browser/frame
|
||||
// then returning false will result in a call to GetAuthCredentials on the
|
||||
// CefRequestHandler associated with that browser, if any. Otherwise,
|
||||
// returning false will cancel the request immediately. This method will only
|
||||
// be called for requests initiated from the browser process.
|
||||
// information is available. Return false to cancel the request. This method
|
||||
// will only be called for requests initiated from the browser process.
|
||||
///
|
||||
/*--cef(optional_param=realm)--*/
|
||||
virtual bool GetAuthCredentials(bool isProxy,
|
||||
|
@@ -183,13 +183,6 @@ typedef struct _cef_settings_t {
|
||||
///
|
||||
cef_string_t framework_dir_path;
|
||||
|
||||
///
|
||||
// The path to the main bundle on macOS. If this value is empty then it
|
||||
// defaults to the top-level app bundle. Also configurable using
|
||||
// the "main-bundle-path" command-line switch.
|
||||
///
|
||||
cef_string_t main_bundle_path;
|
||||
|
||||
///
|
||||
// Set to true (1) to have the browser process message loop run in a separate
|
||||
// thread. If false (0) than the CefDoMessageLoopWork() function must be
|
||||
@@ -226,27 +219,15 @@ typedef struct _cef_settings_t {
|
||||
int command_line_args_disabled;
|
||||
|
||||
///
|
||||
// The location where data for the global browser cache will be stored on
|
||||
// disk. If non-empty this must be either equal to or a child directory of
|
||||
// CefSettings.root_cache_path. If empty then browsers will be created in
|
||||
// "incognito mode" where in-memory caches are used for storage and no data is
|
||||
// persisted to disk. HTML5 databases such as localStorage will only persist
|
||||
// across sessions if a cache path is specified. Can be overridden for
|
||||
// individual CefRequestContext instances via the
|
||||
// CefRequestContextSettings.cache_path value.
|
||||
// The location where cache data will be stored on disk. If empty then
|
||||
// browsers will be created in "incognito mode" where in-memory caches are
|
||||
// used for storage and no data is persisted to disk. HTML5 databases such as
|
||||
// localStorage will only persist across sessions if a cache path is
|
||||
// specified. Can be overridden for individual CefRequestContext instances via
|
||||
// the CefRequestContextSettings.cache_path value.
|
||||
///
|
||||
cef_string_t cache_path;
|
||||
|
||||
///
|
||||
// The root directory that all CefSettings.cache_path and
|
||||
// CefRequestContextSettings.cache_path values must have in common. If this
|
||||
// value is empty and CefSettings.cache_path is non-empty then this value will
|
||||
// default to the CefSettings.cache_path value. Failure to set this value
|
||||
// correctly may result in the sandbox blocking read/write access to the
|
||||
// cache_path directory.
|
||||
///
|
||||
cef_string_t root_cache_path;
|
||||
|
||||
///
|
||||
// The location where user data such as spell checking dictionary files will
|
||||
// be stored on disk. If empty then the default platform-specific user data
|
||||
@@ -419,14 +400,6 @@ typedef struct _cef_settings_t {
|
||||
// CefRequestContextSettings.accept_language_list value.
|
||||
///
|
||||
cef_string_t accept_language_list;
|
||||
|
||||
///
|
||||
// GUID string used for identifying the application. This is passed to the
|
||||
// system AV function for scanning downloaded files. By default, the GUID
|
||||
// will be an empty string and the file will be treated as an untrusted
|
||||
// file when the GUID is empty.
|
||||
///
|
||||
cef_string_t application_client_id_for_file_scanning;
|
||||
} cef_settings_t;
|
||||
|
||||
///
|
||||
@@ -440,14 +413,12 @@ typedef struct _cef_request_context_settings_t {
|
||||
size_t size;
|
||||
|
||||
///
|
||||
// The location where cache data for this request context will be stored on
|
||||
// disk. If non-empty this must be either equal to or a child directory of
|
||||
// CefSettings.root_cache_path. If empty then browsers will be created in
|
||||
// "incognito mode" where in-memory caches are used for storage and no data is
|
||||
// persisted to disk. HTML5 databases such as localStorage will only persist
|
||||
// across sessions if a cache path is specified. To share the global browser
|
||||
// cache and related configuration set this value to match the
|
||||
// CefSettings.cache_path value.
|
||||
// The location where cache data will be stored on disk. If empty then
|
||||
// browsers will be created in "incognito mode" where in-memory caches are
|
||||
// used for storage and no data is persisted to disk. HTML5 databases such as
|
||||
// localStorage will only persist across sessions if a cache path is
|
||||
// specified. To share the global browser cache and related configuration set
|
||||
// this value to match the CefSettings.cache_path value.
|
||||
///
|
||||
cef_string_t cache_path;
|
||||
|
||||
@@ -895,16 +866,66 @@ typedef enum {
|
||||
} cef_storage_type_t;
|
||||
|
||||
///
|
||||
// Supported error code values.
|
||||
// Supported error code values. See net\base\net_error_list.h for complete
|
||||
// descriptions of the error codes.
|
||||
///
|
||||
typedef enum {
|
||||
// No error.
|
||||
ERR_NONE = 0,
|
||||
|
||||
#define NET_ERROR(label, value) ERR_ ## label = value,
|
||||
#include "include/base/internal/cef_net_error_list.h"
|
||||
#undef NET_ERROR
|
||||
|
||||
ERR_FAILED = -2,
|
||||
ERR_ABORTED = -3,
|
||||
ERR_INVALID_ARGUMENT = -4,
|
||||
ERR_INVALID_HANDLE = -5,
|
||||
ERR_FILE_NOT_FOUND = -6,
|
||||
ERR_TIMED_OUT = -7,
|
||||
ERR_FILE_TOO_BIG = -8,
|
||||
ERR_UNEXPECTED = -9,
|
||||
ERR_ACCESS_DENIED = -10,
|
||||
ERR_NOT_IMPLEMENTED = -11,
|
||||
ERR_CONNECTION_CLOSED = -100,
|
||||
ERR_CONNECTION_RESET = -101,
|
||||
ERR_CONNECTION_REFUSED = -102,
|
||||
ERR_CONNECTION_ABORTED = -103,
|
||||
ERR_CONNECTION_FAILED = -104,
|
||||
ERR_NAME_NOT_RESOLVED = -105,
|
||||
ERR_INTERNET_DISCONNECTED = -106,
|
||||
ERR_SSL_PROTOCOL_ERROR = -107,
|
||||
ERR_ADDRESS_INVALID = -108,
|
||||
ERR_ADDRESS_UNREACHABLE = -109,
|
||||
ERR_SSL_CLIENT_AUTH_CERT_NEEDED = -110,
|
||||
ERR_TUNNEL_CONNECTION_FAILED = -111,
|
||||
ERR_NO_SSL_VERSIONS_ENABLED = -112,
|
||||
ERR_SSL_VERSION_OR_CIPHER_MISMATCH = -113,
|
||||
ERR_SSL_RENEGOTIATION_REQUESTED = -114,
|
||||
ERR_CERT_COMMON_NAME_INVALID = -200,
|
||||
ERR_CERT_BEGIN = ERR_CERT_COMMON_NAME_INVALID,
|
||||
ERR_CERT_DATE_INVALID = -201,
|
||||
ERR_CERT_AUTHORITY_INVALID = -202,
|
||||
ERR_CERT_CONTAINS_ERRORS = -203,
|
||||
ERR_CERT_NO_REVOCATION_MECHANISM = -204,
|
||||
ERR_CERT_UNABLE_TO_CHECK_REVOCATION = -205,
|
||||
ERR_CERT_REVOKED = -206,
|
||||
ERR_CERT_INVALID = -207,
|
||||
ERR_CERT_WEAK_SIGNATURE_ALGORITHM = -208,
|
||||
// -209 is available: was ERR_CERT_NOT_IN_DNS.
|
||||
ERR_CERT_NON_UNIQUE_NAME = -210,
|
||||
ERR_CERT_WEAK_KEY = -211,
|
||||
ERR_CERT_NAME_CONSTRAINT_VIOLATION = -212,
|
||||
ERR_CERT_VALIDITY_TOO_LONG = -213,
|
||||
ERR_CERT_END = ERR_CERT_VALIDITY_TOO_LONG,
|
||||
ERR_INVALID_URL = -300,
|
||||
ERR_DISALLOWED_URL_SCHEME = -301,
|
||||
ERR_UNKNOWN_URL_SCHEME = -302,
|
||||
ERR_TOO_MANY_REDIRECTS = -310,
|
||||
ERR_UNSAFE_REDIRECT = -311,
|
||||
ERR_UNSAFE_PORT = -312,
|
||||
ERR_INVALID_RESPONSE = -320,
|
||||
ERR_INVALID_CHUNKED_ENCODING = -321,
|
||||
ERR_METHOD_NOT_SUPPORTED = -322,
|
||||
ERR_UNEXPECTED_PROXY_AUTH = -323,
|
||||
ERR_EMPTY_RESPONSE = -324,
|
||||
ERR_RESPONSE_HEADERS_TOO_BIG = -325,
|
||||
ERR_CACHE_MISS = -400,
|
||||
ERR_INSECURE_RESPONSE = -501,
|
||||
} cef_errorcode_t;
|
||||
|
||||
///
|
||||
@@ -2824,7 +2845,7 @@ typedef enum {
|
||||
SSL_CONNECTION_VERSION_TLS1 = 3,
|
||||
SSL_CONNECTION_VERSION_TLS1_1 = 4,
|
||||
SSL_CONNECTION_VERSION_TLS1_2 = 5,
|
||||
SSL_CONNECTION_VERSION_TLS1_3 = 6,
|
||||
// Reserve 6 for TLS 1.3.
|
||||
SSL_CONNECTION_VERSION_QUIC = 7,
|
||||
} cef_ssl_version_t;
|
||||
|
||||
|
@@ -32,27 +32,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "include/base/cef_build.h"
|
||||
#include "include/cef_config.h"
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
|
||||
#if defined(CEF_X11)
|
||||
typedef union _XEvent XEvent;
|
||||
typedef struct _XDisplay XDisplay;
|
||||
#endif
|
||||
|
||||
#include "include/internal/cef_export.h"
|
||||
#include "include/internal/cef_string.h"
|
||||
|
||||
// Handle types.
|
||||
#if defined(CEF_X11)
|
||||
#define cef_cursor_handle_t unsigned long
|
||||
#define cef_event_handle_t XEvent*
|
||||
#else
|
||||
#define cef_cursor_handle_t void*
|
||||
#define cef_event_handle_t void*
|
||||
#endif
|
||||
|
||||
#define cef_window_handle_t unsigned long
|
||||
|
||||
#define kNullCursorHandle 0
|
||||
@@ -67,9 +58,7 @@ extern "C" {
|
||||
// Return the singleton X11 display shared with Chromium. The display is not
|
||||
// thread-safe and must only be accessed on the browser process UI thread.
|
||||
///
|
||||
#if defined(CEF_X11)
|
||||
CEF_EXPORT XDisplay* cef_get_xdisplay();
|
||||
#endif
|
||||
|
||||
///
|
||||
// Structure representing CefExecuteProcess arguments.
|
||||
|
@@ -37,37 +37,29 @@
|
||||
#include "include/internal/cef_string.h"
|
||||
|
||||
// Handle types.
|
||||
// Actually NSCursor*
|
||||
#ifdef __cplusplus
|
||||
#ifdef __OBJC__
|
||||
@class NSCursor;
|
||||
@class NSEvent;
|
||||
@class NSView;
|
||||
#else
|
||||
class NSCursor;
|
||||
class NSEvent;
|
||||
struct NSView;
|
||||
#endif
|
||||
#define cef_cursor_handle_t NSCursor*
|
||||
#define cef_event_handle_t NSEvent*
|
||||
#define cef_window_handle_t NSView*
|
||||
#else
|
||||
#define cef_cursor_handle_t void*
|
||||
// Acutally NSEvent*
|
||||
#define cef_event_handle_t void*
|
||||
// Actually NSView*
|
||||
#define cef_window_handle_t void*
|
||||
#endif
|
||||
|
||||
#define kNullCursorHandle NULL
|
||||
#define kNullEventHandle NULL
|
||||
#define kNullWindowHandle NULL
|
||||
|
||||
#ifdef __OBJC__
|
||||
#if __has_feature(objc_arc)
|
||||
#define CAST_CEF_CURSOR_HANDLE_TO_NSCURSOR(handle) ((__bridge NSCursor*)handle)
|
||||
#define CAST_CEF_EVENT_HANDLE_TO_NSEVENT(handle) ((__bridge NSEvent*)handle)
|
||||
#define CAST_CEF_WINDOW_HANDLE_TO_NSVIEW(handle) ((__bridge NSView*)handle)
|
||||
|
||||
#define CAST_NSCURSOR_TO_CEF_CURSOR_HANDLE(cursor) ((__bridge void*)cursor)
|
||||
#define CAST_NSEVENT_TO_CEF_EVENT_HANDLE(event) ((__bridge void*)event)
|
||||
#define CAST_NSVIEW_TO_CEF_WINDOW_HANDLE(view) ((__bridge void*)view)
|
||||
#else // __has_feature(objc_arc)
|
||||
#define CAST_CEF_CURSOR_HANDLE_TO_NSCURSOR(handle) ((NSCursor*)handle)
|
||||
#define CAST_CEF_EVENT_HANDLE_TO_NSEVENT(handle) ((NSEvent*)handle)
|
||||
#define CAST_CEF_WINDOW_HANDLE_TO_NSVIEW(handle) ((NSView*)handle)
|
||||
|
||||
#define CAST_NSCURSOR_TO_CEF_CURSOR_HANDLE(cursor) ((void*)cursor)
|
||||
#define CAST_NSEVENT_TO_CEF_EVENT_HANDLE(event) ((void*)event)
|
||||
#define CAST_NSVIEW_TO_CEF_WINDOW_HANDLE(view) ((void*)view)
|
||||
#endif // __has_feature(objc_arc)
|
||||
#endif // __OBJC__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@@ -543,9 +543,7 @@ struct CefSettingsTraits {
|
||||
static inline void clear(struct_type* s) {
|
||||
cef_string_clear(&s->browser_subprocess_path);
|
||||
cef_string_clear(&s->framework_dir_path);
|
||||
cef_string_clear(&s->main_bundle_path);
|
||||
cef_string_clear(&s->cache_path);
|
||||
cef_string_clear(&s->root_cache_path);
|
||||
cef_string_clear(&s->user_data_path);
|
||||
cef_string_clear(&s->user_agent);
|
||||
cef_string_clear(&s->product_version);
|
||||
@@ -555,7 +553,6 @@ struct CefSettingsTraits {
|
||||
cef_string_clear(&s->resources_dir_path);
|
||||
cef_string_clear(&s->locales_dir_path);
|
||||
cef_string_clear(&s->accept_language_list);
|
||||
cef_string_clear(&s->application_client_id_for_file_scanning);
|
||||
}
|
||||
|
||||
static inline void set(const struct_type* src,
|
||||
@@ -567,8 +564,6 @@ struct CefSettingsTraits {
|
||||
&target->browser_subprocess_path, copy);
|
||||
cef_string_set(src->framework_dir_path.str, src->framework_dir_path.length,
|
||||
&target->framework_dir_path, copy);
|
||||
cef_string_set(src->main_bundle_path.str, src->main_bundle_path.length,
|
||||
&target->main_bundle_path, copy);
|
||||
target->multi_threaded_message_loop = src->multi_threaded_message_loop;
|
||||
target->external_message_pump = src->external_message_pump;
|
||||
target->windowless_rendering_enabled = src->windowless_rendering_enabled;
|
||||
@@ -576,8 +571,6 @@ struct CefSettingsTraits {
|
||||
|
||||
cef_string_set(src->cache_path.str, src->cache_path.length,
|
||||
&target->cache_path, copy);
|
||||
cef_string_set(src->root_cache_path.str, src->root_cache_path.length,
|
||||
&target->root_cache_path, copy);
|
||||
cef_string_set(src->user_data_path.str, src->user_data_path.length,
|
||||
&target->user_data_path, copy);
|
||||
target->persist_session_cookies = src->persist_session_cookies;
|
||||
@@ -610,9 +603,6 @@ struct CefSettingsTraits {
|
||||
cef_string_set(src->accept_language_list.str,
|
||||
src->accept_language_list.length,
|
||||
&target->accept_language_list, copy);
|
||||
cef_string_set(src->application_client_id_for_file_scanning.str,
|
||||
src->application_client_id_for_file_scanning.length,
|
||||
&target->application_client_id_for_file_scanning, copy);
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -51,19 +51,14 @@ class CefBrowserView : public CefView {
|
||||
public:
|
||||
///
|
||||
// Create a new BrowserView. The underlying CefBrowser will not be created
|
||||
// until this view is added to the views hierarchy. The optional |extra_info|
|
||||
// parameter provides an opportunity to specify extra information specific
|
||||
// to the created browser that will be passed to
|
||||
// CefRenderProcessHandler::OnBrowserCreated() in the render process.
|
||||
// until this view is added to the views hierarchy.
|
||||
///
|
||||
/*--cef(optional_param=client,optional_param=url,
|
||||
optional_param=request_context,optional_param=delegate,
|
||||
optional_param=extra_info)--*/
|
||||
optional_param=request_context,optional_param=delegate)--*/
|
||||
static CefRefPtr<CefBrowserView> CreateBrowserView(
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefString& url,
|
||||
const CefBrowserSettings& settings,
|
||||
CefRefPtr<CefDictionaryValue> extra_info,
|
||||
CefRefPtr<CefRequestContext> request_context,
|
||||
CefRefPtr<CefBrowserViewDelegate> delegate);
|
||||
|
||||
|
@@ -54,12 +54,17 @@ class CefLabelButton : public CefButton {
|
||||
///
|
||||
// Create a new LabelButton. A |delegate| must be provided to handle the
|
||||
// button click. |text| will be shown on the LabelButton and used as the
|
||||
// default accessible name.
|
||||
// default accessible name. If |with_frame| is true the button will have a
|
||||
// visible frame at all times, center alignment, additional padding and a
|
||||
// default minimum size of 70x33 DIP. If |with_frame| is false the button will
|
||||
// only have a visible frame on hover/press, left alignment, less padding and
|
||||
// no default minimum size.
|
||||
///
|
||||
/*--cef(optional_param=text)--*/
|
||||
static CefRefPtr<CefLabelButton> CreateLabelButton(
|
||||
CefRefPtr<CefButtonDelegate> delegate,
|
||||
const CefString& text);
|
||||
const CefString& text,
|
||||
bool with_frame);
|
||||
|
||||
///
|
||||
// Returns this LabelButton as a MenuButton or NULL if this is not a
|
||||
|
@@ -63,7 +63,8 @@ class CefMenuButton : public CefLabelButton {
|
||||
/*--cef(optional_param=text)--*/
|
||||
static CefRefPtr<CefMenuButton> CreateMenuButton(
|
||||
CefRefPtr<CefMenuButtonDelegate> delegate,
|
||||
const CefString& text);
|
||||
const CefString& text,
|
||||
bool with_frame);
|
||||
|
||||
///
|
||||
// Show a menu with contents |menu_model|. |screen_point| specifies the menu
|
||||
|
@@ -97,9 +97,8 @@ class CefScopedArgArray {
|
||||
CefScopedArgArray(int argc, char* argv[]) {
|
||||
// argv should have (argc + 1) elements, the last one always being NULL.
|
||||
array_ = new char*[argc + 1];
|
||||
values_.resize(argc);
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
values_[i] = argv[i];
|
||||
values_.push_back(argv[i]);
|
||||
array_[i] = const_cast<char*>(values_[i].c_str());
|
||||
}
|
||||
array_[argc] = NULL;
|
||||
|
@@ -360,7 +360,6 @@ class CefMessageRouterBrowserSide
|
||||
///
|
||||
virtual bool OnProcessMessageReceived(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message) = 0;
|
||||
|
||||
@@ -416,7 +415,6 @@ class CefMessageRouterRendererSide
|
||||
///
|
||||
virtual bool OnProcessMessageReceived(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message) = 0;
|
||||
|
||||
|
@@ -29,7 +29,7 @@ void CefAudioMirrorDestination::Start() {
|
||||
FROM_HERE, {content::BrowserThread::IO},
|
||||
base::BindOnce(&content::AudioMirroringManager::StartMirroring,
|
||||
base::Unretained(mirroring_manager_),
|
||||
base::RetainedRef(this)));
|
||||
base::Unretained(this)));
|
||||
}
|
||||
|
||||
void CefAudioMirrorDestination::Stop() {
|
||||
@@ -39,7 +39,7 @@ void CefAudioMirrorDestination::Stop() {
|
||||
FROM_HERE, {content::BrowserThread::IO},
|
||||
base::BindOnce(&content::AudioMirroringManager::StopMirroring,
|
||||
base::Unretained(mirroring_manager_),
|
||||
base::RetainedRef(this)));
|
||||
base::Unretained(this)));
|
||||
}
|
||||
|
||||
// Asynchronously query whether this MirroringDestination wants to consume
|
||||
@@ -56,7 +56,7 @@ void CefAudioMirrorDestination::QueryForMatches(
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(&CefAudioMirrorDestination::QueryForMatchesOnUIThread,
|
||||
base::RetainedRef(this), candidates,
|
||||
base::Unretained(this), candidates,
|
||||
media::BindToCurrentLoop(std::move(results_callback))));
|
||||
}
|
||||
|
||||
@@ -68,8 +68,8 @@ void CefAudioMirrorDestination::QueryForMatchesOnUIThread(
|
||||
std::set<content::GlobalFrameRoutingId> matches;
|
||||
for (auto& candidate : candidates) {
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
CefBrowserHostImpl::GetBrowserForFrameRoute(candidate.child_id,
|
||||
candidate.frame_routing_id);
|
||||
CefBrowserHostImpl::GetBrowserForFrame(candidate.child_id,
|
||||
candidate.frame_routing_id);
|
||||
if (browser == browser_) {
|
||||
matches.insert(candidate);
|
||||
}
|
||||
@@ -99,7 +99,7 @@ media::AudioPushSink* CefAudioMirrorDestination::AddPushInput(
|
||||
return new CefAudioPushSink(
|
||||
params, browser_, cef_audio_handler_,
|
||||
base::Bind(&CefAudioMirrorDestination::ReleasePushInput,
|
||||
base::RetainedRef(this)));
|
||||
base::Unretained(this)));
|
||||
}
|
||||
|
||||
void CefAudioMirrorDestination::ReleasePushInput(CefAudioPushSink* sink) {
|
||||
|
@@ -22,13 +22,14 @@ class CefAudioPushSink;
|
||||
class CefBrowserHostImpl;
|
||||
|
||||
class CefAudioMirrorDestination
|
||||
: public base::RefCountedThreadSafe<CefAudioMirrorDestination>,
|
||||
public content::AudioMirroringManager::MirroringDestination {
|
||||
: public content::AudioMirroringManager::MirroringDestination {
|
||||
public:
|
||||
CefAudioMirrorDestination(CefRefPtr<CefBrowserHostImpl> browser,
|
||||
CefRefPtr<CefAudioHandler> cef_audio_handler,
|
||||
content::AudioMirroringManager* mirroring_manager);
|
||||
|
||||
virtual ~CefAudioMirrorDestination() = default;
|
||||
|
||||
// Start mirroring. This needs to be triggered on the IO thread.
|
||||
void Start();
|
||||
|
||||
@@ -64,10 +65,6 @@ class CefAudioMirrorDestination
|
||||
const media::AudioParameters& params) override;
|
||||
|
||||
private:
|
||||
friend class base::RefCountedThreadSafe<CefAudioMirrorDestination>;
|
||||
|
||||
~CefAudioMirrorDestination() override = default;
|
||||
|
||||
void QueryForMatchesOnUIThread(
|
||||
const std::set<content::GlobalFrameRoutingId>& candidates,
|
||||
MatchesCallback results_callback);
|
||||
|
@@ -165,8 +165,8 @@ void CefAudioPushSink::Close() {
|
||||
stop_stream_ = true;
|
||||
cef_audio_handler_->OnAudioStreamStopped(browser_.get(), audio_stream_id_);
|
||||
|
||||
if (!close_callback_.is_null()) {
|
||||
std::move(close_callback_).Run(this);
|
||||
}
|
||||
const CloseCallback& cb = base::ResetAndReturn(&close_callback_);
|
||||
if (!cb.is_null())
|
||||
cb.Run(this);
|
||||
}
|
||||
}
|
||||
|
@@ -1,306 +1,35 @@
|
||||
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Copyright (c) 2015 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_context.h"
|
||||
|
||||
#include <map>
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/download_manager_delegate.h"
|
||||
#include "libcef/browser/extensions/extension_system.h"
|
||||
#include "libcef/browser/prefs/browser_prefs.h"
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
#include "libcef/browser/ssl_host_state_delegate.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
#include "libcef/common/net_service/util.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/lazy_instance.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "chrome/browser/font_family_cache.h"
|
||||
#include "chrome/browser/plugins/chrome_plugin_service_filter.h"
|
||||
#include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
|
||||
#include "components/content_settings/core/browser/host_content_settings_map.h"
|
||||
#include "components/guest_view/browser/guest_view_manager.h"
|
||||
#include "components/keyed_service/content/browser_context_dependency_manager.h"
|
||||
#include "components/keyed_service/core/simple_dependency_manager.h"
|
||||
#include "components/keyed_service/core/simple_key_map.h"
|
||||
#include "components/prefs/pref_service.h"
|
||||
#include "components/proxy_config/pref_proxy_config_tracker_impl.h"
|
||||
#include "components/user_prefs/user_prefs.h"
|
||||
#include "components/visitedlink/browser/visitedlink_event_listener.h"
|
||||
#include "components/visitedlink/browser/visitedlink_master.h"
|
||||
#include "components/zoom/zoom_event_manager.h"
|
||||
#include "content/public/browser/browser_task_traits.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/download_manager.h"
|
||||
#include "content/public/browser/storage_partition.h"
|
||||
#include "extensions/browser/extension_protocols.h"
|
||||
#include "extensions/browser/process_manager.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "net/proxy_resolution/proxy_config_service.h"
|
||||
#include "net/proxy_resolution/proxy_resolution_service.h"
|
||||
|
||||
using content::BrowserThread;
|
||||
|
||||
namespace {
|
||||
|
||||
// Manages the global list of Impl instances.
|
||||
class ImplManager {
|
||||
public:
|
||||
typedef std::vector<CefBrowserContext*> Vector;
|
||||
|
||||
ImplManager() {}
|
||||
~ImplManager() {
|
||||
DCHECK(all_.empty());
|
||||
DCHECK(map_.empty());
|
||||
}
|
||||
|
||||
void AddImpl(CefBrowserContext* impl) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(!IsValidImpl(impl));
|
||||
all_.push_back(impl);
|
||||
}
|
||||
|
||||
void RemoveImpl(CefBrowserContext* impl, const base::FilePath& path) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
Vector::iterator it = GetImplPos(impl);
|
||||
DCHECK(it != all_.end());
|
||||
all_.erase(it);
|
||||
|
||||
if (!path.empty()) {
|
||||
PathMap::iterator it = map_.find(path);
|
||||
DCHECK(it != map_.end());
|
||||
if (it != map_.end())
|
||||
map_.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
bool IsValidImpl(const CefBrowserContext* impl) {
|
||||
CEF_REQUIRE_UIT();
|
||||
return GetImplPos(impl) != all_.end();
|
||||
}
|
||||
|
||||
CefBrowserContext* GetImplForContext(const content::BrowserContext* context) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!context)
|
||||
return NULL;
|
||||
|
||||
Vector::iterator it = all_.begin();
|
||||
for (; it != all_.end(); ++it) {
|
||||
if (*it == context)
|
||||
return *it;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void SetImplPath(CefBrowserContext* impl, const base::FilePath& path) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(!path.empty());
|
||||
DCHECK(IsValidImpl(impl));
|
||||
DCHECK(GetImplForPath(path) == NULL);
|
||||
map_.insert(std::make_pair(path, impl));
|
||||
}
|
||||
|
||||
CefBrowserContext* GetImplForPath(const base::FilePath& path) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(!path.empty());
|
||||
PathMap::const_iterator it = map_.find(path);
|
||||
if (it != map_.end())
|
||||
return it->second;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const Vector GetAllImpl() const { return all_; }
|
||||
|
||||
private:
|
||||
Vector::iterator GetImplPos(const CefBrowserContext* impl) {
|
||||
Vector::iterator it = all_.begin();
|
||||
for (; it != all_.end(); ++it) {
|
||||
if (*it == impl)
|
||||
return it;
|
||||
}
|
||||
return all_.end();
|
||||
}
|
||||
|
||||
typedef std::map<base::FilePath, CefBrowserContext*> PathMap;
|
||||
PathMap map_;
|
||||
|
||||
Vector all_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ImplManager);
|
||||
};
|
||||
|
||||
#if DCHECK_IS_ON()
|
||||
// Because of DCHECK()s in the object destructor.
|
||||
base::LazyInstance<ImplManager>::DestructorAtExit g_manager =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
#else
|
||||
base::LazyInstance<ImplManager>::Leaky g_manager = LAZY_INSTANCE_INITIALIZER;
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
||||
// Creates and manages VisitedLinkEventListener objects for each
|
||||
// CefBrowserContext sharing the same VisitedLinkMaster.
|
||||
class CefVisitedLinkListener : public visitedlink::VisitedLinkMaster::Listener {
|
||||
public:
|
||||
CefVisitedLinkListener() { DCHECK(listener_map_.empty()); }
|
||||
|
||||
void CreateListenerForContext(const CefBrowserContext* context) {
|
||||
CEF_REQUIRE_UIT();
|
||||
auto listener = std::make_unique<visitedlink::VisitedLinkEventListener>(
|
||||
const_cast<CefBrowserContext*>(context));
|
||||
listener_map_.insert(std::make_pair(context, std::move(listener)));
|
||||
}
|
||||
|
||||
void RemoveListenerForContext(const CefBrowserContext* context) {
|
||||
CEF_REQUIRE_UIT();
|
||||
ListenerMap::iterator it = listener_map_.find(context);
|
||||
DCHECK(it != listener_map_.end());
|
||||
listener_map_.erase(it);
|
||||
}
|
||||
|
||||
// visitedlink::VisitedLinkMaster::Listener methods.
|
||||
|
||||
void NewTable(base::ReadOnlySharedMemoryRegion* table_region) override {
|
||||
CEF_REQUIRE_UIT();
|
||||
ListenerMap::iterator it = listener_map_.begin();
|
||||
for (; it != listener_map_.end(); ++it)
|
||||
it->second->NewTable(table_region);
|
||||
}
|
||||
|
||||
void Add(visitedlink::VisitedLinkCommon::Fingerprint fingerprint) override {
|
||||
CEF_REQUIRE_UIT();
|
||||
ListenerMap::iterator it = listener_map_.begin();
|
||||
for (; it != listener_map_.end(); ++it)
|
||||
it->second->Add(fingerprint);
|
||||
}
|
||||
|
||||
void Reset(bool invalidate_hashes) override {
|
||||
CEF_REQUIRE_UIT();
|
||||
ListenerMap::iterator it = listener_map_.begin();
|
||||
for (; it != listener_map_.end(); ++it)
|
||||
it->second->Reset(invalidate_hashes);
|
||||
}
|
||||
|
||||
private:
|
||||
// Map of CefBrowserContext to the associated VisitedLinkEventListener.
|
||||
typedef std::map<const CefBrowserContext*,
|
||||
std::unique_ptr<visitedlink::VisitedLinkEventListener>>
|
||||
ListenerMap;
|
||||
ListenerMap listener_map_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefVisitedLinkListener);
|
||||
};
|
||||
|
||||
CefBrowserContext::CefBrowserContext(const CefRequestContextSettings& settings)
|
||||
: settings_(settings) {
|
||||
g_manager.Get().AddImpl(this);
|
||||
}
|
||||
CefBrowserContext::CefBrowserContext(bool is_proxy)
|
||||
: is_proxy_(is_proxy), extension_system_(NULL) {}
|
||||
|
||||
CefBrowserContext::~CefBrowserContext() {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
// No CefRequestContext should be referencing this object any longer.
|
||||
DCHECK(request_context_set_.empty());
|
||||
|
||||
// Unregister the context first to avoid re-entrancy during shutdown.
|
||||
g_manager.Get().RemoveImpl(this, cache_path_);
|
||||
|
||||
// Send notifications to clean up objects associated with this Profile.
|
||||
MaybeSendDestroyedNotification();
|
||||
|
||||
ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext(
|
||||
resource_context_.get());
|
||||
|
||||
// Remove any BrowserContextKeyedServiceFactory associations. This must be
|
||||
// called before the ProxyService owned by CefBrowserContext is destroyed.
|
||||
// The SimpleDependencyManager should always be passed after the
|
||||
// BrowserContextDependencyManager. This is because the KeyedService instances
|
||||
// in the BrowserContextDependencyManager's dependency graph can depend on the
|
||||
// ones in the SimpleDependencyManager's graph.
|
||||
DependencyManager::PerformInterlockedTwoPhaseShutdown(
|
||||
BrowserContextDependencyManager::GetInstance(), this,
|
||||
SimpleDependencyManager::GetInstance(), key_.get());
|
||||
|
||||
key_.reset();
|
||||
SimpleKeyMap::GetInstance()->Dissociate(this);
|
||||
|
||||
// Shuts down the storage partitions associated with this browser context.
|
||||
// This must be called before the browser context is actually destroyed
|
||||
// and before a clean-up task for its corresponding IO thread residents
|
||||
// (e.g. ResourceContext) is posted, so that the classes that hung on
|
||||
// StoragePartition can have time to do necessary cleanups on IO thread.
|
||||
ShutdownStoragePartitions();
|
||||
|
||||
if (resource_context_.get()) {
|
||||
// Destruction of the ResourceContext will trigger destruction of all
|
||||
// associated URLRequests.
|
||||
content::BrowserThread::DeleteSoon(content::BrowserThread::IO, FROM_HERE,
|
||||
resource_context_.release());
|
||||
}
|
||||
|
||||
visitedlink_listener_->RemoveListenerForContext(this);
|
||||
|
||||
// The FontFamilyCache references the ProxyService so delete it before the
|
||||
// ProxyService is deleted.
|
||||
SetUserData(&kFontFamilyCacheKey, NULL);
|
||||
|
||||
pref_proxy_config_tracker_->DetachFromPrefService();
|
||||
|
||||
if (url_request_getter_)
|
||||
url_request_getter_->ShutdownOnUIThread();
|
||||
if (host_content_settings_map_)
|
||||
host_content_settings_map_->ShutdownOnUIThread();
|
||||
|
||||
// Delete the download manager delegate here because otherwise we'll crash
|
||||
// when it's accessed from the content::BrowserContext destructor.
|
||||
if (download_manager_delegate_)
|
||||
download_manager_delegate_.reset(NULL);
|
||||
// Should be cleared in Shutdown().
|
||||
DCHECK(!resource_context_.get());
|
||||
}
|
||||
|
||||
void CefBrowserContext::Initialize() {
|
||||
CefContext* context = CefContext::Get();
|
||||
|
||||
cache_path_ = base::FilePath(CefString(&settings_.cache_path));
|
||||
if (!context->ValidateCachePath(cache_path_)) {
|
||||
// Reset to in-memory storage.
|
||||
CefString(&settings_.cache_path).clear();
|
||||
cache_path_ = base::FilePath();
|
||||
}
|
||||
|
||||
if (!cache_path_.empty())
|
||||
g_manager.Get().SetImplPath(this, cache_path_);
|
||||
|
||||
if (settings_.accept_language_list.length == 0) {
|
||||
// Use the global language list setting.
|
||||
CefString(&settings_.accept_language_list) =
|
||||
CefString(&context->settings().accept_language_list);
|
||||
}
|
||||
|
||||
if (!!settings_.persist_session_cookies) {
|
||||
set_should_persist_session_cookies(true);
|
||||
}
|
||||
|
||||
key_ = std::make_unique<ProfileKey>(GetPath());
|
||||
SimpleKeyMap::GetInstance()->Associate(this, key_.get());
|
||||
|
||||
// Initialize the PrefService object.
|
||||
pref_service_ = browser_prefs::CreatePrefService(
|
||||
this, cache_path_, !!settings_.persist_user_preferences);
|
||||
|
||||
content::BrowserContext::Initialize(this, GetPath());
|
||||
|
||||
resource_context_.reset(new CefResourceContext(IsOffTheRecord()));
|
||||
resource_context_.reset(
|
||||
new CefResourceContext(IsOffTheRecord(), GetHandler()));
|
||||
|
||||
// This must be called before creating any services to avoid hitting
|
||||
// DependencyManager::AssertContextWasntDestroyed when creating/destroying
|
||||
@@ -312,9 +41,15 @@ void CefBrowserContext::Initialize() {
|
||||
if (extensions_enabled) {
|
||||
// Create the custom ExtensionSystem first because other KeyedServices
|
||||
// depend on it.
|
||||
// The same CefExtensionSystem instance is shared by CefBrowserContextImpl
|
||||
// and CefBrowserContextProxy objects.
|
||||
extension_system_ = static_cast<extensions::CefExtensionSystem*>(
|
||||
extensions::ExtensionSystem::Get(this));
|
||||
extension_system_->InitForRegularProfile(true);
|
||||
if (is_proxy_) {
|
||||
DCHECK(extension_system_->initialized());
|
||||
} else {
|
||||
extension_system_->InitForRegularProfile(true);
|
||||
}
|
||||
resource_context_->set_extensions_info_map(extension_system_->info_map());
|
||||
|
||||
// Make sure the ProcessManager is created so that it receives extension
|
||||
@@ -322,81 +57,52 @@ void CefBrowserContext::Initialize() {
|
||||
// background/event pages.
|
||||
extensions::ProcessManager::Get(this);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize visited links management.
|
||||
base::FilePath visited_link_path;
|
||||
if (!cache_path_.empty())
|
||||
visited_link_path = cache_path_.Append(FILE_PATH_LITERAL("Visited Links"));
|
||||
visitedlink_listener_ = new CefVisitedLinkListener;
|
||||
visitedlink_master_.reset(new visitedlink::VisitedLinkMaster(
|
||||
visitedlink_listener_, this, !visited_link_path.empty(), false,
|
||||
visited_link_path, 0));
|
||||
visitedlink_listener_->CreateListenerForContext(this);
|
||||
visitedlink_master_->Init();
|
||||
|
||||
// Initialize proxy configuration tracker.
|
||||
pref_proxy_config_tracker_.reset(new PrefProxyConfigTrackerImpl(
|
||||
GetPrefs(),
|
||||
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO})));
|
||||
|
||||
void CefBrowserContext::PostInitialize() {
|
||||
// Spell checking support and possibly other subsystems retrieve the
|
||||
// PrefService associated with a BrowserContext via UserPrefs::Get().
|
||||
PrefService* pref_service = GetPrefs();
|
||||
DCHECK(pref_service);
|
||||
user_prefs::UserPrefs::Set(this, pref_service);
|
||||
key_->SetPrefs(pref_service);
|
||||
|
||||
if (extensions_enabled)
|
||||
const bool extensions_enabled = extensions::ExtensionsEnabled();
|
||||
if (extensions_enabled && !is_proxy_)
|
||||
extension_system_->Init();
|
||||
|
||||
ChromePluginServiceFilter::GetInstance()->RegisterResourceContext(
|
||||
this, resource_context_.get());
|
||||
|
||||
if (!net_service::IsEnabled()) {
|
||||
// Create the CefURLRequestContextGetter via an indirect call to
|
||||
// CreateRequestContext. Triggers a call to CefURLRequestContextGetter::
|
||||
// GetURLRequestContext() on the IO thread which creates the
|
||||
// CefURLRequestContext.
|
||||
GetRequestContext();
|
||||
DCHECK(url_request_getter_.get());
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserContext::AddCefRequestContext(CefRequestContextImpl* context) {
|
||||
CEF_REQUIRE_UIT();
|
||||
request_context_set_.insert(context);
|
||||
}
|
||||
|
||||
void CefBrowserContext::RemoveCefRequestContext(
|
||||
CefRequestContextImpl* context) {
|
||||
void CefBrowserContext::Shutdown() {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
extension_system()->OnRequestContextDeleted(context);
|
||||
// Send notifications to clean up objects associated with this Profile.
|
||||
MaybeSendDestroyedNotification();
|
||||
|
||||
ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext(
|
||||
resource_context_.get());
|
||||
|
||||
// Remove any BrowserContextKeyedServiceFactory associations. This must be
|
||||
// called before the ProxyService owned by CefBrowserContextImpl is destroyed.
|
||||
BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(
|
||||
this);
|
||||
|
||||
if (!is_proxy_) {
|
||||
// Shuts down the storage partitions associated with this browser context.
|
||||
// This must be called before the browser context is actually destroyed
|
||||
// and before a clean-up task for its corresponding IO thread residents
|
||||
// (e.g. ResourceContext) is posted, so that the classes that hung on
|
||||
// StoragePartition can have time to do necessary cleanups on IO thread.
|
||||
ShutdownStoragePartitions();
|
||||
}
|
||||
|
||||
request_context_set_.erase(context);
|
||||
|
||||
// Delete ourselves when the reference count reaches zero.
|
||||
if (request_context_set_.empty())
|
||||
delete this;
|
||||
}
|
||||
|
||||
// static
|
||||
CefBrowserContext* CefBrowserContext::GetForCachePath(
|
||||
const base::FilePath& cache_path) {
|
||||
return g_manager.Get().GetImplForPath(cache_path);
|
||||
}
|
||||
|
||||
// static
|
||||
CefBrowserContext* CefBrowserContext::GetForContext(
|
||||
content::BrowserContext* context) {
|
||||
return g_manager.Get().GetImplForContext(context);
|
||||
}
|
||||
|
||||
// static
|
||||
std::vector<CefBrowserContext*> CefBrowserContext::GetAll() {
|
||||
return g_manager.Get().GetAllImpl();
|
||||
if (resource_context_.get()) {
|
||||
// Destruction of the ResourceContext will trigger destruction of all
|
||||
// associated URLRequests.
|
||||
content::BrowserThread::DeleteSoon(content::BrowserThread::IO, FROM_HERE,
|
||||
resource_context_.release());
|
||||
}
|
||||
}
|
||||
|
||||
content::ResourceContext* CefBrowserContext::GetResourceContext() {
|
||||
@@ -410,7 +116,6 @@ CefBrowserContext::GetClientHintsControllerDelegate() {
|
||||
|
||||
net::URLRequestContextGetter* CefBrowserContext::GetRequestContext() {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(!net_service::IsEnabled());
|
||||
return GetDefaultStoragePartition(this)->GetURLRequestContext();
|
||||
}
|
||||
|
||||
@@ -445,250 +150,11 @@ CefBrowserContext::GetURLLoaderFactory() {
|
||||
->GetURLLoaderFactoryForBrowserProcess();
|
||||
}
|
||||
|
||||
base::FilePath CefBrowserContext::GetPath() const {
|
||||
return cache_path_;
|
||||
}
|
||||
|
||||
std::unique_ptr<content::ZoomLevelDelegate>
|
||||
CefBrowserContext::CreateZoomLevelDelegate(
|
||||
const base::FilePath& partition_path) {
|
||||
if (cache_path_.empty())
|
||||
return std::unique_ptr<content::ZoomLevelDelegate>();
|
||||
|
||||
return base::WrapUnique(new ChromeZoomLevelPrefs(
|
||||
GetPrefs(), cache_path_, partition_path,
|
||||
zoom::ZoomEventManager::GetForBrowserContext(this)->GetWeakPtr()));
|
||||
}
|
||||
|
||||
bool CefBrowserContext::IsOffTheRecord() const {
|
||||
// CEF contexts are never flagged as off-the-record. It causes problems
|
||||
// for the extension system.
|
||||
return false;
|
||||
}
|
||||
|
||||
content::DownloadManagerDelegate*
|
||||
CefBrowserContext::GetDownloadManagerDelegate() {
|
||||
if (!download_manager_delegate_) {
|
||||
content::DownloadManager* manager =
|
||||
BrowserContext::GetDownloadManager(this);
|
||||
download_manager_delegate_.reset(new CefDownloadManagerDelegate(manager));
|
||||
}
|
||||
return download_manager_delegate_.get();
|
||||
}
|
||||
|
||||
content::BrowserPluginGuestManager* CefBrowserContext::GetGuestManager() {
|
||||
DCHECK(extensions::ExtensionsEnabled());
|
||||
return guest_view::GuestViewManager::FromBrowserContext(this);
|
||||
}
|
||||
|
||||
storage::SpecialStoragePolicy* CefBrowserContext::GetSpecialStoragePolicy() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content::PushMessagingService* CefBrowserContext::GetPushMessagingService() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content::SSLHostStateDelegate* CefBrowserContext::GetSSLHostStateDelegate() {
|
||||
if (!ssl_host_state_delegate_.get())
|
||||
ssl_host_state_delegate_.reset(new CefSSLHostStateDelegate());
|
||||
return ssl_host_state_delegate_.get();
|
||||
}
|
||||
|
||||
content::PermissionControllerDelegate*
|
||||
CefBrowserContext::GetPermissionControllerDelegate() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
content::BackgroundFetchDelegate*
|
||||
CefBrowserContext::GetBackgroundFetchDelegate() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
content::BackgroundSyncController*
|
||||
CefBrowserContext::GetBackgroundSyncController() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
content::BrowsingDataRemoverDelegate*
|
||||
CefBrowserContext::GetBrowsingDataRemoverDelegate() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
net::URLRequestContextGetter* CefBrowserContext::CreateRequestContext(
|
||||
content::ProtocolHandlerMap* protocol_handlers,
|
||||
content::URLRequestInterceptorScopedVector request_interceptors) {
|
||||
void CefBrowserContext::OnRenderFrameDeleted(int render_process_id,
|
||||
int render_frame_id,
|
||||
bool is_main_frame,
|
||||
bool is_guest_view) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(!net_service::IsEnabled());
|
||||
DCHECK(!url_request_getter_.get());
|
||||
|
||||
auto io_thread_runner =
|
||||
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO});
|
||||
|
||||
// Initialize the proxy configuration service.
|
||||
// TODO(cef): Determine if we can use the Chrome/Mojo implementation from
|
||||
// https://crrev.com/d0d0d050
|
||||
std::unique_ptr<net::ProxyConfigService> base_service(
|
||||
net::ProxyResolutionService::CreateSystemProxyConfigService(
|
||||
io_thread_runner));
|
||||
std::unique_ptr<net::ProxyConfigService> proxy_config_service(
|
||||
pref_proxy_config_tracker_->CreateTrackingProxyConfigService(
|
||||
std::move(base_service)));
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
// Handle only chrome-extension:// requests. CEF does not support
|
||||
// chrome-extension-resource:// requests (it does not store shared extension
|
||||
// data in its installation directory).
|
||||
extensions::InfoMap* extension_info_map = extension_system()->info_map();
|
||||
(*protocol_handlers)[extensions::kExtensionScheme] =
|
||||
extensions::CreateExtensionProtocolHandler(IsOffTheRecord(),
|
||||
extension_info_map);
|
||||
}
|
||||
|
||||
url_request_getter_ = new CefURLRequestContextGetter(
|
||||
settings_, GetPrefs(), io_thread_runner, protocol_handlers,
|
||||
std::move(proxy_config_service), std::move(request_interceptors));
|
||||
return url_request_getter_.get();
|
||||
}
|
||||
|
||||
net::URLRequestContextGetter*
|
||||
CefBrowserContext::CreateRequestContextForStoragePartition(
|
||||
const base::FilePath& partition_path,
|
||||
bool in_memory,
|
||||
content::ProtocolHandlerMap* protocol_handlers,
|
||||
content::URLRequestInterceptorScopedVector request_interceptors) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PrefService* CefBrowserContext::GetPrefs() {
|
||||
return pref_service_.get();
|
||||
}
|
||||
|
||||
const PrefService* CefBrowserContext::GetPrefs() const {
|
||||
return pref_service_.get();
|
||||
}
|
||||
|
||||
ProfileKey* CefBrowserContext::GetProfileKey() const {
|
||||
DCHECK(key_);
|
||||
return key_.get();
|
||||
}
|
||||
|
||||
policy::SchemaRegistryService*
|
||||
CefBrowserContext::GetPolicySchemaRegistryService() {
|
||||
NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
policy::UserCloudPolicyManager* CefBrowserContext::GetUserCloudPolicyManager() {
|
||||
NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
policy::ProfilePolicyConnector* CefBrowserContext::GetProfilePolicyConnector() {
|
||||
NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const policy::ProfilePolicyConnector*
|
||||
CefBrowserContext::GetProfilePolicyConnector() const {
|
||||
NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const CefRequestContextSettings& CefBrowserContext::GetSettings() const {
|
||||
return settings_;
|
||||
}
|
||||
|
||||
HostContentSettingsMap* CefBrowserContext::GetHostContentSettingsMap() {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
if (!host_content_settings_map_.get()) {
|
||||
// The |is_incognito_profile| and |is_guest_profile| arguments are
|
||||
// intentionally set to false as they otherwise limit the types of values
|
||||
// that can be stored in the settings map (for example, default values set
|
||||
// via DefaultProvider::SetWebsiteSetting).
|
||||
host_content_settings_map_ =
|
||||
new HostContentSettingsMap(GetPrefs(), false, false, false);
|
||||
|
||||
// Change the default plugin policy.
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
const std::string& plugin_policy_str =
|
||||
command_line->GetSwitchValueASCII(switches::kPluginPolicy);
|
||||
if (!plugin_policy_str.empty()) {
|
||||
ContentSetting plugin_policy = CONTENT_SETTING_ALLOW;
|
||||
if (base::LowerCaseEqualsASCII(plugin_policy_str,
|
||||
switches::kPluginPolicy_Detect)) {
|
||||
plugin_policy = CONTENT_SETTING_DETECT_IMPORTANT_CONTENT;
|
||||
} else if (base::LowerCaseEqualsASCII(plugin_policy_str,
|
||||
switches::kPluginPolicy_Block)) {
|
||||
plugin_policy = CONTENT_SETTING_BLOCK;
|
||||
}
|
||||
host_content_settings_map_->SetDefaultContentSetting(
|
||||
CONTENT_SETTINGS_TYPE_PLUGINS, plugin_policy);
|
||||
}
|
||||
}
|
||||
return host_content_settings_map_.get();
|
||||
}
|
||||
|
||||
void CefBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) {
|
||||
visitedlink_master_->AddURLs(urls);
|
||||
}
|
||||
|
||||
void CefBrowserContext::RebuildTable(
|
||||
const scoped_refptr<URLEnumerator>& enumerator) {
|
||||
// Called when visited links will not or cannot be loaded from disk.
|
||||
enumerator->OnComplete(true);
|
||||
}
|
||||
|
||||
void CefBrowserContext::OnRenderFrameCreated(
|
||||
CefRequestContextImpl* request_context,
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
bool is_main_frame,
|
||||
bool is_guest_view) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK_GE(render_process_id, 0);
|
||||
DCHECK_GE(render_frame_id, 0);
|
||||
DCHECK_GE(frame_tree_node_id, 0);
|
||||
|
||||
CefRefPtr<CefRequestContextHandler> handler = request_context->GetHandler();
|
||||
if (handler && resource_context_) {
|
||||
DCHECK_GE(render_process_id, 0);
|
||||
// Using base::Unretained() is safe because both this callback and possible
|
||||
// deletion of |resource_context_| will execute on the IO thread, and this
|
||||
// callback will be executed first.
|
||||
CEF_POST_TASK(CEF_IOT, base::Bind(&CefResourceContext::AddHandler,
|
||||
base::Unretained(resource_context_.get()),
|
||||
render_process_id, render_frame_id,
|
||||
frame_tree_node_id, handler));
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserContext::OnRenderFrameDeleted(
|
||||
CefRequestContextImpl* request_context,
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
bool is_main_frame,
|
||||
bool is_guest_view) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK_GE(render_process_id, 0);
|
||||
DCHECK_GE(render_frame_id, 0);
|
||||
DCHECK_GE(frame_tree_node_id, 0);
|
||||
|
||||
CefRefPtr<CefRequestContextHandler> handler = request_context->GetHandler();
|
||||
if (handler && resource_context_) {
|
||||
DCHECK_GE(render_process_id, 0);
|
||||
// Using base::Unretained() is safe because both this callback and possible
|
||||
// deletion of |resource_context_| will execute on the IO thread, and this
|
||||
// callback will be executed first.
|
||||
CEF_POST_TASK(CEF_IOT, base::Bind(&CefResourceContext::RemoveHandler,
|
||||
base::Unretained(resource_context_.get()),
|
||||
render_process_id, render_frame_id,
|
||||
frame_tree_node_id));
|
||||
}
|
||||
|
||||
if (resource_context_ && is_main_frame) {
|
||||
DCHECK_GE(render_process_id, 0);
|
||||
// Using base::Unretained() is safe because both this callback and possible
|
||||
@@ -712,35 +178,3 @@ void CefBrowserContext::OnPurgePluginListCache() {
|
||||
base::Unretained(resource_context_.get()), -1));
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserContext::RegisterSchemeHandlerFactory(
|
||||
const std::string& scheme_name,
|
||||
const std::string& domain_name,
|
||||
CefRefPtr<CefSchemeHandlerFactory> factory) {
|
||||
if (resource_context_) {
|
||||
// Using base::Unretained() is safe because both this callback and possible
|
||||
// deletion of |resource_context_| will execute on the IO thread, and this
|
||||
// callback will be executed first.
|
||||
CEF_POST_TASK(CEF_IOT,
|
||||
base::Bind(&CefResourceContext::RegisterSchemeHandlerFactory,
|
||||
base::Unretained(resource_context_.get()),
|
||||
scheme_name, domain_name, factory));
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserContext::ClearSchemeHandlerFactories() {
|
||||
if (resource_context_) {
|
||||
// Using base::Unretained() is safe because both this callback and possible
|
||||
// deletion of |resource_context_| will execute on the IO thread, and this
|
||||
// callback will be executed first.
|
||||
CEF_POST_TASK(CEF_IOT,
|
||||
base::Bind(&CefResourceContext::ClearSchemeHandlerFactories,
|
||||
base::Unretained(resource_context_.get())));
|
||||
}
|
||||
}
|
||||
|
||||
network::mojom::NetworkContext* CefBrowserContext::GetNetworkContext() {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(net_service::IsEnabled());
|
||||
return GetDefaultStoragePartition(this)->GetNetworkContext();
|
||||
}
|
||||
|
@@ -1,20 +1,16 @@
|
||||
// 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.
|
||||
// Copyright (c) 2013 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_CONTEXT_IMPL_H_
|
||||
#define CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_IMPL_H_
|
||||
#ifndef CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_H_
|
||||
#define CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_request_context_handler.h"
|
||||
#include "libcef/browser/chrome_profile_stub.h"
|
||||
#include "libcef/browser/net/url_request_context_getter.h"
|
||||
#include "libcef/browser/net/url_request_context_getter_impl.h"
|
||||
#include "libcef/browser/resource_context.h"
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "components/proxy_config/pref_proxy_config_tracker.h"
|
||||
#include "components/visitedlink/browser/visitedlink_delegate.h"
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/content_browser_client.h"
|
||||
@@ -24,7 +20,7 @@
|
||||
//
|
||||
// WC = WebContents
|
||||
// Content API representation of a browser. Created by BHI or the system (for
|
||||
// popups) and owned by BHI. Keeps a pointer to BC.
|
||||
// popups) and owned by BHI. Keeps a pointer to BCI/BCP.
|
||||
//
|
||||
// BHI = CefBrowserHostImpl
|
||||
// Implements the CefBrowser and CefBrowserHost interfaces which are exposed
|
||||
@@ -33,32 +29,56 @@
|
||||
//
|
||||
// RCI = CefRequestContextImpl
|
||||
// Implements the CefRequestContext interface which is exposed to clients.
|
||||
// References the isolated BC.
|
||||
// References the isolated BCI or creates a new BCP.
|
||||
//
|
||||
// BC = CefBrowserContext
|
||||
// BCI = CefBrowserContextImpl
|
||||
// Entry point from WC when using an isolated RCI. Owns the RC and creates the
|
||||
// SPI indirectly. Owned by CefBrowserMainParts for the global context or RCI
|
||||
// for non-global contexts.
|
||||
//
|
||||
// BCP = CefBrowserContextProxy
|
||||
// Entry point from WC when using a custom RCI. Owns the RC and creates the
|
||||
// URCGP and SPP. Owned by RCI.
|
||||
//
|
||||
// SPI = content::StoragePartitionImpl
|
||||
// Owns storage-related objects like Quota, IndexedDB, Cache, etc. Created by
|
||||
// StoragePartitionImplMap::Get(). Provides access to the URCG. Life span is
|
||||
// controlled indirectly by BC.
|
||||
// StoragePartitionImplMap::Get(). Provides access to the URCGI. Life span is
|
||||
// controlled indirectly by BCI.
|
||||
//
|
||||
// SPP = CefStoragePartitionProxy
|
||||
// Forwards requests for storage-related objects to SPI. Created by
|
||||
// GetStoragePartitionFromConfig() calling BCI::GetStoragePartitionProxy().
|
||||
// Provides access to the URCGP. Life span is controlled by BCP.
|
||||
//
|
||||
// RC = CefResourceContext
|
||||
// Acts as a bridge for resource loading. URLRequest life span is tied to this
|
||||
// object. Must be destroyed before the associated URCG. Life span is
|
||||
// controlled by BC.
|
||||
// object. Must be destroyed before the associated URCGI/URCGP. Life span is
|
||||
// controlled by BCI/BCP.
|
||||
//
|
||||
// URCG = CefURLRequestContextGetter
|
||||
// Creates and owns the URC. Created by StoragePartitionImplMap::Get()
|
||||
// calling BC::CreateRequestContext(). Life span is controlled by RC and (for
|
||||
// URCGI = CefURLRequestContextGetterImpl
|
||||
// Creates and owns the URCI. Created by StoragePartitionImplMap::Get()
|
||||
// calling BCI::CreateRequestContext(). Life span is controlled by RC and (for
|
||||
// the global context) CefBrowserMainParts, and SPI.
|
||||
//
|
||||
// URC = CefURLRequestContext
|
||||
// URCGP = CefURLRequestContextGetterProxy
|
||||
// Creates and owns the URCP. Created by GetStoragePartitionFromConfig()
|
||||
// calling BCI::GetStoragePartitionProxy(). Life span is controlled by RC and
|
||||
// SPP.
|
||||
//
|
||||
// URCI = CefURLRequestContextImpl
|
||||
// Owns various network-related objects including the isolated cookie manager.
|
||||
// Owns URLRequest objects which must be destroyed first. Life span is
|
||||
// controlled by URCG.
|
||||
// controlled by URCGI.
|
||||
//
|
||||
// URCP = CefURLRequestContextProxy
|
||||
// Creates the CSP and forwards requests to the objects owned by URCI. Owns
|
||||
// URLRequest objects which must be destroyed first. Life span is controlled
|
||||
// by URCGP.
|
||||
//
|
||||
// CSP = CefCookieStoreProxy
|
||||
// Gives the CefCookieManager instance retrieved via CefRequestContextHandler
|
||||
// an opportunity to handle cookie requests. Otherwise forwards requests via
|
||||
// URCI to the isolated cookie manager. Life span is controlled by URCP.
|
||||
//
|
||||
//
|
||||
// Relationship diagram:
|
||||
@@ -66,13 +86,17 @@
|
||||
// own = ownership (std::unique_ptr)
|
||||
// ptr = raw pointer
|
||||
//
|
||||
// CefBrowserMainParts--\ isolated cookie manager, etc.
|
||||
// | \ ^
|
||||
// own ref ref/own
|
||||
// v v |
|
||||
// BHI -own-> WC -ptr-> BC -own-> SPI -ref-> URCG --own-> URC
|
||||
// CefBrowserMainParts----\ isolated cookie manager, etc.
|
||||
// | \ ^
|
||||
// own ref ref/own
|
||||
// v v |
|
||||
// /---> BCI -own-> SPI -ref-> URCGI --own-> URCI <-ptr-- CSP
|
||||
// / ^ ^ ^ ^
|
||||
// ptr ptr ptr ref /
|
||||
// / | | | /
|
||||
// BHI -own-> WC -ptr-> BCP -own-> SPP -ref-> URCGP -own-> URCP --ref-/
|
||||
//
|
||||
// BHI -ref-> RCI -own-> BC -own-> RC -ref-> URCG
|
||||
// BHI -ref-> RCI -own-> BCI/BCP -own-> RC -ref-> URCGI/URCGP
|
||||
//
|
||||
//
|
||||
// How shutdown works:
|
||||
@@ -80,24 +104,21 @@
|
||||
// ref release, etc.
|
||||
// 2. CefRequestContextImpl is destroyed (possibly asynchronously) on the UI
|
||||
// thread due to CefBrowserHostImpl destruction, ref release, etc.
|
||||
// 3. CefBrowserContext is destroyed on the UI thread due to
|
||||
// CefRequestContextImpl destruction or deletion in
|
||||
// CefBrowserMainParts::PostMainMessageLoopRun().
|
||||
// 3. CefBrowserContext* is destroyed on the UI thread due to
|
||||
// CefRequestContextImpl destruction (*Impl, *Proxy) or deletion in
|
||||
// CefBrowserMainParts::PostMainMessageLoopRun() (*Impl).
|
||||
// 4. CefResourceContext is destroyed asynchronously on the IO thread due to
|
||||
// CefBrowserContext destruction. This cancels/destroys any pending
|
||||
// CefBrowserContext* destruction. This cancels/destroys any pending
|
||||
// URLRequests.
|
||||
// 5. CefURLRequestContextGetter is destroyed asynchronously on the IO thread
|
||||
// due to CefResourceContext destruction (or ref release in
|
||||
// CefBrowserMainParts::PostMainMessageLoopRun. This may be delayed if other
|
||||
// network-related objects still have a reference to it.
|
||||
// 6. CefURLRequestContext is destroyed on the IO thread due to
|
||||
// CefURLRequestContextGetter destruction.
|
||||
// 5. CefURLRequestContextGetter* is destroyed asynchronously on the IO thread
|
||||
// due to CefResourceContext destruction (*Impl, *Proxy) or ref release in
|
||||
// CefBrowserMainParts::PostMainMessageLoopRun() (*Impl). This may be delayed
|
||||
// if other network-related objects still have a reference to it.
|
||||
// 6. CefURLRequestContext* is destroyed on the IO thread due to
|
||||
// CefURLRequestContextGetter* destruction.
|
||||
*/
|
||||
|
||||
class CefDownloadManagerDelegate;
|
||||
class CefRequestContextImpl;
|
||||
class CefSSLHostStateDelegate;
|
||||
class CefVisitedLinkListener;
|
||||
class HostContentSettingsMap;
|
||||
class PrefService;
|
||||
|
||||
@@ -105,35 +126,15 @@ namespace extensions {
|
||||
class CefExtensionSystem;
|
||||
}
|
||||
|
||||
namespace visitedlink {
|
||||
class VisitedLinkMaster;
|
||||
}
|
||||
|
||||
// Main entry point for configuring behavior on a per-browser basis. An instance
|
||||
// of this class is passed to WebContents::Create in CefBrowserHostImpl::
|
||||
// CreateInternal. Only accessed on the UI thread unless otherwise indicated.
|
||||
class CefBrowserContext : public ChromeProfileStub,
|
||||
public visitedlink::VisitedLinkDelegate {
|
||||
class CefBrowserContext : public ChromeProfileStub {
|
||||
public:
|
||||
explicit CefBrowserContext(const CefRequestContextSettings& settings);
|
||||
|
||||
// Returns the existing instance, if any, associated with the specified
|
||||
// |cache_path|.
|
||||
static CefBrowserContext* GetForCachePath(const base::FilePath& cache_path);
|
||||
|
||||
// Returns the underlying CefBrowserContext if any.
|
||||
static CefBrowserContext* GetForContext(content::BrowserContext* context);
|
||||
|
||||
// Returns all existing CefBrowserContext.
|
||||
static std::vector<CefBrowserContext*> GetAll();
|
||||
explicit CefBrowserContext(bool is_proxy);
|
||||
|
||||
// Must be called immediately after this object is created.
|
||||
void Initialize();
|
||||
|
||||
// Track associated CefRequestContextImpl objects. This object will delete
|
||||
// itself when the count reaches zero.
|
||||
void AddCefRequestContext(CefRequestContextImpl* context);
|
||||
void RemoveCefRequestContext(CefRequestContextImpl* context);
|
||||
virtual void Initialize();
|
||||
|
||||
// BrowserContext methods.
|
||||
content::ResourceContext* GetResourceContext() override;
|
||||
@@ -149,82 +150,37 @@ class CefBrowserContext : public ChromeProfileStub,
|
||||
std::vector<network::mojom::CorsOriginPatternPtr> allow_patterns,
|
||||
std::vector<network::mojom::CorsOriginPatternPtr> block_patterns,
|
||||
base::OnceClosure closure) override;
|
||||
base::FilePath GetPath() const override;
|
||||
std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(
|
||||
const base::FilePath& partition_path) override;
|
||||
bool IsOffTheRecord() const override;
|
||||
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
|
||||
content::BrowserPluginGuestManager* GetGuestManager() override;
|
||||
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
|
||||
content::PushMessagingService* GetPushMessagingService() override;
|
||||
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
|
||||
content::PermissionControllerDelegate* GetPermissionControllerDelegate()
|
||||
override;
|
||||
content::BackgroundFetchDelegate* GetBackgroundFetchDelegate() override;
|
||||
content::BackgroundSyncController* GetBackgroundSyncController() override;
|
||||
content::BrowsingDataRemoverDelegate* GetBrowsingDataRemoverDelegate()
|
||||
override;
|
||||
net::URLRequestContextGetter* CreateRequestContext(
|
||||
content::ProtocolHandlerMap* protocol_handlers,
|
||||
content::URLRequestInterceptorScopedVector request_interceptors) override;
|
||||
net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
|
||||
const base::FilePath& partition_path,
|
||||
bool in_memory,
|
||||
content::ProtocolHandlerMap* protocol_handlers,
|
||||
content::URLRequestInterceptorScopedVector request_interceptors) override;
|
||||
|
||||
// Profile methods.
|
||||
ChromeZoomLevelPrefs* GetZoomLevelPrefs() override;
|
||||
scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory() override;
|
||||
PrefService* GetPrefs() override;
|
||||
bool AllowsBrowserWindows() const override { return false; }
|
||||
const PrefService* GetPrefs() const override;
|
||||
ProfileKey* GetProfileKey() const override;
|
||||
policy::SchemaRegistryService* GetPolicySchemaRegistryService() override;
|
||||
policy::UserCloudPolicyManager* GetUserCloudPolicyManager() override;
|
||||
policy::ProfilePolicyConnector* GetProfilePolicyConnector() override;
|
||||
const policy::ProfilePolicyConnector* GetProfilePolicyConnector()
|
||||
const override;
|
||||
|
||||
// Values checked in ProfileNetworkContextService::CreateNetworkContextParams
|
||||
// when creating the NetworkContext.
|
||||
bool ShouldRestoreOldSessionCookies() override {
|
||||
return should_persist_session_cookies_;
|
||||
}
|
||||
bool ShouldPersistSessionCookies() override {
|
||||
return should_persist_session_cookies_;
|
||||
}
|
||||
base::Optional<std::vector<std::string>> GetCookieableSchemes() override {
|
||||
return cookieable_schemes_;
|
||||
}
|
||||
|
||||
// visitedlink::VisitedLinkDelegate methods.
|
||||
void RebuildTable(const scoped_refptr<URLEnumerator>& enumerator) override;
|
||||
// Returns a RequestContext associated with this object. If this object is a
|
||||
// *Proxy then it will return the single associated proxy RequestContext. If
|
||||
// this object is an *Impl then it will return the first non-proxy
|
||||
// RequestContext, if one exists, otherwise the first proxy RequestContext.
|
||||
virtual CefRequestContextImpl* GetCefRequestContext() const = 0;
|
||||
|
||||
// Returns the settings associated with this object. Safe to call from any
|
||||
// thread.
|
||||
const CefRequestContextSettings& GetSettings() const;
|
||||
virtual const CefRequestContextSettings& GetSettings() const = 0;
|
||||
|
||||
// Returns the handler associated with this object. Safe to call from any
|
||||
// thread.
|
||||
virtual CefRefPtr<CefRequestContextHandler> GetHandler() const = 0;
|
||||
|
||||
// Settings for plugins and extensions.
|
||||
HostContentSettingsMap* GetHostContentSettingsMap();
|
||||
virtual HostContentSettingsMap* GetHostContentSettingsMap() = 0;
|
||||
|
||||
// Called from CefBrowserHostImpl::DidNavigateAnyFrame to update the table of
|
||||
// visited links.
|
||||
void AddVisitedURLs(const std::vector<GURL>& urls);
|
||||
virtual void AddVisitedURLs(const std::vector<GURL>& urls) = 0;
|
||||
|
||||
// Called from CefRequestContextImpl::OnRenderFrameCreated.
|
||||
void OnRenderFrameCreated(CefRequestContextImpl* request_context,
|
||||
int render_process_id,
|
||||
// Called from CefBrowserHostImpl::RenderFrameDeleted or
|
||||
// CefMimeHandlerViewGuestDelegate::OnGuestDetached when a render frame is
|
||||
// deleted.
|
||||
void OnRenderFrameDeleted(int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
bool is_main_frame,
|
||||
bool is_guest_view);
|
||||
|
||||
// Called from CefRequestContextImpl::OnRenderFrameDeleted.
|
||||
void OnRenderFrameDeleted(CefRequestContextImpl* request_context,
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
bool is_main_frame,
|
||||
bool is_guest_view);
|
||||
|
||||
@@ -232,22 +188,6 @@ class CefBrowserContext : public ChromeProfileStub,
|
||||
// plugin list cache should be purged.
|
||||
void OnPurgePluginListCache();
|
||||
|
||||
// Called from CefRequestContextImpl methods of the same name.
|
||||
void RegisterSchemeHandlerFactory(const std::string& scheme_name,
|
||||
const std::string& domain_name,
|
||||
CefRefPtr<CefSchemeHandlerFactory> factory);
|
||||
void ClearSchemeHandlerFactories();
|
||||
|
||||
network::mojom::NetworkContext* GetNetworkContext();
|
||||
|
||||
void set_should_persist_session_cookies(bool value) {
|
||||
should_persist_session_cookies_ = value;
|
||||
}
|
||||
void set_cookieable_schemes(
|
||||
base::Optional<std::vector<std::string>> schemes) {
|
||||
cookieable_schemes_ = schemes;
|
||||
}
|
||||
|
||||
CefResourceContext* resource_context() const {
|
||||
return resource_context_.get();
|
||||
}
|
||||
@@ -255,47 +195,27 @@ class CefBrowserContext : public ChromeProfileStub,
|
||||
return extension_system_;
|
||||
}
|
||||
|
||||
// Guaranteed to exist once this object has been initialized.
|
||||
scoped_refptr<CefURLRequestContextGetter> request_context_getter() const {
|
||||
return url_request_getter_;
|
||||
}
|
||||
|
||||
private:
|
||||
// Allow deletion via std::unique_ptr().
|
||||
friend std::default_delete<CefBrowserContext>;
|
||||
bool is_proxy() const { return is_proxy_; }
|
||||
|
||||
protected:
|
||||
~CefBrowserContext() override;
|
||||
|
||||
// Members initialized during construction are safe to access from any thread.
|
||||
CefRequestContextSettings settings_;
|
||||
base::FilePath cache_path_;
|
||||
// Must be called after all services have been initialized.
|
||||
void PostInitialize();
|
||||
|
||||
// CefRequestContextImpl objects referencing this object.
|
||||
std::set<CefRequestContextImpl*> request_context_set_;
|
||||
// Must be called before the child object destructor has completed.
|
||||
void Shutdown();
|
||||
|
||||
std::unique_ptr<PrefService> pref_service_;
|
||||
std::unique_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
|
||||
|
||||
std::unique_ptr<CefDownloadManagerDelegate> download_manager_delegate_;
|
||||
scoped_refptr<CefURLRequestContextGetter> url_request_getter_;
|
||||
std::unique_ptr<CefSSLHostStateDelegate> ssl_host_state_delegate_;
|
||||
scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
|
||||
std::unique_ptr<visitedlink::VisitedLinkMaster> visitedlink_master_;
|
||||
// |visitedlink_listener_| is owned by visitedlink_master_.
|
||||
CefVisitedLinkListener* visitedlink_listener_;
|
||||
bool should_persist_session_cookies_ = false;
|
||||
base::Optional<std::vector<std::string>> cookieable_schemes_;
|
||||
private:
|
||||
// True if this CefBrowserContext is a CefBrowserContextProxy.
|
||||
const bool is_proxy_;
|
||||
|
||||
std::unique_ptr<CefResourceContext> resource_context_;
|
||||
|
||||
// Owned by the KeyedService system.
|
||||
extensions::CefExtensionSystem* extension_system_ = nullptr;
|
||||
|
||||
// The key to index KeyedService instances created by
|
||||
// SimpleKeyedServiceFactory.
|
||||
std::unique_ptr<ProfileKey> key_;
|
||||
extensions::CefExtensionSystem* extension_system_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserContext);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_IMPL_H_
|
||||
#endif // CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_H_
|
||||
|
558
libcef/browser/browser_context_impl.cc
Normal file
558
libcef/browser/browser_context_impl.cc
Normal file
@@ -0,0 +1,558 @@
|
||||
// Copyright (c) 2012 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_context_impl.h"
|
||||
|
||||
#include <map>
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/browser_context_proxy.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/download_manager_delegate.h"
|
||||
#include "libcef/browser/extensions/extension_system.h"
|
||||
#include "libcef/browser/prefs/browser_prefs.h"
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
#include "libcef/browser/ssl_host_state_delegate.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/lazy_instance.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "chrome/browser/font_family_cache.h"
|
||||
#include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
|
||||
#include "components/content_settings/core/browser/host_content_settings_map.h"
|
||||
#include "components/guest_view/browser/guest_view_manager.h"
|
||||
#include "components/prefs/pref_service.h"
|
||||
#include "components/proxy_config/pref_proxy_config_tracker_impl.h"
|
||||
#include "components/visitedlink/browser/visitedlink_event_listener.h"
|
||||
#include "components/visitedlink/browser/visitedlink_master.h"
|
||||
#include "components/zoom/zoom_event_manager.h"
|
||||
#include "content/public/browser/browser_task_traits.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/download_manager.h"
|
||||
#include "content/public/browser/storage_partition.h"
|
||||
#include "extensions/browser/extension_protocols.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "net/proxy_resolution/proxy_config_service.h"
|
||||
#include "net/proxy_resolution/proxy_resolution_service.h"
|
||||
|
||||
using content::BrowserThread;
|
||||
|
||||
namespace {
|
||||
|
||||
// Manages the global list of Impl instances.
|
||||
class ImplManager {
|
||||
public:
|
||||
typedef std::vector<CefBrowserContextImpl*> Vector;
|
||||
|
||||
ImplManager() {}
|
||||
~ImplManager() {
|
||||
DCHECK(all_.empty());
|
||||
DCHECK(map_.empty());
|
||||
}
|
||||
|
||||
void AddImpl(CefBrowserContextImpl* impl) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(!IsValidImpl(impl));
|
||||
all_.push_back(impl);
|
||||
}
|
||||
|
||||
void RemoveImpl(CefBrowserContextImpl* impl, const base::FilePath& path) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
Vector::iterator it = GetImplPos(impl);
|
||||
DCHECK(it != all_.end());
|
||||
all_.erase(it);
|
||||
|
||||
if (!path.empty()) {
|
||||
PathMap::iterator it = map_.find(path);
|
||||
DCHECK(it != map_.end());
|
||||
if (it != map_.end())
|
||||
map_.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
bool IsValidImpl(const CefBrowserContextImpl* impl) {
|
||||
CEF_REQUIRE_UIT();
|
||||
return GetImplPos(impl) != all_.end();
|
||||
}
|
||||
|
||||
CefBrowserContextImpl* GetImplForContext(
|
||||
const content::BrowserContext* context) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!context)
|
||||
return NULL;
|
||||
|
||||
const CefBrowserContext* cef_context =
|
||||
static_cast<const CefBrowserContext*>(context);
|
||||
const CefBrowserContextImpl* cef_context_impl = nullptr;
|
||||
if (cef_context->is_proxy()) {
|
||||
cef_context_impl =
|
||||
static_cast<const CefBrowserContextProxy*>(cef_context)->parent();
|
||||
} else {
|
||||
cef_context_impl = static_cast<const CefBrowserContextImpl*>(cef_context);
|
||||
}
|
||||
|
||||
Vector::iterator it = all_.begin();
|
||||
for (; it != all_.end(); ++it) {
|
||||
if (*it == cef_context_impl)
|
||||
return *it;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void SetImplPath(CefBrowserContextImpl* impl, const base::FilePath& path) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(!path.empty());
|
||||
DCHECK(IsValidImpl(impl));
|
||||
DCHECK(GetImplForPath(path) == NULL);
|
||||
map_.insert(std::make_pair(path, impl));
|
||||
}
|
||||
|
||||
CefBrowserContextImpl* GetImplForPath(const base::FilePath& path) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(!path.empty());
|
||||
PathMap::const_iterator it = map_.find(path);
|
||||
if (it != map_.end())
|
||||
return it->second;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const Vector GetAllImpl() const { return all_; }
|
||||
|
||||
private:
|
||||
Vector::iterator GetImplPos(const CefBrowserContextImpl* impl) {
|
||||
Vector::iterator it = all_.begin();
|
||||
for (; it != all_.end(); ++it) {
|
||||
if (*it == impl)
|
||||
return it;
|
||||
}
|
||||
return all_.end();
|
||||
}
|
||||
|
||||
typedef std::map<base::FilePath, CefBrowserContextImpl*> PathMap;
|
||||
PathMap map_;
|
||||
|
||||
Vector all_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ImplManager);
|
||||
};
|
||||
|
||||
#if DCHECK_IS_ON()
|
||||
// Because of DCHECK()s in the object destructor.
|
||||
base::LazyInstance<ImplManager>::DestructorAtExit g_manager =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
#else
|
||||
base::LazyInstance<ImplManager>::Leaky g_manager = LAZY_INSTANCE_INITIALIZER;
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
||||
// Creates and manages VisitedLinkEventListener objects for each
|
||||
// CefBrowserContext sharing the same VisitedLinkMaster.
|
||||
class CefVisitedLinkListener : public visitedlink::VisitedLinkMaster::Listener {
|
||||
public:
|
||||
CefVisitedLinkListener() { DCHECK(listener_map_.empty()); }
|
||||
|
||||
void CreateListenerForContext(const CefBrowserContext* context) {
|
||||
CEF_REQUIRE_UIT();
|
||||
auto listener = std::make_unique<visitedlink::VisitedLinkEventListener>(
|
||||
const_cast<CefBrowserContext*>(context));
|
||||
listener_map_.insert(std::make_pair(context, std::move(listener)));
|
||||
}
|
||||
|
||||
void RemoveListenerForContext(const CefBrowserContext* context) {
|
||||
CEF_REQUIRE_UIT();
|
||||
ListenerMap::iterator it = listener_map_.find(context);
|
||||
DCHECK(it != listener_map_.end());
|
||||
listener_map_.erase(it);
|
||||
}
|
||||
|
||||
// visitedlink::VisitedLinkMaster::Listener methods.
|
||||
|
||||
void NewTable(base::ReadOnlySharedMemoryRegion* table_region) override {
|
||||
CEF_REQUIRE_UIT();
|
||||
ListenerMap::iterator it = listener_map_.begin();
|
||||
for (; it != listener_map_.end(); ++it)
|
||||
it->second->NewTable(table_region);
|
||||
}
|
||||
|
||||
void Add(visitedlink::VisitedLinkCommon::Fingerprint fingerprint) override {
|
||||
CEF_REQUIRE_UIT();
|
||||
ListenerMap::iterator it = listener_map_.begin();
|
||||
for (; it != listener_map_.end(); ++it)
|
||||
it->second->Add(fingerprint);
|
||||
}
|
||||
|
||||
void Reset(bool invalidate_hashes) override {
|
||||
CEF_REQUIRE_UIT();
|
||||
ListenerMap::iterator it = listener_map_.begin();
|
||||
for (; it != listener_map_.end(); ++it)
|
||||
it->second->Reset(invalidate_hashes);
|
||||
}
|
||||
|
||||
private:
|
||||
// Map of CefBrowserContext to the associated VisitedLinkEventListener.
|
||||
typedef std::map<const CefBrowserContext*,
|
||||
std::unique_ptr<visitedlink::VisitedLinkEventListener>>
|
||||
ListenerMap;
|
||||
ListenerMap listener_map_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefVisitedLinkListener);
|
||||
};
|
||||
|
||||
CefBrowserContextImpl::CefBrowserContextImpl(
|
||||
const CefRequestContextSettings& settings)
|
||||
: CefBrowserContext(false), settings_(settings) {
|
||||
g_manager.Get().AddImpl(this);
|
||||
}
|
||||
|
||||
CefBrowserContextImpl::~CefBrowserContextImpl() {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
// No CefRequestContextImpl should be referencing this object any longer.
|
||||
DCHECK(request_context_set_.empty());
|
||||
|
||||
// Unregister the context first to avoid re-entrancy during shutdown.
|
||||
g_manager.Get().RemoveImpl(this, cache_path_);
|
||||
|
||||
Shutdown();
|
||||
|
||||
visitedlink_listener_->RemoveListenerForContext(this);
|
||||
|
||||
// The FontFamilyCache references the ProxyService so delete it before the
|
||||
// ProxyService is deleted.
|
||||
SetUserData(&kFontFamilyCacheKey, NULL);
|
||||
|
||||
pref_proxy_config_tracker_->DetachFromPrefService();
|
||||
|
||||
if (url_request_getter_)
|
||||
url_request_getter_->ShutdownOnUIThread();
|
||||
if (host_content_settings_map_)
|
||||
host_content_settings_map_->ShutdownOnUIThread();
|
||||
|
||||
// Delete the download manager delegate here because otherwise we'll crash
|
||||
// when it's accessed from the content::BrowserContext destructor.
|
||||
if (download_manager_delegate_)
|
||||
download_manager_delegate_.reset(NULL);
|
||||
}
|
||||
|
||||
void CefBrowserContextImpl::Initialize() {
|
||||
cache_path_ = base::FilePath(CefString(&settings_.cache_path));
|
||||
if (!cache_path_.empty()) {
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
if (!base::DirectoryExists(cache_path_) &&
|
||||
!base::CreateDirectory(cache_path_)) {
|
||||
LOG(ERROR) << "The cache_path directory could not be created: "
|
||||
<< cache_path_.value();
|
||||
cache_path_ = base::FilePath();
|
||||
CefString(&settings_.cache_path).clear();
|
||||
}
|
||||
}
|
||||
|
||||
if (!cache_path_.empty())
|
||||
g_manager.Get().SetImplPath(this, cache_path_);
|
||||
|
||||
if (settings_.accept_language_list.length == 0) {
|
||||
// Use the global language list setting.
|
||||
CefString(&settings_.accept_language_list) =
|
||||
CefString(&CefContext::Get()->settings().accept_language_list);
|
||||
}
|
||||
|
||||
// Initialize the PrefService object.
|
||||
pref_service_ = browser_prefs::CreatePrefService(
|
||||
this, cache_path_, !!settings_.persist_user_preferences);
|
||||
|
||||
CefBrowserContext::Initialize();
|
||||
|
||||
// Initialize visited links management.
|
||||
base::FilePath visited_link_path;
|
||||
if (!cache_path_.empty())
|
||||
visited_link_path = cache_path_.Append(FILE_PATH_LITERAL("Visited Links"));
|
||||
visitedlink_listener_ = new CefVisitedLinkListener;
|
||||
visitedlink_master_.reset(new visitedlink::VisitedLinkMaster(
|
||||
visitedlink_listener_, this, !visited_link_path.empty(), false,
|
||||
visited_link_path, 0));
|
||||
visitedlink_listener_->CreateListenerForContext(this);
|
||||
visitedlink_master_->Init();
|
||||
|
||||
// Initialize proxy configuration tracker.
|
||||
pref_proxy_config_tracker_.reset(new PrefProxyConfigTrackerImpl(
|
||||
GetPrefs(),
|
||||
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO})));
|
||||
|
||||
CefBrowserContext::PostInitialize();
|
||||
|
||||
// Create the CefURLRequestContextGetterImpl via an indirect call to
|
||||
// CreateRequestContext. Triggers a call to CefURLRequestContextGetterImpl::
|
||||
// GetURLRequestContext() on the IO thread which creates the
|
||||
// CefURLRequestContextImpl.
|
||||
GetRequestContext();
|
||||
DCHECK(url_request_getter_.get());
|
||||
|
||||
// Create the StoragePartitionImplMap and StoragePartitionImpl for this
|
||||
// object. This must be done before the first WebContents is created using a
|
||||
// CefBrowserContextProxy of this object, otherwise the StoragePartitionProxy
|
||||
// will not be created (in that case
|
||||
// CefBrowserContextProxy::CreateRequestContext will be called, which is
|
||||
// incorrect).
|
||||
GetDefaultStoragePartition(this);
|
||||
}
|
||||
|
||||
void CefBrowserContextImpl::AddProxy(const CefBrowserContextProxy* proxy) {
|
||||
CEF_REQUIRE_UIT();
|
||||
visitedlink_listener_->CreateListenerForContext(proxy);
|
||||
}
|
||||
|
||||
void CefBrowserContextImpl::RemoveProxy(const CefBrowserContextProxy* proxy) {
|
||||
CEF_REQUIRE_UIT();
|
||||
visitedlink_listener_->RemoveListenerForContext(proxy);
|
||||
}
|
||||
|
||||
void CefBrowserContextImpl::AddCefRequestContext(
|
||||
CefRequestContextImpl* context) {
|
||||
CEF_REQUIRE_UIT();
|
||||
request_context_set_.insert(context);
|
||||
}
|
||||
|
||||
void CefBrowserContextImpl::RemoveCefRequestContext(
|
||||
CefRequestContextImpl* context) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
extension_system()->OnRequestContextDeleted(context);
|
||||
}
|
||||
|
||||
request_context_set_.erase(context);
|
||||
|
||||
// Delete ourselves when the reference count reaches zero.
|
||||
if (request_context_set_.empty())
|
||||
delete this;
|
||||
}
|
||||
|
||||
CefRequestContextImpl* CefBrowserContextImpl::GetCefRequestContext(
|
||||
bool impl_only) const {
|
||||
CEF_REQUIRE_UIT();
|
||||
// First try to find a non-proxy RequestContext.
|
||||
for (CefRequestContextImpl* impl : request_context_set_) {
|
||||
if (!impl->GetHandler())
|
||||
return impl;
|
||||
}
|
||||
if (impl_only)
|
||||
return nullptr;
|
||||
return *request_context_set_.begin();
|
||||
}
|
||||
|
||||
// static
|
||||
CefBrowserContextImpl* CefBrowserContextImpl::GetForCachePath(
|
||||
const base::FilePath& cache_path) {
|
||||
return g_manager.Get().GetImplForPath(cache_path);
|
||||
}
|
||||
|
||||
// static
|
||||
CefBrowserContextImpl* CefBrowserContextImpl::GetForContext(
|
||||
content::BrowserContext* context) {
|
||||
return g_manager.Get().GetImplForContext(context);
|
||||
}
|
||||
|
||||
// static
|
||||
std::vector<CefBrowserContextImpl*> CefBrowserContextImpl::GetAll() {
|
||||
return g_manager.Get().GetAllImpl();
|
||||
}
|
||||
|
||||
base::FilePath CefBrowserContextImpl::GetPath() const {
|
||||
return cache_path_;
|
||||
}
|
||||
|
||||
std::unique_ptr<content::ZoomLevelDelegate>
|
||||
CefBrowserContextImpl::CreateZoomLevelDelegate(
|
||||
const base::FilePath& partition_path) {
|
||||
if (cache_path_.empty())
|
||||
return std::unique_ptr<content::ZoomLevelDelegate>();
|
||||
|
||||
return base::WrapUnique(new ChromeZoomLevelPrefs(
|
||||
GetPrefs(), cache_path_, partition_path,
|
||||
zoom::ZoomEventManager::GetForBrowserContext(this)->GetWeakPtr()));
|
||||
}
|
||||
|
||||
bool CefBrowserContextImpl::IsOffTheRecord() const {
|
||||
// CEF contexts are never flagged as off-the-record. It causes problems
|
||||
// for the extension system.
|
||||
return false;
|
||||
}
|
||||
|
||||
content::DownloadManagerDelegate*
|
||||
CefBrowserContextImpl::GetDownloadManagerDelegate() {
|
||||
if (!download_manager_delegate_) {
|
||||
content::DownloadManager* manager =
|
||||
BrowserContext::GetDownloadManager(this);
|
||||
download_manager_delegate_.reset(new CefDownloadManagerDelegate(manager));
|
||||
}
|
||||
return download_manager_delegate_.get();
|
||||
}
|
||||
|
||||
content::BrowserPluginGuestManager* CefBrowserContextImpl::GetGuestManager() {
|
||||
DCHECK(extensions::ExtensionsEnabled());
|
||||
return guest_view::GuestViewManager::FromBrowserContext(this);
|
||||
}
|
||||
|
||||
storage::SpecialStoragePolicy*
|
||||
CefBrowserContextImpl::GetSpecialStoragePolicy() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content::PushMessagingService*
|
||||
CefBrowserContextImpl::GetPushMessagingService() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content::SSLHostStateDelegate*
|
||||
CefBrowserContextImpl::GetSSLHostStateDelegate() {
|
||||
if (!ssl_host_state_delegate_.get())
|
||||
ssl_host_state_delegate_.reset(new CefSSLHostStateDelegate());
|
||||
return ssl_host_state_delegate_.get();
|
||||
}
|
||||
|
||||
content::PermissionControllerDelegate*
|
||||
CefBrowserContextImpl::GetPermissionControllerDelegate() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
content::BackgroundFetchDelegate*
|
||||
CefBrowserContextImpl::GetBackgroundFetchDelegate() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
content::BackgroundSyncController*
|
||||
CefBrowserContextImpl::GetBackgroundSyncController() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
content::BrowsingDataRemoverDelegate*
|
||||
CefBrowserContextImpl::GetBrowsingDataRemoverDelegate() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
net::URLRequestContextGetter* CefBrowserContextImpl::CreateRequestContext(
|
||||
content::ProtocolHandlerMap* protocol_handlers,
|
||||
content::URLRequestInterceptorScopedVector request_interceptors) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(!url_request_getter_.get());
|
||||
|
||||
auto io_thread_runner =
|
||||
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO});
|
||||
|
||||
// Initialize the proxy configuration service.
|
||||
// TODO(cef): Determine if we can use the Chrome/Mojo implementation from
|
||||
// https://crrev.com/d0d0d050
|
||||
std::unique_ptr<net::ProxyConfigService> base_service(
|
||||
net::ProxyResolutionService::CreateSystemProxyConfigService(
|
||||
io_thread_runner));
|
||||
std::unique_ptr<net::ProxyConfigService> proxy_config_service(
|
||||
pref_proxy_config_tracker_->CreateTrackingProxyConfigService(
|
||||
std::move(base_service)));
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
// Handle only chrome-extension:// requests. CEF does not support
|
||||
// chrome-extension-resource:// requests (it does not store shared extension
|
||||
// data in its installation directory).
|
||||
extensions::InfoMap* extension_info_map = extension_system()->info_map();
|
||||
(*protocol_handlers)[extensions::kExtensionScheme] =
|
||||
extensions::CreateExtensionProtocolHandler(IsOffTheRecord(),
|
||||
extension_info_map);
|
||||
}
|
||||
|
||||
url_request_getter_ = new CefURLRequestContextGetterImpl(
|
||||
settings_, GetPrefs(), io_thread_runner, protocol_handlers,
|
||||
std::move(proxy_config_service), std::move(request_interceptors));
|
||||
return url_request_getter_.get();
|
||||
}
|
||||
|
||||
net::URLRequestContextGetter*
|
||||
CefBrowserContextImpl::CreateRequestContextForStoragePartition(
|
||||
const base::FilePath& partition_path,
|
||||
bool in_memory,
|
||||
content::ProtocolHandlerMap* protocol_handlers,
|
||||
content::URLRequestInterceptorScopedVector request_interceptors) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
content::StoragePartition* CefBrowserContextImpl::GetStoragePartitionProxy(
|
||||
content::BrowserContext* browser_context,
|
||||
content::StoragePartition* partition_impl) {
|
||||
CefBrowserContextProxy* proxy =
|
||||
static_cast<CefBrowserContextProxy*>(browser_context);
|
||||
return proxy->GetOrCreateStoragePartitionProxy(partition_impl);
|
||||
}
|
||||
|
||||
PrefService* CefBrowserContextImpl::GetPrefs() {
|
||||
return pref_service_.get();
|
||||
}
|
||||
|
||||
const PrefService* CefBrowserContextImpl::GetPrefs() const {
|
||||
return pref_service_.get();
|
||||
}
|
||||
|
||||
SimpleFactoryKey* CefBrowserContextImpl::GetSimpleFactoryKey() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CefRequestContextImpl* CefBrowserContextImpl::GetCefRequestContext() const {
|
||||
return GetCefRequestContext(false);
|
||||
}
|
||||
|
||||
const CefRequestContextSettings& CefBrowserContextImpl::GetSettings() const {
|
||||
return settings_;
|
||||
}
|
||||
|
||||
CefRefPtr<CefRequestContextHandler> CefBrowserContextImpl::GetHandler() const {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
HostContentSettingsMap* CefBrowserContextImpl::GetHostContentSettingsMap() {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
if (!host_content_settings_map_.get()) {
|
||||
// The |is_incognito_profile| and |is_guest_profile| arguments are
|
||||
// intentionally set to false as they otherwise limit the types of values
|
||||
// that can be stored in the settings map (for example, default values set
|
||||
// via DefaultProvider::SetWebsiteSetting).
|
||||
host_content_settings_map_ =
|
||||
new HostContentSettingsMap(GetPrefs(), false, false, false, false);
|
||||
|
||||
// Change the default plugin policy.
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
const std::string& plugin_policy_str =
|
||||
command_line->GetSwitchValueASCII(switches::kPluginPolicy);
|
||||
if (!plugin_policy_str.empty()) {
|
||||
ContentSetting plugin_policy = CONTENT_SETTING_ALLOW;
|
||||
if (base::LowerCaseEqualsASCII(plugin_policy_str,
|
||||
switches::kPluginPolicy_Detect)) {
|
||||
plugin_policy = CONTENT_SETTING_DETECT_IMPORTANT_CONTENT;
|
||||
} else if (base::LowerCaseEqualsASCII(plugin_policy_str,
|
||||
switches::kPluginPolicy_Block)) {
|
||||
plugin_policy = CONTENT_SETTING_BLOCK;
|
||||
}
|
||||
host_content_settings_map_->SetDefaultContentSetting(
|
||||
CONTENT_SETTINGS_TYPE_PLUGINS, plugin_policy);
|
||||
}
|
||||
}
|
||||
return host_content_settings_map_.get();
|
||||
}
|
||||
|
||||
void CefBrowserContextImpl::AddVisitedURLs(const std::vector<GURL>& urls) {
|
||||
visitedlink_master_->AddURLs(urls);
|
||||
}
|
||||
|
||||
void CefBrowserContextImpl::RebuildTable(
|
||||
const scoped_refptr<URLEnumerator>& enumerator) {
|
||||
// Called when visited links will not or cannot be loaded from disk.
|
||||
enumerator->OnComplete(true);
|
||||
}
|
136
libcef/browser/browser_context_impl.h
Normal file
136
libcef/browser/browser_context_impl.h
Normal file
@@ -0,0 +1,136 @@
|
||||
// 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_CONTEXT_IMPL_H_
|
||||
#define CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_IMPL_H_
|
||||
#pragma once
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
|
||||
#include "libcef/browser/net/url_request_context_getter_impl.h"
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "components/proxy_config/pref_proxy_config_tracker.h"
|
||||
#include "components/visitedlink/browser/visitedlink_delegate.h"
|
||||
|
||||
class CefBrowserContextProxy;
|
||||
class CefDownloadManagerDelegate;
|
||||
class CefSSLHostStateDelegate;
|
||||
class CefVisitedLinkListener;
|
||||
|
||||
namespace visitedlink {
|
||||
class VisitedLinkMaster;
|
||||
}
|
||||
|
||||
// Isolated BrowserContext implementation. Life span is controlled by
|
||||
// CefBrowserMainParts for the global context and CefRequestContextImpl
|
||||
// for non-global contexts. Only accessed on the UI thread unless otherwise
|
||||
// indicated. See browser_context.h for an object relationship diagram.
|
||||
class CefBrowserContextImpl : public CefBrowserContext,
|
||||
public visitedlink::VisitedLinkDelegate {
|
||||
public:
|
||||
explicit CefBrowserContextImpl(const CefRequestContextSettings& settings);
|
||||
|
||||
// Returns the existing instance, if any, associated with the specified
|
||||
// |cache_path|.
|
||||
static CefBrowserContextImpl* GetForCachePath(
|
||||
const base::FilePath& cache_path);
|
||||
|
||||
// Returns the underlying CefBrowserContextImpl if any.
|
||||
static CefBrowserContextImpl* GetForContext(content::BrowserContext* context);
|
||||
|
||||
// Returns all existing CefBrowserContextImpl.
|
||||
static std::vector<CefBrowserContextImpl*> GetAll();
|
||||
|
||||
// Must be called immediately after this object is created.
|
||||
void Initialize() override;
|
||||
|
||||
// Track associated CefBrowserContextProxy objects.
|
||||
void AddProxy(const CefBrowserContextProxy* proxy);
|
||||
void RemoveProxy(const CefBrowserContextProxy* proxy);
|
||||
|
||||
// Track associated CefRequestContextImpl objects. This object will delete
|
||||
// itself when the count reaches zero.
|
||||
void AddCefRequestContext(CefRequestContextImpl* context);
|
||||
void RemoveCefRequestContext(CefRequestContextImpl* context);
|
||||
CefRequestContextImpl* GetCefRequestContext(bool impl_only) const;
|
||||
|
||||
// BrowserContext methods.
|
||||
base::FilePath GetPath() const override;
|
||||
std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(
|
||||
const base::FilePath& partition_path) override;
|
||||
bool IsOffTheRecord() const override;
|
||||
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
|
||||
content::BrowserPluginGuestManager* GetGuestManager() override;
|
||||
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
|
||||
content::PushMessagingService* GetPushMessagingService() override;
|
||||
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
|
||||
content::PermissionControllerDelegate* GetPermissionControllerDelegate()
|
||||
override;
|
||||
content::BackgroundFetchDelegate* GetBackgroundFetchDelegate() override;
|
||||
content::BackgroundSyncController* GetBackgroundSyncController() override;
|
||||
content::BrowsingDataRemoverDelegate* GetBrowsingDataRemoverDelegate()
|
||||
override;
|
||||
net::URLRequestContextGetter* CreateRequestContext(
|
||||
content::ProtocolHandlerMap* protocol_handlers,
|
||||
content::URLRequestInterceptorScopedVector request_interceptors) override;
|
||||
net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
|
||||
const base::FilePath& partition_path,
|
||||
bool in_memory,
|
||||
content::ProtocolHandlerMap* protocol_handlers,
|
||||
content::URLRequestInterceptorScopedVector request_interceptors) override;
|
||||
content::StoragePartition* GetStoragePartitionProxy(
|
||||
content::BrowserContext* browser_context,
|
||||
content::StoragePartition* partition_impl) override;
|
||||
|
||||
// Profile methods.
|
||||
PrefService* GetPrefs() override;
|
||||
bool AllowsBrowserWindows() const override { return false; }
|
||||
const PrefService* GetPrefs() const override;
|
||||
SimpleFactoryKey* GetSimpleFactoryKey() const override;
|
||||
|
||||
// CefBrowserContext methods.
|
||||
CefRequestContextImpl* GetCefRequestContext() const override;
|
||||
const CefRequestContextSettings& GetSettings() const override;
|
||||
CefRefPtr<CefRequestContextHandler> GetHandler() const override;
|
||||
HostContentSettingsMap* GetHostContentSettingsMap() override;
|
||||
void AddVisitedURLs(const std::vector<GURL>& urls) override;
|
||||
|
||||
// visitedlink::VisitedLinkDelegate methods.
|
||||
void RebuildTable(const scoped_refptr<URLEnumerator>& enumerator) override;
|
||||
|
||||
// Guaranteed to exist once this object has been initialized.
|
||||
scoped_refptr<CefURLRequestContextGetterImpl> request_context_getter() const {
|
||||
return url_request_getter_;
|
||||
}
|
||||
|
||||
private:
|
||||
// Allow deletion via std::unique_ptr().
|
||||
friend std::default_delete<CefBrowserContextImpl>;
|
||||
|
||||
~CefBrowserContextImpl() override;
|
||||
|
||||
// Members initialized during construction are safe to access from any thread.
|
||||
CefRequestContextSettings settings_;
|
||||
base::FilePath cache_path_;
|
||||
|
||||
// CefRequestContextImpl objects referencing this object.
|
||||
std::set<CefRequestContextImpl*> request_context_set_;
|
||||
|
||||
std::unique_ptr<PrefService> pref_service_;
|
||||
std::unique_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
|
||||
|
||||
std::unique_ptr<CefDownloadManagerDelegate> download_manager_delegate_;
|
||||
scoped_refptr<CefURLRequestContextGetterImpl> url_request_getter_;
|
||||
std::unique_ptr<CefSSLHostStateDelegate> ssl_host_state_delegate_;
|
||||
scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
|
||||
std::unique_ptr<visitedlink::VisitedLinkMaster> visitedlink_master_;
|
||||
// |visitedlink_listener_| is owned by visitedlink_master_.
|
||||
CefVisitedLinkListener* visitedlink_listener_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserContextImpl);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_IMPL_H_
|
264
libcef/browser/browser_context_proxy.cc
Normal file
264
libcef/browser/browser_context_proxy.cc
Normal file
@@ -0,0 +1,264 @@
|
||||
// Copyright (c) 2012 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_context_proxy.h"
|
||||
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/download_manager_delegate.h"
|
||||
#include "libcef/browser/net/url_request_context_getter_proxy.h"
|
||||
#include "libcef/browser/storage_partition_proxy.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "chrome/browser/font_family_cache.h"
|
||||
#include "components/guest_view/common/guest_view_constants.h"
|
||||
#include "components/visitedlink/browser/visitedlink_master.h"
|
||||
#include "content/browser/blob_storage/chrome_blob_storage_context.h"
|
||||
#include "content/browser/resource_context_impl.h"
|
||||
#include "content/browser/streams/stream_context.h"
|
||||
#include "content/browser/webui/url_data_manager.h"
|
||||
#include "content/public/browser/storage_partition.h"
|
||||
#include "services/service_manager/public/cpp/service.h"
|
||||
|
||||
namespace {
|
||||
|
||||
bool ShouldProxyUserData(const void* key) {
|
||||
// If this value is not proxied then multiple StoragePartitionImpl objects
|
||||
// will be created and filesystem API access will fail, among other things.
|
||||
if (key == content::BrowserContext::GetStoragePartitionMapUserDataKey())
|
||||
return true;
|
||||
|
||||
// If these values are not proxied then blob data fails to load for the PDF
|
||||
// extension.
|
||||
// See also the call to InitializeResourceContext().
|
||||
if (key == content::ChromeBlobStorageContext::GetUserDataKey() ||
|
||||
key == content::StreamContext::GetUserDataKey()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If this value is not proxied then CefBrowserContextImpl::GetGuestManager()
|
||||
// returns NULL.
|
||||
// See also CefExtensionsAPIClient::CreateGuestViewManagerDelegate.
|
||||
if (key == guest_view::kGuestViewManagerKeyName)
|
||||
return true;
|
||||
|
||||
// If this value is not proxied then there will be a use-after-free while
|
||||
// destroying the FontFamilyCache because it will try to access the
|
||||
// ProxyService owned by CefBrowserContextImpl (which has already been freed).
|
||||
if (key == kFontFamilyCacheKey)
|
||||
return true;
|
||||
|
||||
// If this value is not proxied WebUI will fail to load.
|
||||
if (key == content::URLDataManager::GetUserDataKey())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefBrowserContextProxy::CefBrowserContextProxy(
|
||||
CefRequestContextImpl* const request_context,
|
||||
CefRefPtr<CefRequestContextHandler> handler,
|
||||
CefBrowserContextImpl* parent)
|
||||
: CefBrowserContext(true),
|
||||
request_context_(request_context),
|
||||
handler_(handler),
|
||||
parent_(parent) {
|
||||
DCHECK(handler_.get());
|
||||
DCHECK(parent_);
|
||||
parent_->AddProxy(this);
|
||||
}
|
||||
|
||||
CefBrowserContextProxy::~CefBrowserContextProxy() {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
Shutdown();
|
||||
|
||||
parent_->RemoveProxy(this);
|
||||
}
|
||||
|
||||
void CefBrowserContextProxy::Initialize() {
|
||||
CefBrowserContext::Initialize();
|
||||
|
||||
// This object's CefResourceContext needs to proxy some UserData requests to
|
||||
// the parent object's CefResourceContext.
|
||||
resource_context()->set_parent(parent_->resource_context());
|
||||
|
||||
CefBrowserContext::PostInitialize();
|
||||
}
|
||||
|
||||
base::SupportsUserData::Data* CefBrowserContextProxy::GetUserData(
|
||||
const void* key) const {
|
||||
if (ShouldProxyUserData(key))
|
||||
return parent_->GetUserData(key);
|
||||
return BrowserContext::GetUserData(key);
|
||||
}
|
||||
|
||||
void CefBrowserContextProxy::SetUserData(const void* key,
|
||||
std::unique_ptr<Data> data) {
|
||||
if (ShouldProxyUserData(key))
|
||||
parent_->SetUserData(key, std::move(data));
|
||||
else
|
||||
BrowserContext::SetUserData(key, std::move(data));
|
||||
}
|
||||
|
||||
void CefBrowserContextProxy::RemoveUserData(const void* key) {
|
||||
if (ShouldProxyUserData(key))
|
||||
parent_->RemoveUserData(key);
|
||||
else
|
||||
BrowserContext::RemoveUserData(key);
|
||||
}
|
||||
|
||||
base::FilePath CefBrowserContextProxy::GetPath() const {
|
||||
return parent_->GetPath();
|
||||
}
|
||||
|
||||
std::unique_ptr<content::ZoomLevelDelegate>
|
||||
CefBrowserContextProxy::CreateZoomLevelDelegate(
|
||||
const base::FilePath& partition_path) {
|
||||
return parent_->CreateZoomLevelDelegate(partition_path);
|
||||
}
|
||||
|
||||
bool CefBrowserContextProxy::IsOffTheRecord() const {
|
||||
return parent_->IsOffTheRecord();
|
||||
}
|
||||
|
||||
content::DownloadManagerDelegate*
|
||||
CefBrowserContextProxy::GetDownloadManagerDelegate() {
|
||||
if (!download_manager_delegate_) {
|
||||
content::DownloadManager* manager =
|
||||
BrowserContext::GetDownloadManager(this);
|
||||
download_manager_delegate_.reset(new CefDownloadManagerDelegate(manager));
|
||||
}
|
||||
return download_manager_delegate_.get();
|
||||
}
|
||||
|
||||
content::BrowserPluginGuestManager* CefBrowserContextProxy::GetGuestManager() {
|
||||
return parent_->GetGuestManager();
|
||||
}
|
||||
|
||||
storage::SpecialStoragePolicy*
|
||||
CefBrowserContextProxy::GetSpecialStoragePolicy() {
|
||||
return parent_->GetSpecialStoragePolicy();
|
||||
}
|
||||
|
||||
content::PushMessagingService*
|
||||
CefBrowserContextProxy::GetPushMessagingService() {
|
||||
return parent_->GetPushMessagingService();
|
||||
}
|
||||
|
||||
content::SSLHostStateDelegate*
|
||||
CefBrowserContextProxy::GetSSLHostStateDelegate() {
|
||||
return parent_->GetSSLHostStateDelegate();
|
||||
}
|
||||
|
||||
content::ClientHintsControllerDelegate*
|
||||
CefBrowserContextProxy::GetClientHintsControllerDelegate() {
|
||||
return parent_->GetClientHintsControllerDelegate();
|
||||
}
|
||||
|
||||
content::PermissionControllerDelegate*
|
||||
CefBrowserContextProxy::GetPermissionControllerDelegate() {
|
||||
return parent_->GetPermissionControllerDelegate();
|
||||
}
|
||||
|
||||
content::BackgroundFetchDelegate*
|
||||
CefBrowserContextProxy::GetBackgroundFetchDelegate() {
|
||||
return parent_->GetBackgroundFetchDelegate();
|
||||
}
|
||||
|
||||
content::BackgroundSyncController*
|
||||
CefBrowserContextProxy::GetBackgroundSyncController() {
|
||||
return parent_->GetBackgroundSyncController();
|
||||
}
|
||||
|
||||
content::BrowsingDataRemoverDelegate*
|
||||
CefBrowserContextProxy::GetBrowsingDataRemoverDelegate() {
|
||||
return parent_->GetBrowsingDataRemoverDelegate();
|
||||
}
|
||||
|
||||
net::URLRequestContextGetter* CefBrowserContextProxy::CreateRequestContext(
|
||||
content::ProtocolHandlerMap* protocol_handlers,
|
||||
content::URLRequestInterceptorScopedVector request_interceptors) {
|
||||
// CefBrowserContextImpl::GetOrCreateStoragePartitionProxy is called instead
|
||||
// of this method.
|
||||
NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
net::URLRequestContextGetter*
|
||||
CefBrowserContextProxy::CreateRequestContextForStoragePartition(
|
||||
const base::FilePath& partition_path,
|
||||
bool in_memory,
|
||||
content::ProtocolHandlerMap* protocol_handlers,
|
||||
content::URLRequestInterceptorScopedVector request_interceptors) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<service_manager::Service>
|
||||
CefBrowserContextProxy::HandleServiceRequest(
|
||||
const std::string& service_name,
|
||||
service_manager::mojom::ServiceRequest request) {
|
||||
return parent_->HandleServiceRequest(service_name, std::move(request));
|
||||
}
|
||||
|
||||
PrefService* CefBrowserContextProxy::GetPrefs() {
|
||||
return parent_->GetPrefs();
|
||||
}
|
||||
|
||||
bool CefBrowserContextProxy::AllowsBrowserWindows() const {
|
||||
return parent_->AllowsBrowserWindows();
|
||||
}
|
||||
|
||||
const PrefService* CefBrowserContextProxy::GetPrefs() const {
|
||||
return parent_->GetPrefs();
|
||||
}
|
||||
|
||||
SimpleFactoryKey* CefBrowserContextProxy::GetSimpleFactoryKey() const {
|
||||
return parent_->GetSimpleFactoryKey();
|
||||
}
|
||||
|
||||
CefRequestContextImpl* CefBrowserContextProxy::GetCefRequestContext() const {
|
||||
return request_context_;
|
||||
}
|
||||
|
||||
const CefRequestContextSettings& CefBrowserContextProxy::GetSettings() const {
|
||||
return parent_->GetSettings();
|
||||
}
|
||||
|
||||
CefRefPtr<CefRequestContextHandler> CefBrowserContextProxy::GetHandler() const {
|
||||
return handler_;
|
||||
}
|
||||
|
||||
HostContentSettingsMap* CefBrowserContextProxy::GetHostContentSettingsMap() {
|
||||
return parent_->GetHostContentSettingsMap();
|
||||
}
|
||||
|
||||
void CefBrowserContextProxy::AddVisitedURLs(const std::vector<GURL>& urls) {
|
||||
parent_->AddVisitedURLs(urls);
|
||||
}
|
||||
|
||||
content::StoragePartition*
|
||||
CefBrowserContextProxy::GetOrCreateStoragePartitionProxy(
|
||||
content::StoragePartition* partition_impl) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
if (!storage_partition_proxy_) {
|
||||
scoped_refptr<CefURLRequestContextGetterProxy> url_request_getter =
|
||||
new CefURLRequestContextGetterProxy(handler_,
|
||||
parent_->request_context_getter());
|
||||
storage_partition_proxy_.reset(
|
||||
new CefStoragePartitionProxy(partition_impl, url_request_getter.get()));
|
||||
|
||||
// Associates UserData keys with the ResourceContext.
|
||||
// Called from StoragePartitionImplMap::Get() for CefBrowserContextImpl.
|
||||
content::InitializeResourceContext(this);
|
||||
}
|
||||
|
||||
// There should only be one CefStoragePartitionProxy for this
|
||||
// CefBrowserContextProxy.
|
||||
DCHECK_EQ(storage_partition_proxy_->parent(), partition_impl);
|
||||
return storage_partition_proxy_.get();
|
||||
}
|
102
libcef/browser/browser_context_proxy.h
Normal file
102
libcef/browser/browser_context_proxy.h
Normal file
@@ -0,0 +1,102 @@
|
||||
// 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_CONTEXT_PROXY_H_
|
||||
#define CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_PROXY_H_
|
||||
#pragma once
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/browser_context_impl.h"
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
|
||||
class CefDownloadManagerDelegate;
|
||||
class CefStoragePartitionProxy;
|
||||
|
||||
// BrowserContext implementation for a particular CefRequestContext. Life span
|
||||
// is controlled by CefRequestContextImpl. Only accessed on the UI thread. See
|
||||
// browser_context.h for an object relationship diagram.
|
||||
class CefBrowserContextProxy : public CefBrowserContext {
|
||||
public:
|
||||
CefBrowserContextProxy(CefRequestContextImpl* const request_context,
|
||||
CefRefPtr<CefRequestContextHandler> handler,
|
||||
CefBrowserContextImpl* parent);
|
||||
|
||||
// Must be called immediately after this object is created.
|
||||
void Initialize() override;
|
||||
|
||||
// SupportsUserData methods.
|
||||
Data* GetUserData(const void* key) const override;
|
||||
void SetUserData(const void* key, std::unique_ptr<Data> data) override;
|
||||
void RemoveUserData(const void* key) override;
|
||||
|
||||
// BrowserContext methods.
|
||||
base::FilePath GetPath() const override;
|
||||
std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(
|
||||
const base::FilePath& partition_path) override;
|
||||
bool IsOffTheRecord() const override;
|
||||
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
|
||||
content::BrowserPluginGuestManager* GetGuestManager() override;
|
||||
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
|
||||
content::PushMessagingService* GetPushMessagingService() override;
|
||||
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
|
||||
content::ClientHintsControllerDelegate* GetClientHintsControllerDelegate()
|
||||
override;
|
||||
content::PermissionControllerDelegate* GetPermissionControllerDelegate()
|
||||
override;
|
||||
content::BackgroundFetchDelegate* GetBackgroundFetchDelegate() override;
|
||||
content::BackgroundSyncController* GetBackgroundSyncController() override;
|
||||
content::BrowsingDataRemoverDelegate* GetBrowsingDataRemoverDelegate()
|
||||
override;
|
||||
net::URLRequestContextGetter* CreateRequestContext(
|
||||
content::ProtocolHandlerMap* protocol_handlers,
|
||||
content::URLRequestInterceptorScopedVector request_interceptors) override;
|
||||
net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
|
||||
const base::FilePath& partition_path,
|
||||
bool in_memory,
|
||||
content::ProtocolHandlerMap* protocol_handlers,
|
||||
content::URLRequestInterceptorScopedVector request_interceptors) override;
|
||||
std::unique_ptr<service_manager::Service> HandleServiceRequest(
|
||||
const std::string& service_name,
|
||||
service_manager::mojom::ServiceRequest request) override;
|
||||
|
||||
// Profile methods.
|
||||
PrefService* GetPrefs() override;
|
||||
bool AllowsBrowserWindows() const override;
|
||||
const PrefService* GetPrefs() const override;
|
||||
SimpleFactoryKey* GetSimpleFactoryKey() const override;
|
||||
|
||||
// CefBrowserContext methods.
|
||||
CefRequestContextImpl* GetCefRequestContext() const override;
|
||||
const CefRequestContextSettings& GetSettings() const override;
|
||||
CefRefPtr<CefRequestContextHandler> GetHandler() const override;
|
||||
HostContentSettingsMap* GetHostContentSettingsMap() override;
|
||||
void AddVisitedURLs(const std::vector<GURL>& urls) override;
|
||||
|
||||
content::StoragePartition* GetOrCreateStoragePartitionProxy(
|
||||
content::StoragePartition* partition_impl);
|
||||
|
||||
CefBrowserContextImpl* parent() const { return parent_; }
|
||||
|
||||
private:
|
||||
// Allow deletion via std::unique_ptr() only.
|
||||
friend std::default_delete<CefBrowserContextProxy>;
|
||||
|
||||
~CefBrowserContextProxy() override;
|
||||
|
||||
// Guaranteed to outlive this object.
|
||||
CefRequestContextImpl* const request_context_;
|
||||
|
||||
// Members initialized during construction are safe to access from any thread.
|
||||
CefRefPtr<CefRequestContextHandler> handler_;
|
||||
CefBrowserContextImpl* parent_; // Guaranteed to outlive this object.
|
||||
|
||||
std::unique_ptr<CefDownloadManagerDelegate> download_manager_delegate_;
|
||||
std::unique_ptr<CefStoragePartitionProxy> storage_partition_proxy_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserContextProxy);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_PROXY_H_
|
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <queue>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -21,7 +22,7 @@
|
||||
#include "libcef/browser/frame_host_impl.h"
|
||||
#include "libcef/browser/javascript_dialog_manager.h"
|
||||
#include "libcef/browser/menu_manager.h"
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
#include "libcef/common/response_manager.h"
|
||||
|
||||
#include "base/observer_list.h"
|
||||
#include "base/strings/string16.h"
|
||||
@@ -43,16 +44,24 @@ class Extension;
|
||||
class ExtensionHost;
|
||||
} // namespace extensions
|
||||
|
||||
namespace net {
|
||||
class URLRequest;
|
||||
}
|
||||
|
||||
#if defined(USE_AURA)
|
||||
namespace views {
|
||||
class Widget;
|
||||
}
|
||||
#endif // defined(USE_AURA)
|
||||
|
||||
struct Cef_DraggableRegion_Params;
|
||||
struct Cef_Request_Params;
|
||||
struct Cef_Response_Params;
|
||||
class CefAudioMirrorDestination;
|
||||
class CefBrowserInfo;
|
||||
class CefBrowserPlatformDelegate;
|
||||
class CefDevToolsFrontend;
|
||||
struct CefNavigateParams;
|
||||
class SiteInstance;
|
||||
|
||||
// Implementation of CefBrowser.
|
||||
@@ -125,8 +134,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
// request context will be used.
|
||||
CefRefPtr<CefRequestContext> request_context;
|
||||
|
||||
CefRefPtr<CefDictionaryValue> extra_info;
|
||||
|
||||
// Used when explicitly creating the browser as an extension host via
|
||||
// ProcessManager::CreateBackgroundHost.
|
||||
const extensions::Extension* extension = nullptr;
|
||||
@@ -145,11 +152,14 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
// Returns the browser associated with the specified WebContents.
|
||||
static CefRefPtr<CefBrowserHostImpl> GetBrowserForContents(
|
||||
const content::WebContents* contents);
|
||||
// Returns the browser associated with the specified FrameTreeNode ID.
|
||||
// Returns the browser associated with the specified URLRequest.
|
||||
static CefRefPtr<CefBrowserHostImpl> GetBrowserForRequest(
|
||||
const net::URLRequest* request);
|
||||
// Returns the browser associated with the specified FrameTreeNode.
|
||||
static CefRefPtr<CefBrowserHostImpl> GetBrowserForFrameTreeNode(
|
||||
int frame_tree_node_id);
|
||||
// Returns the browser associated with the specified frame routing IDs.
|
||||
static CefRefPtr<CefBrowserHostImpl> GetBrowserForFrameRoute(
|
||||
static CefRefPtr<CefBrowserHostImpl> GetBrowserForFrame(
|
||||
int render_process_id,
|
||||
int render_routing_id);
|
||||
|
||||
@@ -269,6 +279,8 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
size_t GetFrameCount() override;
|
||||
void GetFrameIdentifiers(std::vector<int64>& identifiers) override;
|
||||
void GetFrameNames(std::vector<CefString>& names) override;
|
||||
bool SendProcessMessage(CefProcessId target_process,
|
||||
CefRefPtr<CefProcessMessage> message) override;
|
||||
|
||||
// Returns true if windowless rendering is enabled.
|
||||
bool IsWindowless() const;
|
||||
@@ -296,27 +308,49 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
CefRefPtr<CefBrowserView> GetBrowserView() const;
|
||||
#endif
|
||||
|
||||
// Returns the frame associated with the specified RenderFrameHost.
|
||||
CefRefPtr<CefFrame> GetFrameForHost(const content::RenderFrameHost* host);
|
||||
// Returns the frame associated with the specified URLRequest.
|
||||
CefRefPtr<CefFrame> GetFrameForRequest(const net::URLRequest* request);
|
||||
|
||||
// Returns the frame associated with the specified FrameTreeNode ID.
|
||||
CefRefPtr<CefFrame> GetFrameForFrameTreeNode(int frame_tree_node_id);
|
||||
// Navigate as specified by the |params| argument.
|
||||
void Navigate(const CefNavigateParams& params);
|
||||
|
||||
// Load the specified URL in the main frame.
|
||||
void LoadMainFrameURL(const std::string& url,
|
||||
const content::Referrer& referrer,
|
||||
ui::PageTransition transition,
|
||||
const std::string& extra_headers);
|
||||
// Load the specified request.
|
||||
void LoadRequest(int64 frame_id, CefRefPtr<CefRequest> request);
|
||||
|
||||
// Called from CefFrameHostImpl.
|
||||
void OnFrameFocused(CefRefPtr<CefFrameHostImpl> frame);
|
||||
void OnDidFinishLoad(CefRefPtr<CefFrameHostImpl> frame,
|
||||
const GURL& validated_url,
|
||||
int http_status_code);
|
||||
// Load the specified URL.
|
||||
void LoadURL(int64 frame_id,
|
||||
const std::string& url,
|
||||
const content::Referrer& referrer,
|
||||
ui::PageTransition transition,
|
||||
const std::string& extra_headers);
|
||||
|
||||
// Load the specified string.
|
||||
void LoadString(int64 frame_id,
|
||||
const std::string& string,
|
||||
const std::string& url);
|
||||
|
||||
// Send a command to the renderer for execution.
|
||||
void SendCommand(int64 frame_id,
|
||||
const std::string& command,
|
||||
CefRefPtr<CefResponseManager::Handler> responseHandler);
|
||||
|
||||
// Send code to the renderer for execution.
|
||||
void SendCode(int64 frame_id,
|
||||
bool is_javascript,
|
||||
const std::string& code,
|
||||
const std::string& script_url,
|
||||
int script_start_line,
|
||||
CefRefPtr<CefResponseManager::Handler> responseHandler);
|
||||
|
||||
void ExecuteJavaScriptWithUserGestureForTests(int64 frame_id,
|
||||
const CefString& javascript);
|
||||
|
||||
// Open the specified text in the default text editor.
|
||||
void ViewText(const std::string& text);
|
||||
|
||||
// Handler for URLs involving external protocols.
|
||||
void HandleExternalProtocol(const GURL& url);
|
||||
|
||||
// Convert from view coordinates to screen coordinates. Potential display
|
||||
// scaling will be applied to the result.
|
||||
gfx::Point GetScreenPoint(const gfx::Point& view) const;
|
||||
@@ -335,9 +369,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
CefRefPtr<CefClient> client() const { return client_; }
|
||||
scoped_refptr<CefBrowserInfo> browser_info() const { return browser_info_; }
|
||||
int browser_id() const;
|
||||
CefRefPtr<CefRequestContextImpl> request_context() const {
|
||||
return request_context_;
|
||||
}
|
||||
|
||||
// Accessors that must be called on the UI thread.
|
||||
content::BrowserContext* GetBrowserContext();
|
||||
@@ -387,7 +418,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
void CloseContents(content::WebContents* source) override;
|
||||
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
|
||||
bool DidAddMessageToConsole(content::WebContents* source,
|
||||
blink::mojom::ConsoleMessageLevel log_level,
|
||||
int32_t level,
|
||||
const base::string16& message,
|
||||
int32_t line_no,
|
||||
const base::string16& source_id) override;
|
||||
@@ -463,7 +494,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
|
||||
void RenderFrameHostChanged(content::RenderFrameHost* old_host,
|
||||
content::RenderFrameHost* new_host) override;
|
||||
void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
|
||||
void FrameDeleted(content::RenderFrameHost* render_frame_host) override;
|
||||
void RenderViewCreated(content::RenderViewHost* render_view_host) override;
|
||||
void RenderViewDeleted(content::RenderViewHost* render_view_host) override;
|
||||
void RenderViewReady() override;
|
||||
@@ -499,7 +530,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
void AddObserver(Observer* observer);
|
||||
void RemoveObserver(Observer* observer);
|
||||
bool HasObserver(Observer* observer) const;
|
||||
|
||||
bool StartAudioMirroring();
|
||||
bool StopAudioMirroring();
|
||||
|
||||
@@ -528,10 +558,25 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
scoped_refptr<CefBrowserInfo> browser_info,
|
||||
CefRefPtr<CefBrowserHostImpl> opener,
|
||||
bool is_devtools_popup,
|
||||
CefRefPtr<CefRequestContextImpl> request_context,
|
||||
CefRefPtr<CefRequestContext> request_context,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate,
|
||||
CefRefPtr<CefExtension> extension);
|
||||
|
||||
// content::WebContentsObserver::OnMessageReceived() message handlers.
|
||||
void OnFrameIdentified(int64 frame_id,
|
||||
int64 parent_frame_id,
|
||||
base::string16 name);
|
||||
void OnFrameFocused(content::RenderFrameHost* render_frame_host);
|
||||
void OnDidFinishLoad(int64 frame_id,
|
||||
const GURL& validated_url,
|
||||
bool is_main_frame,
|
||||
int http_status_code);
|
||||
void OnUpdateDraggableRegions(
|
||||
const std::vector<Cef_DraggableRegion_Params>& regions);
|
||||
void OnRequest(const Cef_Request_Params& params);
|
||||
void OnResponse(const Cef_Response_Params& params);
|
||||
void OnResponseAck(int request_id);
|
||||
|
||||
// content::NotificationObserver methods.
|
||||
void Observe(int type,
|
||||
const content::NotificationSource& source,
|
||||
@@ -543,7 +588,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
content::WebContents* web_contents,
|
||||
scoped_refptr<CefBrowserInfo> browser_info,
|
||||
CefRefPtr<CefBrowserHostImpl> opener,
|
||||
CefRefPtr<CefRequestContextImpl> request_context,
|
||||
CefRefPtr<CefRequestContext> request_context,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate,
|
||||
CefRefPtr<CefExtension> extension);
|
||||
|
||||
@@ -566,7 +611,42 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
// Action to be executed once the navigation lock is released.
|
||||
void set_pending_navigation_action(base::OnceClosure action);
|
||||
|
||||
void OnAddressChange(const GURL& url);
|
||||
// Update or create a frame object. |frame_id| (renderer routing id) will be
|
||||
// >= 0 if the frame currently exists in the renderer process. |frame_id| will
|
||||
// be < 0 for the main frame if it has not yet navigated for the first time,
|
||||
// or for sub-frames if PlzNavigate is enabled and the sub-frame does not yet
|
||||
// have a renderer process representation. |frame_tree_node_id| will be
|
||||
// kUnspecifiedFrameTreeNodeId for calls that originate from the renderer
|
||||
// process (meaning that |frame_id| should be >= 0); kUnusedFrameTreeNodeId
|
||||
// if PlzNavigate is disabled; or >= 0 otherwise. |parent_frame_id| will be
|
||||
// CefFrameHostImpl::kUnspecifiedFrameId if unknown. In cases where |frame_id|
|
||||
// is < 0 either the existing main frame object or a pending object will be
|
||||
// returned depending on current state. If |is_main_frame_state_flaky| is true
|
||||
// then the value of |is_main_frame| cannot be relied on.
|
||||
CefRefPtr<CefFrame> GetOrCreateFrame(int64 frame_id,
|
||||
int frame_tree_node_id,
|
||||
int64 parent_frame_id,
|
||||
bool is_main_frame,
|
||||
bool is_main_frame_state_flaky,
|
||||
base::string16 frame_name,
|
||||
const GURL& frame_url);
|
||||
|
||||
// Returns a pending frame object. If the main frame has not yet navigated for
|
||||
// the first time then |frame_tree_node_id| will be kMainFrameTreeNodeId and a
|
||||
// single pending object will be returned. Otherwise, this method will be
|
||||
// called with a |frame_tree_node_id| value >= 0 when PlzNavigate is enabled
|
||||
// and there will then be one pending object for each frame that does not yet
|
||||
// have a renderer process representation. |parent_frame_id| will be
|
||||
// CefFrameHostImpl::kUnspecifiedFrameId if unknown. |created| will be set to
|
||||
// true if |created| is non-nullptr and the frame object was created.
|
||||
CefRefPtr<CefFrameHostImpl> GetOrCreatePendingFrame(int frame_tree_node_id,
|
||||
int64 parent_frame_id,
|
||||
bool* created);
|
||||
|
||||
// Remove the references to all frames and mark them as detached.
|
||||
void DetachAllFrames();
|
||||
|
||||
void OnAddressChange(CefRefPtr<CefFrame> frame, const GURL& url);
|
||||
void OnLoadStart(CefRefPtr<CefFrame> frame,
|
||||
ui::PageTransition transition_type);
|
||||
void OnLoadError(CefRefPtr<CefFrame> frame, const GURL& url, int error_code);
|
||||
@@ -583,11 +663,16 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
|
||||
void ConfigureAutoResize();
|
||||
|
||||
// Send a message to the RenderViewHost associated with this browser.
|
||||
// TODO(cef): With the introduction of OOPIFs, WebContents can span multiple
|
||||
// processes. Messages should be sent to specific RenderFrameHosts instead.
|
||||
bool Send(IPC::Message* message);
|
||||
|
||||
CefBrowserSettings settings_;
|
||||
CefRefPtr<CefClient> client_;
|
||||
scoped_refptr<CefBrowserInfo> browser_info_;
|
||||
CefWindowHandle opener_;
|
||||
CefRefPtr<CefRequestContextImpl> request_context_;
|
||||
CefRefPtr<CefRequestContext> request_context_;
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate_;
|
||||
const bool is_windowless_;
|
||||
const bool is_views_hosted_;
|
||||
@@ -607,8 +692,26 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
bool has_document_;
|
||||
bool is_fullscreen_;
|
||||
|
||||
// The currently focused frame, or nullptr if the main frame is focused.
|
||||
CefRefPtr<CefFrameHostImpl> focused_frame_;
|
||||
// Messages we queue while waiting for the RenderView to be ready. We queue
|
||||
// them here instead of in the RenderProcessHost to ensure that they're sent
|
||||
// after the CefRenderViewObserver has been created on the renderer side.
|
||||
std::queue<IPC::Message*> queued_messages_;
|
||||
bool queue_messages_;
|
||||
|
||||
// Map of frame tree node id to CefFrameHostImpl. These are frames that do not
|
||||
// yet have a renderer process representation.
|
||||
typedef std::map<int, CefRefPtr<CefFrameHostImpl>> FrameTreeNodeIdMap;
|
||||
FrameTreeNodeIdMap pending_frames_;
|
||||
|
||||
// Map of unique frame id (renderer routing id) to CefFrameHostImpl. These are
|
||||
// frames that do have a renderer process representation.
|
||||
typedef std::map<int64, CefRefPtr<CefFrameHostImpl>> FrameIdMap;
|
||||
FrameIdMap frames_;
|
||||
|
||||
// The unique frame id currently identified as the main frame.
|
||||
int64 main_frame_id_;
|
||||
// The unique frame id currently identified as the focused frame.
|
||||
int64 focused_frame_id_;
|
||||
|
||||
// Represents the current browser destruction state. Only accessed on the UI
|
||||
// thread.
|
||||
@@ -638,6 +741,9 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
// Used for managing notification subscriptions.
|
||||
std::unique_ptr<content::NotificationRegistrar> registrar_;
|
||||
|
||||
// Manages response registrations.
|
||||
std::unique_ptr<CefResponseManager> response_manager_;
|
||||
|
||||
// Used for creating and managing file dialogs.
|
||||
std::unique_ptr<CefFileDialogManager> file_dialog_manager_;
|
||||
|
||||
@@ -666,7 +772,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
bool is_background_host_ = false;
|
||||
|
||||
// Used to mirror audio streams
|
||||
scoped_refptr<CefAudioMirrorDestination> audio_mirror_destination_;
|
||||
std::unique_ptr<CefAudioMirrorDestination> audio_mirror_destination_;
|
||||
|
||||
// Used with auto-resize.
|
||||
bool auto_resize_enabled_ = false;
|
||||
|
@@ -6,364 +6,140 @@
|
||||
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/values_impl.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "content/browser/frame_host/frame_tree_node.h"
|
||||
#include "content/browser/frame_host/render_frame_host_impl.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "ipc/ipc_message.h"
|
||||
|
||||
CefBrowserInfo::FrameInfo::~FrameInfo() {
|
||||
if (frame_ && !is_main_frame_) {
|
||||
// Disassociate sub-frames from the browser.
|
||||
frame_->Detach();
|
||||
}
|
||||
// CefBrowserInfo::RenderIDManager
|
||||
|
||||
CefBrowserInfo::RenderIDManager::RenderIDManager(base::Lock* lock)
|
||||
: lock_(lock) {
|
||||
DCHECK(lock);
|
||||
}
|
||||
|
||||
CefBrowserInfo::CefBrowserInfo(int browser_id,
|
||||
bool is_popup,
|
||||
bool is_windowless,
|
||||
CefRefPtr<CefDictionaryValue> extra_info)
|
||||
void CefBrowserInfo::RenderIDManager::add_render_frame_id(
|
||||
int render_process_id,
|
||||
int render_routing_id) {
|
||||
DCHECK_GT(render_process_id, 0);
|
||||
DCHECK_GT(render_routing_id, 0);
|
||||
|
||||
base::AutoLock lock_scope(*lock_);
|
||||
|
||||
if (!render_frame_id_set_.empty()) {
|
||||
RenderIdSet::const_iterator it = render_frame_id_set_.find(
|
||||
std::make_pair(render_process_id, render_routing_id));
|
||||
DCHECK(it == render_frame_id_set_.end());
|
||||
if (it != render_frame_id_set_.end())
|
||||
return;
|
||||
}
|
||||
|
||||
render_frame_id_set_.insert(
|
||||
std::make_pair(render_process_id, render_routing_id));
|
||||
}
|
||||
|
||||
void CefBrowserInfo::RenderIDManager::remove_render_frame_id(
|
||||
int render_process_id,
|
||||
int render_routing_id) {
|
||||
DCHECK_GT(render_process_id, 0);
|
||||
DCHECK_GT(render_routing_id, 0);
|
||||
|
||||
base::AutoLock lock_scope(*lock_);
|
||||
|
||||
DCHECK(!render_frame_id_set_.empty());
|
||||
if (render_frame_id_set_.empty())
|
||||
return;
|
||||
|
||||
bool erased = render_frame_id_set_.erase(
|
||||
std::make_pair(render_process_id, render_routing_id)) != 0;
|
||||
DCHECK(erased);
|
||||
}
|
||||
|
||||
bool CefBrowserInfo::RenderIDManager::is_render_frame_id_match(
|
||||
int render_process_id,
|
||||
int render_routing_id) const {
|
||||
base::AutoLock lock_scope(*lock_);
|
||||
|
||||
if (render_frame_id_set_.empty())
|
||||
return false;
|
||||
|
||||
RenderIdSet::const_iterator it = render_frame_id_set_.find(
|
||||
std::make_pair(render_process_id, render_routing_id));
|
||||
return (it != render_frame_id_set_.end());
|
||||
}
|
||||
|
||||
// CefBrowserInfo::FrameTreeNodeIDManager
|
||||
|
||||
CefBrowserInfo::FrameTreeNodeIDManager::FrameTreeNodeIDManager(base::Lock* lock)
|
||||
: lock_(lock) {
|
||||
DCHECK(lock);
|
||||
}
|
||||
|
||||
void CefBrowserInfo::FrameTreeNodeIDManager::add_frame_tree_node_id(
|
||||
int frame_tree_node_id) {
|
||||
DCHECK_GE(frame_tree_node_id, 0);
|
||||
|
||||
base::AutoLock lock_scope(*lock_);
|
||||
|
||||
if (!frame_tree_node_id_set_.empty()) {
|
||||
FrameTreeNodeIdSet::const_iterator it =
|
||||
frame_tree_node_id_set_.find(frame_tree_node_id);
|
||||
DCHECK(it == frame_tree_node_id_set_.end());
|
||||
if (it != frame_tree_node_id_set_.end())
|
||||
return;
|
||||
}
|
||||
|
||||
frame_tree_node_id_set_.insert(frame_tree_node_id);
|
||||
}
|
||||
|
||||
void CefBrowserInfo::FrameTreeNodeIDManager::remove_frame_tree_node_id(
|
||||
int frame_tree_node_id) {
|
||||
DCHECK_GE(frame_tree_node_id, 0);
|
||||
|
||||
base::AutoLock lock_scope(*lock_);
|
||||
|
||||
DCHECK(!frame_tree_node_id_set_.empty());
|
||||
if (frame_tree_node_id_set_.empty())
|
||||
return;
|
||||
|
||||
bool erased = frame_tree_node_id_set_.erase(frame_tree_node_id) != 0;
|
||||
DCHECK(erased);
|
||||
}
|
||||
|
||||
bool CefBrowserInfo::FrameTreeNodeIDManager::is_frame_tree_node_id_match(
|
||||
int frame_tree_node_id) const {
|
||||
base::AutoLock lock_scope(*lock_);
|
||||
|
||||
if (frame_tree_node_id_set_.empty())
|
||||
return false;
|
||||
|
||||
FrameTreeNodeIdSet::const_iterator it =
|
||||
frame_tree_node_id_set_.find(frame_tree_node_id);
|
||||
return (it != frame_tree_node_id_set_.end());
|
||||
}
|
||||
|
||||
// CefBrowserInfo
|
||||
|
||||
CefBrowserInfo::CefBrowserInfo(int browser_id, bool is_popup)
|
||||
: browser_id_(browser_id),
|
||||
is_popup_(is_popup),
|
||||
is_windowless_(is_windowless),
|
||||
extra_info_(extra_info) {
|
||||
is_windowless_(false),
|
||||
render_id_manager_(&lock_),
|
||||
guest_render_id_manager_(&lock_),
|
||||
frame_tree_node_id_manager_(&lock_) {
|
||||
DCHECK_GT(browser_id, 0);
|
||||
}
|
||||
|
||||
CefBrowserInfo::~CefBrowserInfo() {}
|
||||
|
||||
void CefBrowserInfo::set_windowless(bool windowless) {
|
||||
is_windowless_ = windowless;
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> CefBrowserInfo::browser() const {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
return browser_;
|
||||
}
|
||||
|
||||
void CefBrowserInfo::SetBrowser(CefRefPtr<CefBrowserHostImpl> browser) {
|
||||
void CefBrowserInfo::set_browser(CefRefPtr<CefBrowserHostImpl> browser) {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
browser_ = browser;
|
||||
|
||||
if (!browser) {
|
||||
RemoveAllFrames();
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserInfo::MaybeCreateFrame(content::RenderFrameHost* host,
|
||||
bool is_guest_view) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
const auto frame_id = CefFrameHostImpl::MakeFrameId(host);
|
||||
const int frame_tree_node_id = host->GetFrameTreeNodeId();
|
||||
const bool is_main_frame = (host->GetParent() == nullptr);
|
||||
|
||||
// A speculative RFH will be created in response to a browser-initiated
|
||||
// cross-origin navigation (e.g. via LoadURL) and eventually either discarded
|
||||
// or swapped in based on whether the navigation is committed. We'll create a
|
||||
// frame object for the speculative RFH so that it can be found by
|
||||
// frame/routing ID. However, we won't replace the main frame with a
|
||||
// speculative RFH until after it's swapped in, and we'll generally prefer to
|
||||
// return a non-speculative RFH for the same node ID if one exists.
|
||||
const bool is_speculative = (static_cast<content::RenderFrameHostImpl*>(host)
|
||||
->frame_tree_node()
|
||||
->render_manager()
|
||||
->current_frame_host() != host);
|
||||
|
||||
base::AutoLock lock_scope(lock_);
|
||||
DCHECK(browser_);
|
||||
|
||||
const auto it = frame_id_map_.find(frame_id);
|
||||
if (it != frame_id_map_.end()) {
|
||||
auto info = it->second;
|
||||
|
||||
#if DCHECK_IS_ON()
|
||||
// Check that the frame info hasn't changed unexpectedly.
|
||||
DCHECK_EQ(info->frame_id_, frame_id);
|
||||
DCHECK_EQ(info->frame_tree_node_id_, frame_tree_node_id);
|
||||
DCHECK_EQ(info->is_guest_view_, is_guest_view);
|
||||
DCHECK_EQ(info->is_main_frame_, is_main_frame);
|
||||
#endif
|
||||
|
||||
if (!info->is_guest_view_ && info->is_speculative_ && !is_speculative) {
|
||||
// Upgrade the frame info from speculative to non-speculative.
|
||||
if (info->is_main_frame_) {
|
||||
if (main_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;
|
||||
MaybeUpdateFrameTreeNodeIdMap(info);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
auto frame_info = new FrameInfo;
|
||||
frame_info->host_ = host;
|
||||
frame_info->frame_id_ = frame_id;
|
||||
frame_info->frame_tree_node_id_ = frame_tree_node_id;
|
||||
frame_info->is_guest_view_ = is_guest_view;
|
||||
frame_info->is_main_frame_ = is_main_frame;
|
||||
frame_info->is_speculative_ = is_speculative;
|
||||
|
||||
// Guest views don't get their own CefBrowser or CefFrame objects.
|
||||
if (!is_guest_view) {
|
||||
if (is_main_frame && main_frame_ && !is_speculative) {
|
||||
// Update the existing main frame object.
|
||||
main_frame_->SetRenderFrameHost(host);
|
||||
frame_info->frame_ = main_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()
|
||||
// Check that the frame info hasn't changed unexpectedly.
|
||||
DCHECK_EQ(frame_id, frame_info->frame_->GetIdentifier());
|
||||
DCHECK_EQ(frame_info->is_main_frame_, frame_info->frame_->IsMain());
|
||||
#endif
|
||||
}
|
||||
|
||||
browser_->request_context()->OnRenderFrameCreated(
|
||||
host->GetProcess()->GetID(), host->GetRoutingID(), frame_tree_node_id,
|
||||
is_main_frame, is_guest_view);
|
||||
|
||||
// Populate the lookup maps.
|
||||
frame_id_map_.insert(std::make_pair(frame_id, frame_info));
|
||||
MaybeUpdateFrameTreeNodeIdMap(frame_info);
|
||||
|
||||
// And finally set the ownership.
|
||||
frame_info_set_.insert(base::WrapUnique(frame_info));
|
||||
}
|
||||
|
||||
void CefBrowserInfo::RemoveFrame(content::RenderFrameHost* host) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
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());
|
||||
|
||||
auto frame_info = it->second;
|
||||
|
||||
browser_->request_context()->OnRenderFrameDeleted(
|
||||
host->GetProcess()->GetID(), host->GetRoutingID(),
|
||||
frame_info->frame_tree_node_id_, frame_info->is_main_frame_,
|
||||
frame_info->is_guest_view_);
|
||||
|
||||
// Remove from the lookup maps.
|
||||
frame_id_map_.erase(it);
|
||||
|
||||
// A new RFH with the same node ID may be added before the old RFH is deleted,
|
||||
// or this might be a speculative RFH. Therefore only delete the map entry if
|
||||
// it's currently pointing to the to-be-deleted frame info object.
|
||||
if (frame_tree_node_id_map_.find(frame_info->frame_tree_node_id_)->second ==
|
||||
frame_info) {
|
||||
frame_tree_node_id_map_.erase(frame_info->frame_tree_node_id_);
|
||||
}
|
||||
|
||||
// And finally delete the frame info.
|
||||
auto it2 = frame_info_set_.find(frame_info);
|
||||
frame_info_set_.erase(it2);
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetMainFrame() {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
DCHECK(browser_);
|
||||
if (!main_frame_) {
|
||||
// Create a temporary object that will eventually be updated with real
|
||||
// routing information.
|
||||
main_frame_ =
|
||||
new CefFrameHostImpl(this, true, CefFrameHostImpl::kInvalidFrameId);
|
||||
}
|
||||
return main_frame_;
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::CreateTempSubFrame(
|
||||
int64_t parent_frame_id) {
|
||||
CefRefPtr<CefFrameHostImpl> parent = GetFrameForId(parent_frame_id);
|
||||
if (!parent)
|
||||
parent = GetMainFrame();
|
||||
return new CefFrameHostImpl(this, false, parent->GetIdentifier());
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForHost(
|
||||
const content::RenderFrameHost* host,
|
||||
bool* is_guest_view) const {
|
||||
if (is_guest_view)
|
||||
*is_guest_view = false;
|
||||
|
||||
if (!host)
|
||||
return nullptr;
|
||||
|
||||
return GetFrameForId(CefFrameHostImpl::MakeFrameId(host), is_guest_view);
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForRoute(
|
||||
int32_t render_process_id,
|
||||
int32_t render_routing_id,
|
||||
bool* is_guest_view) const {
|
||||
if (is_guest_view)
|
||||
*is_guest_view = false;
|
||||
|
||||
if (render_process_id < 0 || render_routing_id < 0)
|
||||
return nullptr;
|
||||
|
||||
return GetFrameForId(
|
||||
CefFrameHostImpl::MakeFrameId(render_process_id, render_routing_id),
|
||||
is_guest_view);
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForId(
|
||||
int64_t frame_id,
|
||||
bool* is_guest_view) const {
|
||||
if (is_guest_view)
|
||||
*is_guest_view = false;
|
||||
|
||||
if (frame_id < 0)
|
||||
return nullptr;
|
||||
|
||||
base::AutoLock lock_scope(lock_);
|
||||
|
||||
const auto it = frame_id_map_.find(frame_id);
|
||||
if (it != frame_id_map_.end()) {
|
||||
const auto info = it->second;
|
||||
|
||||
if (info->is_guest_view_) {
|
||||
if (is_guest_view)
|
||||
*is_guest_view = true;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (info->is_speculative_) {
|
||||
if (info->is_main_frame_ && main_frame_) {
|
||||
// Always prefer the non-speculative main frame.
|
||||
return main_frame_;
|
||||
} else {
|
||||
// Always prefer an existing non-speculative frame for the same node ID.
|
||||
bool is_guest_view_tmp;
|
||||
auto frame = GetFrameForFrameTreeNodeInternal(info->frame_tree_node_id_,
|
||||
&is_guest_view_tmp);
|
||||
if (is_guest_view_tmp) {
|
||||
if (is_guest_view)
|
||||
*is_guest_view = true;
|
||||
return nullptr;
|
||||
}
|
||||
if (frame)
|
||||
return frame;
|
||||
}
|
||||
|
||||
LOG(WARNING) << "Returning a speculative frame for frame id " << frame_id;
|
||||
}
|
||||
|
||||
DCHECK(info->frame_);
|
||||
return info->frame_;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForFrameTreeNode(
|
||||
int frame_tree_node_id,
|
||||
bool* is_guest_view) const {
|
||||
if (is_guest_view)
|
||||
*is_guest_view = false;
|
||||
|
||||
if (frame_tree_node_id < 0)
|
||||
return nullptr;
|
||||
|
||||
base::AutoLock lock_scope(lock_);
|
||||
return GetFrameForFrameTreeNodeInternal(frame_tree_node_id, is_guest_view);
|
||||
}
|
||||
|
||||
CefBrowserInfo::FrameHostList CefBrowserInfo::GetAllFrames() const {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
FrameHostList frames;
|
||||
for (const auto& info : frame_info_set_) {
|
||||
if (info->frame_ && !info->is_speculative_)
|
||||
frames.insert(info->frame_);
|
||||
}
|
||||
return frames;
|
||||
}
|
||||
|
||||
void CefBrowserInfo::MaybeUpdateFrameTreeNodeIdMap(FrameInfo* info) {
|
||||
lock_.AssertAcquired();
|
||||
|
||||
auto it = frame_tree_node_id_map_.find(info->frame_tree_node_id_);
|
||||
const bool has_entry = (it != frame_tree_node_id_map_.end());
|
||||
|
||||
if (has_entry && it->second == info) {
|
||||
// Already mapping to |info|.
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't replace an existing node ID entry with a speculative RFH, but do
|
||||
// add an entry if one doesn't already exist.
|
||||
if (!info->is_speculative_ || !has_entry) {
|
||||
// A new RFH with the same node ID may be added before the old RFH is
|
||||
// deleted. To avoid duplicate entries in the map remove the old entry, if
|
||||
// any, before adding the new entry.
|
||||
if (has_entry)
|
||||
frame_tree_node_id_map_.erase(it);
|
||||
|
||||
frame_tree_node_id_map_.insert(
|
||||
std::make_pair(info->frame_tree_node_id_, info));
|
||||
}
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForFrameTreeNodeInternal(
|
||||
int frame_tree_node_id,
|
||||
bool* is_guest_view) const {
|
||||
if (is_guest_view)
|
||||
*is_guest_view = false;
|
||||
|
||||
lock_.AssertAcquired();
|
||||
|
||||
const auto it = frame_tree_node_id_map_.find(frame_tree_node_id);
|
||||
if (it != frame_tree_node_id_map_.end()) {
|
||||
const auto info = it->second;
|
||||
|
||||
LOG_IF(WARNING, info->is_speculative_)
|
||||
<< "Returning a speculative frame for node id " << frame_tree_node_id;
|
||||
|
||||
if (info->is_guest_view_) {
|
||||
if (is_guest_view)
|
||||
*is_guest_view = true;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DCHECK(info->frame_);
|
||||
return info->frame_;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CefBrowserInfo::RemoveAllFrames() {
|
||||
lock_.AssertAcquired();
|
||||
|
||||
// Clear the lookup maps.
|
||||
frame_id_map_.clear();
|
||||
frame_tree_node_id_map_.clear();
|
||||
|
||||
// Explicitly Detach main frames.
|
||||
for (auto& info : frame_info_set_) {
|
||||
if (info->frame_ && info->is_main_frame_)
|
||||
info->frame_->Detach();
|
||||
}
|
||||
|
||||
if (main_frame_) {
|
||||
main_frame_->Detach();
|
||||
main_frame_ = nullptr;
|
||||
}
|
||||
|
||||
// And finally delete the frame info.
|
||||
frame_info_set_.clear();
|
||||
}
|
||||
|
@@ -7,172 +7,128 @@
|
||||
#pragma once
|
||||
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "include/internal/cef_ptr.h"
|
||||
#include "libcef/common/values_impl.h"
|
||||
|
||||
#include "base/containers/unique_ptr_adapters.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/synchronization/lock.h"
|
||||
#include "base/values.h"
|
||||
|
||||
namespace content {
|
||||
class RenderFrameHost;
|
||||
}
|
||||
|
||||
class CefBrowserHostImpl;
|
||||
class CefFrameHostImpl;
|
||||
|
||||
// CefBrowserInfo is used to associate a browser ID and render view/process
|
||||
// IDs with a particular CefBrowserHostImpl. Render view/process IDs may change
|
||||
// during the lifetime of a single CefBrowserHostImpl.
|
||||
//
|
||||
// CefBrowserInfo objects are managed by CefBrowserInfoManager and should not be
|
||||
// created directly.
|
||||
// CefBrowserInfo objects are managed by CefContentBrowserClient and should not
|
||||
// be created directly.
|
||||
class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
public:
|
||||
CefBrowserInfo(int browser_id,
|
||||
bool is_popup,
|
||||
bool is_windowless,
|
||||
CefRefPtr<CefDictionaryValue> extra_info);
|
||||
class RenderIDManager {
|
||||
public:
|
||||
explicit RenderIDManager(base::Lock* lock);
|
||||
|
||||
// Adds an ID pair if it doesn't already exist.
|
||||
void add_render_frame_id(int render_process_id, int render_routing_id);
|
||||
|
||||
// Remove an ID pair if it exists.
|
||||
void remove_render_frame_id(int render_process_id, int render_routing_id);
|
||||
|
||||
// Returns true if this browser matches the specified ID pair.
|
||||
bool is_render_frame_id_match(int render_process_id,
|
||||
int render_routing_id) const;
|
||||
|
||||
private:
|
||||
typedef std::set<std::pair<int, int>> RenderIdSet;
|
||||
|
||||
// Access to |render_frame_id_set_| must be protected by |lock_|.
|
||||
mutable base::Lock* lock_;
|
||||
|
||||
// Set of mapped (process_id, routing_id) pairs. Keeping this set is
|
||||
// necessary for the following reasons:
|
||||
// 1. When navigating cross-origin the new (pending) RenderFrameHost will be
|
||||
// created before the old (current) RenderFrameHost is destroyed.
|
||||
// 2. When canceling and asynchronously continuing navigation of the same
|
||||
// URL a new RenderFrameHost may be created for the first (canceled)
|
||||
// navigation and then destroyed as a result of the second (allowed)
|
||||
// navigation.
|
||||
// 3. Out-of-process iframes have their own render IDs which must also be
|
||||
// associated with the host browser.
|
||||
RenderIdSet render_frame_id_set_;
|
||||
};
|
||||
|
||||
class FrameTreeNodeIDManager {
|
||||
public:
|
||||
explicit FrameTreeNodeIDManager(base::Lock* lock);
|
||||
|
||||
// Adds an ID if it doesn't already exist.
|
||||
void add_frame_tree_node_id(int frame_tree_node_id);
|
||||
|
||||
// Remove an ID if it exists.
|
||||
void remove_frame_tree_node_id(int frame_tree_node_id);
|
||||
|
||||
// Returns true if this browser matches the specified ID.
|
||||
bool is_frame_tree_node_id_match(int frame_tree_node_id) const;
|
||||
|
||||
private:
|
||||
typedef std::set<int> FrameTreeNodeIdSet;
|
||||
|
||||
// Access to |request_id_set_| must be protected by |lock_|.
|
||||
mutable base::Lock* lock_;
|
||||
|
||||
// Set of mapped frame_tree_node_id values. Keeping this set is necessary
|
||||
// because, when navigating the main frame, a new (pre-commit) URLRequest
|
||||
// will be created before the RenderFrameHost. Consequently we can't rely
|
||||
// on ResourceRequestInfo::GetRenderFrameForRequest returning a valid frame
|
||||
// ID. See https://crbug.com/776884 for background.
|
||||
FrameTreeNodeIdSet frame_tree_node_id_set_;
|
||||
};
|
||||
|
||||
CefBrowserInfo(int browser_id, bool is_popup);
|
||||
|
||||
int browser_id() const { return browser_id_; }
|
||||
bool is_popup() const { return is_popup_; }
|
||||
bool is_windowless() const { return is_windowless_; }
|
||||
CefRefPtr<CefDictionaryValue> extra_info() const { return extra_info_; }
|
||||
|
||||
// May return NULL if the browser has not yet been created or if the browser
|
||||
// has been destroyed.
|
||||
void set_windowless(bool windowless);
|
||||
|
||||
// Returns the render ID manager for this browser.
|
||||
RenderIDManager* render_id_manager() { return &render_id_manager_; }
|
||||
|
||||
// Returns the render ID manager for guest views owned by this browser.
|
||||
RenderIDManager* guest_render_id_manager() {
|
||||
return &guest_render_id_manager_;
|
||||
}
|
||||
|
||||
// Returns the frame tree node ID manager for this browser.
|
||||
FrameTreeNodeIDManager* frame_tree_node_id_manager() {
|
||||
return &frame_tree_node_id_manager_;
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser() const;
|
||||
|
||||
// Set or clear the browser. Called from the CefBrowserHostImpl constructor
|
||||
// (to set) and DestroyBrowser (to clear).
|
||||
void SetBrowser(CefRefPtr<CefBrowserHostImpl> browser);
|
||||
|
||||
// Ensure that a frame record exists for |host|. Called for the main frame
|
||||
// when the RenderView is created, or for a sub-frame when the associated
|
||||
// RenderFrame is created in the renderer process.
|
||||
// Called from CefBrowserHostImpl::RenderFrameCreated (is_guest_view = false)
|
||||
// or CefMimeHandlerViewGuestDelegate::OnGuestAttached (is_guest_view = true).
|
||||
void MaybeCreateFrame(content::RenderFrameHost* host, bool is_guest_view);
|
||||
|
||||
// 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
|
||||
// is destroyed in the renderer process.
|
||||
// Called from CefBrowserHostImpl::FrameDeleted or
|
||||
// CefMimeHandlerViewGuestDelegate::OnGuestDetached.
|
||||
void RemoveFrame(content::RenderFrameHost* host);
|
||||
|
||||
// Returns the main frame object. This object will remain valid until the
|
||||
// browser is destroyed even though the indentifier may change with cross-
|
||||
// origin navigations. Furthermore, calling LoadURL on this object will always
|
||||
// behave as expected because the call is routed through the browser's
|
||||
// NavigationController.
|
||||
CefRefPtr<CefFrameHostImpl> GetMainFrame();
|
||||
|
||||
// Creates a temporary sub-frame object for situations during navigation or
|
||||
// resource loading where a RFH does not yet exist. If |parent_frame_id|
|
||||
// is invalid the current main frame will be specified as the parent.
|
||||
// Temporary frame objects are not tracked but will be implicitly detached
|
||||
// on browser destruction.
|
||||
CefRefPtr<CefFrameHostImpl> CreateTempSubFrame(int64_t parent_frame_id);
|
||||
|
||||
// Returns the frame object matching the specified host or nullptr if no match
|
||||
// is found. Nullptr will also be returned if a guest view match is found
|
||||
// because we don't create frame objects for guest views. If |is_guest_view|
|
||||
// is non-nullptr it will be set to true in this case. Must be called on the
|
||||
// UI thread.
|
||||
CefRefPtr<CefFrameHostImpl> GetFrameForHost(
|
||||
const content::RenderFrameHost* host,
|
||||
bool* is_guest_view = nullptr) const;
|
||||
|
||||
// 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
|
||||
// because we don't create frame objects for guest views. If |is_guest_view|
|
||||
// is non-nullptr it will be set to true in this case. Safe to call from any
|
||||
// thread.
|
||||
CefRefPtr<CefFrameHostImpl> GetFrameForRoute(
|
||||
int32_t render_process_id,
|
||||
int32_t render_routing_id,
|
||||
bool* is_guest_view = nullptr) const;
|
||||
|
||||
// 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
|
||||
// because we don't create frame objects for guest views. If |is_guest_view|
|
||||
// is non-nullptr it will be set to true in this case. Safe to call from any
|
||||
// thread.
|
||||
CefRefPtr<CefFrameHostImpl> GetFrameForId(
|
||||
int64_t frame_id,
|
||||
bool* is_guest_view = nullptr) const;
|
||||
|
||||
// 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
|
||||
// because we don't create frame objects for guest views. If |is_guest_view|
|
||||
// is non-nullptr it will be set to true in this case. Safe to call from any
|
||||
// thread.
|
||||
CefRefPtr<CefFrameHostImpl> GetFrameForFrameTreeNode(
|
||||
int frame_tree_node_id,
|
||||
bool* is_guest_view = nullptr) const;
|
||||
|
||||
// Returns all non-speculative frame objects that currently exist. Guest views
|
||||
// will be excluded because they don't have a frame object. Safe to call from
|
||||
// any thread.
|
||||
typedef std::set<CefRefPtr<CefFrameHostImpl>> FrameHostList;
|
||||
FrameHostList GetAllFrames() const;
|
||||
void set_browser(CefRefPtr<CefBrowserHostImpl> browser);
|
||||
|
||||
private:
|
||||
friend class base::RefCountedThreadSafe<CefBrowserInfo>;
|
||||
|
||||
virtual ~CefBrowserInfo();
|
||||
|
||||
struct FrameInfo {
|
||||
~FrameInfo();
|
||||
|
||||
content::RenderFrameHost* host_;
|
||||
int64_t frame_id_; // Combination of render_process_id + render_routing_id.
|
||||
int frame_tree_node_id_;
|
||||
bool is_guest_view_;
|
||||
bool is_main_frame_;
|
||||
bool is_speculative_;
|
||||
CefRefPtr<CefFrameHostImpl> frame_;
|
||||
};
|
||||
|
||||
void MaybeUpdateFrameTreeNodeIdMap(FrameInfo* info);
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> GetFrameForFrameTreeNodeInternal(
|
||||
int frame_tree_node_id,
|
||||
bool* is_guest_view = nullptr) const;
|
||||
|
||||
void RemoveAllFrames();
|
||||
~CefBrowserInfo();
|
||||
|
||||
int browser_id_;
|
||||
bool is_popup_;
|
||||
bool is_windowless_;
|
||||
CefRefPtr<CefDictionaryValue> extra_info_;
|
||||
|
||||
mutable base::Lock lock_;
|
||||
|
||||
// The below members must be protected by |lock_|.
|
||||
|
||||
RenderIDManager render_id_manager_;
|
||||
RenderIDManager guest_render_id_manager_;
|
||||
|
||||
FrameTreeNodeIDManager frame_tree_node_id_manager_;
|
||||
|
||||
// May be NULL if the browser has not yet been created or if the browser has
|
||||
// been destroyed.
|
||||
CefRefPtr<CefBrowserHostImpl> browser_;
|
||||
|
||||
// Owner of FrameInfo structs.
|
||||
typedef std::set<std::unique_ptr<FrameInfo>, base::UniquePtrComparator>
|
||||
FrameInfoSet;
|
||||
FrameInfoSet frame_info_set_;
|
||||
|
||||
// Map a frame ID (e.g. MakeFrameId(process_id, routing_id)) to one frame.
|
||||
typedef std::unordered_map<int64_t, FrameInfo*> FrameIDMap;
|
||||
FrameIDMap frame_id_map_;
|
||||
|
||||
// Map a frame_tree_node_id to one frame.
|
||||
typedef std::unordered_map<int, FrameInfo*> FrameTreeNodeIDMap;
|
||||
FrameTreeNodeIDMap frame_tree_node_id_map_;
|
||||
|
||||
// The current main frame.
|
||||
CefRefPtr<CefFrameHostImpl> main_frame_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserInfo);
|
||||
};
|
||||
|
||||
|
@@ -12,7 +12,6 @@
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/cef_messages.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
#include "libcef/common/values_impl.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "content/common/view_messages.h"
|
||||
@@ -61,37 +60,50 @@ CefBrowserInfoManager* CefBrowserInfoManager::GetInstance() {
|
||||
|
||||
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreateBrowserInfo(
|
||||
bool is_popup,
|
||||
bool is_windowless,
|
||||
CefRefPtr<CefDictionaryValue> extra_info) {
|
||||
bool is_windowless) {
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
|
||||
scoped_refptr<CefBrowserInfo> browser_info = new CefBrowserInfo(
|
||||
++next_browser_id_, is_popup, is_windowless, extra_info);
|
||||
scoped_refptr<CefBrowserInfo> browser_info =
|
||||
new CefBrowserInfo(++next_browser_id_, is_popup);
|
||||
browser_info_list_.push_back(browser_info);
|
||||
|
||||
if (is_windowless)
|
||||
browser_info->set_windowless(true);
|
||||
|
||||
return browser_info;
|
||||
}
|
||||
|
||||
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreatePopupBrowserInfo(
|
||||
content::WebContents* new_contents,
|
||||
bool is_windowless,
|
||||
CefRefPtr<CefDictionaryValue> extra_info) {
|
||||
bool is_windowless) {
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
|
||||
auto frame_host = new_contents->GetMainFrame();
|
||||
content::RenderFrameHost* frame_host = new_contents->GetMainFrame();
|
||||
const int render_process_id = frame_host->GetProcess()->GetID();
|
||||
const auto frame_id = CefFrameHostImpl::MakeFrameId(frame_host);
|
||||
const int render_frame_routing_id = frame_host->GetRoutingID();
|
||||
|
||||
scoped_refptr<CefBrowserInfo> browser_info =
|
||||
new CefBrowserInfo(++next_browser_id_, true, is_windowless, extra_info);
|
||||
new CefBrowserInfo(++next_browser_id_, true);
|
||||
browser_info->render_id_manager()->add_render_frame_id(
|
||||
render_process_id, render_frame_routing_id);
|
||||
browser_info_list_.push_back(browser_info);
|
||||
|
||||
if (is_windowless)
|
||||
browser_info->set_windowless(true);
|
||||
|
||||
// Continue any pending NewBrowserInfo requests.
|
||||
auto it = pending_new_browser_info_map_.find(frame_id);
|
||||
if (it != pending_new_browser_info_map_.end()) {
|
||||
SendNewBrowserInfoResponse(render_process_id, browser_info, false,
|
||||
it->second->reply_msg);
|
||||
pending_new_browser_info_map_.erase(it);
|
||||
PendingNewBrowserInfoList::iterator it =
|
||||
pending_new_browser_info_list_.begin();
|
||||
for (; it != pending_new_browser_info_list_.end(); ++it) {
|
||||
PendingNewBrowserInfo* info = it->get();
|
||||
if (info->render_process_id == render_process_id &&
|
||||
info->render_frame_routing_id == render_frame_routing_id) {
|
||||
SendNewBrowserInfoResponse(render_process_id, browser_info, false,
|
||||
info->reply_msg);
|
||||
|
||||
pending_new_browser_info_list_.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return browser_info;
|
||||
@@ -144,8 +156,8 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
||||
|
||||
auto pending_popup = std::make_unique<CefBrowserInfoManager::PendingPopup>();
|
||||
pending_popup->step = CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW;
|
||||
pending_popup->opener_render_process_id = opener->GetProcess()->GetID();
|
||||
pending_popup->opener_render_routing_id = opener->GetRoutingID();
|
||||
pending_popup->opener_process_id = opener->GetProcess()->GetID();
|
||||
pending_popup->opener_frame_id = opener->GetRoutingID();
|
||||
pending_popup->target_url = target_url;
|
||||
pending_popup->target_frame_name = frame_name;
|
||||
|
||||
@@ -156,8 +168,8 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefLifeSpanHandler> handler = client->GetLifeSpanHandler();
|
||||
if (handler.get()) {
|
||||
CefRefPtr<CefFrame> opener_frame = browser->GetFrameForHost(opener);
|
||||
DCHECK(opener_frame);
|
||||
CefRefPtr<CefFrame> frame =
|
||||
browser->GetFrame(pending_popup->opener_frame_id);
|
||||
|
||||
CefPopupFeatures cef_features;
|
||||
TranslatePopupFeatures(features, cef_features);
|
||||
@@ -175,12 +187,11 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
||||
#endif
|
||||
|
||||
allow = !handler->OnBeforePopup(
|
||||
browser.get(), opener_frame, pending_popup->target_url.spec(),
|
||||
browser.get(), frame, pending_popup->target_url.spec(),
|
||||
pending_popup->target_frame_name,
|
||||
static_cast<cef_window_open_disposition_t>(disposition), user_gesture,
|
||||
cef_features, *window_info, pending_popup->client,
|
||||
pending_popup->settings, pending_popup->extra_info,
|
||||
no_javascript_access);
|
||||
pending_popup->settings, no_javascript_access);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,7 +203,6 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
||||
|
||||
create_params.settings = pending_popup->settings;
|
||||
create_params.client = pending_popup->client;
|
||||
create_params.extra_info = pending_popup->extra_info;
|
||||
|
||||
pending_popup->platform_delegate =
|
||||
CefBrowserPlatformDelegate::Create(create_params);
|
||||
@@ -214,14 +224,14 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
||||
void CefBrowserInfoManager::GetCustomWebContentsView(
|
||||
const GURL& target_url,
|
||||
int opener_render_process_id,
|
||||
int opener_render_routing_id,
|
||||
int opener_render_frame_id,
|
||||
content::WebContentsView** view,
|
||||
content::RenderViewHostDelegateView** delegate_view) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
std::unique_ptr<CefBrowserInfoManager::PendingPopup> pending_popup =
|
||||
PopPendingPopup(CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW,
|
||||
opener_render_process_id, opener_render_routing_id,
|
||||
opener_render_process_id, opener_render_frame_id,
|
||||
target_url);
|
||||
DCHECK(pending_popup.get());
|
||||
DCHECK(pending_popup->platform_delegate.get());
|
||||
@@ -239,39 +249,37 @@ void CefBrowserInfoManager::GetCustomWebContentsView(
|
||||
void CefBrowserInfoManager::WebContentsCreated(
|
||||
const GURL& target_url,
|
||||
int opener_render_process_id,
|
||||
int opener_render_routing_id,
|
||||
int opener_render_frame_id,
|
||||
CefBrowserSettings& settings,
|
||||
CefRefPtr<CefClient>& client,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate>& platform_delegate,
|
||||
CefRefPtr<CefDictionaryValue>& extra_info) {
|
||||
std::unique_ptr<CefBrowserPlatformDelegate>& platform_delegate) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
std::unique_ptr<CefBrowserInfoManager::PendingPopup> pending_popup =
|
||||
PopPendingPopup(
|
||||
CefBrowserInfoManager::PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW,
|
||||
opener_render_process_id, opener_render_routing_id, target_url);
|
||||
opener_render_process_id, opener_render_frame_id, target_url);
|
||||
DCHECK(pending_popup.get());
|
||||
DCHECK(pending_popup->platform_delegate.get());
|
||||
|
||||
settings = pending_popup->settings;
|
||||
client = pending_popup->client;
|
||||
platform_delegate = std::move(pending_popup->platform_delegate);
|
||||
extra_info = pending_popup->extra_info;
|
||||
}
|
||||
|
||||
void CefBrowserInfoManager::OnGetNewBrowserInfo(int render_process_id,
|
||||
int render_routing_id,
|
||||
int render_frame_routing_id,
|
||||
IPC::Message* reply_msg) {
|
||||
DCHECK_NE(render_process_id, content::ChildProcessHost::kInvalidUniqueID);
|
||||
DCHECK_GT(render_routing_id, 0);
|
||||
DCHECK_GT(render_frame_routing_id, 0);
|
||||
DCHECK(reply_msg);
|
||||
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
|
||||
bool is_guest_view = false;
|
||||
|
||||
scoped_refptr<CefBrowserInfo> browser_info =
|
||||
GetBrowserInfo(render_process_id, render_routing_id, &is_guest_view);
|
||||
scoped_refptr<CefBrowserInfo> browser_info = GetBrowserInfo(
|
||||
render_process_id, render_frame_routing_id, &is_guest_view);
|
||||
|
||||
if (browser_info.get()) {
|
||||
// Send the response immediately.
|
||||
@@ -280,20 +288,27 @@ void CefBrowserInfoManager::OnGetNewBrowserInfo(int render_process_id,
|
||||
return;
|
||||
}
|
||||
|
||||
const auto frame_id =
|
||||
CefFrameHostImpl::MakeFrameId(render_process_id, render_routing_id);
|
||||
|
||||
#if DCHECK_IS_ON()
|
||||
// Verify that no request for the same route is currently queued.
|
||||
DCHECK(pending_new_browser_info_map_.find(frame_id) ==
|
||||
pending_new_browser_info_map_.end());
|
||||
{
|
||||
PendingNewBrowserInfoList::const_iterator it =
|
||||
pending_new_browser_info_list_.begin();
|
||||
for (; it != pending_new_browser_info_list_.end(); ++it) {
|
||||
PendingNewBrowserInfo* info = it->get();
|
||||
if (info->render_process_id == render_process_id &&
|
||||
info->render_frame_routing_id == render_frame_routing_id) {
|
||||
NOTREACHED();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Queue the request.
|
||||
std::unique_ptr<PendingNewBrowserInfo> pending(new PendingNewBrowserInfo());
|
||||
pending->render_process_id = render_process_id;
|
||||
pending->render_routing_id = render_routing_id;
|
||||
pending->render_frame_routing_id = render_frame_routing_id;
|
||||
pending->reply_msg = reply_msg;
|
||||
pending_new_browser_info_map_.insert(
|
||||
std::make_pair(frame_id, std::move(pending)));
|
||||
pending_new_browser_info_list_.push_back(std::move(pending));
|
||||
}
|
||||
|
||||
void CefBrowserInfoManager::RemoveBrowserInfo(
|
||||
@@ -341,32 +356,26 @@ void CefBrowserInfoManager::DestroyAllBrowsers() {
|
||||
#endif
|
||||
}
|
||||
|
||||
scoped_refptr<CefBrowserInfo>
|
||||
CefBrowserInfoManager::GetBrowserInfoForFrameRoute(int render_process_id,
|
||||
int render_routing_id,
|
||||
bool* is_guest_view) {
|
||||
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::GetBrowserInfoForFrame(
|
||||
int render_process_id,
|
||||
int render_routing_id,
|
||||
bool* is_guest_view) {
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
return GetBrowserInfo(render_process_id, render_routing_id, is_guest_view);
|
||||
}
|
||||
|
||||
scoped_refptr<CefBrowserInfo>
|
||||
CefBrowserInfoManager::GetBrowserInfoForFrameTreeNode(int frame_tree_node_id,
|
||||
bool* is_guest_view) {
|
||||
if (is_guest_view)
|
||||
*is_guest_view = false;
|
||||
|
||||
CefBrowserInfoManager::GetBrowserInfoForFrameTreeNode(int frame_tree_node_id) {
|
||||
if (frame_tree_node_id < 0)
|
||||
return nullptr;
|
||||
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
|
||||
for (const auto& browser_info : browser_info_list_) {
|
||||
bool is_guest_view_tmp;
|
||||
auto frame = browser_info->GetFrameForFrameTreeNode(frame_tree_node_id,
|
||||
&is_guest_view_tmp);
|
||||
if (frame || is_guest_view_tmp) {
|
||||
if (is_guest_view)
|
||||
*is_guest_view = is_guest_view_tmp;
|
||||
BrowserInfoList::const_iterator it = browser_info_list_.begin();
|
||||
for (; it != browser_info_list_.end(); ++it) {
|
||||
const scoped_refptr<CefBrowserInfo>& browser_info = *it;
|
||||
if (browser_info->frame_tree_node_id_manager()->is_frame_tree_node_id_match(
|
||||
frame_tree_node_id)) {
|
||||
return browser_info;
|
||||
}
|
||||
}
|
||||
@@ -374,12 +383,9 @@ CefBrowserInfoManager::GetBrowserInfoForFrameTreeNode(int frame_tree_node_id,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CefBrowserInfoManager::BrowserInfoList
|
||||
CefBrowserInfoManager::GetBrowserInfoList() {
|
||||
void CefBrowserInfoManager::GetBrowserInfoList(BrowserInfoList& list) {
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
BrowserInfoList copy;
|
||||
copy.assign(browser_info_list_.begin(), browser_info_list_.end());
|
||||
return copy;
|
||||
list = browser_info_list_;
|
||||
}
|
||||
|
||||
void CefBrowserInfoManager::RenderProcessHostDestroyed(
|
||||
@@ -393,12 +399,12 @@ void CefBrowserInfoManager::RenderProcessHostDestroyed(
|
||||
{
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
|
||||
PendingNewBrowserInfoMap::iterator it =
|
||||
pending_new_browser_info_map_.begin();
|
||||
while (it != pending_new_browser_info_map_.end()) {
|
||||
auto info = it->second.get();
|
||||
PendingNewBrowserInfoList::iterator it =
|
||||
pending_new_browser_info_list_.begin();
|
||||
while (it != pending_new_browser_info_list_.end()) {
|
||||
PendingNewBrowserInfo* info = it->get();
|
||||
if (info->render_process_id == render_process_id)
|
||||
it = pending_new_browser_info_map_.erase(it);
|
||||
it = pending_new_browser_info_list_.erase(it);
|
||||
else
|
||||
++it;
|
||||
}
|
||||
@@ -409,7 +415,7 @@ void CefBrowserInfoManager::RenderProcessHostDestroyed(
|
||||
PendingPopupList::iterator it = pending_popup_list_.begin();
|
||||
while (it != pending_popup_list_.end()) {
|
||||
PendingPopup* popup = it->get();
|
||||
if (popup->opener_render_process_id == render_process_id) {
|
||||
if (popup->opener_process_id == render_process_id) {
|
||||
it = pending_popup_list_.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
@@ -426,19 +432,18 @@ void CefBrowserInfoManager::PushPendingPopup(
|
||||
|
||||
std::unique_ptr<CefBrowserInfoManager::PendingPopup>
|
||||
CefBrowserInfoManager::PopPendingPopup(PendingPopup::Step step,
|
||||
int opener_render_process_id,
|
||||
int opener_render_routing_id,
|
||||
int opener_process_id,
|
||||
int opener_frame_id,
|
||||
const GURL& target_url) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK_GT(opener_render_process_id, 0);
|
||||
DCHECK_GT(opener_render_routing_id, 0);
|
||||
DCHECK_GT(opener_process_id, 0);
|
||||
DCHECK_GT(opener_frame_id, 0);
|
||||
|
||||
PendingPopupList::iterator it = pending_popup_list_.begin();
|
||||
for (; it != pending_popup_list_.end(); ++it) {
|
||||
PendingPopup* popup = it->get();
|
||||
if (popup->step == step &&
|
||||
popup->opener_render_process_id == opener_render_process_id &&
|
||||
popup->opener_render_routing_id == opener_render_routing_id &&
|
||||
if (popup->step == step && popup->opener_process_id == opener_process_id &&
|
||||
popup->opener_frame_id == opener_frame_id &&
|
||||
popup->target_url == target_url) {
|
||||
// Transfer ownership of the pointer.
|
||||
it->release();
|
||||
@@ -451,24 +456,29 @@ CefBrowserInfoManager::PopPendingPopup(PendingPopup::Step step,
|
||||
}
|
||||
|
||||
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::GetBrowserInfo(
|
||||
int render_process_id,
|
||||
int render_routing_id,
|
||||
int render_frame_process_id,
|
||||
int render_frame_routing_id,
|
||||
bool* is_guest_view) {
|
||||
browser_info_lock_.AssertAcquired();
|
||||
|
||||
if (is_guest_view)
|
||||
*is_guest_view = false;
|
||||
|
||||
if (render_process_id < 0 || render_routing_id < 0)
|
||||
if (render_frame_process_id < 0 || render_frame_routing_id < 0)
|
||||
return nullptr;
|
||||
|
||||
for (const auto& browser_info : browser_info_list_) {
|
||||
bool is_guest_view_tmp;
|
||||
auto frame = browser_info->GetFrameForRoute(
|
||||
render_process_id, render_routing_id, &is_guest_view_tmp);
|
||||
if (frame || is_guest_view_tmp) {
|
||||
BrowserInfoList::const_iterator it = browser_info_list_.begin();
|
||||
for (; it != browser_info_list_.end(); ++it) {
|
||||
const scoped_refptr<CefBrowserInfo>& browser_info = *it;
|
||||
if (browser_info->render_id_manager()->is_render_frame_id_match(
|
||||
render_frame_process_id, render_frame_routing_id)) {
|
||||
return browser_info;
|
||||
}
|
||||
if (extensions::ExtensionsEnabled() &&
|
||||
browser_info->guest_render_id_manager()->is_render_frame_id_match(
|
||||
render_frame_process_id, render_frame_routing_id)) {
|
||||
if (is_guest_view)
|
||||
*is_guest_view = is_guest_view_tmp;
|
||||
*is_guest_view = true;
|
||||
return browser_info;
|
||||
}
|
||||
}
|
||||
@@ -503,14 +513,6 @@ void CefBrowserInfoManager::SendNewBrowserInfoResponse(
|
||||
params.is_popup = browser_info->is_popup();
|
||||
params.is_guest_view = is_guest_view;
|
||||
|
||||
auto extra_info = browser_info->extra_info();
|
||||
if (extra_info) {
|
||||
auto extra_info_impl =
|
||||
static_cast<CefDictionaryValueImpl*>(extra_info.get());
|
||||
auto extra_info_value = extra_info_impl->CopyValue();
|
||||
extra_info_value->Swap(¶ms.extra_info);
|
||||
}
|
||||
|
||||
CefProcessHostMsg_GetNewBrowserInfo::WriteReplyParams(reply_msg, params);
|
||||
host->Send(reply_msg);
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "include/cef_client.h"
|
||||
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include "base/synchronization/lock.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/web/window_features.mojom.h"
|
||||
#include "ui/base/window_open_disposition.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
@@ -49,10 +49,8 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
|
||||
// Called from CefBrowserHostImpl::Create when a new browser is being created
|
||||
// directly. In this case |is_popup| will be true only for DevTools browsers.
|
||||
scoped_refptr<CefBrowserInfo> CreateBrowserInfo(
|
||||
bool is_popup,
|
||||
bool is_windowless,
|
||||
CefRefPtr<CefDictionaryValue> extra_info);
|
||||
scoped_refptr<CefBrowserInfo> CreateBrowserInfo(bool is_popup,
|
||||
bool is_windowless);
|
||||
|
||||
// Called from CefBrowserHostImpl::WebContentsCreated when a new browser is
|
||||
// being created for a traditional popup (e.g. window.open() or targeted
|
||||
@@ -60,8 +58,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
// response will be sent when this method is called.
|
||||
scoped_refptr<CefBrowserInfo> CreatePopupBrowserInfo(
|
||||
content::WebContents* new_contents,
|
||||
bool is_windowless,
|
||||
CefRefPtr<CefDictionaryValue> extra_info);
|
||||
bool is_windowless);
|
||||
|
||||
// Called from CefContentBrowserClient::CanCreateWindow. See comments on
|
||||
// PendingPopup for more information.
|
||||
@@ -80,7 +77,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
void GetCustomWebContentsView(
|
||||
const GURL& target_url,
|
||||
int opener_render_process_id,
|
||||
int opener_render_routing_id,
|
||||
int opener_render_frame_id,
|
||||
content::WebContentsView** view,
|
||||
content::RenderViewHostDelegateView** delegate_view);
|
||||
|
||||
@@ -89,11 +86,10 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
void WebContentsCreated(
|
||||
const GURL& target_url,
|
||||
int opener_render_process_id,
|
||||
int opener_render_routing_id,
|
||||
int opener_render_frame_id,
|
||||
CefBrowserSettings& settings,
|
||||
CefRefPtr<CefClient>& client,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate>& platform_delegate,
|
||||
CefRefPtr<CefDictionaryValue>& extra_info);
|
||||
std::unique_ptr<CefBrowserPlatformDelegate>& platform_delegate);
|
||||
|
||||
// Called from CefBrowserMessageFilter::OnGetNewBrowserInfo for delivering
|
||||
// browser info to the renderer process. If the browser info already exists
|
||||
@@ -103,7 +99,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
// already exist for traditional popup browsers depending on timing. See
|
||||
// comments on PendingPopup for more information.
|
||||
void OnGetNewBrowserInfo(int render_process_id,
|
||||
int render_routing_id,
|
||||
int render_frame_routing_id,
|
||||
IPC::Message* reply_msg);
|
||||
|
||||
// Called from CefBrowserHostImpl::DestroyBrowser() when a browser is
|
||||
@@ -113,30 +109,27 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
// Called from CefContext::FinishShutdownOnUIThread() to destroy all browsers.
|
||||
void DestroyAllBrowsers();
|
||||
|
||||
// Returns the CefBrowserInfo matching the specified IDs or nullptr if no
|
||||
// match is found. It is allowed to add new callers of this method but
|
||||
// consider using CefBrowserHostImpl::GetBrowserForFrameRoute() or
|
||||
// extensions::GetOwnerBrowserForFrameRoute() instead. If |is_guest_view| is
|
||||
// non-nullptr it will be set to true if the IDs match a guest view associated
|
||||
// with the returned browser info instead of the browser itself.
|
||||
scoped_refptr<CefBrowserInfo> GetBrowserInfoForFrameRoute(
|
||||
int render_process_id,
|
||||
int render_routing_id,
|
||||
bool* is_guest_view = nullptr);
|
||||
// Retrieves the CefBrowserInfo matching the specified IDs or an empty
|
||||
// pointer if no match is found. It is allowed to add new callers of this
|
||||
// method but consider using CefBrowserHostImpl::GetBrowserForFrame()
|
||||
// or extensions::GetOwnerBrowserForFrame() instead.
|
||||
// |is_guest_view| will be set to true if the IDs match a guest view
|
||||
// associated with the returned browser info instead of the browser itself.
|
||||
scoped_refptr<CefBrowserInfo> GetBrowserInfoForFrame(int render_process_id,
|
||||
int render_routing_id,
|
||||
bool* is_guest_view);
|
||||
|
||||
// Returns the CefBrowserInfo matching the specified ID or nullptr if no match
|
||||
// is found. It is allowed to add new callers of this method but consider
|
||||
// using CefBrowserHostImpl::GetBrowserForFrameTreeNode() instead. If
|
||||
// |is_guest_view| is non-nullptr it will be set to true if the IDs match a
|
||||
// guest view associated with the returned browser info instead of the browser
|
||||
// itself.
|
||||
// Retrieves the CefBrowserInfo matching the specified ID or an empty
|
||||
// pointer if no match is found. It is allowed to add new callers of this
|
||||
// method but consider using CefBrowserHostImpl::GetBrowserForRequest()
|
||||
// instead since we generally use this mapping for URLRequests on the IO
|
||||
// thread.
|
||||
scoped_refptr<CefBrowserInfo> GetBrowserInfoForFrameTreeNode(
|
||||
int frame_tree_node_id,
|
||||
bool* is_guest_view = nullptr);
|
||||
int frame_tree_node_id);
|
||||
|
||||
// Returns all existing CefBrowserInfo objects.
|
||||
// Retrieves all existing CefBrowserInfo objects.
|
||||
typedef std::list<scoped_refptr<CefBrowserInfo>> BrowserInfoList;
|
||||
BrowserInfoList GetBrowserInfoList();
|
||||
void GetBrowserInfoList(BrowserInfoList& list);
|
||||
|
||||
private:
|
||||
// RenderProcessHostObserver methods:
|
||||
@@ -167,15 +160,14 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
// Initial state from ViewHostMsg_CreateWindow.
|
||||
// |target_url| will be empty if a popup is created via window.open() and
|
||||
// never navigated. For example: javascript:window.open();
|
||||
int opener_render_process_id;
|
||||
int opener_render_routing_id;
|
||||
int opener_process_id;
|
||||
int opener_frame_id;
|
||||
GURL target_url;
|
||||
std::string target_frame_name;
|
||||
|
||||
// Values specified by OnBeforePopup.
|
||||
CefBrowserSettings settings;
|
||||
CefRefPtr<CefClient> client;
|
||||
CefRefPtr<CefDictionaryValue> extra_info;
|
||||
|
||||
// Platform delegate specific to the new popup.
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate;
|
||||
@@ -185,13 +177,13 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
void PushPendingPopup(std::unique_ptr<PendingPopup> popup);
|
||||
std::unique_ptr<PendingPopup> PopPendingPopup(PendingPopup::Step step,
|
||||
int opener_process_id,
|
||||
int opener_routing_id,
|
||||
int opener_frame_id,
|
||||
const GURL& target_url);
|
||||
|
||||
// Retrieves the BrowserInfo matching the specified IDs. If both sets are
|
||||
// valid then this method makes sure both sets have been registered.
|
||||
scoped_refptr<CefBrowserInfo> GetBrowserInfo(int render_process_id,
|
||||
int render_routing_id,
|
||||
scoped_refptr<CefBrowserInfo> GetBrowserInfo(int render_frame_process_id,
|
||||
int render_frame_routing_id,
|
||||
bool* is_guest_view);
|
||||
|
||||
// Send the response for a pending OnGetNewBrowserInfo request.
|
||||
@@ -204,7 +196,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
// Pending request for OnGetNewBrowserInfo.
|
||||
struct PendingNewBrowserInfo {
|
||||
int render_process_id;
|
||||
int render_routing_id;
|
||||
int render_frame_routing_id;
|
||||
IPC::Message* reply_msg;
|
||||
};
|
||||
|
||||
@@ -215,10 +207,9 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
BrowserInfoList browser_info_list_;
|
||||
int next_browser_id_;
|
||||
|
||||
// Map of frame ID to info.
|
||||
using PendingNewBrowserInfoMap =
|
||||
std::map<int64_t, std::unique_ptr<PendingNewBrowserInfo>>;
|
||||
PendingNewBrowserInfoMap pending_new_browser_info_map_;
|
||||
using PendingNewBrowserInfoList =
|
||||
std::vector<std::unique_ptr<PendingNewBrowserInfo>>;
|
||||
PendingNewBrowserInfoList pending_new_browser_info_list_;
|
||||
|
||||
// Only accessed on the UI thread.
|
||||
using PendingPopupList = std::vector<std::unique_ptr<PendingPopup>>;
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/browser_context_impl.h"
|
||||
#include "libcef/browser/browser_context_keyed_service_factories.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/context.h"
|
||||
@@ -21,15 +21,12 @@
|
||||
#include "libcef/common/extensions/extensions_client.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
#include "libcef/common/net/net_resource_provider.h"
|
||||
#include "libcef/common/net_service/util.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/task/post_task.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/browser/chrome_browser_main_extra_parts.h"
|
||||
#include "chrome/browser/net/system_network_context_manager.h"
|
||||
#include "chrome/browser/plugins/plugin_finder.h"
|
||||
#include "content/public/browser/gpu_data_manager.h"
|
||||
#include "extensions/browser/extension_system.h"
|
||||
@@ -56,18 +53,13 @@
|
||||
#endif // defined(USE_AURA)
|
||||
|
||||
#if defined(USE_AURA) && defined(OS_LINUX)
|
||||
#include "ui/base/ime/init/input_method_initializer.h"
|
||||
#include "ui/base/ime/input_method_initializer.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
#include "libcef/browser/printing/print_dialog_linux.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "components/os_crypt/os_crypt.h"
|
||||
#endif
|
||||
|
||||
CefBrowserMainParts::CefBrowserMainParts(
|
||||
const content::MainFunctionParams& parameters)
|
||||
: BrowserMainParts(), devtools_delegate_(NULL) {}
|
||||
@@ -123,15 +115,6 @@ void CefBrowserMainParts::PreMainMessageLoopStart() {
|
||||
ui::TouchFactory::SetTouchDeviceListFromCommandLine();
|
||||
#endif
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
if (net_service::IsEnabled()) {
|
||||
// Initialize the OSCrypt.
|
||||
PrefService* local_state = g_browser_process->local_state();
|
||||
DCHECK(local_state);
|
||||
OSCrypt::Init(local_state);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
|
||||
chrome_extra_parts_[i]->PreMainMessageLoopStart();
|
||||
}
|
||||
@@ -155,13 +138,9 @@ int CefBrowserMainParts::PreCreateThreads() {
|
||||
|
||||
net::NetModule::SetResourceProvider(&NetResourceProvider);
|
||||
|
||||
// Initialize these objects before IO access restrictions are applied and
|
||||
// Initialize the GpuDataManager before IO access restrictions are applied and
|
||||
// before the IO thread is started.
|
||||
content::GpuDataManager::GetInstance();
|
||||
if (net_service::IsEnabled()) {
|
||||
SystemNetworkContextManager::CreateInstance(
|
||||
g_browser_process->local_state());
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
|
||||
chrome_extra_parts_[i]->PreCreateThreads();
|
||||
@@ -219,7 +198,7 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
|
||||
// Create the global RequestContext.
|
||||
global_request_context_ =
|
||||
CefRequestContextImpl::CreateGlobalRequestContext(settings);
|
||||
CefBrowserContext* browser_context = static_cast<CefBrowserContext*>(
|
||||
CefBrowserContextImpl* browser_context = static_cast<CefBrowserContextImpl*>(
|
||||
global_request_context_->GetBrowserContext());
|
||||
|
||||
PostProfileInit();
|
||||
|
@@ -6,7 +6,7 @@
|
||||
#define CEF_LIBCEF_BROWSER_BROWSER_MAIN_H_
|
||||
#pragma once
|
||||
|
||||
#include "libcef/browser/net/url_request_context_getter.h"
|
||||
#include "libcef/browser/net/url_request_context_getter_impl.h"
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
|
||||
#include "base/macros.h"
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#include "libcef/common/content_client.h"
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/message_loop/message_pump.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/message_loop/message_pump_for_ui.h"
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
@@ -108,6 +108,6 @@ std::unique_ptr<base::MessagePump> MessagePumpFactoryForUI() {
|
||||
void InitMessagePumpFactoryForUI() {
|
||||
const CefSettings& settings = CefContext::Get()->settings();
|
||||
if (settings.external_message_pump) {
|
||||
base::MessagePump::OverrideMessagePumpForUIFactory(MessagePumpFactoryForUI);
|
||||
base::MessageLoop::InitMessagePumpForUIFactory(MessagePumpFactoryForUI);
|
||||
}
|
||||
}
|
||||
|
@@ -184,7 +184,7 @@ class CefBrowserPlatformDelegate {
|
||||
const content::NativeWebKeyboardEvent& event) = 0;
|
||||
|
||||
// Invoke platform specific handling for the external protocol.
|
||||
static void HandleExternalProtocol(const GURL& url);
|
||||
virtual void HandleExternalProtocol(const GURL& url) = 0;
|
||||
|
||||
// Translate CEF events to Chromium/Blink events.
|
||||
virtual void TranslateKeyEvent(content::NativeWebKeyboardEvent& result,
|
||||
|
@@ -2,7 +2,7 @@
|
||||
// reserved. Use of this source code is governed by a BSD-style license that can
|
||||
// be found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/net/browser_urlrequest_old_impl.h"
|
||||
#include "libcef/browser/browser_urlrequest_impl.h"
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
@@ -36,7 +36,7 @@ namespace {
|
||||
|
||||
class CefURLFetcherDelegate : public net::URLFetcherDelegate {
|
||||
public:
|
||||
CefURLFetcherDelegate(CefBrowserURLRequestOld::Context* context,
|
||||
CefURLFetcherDelegate(CefBrowserURLRequest::Context* context,
|
||||
int request_flags);
|
||||
~CefURLFetcherDelegate() override;
|
||||
|
||||
@@ -52,14 +52,14 @@ class CefURLFetcherDelegate : public net::URLFetcherDelegate {
|
||||
|
||||
private:
|
||||
// The context_ pointer will outlive this object.
|
||||
CefBrowserURLRequestOld::Context* context_;
|
||||
CefBrowserURLRequest::Context* context_;
|
||||
int request_flags_;
|
||||
};
|
||||
|
||||
class CefURLFetcherResponseWriter : public net::URLFetcherResponseWriter {
|
||||
public:
|
||||
CefURLFetcherResponseWriter(
|
||||
CefRefPtr<CefBrowserURLRequestOld> url_request,
|
||||
CefRefPtr<CefBrowserURLRequest> url_request,
|
||||
scoped_refptr<base::SequencedTaskRunner> task_runner)
|
||||
: url_request_(url_request), task_runner_(task_runner) {}
|
||||
|
||||
@@ -91,7 +91,7 @@ class CefURLFetcherResponseWriter : public net::URLFetcherResponseWriter {
|
||||
|
||||
private:
|
||||
static void WriteOnClientThread(
|
||||
CefRefPtr<CefBrowserURLRequestOld> url_request,
|
||||
CefRefPtr<CefBrowserURLRequest> url_request,
|
||||
scoped_refptr<net::IOBuffer> buffer,
|
||||
int num_bytes,
|
||||
net::CompletionOnceCallback callback,
|
||||
@@ -111,7 +111,7 @@ class CefURLFetcherResponseWriter : public net::URLFetcherResponseWriter {
|
||||
std::move(callback).Run(num_bytes);
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowserURLRequestOld> url_request_;
|
||||
CefRefPtr<CefBrowserURLRequest> url_request_;
|
||||
scoped_refptr<base::SequencedTaskRunner> task_runner_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefURLFetcherResponseWriter);
|
||||
@@ -124,13 +124,12 @@ std::unique_ptr<base::SupportsUserData::Data> CreateURLRequestUserData(
|
||||
|
||||
} // namespace
|
||||
|
||||
// CefBrowserURLRequestOld::Context
|
||||
// ----------------------------------------------
|
||||
// CefBrowserURLRequest::Context ----------------------------------------------
|
||||
|
||||
class CefBrowserURLRequestOld::Context
|
||||
: public base::RefCountedThreadSafe<CefBrowserURLRequestOld::Context> {
|
||||
class CefBrowserURLRequest::Context
|
||||
: public base::RefCountedThreadSafe<CefBrowserURLRequest::Context> {
|
||||
public:
|
||||
Context(CefRefPtr<CefBrowserURLRequestOld> url_request,
|
||||
Context(CefRefPtr<CefBrowserURLRequest> url_request,
|
||||
CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefURLRequestClient> client,
|
||||
CefRefPtr<CefRequestContext> request_context)
|
||||
@@ -178,12 +177,10 @@ class CefBrowserURLRequestOld::Context
|
||||
|
||||
base::PostTaskWithTraitsAndReply(
|
||||
FROM_HERE, {BrowserThread::UI},
|
||||
base::Bind(
|
||||
&CefBrowserURLRequestOld::Context::GetRequestContextOnUIThread,
|
||||
this),
|
||||
base::Bind(
|
||||
&CefBrowserURLRequestOld::Context::ContinueOnOriginatingThread,
|
||||
this, url, request_type));
|
||||
base::Bind(&CefBrowserURLRequest::Context::GetRequestContextOnUIThread,
|
||||
this),
|
||||
base::Bind(&CefBrowserURLRequest::Context::ContinueOnOriginatingThread,
|
||||
this, url, request_type));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -333,7 +330,7 @@ class CefBrowserURLRequestOld::Context
|
||||
bool response_was_cached() const { return response_was_cached_; }
|
||||
|
||||
private:
|
||||
friend class base::RefCountedThreadSafe<CefBrowserURLRequestOld::Context>;
|
||||
friend class base::RefCountedThreadSafe<CefBrowserURLRequest::Context>;
|
||||
|
||||
~Context() {
|
||||
if (fetcher_.get()) {
|
||||
@@ -372,7 +369,7 @@ class CefBrowserURLRequestOld::Context
|
||||
}
|
||||
|
||||
// Members only accessed on the initialization thread.
|
||||
CefRefPtr<CefBrowserURLRequestOld> url_request_;
|
||||
CefRefPtr<CefBrowserURLRequest> url_request_;
|
||||
CefRefPtr<CefRequest> request_;
|
||||
CefRefPtr<CefURLRequestClient> client_;
|
||||
CefRefPtr<CefRequestContext> request_context_;
|
||||
@@ -394,7 +391,7 @@ class CefBrowserURLRequestOld::Context
|
||||
namespace {
|
||||
|
||||
CefURLFetcherDelegate::CefURLFetcherDelegate(
|
||||
CefBrowserURLRequestOld::Context* context,
|
||||
CefBrowserURLRequest::Context* context,
|
||||
int request_flags)
|
||||
: context_(context), request_flags_(request_flags) {}
|
||||
|
||||
@@ -405,7 +402,7 @@ void CefURLFetcherDelegate::OnURLFetchComplete(const net::URLFetcher* source) {
|
||||
// in the call stack.
|
||||
CefTaskRunnerImpl::GetCurrentTaskRunner()->PostTask(
|
||||
FROM_HERE,
|
||||
base::Bind(&CefBrowserURLRequestOld::Context::OnComplete, context_));
|
||||
base::Bind(&CefBrowserURLRequest::Context::OnComplete, context_));
|
||||
}
|
||||
|
||||
void CefURLFetcherDelegate::OnURLFetchDownloadProgress(
|
||||
@@ -426,67 +423,66 @@ void CefURLFetcherDelegate::OnURLFetchUploadProgress(
|
||||
|
||||
} // namespace
|
||||
|
||||
// CefBrowserURLRequestOld
|
||||
// -------------------------------------------------------
|
||||
// CefBrowserURLRequest -------------------------------------------------------
|
||||
|
||||
CefBrowserURLRequestOld::CefBrowserURLRequestOld(
|
||||
CefBrowserURLRequest::CefBrowserURLRequest(
|
||||
CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefURLRequestClient> client,
|
||||
CefRefPtr<CefRequestContext> request_context) {
|
||||
context_ = new Context(this, request, client, request_context);
|
||||
}
|
||||
|
||||
CefBrowserURLRequestOld::~CefBrowserURLRequestOld() {}
|
||||
CefBrowserURLRequest::~CefBrowserURLRequest() {}
|
||||
|
||||
bool CefBrowserURLRequestOld::Start() {
|
||||
bool CefBrowserURLRequest::Start() {
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
return context_->Start();
|
||||
}
|
||||
|
||||
CefRefPtr<CefRequest> CefBrowserURLRequestOld::GetRequest() {
|
||||
CefRefPtr<CefRequest> CefBrowserURLRequest::GetRequest() {
|
||||
if (!VerifyContext())
|
||||
return NULL;
|
||||
return context_->request();
|
||||
}
|
||||
|
||||
CefRefPtr<CefURLRequestClient> CefBrowserURLRequestOld::GetClient() {
|
||||
CefRefPtr<CefURLRequestClient> CefBrowserURLRequest::GetClient() {
|
||||
if (!VerifyContext())
|
||||
return NULL;
|
||||
return context_->client();
|
||||
}
|
||||
|
||||
CefURLRequest::Status CefBrowserURLRequestOld::GetRequestStatus() {
|
||||
CefURLRequest::Status CefBrowserURLRequest::GetRequestStatus() {
|
||||
if (!VerifyContext())
|
||||
return UR_UNKNOWN;
|
||||
return context_->status();
|
||||
}
|
||||
|
||||
CefURLRequest::ErrorCode CefBrowserURLRequestOld::GetRequestError() {
|
||||
CefURLRequest::ErrorCode CefBrowserURLRequest::GetRequestError() {
|
||||
if (!VerifyContext())
|
||||
return ERR_NONE;
|
||||
return context_->error_code();
|
||||
}
|
||||
|
||||
CefRefPtr<CefResponse> CefBrowserURLRequestOld::GetResponse() {
|
||||
CefRefPtr<CefResponse> CefBrowserURLRequest::GetResponse() {
|
||||
if (!VerifyContext())
|
||||
return NULL;
|
||||
return context_->response();
|
||||
}
|
||||
|
||||
bool CefBrowserURLRequestOld::ResponseWasCached() {
|
||||
bool CefBrowserURLRequest::ResponseWasCached() {
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
return context_->response_was_cached();
|
||||
}
|
||||
|
||||
void CefBrowserURLRequestOld::Cancel() {
|
||||
void CefBrowserURLRequest::Cancel() {
|
||||
if (!VerifyContext())
|
||||
return;
|
||||
return context_->Cancel();
|
||||
}
|
||||
|
||||
bool CefBrowserURLRequestOld::VerifyContext() {
|
||||
bool CefBrowserURLRequest::VerifyContext() {
|
||||
DCHECK(context_.get());
|
||||
if (!context_->CalledOnValidThread()) {
|
||||
NOTREACHED() << "called on invalid thread";
|
@@ -2,21 +2,21 @@
|
||||
// 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_NET_BROWSER_URLREQUEST_OLD_IMPL_H_
|
||||
#define CEF_LIBCEF_BROWSER_NET_BROWSER_URLREQUEST_OLD_IMPL_H_
|
||||
#ifndef CEF_LIBCEF_BROWSER_BROWSER_URLREQUEST_IMPL_H_
|
||||
#define CEF_LIBCEF_BROWSER_BROWSER_URLREQUEST_IMPL_H_
|
||||
|
||||
#include "include/cef_urlrequest.h"
|
||||
|
||||
#include "base/memory/ref_counted.h"
|
||||
|
||||
class CefBrowserURLRequestOld : public CefURLRequest {
|
||||
class CefBrowserURLRequest : public CefURLRequest {
|
||||
public:
|
||||
class Context;
|
||||
|
||||
CefBrowserURLRequestOld(CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefURLRequestClient> client,
|
||||
CefRefPtr<CefRequestContext> request_context);
|
||||
~CefBrowserURLRequestOld() override;
|
||||
CefBrowserURLRequest(CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefURLRequestClient> client,
|
||||
CefRefPtr<CefRequestContext> request_context);
|
||||
~CefBrowserURLRequest() override;
|
||||
|
||||
bool Start();
|
||||
|
||||
@@ -34,7 +34,7 @@ class CefBrowserURLRequestOld : public CefURLRequest {
|
||||
|
||||
scoped_refptr<Context> context_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefBrowserURLRequestOld);
|
||||
IMPLEMENT_REFCOUNTING(CefBrowserURLRequest);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_NET_BROWSER_URLREQUEST_OLD_IMPL_H_
|
||||
#endif // CEF_LIBCEF_BROWSER_BROWSER_URLREQUEST_IMPL_H_
|
@@ -5,25 +5,17 @@
|
||||
|
||||
#include "libcef/browser/chrome_browser_process_stub.h"
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/browser_context_impl.h"
|
||||
#include "libcef/browser/chrome_profile_manager_stub.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/prefs/browser_prefs.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
#include "libcef/common/net_service/util.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "chrome/browser/net/system_network_context_manager.h"
|
||||
#include "chrome/browser/policy/chrome_browser_policy_connector.h"
|
||||
#include "chrome/browser/net/chrome_net_log_helper.h"
|
||||
#include "chrome/browser/printing/print_job_manager.h"
|
||||
#include "chrome/browser/ui/prefs/pref_watcher.h"
|
||||
#include "components/net_log/chrome_net_log.h"
|
||||
#include "components/net_log/net_export_file_writer.h"
|
||||
#include "components/prefs/pref_service.h"
|
||||
#include "content/browser/startup_helper.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "net/log/net_log_capture_mode.h"
|
||||
#include "services/network/public/cpp/network_switches.h"
|
||||
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||
|
||||
@@ -31,10 +23,14 @@ ChromeBrowserProcessStub::ChromeBrowserProcessStub()
|
||||
: initialized_(false),
|
||||
context_initialized_(false),
|
||||
shutdown_(false),
|
||||
locale_("en-US") {}
|
||||
locale_("en-US") {
|
||||
chrome::SetBrowserContextIncognitoHelper(this);
|
||||
}
|
||||
|
||||
ChromeBrowserProcessStub::~ChromeBrowserProcessStub() {
|
||||
DCHECK((!initialized_ && !context_initialized_) || shutdown_);
|
||||
g_browser_process = NULL;
|
||||
chrome::SetBrowserContextIncognitoHelper(nullptr);
|
||||
}
|
||||
|
||||
void ChromeBrowserProcessStub::Initialize() {
|
||||
@@ -42,9 +38,6 @@ void ChromeBrowserProcessStub::Initialize() {
|
||||
DCHECK(!context_initialized_);
|
||||
DCHECK(!shutdown_);
|
||||
|
||||
// Initialize this early before any code tries to check feature flags.
|
||||
content::SetUpFieldTrialsAndFeatureList();
|
||||
|
||||
initialized_ = true;
|
||||
}
|
||||
|
||||
@@ -77,21 +70,6 @@ void ChromeBrowserProcessStub::Shutdown() {
|
||||
profile_manager_.reset();
|
||||
event_router_forwarder_ = nullptr;
|
||||
|
||||
if (net_service::IsEnabled() && SystemNetworkContextManager::GetInstance()) {
|
||||
SystemNetworkContextManager::DeleteInstance();
|
||||
}
|
||||
|
||||
// Release any references to |local_state_| that are held by objects
|
||||
// associated with a Profile. The Profile will be deleted later.
|
||||
for (const auto& profile : CefBrowserContext::GetAll()) {
|
||||
PrefWatcher* pref_watcher = PrefWatcher::Get(profile);
|
||||
if (pref_watcher)
|
||||
pref_watcher->Shutdown();
|
||||
}
|
||||
|
||||
local_state_.reset();
|
||||
browser_policy_connector_.reset();
|
||||
|
||||
shutdown_ = true;
|
||||
}
|
||||
|
||||
@@ -130,8 +108,8 @@ IOThread* ChromeBrowserProcessStub::io_thread() {
|
||||
|
||||
SystemNetworkContextManager*
|
||||
ChromeBrowserProcessStub::system_network_context_manager() {
|
||||
DCHECK(SystemNetworkContextManager::GetInstance());
|
||||
return SystemNetworkContextManager::GetInstance();
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
net_log::NetExportFileWriter*
|
||||
@@ -159,17 +137,9 @@ ProfileManager* ChromeBrowserProcessStub::profile_manager() {
|
||||
}
|
||||
|
||||
PrefService* ChromeBrowserProcessStub::local_state() {
|
||||
DCHECK(initialized_);
|
||||
if (!local_state_) {
|
||||
const CefSettings& settings = CefContext::Get()->settings();
|
||||
const base::FilePath& cache_path =
|
||||
base::FilePath(CefString(&settings.cache_path));
|
||||
|
||||
// Used for very early NetworkService initialization.
|
||||
local_state_ = browser_prefs::CreatePrefService(
|
||||
nullptr, cache_path, !!settings.persist_user_preferences);
|
||||
}
|
||||
return local_state_.get();
|
||||
DCHECK(context_initialized_);
|
||||
return profile_manager_->GetLastUsedProfile(profile_manager_->user_data_dir())
|
||||
->GetPrefs();
|
||||
}
|
||||
|
||||
net::URLRequestContextGetter*
|
||||
@@ -213,15 +183,13 @@ ChromeBrowserProcessStub::notification_platform_bridge() {
|
||||
|
||||
policy::ChromeBrowserPolicyConnector*
|
||||
ChromeBrowserProcessStub::browser_policy_connector() {
|
||||
if (!browser_policy_connector_) {
|
||||
browser_policy_connector_ =
|
||||
std::make_unique<policy::ChromeBrowserPolicyConnector>();
|
||||
}
|
||||
return browser_policy_connector_.get();
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
policy::PolicyService* ChromeBrowserProcessStub::policy_service() {
|
||||
return browser_policy_connector()->GetPolicyService();
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
IconManager* ChromeBrowserProcessStub::icon_manager() {
|
||||
@@ -327,11 +295,6 @@ ChromeBrowserProcessStub::optimization_guide_service() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
StartupData* ChromeBrowserProcessStub::startup_data() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
|
||||
void ChromeBrowserProcessStub::StartAutoupdateTimer() {}
|
||||
#endif
|
||||
@@ -345,8 +308,7 @@ net_log::ChromeNetLog* ChromeBrowserProcessStub::net_log() {
|
||||
if (command_line.HasSwitch(network::switches::kLogNetLog)) {
|
||||
net_log_->StartWritingToFile(
|
||||
command_line.GetSwitchValuePath(network::switches::kLogNetLog),
|
||||
net::GetNetCaptureModeFromCommandLine(command_line,
|
||||
network::switches::kLogNetLog),
|
||||
GetNetCaptureModeFromCommandLine(command_line),
|
||||
command_line.GetCommandLineString(), std::string());
|
||||
}
|
||||
}
|
||||
@@ -409,3 +371,15 @@ ChromeBrowserProcessStub::pref_service_factory() const {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content::BrowserContext*
|
||||
ChromeBrowserProcessStub::GetBrowserContextRedirectedInIncognito(
|
||||
content::BrowserContext* context) {
|
||||
return CefBrowserContextImpl::GetForContext(context);
|
||||
}
|
||||
|
||||
content::BrowserContext*
|
||||
ChromeBrowserProcessStub::GetBrowserContextOwnInstanceInIncognito(
|
||||
content::BrowserContext* context) {
|
||||
return GetBrowserContextRedirectedInIncognito(context);
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include "base/compiler_specific.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/browser/extensions/event_router_forwarder.h"
|
||||
#include "chrome/browser/profiles/incognito_helpers.h"
|
||||
#include "media/media_buildflags.h"
|
||||
|
||||
class ChromeProfileManagerStub;
|
||||
@@ -28,7 +29,8 @@ class BackgroundModeManager {
|
||||
DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager);
|
||||
};
|
||||
|
||||
class ChromeBrowserProcessStub : public BrowserProcess {
|
||||
class ChromeBrowserProcessStub : public BrowserProcess,
|
||||
public chrome::BrowserContextIncognitoHelper {
|
||||
public:
|
||||
ChromeBrowserProcessStub();
|
||||
~ChromeBrowserProcessStub() override;
|
||||
@@ -87,7 +89,6 @@ class ChromeBrowserProcessStub : public BrowserProcess {
|
||||
override;
|
||||
optimization_guide::OptimizationGuideService* optimization_guide_service()
|
||||
override;
|
||||
StartupData* startup_data() override;
|
||||
|
||||
#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
|
||||
void StartAutoupdateTimer() override;
|
||||
@@ -108,6 +109,12 @@ class ChromeBrowserProcessStub : public BrowserProcess {
|
||||
override;
|
||||
prefs::InProcessPrefServiceFactory* pref_service_factory() const override;
|
||||
|
||||
// BrowserContextIncognitoHelper implementation.
|
||||
content::BrowserContext* GetBrowserContextRedirectedInIncognito(
|
||||
content::BrowserContext* context) override;
|
||||
content::BrowserContext* GetBrowserContextOwnInstanceInIncognito(
|
||||
content::BrowserContext* context) override;
|
||||
|
||||
private:
|
||||
bool initialized_;
|
||||
bool context_initialized_;
|
||||
@@ -119,10 +126,6 @@ class ChromeBrowserProcessStub : public BrowserProcess {
|
||||
scoped_refptr<extensions::EventRouterForwarder> event_router_forwarder_;
|
||||
std::unique_ptr<net_log::ChromeNetLog> net_log_;
|
||||
std::unique_ptr<net_log::NetExportFileWriter> net_export_file_writer_;
|
||||
std::unique_ptr<PrefService> local_state_;
|
||||
// Must be destroyed after |local_state_|.
|
||||
std::unique_ptr<policy::ChromeBrowserPolicyConnector>
|
||||
browser_policy_connector_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserProcessStub);
|
||||
};
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "libcef/browser/chrome_profile_manager_stub.h"
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/browser_context_impl.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
|
||||
namespace {
|
||||
@@ -20,8 +20,8 @@ namespace {
|
||||
// context for the currently active browser (e.g. the browser with input focus).
|
||||
// Return the main context for now since we don't currently have a good way to
|
||||
// determine that.
|
||||
CefBrowserContext* GetActiveBrowserContext() {
|
||||
return static_cast<CefBrowserContext*>(
|
||||
CefBrowserContextImpl* GetActiveBrowserContext() {
|
||||
return static_cast<CefBrowserContextImpl*>(
|
||||
CefContentBrowserClient::Get()->request_context()->GetBrowserContext());
|
||||
}
|
||||
|
||||
@@ -34,8 +34,8 @@ ChromeProfileManagerStub::~ChromeProfileManagerStub() {}
|
||||
|
||||
Profile* ChromeProfileManagerStub::GetProfile(
|
||||
const base::FilePath& profile_dir) {
|
||||
CefBrowserContext* browser_context =
|
||||
CefBrowserContext::GetForCachePath(profile_dir);
|
||||
CefBrowserContextImpl* browser_context =
|
||||
CefBrowserContextImpl::GetForCachePath(profile_dir);
|
||||
if (!browser_context) {
|
||||
// ProfileManager makes assumptions about profile directory paths that do
|
||||
// not match CEF usage. For example, the default Chrome profile name is
|
||||
@@ -51,7 +51,7 @@ Profile* ChromeProfileManagerStub::GetProfile(
|
||||
bool ChromeProfileManagerStub::IsValidProfile(const void* profile) {
|
||||
if (!profile)
|
||||
return false;
|
||||
return !!CefBrowserContext::GetForContext(
|
||||
return !!CefBrowserContextImpl::GetForContext(
|
||||
reinterpret_cast<content::BrowserContext*>(const_cast<void*>(profile)));
|
||||
}
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include "include/cef_version.h"
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/browser_context_impl.h"
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/browser_info.h"
|
||||
#include "libcef/browser/browser_info_manager.h"
|
||||
@@ -18,13 +18,8 @@
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/devtools/devtools_manager_delegate.h"
|
||||
#include "libcef/browser/extensions/extension_system.h"
|
||||
#include "libcef/browser/extensions/extension_web_contents_observer.h"
|
||||
#include "libcef/browser/media_capture_devices_dispatcher.h"
|
||||
#include "libcef/browser/net/chrome_scheme_handler.h"
|
||||
#include "libcef/browser/net/net_util.h"
|
||||
#include "libcef/browser/net_service/login_delegate.h"
|
||||
#include "libcef/browser/net_service/proxy_url_loader_factory.h"
|
||||
#include "libcef/browser/net_service/resource_request_handler_wrapper.h"
|
||||
#include "libcef/browser/plugins/plugin_service_filter.h"
|
||||
#include "libcef/browser/prefs/renderer_prefs.h"
|
||||
#include "libcef/browser/printing/printing_message_filter.h"
|
||||
@@ -39,13 +34,12 @@
|
||||
#include "libcef/common/content_client.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
#include "libcef/common/net/scheme_registration.h"
|
||||
#include "libcef/common/net_service/util.h"
|
||||
#include "libcef/common/request_impl.h"
|
||||
#include "libcef/common/service_manifests/builtin_service_manifests.h"
|
||||
#include "libcef/common/service_manifests/cef_content_browser_overlay_manifest.h"
|
||||
#include "libcef/common/service_manifests/cef_content_gpu_overlay_manifest.h"
|
||||
#include "libcef/common/service_manifests/cef_content_renderer_overlay_manifest.h"
|
||||
#include "libcef/common/service_manifests/cef_content_utility_overlay_manifest.h"
|
||||
#include "libcef/common/service_manifests/cef_packaged_service_manifests.h"
|
||||
#include "libcef/common/service_manifests/cef_renderer_manifest.h"
|
||||
|
||||
#include "base/base_switches.h"
|
||||
@@ -54,30 +48,19 @@
|
||||
#include "base/json/json_reader.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/stl_util.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "cef/grit/cef_resources.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/browser/chrome_content_browser_client.h"
|
||||
#include "chrome/browser/chrome_service.h"
|
||||
#include "chrome/browser/net/system_network_context_manager.h"
|
||||
#include "chrome/browser/plugins/plugin_info_host_impl.h"
|
||||
#include "chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.h"
|
||||
#include "chrome/browser/plugins/plugin_utils.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/common/constants.mojom.h"
|
||||
#include "chrome/common/webui_url_constants.h"
|
||||
#include "chrome/grit/browser_resources.h"
|
||||
#include "chrome/grit/generated_resources.h"
|
||||
#include "chrome/services/printing/printing_service.h"
|
||||
#include "chrome/services/printing/public/mojom/constants.mojom.h"
|
||||
#include "components/navigation_interception/intercept_navigation_throttle.h"
|
||||
#include "components/navigation_interception/navigation_params.h"
|
||||
#include "components/services/heap_profiling/heap_profiling_service.h"
|
||||
#include "components/services/heap_profiling/public/mojom/constants.mojom.h"
|
||||
#include "components/services/pdf_compositor/public/cpp/pdf_compositor_service_factory.h"
|
||||
#include "components/services/pdf_compositor/public/interfaces/pdf_compositor.mojom.h"
|
||||
#include "components/version_info/version_info.h"
|
||||
#include "content/browser/frame_host/navigation_handle_impl.h"
|
||||
@@ -98,13 +81,12 @@
|
||||
#include "content/public/browser/render_widget_host_view.h"
|
||||
#include "content/public/browser/resource_dispatcher_host.h"
|
||||
#include "content/public/browser/storage_partition.h"
|
||||
#include "content/public/browser/web_ui_url_loader_factory.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "content/public/common/service_names.mojom.h"
|
||||
#include "content/public/common/storage_quota_params.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "content/public/common/user_agent.h"
|
||||
#include "content/public/common/web_preferences.h"
|
||||
#include "extensions/browser/api/web_request/web_request_api.h"
|
||||
#include "extensions/browser/extension_message_filter.h"
|
||||
#include "extensions/browser/extension_protocols.h"
|
||||
#include "extensions/browser/extension_registry.h"
|
||||
@@ -114,13 +96,8 @@
|
||||
#include "extensions/browser/io_thread_extension_message_filter.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "extensions/common/switches.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
#include "net/base/auth.h"
|
||||
#include "net/ssl/ssl_cert_request_info.h"
|
||||
#include "ppapi/host/ppapi_host.h"
|
||||
#include "services/network/public/cpp/network_switches.h"
|
||||
#include "services/proxy_resolver/proxy_resolver_service.h"
|
||||
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
|
||||
#include "services/service_manager/embedder/switches.h"
|
||||
#include "services/service_manager/public/mojom/connector.mojom.h"
|
||||
#include "services/service_manager/sandbox/switches.h"
|
||||
@@ -344,8 +321,8 @@ class CefQuotaPermissionContext : public content::QuotaPermissionContext {
|
||||
bool handled = false;
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
CefBrowserHostImpl::GetBrowserForFrameRoute(render_process_id,
|
||||
params.render_frame_id);
|
||||
CefBrowserHostImpl::GetBrowserForFrame(render_process_id,
|
||||
params.render_frame_id);
|
||||
if (browser.get()) {
|
||||
CefRefPtr<CefClient> client = browser->GetClient();
|
||||
if (client.get()) {
|
||||
@@ -437,9 +414,8 @@ int GetCrashSignalFD(const base::CommandLine& command_line) {
|
||||
// |is_main_frame| argument once this problem is fixed.
|
||||
bool NavigationOnUIThread(
|
||||
bool is_main_frame,
|
||||
int64_t frame_id,
|
||||
int64_t parent_frame_id,
|
||||
int frame_tree_node_id,
|
||||
int64 frame_id,
|
||||
int64 parent_frame_id,
|
||||
content::WebContents* source,
|
||||
const navigation_interception::NavigationParams& params) {
|
||||
CEF_REQUIRE_UIT();
|
||||
@@ -458,14 +434,13 @@ bool NavigationOnUIThread(
|
||||
frame = browser->GetMainFrame();
|
||||
} else if (frame_id >= 0) {
|
||||
frame = browser->GetFrame(frame_id);
|
||||
}
|
||||
if (!frame && frame_tree_node_id >= 0) {
|
||||
frame = browser->GetFrameForFrameTreeNode(frame_tree_node_id);
|
||||
}
|
||||
if (!frame) {
|
||||
DCHECK(frame);
|
||||
} else {
|
||||
// Create a temporary frame object for navigation of sub-frames that
|
||||
// don't yet exist.
|
||||
frame = browser->browser_info()->CreateTempSubFrame(parent_frame_id);
|
||||
frame = new CefFrameHostImpl(
|
||||
browser.get(), CefFrameHostImpl::kInvalidFrameId, false,
|
||||
CefString(), CefString(), parent_frame_id);
|
||||
}
|
||||
|
||||
CefRefPtr<CefRequestImpl> request = new CefRequestImpl();
|
||||
@@ -487,30 +462,6 @@ bool NavigationOnUIThread(
|
||||
return ignore_navigation;
|
||||
}
|
||||
|
||||
const extensions::ExtensionSet* GetEnabledExtensions(
|
||||
content::BrowserContext* context) {
|
||||
auto registry = extensions::ExtensionRegistry::Get(context);
|
||||
return ®istry->enabled_extensions();
|
||||
}
|
||||
|
||||
const extensions::ExtensionSet* GetEnabledExtensions(
|
||||
content::ResourceContext* context) {
|
||||
auto cef_context = static_cast<CefResourceContext*>(context);
|
||||
if (!cef_context)
|
||||
return nullptr;
|
||||
|
||||
return &cef_context->GetExtensionInfoMap()->extensions();
|
||||
}
|
||||
|
||||
const extensions::ExtensionSet* GetEnabledExtensions(
|
||||
content::BrowserOrResourceContext context) {
|
||||
if (content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) {
|
||||
return GetEnabledExtensions(context.ToBrowserContext());
|
||||
}
|
||||
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
|
||||
return GetEnabledExtensions(context.ToResourceContext());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefContentBrowserClient::CefContentBrowserClient() : browser_main_parts_(NULL) {
|
||||
@@ -529,13 +480,12 @@ CefContentBrowserClient* CefContentBrowserClient::Get() {
|
||||
CefContentClient::Get()->browser());
|
||||
}
|
||||
|
||||
std::unique_ptr<content::BrowserMainParts>
|
||||
CefContentBrowserClient::CreateBrowserMainParts(
|
||||
content::BrowserMainParts* CefContentBrowserClient::CreateBrowserMainParts(
|
||||
const content::MainFunctionParams& parameters) {
|
||||
browser_main_parts_ = new CefBrowserMainParts(parameters);
|
||||
browser_main_parts_->AddParts(
|
||||
ChromeService::GetInstance()->CreateExtraParts());
|
||||
return base::WrapUnique(browser_main_parts_);
|
||||
return browser_main_parts_;
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::RenderProcessWillLaunch(
|
||||
@@ -564,16 +514,16 @@ void CefContentBrowserClient::RenderProcessWillLaunch(
|
||||
host->Send(
|
||||
new CefProcessMsg_SetIsIncognitoProcess(profile->IsOffTheRecord()));
|
||||
|
||||
service_manager::mojom::ServicePtrInfo service;
|
||||
service_manager::mojom::ServicePtr service;
|
||||
*service_request = mojo::MakeRequest(&service);
|
||||
service_manager::mojom::PIDReceiverPtr pid_receiver;
|
||||
service_manager::Identity renderer_identity = host->GetChildIdentity();
|
||||
mojo::Remote<service_manager::mojom::ProcessMetadata> metadata;
|
||||
ChromeService::GetInstance()->connector()->RegisterServiceInstance(
|
||||
service_manager::Identity(chrome::mojom::kRendererServiceName,
|
||||
renderer_identity.instance_group(),
|
||||
renderer_identity.instance_id(),
|
||||
base::Token::CreateRandom()),
|
||||
std::move(service), metadata.BindNewPipeAndPassReceiver());
|
||||
std::move(service), mojo::MakeRequest(&pid_receiver));
|
||||
}
|
||||
|
||||
bool CefContentBrowserClient::ShouldUseProcessPerSite(
|
||||
@@ -606,42 +556,29 @@ bool CefContentBrowserClient::ShouldUseProcessPerSite(
|
||||
// Based on
|
||||
// ChromeContentBrowserClientExtensionsPart::DoesSiteRequireDedicatedProcess.
|
||||
bool CefContentBrowserClient::DoesSiteRequireDedicatedProcess(
|
||||
content::BrowserOrResourceContext browser_or_resource_context,
|
||||
content::BrowserContext* browser_context,
|
||||
const GURL& effective_site_url) {
|
||||
if (!extensions::ExtensionsEnabled())
|
||||
return false;
|
||||
|
||||
auto extension = GetEnabledExtensions(browser_or_resource_context)
|
||||
->GetExtensionOrAppByURL(effective_site_url);
|
||||
extensions::ExtensionRegistry* registry =
|
||||
extensions::ExtensionRegistry::Get(browser_context);
|
||||
const extensions::Extension* extension =
|
||||
registry->enabled_extensions().GetExtensionOrAppByURL(effective_site_url);
|
||||
if (!extension)
|
||||
return false;
|
||||
|
||||
// Always isolate Chrome Web Store.
|
||||
if (extension->id() == extensions::kWebStoreAppId)
|
||||
return true;
|
||||
|
||||
// Extensions should be isolated, except for hosted apps. Isolating hosted
|
||||
// apps is a good idea, but ought to be a separate knob.
|
||||
if (extension->is_hosted_app())
|
||||
return false;
|
||||
|
||||
// Isolate all extensions.
|
||||
return extension != nullptr;
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::GetAdditionalWebUISchemes(
|
||||
std::vector<std::string>* additional_schemes) {
|
||||
// Any schemes listed here are treated as WebUI schemes but do not get WebUI
|
||||
// bindings. Also, view-source is allowed for these schemes. WebUI schemes
|
||||
// will not be passed to HandleExternalProtocol.
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::GetAdditionalViewSourceSchemes(
|
||||
std::vector<std::string>* additional_schemes) {
|
||||
GetAdditionalWebUISchemes(additional_schemes);
|
||||
|
||||
additional_schemes->push_back(extensions::kExtensionScheme);
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem(
|
||||
std::vector<std::string>* additional_allowed_schemes) {
|
||||
ContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem(
|
||||
additional_allowed_schemes);
|
||||
additional_allowed_schemes->push_back(content::kChromeDevToolsScheme);
|
||||
additional_allowed_schemes->push_back(content::kChromeUIScheme);
|
||||
}
|
||||
|
||||
bool CefContentBrowserClient::IsWebUIAllowedToMakeNetworkRequests(
|
||||
const url::Origin& origin) {
|
||||
return scheme::IsWebUIAllowedToMakeNetworkRequests(origin);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefContentBrowserClient::IsHandledURL(const GURL& url) {
|
||||
@@ -712,41 +649,23 @@ void CefContentBrowserClient::SiteInstanceDeleting(
|
||||
site_instance->GetId()));
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::RunServiceInstance(
|
||||
const service_manager::Identity& identity,
|
||||
mojo::PendingReceiver<service_manager::mojom::Service>* receiver) {
|
||||
const std::string& service_name = identity.name();
|
||||
if (service_name == printing::mojom::kServiceName) {
|
||||
service_manager::Service::RunAsyncUntilTermination(
|
||||
printing::CreatePdfCompositorService(std::move(*receiver)));
|
||||
return;
|
||||
}
|
||||
if (service_name == printing::mojom::kChromePrintingServiceName) {
|
||||
service_manager::Service::RunAsyncUntilTermination(
|
||||
std::make_unique<printing::PrintingService>(std::move(*receiver)));
|
||||
return;
|
||||
}
|
||||
if (service_name == proxy_resolver::mojom::kProxyResolverServiceName) {
|
||||
service_manager::Service::RunAsyncUntilTermination(
|
||||
std::make_unique<proxy_resolver::ProxyResolverService>(
|
||||
std::move(*receiver)));
|
||||
return;
|
||||
}
|
||||
void CefContentBrowserClient::RegisterIOThreadServiceHandlers(
|
||||
content::ServiceManagerConnection* connection) {
|
||||
// For spell checking.
|
||||
connection->AddServiceRequestHandler(
|
||||
chrome::mojom::kServiceName,
|
||||
ChromeService::GetInstance()->CreateChromeServiceRequestHandler());
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::RunServiceInstanceOnIOThread(
|
||||
const service_manager::Identity& identity,
|
||||
mojo::PendingReceiver<service_manager::mojom::Service>* receiver) {
|
||||
if (identity.name() == chrome::mojom::kServiceName) {
|
||||
ChromeService::GetInstance()->CreateChromeServiceRequestHandler().Run(
|
||||
std::move(*receiver));
|
||||
return;
|
||||
}
|
||||
if (identity.name() == heap_profiling::mojom::kServiceName) {
|
||||
heap_profiling::HeapProfilingService::GetServiceFactory().Run(
|
||||
std::move(*receiver));
|
||||
return;
|
||||
}
|
||||
void CefContentBrowserClient::RegisterOutOfProcessServices(
|
||||
OutOfProcessServiceMap* services) {
|
||||
(*services)[printing::mojom::kServiceName] =
|
||||
base::BindRepeating(&base::ASCIIToUTF16, "PDF Compositor Service");
|
||||
(*services)[printing::mojom::kChromePrintingServiceName] =
|
||||
base::BindRepeating(&base::ASCIIToUTF16, "Printing Service");
|
||||
(*services)[proxy_resolver::mojom::kProxyResolverServiceName] =
|
||||
base::BindRepeating(&l10n_util::GetStringUTF16,
|
||||
IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME);
|
||||
}
|
||||
|
||||
base::Optional<service_manager::Manifest>
|
||||
@@ -755,6 +674,10 @@ CefContentBrowserClient::GetServiceManifestOverlay(base::StringPiece name) {
|
||||
return GetCefContentBrowserOverlayManifest();
|
||||
} else if (name == content::mojom::kGpuServiceName) {
|
||||
return GetCefContentGpuOverlayManifest();
|
||||
} else if (name == content::mojom::kPackagedServicesServiceName) {
|
||||
service_manager::Manifest overlay;
|
||||
overlay.packaged_services = GetCefPackagedServiceManifests();
|
||||
return overlay;
|
||||
} else if (name == content::mojom::kRendererServiceName) {
|
||||
return GetCefContentRendererOverlayManifest();
|
||||
} else if (name == content::mojom::kUtilityServiceName) {
|
||||
@@ -766,9 +689,14 @@ CefContentBrowserClient::GetServiceManifestOverlay(base::StringPiece name) {
|
||||
|
||||
std::vector<service_manager::Manifest>
|
||||
CefContentBrowserClient::GetExtraServiceManifests() {
|
||||
auto manifests = GetBuiltinServiceManifests();
|
||||
manifests.push_back(GetCefRendererManifest());
|
||||
return manifests;
|
||||
return std::vector<service_manager::Manifest>{GetCefRendererManifest()};
|
||||
}
|
||||
|
||||
bool CefContentBrowserClient::IsSameBrowserContext(
|
||||
content::BrowserContext* context1,
|
||||
content::BrowserContext* context2) {
|
||||
return CefBrowserContextImpl::GetForContext(context1) ==
|
||||
CefBrowserContextImpl::GetForContext(context2);
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
@@ -783,7 +711,6 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
switches::kDisablePackLoading,
|
||||
#if defined(OS_MACOSX)
|
||||
switches::kFrameworkDirPath,
|
||||
switches::kMainBundlePath,
|
||||
#endif
|
||||
switches::kLocalesDirPath,
|
||||
switches::kLogFile,
|
||||
@@ -813,7 +740,7 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
switches::kPpapiFlashPath,
|
||||
switches::kPpapiFlashVersion,
|
||||
switches::kUncaughtExceptionStackSize,
|
||||
network::switches::kUnsafelyTreatInsecureOriginAsSecure,
|
||||
switches::kUnsafelyTreatInsecureOriginAsSecure,
|
||||
};
|
||||
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
|
||||
base::size(kSwitchNames));
|
||||
@@ -912,27 +839,7 @@ std::string CefContentBrowserClient::GetApplicationLocale() {
|
||||
return g_browser_process->GetApplicationLocale();
|
||||
}
|
||||
|
||||
scoped_refptr<network::SharedURLLoaderFactory>
|
||||
CefContentBrowserClient::GetSystemSharedURLLoaderFactory() {
|
||||
DCHECK(
|
||||
content::BrowserThread::CurrentlyOn(content::BrowserThread::UI) ||
|
||||
!content::BrowserThread::IsThreadInitialized(content::BrowserThread::UI));
|
||||
|
||||
if (!SystemNetworkContextManager::GetInstance())
|
||||
return nullptr;
|
||||
|
||||
return SystemNetworkContextManager::GetInstance()
|
||||
->GetSharedURLLoaderFactory();
|
||||
}
|
||||
|
||||
network::mojom::NetworkContext*
|
||||
CefContentBrowserClient::GetSystemNetworkContext() {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
DCHECK(SystemNetworkContextManager::GetInstance());
|
||||
return SystemNetworkContextManager::GetInstance()->GetContext();
|
||||
}
|
||||
|
||||
scoped_refptr<content::QuotaPermissionContext>
|
||||
content::QuotaPermissionContext*
|
||||
CefContentBrowserClient::CreateQuotaPermissionContext() {
|
||||
return new CefQuotaPermissionContext();
|
||||
}
|
||||
@@ -977,14 +884,14 @@ void CefContentBrowserClient::AllowCertificateError(
|
||||
int cert_error,
|
||||
const net::SSLInfo& ssl_info,
|
||||
const GURL& request_url,
|
||||
bool is_main_frame_request,
|
||||
content::ResourceType resource_type,
|
||||
bool strict_enforcement,
|
||||
bool expired_previous_decision,
|
||||
const base::Callback<void(content::CertificateRequestResultType)>&
|
||||
callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
if (!is_main_frame_request) {
|
||||
if (resource_type != content::ResourceType::RESOURCE_TYPE_MAIN_FRAME) {
|
||||
// A sub-resource has a certificate error. The user doesn't really
|
||||
// have a context for making the right decision, so block the request
|
||||
// hard.
|
||||
@@ -1129,16 +1036,24 @@ CefContentBrowserClient::CreateThrottlesForNavigation(
|
||||
|
||||
const bool is_main_frame = navigation_handle->IsInMainFrame();
|
||||
|
||||
// Identify the RenderFrameHost that originated the navigation.
|
||||
const int64_t parent_frame_id =
|
||||
!is_main_frame
|
||||
? CefFrameHostImpl::MakeFrameId(navigation_handle->GetParentFrame())
|
||||
: CefFrameHostImpl::kInvalidFrameId;
|
||||
int64 parent_frame_id = CefFrameHostImpl::kUnspecifiedFrameId;
|
||||
if (!is_main_frame) {
|
||||
// Identify the RenderFrameHost that originated the navigation.
|
||||
content::RenderFrameHost* parent_frame_host =
|
||||
navigation_handle->GetParentFrame();
|
||||
DCHECK(parent_frame_host);
|
||||
if (parent_frame_host)
|
||||
parent_frame_id = parent_frame_host->GetRoutingID();
|
||||
if (parent_frame_id < 0)
|
||||
parent_frame_id = CefFrameHostImpl::kUnspecifiedFrameId;
|
||||
}
|
||||
|
||||
const int64_t frame_id = !is_main_frame && navigation_handle->HasCommitted()
|
||||
? CefFrameHostImpl::MakeFrameId(
|
||||
navigation_handle->GetRenderFrameHost())
|
||||
: CefFrameHostImpl::kInvalidFrameId;
|
||||
int64 frame_id = CefFrameHostImpl::kInvalidFrameId;
|
||||
if (!is_main_frame && navigation_handle->HasCommitted()) {
|
||||
frame_id = navigation_handle->GetRenderFrameHost()->GetRoutingID();
|
||||
if (frame_id < 0)
|
||||
frame_id = CefFrameHostImpl::kInvalidFrameId;
|
||||
}
|
||||
|
||||
// Must use SynchronyMode::kSync to ensure that OnBeforeBrowse is always
|
||||
// called before OnBeforeResourceLoad.
|
||||
@@ -1146,33 +1061,13 @@ CefContentBrowserClient::CreateThrottlesForNavigation(
|
||||
std::make_unique<navigation_interception::InterceptNavigationThrottle>(
|
||||
navigation_handle,
|
||||
base::Bind(&NavigationOnUIThread, is_main_frame, frame_id,
|
||||
parent_frame_id, navigation_handle->GetFrameTreeNodeId()),
|
||||
parent_frame_id),
|
||||
navigation_interception::SynchronyMode::kSync);
|
||||
throttles.push_back(std::move(throttle));
|
||||
|
||||
return throttles;
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<content::URLLoaderThrottle>>
|
||||
CefContentBrowserClient::CreateURLLoaderThrottles(
|
||||
const network::ResourceRequest& request,
|
||||
content::ResourceContext* resource_context,
|
||||
const base::RepeatingCallback<content::WebContents*()>& wc_getter,
|
||||
content::NavigationUIData* navigation_ui_data,
|
||||
int frame_tree_node_id) {
|
||||
CEF_REQUIRE_IOT();
|
||||
std::vector<std::unique_ptr<content::URLLoaderThrottle>> result;
|
||||
|
||||
if (net_service::IsEnabled()) {
|
||||
// Used to substitute View ID for PDF contents when using the PDF plugin.
|
||||
result.push_back(
|
||||
std::make_unique<PluginResponseInterceptorURLLoaderThrottle>(
|
||||
resource_context, request.resource_type, frame_tree_node_id));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
void CefContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
|
||||
const base::CommandLine& command_line,
|
||||
@@ -1226,21 +1121,6 @@ CefContentBrowserClient::CreateClientCertStore(
|
||||
->CreateClientCertStore();
|
||||
}
|
||||
|
||||
std::unique_ptr<content::LoginDelegate>
|
||||
CefContentBrowserClient::CreateLoginDelegate(
|
||||
const net::AuthChallengeInfo& auth_info,
|
||||
content::WebContents* web_contents,
|
||||
const content::GlobalRequestID& request_id,
|
||||
bool is_request_for_main_frame,
|
||||
const GURL& url,
|
||||
scoped_refptr<net::HttpResponseHeaders> response_headers,
|
||||
bool first_auth_attempt,
|
||||
LoginAuthRequiredCallback auth_required_callback) {
|
||||
return std::make_unique<net_service::LoginDelegate>(
|
||||
auth_info, web_contents, request_id, url,
|
||||
std::move(auth_required_callback));
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::RegisterNonNetworkNavigationURLLoaderFactories(
|
||||
int frame_tree_node_id,
|
||||
NonNetworkURLLoaderFactoryMap* factories) {
|
||||
@@ -1267,43 +1147,6 @@ void CefContentBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories(
|
||||
render_frame_id);
|
||||
if (factory)
|
||||
factories->emplace(extensions::kExtensionScheme, std::move(factory));
|
||||
|
||||
content::RenderFrameHost* frame_host =
|
||||
content::RenderFrameHost::FromID(render_process_id, render_frame_id);
|
||||
content::WebContents* web_contents =
|
||||
content::WebContents::FromRenderFrameHost(frame_host);
|
||||
if (!web_contents)
|
||||
return;
|
||||
|
||||
extensions::CefExtensionWebContentsObserver* web_observer =
|
||||
extensions::CefExtensionWebContentsObserver::FromWebContents(
|
||||
web_contents);
|
||||
|
||||
// There is nothing to do if no CefExtensionWebContentsObserver is attached
|
||||
// to the |web_contents|.
|
||||
if (!web_observer)
|
||||
return;
|
||||
|
||||
const extensions::Extension* extension =
|
||||
web_observer->GetExtensionFromFrame(frame_host, false);
|
||||
if (!extension)
|
||||
return;
|
||||
|
||||
std::vector<std::string> allowed_webui_hosts;
|
||||
// Support for chrome:// scheme if appropriate.
|
||||
if ((extension->is_extension() || extension->is_platform_app()) &&
|
||||
extensions::Manifest::IsComponentLocation(extension->location())) {
|
||||
// Components of chrome that are implemented as extensions or platform apps
|
||||
// are allowed to use chrome://resources/ and chrome://theme/ URLs.
|
||||
allowed_webui_hosts.emplace_back(content::kChromeUIResourcesHost);
|
||||
allowed_webui_hosts.emplace_back(chrome::kChromeUIThemeHost);
|
||||
}
|
||||
if (!allowed_webui_hosts.empty()) {
|
||||
factories->emplace(
|
||||
content::kChromeUIScheme,
|
||||
content::CreateWebUIURLLoader(frame_host, content::kChromeUIScheme,
|
||||
std::move(allowed_webui_hosts)));
|
||||
}
|
||||
}
|
||||
|
||||
bool CefContentBrowserClient::WillCreateURLLoaderFactory(
|
||||
@@ -1316,62 +1159,18 @@ bool CefContentBrowserClient::WillCreateURLLoaderFactory(
|
||||
network::mojom::URLLoaderFactoryRequest* factory_request,
|
||||
network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client,
|
||||
bool* bypass_redirect_checks) {
|
||||
if (!net_service::IsEnabled())
|
||||
if (!extensions::ExtensionsEnabled())
|
||||
return false;
|
||||
|
||||
auto request_handler = net_service::CreateInterceptedRequestHandler(
|
||||
auto* web_request_api =
|
||||
extensions::BrowserContextKeyedAPIFactory<extensions::WebRequestAPI>::Get(
|
||||
browser_context);
|
||||
bool use_proxy = web_request_api->MaybeProxyURLLoaderFactory(
|
||||
browser_context, frame, render_process_id, is_navigation, is_download,
|
||||
request_initiator);
|
||||
|
||||
net_service::ProxyURLLoaderFactory::CreateProxy(
|
||||
browser_context, factory_request, header_client,
|
||||
std::move(request_handler));
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::OnNetworkServiceCreated(
|
||||
network::mojom::NetworkService* network_service) {
|
||||
if (!net_service::IsEnabled())
|
||||
return;
|
||||
|
||||
DCHECK(g_browser_process);
|
||||
PrefService* local_state = g_browser_process->local_state();
|
||||
DCHECK(local_state);
|
||||
|
||||
// Need to set up global NetworkService state before anything else uses it.
|
||||
DCHECK(SystemNetworkContextManager::GetInstance());
|
||||
SystemNetworkContextManager::GetInstance()->OnNetworkServiceCreated(
|
||||
network_service);
|
||||
}
|
||||
|
||||
network::mojom::NetworkContextPtr CefContentBrowserClient::CreateNetworkContext(
|
||||
content::BrowserContext* context,
|
||||
bool in_memory,
|
||||
const base::FilePath& relative_partition_path) {
|
||||
Profile* profile = Profile::FromBrowserContext(context);
|
||||
return profile->CreateNetworkContext(in_memory, relative_partition_path);
|
||||
}
|
||||
|
||||
// The sandbox may block read/write access from the NetworkService to
|
||||
// directories that are not returned by this method.
|
||||
std::vector<base::FilePath>
|
||||
CefContentBrowserClient::GetNetworkContextsParentDirectory() {
|
||||
base::FilePath user_data_path;
|
||||
base::PathService::Get(chrome::DIR_USER_DATA, &user_data_path);
|
||||
DCHECK(!user_data_path.empty());
|
||||
|
||||
// The CefContext::ValidateCachePath method enforces the requirement that all
|
||||
// cache_path values be either equal to or a child of root_cache_path.
|
||||
const base::FilePath& root_cache_path =
|
||||
base::FilePath(CefString(&CefContext::Get()->settings().root_cache_path));
|
||||
|
||||
// root_cache_path may sometimes be empty or a child of user_data_path, so
|
||||
// only return the one path in that case.
|
||||
if (root_cache_path.empty() || user_data_path.IsParent(root_cache_path)) {
|
||||
return {user_data_path};
|
||||
}
|
||||
|
||||
return {user_data_path, root_cache_path};
|
||||
factory_request, header_client);
|
||||
if (bypass_redirect_checks)
|
||||
*bypass_redirect_checks = use_proxy;
|
||||
return use_proxy;
|
||||
}
|
||||
|
||||
bool CefContentBrowserClient::HandleExternalProtocol(
|
||||
@@ -1382,52 +1181,39 @@ bool CefContentBrowserClient::HandleExternalProtocol(
|
||||
bool is_main_frame,
|
||||
ui::PageTransition page_transition,
|
||||
bool has_user_gesture,
|
||||
network::mojom::URLLoaderFactoryRequest* factory_request,
|
||||
network::mojom::URLLoaderFactory*& out_factory) {
|
||||
if (net_service::IsEnabled()) {
|
||||
// Call the other HandleExternalProtocol variant.
|
||||
return false;
|
||||
}
|
||||
|
||||
CefRefPtr<CefRequestImpl> requestPtr = new CefRequestImpl();
|
||||
requestPtr->SetURL(url.spec());
|
||||
requestPtr->SetReadOnly(true);
|
||||
|
||||
net_util::HandleExternalProtocol(requestPtr, web_contents_getter);
|
||||
const std::string& method,
|
||||
const net::HttpRequestHeaders& headers) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::Bind(
|
||||
base::IgnoreResult(
|
||||
&CefContentBrowserClient::HandleExternalProtocolOnUIThread),
|
||||
url, web_contents_getter));
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CefContentBrowserClient::HandleExternalProtocol(
|
||||
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
|
||||
int frame_tree_node_id,
|
||||
content::NavigationUIData* navigation_data,
|
||||
const network::ResourceRequest& request,
|
||||
network::mojom::URLLoaderFactoryRequest* factory_request,
|
||||
network::mojom::URLLoaderFactory*& out_factory) {
|
||||
DCHECK(net_service::IsEnabled());
|
||||
// CefBrowserPlatformDelegate::HandleExternalProtocol may be called if
|
||||
// nothing handles the request.
|
||||
auto request_handler = net_service::CreateInterceptedRequestHandler(
|
||||
web_contents_getter, frame_tree_node_id, request);
|
||||
out_factory = net_service::ProxyURLLoaderFactory::CreateProxy(
|
||||
web_contents_getter, factory_request, std::move(request_handler));
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string CefContentBrowserClient::GetProduct() const {
|
||||
// Match the logic in chrome_content_browser_client.cc GetProduct() which
|
||||
// will be called when the NetworkService is enabled.
|
||||
return ::GetProduct();
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
if (command_line->HasSwitch(switches::kProductVersion))
|
||||
return command_line->GetSwitchValueASCII(switches::kProductVersion);
|
||||
|
||||
return GetChromeProduct();
|
||||
}
|
||||
|
||||
std::string CefContentBrowserClient::GetChromeProduct() const {
|
||||
return version_info::GetProductNameAndVersionForUserAgent();
|
||||
return base::StringPrintf("Chrome/%d.%d.%d.%d", CHROME_VERSION_MAJOR,
|
||||
CHROME_VERSION_MINOR, CHROME_VERSION_BUILD,
|
||||
CHROME_VERSION_PATCH);
|
||||
}
|
||||
|
||||
std::string CefContentBrowserClient::GetUserAgent() const {
|
||||
// Match the logic in chrome_content_browser_client.cc GetUserAgent() which
|
||||
// will be called when the NetworkService is enabled.
|
||||
return ::GetUserAgent();
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
if (command_line->HasSwitch(switches::kUserAgent))
|
||||
return command_line->GetSwitchValueASCII(switches::kUserAgent);
|
||||
|
||||
return content::BuildUserAgentFromProduct(GetProduct());
|
||||
}
|
||||
|
||||
blink::UserAgentMetadata CefContentBrowserClient::GetUserAgentMetadata() const {
|
||||
@@ -1444,16 +1230,6 @@ blink::UserAgentMetadata CefContentBrowserClient::GetUserAgentMetadata() const {
|
||||
return metadata;
|
||||
}
|
||||
|
||||
base::flat_set<std::string>
|
||||
CefContentBrowserClient::GetPluginMimeTypesWithExternalHandlers(
|
||||
content::ResourceContext* resource_context) {
|
||||
base::flat_set<std::string> mime_types;
|
||||
auto map = PluginUtils::GetMimeTypeToExtensionIdMap(resource_context);
|
||||
for (const auto& pair : map)
|
||||
mime_types.insert(pair.first);
|
||||
return mime_types;
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::RegisterCustomScheme(const std::string& scheme) {
|
||||
// Register as a Web-safe scheme so that requests for the scheme from a
|
||||
// render process will be allowed in resource_dispatcher_host_impl.cc
|
||||
@@ -1497,3 +1273,18 @@ const extensions::Extension* CefContentBrowserClient::GetExtension(
|
||||
return registry->enabled_extensions().GetExtensionOrAppByURL(
|
||||
site_instance->GetSiteURL());
|
||||
}
|
||||
|
||||
// static
|
||||
void CefContentBrowserClient::HandleExternalProtocolOnUIThread(
|
||||
const GURL& url,
|
||||
const content::ResourceRequestInfo::WebContentsGetter&
|
||||
web_contents_getter) {
|
||||
CEF_REQUIRE_UIT();
|
||||
content::WebContents* web_contents = web_contents_getter.Run();
|
||||
if (web_contents) {
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
CefBrowserHostImpl::GetBrowserForContents(web_contents);
|
||||
if (browser.get())
|
||||
browser->HandleExternalProtocol(url);
|
||||
}
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include "include/cef_request_context_handler.h"
|
||||
#include "libcef/browser/net/url_request_context_getter.h"
|
||||
#include "libcef/browser/net/url_request_context_getter_impl.h"
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
|
||||
#include "base/macros.h"
|
||||
@@ -41,37 +41,26 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
static CefContentBrowserClient* Get();
|
||||
|
||||
// ContentBrowserClient implementation.
|
||||
std::unique_ptr<content::BrowserMainParts> CreateBrowserMainParts(
|
||||
content::BrowserMainParts* CreateBrowserMainParts(
|
||||
const content::MainFunctionParams& parameters) override;
|
||||
void RenderProcessWillLaunch(
|
||||
content::RenderProcessHost* host,
|
||||
service_manager::mojom::ServiceRequest* service_request) override;
|
||||
bool ShouldUseProcessPerSite(content::BrowserContext* browser_context,
|
||||
const GURL& effective_url) override;
|
||||
bool DoesSiteRequireDedicatedProcess(
|
||||
content::BrowserOrResourceContext browser_or_resource_contexts,
|
||||
const GURL& effective_site_url) override;
|
||||
void GetAdditionalWebUISchemes(
|
||||
std::vector<std::string>* additional_schemes) override;
|
||||
void GetAdditionalViewSourceSchemes(
|
||||
std::vector<std::string>* additional_schemes) override;
|
||||
void GetAdditionalAllowedSchemesForFileSystem(
|
||||
std::vector<std::string>* additional_allowed_schemes) override;
|
||||
bool IsWebUIAllowedToMakeNetworkRequests(const url::Origin& origin) override;
|
||||
bool DoesSiteRequireDedicatedProcess(content::BrowserContext* browser_context,
|
||||
const GURL& effective_site_url) override;
|
||||
bool IsHandledURL(const GURL& url) override;
|
||||
void SiteInstanceGotProcess(content::SiteInstance* site_instance) override;
|
||||
void SiteInstanceDeleting(content::SiteInstance* site_instance) override;
|
||||
void RunServiceInstance(
|
||||
const service_manager::Identity& identity,
|
||||
mojo::PendingReceiver<service_manager::mojom::Service>* receiver)
|
||||
override;
|
||||
void RunServiceInstanceOnIOThread(
|
||||
const service_manager::Identity& identity,
|
||||
mojo::PendingReceiver<service_manager::mojom::Service>* receiver)
|
||||
override;
|
||||
void RegisterIOThreadServiceHandlers(
|
||||
content::ServiceManagerConnection* connection) override;
|
||||
void RegisterOutOfProcessServices(OutOfProcessServiceMap* services) override;
|
||||
base::Optional<service_manager::Manifest> GetServiceManifestOverlay(
|
||||
base::StringPiece name) override;
|
||||
std::vector<service_manager::Manifest> GetExtraServiceManifests() override;
|
||||
bool IsSameBrowserContext(content::BrowserContext* context1,
|
||||
content::BrowserContext* context2) override;
|
||||
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
|
||||
int child_process_id) override;
|
||||
void AdjustUtilityServiceProcessCommandLine(
|
||||
@@ -79,11 +68,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
base::CommandLine* command_line) override;
|
||||
bool ShouldEnableStrictSiteIsolation() override;
|
||||
std::string GetApplicationLocale() override;
|
||||
scoped_refptr<network::SharedURLLoaderFactory>
|
||||
GetSystemSharedURLLoaderFactory() override;
|
||||
network::mojom::NetworkContext* GetSystemNetworkContext() override;
|
||||
scoped_refptr<content::QuotaPermissionContext> CreateQuotaPermissionContext()
|
||||
override;
|
||||
content::QuotaPermissionContext* CreateQuotaPermissionContext() override;
|
||||
void GetQuotaSettings(
|
||||
content::BrowserContext* context,
|
||||
content::StoragePartition* partition,
|
||||
@@ -98,7 +83,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
int cert_error,
|
||||
const net::SSLInfo& ssl_info,
|
||||
const GURL& request_url,
|
||||
bool is_main_frame_request,
|
||||
content::ResourceType resource_type,
|
||||
bool strict_enforcement,
|
||||
bool expired_previous_decision,
|
||||
const base::Callback<void(content::CertificateRequestResultType)>&
|
||||
@@ -131,13 +116,6 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
std::vector<std::unique_ptr<content::NavigationThrottle>>
|
||||
CreateThrottlesForNavigation(
|
||||
content::NavigationHandle* navigation_handle) override;
|
||||
std::vector<std::unique_ptr<content::URLLoaderThrottle>>
|
||||
CreateURLLoaderThrottles(
|
||||
const network::ResourceRequest& request,
|
||||
content::ResourceContext* resource_context,
|
||||
const base::RepeatingCallback<content::WebContents*()>& wc_getter,
|
||||
content::NavigationUIData* navigation_ui_data,
|
||||
int frame_tree_node_id) override;
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
void GetAdditionalMappedFilesForChildProcess(
|
||||
@@ -155,17 +133,10 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
service_manager::BinderRegistry* registry,
|
||||
blink::AssociatedInterfaceRegistry* associated_registry,
|
||||
content::RenderProcessHost* render_process_host) override;
|
||||
|
||||
std::unique_ptr<net::ClientCertStore> CreateClientCertStore(
|
||||
content::ResourceContext* resource_context) override;
|
||||
std::unique_ptr<content::LoginDelegate> CreateLoginDelegate(
|
||||
const net::AuthChallengeInfo& auth_info,
|
||||
content::WebContents* web_contents,
|
||||
const content::GlobalRequestID& request_id,
|
||||
bool is_request_for_main_frame,
|
||||
const GURL& url,
|
||||
scoped_refptr<net::HttpResponseHeaders> response_headers,
|
||||
bool first_auth_attempt,
|
||||
LoginAuthRequiredCallback auth_required_callback) override;
|
||||
|
||||
void RegisterNonNetworkNavigationURLLoaderFactories(
|
||||
int frame_tree_node_id,
|
||||
NonNetworkURLLoaderFactoryMap* factories) override;
|
||||
@@ -183,13 +154,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
network::mojom::URLLoaderFactoryRequest* factory_request,
|
||||
network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client,
|
||||
bool* bypass_redirect_checks) override;
|
||||
void OnNetworkServiceCreated(
|
||||
network::mojom::NetworkService* network_service) override;
|
||||
network::mojom::NetworkContextPtr CreateNetworkContext(
|
||||
content::BrowserContext* context,
|
||||
bool in_memory,
|
||||
const base::FilePath& relative_partition_path) override;
|
||||
std::vector<base::FilePath> GetNetworkContextsParentDirectory() override;
|
||||
|
||||
bool HandleExternalProtocol(
|
||||
const GURL& url,
|
||||
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
|
||||
@@ -198,21 +163,12 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
bool is_main_frame,
|
||||
ui::PageTransition page_transition,
|
||||
bool has_user_gesture,
|
||||
network::mojom::URLLoaderFactoryRequest* factory_request,
|
||||
network::mojom::URLLoaderFactory*& out_factory) override;
|
||||
bool HandleExternalProtocol(
|
||||
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
|
||||
int frame_tree_node_id,
|
||||
content::NavigationUIData* navigation_data,
|
||||
const network::ResourceRequest& request,
|
||||
network::mojom::URLLoaderFactoryRequest* factory_request,
|
||||
network::mojom::URLLoaderFactory*& out_factory) override;
|
||||
const std::string& method,
|
||||
const net::HttpRequestHeaders& headers) override;
|
||||
std::string GetProduct() const override;
|
||||
std::string GetChromeProduct() const override;
|
||||
std::string GetUserAgent() const override;
|
||||
blink::UserAgentMetadata GetUserAgentMetadata() const override;
|
||||
base::flat_set<std::string> GetPluginMimeTypesWithExternalHandlers(
|
||||
content::ResourceContext* resource_context) override;
|
||||
|
||||
// Perform browser process registration for the custom scheme.
|
||||
void RegisterCustomScheme(const std::string& scheme);
|
||||
@@ -229,6 +185,11 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
const extensions::Extension* GetExtension(
|
||||
content::SiteInstance* site_instance);
|
||||
|
||||
static void HandleExternalProtocolOnUIThread(
|
||||
const GURL& url,
|
||||
const content::ResourceRequestInfo::WebContentsGetter&
|
||||
web_contents_getter);
|
||||
|
||||
CefBrowserMainParts* browser_main_parts_;
|
||||
|
||||
std::unique_ptr<content::PluginServiceFilter> plugin_service_filter_;
|
||||
|
@@ -22,9 +22,9 @@
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/run_loop.h"
|
||||
#include "base/synchronization/waitable_event.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "components/network_session_configurator/common/network_switches.h"
|
||||
#include "content/app/content_service_manager_main_delegate.h"
|
||||
#include "content/browser/startup_helper.h"
|
||||
#include "content/public/browser/notification_service.h"
|
||||
#include "content/public/browser/notification_types.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
@@ -35,8 +35,8 @@
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "chrome/chrome_elf/chrome_elf_main.h"
|
||||
#include "chrome/install_static/initialize_from_primary_module.h"
|
||||
#include "chrome_elf/chrome_elf_main.h"
|
||||
#include "components/crash/content/app/crashpad.h"
|
||||
#include "content/public/app/sandbox_helper_win.h"
|
||||
#include "sandbox/win/src/sandbox_types.h"
|
||||
@@ -370,18 +370,6 @@ bool CefContext::Initialize(const CefMainArgs& args,
|
||||
SignalChromeElf();
|
||||
#endif
|
||||
|
||||
base::FilePath cache_path = base::FilePath(CefString(&settings_.cache_path));
|
||||
if (!ValidateCachePath(cache_path)) {
|
||||
// Reset to in-memory storage.
|
||||
CefString(&settings_.cache_path).clear();
|
||||
cache_path = base::FilePath();
|
||||
}
|
||||
const base::FilePath& root_cache_path =
|
||||
base::FilePath(CefString(&settings_.root_cache_path));
|
||||
if (root_cache_path.empty() && !cache_path.empty()) {
|
||||
CefString(&settings_.root_cache_path) = CefString(&settings_.cache_path);
|
||||
}
|
||||
|
||||
main_delegate_.reset(new CefMainDelegate(application));
|
||||
browser_info_manager_.reset(new CefBrowserInfoManager);
|
||||
|
||||
@@ -427,6 +415,11 @@ bool CefContext::Initialize(const CefMainArgs& args,
|
||||
base::WaitableEvent::ResetPolicy::AUTOMATIC,
|
||||
base::WaitableEvent::InitialState::NOT_SIGNALED);
|
||||
|
||||
// This is required because creating a base::Thread as starting it will
|
||||
// check some feature flags this will cause a CHECK failure later when this
|
||||
// gets called by some call down the line of service_manager::MainRun.
|
||||
content::SetUpFieldTrialsAndFeatureList();
|
||||
|
||||
if (!main_delegate_->CreateUIThread(base::BindOnce(
|
||||
[](CefContext* context, base::WaitableEvent* event) {
|
||||
service_manager::MainRun(*context->sm_main_params_);
|
||||
@@ -540,46 +533,6 @@ void CefContext::PopulateRequestContextSettings(
|
||||
CefString(&settings_.accept_language_list);
|
||||
}
|
||||
|
||||
bool CefContext::ValidateCachePath(const base::FilePath& cache_path) {
|
||||
if (cache_path.empty())
|
||||
return true;
|
||||
|
||||
const base::FilePath& root_cache_path =
|
||||
base::FilePath(CefString(&settings_.root_cache_path));
|
||||
if (!root_cache_path.empty() && root_cache_path != cache_path &&
|
||||
!root_cache_path.IsParent(cache_path)) {
|
||||
LOG(ERROR) << "The cache_path directory (" << cache_path.value()
|
||||
<< ") is not a child of the root_cache_path directory ("
|
||||
<< root_cache_path.value() << ")";
|
||||
return false;
|
||||
}
|
||||
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
if (!base::DirectoryExists(cache_path) &&
|
||||
!base::CreateDirectory(cache_path)) {
|
||||
LOG(ERROR) << "The cache_path directory (" << cache_path.value()
|
||||
<< ") could not be created.";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefContext::AddObserver(Observer* observer) {
|
||||
CEF_REQUIRE_UIT();
|
||||
observers_.AddObserver(observer);
|
||||
}
|
||||
|
||||
void CefContext::RemoveObserver(Observer* observer) {
|
||||
CEF_REQUIRE_UIT();
|
||||
observers_.RemoveObserver(observer);
|
||||
}
|
||||
|
||||
bool CefContext::HasObserver(Observer* observer) const {
|
||||
CEF_REQUIRE_UIT();
|
||||
return observers_.HasObserver(observer);
|
||||
}
|
||||
|
||||
void CefContext::OnContextInitialized() {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
@@ -606,9 +559,6 @@ void CefContext::FinishShutdownOnUIThread(
|
||||
|
||||
browser_info_manager_->DestroyAllBrowsers();
|
||||
|
||||
for (auto& observer : observers_)
|
||||
observer.OnContextDestroyed();
|
||||
|
||||
if (trace_subscriber_.get())
|
||||
trace_subscriber_.reset(NULL);
|
||||
|
||||
@@ -636,7 +586,4 @@ void CefContext::FinalizeShutdown() {
|
||||
sm_main_params_.reset(NULL);
|
||||
sm_main_delegate_.reset(NULL);
|
||||
main_delegate_.reset(NULL);
|
||||
|
||||
delete g_browser_process;
|
||||
g_browser_process = NULL;
|
||||
}
|
||||
|
@@ -12,7 +12,6 @@
|
||||
|
||||
#include "include/cef_app.h"
|
||||
|
||||
#include "base/observer_list.h"
|
||||
#include "base/threading/platform_thread.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
|
||||
@@ -37,17 +36,6 @@ class CefContext {
|
||||
public:
|
||||
typedef std::list<CefRefPtr<CefBrowserHostImpl>> BrowserList;
|
||||
|
||||
// Interface to implement for observers that wish to be informed of changes
|
||||
// to the context. All methods will be called on the UI thread.
|
||||
class Observer {
|
||||
public:
|
||||
// Called before the context is destroyed.
|
||||
virtual void OnContextDestroyed() = 0;
|
||||
|
||||
protected:
|
||||
virtual ~Observer() {}
|
||||
};
|
||||
|
||||
CefContext();
|
||||
~CefContext();
|
||||
|
||||
@@ -85,20 +73,10 @@ class CefContext {
|
||||
|
||||
CefTraceSubscriber* GetTraceSubscriber();
|
||||
|
||||
// Populate request context settings for the global system context based on
|
||||
// CefSettings and command-line flags.
|
||||
// Populate the request context settings based on CefSettings and command-
|
||||
// line flags.
|
||||
void PopulateRequestContextSettings(CefRequestContextSettings* settings);
|
||||
|
||||
// Verify that |cache_path| is valid and create it if necessary.
|
||||
bool ValidateCachePath(const base::FilePath& cache_path);
|
||||
|
||||
// Manage observer objects. The observer must either outlive this object or
|
||||
// remove itself before destruction. These methods can only be called on the
|
||||
// UI thread.
|
||||
void AddObserver(Observer* observer);
|
||||
void RemoveObserver(Observer* observer);
|
||||
bool HasObserver(Observer* observer) const;
|
||||
|
||||
private:
|
||||
void OnContextInitialized();
|
||||
|
||||
@@ -123,9 +101,6 @@ class CefContext {
|
||||
std::unique_ptr<service_manager::MainParams> sm_main_params_;
|
||||
std::unique_ptr<CefTraceSubscriber> trace_subscriber_;
|
||||
std::unique_ptr<CefBrowserInfoManager> browser_info_manager_;
|
||||
|
||||
// Observers that want to be notified of changes to this object.
|
||||
base::ObserverList<Observer>::Unchecked observers_;
|
||||
};
|
||||
|
||||
// Helper macro that returns true if the global context is in a valid state.
|
||||
|
655
libcef/browser/cookie_manager_impl.cc
Normal file
655
libcef/browser/cookie_manager_impl.cc
Normal file
@@ -0,0 +1,655 @@
|
||||
// Copyright (c) 2012 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/cookie_manager_impl.h"
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/net/cookie_store_source.h"
|
||||
#include "libcef/browser/net/network_delegate.h"
|
||||
#include "libcef/common/task_runner_impl.h"
|
||||
#include "libcef/common/time_util.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/format_macros.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "components/net_log/chrome_net_log.h"
|
||||
#include "content/browser/storage_partition_impl.h"
|
||||
#include "content/public/browser/browser_task_traits.h"
|
||||
#include "net/cookies/cookie_util.h"
|
||||
#include "net/cookies/parsed_cookie.h"
|
||||
#include "net/url_request/url_request_context.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
using content::BrowserThread;
|
||||
|
||||
namespace {
|
||||
|
||||
// Callback class for visiting cookies.
|
||||
class VisitCookiesCallback : public base::RefCounted<VisitCookiesCallback> {
|
||||
public:
|
||||
explicit VisitCookiesCallback(
|
||||
const CefCookieManagerImpl::CookieStoreGetter& cookie_store_getter,
|
||||
CefRefPtr<CefCookieVisitor> visitor)
|
||||
: cookie_store_getter_(cookie_store_getter), visitor_(visitor) {}
|
||||
|
||||
void Run(const net::CookieList& list,
|
||||
const net::CookieStatusList& excluded_list) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
int total = list.size(), count = 0;
|
||||
|
||||
net::CookieList::const_iterator it = list.begin();
|
||||
for (; it != list.end(); ++it, ++count) {
|
||||
CefCookie cookie;
|
||||
const net::CanonicalCookie& cc = *(it);
|
||||
CefCookieManagerImpl::GetCefCookie(cc, cookie);
|
||||
|
||||
bool deleteCookie = false;
|
||||
bool keepLooping = visitor_->Visit(cookie, count, total, deleteCookie);
|
||||
if (deleteCookie) {
|
||||
net::CookieStore* cookie_store = cookie_store_getter_.Run();
|
||||
if (cookie_store) {
|
||||
cookie_store->DeleteCanonicalCookieAsync(
|
||||
cc, net::CookieMonster::DeleteCallback());
|
||||
}
|
||||
}
|
||||
if (!keepLooping)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
friend class base::RefCounted<VisitCookiesCallback>;
|
||||
|
||||
~VisitCookiesCallback() {}
|
||||
|
||||
CefCookieManagerImpl::CookieStoreGetter cookie_store_getter_;
|
||||
CefRefPtr<CefCookieVisitor> visitor_;
|
||||
};
|
||||
|
||||
// Methods extracted from net/cookies/cookie_store.cc
|
||||
|
||||
// Determine the cookie domain to use for setting the specified cookie.
|
||||
bool GetCookieDomain(const GURL& url,
|
||||
const net::ParsedCookie& pc,
|
||||
std::string* result) {
|
||||
std::string domain_string;
|
||||
if (pc.HasDomain())
|
||||
domain_string = pc.Domain();
|
||||
return net::cookie_util::GetCookieDomainWithString(url, domain_string,
|
||||
result);
|
||||
}
|
||||
|
||||
// Always execute the callback asynchronously.
|
||||
void RunAsyncCompletionOnIOThread(CefRefPtr<CefCompletionCallback> callback) {
|
||||
if (!callback.get())
|
||||
return;
|
||||
CEF_POST_TASK(CEF_IOT,
|
||||
base::Bind(&CefCompletionCallback::OnComplete, callback.get()));
|
||||
}
|
||||
|
||||
// Always execute the callback asynchronously.
|
||||
void DeleteCookiesCallbackImpl(CefRefPtr<CefDeleteCookiesCallback> callback,
|
||||
uint32_t num_deleted) {
|
||||
if (!callback.get())
|
||||
return;
|
||||
CEF_POST_TASK(CEF_IOT, base::Bind(&CefDeleteCookiesCallback::OnComplete,
|
||||
callback.get(), num_deleted));
|
||||
}
|
||||
|
||||
// Always execute the callback asynchronously.
|
||||
void SetCookieCallbackImpl(CefRefPtr<CefSetCookieCallback> callback,
|
||||
net::CanonicalCookie::CookieInclusionStatus status) {
|
||||
if (!callback.get())
|
||||
return;
|
||||
CEF_POST_TASK(
|
||||
CEF_IOT,
|
||||
base::Bind(
|
||||
&CefSetCookieCallback::OnComplete, callback.get(),
|
||||
status == net::CanonicalCookie::CookieInclusionStatus::INCLUDE));
|
||||
}
|
||||
|
||||
net::CookieStore* GetExistingCookieStoreHelper(
|
||||
base::WeakPtr<CefCookieManagerImpl> cookie_manager) {
|
||||
if (cookie_manager.get())
|
||||
return cookie_manager->GetExistingCookieStore();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefCookieManagerImpl::CefCookieManagerImpl(bool is_blocking)
|
||||
: is_blocking_(is_blocking), weak_ptr_factory_(this) {}
|
||||
|
||||
CefCookieManagerImpl::~CefCookieManagerImpl() {
|
||||
CEF_REQUIRE_IOT();
|
||||
}
|
||||
|
||||
void CefCookieManagerImpl::Initialize(
|
||||
CefRefPtr<CefRequestContextImpl> request_context,
|
||||
const CefString& path,
|
||||
bool persist_session_cookies,
|
||||
CefRefPtr<CefCompletionCallback> callback) {
|
||||
CHECK(!is_blocking_);
|
||||
if (request_context.get()) {
|
||||
request_context_ = request_context;
|
||||
request_context_->GetRequestContextImpl(
|
||||
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO}),
|
||||
base::Bind(&CefCookieManagerImpl::InitWithContext, this, callback));
|
||||
} else {
|
||||
SetStoragePath(path, persist_session_cookies, callback);
|
||||
}
|
||||
}
|
||||
|
||||
void CefCookieManagerImpl::GetCookieStore(
|
||||
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
||||
const CookieStoreCallback& callback) {
|
||||
if (!task_runner.get())
|
||||
task_runner = CefTaskRunnerImpl::GetCurrentTaskRunner();
|
||||
|
||||
if (!CEF_CURRENTLY_ON_IOT()) {
|
||||
CEF_POST_TASK(CEF_IOT, base::Bind(&CefCookieManagerImpl::GetCookieStore,
|
||||
this, task_runner, callback));
|
||||
return;
|
||||
}
|
||||
|
||||
if (HasContext()) {
|
||||
RunMethodWithContext(
|
||||
base::Bind(&CefCookieManagerImpl::GetCookieStoreWithContext, this,
|
||||
task_runner, callback));
|
||||
return;
|
||||
}
|
||||
|
||||
DCHECK(is_blocking_ || cookie_source_);
|
||||
|
||||
// Binding ref-counted |this| to CookieStoreGetter may result in
|
||||
// heap-use-after-free if (a) the CookieStoreGetter contains the last
|
||||
// CefCookieManagerImpl reference and (b) that reference is released during
|
||||
// execution of a CookieMonster callback (which then results in the
|
||||
// CookieManager being deleted). Use WeakPtr instead of |this| so that, in
|
||||
// that case, the CookieStoreGetter will return nullptr instead of keeping
|
||||
// the CefCookieManagerImpl alive (see issue #1882).
|
||||
const CookieStoreGetter& cookie_store_getter =
|
||||
base::Bind(GetExistingCookieStoreHelper, weak_ptr_factory_.GetWeakPtr());
|
||||
|
||||
if (task_runner->BelongsToCurrentThread()) {
|
||||
// Execute the callback immediately.
|
||||
callback.Run(cookie_store_getter);
|
||||
} else {
|
||||
// Execute the callback on the target thread.
|
||||
task_runner->PostTask(FROM_HERE, base::Bind(callback, cookie_store_getter));
|
||||
}
|
||||
}
|
||||
|
||||
net::CookieStore* CefCookieManagerImpl::GetExistingCookieStore() {
|
||||
CEF_REQUIRE_IOT();
|
||||
if (cookie_source_) {
|
||||
return cookie_source_->GetCookieStore();
|
||||
} else if (request_context_impl_.get()) {
|
||||
net::CookieStore* cookie_store =
|
||||
request_context_impl_->GetExistingCookieStore();
|
||||
DCHECK(cookie_store);
|
||||
return cookie_store;
|
||||
}
|
||||
|
||||
DCHECK(is_blocking_);
|
||||
if (!is_blocking_)
|
||||
LOG(ERROR) << "Cookie store does not exist";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CefCookieManagerImpl::SetSupportedSchemes(
|
||||
const std::vector<CefString>& schemes,
|
||||
CefRefPtr<CefCompletionCallback> callback) {
|
||||
if (!CEF_CURRENTLY_ON_IOT()) {
|
||||
CEF_POST_TASK(CEF_IOT,
|
||||
base::Bind(&CefCookieManagerImpl::SetSupportedSchemes, this,
|
||||
schemes, callback));
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<std::string> scheme_set;
|
||||
std::vector<CefString>::const_iterator it = schemes.begin();
|
||||
for (; it != schemes.end(); ++it)
|
||||
scheme_set.push_back(*it);
|
||||
|
||||
SetSupportedSchemesInternal(scheme_set, callback);
|
||||
}
|
||||
|
||||
bool CefCookieManagerImpl::VisitAllCookies(
|
||||
CefRefPtr<CefCookieVisitor> visitor) {
|
||||
GetCookieStore(
|
||||
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO}),
|
||||
base::Bind(&CefCookieManagerImpl::VisitAllCookiesInternal, this,
|
||||
visitor));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefCookieManagerImpl::VisitUrlCookies(
|
||||
const CefString& url,
|
||||
bool includeHttpOnly,
|
||||
CefRefPtr<CefCookieVisitor> visitor) {
|
||||
GetCookieStore(
|
||||
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO}),
|
||||
base::Bind(&CefCookieManagerImpl::VisitUrlCookiesInternal, this, url,
|
||||
includeHttpOnly, visitor));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefCookieManagerImpl::SetCookie(const CefString& url,
|
||||
const CefCookie& cookie,
|
||||
CefRefPtr<CefSetCookieCallback> callback) {
|
||||
GURL gurl = GURL(url.ToString());
|
||||
if (!gurl.is_valid())
|
||||
return false;
|
||||
|
||||
GetCookieStore(
|
||||
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO}),
|
||||
base::Bind(&CefCookieManagerImpl::SetCookieInternal, this, gurl, cookie,
|
||||
callback));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefCookieManagerImpl::DeleteCookies(
|
||||
const CefString& url,
|
||||
const CefString& cookie_name,
|
||||
CefRefPtr<CefDeleteCookiesCallback> callback) {
|
||||
// Empty URLs are allowed but not invalid URLs.
|
||||
GURL gurl = GURL(url.ToString());
|
||||
if (!gurl.is_empty() && !gurl.is_valid())
|
||||
return false;
|
||||
|
||||
GetCookieStore(
|
||||
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO}),
|
||||
base::Bind(&CefCookieManagerImpl::DeleteCookiesInternal, this, gurl,
|
||||
cookie_name, callback));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefCookieManagerImpl::SetStoragePath(
|
||||
const CefString& path,
|
||||
bool persist_session_cookies,
|
||||
CefRefPtr<CefCompletionCallback> callback) {
|
||||
if (!CEF_CURRENTLY_ON_IOT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_IOT,
|
||||
base::Bind(base::IgnoreResult(&CefCookieManagerImpl::SetStoragePath),
|
||||
this, path, persist_session_cookies, callback));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (HasContext()) {
|
||||
RunMethodWithContext(
|
||||
base::Bind(&CefCookieManagerImpl::SetStoragePathWithContext, this, path,
|
||||
persist_session_cookies, callback));
|
||||
return true;
|
||||
}
|
||||
|
||||
base::FilePath new_path;
|
||||
if (!path.empty())
|
||||
new_path = base::FilePath(path);
|
||||
|
||||
if (!cookie_source_) {
|
||||
cookie_source_.reset(new CefCookieStoreOwnerSource());
|
||||
}
|
||||
|
||||
cookie_source_->SetCookieStoragePath(new_path, persist_session_cookies,
|
||||
g_browser_process->net_log());
|
||||
|
||||
RunAsyncCompletionOnIOThread(callback);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefCookieManagerImpl::FlushStore(
|
||||
CefRefPtr<CefCompletionCallback> callback) {
|
||||
GetCookieStore(
|
||||
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO}),
|
||||
base::Bind(&CefCookieManagerImpl::FlushStoreInternal, this, callback));
|
||||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
bool CefCookieManagerImpl::GetCefCookie(const net::CanonicalCookie& cc,
|
||||
CefCookie& cookie) {
|
||||
CefString(&cookie.name).FromString(cc.Name());
|
||||
CefString(&cookie.value).FromString(cc.Value());
|
||||
CefString(&cookie.domain).FromString(cc.Domain());
|
||||
CefString(&cookie.path).FromString(cc.Path());
|
||||
cookie.secure = cc.IsSecure();
|
||||
cookie.httponly = cc.IsHttpOnly();
|
||||
cef_time_from_basetime(cc.CreationDate(), cookie.creation);
|
||||
cef_time_from_basetime(cc.LastAccessDate(), cookie.last_access);
|
||||
cookie.has_expires = cc.IsPersistent();
|
||||
if (cookie.has_expires)
|
||||
cef_time_from_basetime(cc.ExpiryDate(), cookie.expires);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
bool CefCookieManagerImpl::GetCefCookie(const GURL& url,
|
||||
const std::string& cookie_line,
|
||||
CefCookie& cookie) {
|
||||
// Parse the cookie.
|
||||
net::ParsedCookie pc(cookie_line);
|
||||
if (!pc.IsValid())
|
||||
return false;
|
||||
|
||||
std::string cookie_domain;
|
||||
if (!GetCookieDomain(url, pc, &cookie_domain))
|
||||
return false;
|
||||
|
||||
std::string path_string;
|
||||
if (pc.HasPath())
|
||||
path_string = pc.Path();
|
||||
std::string cookie_path =
|
||||
net::CanonicalCookie::CanonPathWithString(url, path_string);
|
||||
base::Time creation_time = base::Time::Now();
|
||||
base::Time cookie_expires =
|
||||
net::CanonicalCookie::CanonExpiration(pc, creation_time, creation_time);
|
||||
|
||||
CefString(&cookie.name).FromString(pc.Name());
|
||||
CefString(&cookie.value).FromString(pc.Value());
|
||||
CefString(&cookie.domain).FromString(cookie_domain);
|
||||
CefString(&cookie.path).FromString(cookie_path);
|
||||
cookie.secure = pc.IsSecure();
|
||||
cookie.httponly = pc.IsHttpOnly();
|
||||
cef_time_from_basetime(creation_time, cookie.creation);
|
||||
cef_time_from_basetime(creation_time, cookie.last_access);
|
||||
cookie.has_expires = !cookie_expires.is_null();
|
||||
if (cookie.has_expires)
|
||||
cef_time_from_basetime(cookie_expires, cookie.expires);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
void CefCookieManagerImpl::SetCookieMonsterSchemes(
|
||||
net::CookieMonster* cookie_monster,
|
||||
const std::vector<std::string>& schemes) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
std::vector<std::string> all_schemes = schemes;
|
||||
|
||||
// Add default schemes that should always support cookies.
|
||||
all_schemes.push_back("http");
|
||||
all_schemes.push_back("https");
|
||||
all_schemes.push_back("ws");
|
||||
all_schemes.push_back("wss");
|
||||
|
||||
cookie_monster->SetCookieableSchemes(all_schemes);
|
||||
}
|
||||
|
||||
bool CefCookieManagerImpl::HasContext() {
|
||||
CEF_REQUIRE_IOT();
|
||||
return (request_context_impl_.get() || request_context_.get());
|
||||
}
|
||||
|
||||
void CefCookieManagerImpl::RunMethodWithContext(
|
||||
const CefRequestContextImpl::RequestContextCallback& method) {
|
||||
CEF_REQUIRE_IOT();
|
||||
if (request_context_impl_.get()) {
|
||||
method.Run(request_context_impl_);
|
||||
} else if (request_context_.get()) {
|
||||
// Try again after the request context is initialized.
|
||||
request_context_->GetRequestContextImpl(
|
||||
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO}),
|
||||
method);
|
||||
} else {
|
||||
NOTREACHED();
|
||||
}
|
||||
}
|
||||
|
||||
void CefCookieManagerImpl::InitWithContext(
|
||||
CefRefPtr<CefCompletionCallback> callback,
|
||||
scoped_refptr<CefURLRequestContextGetterImpl> request_context) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
DCHECK(!request_context_impl_.get());
|
||||
request_context_impl_ = request_context;
|
||||
|
||||
// Clear the CefRequestContextImpl reference here to avoid a potential
|
||||
// reference loop between CefRequestContextImpl (which has a reference to
|
||||
// CefRequestContextHandler), CefRequestContextHandler (which may keep a
|
||||
// reference to this object) and this object.
|
||||
request_context_ = NULL;
|
||||
|
||||
RunAsyncCompletionOnIOThread(callback);
|
||||
}
|
||||
|
||||
void CefCookieManagerImpl::SetStoragePathWithContext(
|
||||
const CefString& path,
|
||||
bool persist_session_cookies,
|
||||
CefRefPtr<CefCompletionCallback> callback,
|
||||
scoped_refptr<CefURLRequestContextGetterImpl> request_context) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
base::FilePath new_path;
|
||||
if (!path.empty())
|
||||
new_path = base::FilePath(path);
|
||||
|
||||
request_context->SetCookieStoragePath(new_path, persist_session_cookies);
|
||||
|
||||
RunAsyncCompletionOnIOThread(callback);
|
||||
}
|
||||
|
||||
void CefCookieManagerImpl::SetSupportedSchemesWithContext(
|
||||
const std::vector<std::string>& schemes,
|
||||
CefRefPtr<CefCompletionCallback> callback,
|
||||
scoped_refptr<CefURLRequestContextGetterImpl> request_context) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
request_context->SetCookieSupportedSchemes(schemes);
|
||||
|
||||
RunAsyncCompletionOnIOThread(callback);
|
||||
}
|
||||
|
||||
void CefCookieManagerImpl::GetCookieStoreWithContext(
|
||||
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
||||
const CookieStoreCallback& callback,
|
||||
scoped_refptr<CefURLRequestContextGetterImpl> request_context) {
|
||||
CEF_REQUIRE_IOT();
|
||||
DCHECK(request_context->GetExistingCookieStore());
|
||||
|
||||
const CookieStoreGetter& cookie_store_getter = base::Bind(
|
||||
&CefURLRequestContextGetterImpl::GetExistingCookieStore, request_context);
|
||||
|
||||
if (task_runner->BelongsToCurrentThread()) {
|
||||
// Execute the callback immediately.
|
||||
callback.Run(cookie_store_getter);
|
||||
} else {
|
||||
// Execute the callback on the target thread.
|
||||
task_runner->PostTask(FROM_HERE, base::Bind(callback, cookie_store_getter));
|
||||
}
|
||||
}
|
||||
|
||||
void CefCookieManagerImpl::SetSupportedSchemesInternal(
|
||||
const std::vector<std::string>& schemes,
|
||||
CefRefPtr<CefCompletionCallback> callback) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
if (HasContext()) {
|
||||
RunMethodWithContext(
|
||||
base::Bind(&CefCookieManagerImpl::SetSupportedSchemesWithContext, this,
|
||||
schemes, callback));
|
||||
return;
|
||||
}
|
||||
|
||||
DCHECK(is_blocking_ || cookie_source_);
|
||||
if (cookie_source_) {
|
||||
cookie_source_->SetCookieSupportedSchemes(schemes);
|
||||
}
|
||||
|
||||
RunAsyncCompletionOnIOThread(callback);
|
||||
}
|
||||
|
||||
void CefCookieManagerImpl::VisitAllCookiesInternal(
|
||||
CefRefPtr<CefCookieVisitor> visitor,
|
||||
const CookieStoreGetter& cookie_store_getter) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
net::CookieStore* cookie_store = cookie_store_getter.Run();
|
||||
if (!cookie_store)
|
||||
return;
|
||||
|
||||
scoped_refptr<VisitCookiesCallback> callback(
|
||||
new VisitCookiesCallback(cookie_store_getter, visitor));
|
||||
|
||||
cookie_store->GetAllCookiesAsync(
|
||||
base::Bind(&VisitCookiesCallback::Run, callback.get()));
|
||||
}
|
||||
|
||||
void CefCookieManagerImpl::VisitUrlCookiesInternal(
|
||||
const CefString& url,
|
||||
bool includeHttpOnly,
|
||||
CefRefPtr<CefCookieVisitor> visitor,
|
||||
const CookieStoreGetter& cookie_store_getter) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
net::CookieStore* cookie_store = cookie_store_getter.Run();
|
||||
if (!cookie_store)
|
||||
return;
|
||||
|
||||
net::CookieOptions options;
|
||||
if (includeHttpOnly)
|
||||
options.set_include_httponly();
|
||||
|
||||
scoped_refptr<VisitCookiesCallback> callback(
|
||||
new VisitCookiesCallback(cookie_store_getter, visitor));
|
||||
|
||||
GURL gurl = GURL(url.ToString());
|
||||
cookie_store->GetCookieListWithOptionsAsync(
|
||||
gurl, options, base::Bind(&VisitCookiesCallback::Run, callback.get()));
|
||||
}
|
||||
|
||||
void CefCookieManagerImpl::SetCookieInternal(
|
||||
const GURL& url,
|
||||
const CefCookie& cookie,
|
||||
CefRefPtr<CefSetCookieCallback> callback,
|
||||
const CookieStoreGetter& cookie_store_getter) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
net::CookieStore* cookie_store = cookie_store_getter.Run();
|
||||
if (!cookie_store) {
|
||||
if (callback.get()) {
|
||||
CEF_POST_TASK(CEF_IOT, base::Bind(&CefSetCookieCallback::OnComplete,
|
||||
callback.get(), false));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
std::string name = CefString(&cookie.name).ToString();
|
||||
std::string value = CefString(&cookie.value).ToString();
|
||||
std::string domain = CefString(&cookie.domain).ToString();
|
||||
std::string path = CefString(&cookie.path).ToString();
|
||||
|
||||
base::Time expiration_time;
|
||||
if (cookie.has_expires)
|
||||
cef_time_to_basetime(cookie.expires, expiration_time);
|
||||
|
||||
cookie_store->SetCanonicalCookieAsync(
|
||||
net::CanonicalCookie::CreateSanitizedCookie(
|
||||
url, name, value, domain, path,
|
||||
base::Time(), // Creation time.
|
||||
expiration_time,
|
||||
base::Time(), // Last access time.
|
||||
cookie.secure ? true : false, cookie.httponly ? true : false,
|
||||
net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT),
|
||||
url.scheme(), cookie.httponly ? true : false,
|
||||
base::Bind(SetCookieCallbackImpl, callback));
|
||||
}
|
||||
|
||||
void CefCookieManagerImpl::DeleteCookiesInternal(
|
||||
const GURL& url,
|
||||
const CefString& cookie_name,
|
||||
CefRefPtr<CefDeleteCookiesCallback> callback,
|
||||
const CookieStoreGetter& cookie_store_getter) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
net::CookieStore* cookie_store = cookie_store_getter.Run();
|
||||
if (!cookie_store) {
|
||||
if (callback.get()) {
|
||||
CEF_POST_TASK(CEF_IOT, base::Bind(&CefDeleteCookiesCallback::OnComplete,
|
||||
callback.get(), 0));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (url.is_empty()) {
|
||||
// Delete all cookies.
|
||||
cookie_store->DeleteAllAsync(
|
||||
base::Bind(DeleteCookiesCallbackImpl, callback));
|
||||
} else if (cookie_name.empty()) {
|
||||
// Delete all matching host cookies.
|
||||
net::CookieDeletionInfo delete_info;
|
||||
delete_info.host = url.host();
|
||||
cookie_store->DeleteAllMatchingInfoAsync(
|
||||
delete_info, base::Bind(DeleteCookiesCallbackImpl, callback));
|
||||
} else {
|
||||
// Delete all matching host and domain cookies.
|
||||
net::CookieDeletionInfo delete_info;
|
||||
delete_info.url = url;
|
||||
delete_info.name = cookie_name;
|
||||
cookie_store->DeleteAllMatchingInfoAsync(
|
||||
delete_info, base::Bind(DeleteCookiesCallbackImpl, callback));
|
||||
}
|
||||
}
|
||||
|
||||
void CefCookieManagerImpl::FlushStoreInternal(
|
||||
CefRefPtr<CefCompletionCallback> callback,
|
||||
const CookieStoreGetter& cookie_store_getter) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
net::CookieStore* cookie_store = cookie_store_getter.Run();
|
||||
if (!cookie_store) {
|
||||
RunAsyncCompletionOnIOThread(callback);
|
||||
return;
|
||||
}
|
||||
|
||||
cookie_store->FlushStore(base::Bind(RunAsyncCompletionOnIOThread, callback));
|
||||
}
|
||||
|
||||
// CefCookieManager methods ----------------------------------------------------
|
||||
|
||||
// static
|
||||
CefRefPtr<CefCookieManager> CefCookieManager::GetGlobalManager(
|
||||
CefRefPtr<CefCompletionCallback> callback) {
|
||||
// Verify that the context is in a valid state.
|
||||
if (!CONTEXT_STATE_VALID()) {
|
||||
NOTREACHED() << "context not valid";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return CefRequestContext::GetGlobalContext()->GetDefaultCookieManager(
|
||||
callback);
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<CefCookieManager> CefCookieManager::GetBlockingManager() {
|
||||
return new CefCookieManagerImpl(true);
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<CefCookieManager> CefCookieManager::CreateManager(
|
||||
const CefString& path,
|
||||
bool persist_session_cookies,
|
||||
CefRefPtr<CefCompletionCallback> callback) {
|
||||
// Verify that the context is in a valid state.
|
||||
if (!CONTEXT_STATE_VALID()) {
|
||||
NOTREACHED() << "context not valid";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CefRefPtr<CefCookieManagerImpl> cookie_manager =
|
||||
new CefCookieManagerImpl(false);
|
||||
cookie_manager->Initialize(NULL, path, persist_session_cookies, callback);
|
||||
return cookie_manager.get();
|
||||
}
|
@@ -2,8 +2,8 @@
|
||||
// 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_NET_COOKIE_MANAGER_OLD_IMPL_H_
|
||||
#define CEF_LIBCEF_BROWSER_NET_COOKIE_MANAGER_OLD_IMPL_H_
|
||||
#ifndef CEF_LIBCEF_BROWSER_COOKIE_MANAGER_IMPL_H_
|
||||
#define CEF_LIBCEF_BROWSER_COOKIE_MANAGER_IMPL_H_
|
||||
|
||||
#include <set>
|
||||
|
||||
@@ -12,13 +12,16 @@
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "net/cookies/cookie_monster.h"
|
||||
|
||||
class CefCookieStoreOwnerSource;
|
||||
|
||||
// Implementation of the CefCookieManager interface.
|
||||
class CefCookieManagerOldImpl : public CefCookieManager {
|
||||
class CefCookieManagerImpl : public CefCookieManager {
|
||||
public:
|
||||
CefCookieManagerOldImpl();
|
||||
~CefCookieManagerOldImpl() override;
|
||||
explicit CefCookieManagerImpl(bool is_blocking);
|
||||
~CefCookieManagerImpl() override;
|
||||
|
||||
// Must be called immediately after this object is created when |is_blocking|
|
||||
// is false.
|
||||
@@ -43,7 +46,6 @@ class CefCookieManagerOldImpl : public CefCookieManager {
|
||||
|
||||
// CefCookieManager methods.
|
||||
void SetSupportedSchemes(const std::vector<CefString>& schemes,
|
||||
bool include_defaults,
|
||||
CefRefPtr<CefCompletionCallback> callback) override;
|
||||
bool VisitAllCookies(CefRefPtr<CefCookieVisitor> visitor) override;
|
||||
bool VisitUrlCookies(const CefString& url,
|
||||
@@ -55,33 +57,47 @@ class CefCookieManagerOldImpl : public CefCookieManager {
|
||||
bool DeleteCookies(const CefString& url,
|
||||
const CefString& cookie_name,
|
||||
CefRefPtr<CefDeleteCookiesCallback> callback) override;
|
||||
bool SetStoragePath(const CefString& path,
|
||||
bool persist_session_cookies,
|
||||
CefRefPtr<CefCompletionCallback> callback) override;
|
||||
bool FlushStore(CefRefPtr<CefCompletionCallback> callback) override;
|
||||
|
||||
// Set the schemes supported by |cookie_monster|.
|
||||
static bool GetCefCookie(const net::CanonicalCookie& cc, CefCookie& cookie);
|
||||
static bool GetCefCookie(const GURL& url,
|
||||
const std::string& cookie_line,
|
||||
CefCookie& cookie);
|
||||
|
||||
// Set the schemes supported by |cookie_monster|. Default schemes will always
|
||||
// be supported.
|
||||
static void SetCookieMonsterSchemes(net::CookieMonster* cookie_monster,
|
||||
const std::vector<std::string>& schemes,
|
||||
bool include_defaults);
|
||||
const std::vector<std::string>& schemes);
|
||||
|
||||
private:
|
||||
// Returns true if a context is or will be available.
|
||||
bool HasContext();
|
||||
|
||||
// Execute |method| on the IO thread once the request context is available.
|
||||
void RunMethodWithContext(
|
||||
const CefRequestContextImpl::RequestContextCallback& method);
|
||||
|
||||
void InitWithContext(
|
||||
CefRefPtr<CefCompletionCallback> callback,
|
||||
scoped_refptr<CefURLRequestContextGetter> request_context);
|
||||
scoped_refptr<CefURLRequestContextGetterImpl> request_context);
|
||||
void SetStoragePathWithContext(
|
||||
const CefString& path,
|
||||
bool persist_session_cookies,
|
||||
CefRefPtr<CefCompletionCallback> callback,
|
||||
scoped_refptr<CefURLRequestContextGetterImpl> request_context);
|
||||
void SetSupportedSchemesWithContext(
|
||||
const std::vector<std::string>& schemes,
|
||||
bool include_defaults,
|
||||
CefRefPtr<CefCompletionCallback> callback,
|
||||
scoped_refptr<CefURLRequestContextGetter> request_context);
|
||||
scoped_refptr<CefURLRequestContextGetterImpl> request_context);
|
||||
void GetCookieStoreWithContext(
|
||||
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
||||
const CookieStoreCallback& callback,
|
||||
scoped_refptr<CefURLRequestContextGetter> request_context);
|
||||
scoped_refptr<CefURLRequestContextGetterImpl> request_context);
|
||||
|
||||
void SetSupportedSchemesInternal(const std::vector<std::string>& schemes,
|
||||
bool include_defaults,
|
||||
CefRefPtr<CefCompletionCallback> callback);
|
||||
void VisitAllCookiesInternal(CefRefPtr<CefCookieVisitor> visitor,
|
||||
const CookieStoreGetter& cookie_store_getter);
|
||||
@@ -100,11 +116,20 @@ class CefCookieManagerOldImpl : public CefCookieManager {
|
||||
void FlushStoreInternal(CefRefPtr<CefCompletionCallback> callback,
|
||||
const CookieStoreGetter& cookie_store_getter);
|
||||
|
||||
// Context that owns the cookie monster.
|
||||
CefRefPtr<CefRequestContextImpl> request_context_;
|
||||
scoped_refptr<CefURLRequestContextGetter> request_context_impl_;
|
||||
// If true all cookies will be blocked.
|
||||
const bool is_blocking_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING_DELETE_ON_IOT(CefCookieManagerOldImpl);
|
||||
// Used for cookie monsters owned by the context.
|
||||
CefRefPtr<CefRequestContextImpl> request_context_;
|
||||
scoped_refptr<CefURLRequestContextGetterImpl> request_context_impl_;
|
||||
|
||||
// Used for cookie monsters owned by this object.
|
||||
std::unique_ptr<CefCookieStoreOwnerSource> cookie_source_;
|
||||
|
||||
// Must be the last member.
|
||||
base::WeakPtrFactory<CefCookieManagerImpl> weak_ptr_factory_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING_DELETE_ON_IOT(CefCookieManagerImpl);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_NET_COOKIE_MANAGER_OLD_IMPL_H_
|
||||
#endif // CEF_LIBCEF_BROWSER_COOKIE_MANAGER_IMPL_H_
|
@@ -199,5 +199,5 @@ void CefDevToolsFileManager::CallClientFunction(
|
||||
}
|
||||
javascript.append(");");
|
||||
browser_impl_->web_contents()->GetMainFrame()->ExecuteJavaScript(
|
||||
base::UTF8ToUTF16(javascript), base::NullCallback());
|
||||
base::UTF8ToUTF16(javascript));
|
||||
}
|
||||
|
@@ -11,9 +11,7 @@
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/devtools/devtools_manager_delegate.h"
|
||||
#include "libcef/browser/net/devtools_scheme_handler.h"
|
||||
#include "libcef/common/net_service/util.h"
|
||||
|
||||
#include "base/base64.h"
|
||||
#include "base/guid.h"
|
||||
#include "base/json/json_reader.h"
|
||||
#include "base/json/json_writer.h"
|
||||
@@ -30,16 +28,13 @@
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/browser_task_traits.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/file_url_loader.h"
|
||||
#include "content/public/browser/navigation_handle.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/shared_cors_origin_access_list.h"
|
||||
#include "content/public/browser/storage_partition.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/common/content_client.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "content/public/common/url_utils.h"
|
||||
#include "ipc/ipc_channel.h"
|
||||
#include "net/base/completion_once_callback.h"
|
||||
#include "net/base/io_buffer.h"
|
||||
@@ -48,8 +43,6 @@
|
||||
#include "net/traffic_annotation/network_traffic_annotation.h"
|
||||
#include "net/url_request/url_fetcher.h"
|
||||
#include "net/url_request/url_fetcher_response_writer.h"
|
||||
#include "services/network/public/cpp/simple_url_loader.h"
|
||||
#include "services/network/public/cpp/simple_url_loader_stream_consumer.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -115,87 +108,8 @@ static std::string GetFrontendURL() {
|
||||
scheme::kChromeDevToolsHost);
|
||||
}
|
||||
|
||||
std::unique_ptr<base::DictionaryValue> BuildObjectForResponse(
|
||||
const net::HttpResponseHeaders* rh) {
|
||||
auto response = std::make_unique<base::DictionaryValue>();
|
||||
response->SetInteger("statusCode", rh ? rh->response_code() : 200);
|
||||
|
||||
auto headers = std::make_unique<base::DictionaryValue>();
|
||||
size_t iterator = 0;
|
||||
std::string name;
|
||||
std::string value;
|
||||
// TODO(caseq): this probably needs to handle duplicate header names
|
||||
// correctly by folding them.
|
||||
while (rh && rh->EnumerateHeaderLines(&iterator, &name, &value))
|
||||
headers->SetString(name, value);
|
||||
|
||||
response->Set("headers", std::move(headers));
|
||||
return response;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
class CefDevToolsFrontend::NetworkResourceLoader
|
||||
: public network::SimpleURLLoaderStreamConsumer {
|
||||
public:
|
||||
NetworkResourceLoader(int stream_id,
|
||||
CefDevToolsFrontend* bindings,
|
||||
std::unique_ptr<network::SimpleURLLoader> loader,
|
||||
network::mojom::URLLoaderFactory* url_loader_factory,
|
||||
int request_id)
|
||||
: stream_id_(stream_id),
|
||||
bindings_(bindings),
|
||||
loader_(std::move(loader)),
|
||||
request_id_(request_id) {
|
||||
loader_->SetOnResponseStartedCallback(base::BindOnce(
|
||||
&NetworkResourceLoader::OnResponseStarted, base::Unretained(this)));
|
||||
loader_->DownloadAsStream(url_loader_factory, this);
|
||||
}
|
||||
|
||||
private:
|
||||
void OnResponseStarted(const GURL& final_url,
|
||||
const network::ResourceResponseHead& response_head) {
|
||||
response_headers_ = response_head.headers;
|
||||
}
|
||||
|
||||
void OnDataReceived(base::StringPiece chunk,
|
||||
base::OnceClosure resume) override {
|
||||
base::Value chunkValue;
|
||||
|
||||
bool encoded = !base::IsStringUTF8(chunk);
|
||||
if (encoded) {
|
||||
std::string encoded_string;
|
||||
base::Base64Encode(chunk, &encoded_string);
|
||||
chunkValue = base::Value(std::move(encoded_string));
|
||||
} else {
|
||||
chunkValue = base::Value(chunk);
|
||||
}
|
||||
base::Value id(stream_id_);
|
||||
base::Value encodedValue(encoded);
|
||||
|
||||
bindings_->CallClientFunction("DevToolsAPI.streamWrite", &id, &chunkValue,
|
||||
&encodedValue);
|
||||
std::move(resume).Run();
|
||||
}
|
||||
|
||||
void OnComplete(bool success) override {
|
||||
auto response = BuildObjectForResponse(response_headers_.get());
|
||||
bindings_->SendMessageAck(request_id_, response.get());
|
||||
|
||||
bindings_->loaders_.erase(bindings_->loaders_.find(this));
|
||||
}
|
||||
|
||||
void OnRetry(base::OnceClosure start_retry) override { NOTREACHED(); }
|
||||
|
||||
const int stream_id_;
|
||||
CefDevToolsFrontend* const bindings_;
|
||||
std::unique_ptr<network::SimpleURLLoader> loader_;
|
||||
int request_id_;
|
||||
scoped_refptr<net::HttpResponseHeaders> response_headers_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(NetworkResourceLoader);
|
||||
};
|
||||
|
||||
// This constant should be in sync with
|
||||
// the constant at devtools_ui_bindings.cc.
|
||||
const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4;
|
||||
@@ -351,8 +265,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
agent_host_->DispatchProtocolMessage(this, protocol_message);
|
||||
} else if (method == "loadCompleted") {
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
||||
base::ASCIIToUTF16("DevToolsAPI.setUseSoftMenu(true);"),
|
||||
base::NullCallback());
|
||||
base::ASCIIToUTF16("DevToolsAPI.setUseSoftMenu(true);"));
|
||||
} else if (method == "loadNetworkResource" && params->GetSize() == 3) {
|
||||
// TODO(pfeldman): handle some of the embedder messages in content.
|
||||
std::string url;
|
||||
@@ -396,62 +309,20 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
}
|
||||
}
|
||||
})");
|
||||
|
||||
if (net_service::IsEnabled()) {
|
||||
// Based on DevToolsUIBindings::LoadNetworkResource.
|
||||
auto resource_request = std::make_unique<network::ResourceRequest>();
|
||||
resource_request->url = gurl;
|
||||
// TODO(caseq): this preserves behavior of URLFetcher-based
|
||||
// implementation. We really need to pass proper first party origin from
|
||||
// the front-end.
|
||||
resource_request->site_for_cookies = gurl;
|
||||
resource_request->headers.AddHeadersFromString(headers);
|
||||
|
||||
std::unique_ptr<network::mojom::URLLoaderFactory> file_url_loader_factory;
|
||||
scoped_refptr<network::SharedURLLoaderFactory> network_url_loader_factory;
|
||||
std::unique_ptr<network::mojom::URLLoaderFactory>
|
||||
webui_url_loader_factory;
|
||||
network::mojom::URLLoaderFactory* url_loader_factory;
|
||||
if (gurl.SchemeIsFile()) {
|
||||
file_url_loader_factory = content::CreateFileURLLoaderFactory(
|
||||
base::FilePath() /* profile_path */,
|
||||
nullptr /* shared_cors_origin_access_list */);
|
||||
url_loader_factory = file_url_loader_factory.get();
|
||||
} else if (content::HasWebUIScheme(gurl)) {
|
||||
base::DictionaryValue response;
|
||||
response.SetInteger("statusCode", 403);
|
||||
SendMessageAck(request_id, &response);
|
||||
return;
|
||||
} else {
|
||||
auto* partition = content::BrowserContext::GetStoragePartitionForSite(
|
||||
web_contents()->GetBrowserContext(), gurl);
|
||||
network_url_loader_factory =
|
||||
partition->GetURLLoaderFactoryForBrowserProcess();
|
||||
url_loader_factory = network_url_loader_factory.get();
|
||||
}
|
||||
|
||||
auto simple_url_loader = network::SimpleURLLoader::Create(
|
||||
std::move(resource_request), traffic_annotation);
|
||||
auto resource_loader = std::make_unique<NetworkResourceLoader>(
|
||||
stream_id, this, std::move(simple_url_loader), url_loader_factory,
|
||||
request_id);
|
||||
loaders_.insert(std::move(resource_loader));
|
||||
} else {
|
||||
net::URLFetcher* fetcher =
|
||||
net::URLFetcher::Create(gurl, net::URLFetcher::GET, this,
|
||||
traffic_annotation)
|
||||
.release();
|
||||
pending_requests_[fetcher] = request_id;
|
||||
fetcher->SetRequestContext(
|
||||
content::BrowserContext::GetDefaultStoragePartition(
|
||||
web_contents()->GetBrowserContext())
|
||||
->GetURLRequestContext());
|
||||
fetcher->SetExtraRequestHeaders(headers);
|
||||
fetcher->SaveResponseWithWriter(
|
||||
std::unique_ptr<net::URLFetcherResponseWriter>(
|
||||
new ResponseWriter(weak_factory_.GetWeakPtr(), stream_id)));
|
||||
fetcher->Start();
|
||||
}
|
||||
net::URLFetcher* fetcher =
|
||||
net::URLFetcher::Create(gurl, net::URLFetcher::GET, this,
|
||||
traffic_annotation)
|
||||
.release();
|
||||
pending_requests_[fetcher] = request_id;
|
||||
fetcher->SetRequestContext(
|
||||
content::BrowserContext::GetDefaultStoragePartition(
|
||||
web_contents()->GetBrowserContext())
|
||||
->GetURLRequestContext());
|
||||
fetcher->SetExtraRequestHeaders(headers);
|
||||
fetcher->SaveResponseWithWriter(
|
||||
std::unique_ptr<net::URLFetcherResponseWriter>(
|
||||
new ResponseWriter(weak_factory_.GetWeakPtr(), stream_id)));
|
||||
fetcher->Start();
|
||||
return;
|
||||
} else if (method == "getPreferences") {
|
||||
SendMessageAck(request_id,
|
||||
@@ -473,8 +344,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
update.Get()->RemoveWithoutPathExpansion(name, nullptr);
|
||||
} else if (method == "requestFileSystems") {
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
||||
base::ASCIIToUTF16("DevToolsAPI.fileSystemsLoaded([]);"),
|
||||
base::NullCallback());
|
||||
base::ASCIIToUTF16("DevToolsAPI.fileSystemsLoaded([]);"));
|
||||
} else if (method == "reattach") {
|
||||
if (!agent_host_)
|
||||
return;
|
||||
@@ -518,8 +388,7 @@ void CefDevToolsFrontend::DispatchProtocolMessage(
|
||||
base::EscapeJSONString(message, true, ¶m);
|
||||
std::string code = "DevToolsAPI.dispatchMessage(" + param + ");";
|
||||
base::string16 javascript = base::UTF8ToUTF16(code);
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
||||
javascript, base::NullCallback());
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(javascript);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -531,14 +400,11 @@ void CefDevToolsFrontend::DispatchProtocolMessage(
|
||||
std::string code = "DevToolsAPI.dispatchMessageChunk(" + param + "," +
|
||||
std::to_string(pos ? 0 : total_size) + ");";
|
||||
base::string16 javascript = base::UTF8ToUTF16(code);
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
||||
javascript, base::NullCallback());
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(javascript);
|
||||
}
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::OnURLFetchComplete(const net::URLFetcher* source) {
|
||||
DCHECK(!net_service::IsEnabled());
|
||||
|
||||
// TODO(pfeldman): this is a copy of chrome's devtools_ui_bindings.cc.
|
||||
// We should handle some of the commands including this one in content.
|
||||
DCHECK(source);
|
||||
@@ -582,7 +448,7 @@ void CefDevToolsFrontend::CallClientFunction(const std::string& function_name,
|
||||
}
|
||||
javascript.append(");");
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
||||
base::UTF8ToUTF16(javascript), base::NullCallback());
|
||||
base::UTF8ToUTF16(javascript));
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::SendMessageAck(int request_id,
|
||||
|
@@ -90,14 +90,8 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
|
||||
scoped_refptr<content::DevToolsAgentHost> agent_host_;
|
||||
CefPoint inspect_element_at_;
|
||||
std::unique_ptr<content::DevToolsFrontendHost> frontend_host_;
|
||||
|
||||
using PendingRequestsMap = std::map<const net::URLFetcher*, int>;
|
||||
PendingRequestsMap pending_requests_;
|
||||
|
||||
class NetworkResourceLoader;
|
||||
std::set<std::unique_ptr<NetworkResourceLoader>, base::UniquePtrComparator>
|
||||
loaders_;
|
||||
|
||||
using ExtensionsAPIs = std::map<std::string, std::string>;
|
||||
ExtensionsAPIs extensions_api_;
|
||||
CefDevToolsFileManager file_manager_;
|
||||
|
@@ -5,7 +5,6 @@
|
||||
#include "libcef/browser/download_manager_delegate.h"
|
||||
|
||||
#include "include/cef_download_handler.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/download_item_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
@@ -15,7 +14,6 @@
|
||||
#include "base/path_service.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "chrome/common/chrome_constants.h"
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/download_item_utils.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
@@ -319,9 +317,13 @@ void CefDownloadManagerDelegate::OnDownloadDestroyed(DownloadItem* item) {
|
||||
|
||||
void CefDownloadManagerDelegate::OnDownloadCreated(DownloadManager* manager,
|
||||
DownloadItem* item) {
|
||||
// When NetworkService is enabled this callback may arrive after
|
||||
// DetermineDownloadTarget, so we allow association from either method.
|
||||
CefRefPtr<CefBrowserHostImpl> browser = GetOrAssociateBrowser(item);
|
||||
CefBrowserHostImpl* browser = nullptr;
|
||||
content::WebContents* contents =
|
||||
content::DownloadItemUtils::GetWebContents(item);
|
||||
if (contents) {
|
||||
browser = CefBrowserHostImpl::GetBrowserForContents(contents).get();
|
||||
DCHECK(browser);
|
||||
}
|
||||
if (!browser) {
|
||||
// If the download is rejected (e.g. ALT+click on an invalid protocol link)
|
||||
// then an "interrupted" download will be started via DownloadManagerImpl::
|
||||
@@ -334,7 +336,17 @@ void CefDownloadManagerDelegate::OnDownloadCreated(DownloadManager* manager,
|
||||
LOG(INFO) << "Rejected download of " << url_chain.back().spec();
|
||||
}
|
||||
item->Cancel(true);
|
||||
return;
|
||||
}
|
||||
|
||||
item->AddObserver(this);
|
||||
|
||||
item_browser_map_.insert(std::make_pair(item, browser));
|
||||
|
||||
// Register as an observer so that we can cancel associated DownloadItems when
|
||||
// the browser is destroyed.
|
||||
if (!browser->HasObserver(this))
|
||||
browser->AddObserver(this);
|
||||
}
|
||||
|
||||
void CefDownloadManagerDelegate::ManagerGoingDown(DownloadManager* manager) {
|
||||
@@ -356,9 +368,7 @@ bool CefDownloadManagerDelegate::DetermineDownloadTarget(
|
||||
return true;
|
||||
}
|
||||
|
||||
// When NetworkService is enabled this callback may arrive before
|
||||
// OnDownloadCreated, so we allow association from either method.
|
||||
CefRefPtr<CefBrowserHostImpl> browser = GetOrAssociateBrowser(item);
|
||||
CefRefPtr<CefBrowserHostImpl> browser = GetBrowser(item);
|
||||
CefRefPtr<CefDownloadHandler> handler;
|
||||
if (browser.get())
|
||||
handler = GetDownloadHandler(browser);
|
||||
@@ -389,16 +399,6 @@ void CefDownloadManagerDelegate::GetNextId(
|
||||
callback.Run(next_id++);
|
||||
}
|
||||
|
||||
std::string CefDownloadManagerDelegate::ApplicationClientIdForFileScanning()
|
||||
const {
|
||||
const CefSettings& settings = CefContext::Get()->settings();
|
||||
if (settings.application_client_id_for_file_scanning.length > 0) {
|
||||
return CefString(&settings.application_client_id_for_file_scanning)
|
||||
.ToString();
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
|
||||
void CefDownloadManagerDelegate::OnBrowserDestroyed(
|
||||
CefBrowserHostImpl* browser) {
|
||||
ItemBrowserMap::iterator it = item_browser_map_.begin();
|
||||
@@ -412,34 +412,6 @@ void CefDownloadManagerDelegate::OnBrowserDestroyed(
|
||||
}
|
||||
}
|
||||
|
||||
CefBrowserHostImpl* CefDownloadManagerDelegate::GetOrAssociateBrowser(
|
||||
download::DownloadItem* item) {
|
||||
ItemBrowserMap::const_iterator it = item_browser_map_.find(item);
|
||||
if (it != item_browser_map_.end())
|
||||
return it->second;
|
||||
|
||||
CefBrowserHostImpl* browser = nullptr;
|
||||
content::WebContents* contents =
|
||||
content::DownloadItemUtils::GetWebContents(item);
|
||||
if (contents) {
|
||||
browser = CefBrowserHostImpl::GetBrowserForContents(contents).get();
|
||||
DCHECK(browser);
|
||||
}
|
||||
if (!browser)
|
||||
return nullptr;
|
||||
|
||||
item->AddObserver(this);
|
||||
|
||||
item_browser_map_.insert(std::make_pair(item, browser));
|
||||
|
||||
// Register as an observer so that we can cancel associated DownloadItems when
|
||||
// the browser is destroyed.
|
||||
if (!browser->HasObserver(this))
|
||||
browser->AddObserver(this);
|
||||
|
||||
return browser;
|
||||
}
|
||||
|
||||
CefBrowserHostImpl* CefDownloadManagerDelegate::GetBrowser(DownloadItem* item) {
|
||||
ItemBrowserMap::const_iterator it = item_browser_map_.find(item);
|
||||
if (it != item_browser_map_.end())
|
||||
|
@@ -39,12 +39,10 @@ class CefDownloadManagerDelegate : public download::DownloadItem::Observer,
|
||||
download::DownloadItem* item,
|
||||
const content::DownloadTargetCallback& callback) override;
|
||||
void GetNextId(const content::DownloadIdCallback& callback) override;
|
||||
std::string ApplicationClientIdForFileScanning() const override;
|
||||
|
||||
// CefBrowserHostImpl::Observer methods.
|
||||
void OnBrowserDestroyed(CefBrowserHostImpl* browser) override;
|
||||
|
||||
CefBrowserHostImpl* GetOrAssociateBrowser(download::DownloadItem* item);
|
||||
CefBrowserHostImpl* GetBrowser(download::DownloadItem* item);
|
||||
|
||||
content::DownloadManager* manager_;
|
||||
|
@@ -144,9 +144,9 @@ bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage(std::string* error) {
|
||||
ExtensionApiFrameIdMap::GetRenderFrameHostById(browser->web_contents(),
|
||||
frame_id);
|
||||
if (!rfh) {
|
||||
*error = ErrorUtils::FormatErrorMessage(
|
||||
keys::kFrameNotFoundError, base::NumberToString(frame_id),
|
||||
base::NumberToString(execute_tab_id_));
|
||||
*error = ErrorUtils::FormatErrorMessage(keys::kFrameNotFoundError,
|
||||
base::IntToString(frame_id),
|
||||
base::IntToString(execute_tab_id_));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "libcef/browser/extensions/browser_extensions_util.h"
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/browser_context_impl.h"
|
||||
#include "libcef/browser/browser_info_manager.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
@@ -61,10 +61,9 @@ content::WebContents* GetOwnerForGuestContents(content::WebContents* guest) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> GetOwnerBrowserForFrameRoute(
|
||||
int render_process_id,
|
||||
int render_routing_id,
|
||||
bool* is_guest_view) {
|
||||
CefRefPtr<CefBrowserHostImpl> GetOwnerBrowserForFrame(int render_process_id,
|
||||
int render_routing_id,
|
||||
bool* is_guest_view) {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
// Use the non-thread-safe but potentially faster approach.
|
||||
content::RenderFrameHost* host =
|
||||
@@ -75,7 +74,7 @@ CefRefPtr<CefBrowserHostImpl> GetOwnerBrowserForFrameRoute(
|
||||
} else {
|
||||
// Use the thread-safe approach.
|
||||
scoped_refptr<CefBrowserInfo> info =
|
||||
CefBrowserInfoManager::GetInstance()->GetBrowserInfoForFrameRoute(
|
||||
CefBrowserInfoManager::GetInstance()->GetBrowserInfoForFrame(
|
||||
render_process_id, render_routing_id, is_guest_view);
|
||||
if (info.get()) {
|
||||
CefRefPtr<CefBrowserHostImpl> browser = info->browser();
|
||||
@@ -141,15 +140,16 @@ CefRefPtr<CefBrowserHostImpl> GetBrowserForTabId(
|
||||
if (tab_id < 0 || !browser_context)
|
||||
return nullptr;
|
||||
|
||||
CefBrowserContext* browser_context_impl =
|
||||
CefBrowserContext::GetForContext(browser_context);
|
||||
CefBrowserContextImpl* browser_context_impl =
|
||||
CefBrowserContextImpl::GetForContext(browser_context);
|
||||
|
||||
for (const auto& browser_info :
|
||||
CefBrowserInfoManager::GetInstance()->GetBrowserInfoList()) {
|
||||
CefBrowserInfoManager::BrowserInfoList list;
|
||||
CefBrowserInfoManager::GetInstance()->GetBrowserInfoList(list);
|
||||
for (auto browser_info : list) {
|
||||
CefRefPtr<CefBrowserHostImpl> current_browser = browser_info->browser();
|
||||
if (current_browser && current_browser->GetIdentifier() == tab_id) {
|
||||
// Make sure we're operating in the same BrowserContextImpl.
|
||||
if (CefBrowserContext::GetForContext(
|
||||
if (CefBrowserContextImpl::GetForContext(
|
||||
current_browser->GetBrowserContext()) == browser_context_impl) {
|
||||
return current_browser;
|
||||
} else {
|
||||
|
@@ -36,10 +36,9 @@ content::WebContents* GetOwnerForGuestContents(content::WebContents* guest);
|
||||
// routing IDs, if any. |is_guest_view| will be set to true if the IDs
|
||||
// match a guest view associated with the returned browser instead of the
|
||||
// browser itself.
|
||||
CefRefPtr<CefBrowserHostImpl> GetOwnerBrowserForFrameRoute(
|
||||
int render_process_id,
|
||||
int render_routing_id,
|
||||
bool* is_guest_view);
|
||||
CefRefPtr<CefBrowserHostImpl> GetOwnerBrowserForFrame(int render_process_id,
|
||||
int render_routing_id,
|
||||
bool* is_guest_view);
|
||||
|
||||
// Returns the CefBrowserHostImpl that owns the specified |host|, if any.
|
||||
// |is_guest_view| will be set to true if the host matches a guest view
|
||||
|
@@ -91,6 +91,11 @@ bool CefBrowserPlatformDelegateBackground::HandleKeyboardEvent(
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateBackground::HandleExternalProtocol(
|
||||
const GURL& url) {
|
||||
native_delegate_->HandleExternalProtocol(url);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateBackground::TranslateKeyEvent(
|
||||
content::NativeWebKeyboardEvent& result,
|
||||
const CefKeyEvent& key_event) const {
|
||||
|
@@ -34,6 +34,7 @@ class CefBrowserPlatformDelegateBackground
|
||||
void ViewText(const std::string& text) override;
|
||||
bool HandleKeyboardEvent(
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
void HandleExternalProtocol(const GURL& url) override;
|
||||
void TranslateKeyEvent(content::NativeWebKeyboardEvent& result,
|
||||
const CefKeyEvent& key_event) const override;
|
||||
void TranslateClickEvent(blink::WebMouseEvent& result,
|
||||
|
@@ -21,7 +21,7 @@ CefComponentExtensionResourceManager::~CefComponentExtensionResourceManager() {}
|
||||
bool CefComponentExtensionResourceManager::IsComponentExtensionResource(
|
||||
const base::FilePath& extension_path,
|
||||
const base::FilePath& resource_path,
|
||||
int* resource_id) const {
|
||||
ComponentExtensionResourceInfo* resource_info) const {
|
||||
base::FilePath directory_path = extension_path;
|
||||
base::FilePath resources_dir;
|
||||
base::FilePath relative_path;
|
||||
@@ -34,7 +34,7 @@ bool CefComponentExtensionResourceManager::IsComponentExtensionResource(
|
||||
|
||||
auto entry = path_to_resource_info_.find(relative_path);
|
||||
if (entry != path_to_resource_info_.end()) {
|
||||
*resource_id = entry->second;
|
||||
*resource_info = entry->second;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ CefComponentExtensionResourceManager::GetTemplateReplacementsForExtension(
|
||||
}
|
||||
|
||||
void CefComponentExtensionResourceManager::AddComponentResourceEntries(
|
||||
const GritResourceMap* entries,
|
||||
const GzippedGritResourceMap* entries,
|
||||
size_t size) {
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
base::FilePath resource_path =
|
||||
@@ -56,7 +56,8 @@ void CefComponentExtensionResourceManager::AddComponentResourceEntries(
|
||||
resource_path = resource_path.NormalizePathSeparators();
|
||||
|
||||
DCHECK(!base::ContainsKey(path_to_resource_info_, resource_path));
|
||||
path_to_resource_info_[resource_path] = entries[i].value;
|
||||
path_to_resource_info_[resource_path] = {entries[i].value,
|
||||
entries[i].gzipped};
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -10,7 +10,7 @@
|
||||
#include "base/files/file_path.h"
|
||||
#include "extensions/browser/component_extension_resource_manager.h"
|
||||
|
||||
struct GritResourceMap;
|
||||
struct GzippedGritResourceMap;
|
||||
|
||||
namespace extensions {
|
||||
|
||||
@@ -21,18 +21,21 @@ class CefComponentExtensionResourceManager
|
||||
~CefComponentExtensionResourceManager() override;
|
||||
|
||||
// Overridden from ComponentExtensionResourceManager:
|
||||
bool IsComponentExtensionResource(const base::FilePath& extension_path,
|
||||
const base::FilePath& resource_path,
|
||||
int* resource_id) const override;
|
||||
bool IsComponentExtensionResource(
|
||||
const base::FilePath& extension_path,
|
||||
const base::FilePath& resource_path,
|
||||
ComponentExtensionResourceInfo* resource_info) const override;
|
||||
const ui::TemplateReplacements* GetTemplateReplacementsForExtension(
|
||||
const std::string& extension_id) const override;
|
||||
|
||||
private:
|
||||
void AddComponentResourceEntries(const GritResourceMap* entries, size_t size);
|
||||
void AddComponentResourceEntries(const GzippedGritResourceMap* entries,
|
||||
size_t size);
|
||||
|
||||
// A map from a resource path to the resource ID. Used by
|
||||
// IsComponentExtensionResource.
|
||||
std::map<base::FilePath, int> path_to_resource_info_;
|
||||
std::map<base::FilePath, ComponentExtensionResourceInfo>
|
||||
path_to_resource_info_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefComponentExtensionResourceManager);
|
||||
};
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user