Compare commits

..

17 Commits
3809 ... 3578

Author SHA1 Message Date
Marshall Greenblatt
c974488bae Fix CVE-2019-5786: Use-after-free in FileReader (see https://crbug.com/936448) 2019-03-07 17:25:12 -05:00
Marshall Greenblatt
cc1dc0f59d Suppress ERROR messages with log-severity=disable (issue #2581)
Also expose FATAL severity level.
2019-01-29 14:58:31 -05:00
Arnaud Renevier
3d3f3c663e Fix uninitialized member CefNavigateParams::load_flags (issue #2580) 2019-01-29 14:56:57 -05:00
Marshall Greenblatt
0f6d65a690 Fix incorrect OSR IME suggestion background color (issue #2562) 2019-01-28 12:14:09 -05:00
Marshall Greenblatt
812136638e Fix CefResourceHandler leak in DownloadTest.Pending* 2019-01-23 14:57:08 +01:00
Chris Dziemborowicz
d150d19197 macOS: Create a CFRunLoop for video-capture and audio services (issue #2573) 2019-01-23 14:57:00 +01:00
Marshall Greenblatt
fa073f3d64 Fix Check failed: frame->IsMain() when loading Worker scripts (issue #2561) 2019-01-17 16:54:37 +01:00
Marshall Greenblatt
bf8cff263c Update to Chromium version 71.0.3578.98 2019-01-11 16:51:40 +01:00
Marshall Greenblatt
15f32b5d91 macOS: Export only CEF symbols from cef_sandbox.a (issue #2459) 2019-01-11 15:58:24 +01:00
Marshall Greenblatt
1992780b51 Update copyright year on generated files 2019-01-10 15:33:22 +01:00
Marshall Greenblatt
36610bd435 Update to Chromium version 71.0.3578.80 2018-12-11 15:03:50 -05:00
Marshall Greenblatt
3563564400 Windows: cefclient: Create a new D3D11 device for each browser (issue #2538)
This fixes a texture resizing issue when creating multiple windows with OSR
and shared textures enabled.
2018-11-15 15:45:18 -05:00
Marshall Greenblatt
8a72378a7c Windows: Add MS BuildTools support to msvs_env.bat (issue #2545) 2018-11-15 15:45:12 -05:00
Marshall Greenblatt
f54d47a71e Windows: Fix sandbox link error with binary distribution (issue #2546) 2018-11-13 13:45:57 -05:00
Marshall Greenblatt
cfd9e1e56e cefclient: Fix new window always on top (issue #1468) 2018-11-05 13:46:15 -05:00
Marshall Greenblatt
8f96ed2162 Fix incorrect quota size (issue #2452) 2018-10-26 15:46:49 -04:00
Marshall Greenblatt
063fc4f6cd Update to Chromium version 71.0.3578.20 2018-10-25 15:40:21 -04:00
1193 changed files with 24041 additions and 47907 deletions

2
.gitignore vendored
View File

@@ -46,6 +46,4 @@ Thumbs.db
/binary_distrib /binary_distrib
/docs /docs
# CEF generated files # CEF generated files
/include/cef_config.h
/include/cef_version.h /include/cef_version.h
.ccls-cache/

395
BUILD.gn
View File

@@ -100,12 +100,13 @@ import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/ui.gni") import("//build/config/ui.gni")
import("//cef/cef_repack_locales.gni") import("//cef/cef_repack_locales.gni")
import("//chrome/common/features.gni") import("//chrome/common/features.gni")
import("//content/public/app/mac_helpers.gni")
import("//extensions/buildflags/buildflags.gni") import("//extensions/buildflags/buildflags.gni")
import("//media/media_options.gni") import("//media/media_options.gni")
import("//mojo/public/tools/bindings/mojom.gni") import("//mojo/public/tools/bindings/mojom.gni")
import("//ppapi/buildflags/buildflags.gni") import("//ppapi/buildflags/buildflags.gni")
import("//printing/buildflags/buildflags.gni") import("//printing/buildflags/buildflags.gni")
import("//services/catalog/public/tools/catalog.gni")
import("//services/service_manager/public/service_manifest.gni")
import("//third_party/icu/config.gni") import("//third_party/icu/config.gni")
import("//third_party/widevine/cdm/widevine.gni") import("//third_party/widevine/cdm/widevine.gni")
import("//tools/grit/repack.gni") import("//tools/grit/repack.gni")
@@ -167,24 +168,55 @@ if (is_mac) {
# #
if (is_mac) { if (is_mac) {
cef_commit_number = exec_script(
"//cef/tools/commit_number.py",
[ rebase_path("//cef", root_build_dir) ],
"trim string", [])
cef_version_file = "//cef/VERSION.in"
# The tweak_info_plist.py script requires a version number with 4 parts. CEF # The tweak_info_plist.py script requires a version number with 4 parts. CEF
# uses a version number with 3 parts so just set the last part to 0. # uses a version number with 3 parts so just set the last part to 0.
cef_plist_version = exec_script( cef_plist_version = exec_script(
"//cef/tools/cef_version.py", [ "plist" ], "trim string", []) "//build/util/version.py",
[
"-f",
rebase_path(cef_version_file, root_build_dir),
"-f",
rebase_path(chrome_version_file, root_build_dir),
"-t",
"@CEF_MAJOR@.@BUILD@.${cef_commit_number}.0",
],
"trim string",
[ cef_version_file, chrome_version_file ])
# Need to be creative to match dylib version formatting requirements. # Need to be creative to match dylib version formatting requirements.
cef_dylib_version = exec_script( cef_dylib_version = exec_script(
"//cef/tools/cef_version.py", [ "dylib" ], "trim string", []) "//build/util/version.py",
[
"-f",
rebase_path(cef_version_file, root_build_dir),
"-f",
rebase_path(chrome_version_file, root_build_dir),
"-t",
"@CEF_MAJOR@${cef_commit_number}.@BUILD_HI@.@BUILD_LO@",
"-e",
"BUILD_HI=int(BUILD)/256",
"-e",
"BUILD_LO=int(BUILD)%256",
],
"trim string",
[ cef_version_file, chrome_version_file ])
} }
# Read file lists from gypi files. The gypi_to_gn.py script does not support # Read file lists from gypi files. The gypi_to_gn.py script does not support
# variable references so all required variables must be explicitly specified in # variable references so all required variables must be explicitly specified in
# the below configurations. # the below configurations.
gypi_paths = exec_script("//cef/tools/gypi_to_gn.py", gypi_paths = exec_script("//build/gypi_to_gn.py",
[ rebase_path("cef_paths.gypi") ], [ rebase_path("cef_paths.gypi") ],
"scope", "scope",
[ "cef_paths.gypi" ]) [ "cef_paths.gypi" ])
gypi_paths2 = exec_script("//cef/tools/gypi_to_gn.py", gypi_paths2 = exec_script("//build/gypi_to_gn.py",
[ rebase_path("cef_paths2.gypi") ], [ rebase_path("cef_paths2.gypi") ],
"scope", "scope",
[ "cef_paths2.gypi" ]) [ "cef_paths2.gypi" ])
@@ -197,13 +229,10 @@ gypi_paths2 = exec_script("//cef/tools/gypi_to_gn.py",
group("cef") { group("cef") {
testonly = true testonly = true
deps = [ deps = [
":cefclient",
":cefsimple", ":cefsimple",
":ceftests", ":ceftests",
] ]
if (!is_linux || use_x11) {
deps += [ ":cefclient" ]
}
} }
@@ -248,7 +277,7 @@ if (is_win) {
"//chrome/common:buildflags", "//chrome/common:buildflags",
"//ppapi/buildflags:buildflags", "//ppapi/buildflags:buildflags",
"//printing/buildflags:buildflags", "//printing/buildflags:buildflags",
"//ui/base:buildflags", "//ui/base:ui_features",
] ]
} }
} }
@@ -256,14 +285,14 @@ if (is_win) {
static_library("libcef_static") { static_library("libcef_static") {
sources = gypi_paths2.includes_common + sources = gypi_paths2.includes_common +
gypi_paths.autogen_cpp_includes + [ gypi_paths.autogen_cpp_includes + [
"libcef/browser/audio_mirror_destination.cc",
"libcef/browser/audio_mirror_destination.h",
"libcef/browser/audio_push_sink.cc",
"libcef/browser/audio_push_sink.h",
"libcef/browser/browser_context.cc", "libcef/browser/browser_context.cc",
"libcef/browser/browser_context.h", "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.cc",
"libcef/browser/browser_context_keyed_service_factories.h", "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.cc",
"libcef/browser/browser_host_impl.h", "libcef/browser/browser_host_impl.h",
"libcef/browser/browser_info.cc", "libcef/browser/browser_info.cc",
@@ -279,11 +308,12 @@ static_library("libcef_static") {
"libcef/browser/browser_platform_delegate.cc", "libcef/browser/browser_platform_delegate.cc",
"libcef/browser/browser_platform_delegate.h", "libcef/browser/browser_platform_delegate.h",
"libcef/browser/browser_platform_delegate_create.cc", "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.cc",
"libcef/browser/browser_util.h", "libcef/browser/browser_util.h",
"libcef/browser/chrome_browser_process_stub.cc", "libcef/browser/chrome_browser_process_stub.cc",
"libcef/browser/chrome_browser_process_stub.h", "libcef/browser/chrome_browser_process_stub.h",
"libcef/browser/chrome_crash_reporter_client_stub.cc",
"libcef/browser/chrome_profile_manager_stub.cc", "libcef/browser/chrome_profile_manager_stub.cc",
"libcef/browser/chrome_profile_manager_stub.h", "libcef/browser/chrome_profile_manager_stub.h",
"libcef/browser/chrome_profile_stub.cc", "libcef/browser/chrome_profile_stub.cc",
@@ -294,12 +324,12 @@ static_library("libcef_static") {
"libcef/browser/context.h", "libcef/browser/context.h",
"libcef/browser/context_menu_params_impl.cc", "libcef/browser/context_menu_params_impl.cc",
"libcef/browser/context_menu_params_impl.h", "libcef/browser/context_menu_params_impl.h",
"libcef/browser/devtools/devtools_file_manager.cc", "libcef/browser/cookie_manager_impl.cc",
"libcef/browser/devtools/devtools_file_manager.h", "libcef/browser/cookie_manager_impl.h",
"libcef/browser/devtools/devtools_frontend.cc", "libcef/browser/devtools_frontend.cc",
"libcef/browser/devtools/devtools_frontend.h", "libcef/browser/devtools_frontend.h",
"libcef/browser/devtools/devtools_manager_delegate.cc", "libcef/browser/devtools_manager_delegate.cc",
"libcef/browser/devtools/devtools_manager_delegate.h", "libcef/browser/devtools_manager_delegate.h",
"libcef/browser/download_item_impl.cc", "libcef/browser/download_item_impl.cc",
"libcef/browser/download_item_impl.h", "libcef/browser/download_item_impl.h",
"libcef/browser/download_manager_delegate.cc", "libcef/browser/download_manager_delegate.cc",
@@ -371,12 +401,12 @@ static_library("libcef_static") {
"libcef/browser/navigate_params.h", "libcef/browser/navigate_params.h",
"libcef/browser/navigation_entry_impl.cc", "libcef/browser/navigation_entry_impl.cc",
"libcef/browser/navigation_entry_impl.h", "libcef/browser/navigation_entry_impl.h",
"libcef/browser/net/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.cc",
"libcef/browser/net/chrome_scheme_handler.h", "libcef/browser/net/chrome_scheme_handler.h",
"libcef/browser/net/cookie_manager_old_impl.cc", "libcef/browser/net/cookie_store_proxy.cc",
"libcef/browser/net/cookie_manager_old_impl.h", "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/crlset_file_util_impl.cc",
"libcef/browser/net/devtools_scheme_handler.cc", "libcef/browser/net/devtools_scheme_handler.cc",
"libcef/browser/net/devtools_scheme_handler.h", "libcef/browser/net/devtools_scheme_handler.h",
@@ -394,52 +424,32 @@ static_library("libcef_static") {
"libcef/browser/net/source_stream.h", "libcef/browser/net/source_stream.h",
"libcef/browser/net/url_request_context.cc", "libcef/browser/net/url_request_context.cc",
"libcef/browser/net/url_request_context.h", "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.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.cc",
"libcef/browser/net/url_request_interceptor.h", "libcef/browser/net/url_request_interceptor.h",
"libcef/browser/net/url_request_manager.cc", "libcef/browser/net/url_request_manager.cc",
"libcef/browser/net/url_request_manager.h", "libcef/browser/net/url_request_manager.h",
"libcef/browser/net/url_request_user_data.cc", "libcef/browser/net/url_request_user_data.cc",
"libcef/browser/net/url_request_user_data.h", "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.cc",
"libcef/browser/origin_whitelist_impl.h", "libcef/browser/origin_whitelist_impl.h",
"libcef/browser/osr/browser_platform_delegate_osr.cc", "libcef/browser/osr/browser_platform_delegate_osr.cc",
"libcef/browser/osr/browser_platform_delegate_osr.h", "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", "libcef/browser/osr/osr_accessibility_util.cc",
"libcef/browser/osr/osr_accessibility_util.h", "libcef/browser/osr/osr_accessibility_util.h",
"libcef/browser/osr/osr_util.cc", "libcef/browser/osr/osr_util.cc",
"libcef/browser/osr/osr_util.h", "libcef/browser/osr/osr_util.h",
"libcef/browser/osr/render_widget_host_view_osr.cc", "libcef/browser/osr/render_widget_host_view_osr.cc",
"libcef/browser/osr/render_widget_host_view_osr.h", "libcef/browser/osr/render_widget_host_view_osr.h",
"libcef/browser/osr/synthetic_gesture_target_osr.cc", "libcef/browser/osr/software_output_device_osr.cc",
"libcef/browser/osr/synthetic_gesture_target_osr.h", "libcef/browser/osr/software_output_device_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.cc",
"libcef/browser/osr/web_contents_view_osr.h", "libcef/browser/osr/web_contents_view_osr.h",
"libcef/browser/path_util_impl.cc", "libcef/browser/path_util_impl.cc",
@@ -477,6 +487,8 @@ static_library("libcef_static") {
"libcef/browser/ssl_info_impl.h", "libcef/browser/ssl_info_impl.h",
"libcef/browser/ssl_status_impl.cc", "libcef/browser/ssl_status_impl.cc",
"libcef/browser/ssl_status_impl.h", "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.cc",
"libcef/browser/stream_impl.h", "libcef/browser/stream_impl.h",
"libcef/browser/trace_impl.cc", "libcef/browser/trace_impl.cc",
@@ -519,8 +531,6 @@ static_library("libcef_static") {
"libcef/common/extensions/extensions_util.cc", "libcef/common/extensions/extensions_util.cc",
"libcef/common/extensions/extensions_util.h", "libcef/common/extensions/extensions_util.h",
"libcef/common/file_util_impl.cc", "libcef/common/file_util_impl.cc",
"libcef/common/frame_util.cc",
"libcef/common/frame_util.h",
"libcef/common/json_impl.cc", "libcef/common/json_impl.cc",
"libcef/common/main_delegate.cc", "libcef/common/main_delegate.cc",
"libcef/common/main_delegate.h", "libcef/common/main_delegate.h",
@@ -534,10 +544,6 @@ static_library("libcef_static") {
"libcef/common/net/upload_data.h", "libcef/common/net/upload_data.h",
"libcef/common/net/upload_element.cc", "libcef/common/net/upload_element.cc",
"libcef/common/net/upload_element.h", "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/parser_impl.cc",
"libcef/common/process_message_impl.cc", "libcef/common/process_message_impl.cc",
"libcef/common/process_message_impl.h", "libcef/common/process_message_impl.h",
@@ -601,8 +607,6 @@ static_library("libcef_static") {
"libcef/renderer/render_urlrequest_impl.cc", "libcef/renderer/render_urlrequest_impl.cc",
"libcef/renderer/render_urlrequest_impl.h", "libcef/renderer/render_urlrequest_impl.h",
"libcef/renderer/thread_util.h", "libcef/renderer/thread_util.h",
"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.cc",
"libcef/renderer/v8_impl.h", "libcef/renderer/v8_impl.h",
"libcef/utility/content_utility_client.cc", "libcef/utility/content_utility_client.cc",
@@ -638,7 +642,6 @@ static_library("libcef_static") {
deps = [ deps = [
":cef_make_headers", ":cef_make_headers",
":cef_service_manifests",
# Generate API bindings for extensions. # Generate API bindings for extensions.
# TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See # TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
@@ -676,11 +679,11 @@ static_library("libcef_static") {
"//components/printing/browser", "//components/printing/browser",
"//components/printing/common", "//components/printing/common",
"//components/printing/renderer", "//components/printing/renderer",
"//components/proxy_config",
"//components/safe_browsing/db:test_database_manager", "//components/safe_browsing/db:test_database_manager",
"//components/services/pdf_compositor:pdf_compositor_manifest",
"//components/services/pdf_compositor/public/cpp:factory", "//components/services/pdf_compositor/public/cpp:factory",
"//components/services/pdf_compositor/public/interfaces", "//components/services/pdf_compositor/public/interfaces",
"//components/tracing", "//components/proxy_config",
"//components/update_client", "//components/update_client",
"//components/url_formatter", "//components/url_formatter",
"//components/user_prefs", "//components/user_prefs",
@@ -710,6 +713,7 @@ static_library("libcef_static") {
"//media", "//media",
"//media/blink", "//media/blink",
"//net", "//net",
"//net/dns:mojo_client",
"//net:net_with_v8", "//net:net_with_v8",
"//pdf", "//pdf",
"//ppapi/buildflags", "//ppapi/buildflags",
@@ -718,6 +722,7 @@ static_library("libcef_static") {
"//services/network/public/cpp", "//services/network/public/cpp",
"//services/service_manager/embedder", "//services/service_manager/embedder",
"//services/service_manager/public/cpp", "//services/service_manager/public/cpp",
"//services/service_manager/runner/common",
"//skia", "//skia",
"//storage/browser", "//storage/browser",
"//third_party/blink/public:blink", "//third_party/blink/public:blink",
@@ -770,7 +775,7 @@ static_library("libcef_static") {
deps += [ deps += [
"//chrome/install_static:secondary_module", "//chrome/install_static:secondary_module",
"//chrome/chrome_elf", "//chrome_elf",
] ]
if (is_component_build) { if (is_component_build) {
@@ -782,10 +787,6 @@ static_library("libcef_static") {
# For D3D11_DECODER_PROFILE_H264_VLD_NOFGT. # For D3D11_DECODER_PROFILE_H264_VLD_NOFGT.
"dxguid.lib", "dxguid.lib",
] ]
data_deps = [
"//chrome/elevation_service",
]
} }
if (is_linux) { if (is_linux) {
@@ -799,25 +800,14 @@ static_library("libcef_static") {
"libcef/browser/osr/render_widget_host_view_osr_linux.cc", "libcef/browser/osr/render_widget_host_view_osr_linux.cc",
"libcef/browser/printing/print_dialog_linux.cc", "libcef/browser/printing/print_dialog_linux.cc",
"libcef/browser/printing/print_dialog_linux.h", "libcef/browser/printing/print_dialog_linux.h",
]
if (use_x11) {
sources += [
"libcef/browser/native/window_x11.cc", "libcef/browser/native/window_x11.cc",
"libcef/browser/native/window_x11.h", "libcef/browser/native/window_x11.h",
] ]
}
deps += [ deps += [
"//build/config/freetype", "//build/config/freetype",
"//third_party/fontconfig", "//third_party/fontconfig",
] ]
if (is_linux && !use_x11) {
deps += [
"//third_party/angle:libEGL",
]
}
} }
if (is_mac) { if (is_mac) {
@@ -832,6 +822,7 @@ static_library("libcef_static") {
"libcef/browser/native/menu_runner_mac.mm", "libcef/browser/native/menu_runner_mac.mm",
"libcef/browser/osr/browser_platform_delegate_osr_mac.h", "libcef/browser/osr/browser_platform_delegate_osr_mac.h",
"libcef/browser/osr/browser_platform_delegate_osr_mac.mm", "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.h",
"libcef/common/util_mac.mm", "libcef/common/util_mac.mm",
] ]
@@ -934,15 +925,6 @@ static_library("libcef_static") {
"//ui/aura/test/ui_controls_factory_aura.h", "//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 += [ deps += [
"//ui/aura", "//ui/aura",
"//ui/events", "//ui/events",
@@ -980,24 +962,17 @@ static_library("libcef_static") {
# Part of //ui/aura:test_support which is testingonly. # Part of //ui/aura:test_support which is testingonly.
"//ui/aura/test/aura_test_utils.cc", "//ui/aura/test/aura_test_utils.cc",
"//ui/aura/test/aura_test_utils.h", "//ui/aura/test/aura_test_utils.h",
# Part of //ui/events:test_support which is testingonly.
"//ui/events/test/platform_event_waiter.cc",
"//ui/events/test/platform_event_waiter.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/ui_controls_factory_aurax11.cc",
"//ui/aura/test/x11_event_sender.cc", "//ui/aura/test/x11_event_sender.cc",
"//ui/aura/test/x11_event_sender.h", "//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. # 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.cc",
"//ui/views/test/ui_controls_factory_desktop_aurax11.h", "//ui/views/test/ui_controls_factory_desktop_aurax11.h",
] ]
} }
}
} else { } else {
sources += [ sources += [
# Provides stub implementations for the views static methods. # Provides stub implementations for the views static methods.
@@ -1067,142 +1042,45 @@ if (is_mac) {
} }
} }
# #
# Service manifests. # Service manifests.
# #
source_set("cef_content_browser_overlay_manifest") { cef_packaged_services = [
sources = [ "//chrome/app:chrome_manifest", # For spell checking.
"libcef/common/service_manifests/cef_content_browser_overlay_manifest.cc", "//chrome/app:chrome_renderer_manifest", # For spell checking.
"libcef/common/service_manifests/cef_content_browser_overlay_manifest.h", "//chrome/services/printing:manifest",
] "//services/metrics:manifest",
"//services/proxy_resolver:proxy_resolver_manifest",
]
configs += [ service_manifest("cef_packaged_services_manifest_overlay") {
"libcef/features:config" source = "libcef/common/service_manifests/packaged_services_manifest_overlay.json"
] packaged_services = cef_packaged_services
}
service_manifest("cef_browser_manifest_overlay") {
source = "libcef/common/service_manifests/browser_manifest_overlay.json"
}
service_manifest("cef_renderer_manifest_overlay") {
source = "libcef/common/service_manifests/renderer_manifest_overlay.json"
}
service_manifest("cef_utility_manifest_overlay") {
source = "libcef/common/service_manifests/utility_manifest_overlay.json"
}
group("cef_manifest_overlays") {
deps = [ deps = [
"//base", ":cef_packaged_services_manifest_overlay",
"//components/services/heap_profiling/public/mojom", ":cef_browser_manifest_overlay",
"//extensions/buildflags", ":cef_renderer_manifest_overlay",
"//extensions/common:mojo", ":cef_utility_manifest_overlay",
"//extensions/common/api:mojom",
"//services/service_manager/public/cpp",
"//third_party/blink/public/common",
] ]
} }
source_set("cef_content_gpu_overlay_manifest") {
sources = [
"libcef/common/service_manifests/cef_content_gpu_overlay_manifest.cc",
"libcef/common/service_manifests/cef_content_gpu_overlay_manifest.h",
]
configs += [
"libcef/features:config"
]
deps = [
"//base",
"//components/services/heap_profiling/public/mojom",
"//services/service_manager/public/cpp",
]
}
source_set("cef_content_renderer_overlay_manifest") {
sources = [
"libcef/common/service_manifests/cef_content_renderer_overlay_manifest.cc",
"libcef/common/service_manifests/cef_content_renderer_overlay_manifest.h",
]
configs += [
"libcef/features:config"
]
deps = [
"//base",
"//components/services/heap_profiling/public/mojom",
"//components/subresource_filter/content/mojom",
"//extensions/buildflags",
"//extensions/common:mojo",
"//services/service_manager/public/cpp",
"//third_party/blink/public/common",
]
if (is_mac) {
deps += [ "//components/spellcheck/common:interfaces" ]
}
}
source_set("cef_content_utility_overlay_manifest") {
sources = [
"libcef/common/service_manifests/cef_content_utility_overlay_manifest.cc",
"libcef/common/service_manifests/cef_content_utility_overlay_manifest.h",
]
configs += [
"libcef/features:config"
]
deps = [
"//base",
"//components/services/heap_profiling/public/mojom",
"//services/service_manager/public/cpp",
]
}
source_set("builtin_service_manifests") {
sources = [
"libcef/common/service_manifests/builtin_service_manifests.cc",
"libcef/common/service_manifests/builtin_service_manifests.h",
]
configs += [
"libcef/features:config"
]
deps = [
"//base",
"//chrome/common:mojo_bindings",
"//chrome/services/printing/public/cpp:manifest",
"//components/services/pdf_compositor/public/cpp:manifest",
"//components/spellcheck/common:interfaces",
"//components/startup_metric_utils/common:interfaces",
"//extensions/buildflags",
"//printing/buildflags",
"//services/proxy_resolver/public/cpp:manifest",
"//services/service_manager/public/cpp",
]
}
source_set("cef_renderer_manifest") {
sources = [
"libcef/common/service_manifests/cef_renderer_manifest.cc",
"libcef/common/service_manifests/cef_renderer_manifest.h",
]
configs += [
"libcef/features:config"
]
deps = [
"//base",
"//chrome/common:mojo_bindings",
"//components/spellcheck/common:interfaces",
"//services/service_manager/public/cpp",
]
}
source_set("cef_service_manifests") {
public_deps = [
":cef_content_browser_overlay_manifest",
":cef_content_gpu_overlay_manifest",
":cef_content_renderer_overlay_manifest",
":cef_content_utility_overlay_manifest",
":builtin_service_manifests",
":cef_renderer_manifest",
]
}
# #
# Resource grit/pack targets. # Resource grit/pack targets.
@@ -1348,6 +1226,7 @@ grit("cef_resources") {
"-E", "-E",
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
] ]
deps = [ ":cef_manifest_overlays" ]
} }
# Generate cef.pak. # Generate cef.pak.
@@ -1704,21 +1583,12 @@ if (is_mac) {
] ]
} }
template("cef_helper_app") { mac_app_bundle("${app_name}_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))
testonly = app_testonly testonly = app_testonly
output_name = app_helper_name + invoker.helper_name_suffix output_name = app_helper_name
sources = invoker.helper_sources sources = invoker.helper_sources
extra_substitutions = [
"BUNDLE_ID_SUFFIX=${invoker.helper_bundle_id_suffix}",
]
deps = [ deps = [
":cef_make_headers", ":cef_make_headers",
":cef_sandbox", ":cef_sandbox",
@@ -1741,43 +1611,19 @@ if (is_mac) {
defines = invoker.helper_defines defines = invoker.helper_defines
} }
} }
}
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
}
helper_name_suffix = _helper_suffix
helper_bundle_id_suffix = _helper_bundle_id
}
}
bundle_data("${app_name}_framework_bundle_data") { bundle_data("${app_name}_framework_bundle_data") {
testonly = app_testonly testonly = app_testonly
sources = [ sources = [
"$root_out_dir/$cef_framework_name.framework", "$root_out_dir/$cef_framework_name.framework",
"$root_out_dir/$app_helper_name.app",
] ]
public_deps = [ public_deps = [
":cef_framework", ":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 = [ outputs = [
"{{bundle_contents_dir}}/Frameworks/{{source_file_part}}", "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}",
] ]
@@ -2041,19 +1887,12 @@ if (is_mac) {
# The cefclient target depends on packages that are not available in the # The cefclient target depends on packages that are not available in the
# default sysroot environment. # default sysroot environment.
if (is_linux && !use_sysroot) { if (is_linux && !use_sysroot) {
pkg_config("glib") {
packages = [
"glib-2.0",
]
}
pkg_config("gtk") { pkg_config("gtk") {
packages = [ packages = [
"gmodule-2.0", "gmodule-2.0",
"gtk+-2.0", "gtk+-2.0",
"gthread-2.0", "gthread-2.0",
"gtk+-unix-print-2.0", "gtk+-unix-print-2.0",
"xi",
] ]
} }
@@ -2150,13 +1989,7 @@ if (is_mac) {
] ]
} }
if (is_component_build) { if (!is_component_build) {
if (use_allocator=="tcmalloc") {
# Link to base to initialize tcmalloc allocator shims, otherwise
# base::allocator::IsAllocatorInitialized check fails
deps += [ "//base" ]
}
} else {
# Set rpath to find our own libfreetype even in a non-component build. # Set rpath to find our own libfreetype even in a non-component build.
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ] configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
} }
@@ -2206,11 +2039,9 @@ if (is_mac) {
sources += gypi_paths2.includes_linux + sources += gypi_paths2.includes_linux +
gypi_paths2.cefsimple_sources_linux gypi_paths2.cefsimple_sources_linux
if (use_x11) {
libs = [ libs = [
"X11", "X11",
] ]
}
if (!is_component_build) { if (!is_component_build) {
# Set rpath to find our own libfreetype even in a non-component build. # Set rpath to find our own libfreetype even in a non-component build.
@@ -2267,15 +2098,9 @@ if (is_mac) {
sources += gypi_paths2.shared_sources_linux + sources += gypi_paths2.shared_sources_linux +
gypi_paths2.ceftests_sources_linux gypi_paths2.ceftests_sources_linux
if (use_x11) {
libs = [ libs = [
"X11", "X11",
] ]
} else {
if (!use_sysroot) {
configs += [ ":glib" ]
}
}
deps += [ deps += [
":copy_ceftests_files", ":copy_ceftests_files",

View File

@@ -7,5 +7,5 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding # https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{ {
'chromium_checkout': 'refs/tags/76.0.3809.132' 'chromium_checkout': 'refs/tags/71.0.3578.98',
} }

View File

@@ -27,8 +27,6 @@
# Files in the chromium/src directory that should be evaluated for changes. # Files in the chromium/src directory that should be evaluated for changes.
# Similar changes may need to be applied to the CEF source code. # Similar changes may need to be applied to the CEF source code.
'files': [ 'files': [
'chrome/app/chrome_*_manifest.*',
'chrome/app/chrome_*_manifests.*',
'chrome/browser/browser_process.h', 'chrome/browser/browser_process.h',
'chrome/browser/extensions/api/tabs/tabs_api.*', 'chrome/browser/extensions/api/tabs/tabs_api.*',
'chrome/browser/extensions/chrome_component_extension_resource_manager.*', 'chrome/browser/extensions/chrome_component_extension_resource_manager.*',
@@ -61,5 +59,15 @@
], ],
# Patterns that should not be found in the chromium/src directory after # Patterns that should not be found in the chromium/src directory after
# applying patch files. # 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.',
},
],
} }

View File

@@ -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. # 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. # TODO: Change these lines to match your project target when you copy this file.
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests") if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
add_subdirectory(tests/cefclient)
add_subdirectory(tests/cefsimple) add_subdirectory(tests/cefsimple)
add_subdirectory(tests/gtest) add_subdirectory(tests/gtest)
add_subdirectory(tests/ceftests) add_subdirectory(tests/ceftests)
endif() endif()
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests/cefclient")
add_subdirectory(tests/cefclient)
endif()
# Display configuration settings. # Display configuration settings.
PRINT_CEF_CONFIG() PRINT_CEF_CONFIG()

View File

@@ -7,7 +7,6 @@ The Chromium Embedded Framework (CEF) is a simple framework for embedding Chromi
* General Usage - https://bitbucket.org/chromiumembedded/cef/wiki/GeneralUsage * General Usage - https://bitbucket.org/chromiumembedded/cef/wiki/GeneralUsage
* Master Build Quick-Start - https://bitbucket.org/chromiumembedded/cef/wiki/MasterBuildQuickStart * Master Build Quick-Start - https://bitbucket.org/chromiumembedded/cef/wiki/MasterBuildQuickStart
* Branches and Building - https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding * Branches and Building - https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
* Announcements - https://groups.google.com/forum/#!forum/cef-announce
* Support Forum - http://www.magpcss.org/ceforum/ * Support Forum - http://www.magpcss.org/ceforum/
* CEF1 C++ API Docs - http://magpcss.org/ceforum/apidocs/ * CEF1 C++ API Docs - http://magpcss.org/ceforum/apidocs/
* CEF3 C++ API Docs - http://magpcss.org/ceforum/apidocs3/ * CEF3 C++ API Docs - http://magpcss.org/ceforum/apidocs3/
@@ -50,7 +49,6 @@ The base CEF framework includes support for the C and C++ programming languages.
* Delphi (CEF1) - http://code.google.com/p/delphichromiumembedded/ * Delphi (CEF1) - http://code.google.com/p/delphichromiumembedded/
* Delphi (CEF3) - https://github.com/hgourvest/dcef3 * Delphi (CEF3) - https://github.com/hgourvest/dcef3
* Delphi (CEF3) - https://github.com/salvadordf/CEF4Delphi * Delphi (CEF3) - https://github.com/salvadordf/CEF4Delphi
* Go - https://github.com/richardwilkes/cef
* Go - https://github.com/CzarekTomczak/cef2go * Go - https://github.com/CzarekTomczak/cef2go
* Java - https://bitbucket.org/chromiumembedded/java-cef * Java - https://bitbucket.org/chromiumembedded/java-cef
* Java - http://code.google.com/p/javacef/ * Java - http://code.google.com/p/javacef/

View File

@@ -8,7 +8,7 @@
# by hand. See the translator.README.txt file in the tools directory for # by hand. See the translator.README.txt file in the tools directory for
# more information. # more information.
# #
# $hash=a8e80ae73a0d30776c2e6aaceaf9dbd4031f6c74$ # $hash=ebb10ec8232ea37044d01a4522248b5055f5c1fc$
# #
{ {
@@ -16,7 +16,6 @@
'autogen_cpp_includes': [ 'autogen_cpp_includes': [
'include/cef_accessibility_handler.h', 'include/cef_accessibility_handler.h',
'include/cef_app.h', 'include/cef_app.h',
'include/cef_audio_handler.h',
'include/cef_auth_callback.h', 'include/cef_auth_callback.h',
'include/cef_browser.h', 'include/cef_browser.h',
'include/cef_browser_process_handler.h', 'include/cef_browser_process_handler.h',
@@ -57,14 +56,12 @@
'include/cef_render_handler.h', 'include/cef_render_handler.h',
'include/cef_render_process_handler.h', 'include/cef_render_process_handler.h',
'include/cef_request.h', 'include/cef_request.h',
'include/cef_request_callback.h',
'include/cef_request_context.h', 'include/cef_request_context.h',
'include/cef_request_context_handler.h', 'include/cef_request_context_handler.h',
'include/cef_request_handler.h', 'include/cef_request_handler.h',
'include/cef_resource_bundle.h', 'include/cef_resource_bundle.h',
'include/cef_resource_bundle_handler.h', 'include/cef_resource_bundle_handler.h',
'include/cef_resource_handler.h', 'include/cef_resource_handler.h',
'include/cef_resource_request_handler.h',
'include/cef_response.h', 'include/cef_response.h',
'include/cef_response_filter.h', 'include/cef_response_filter.h',
'include/cef_scheme.h', 'include/cef_scheme.h',
@@ -110,7 +107,6 @@
'autogen_capi_includes': [ 'autogen_capi_includes': [
'include/capi/cef_accessibility_handler_capi.h', 'include/capi/cef_accessibility_handler_capi.h',
'include/capi/cef_app_capi.h', 'include/capi/cef_app_capi.h',
'include/capi/cef_audio_handler_capi.h',
'include/capi/cef_auth_callback_capi.h', 'include/capi/cef_auth_callback_capi.h',
'include/capi/cef_browser_capi.h', 'include/capi/cef_browser_capi.h',
'include/capi/cef_browser_process_handler_capi.h', 'include/capi/cef_browser_process_handler_capi.h',
@@ -151,14 +147,12 @@
'include/capi/cef_render_handler_capi.h', 'include/capi/cef_render_handler_capi.h',
'include/capi/cef_render_process_handler_capi.h', 'include/capi/cef_render_process_handler_capi.h',
'include/capi/cef_request_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_capi.h',
'include/capi/cef_request_context_handler_capi.h', 'include/capi/cef_request_context_handler_capi.h',
'include/capi/cef_request_handler_capi.h', 'include/capi/cef_request_handler_capi.h',
'include/capi/cef_resource_bundle_capi.h', 'include/capi/cef_resource_bundle_capi.h',
'include/capi/cef_resource_bundle_handler_capi.h', 'include/capi/cef_resource_bundle_handler_capi.h',
'include/capi/cef_resource_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_capi.h',
'include/capi/cef_response_filter_capi.h', 'include/capi/cef_response_filter_capi.h',
'include/capi/cef_scheme_capi.h', 'include/capi/cef_scheme_capi.h',
@@ -206,8 +200,6 @@
'libcef_dll/ctocpp/accessibility_handler_ctocpp.h', 'libcef_dll/ctocpp/accessibility_handler_ctocpp.h',
'libcef_dll/ctocpp/app_ctocpp.cc', 'libcef_dll/ctocpp/app_ctocpp.cc',
'libcef_dll/ctocpp/app_ctocpp.h', 'libcef_dll/ctocpp/app_ctocpp.h',
'libcef_dll/ctocpp/audio_handler_ctocpp.cc',
'libcef_dll/ctocpp/audio_handler_ctocpp.h',
'libcef_dll/cpptoc/auth_callback_cpptoc.cc', 'libcef_dll/cpptoc/auth_callback_cpptoc.cc',
'libcef_dll/cpptoc/auth_callback_cpptoc.h', 'libcef_dll/cpptoc/auth_callback_cpptoc.h',
'libcef_dll/cpptoc/before_download_callback_cpptoc.cc', 'libcef_dll/cpptoc/before_download_callback_cpptoc.cc',
@@ -242,8 +234,6 @@
'libcef_dll/ctocpp/context_menu_handler_ctocpp.h', 'libcef_dll/ctocpp/context_menu_handler_ctocpp.h',
'libcef_dll/cpptoc/context_menu_params_cpptoc.cc', 'libcef_dll/cpptoc/context_menu_params_cpptoc.cc',
'libcef_dll/cpptoc/context_menu_params_cpptoc.h', '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.cc',
'libcef_dll/cpptoc/cookie_manager_cpptoc.h', 'libcef_dll/cpptoc/cookie_manager_cpptoc.h',
'libcef_dll/ctocpp/cookie_visitor_ctocpp.cc', 'libcef_dll/ctocpp/cookie_visitor_ctocpp.cc',
@@ -372,12 +362,6 @@
'libcef_dll/ctocpp/resource_bundle_handler_ctocpp.h', 'libcef_dll/ctocpp/resource_bundle_handler_ctocpp.h',
'libcef_dll/ctocpp/resource_handler_ctocpp.cc', 'libcef_dll/ctocpp/resource_handler_ctocpp.cc',
'libcef_dll/ctocpp/resource_handler_ctocpp.h', '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.cc',
'libcef_dll/cpptoc/response_cpptoc.h', 'libcef_dll/cpptoc/response_cpptoc.h',
'libcef_dll/ctocpp/response_filter_ctocpp.cc', 'libcef_dll/ctocpp/response_filter_ctocpp.cc',
@@ -498,8 +482,6 @@
'libcef_dll/cpptoc/accessibility_handler_cpptoc.h', 'libcef_dll/cpptoc/accessibility_handler_cpptoc.h',
'libcef_dll/cpptoc/app_cpptoc.cc', 'libcef_dll/cpptoc/app_cpptoc.cc',
'libcef_dll/cpptoc/app_cpptoc.h', 'libcef_dll/cpptoc/app_cpptoc.h',
'libcef_dll/cpptoc/audio_handler_cpptoc.cc',
'libcef_dll/cpptoc/audio_handler_cpptoc.h',
'libcef_dll/ctocpp/auth_callback_ctocpp.cc', 'libcef_dll/ctocpp/auth_callback_ctocpp.cc',
'libcef_dll/ctocpp/auth_callback_ctocpp.h', 'libcef_dll/ctocpp/auth_callback_ctocpp.h',
'libcef_dll/ctocpp/before_download_callback_ctocpp.cc', 'libcef_dll/ctocpp/before_download_callback_ctocpp.cc',
@@ -534,8 +516,6 @@
'libcef_dll/cpptoc/context_menu_handler_cpptoc.h', 'libcef_dll/cpptoc/context_menu_handler_cpptoc.h',
'libcef_dll/ctocpp/context_menu_params_ctocpp.cc', 'libcef_dll/ctocpp/context_menu_params_ctocpp.cc',
'libcef_dll/ctocpp/context_menu_params_ctocpp.h', '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.cc',
'libcef_dll/ctocpp/cookie_manager_ctocpp.h', 'libcef_dll/ctocpp/cookie_manager_ctocpp.h',
'libcef_dll/cpptoc/cookie_visitor_cpptoc.cc', 'libcef_dll/cpptoc/cookie_visitor_cpptoc.cc',
@@ -664,12 +644,6 @@
'libcef_dll/cpptoc/resource_bundle_handler_cpptoc.h', 'libcef_dll/cpptoc/resource_bundle_handler_cpptoc.h',
'libcef_dll/cpptoc/resource_handler_cpptoc.cc', 'libcef_dll/cpptoc/resource_handler_cpptoc.cc',
'libcef_dll/cpptoc/resource_handler_cpptoc.h', '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.cc',
'libcef_dll/ctocpp/response_ctocpp.h', 'libcef_dll/ctocpp/response_ctocpp.h',
'libcef_dll/cpptoc/response_filter_cpptoc.cc', 'libcef_dll/cpptoc/response_filter_cpptoc.cc',

View File

@@ -34,9 +34,7 @@
'include/base/internal/cef_lock_impl.h', 'include/base/internal/cef_lock_impl.h',
'include/base/internal/cef_raw_scoped_refptr_mismatch_checker.h', 'include/base/internal/cef_raw_scoped_refptr_mismatch_checker.h',
'include/base/internal/cef_thread_checker_impl.h', 'include/base/internal/cef_thread_checker_impl.h',
'include/cef_api_hash.h',
'include/cef_base.h', 'include/cef_base.h',
'include/cef_config.h',
'include/cef_version.h', 'include/cef_version.h',
'include/internal/cef_export.h', 'include/internal/cef_export.h',
'include/internal/cef_logging_internal.h', 'include/internal/cef_logging_internal.h',
@@ -88,7 +86,6 @@
'includes_linux': [ 'includes_linux': [
'include/base/internal/cef_atomicops_atomicword_compat.h', 'include/base/internal/cef_atomicops_atomicword_compat.h',
'include/base/internal/cef_atomicops_arm_gcc.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/base/internal/cef_atomicops_x86_gcc.h',
'include/internal/cef_linux.h', 'include/internal/cef_linux.h',
'include/internal/cef_types_linux.h', 'include/internal/cef_types_linux.h',
@@ -106,8 +103,6 @@
'libcef_dll/libcef_dll2.cc', 'libcef_dll/libcef_dll2.cc',
'libcef_dll/ptr_util.h', 'libcef_dll/ptr_util.h',
'libcef_dll/resource.h', 'libcef_dll/resource.h',
'libcef_dll/shutdown_checker.cc',
'libcef_dll/shutdown_checker.h',
'libcef_dll/transfer_util.cc', 'libcef_dll/transfer_util.cc',
'libcef_dll/transfer_util.h', 'libcef_dll/transfer_util.h',
'libcef_dll/wrapper_types.h', 'libcef_dll/wrapper_types.h',
@@ -135,8 +130,6 @@
'libcef_dll/ctocpp/ctocpp_ref_counted.h', 'libcef_dll/ctocpp/ctocpp_ref_counted.h',
'libcef_dll/ctocpp/ctocpp_scoped.h', 'libcef_dll/ctocpp/ctocpp_scoped.h',
'libcef_dll/ptr_util.h', 'libcef_dll/ptr_util.h',
'libcef_dll/shutdown_checker.cc',
'libcef_dll/shutdown_checker.h',
'libcef_dll/transfer_util.cc', 'libcef_dll/transfer_util.cc',
'libcef_dll/transfer_util.h', 'libcef_dll/transfer_util.h',
'libcef_dll/wrapper_types.h', 'libcef_dll/wrapper_types.h',
@@ -450,7 +443,6 @@
'tests/cefsimple/simple_handler_linux.cc', 'tests/cefsimple/simple_handler_linux.cc',
], ],
'ceftests_sources_common': [ 'ceftests_sources_common': [
'tests/ceftests/audio_output_unittest.cc',
'tests/ceftests/browser_info_map_unittest.cc', 'tests/ceftests/browser_info_map_unittest.cc',
'tests/ceftests/command_line_unittest.cc', 'tests/ceftests/command_line_unittest.cc',
'tests/ceftests/cookie_unittest.cc', 'tests/ceftests/cookie_unittest.cc',
@@ -488,7 +480,6 @@
'tests/ceftests/request_unittest.cc', 'tests/ceftests/request_unittest.cc',
'tests/ceftests/resource.h', 'tests/ceftests/resource.h',
'tests/ceftests/resource_manager_unittest.cc', 'tests/ceftests/resource_manager_unittest.cc',
'tests/ceftests/resource_request_handler_unittest.cc',
'tests/ceftests/routing_test_handler.cc', 'tests/ceftests/routing_test_handler.cc',
'tests/ceftests/routing_test_handler.h', 'tests/ceftests/routing_test_handler.h',
'tests/ceftests/run_all_unittests.cc', 'tests/ceftests/run_all_unittests.cc',
@@ -547,7 +538,6 @@
'tests/shared/browser/resource_util.h', 'tests/shared/browser/resource_util.h',
'tests/shared/browser/resource_util_mac.mm', 'tests/shared/browser/resource_util_mac.mm',
'tests/shared/browser/resource_util_posix.cc', 'tests/shared/browser/resource_util_posix.cc',
'tests/ceftests/audio_output_unittest.cc',
'tests/ceftests/client_app_delegates.cc', 'tests/ceftests/client_app_delegates.cc',
'tests/ceftests/cookie_unittest.cc', 'tests/ceftests/cookie_unittest.cc',
'tests/ceftests/dom_unittest.cc', 'tests/ceftests/dom_unittest.cc',
@@ -559,7 +549,6 @@
'tests/ceftests/process_message_unittest.cc', 'tests/ceftests/process_message_unittest.cc',
'tests/ceftests/request_handler_unittest.cc', 'tests/ceftests/request_handler_unittest.cc',
'tests/ceftests/request_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.cc',
'tests/ceftests/routing_test_handler.h', 'tests/ceftests/routing_test_handler.h',
'tests/ceftests/scheme_handler_unittest.cc', 'tests/ceftests/scheme_handler_unittest.cc',

View File

@@ -141,13 +141,6 @@ if(OS_LINUX)
include(CheckCCompilerFlag) include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG(-Wno-undefined-var-template COMPILER_SUPPORTS_NO_UNDEFINED_VAR_TEMPLATE)
if(COMPILER_SUPPORTS_NO_UNDEFINED_VAR_TEMPLATE)
list(APPEND CEF_CXX_COMPILER_FLAGS
-Wno-undefined-var-template # Don't warn about potentially uninstantiated static members
)
endif()
CHECK_C_COMPILER_FLAG(-Wno-unused-local-typedefs COMPILER_SUPPORTS_NO_UNUSED_LOCAL_TYPEDEFS) CHECK_C_COMPILER_FLAG(-Wno-unused-local-typedefs COMPILER_SUPPORTS_NO_UNUSED_LOCAL_TYPEDEFS)
if(COMPILER_SUPPORTS_NO_UNUSED_LOCAL_TYPEDEFS) if(COMPILER_SUPPORTS_NO_UNUSED_LOCAL_TYPEDEFS)
list(APPEND CEF_C_COMPILER_FLAGS list(APPEND CEF_C_COMPILER_FLAGS
@@ -169,12 +162,6 @@ if(OS_LINUX)
) )
endif() endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
list(APPEND CEF_CXX_COMPILER_FLAGS
-Wno-attributes # The cfi-icall attribute is not supported by the GNU C++ compiler
)
endif()
if(PROJECT_ARCH STREQUAL "x86_64") if(PROJECT_ARCH STREQUAL "x86_64")
# 64-bit architecture. # 64-bit architecture.
list(APPEND CEF_COMPILER_FLAGS list(APPEND CEF_COMPILER_FLAGS
@@ -346,15 +333,6 @@ if(OS_MACOSX)
set(CEF_SANDBOX_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/cef_sandbox.a") set(CEF_SANDBOX_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/cef_sandbox.a")
set(CEF_SANDBOX_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/cef_sandbox.a") set(CEF_SANDBOX_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/cef_sandbox.a")
endif() 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() endif()
@@ -383,9 +361,6 @@ if(OS_WINDOWS)
1913 # VS2017 version 15.6 1913 # VS2017 version 15.6
1914 # VS2017 version 15.7 1914 # VS2017 version 15.7
1915 # VS2017 version 15.8 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) list(FIND supported_msvc_versions ${MSVC_VERSION} _index)
if (${_index} EQUAL -1) if (${_index} EQUAL -1)
@@ -471,6 +446,7 @@ if(OS_WINDOWS)
# List of CEF binary files. # List of CEF binary files.
set(CEF_BINARY_FILES set(CEF_BINARY_FILES
chrome_elf.dll chrome_elf.dll
d3dcompiler_43.dll
d3dcompiler_47.dll d3dcompiler_47.dll
libcef.dll libcef.dll
libEGL.dll libEGL.dll
@@ -501,10 +477,7 @@ if(OS_WINDOWS)
# Libraries required by cef_sandbox.lib. # Libraries required by cef_sandbox.lib.
set(CEF_SANDBOX_STANDARD_LIBS set(CEF_SANDBOX_STANDARD_LIBS
dbghelp.lib dbghelp.lib
PowrProf.lib
Propsys.lib
psapi.lib psapi.lib
SetupAPI.lib
version.lib version.lib
wbemuuid.lib wbemuuid.lib
winmm.lib winmm.lib

View File

@@ -182,8 +182,6 @@ Atomic64 Release_Load(volatile const Atomic64* ptr);
#include "include/base/internal/cef_atomicops_mac.h" #include "include/base/internal/cef_atomicops_mac.h"
#elif defined(COMPILER_GCC) && defined(ARCH_CPU_X86_FAMILY) #elif defined(COMPILER_GCC) && defined(ARCH_CPU_X86_FAMILY)
#include "include/base/internal/cef_atomicops_x86_gcc.h" #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) #elif defined(COMPILER_GCC) && defined(__ARM_ARCH)
#include "include/base/internal/cef_atomicops_arm_gcc.h" #include "include/base/internal/cef_atomicops_arm_gcc.h"
#else #else

View File

@@ -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_

View File

@@ -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"

View File

@@ -1,110 +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=0385a38b6761c5dec07bb89a95a007ad3c11bea6$
//
#ifndef CEF_INCLUDE_CAPI_CEF_AUDIO_HANDLER_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_AUDIO_HANDLER_CAPI_H_
#pragma once
#include "include/capi/cef_base_capi.h"
#include "include/capi/cef_browser_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
// Implement this structure to handle audio events All functions will be called
// on the UI thread
///
typedef struct _cef_audio_handler_t {
///
// Base structure.
///
cef_base_ref_counted_t base;
///
// Called when the stream identified by |audio_stream_id| has started.
// |audio_stream_id| will uniquely identify the stream across all future
// cef_audio_handler_t callbacks. OnAudioSteamStopped will always be called
// after OnAudioStreamStarted; both functions may be called multiple times for
// the same stream. |channels| is the number of channels, |channel_layout| is
// the layout of the channels and |sample_rate| is the stream sample rate.
// |frames_per_buffer| is the maximum number of frames that will occur in the
// PCM packet passed to OnAudioStreamPacket.
///
void(CEF_CALLBACK* on_audio_stream_started)(
struct _cef_audio_handler_t* self,
struct _cef_browser_t* browser,
int audio_stream_id,
int channels,
cef_channel_layout_t channel_layout,
int sample_rate,
int frames_per_buffer);
///
// Called when a PCM packet is received for the stream identified by
// |audio_stream_id|. |data| is an array representing the raw PCM data as a
// floating point type, i.e. 4-byte value(s). |frames| is the number of frames
// in the PCM packet. |pts| is the presentation timestamp (in milliseconds
// since the Unix Epoch) and represents the time at which the decompressed
// packet should be presented to the user. Based on |frames| and the
// |channel_layout| value passed to OnAudioStreamStarted you can calculate the
// size of the |data| array in bytes.
///
void(CEF_CALLBACK* on_audio_stream_packet)(struct _cef_audio_handler_t* self,
struct _cef_browser_t* browser,
int audio_stream_id,
const float** data,
int frames,
int64 pts);
///
// Called when the stream identified by |audio_stream_id| has stopped.
// OnAudioSteamStopped will always be called after OnAudioStreamStarted; both
// functions may be called multiple times for the same stream.
///
void(CEF_CALLBACK* on_audio_stream_stopped)(struct _cef_audio_handler_t* self,
struct _cef_browser_t* browser,
int audio_stream_id);
} cef_audio_handler_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_AUDIO_HANDLER_CAPI_H_

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=623d324a1ef5637353ae74761fdc04eac4d99716$ // $hash=faac9d17d7efae3a72c4cc44474071027596c843$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_
@@ -45,6 +45,7 @@
#include "include/capi/cef_frame_capi.h" #include "include/capi/cef_frame_capi.h"
#include "include/capi/cef_image_capi.h" #include "include/capi/cef_image_capi.h"
#include "include/capi/cef_navigation_entry_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" #include "include/capi/cef_request_context_capi.h"
#ifdef __cplusplus #ifdef __cplusplus
@@ -178,6 +179,15 @@ typedef struct _cef_browser_t {
/// ///
void(CEF_CALLBACK* get_frame_names)(struct _cef_browser_t* self, void(CEF_CALLBACK* get_frame_names)(struct _cef_browser_t* self,
cef_string_list_t names); 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; } cef_browser_t;
/// ///
@@ -607,12 +617,6 @@ typedef struct _cef_browser_host_t {
int deltaX, int deltaX,
int deltaY); int deltaY);
///
// Send a touch event to the browser for a windowless browser.
///
void(CEF_CALLBACK* send_touch_event)(struct _cef_browser_host_t* self,
const struct _cef_touch_event_t* event);
/// ///
// Send a focus event to the browser. // Send a focus event to the browser.
/// ///
@@ -840,18 +844,6 @@ typedef struct _cef_browser_host_t {
// cef_request_tContext::LoadExtension for details. // cef_request_tContext::LoadExtension for details.
/// ///
int(CEF_CALLBACK* is_background_host)(struct _cef_browser_host_t* self); int(CEF_CALLBACK* is_background_host)(struct _cef_browser_host_t* self);
///
// Set whether the browser's audio is muted.
///
void(CEF_CALLBACK* set_audio_muted)(struct _cef_browser_host_t* self,
int mute);
///
// Returns true (1) if the browser's audio is muted. This function can only
// be called on the UI thread.
///
int(CEF_CALLBACK* is_audio_muted)(struct _cef_browser_host_t* self);
} cef_browser_host_t; } cef_browser_host_t;
/// ///
@@ -859,33 +851,25 @@ typedef struct _cef_browser_host_t {
// |windowInfo|. All values will be copied internally and the actual window will // |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 // be created on the UI thread. If |request_context| is NULL the global request
// context will be used. This function can be called on any browser process // context will be used. This function can be called on any browser process
// thread and will not block. The optional |extra_info| parameter provides an // thread and will not block.
// 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.
/// ///
CEF_EXPORT int cef_browser_host_create_browser( CEF_EXPORT int cef_browser_host_create_browser(
const cef_window_info_t* windowInfo, const cef_window_info_t* windowInfo,
struct _cef_client_t* client, struct _cef_client_t* client,
const cef_string_t* url, const cef_string_t* url,
const struct _cef_browser_settings_t* settings, const struct _cef_browser_settings_t* settings,
struct _cef_dictionary_value_t* extra_info,
struct _cef_request_context_t* request_context); struct _cef_request_context_t* request_context);
/// ///
// Create a new browser window using the window parameters specified by // Create a new browser window using the window parameters specified by
// |windowInfo|. If |request_context| is NULL the global request context will be // |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 // used. This function can only be called on the browser process UI thread.
// 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.
/// ///
CEF_EXPORT cef_browser_t* cef_browser_host_create_browser_sync( CEF_EXPORT cef_browser_t* cef_browser_host_create_browser_sync(
const cef_window_info_t* windowInfo, const cef_window_info_t* windowInfo,
struct _cef_client_t* client, struct _cef_client_t* client,
const cef_string_t* url, const cef_string_t* url,
const struct _cef_browser_settings_t* settings, const struct _cef_browser_settings_t* settings,
struct _cef_dictionary_value_t* extra_info,
struct _cef_request_context_t* request_context); struct _cef_request_context_t* request_context);
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -33,14 +33,13 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=c8b6ce6786bb8369c3d9bb9e932a115fb379b145$ // $hash=318ad8428256c2ef980f2f594ace2469001e59bd$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_ #define CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_
#pragma once #pragma once
#include "include/capi/cef_audio_handler_capi.h"
#include "include/capi/cef_base_capi.h" #include "include/capi/cef_base_capi.h"
#include "include/capi/cef_context_menu_handler_capi.h" #include "include/capi/cef_context_menu_handler_capi.h"
#include "include/capi/cef_dialog_handler_capi.h" #include "include/capi/cef_dialog_handler_capi.h"
@@ -70,12 +69,6 @@ typedef struct _cef_client_t {
/// ///
cef_base_ref_counted_t base; cef_base_ref_counted_t base;
///
// Return the handler for audio rendering events.
///
struct _cef_audio_handler_t*(CEF_CALLBACK* get_audio_handler)(
struct _cef_client_t* self);
/// ///
// Return the handler for context menus. If no handler is provided the default // Return the handler for context menus. If no handler is provided the default
// implementation will be used. // implementation will be used.
@@ -166,7 +159,6 @@ typedef struct _cef_client_t {
int(CEF_CALLBACK* on_process_message_received)( int(CEF_CALLBACK* on_process_message_received)(
struct _cef_client_t* self, struct _cef_client_t* self,
struct _cef_browser_t* browser, struct _cef_browser_t* browser,
struct _cef_frame_t* frame,
cef_process_id_t source_process, cef_process_id_t source_process,
struct _cef_process_message_t* message); struct _cef_process_message_t* message);
} cef_client_t; } cef_client_t;

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=ef1fc4ab41a3fc6046a8754ce1a64bc2732332e6$ // $hash=8e5c27c998b6aabcaf43a4cc7f97064d49eaf8b9$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_COOKIE_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_COOKIE_CAPI_H_
@@ -62,22 +62,18 @@ typedef struct _cef_cookie_manager_t {
cef_base_ref_counted_t base; cef_base_ref_counted_t base;
/// ///
// Set the schemes supported by this manager. If |include_defaults| is true // Set the schemes supported by this manager. The default schemes ("http",
// (1) the default schemes ("http", "https", "ws" and "wss") will also be // "https", "ws" and "wss") will always be supported. If |callback| is non-
// supported. Calling this function with an NULL |schemes| value and // NULL it will be executed asnychronously on the IO thread after the change
// |include_defaults| set to false (0) will disable all loading and saving of // has been applied. Must be called before any cookies are accessed.
// 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.
/// ///
void(CEF_CALLBACK* set_supported_schemes)( void(CEF_CALLBACK* set_supported_schemes)(
struct _cef_cookie_manager_t* self, struct _cef_cookie_manager_t* self,
cef_string_list_t schemes, cef_string_list_t schemes,
int include_defaults,
struct _cef_completion_callback_t* callback); 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 // longest path, then by earliest creation date. Returns false (0) if cookies
// cannot be accessed. // cannot be accessed.
/// ///
@@ -85,7 +81,7 @@ typedef struct _cef_cookie_manager_t {
struct _cef_cookie_visitor_t* visitor); 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) // given url scheme, host, domain and path. If |includeHttpOnly| is true (1)
// HTTP-only cookies will also be included in the results. The returned // HTTP-only cookies will also be included in the results. The returned
// cookies are ordered by longest path, then by earliest creation date. // 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 // check for disallowed characters (e.g. the ';' character is disallowed
// within the cookie value attribute) and fail without setting the cookie if // 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 // 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. // 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, 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 // 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 // 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- // 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 // 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 // or if cookies cannot be accessed. Cookies can alternately be deleted using
// the Visit*Cookies() functions. // the Visit*Cookies() functions.
@@ -127,9 +123,25 @@ typedef struct _cef_cookie_manager_t {
const cef_string_t* cookie_name, const cef_string_t* cookie_name,
struct _cef_delete_cookies_callback_t* callback); 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 // 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. // Returns false (0) if cookies cannot be accessed.
/// ///
int(CEF_CALLBACK* flush_store)(struct _cef_cookie_manager_t* self, 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 // Returns the global cookie manager. By default data will be stored at
// CefSettings.cache_path if specified or in memory otherwise. If |callback| is // 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 // manager's storage has been initialized. Using this function is equivalent to
// calling cef_request_tContext::cef_request_context_get_global_context()->GetDe // calling cef_request_tContext::cef_request_context_get_global_context()->get_d
// faultCookieManager(). // efault_cookie_manager().
/// ///
CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_global_manager( CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_global_manager(
struct _cef_completion_callback_t* callback); 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 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 { typedef struct _cef_cookie_visitor_t {
/// ///
@@ -201,7 +237,7 @@ typedef struct _cef_delete_cookies_callback_t {
/// ///
// Method that will be called upon completion. |num_deleted| will be the // Method that will be called upon completion. |num_deleted| will be the
// number of cookies that were deleted. // number of cookies that were deleted or -1 if unknown.
/// ///
void(CEF_CALLBACK* on_complete)(struct _cef_delete_cookies_callback_t* self, void(CEF_CALLBACK* on_complete)(struct _cef_delete_cookies_callback_t* self,
int num_deleted); int num_deleted);

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=5c7eb1cee72dcb8b7657007b3f9db64680ea8c4d$ // $hash=22ebb1d811a4e0a834eb115859d797c72a5c4ca3$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_DRAG_HANDLER_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_DRAG_HANDLER_CAPI_H_
@@ -43,7 +43,6 @@
#include "include/capi/cef_base_capi.h" #include "include/capi/cef_base_capi.h"
#include "include/capi/cef_browser_capi.h" #include "include/capi/cef_browser_capi.h"
#include "include/capi/cef_drag_data_capi.h" #include "include/capi/cef_drag_data_capi.h"
#include "include/capi/cef_frame_capi.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@@ -80,7 +79,6 @@ typedef struct _cef_drag_handler_t {
void(CEF_CALLBACK* on_draggable_regions_changed)( void(CEF_CALLBACK* on_draggable_regions_changed)(
struct _cef_drag_handler_t* self, struct _cef_drag_handler_t* self,
struct _cef_browser_t* browser, struct _cef_browser_t* browser,
struct _cef_frame_t* frame,
size_t regionsCount, size_t regionsCount,
cef_draggable_region_t const* regions); cef_draggable_region_t const* regions);
} cef_drag_handler_t; } cef_drag_handler_t;

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=6bef924a259845dbf03e9cf5084ff7feb2771034$ // $hash=d3fcf9a928adb588443a52d82a48c188a67d3231$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_FRAME_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_FRAME_CAPI_H_
@@ -42,7 +42,6 @@
#include "include/capi/cef_base_capi.h" #include "include/capi/cef_base_capi.h"
#include "include/capi/cef_dom_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_request_capi.h"
#include "include/capi/cef_stream_capi.h" #include "include/capi/cef_stream_capi.h"
#include "include/capi/cef_string_visitor_capi.h" #include "include/capi/cef_string_visitor_capi.h"
@@ -52,8 +51,6 @@ extern "C" {
#endif #endif
struct _cef_browser_t; struct _cef_browser_t;
struct _cef_urlrequest_client_t;
struct _cef_urlrequest_t;
struct _cef_v8context_t; struct _cef_v8context_t;
/// ///
@@ -218,44 +215,6 @@ typedef struct _cef_frame_t {
/// ///
void(CEF_CALLBACK* visit_dom)(struct _cef_frame_t* self, void(CEF_CALLBACK* visit_dom)(struct _cef_frame_t* self,
struct _cef_domvisitor_t* visitor); 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; } cef_frame_t;
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=85d9f30e93e1c3759213074cc5876f848cf4b012$ // $hash=a1648c803a6d72e004e523cd4c02530702635d1e$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_LIFE_SPAN_HANDLER_CAPI_H_ #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 // 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 // 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 // the parent browser is destroyed before the popup browser creation completes
// (indicated by a call to OnAfterCreated for the popup browser). The // (indicated by a call to OnAfterCreated for the popup browser).
// |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.
/// ///
int(CEF_CALLBACK* on_before_popup)( int(CEF_CALLBACK* on_before_popup)(
struct _cef_life_span_handler_t* self, 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_window_info_t* windowInfo,
struct _cef_client_t** client, struct _cef_client_t** client,
struct _cef_browser_settings_t* settings, struct _cef_browser_settings_t* settings,
struct _cef_dictionary_value_t** extra_info,
int* no_javascript_access); 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 // Called just before a browser is destroyed. Release all references to the
// browser object and do not attempt to execute any functions on the browser // browser object and do not attempt to execute any functions on the browser
// object (other than GetIdentifier or IsSame) after this callback returns. // object after this callback returns. This callback will be the last
// This callback will be the last notification that references |browser| on // notification that references |browser|. See do_close() documentation for
// the UI thread. Any in-progress network requests associated with |browser| // additional usage information.
// 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.
/// ///
void(CEF_CALLBACK* on_before_close)(struct _cef_life_span_handler_t* self, void(CEF_CALLBACK* on_before_close)(struct _cef_life_span_handler_t* self,
struct _cef_browser_t* browser); struct _cef_browser_t* browser);

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=0640490eead86e5631e8db67f3a0de8b43c10640$ // $hash=cf5dc6f6d2c64d5dc706edd5adc5cf6c7c752750$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_
@@ -231,17 +231,6 @@ typedef struct _cef_render_handler_t {
struct _cef_browser_t* browser, struct _cef_browser_t* browser,
const cef_string_t* selected_text, const cef_string_t* selected_text,
const cef_range_t* selected_range); const cef_range_t* selected_range);
///
// Called when an on-screen keyboard should be shown or hidden for the
// specified |browser|. |input_mode| specifies what kind of keyboard should be
// opened. If |input_mode| is CEF_TEXT_INPUT_MODE_NONE, any existing keyboard
// for this browser should be hidden.
///
void(CEF_CALLBACK* on_virtual_keyboard_requested)(
struct _cef_render_handler_t* self,
struct _cef_browser_t* browser,
cef_text_input_mode_t input_mode);
} cef_render_handler_t; } cef_render_handler_t;
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=6c6efd722dda7480a5449ef31f1d6d9a16fd3465$ // $hash=63544b02e263d0aeb2f6553bf40c52bcf72d9f0b$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_RENDER_PROCESS_HANDLER_CAPI_H_ #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 // Called after a browser has been created. When browsing cross-origin a new
// browser will be created before the old browser with the same identifier is // browser will be created before the old browser with the same identifier is
// destroyed. |extra_info| is a read-only value originating from // destroyed.
// 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().
/// ///
void(CEF_CALLBACK* on_browser_created)( void(CEF_CALLBACK* on_browser_created)(
struct _cef_render_process_handler_t* self, struct _cef_render_process_handler_t* self,
struct _cef_browser_t* browser, struct _cef_browser_t* browser);
struct _cef_dictionary_value_t* extra_info);
/// ///
// Called before a browser is destroyed. // Called before a browser is destroyed.
@@ -166,7 +161,6 @@ typedef struct _cef_render_process_handler_t {
int(CEF_CALLBACK* on_process_message_received)( int(CEF_CALLBACK* on_process_message_received)(
struct _cef_render_process_handler_t* self, struct _cef_render_process_handler_t* self,
struct _cef_browser_t* browser, struct _cef_browser_t* browser,
struct _cef_frame_t* frame,
cef_process_id_t source_process, cef_process_id_t source_process,
struct _cef_process_message_t* message); struct _cef_process_message_t* message);
} cef_render_process_handler_t; } cef_render_process_handler_t;

View File

@@ -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_

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=3a1ab8264989d7f68504dc60ad6dc52c31d323a4$ // $hash=580e0e91bf4052f0e996dc42f63079ca1a6390cf$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CAPI_H_ #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, void(CEF_CALLBACK* set_header_map)(struct _cef_request_t* self,
cef_string_multimap_t headerMap); 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. // 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 // Returns the globally unique identifier for this request or 0 if not
// specified. Can be used by cef_resource_request_handler_t implementations in // specified. Can be used by cef_request_tHandler implementations in the
// the browser process to track a single request across multiple callbacks. // browser process to track a single request across multiple callbacks.
/// ///
uint64(CEF_CALLBACK* get_identifier)(struct _cef_request_t* self); uint64(CEF_CALLBACK* get_identifier)(struct _cef_request_t* self);
} cef_request_t; } cef_request_t;

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=fdfce3e4e33a1d4e1170497d2a476f0837994060$ // $hash=cd2b70b906b9f07923d69d9ec0b32488125b0af3$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_CAPI_H_
@@ -44,13 +44,13 @@
#include "include/capi/cef_cookie_capi.h" #include "include/capi/cef_cookie_capi.h"
#include "include/capi/cef_extension_capi.h" #include "include/capi/cef_extension_capi.h"
#include "include/capi/cef_extension_handler_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" #include "include/capi/cef_values_capi.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
struct _cef_request_context_handler_t;
struct _cef_scheme_handler_factory_t; struct _cef_scheme_handler_factory_t;
/// ///
@@ -130,11 +130,14 @@ typedef struct _cef_request_context_t {
struct _cef_request_context_t* self); struct _cef_request_context_t* self);
/// ///
// Returns the cookie manager for this object. If |callback| is non-NULL it // Returns the default cookie manager for this object. This will be the global
// will be executed asnychronously on the IO thread after the manager's // cookie manager if this object is the global request context. Otherwise,
// storage has been initialized. // 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_request_context_t* self,
struct _cef_completion_callback_t* callback); struct _cef_completion_callback_t* callback);
@@ -238,15 +241,6 @@ typedef struct _cef_request_context_t {
struct _cef_request_context_t* self, struct _cef_request_context_t* self,
struct _cef_completion_callback_t* callback); 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 // 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 // only recommended if you have released all other CEF objects but don't yet
@@ -265,6 +259,17 @@ typedef struct _cef_request_context_t {
const cef_string_t* origin, const cef_string_t* origin,
struct _cef_resolve_callback_t* callback); struct _cef_resolve_callback_t* callback);
///
// Attempts to resolve |origin| to a list of associated IP addresses using
// cached data. |resolved_ips| will be populated with the list of resolved IP
// addresses or NULL if no cached data is available. Returns ERR_NONE on
// success. This function must be called on the browser process IO thread.
///
cef_errorcode_t(CEF_CALLBACK* resolve_host_cached)(
struct _cef_request_context_t* self,
const cef_string_t* origin,
cef_string_list_t resolved_ips);
/// ///
// Load an extension. // Load an extension.
// //

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=d3a339e3f85077d971e5814eb5a164a87c647810$ // $hash=03c829d89f0b5b7ab12634fa2f11c4903cd8edb2$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_HANDLER_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_HANDLER_CAPI_H_
@@ -41,16 +41,15 @@
#pragma once #pragma once
#include "include/capi/cef_base_capi.h" #include "include/capi/cef_base_capi.h"
#include "include/capi/cef_browser_capi.h" #include "include/capi/cef_cookie_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_web_plugin_capi.h" #include "include/capi/cef_web_plugin_capi.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
struct _cef_request_context_t;
/// ///
// Implement this structure to provide handler implementations. The handler // Implement this structure to provide handler implementations. The handler
// instance will not be released until all objects related to the context have // 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_handler_t* self,
struct _cef_request_context_t* request_context); 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 // 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. // 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, const cef_string_t* top_origin_url,
struct _cef_web_plugin_info_t* plugin_info, struct _cef_web_plugin_info_t* plugin_info,
cef_plugin_policy_t* plugin_policy); 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; } cef_request_context_handler_t;
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=d9c4e8591ee39bd9d8c1714c0ca2417a7d2a38ea$ // $hash=64631c0b1776a951da838f8b08a4c71ef33a15cc$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_
@@ -44,9 +44,10 @@
#include "include/capi/cef_base_capi.h" #include "include/capi/cef_base_capi.h"
#include "include/capi/cef_browser_capi.h" #include "include/capi/cef_browser_capi.h"
#include "include/capi/cef_frame_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_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_ssl_info_capi.h"
#include "include/capi/cef_x509_certificate_capi.h" #include "include/capi/cef_x509_certificate_capi.h"
@@ -54,6 +55,27 @@
extern "C" { extern "C" {
#endif #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. // Callback structure used to select a client certificate for authentication.
/// ///
@@ -126,39 +148,92 @@ typedef struct _cef_request_handler_t {
int user_gesture); int user_gesture);
/// ///
// Called on the browser process IO thread before a resource request is // Called on the IO thread before a resource request is loaded. The |request|
// initiated. The |browser| and |frame| values represent the source of the // object may be modified. Return RV_CONTINUE to continue the request
// request. |request| represents the request contents and cannot be modified // immediately. Return RV_CONTINUE_ASYNC and call cef_request_tCallback::
// in this callback. |is_navigation| will be true (1) if the resource request // cont() at a later time to continue or cancel the request asynchronously.
// is a navigation. |is_download| will be true (1) if the resource request is // Return RV_CANCEL to cancel the request immediately.
// 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.
/// ///
struct _cef_resource_request_handler_t*( cef_return_value_t(CEF_CALLBACK* on_before_resource_load)(
CEF_CALLBACK* get_resource_request_handler)(
struct _cef_request_handler_t* self, struct _cef_request_handler_t* self,
struct _cef_browser_t* browser, struct _cef_browser_t* browser,
struct _cef_frame_t* frame, struct _cef_frame_t* frame,
struct _cef_request_t* request, struct _cef_request_t* request,
int is_navigation, struct _cef_request_callback_t* callback);
int is_download,
const cef_string_t* request_initiator, ///
int* disable_default_handling); // 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. // Called on the IO thread when the browser needs credentials from the user.
// |origin_url| is the origin making this authentication request. |isProxy| // |isProxy| indicates whether the host is a proxy server. |host| contains the
// indicates whether the host is a proxy server. |host| contains the hostname // hostname and |port| contains the port number. |realm| is the realm of the
// and |port| contains the port number. |realm| is the realm of the challenge // challenge and may be NULL. |scheme| is the authentication scheme used, such
// and may be NULL. |scheme| is the authentication scheme used, such as // as "basic" or "digest", and will be NULL if the source of the request is an
// "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 // 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 // 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 // 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)( int(CEF_CALLBACK* get_auth_credentials)(
struct _cef_request_handler_t* self, struct _cef_request_handler_t* self,
struct _cef_browser_t* browser, struct _cef_browser_t* browser,
const cef_string_t* origin_url, struct _cef_frame_t* frame,
int isProxy, int isProxy,
const cef_string_t* host, const cef_string_t* host,
int port, int port,
@@ -175,6 +250,29 @@ typedef struct _cef_request_handler_t {
const cef_string_t* scheme, const cef_string_t* scheme,
struct _cef_auth_callback_t* callback); 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 // Called on the IO thread when JavaScript requests a specific storage quota
// size via the webkitStorageInfo.requestQuota function. |origin_url| is the // size via the webkitStorageInfo.requestQuota function. |origin_url| is the
@@ -190,6 +288,18 @@ typedef struct _cef_request_handler_t {
int64 new_size, int64 new_size,
struct _cef_request_callback_t* callback); 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 // 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 // certificate. Return true (1) and call cef_request_tCallback::cont() either

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=8c6ffeab9c9183cc5f77929839643767ce5c5c2f$ // $hash=2d14f5cfe748ef0f34aade25cfd1e299cb0ae793$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_RESOURCE_HANDLER_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_RESOURCE_HANDLER_CAPI_H_
@@ -51,48 +51,9 @@
extern "C" { extern "C" {
#endif #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 // 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 { typedef struct _cef_resource_handler_t {
/// ///
@@ -100,29 +61,12 @@ typedef struct _cef_resource_handler_t {
/// ///
cef_base_ref_counted_t base; 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 // Begin processing the request. To handle the request return true (1) and
// call cef_callback_t::cont() once the response header information is // call cef_callback_t::cont() once the response header information is
// available (cef_callback_t::cont() can also be called from inside this // available (cef_callback_t::cont() can also be called from inside this
// function if header information is available immediately). To cancel the // function if header information is available immediately). To cancel the
// request return false (0). // request return false (0).
//
// WARNING: This function is deprecated. Use Open instead.
/// ///
int(CEF_CALLBACK* process_request)(struct _cef_resource_handler_t* self, int(CEF_CALLBACK* process_request)(struct _cef_resource_handler_t* self,
struct _cef_request_t* request, struct _cef_request_t* request,
@@ -136,59 +80,20 @@ typedef struct _cef_resource_handler_t {
// (0) or the specified number of bytes have been read. Use the |response| // (0) or the specified number of bytes have been read. Use the |response|
// object to set the mime type, http status code and other optional header // object to set the mime type, http status code and other optional header
// values. To redirect the request to a new URL set |redirectUrl| to the new // values. To redirect the request to a new URL set |redirectUrl| to the new
// URL. |redirectUrl| can be either a relative or fully qualified URL. It is // URL. If an error occured while setting up the request you can call
// also possible to set |response| to a redirect http status code and pass the // set_error() on |response| to indicate the error condition.
// new URL via a Location header. Likewise with |redirectUrl| it is valid to
// set a relative or fully qualified URL as the Location header value. If an
// error occured while setting up the request you can call set_error() on
// |response| to indicate the error condition.
/// ///
void(CEF_CALLBACK* get_response_headers)(struct _cef_resource_handler_t* self, void(CEF_CALLBACK* get_response_headers)(struct _cef_resource_handler_t* self,
struct _cef_response_t* response, struct _cef_response_t* response,
int64* response_length, int64* response_length,
cef_string_t* redirectUrl); 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 // 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_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 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 // |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). // 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, int(CEF_CALLBACK* read_response)(struct _cef_resource_handler_t* self,
void* data_out, void* data_out,
@@ -196,6 +101,21 @@ typedef struct _cef_resource_handler_t {
int* bytes_read, int* bytes_read,
struct _cef_callback_t* callback); 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. // Request processing has been canceled.
/// ///

View File

@@ -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_

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=cc5ec5ca76adb568adb08c3b58fb3289a94b2ecd$ // $hash=0c99415ddb1bf7d10135545c7b0ccfb7eec2264d$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_RESPONSE_CAPI_H_ #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, void(CEF_CALLBACK* set_mime_type)(struct _cef_response_t* self,
const cef_string_t* mimeType); 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. // Get the value for the specified response header field.
/// ///

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=bf5c2a51aa80e831382bfe08e8dd5ec6331f0fdc$ // $hash=f83c72ec43f10f19eba82d9d3c284cc436cdbd23$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_SCHEME_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_SCHEME_CAPI_H_
@@ -66,7 +66,56 @@ typedef struct _cef_scheme_registrar_t {
// Register a custom scheme. This function should not be called for the built- // Register a custom scheme. This function should not be called for the built-
// in HTTP, HTTPS, FILE, FTP, ABOUT and DATA schemes. // in HTTP, HTTPS, FILE, FTP, ABOUT and DATA schemes.
// //
// See cef_scheme_options_t for possible values for |options|. // If |is_standard| is true (1) the scheme will be treated as a standard
// scheme. Standard schemes are subject to URL canonicalization and parsing
// rules as defined in the Common Internet Scheme Syntax RFC 1738 Section 3.1
// available at http://www.ietf.org/rfc/rfc1738.txt
//
// In particular, the syntax for standard scheme URLs must be of the form:
// <pre>
// [scheme]://[username]:[password]@[host]:[port]/[url-path]
// </pre> Standard scheme URLs must have a host component that is a fully
// qualified domain name as defined in Section 3.5 of RFC 1034 [13] and
// Section 2.1 of RFC 1123. These URLs will be canonicalized to
// "scheme://host/path" in the simplest case and
// "scheme://username:password@host:port/path" in the most explicit case. For
// example, "scheme:host/path" and "scheme:///host/path" will both be
// canonicalized to "scheme://host/path". The origin of a standard scheme URL
// is the combination of scheme, host and port (i.e., "scheme://host:port" in
// the most explicit case).
//
// For non-standard scheme URLs only the "scheme:" component is parsed and
// canonicalized. The remainder of the URL will be passed to the handler as-
// is. For example, "scheme:///some%20text" will remain the same. Non-standard
// scheme URLs cannot be used as a target for form submission.
//
// If |is_local| is true (1) the scheme will be treated with the same security
// rules as those applied to "file" URLs. Normal pages cannot link to or
// access local URLs. Also, by default, local URLs can only perform
// XMLHttpRequest calls to the same URL (origin + path) that originated the
// request. To allow XMLHttpRequest calls from a local URL to other URLs with
// the same origin set the CefSettings.file_access_from_file_urls_allowed
// value to true (1). To allow XMLHttpRequest calls from a local URL to all
// origins set the CefSettings.universal_access_from_file_urls_allowed value
// to true (1).
//
// If |is_display_isolated| is true (1) the scheme can only be displayed from
// other content hosted with the same scheme. For example, pages in other
// origins cannot create iframes or hyperlinks to URLs with the scheme. For
// schemes that must be accessible from other schemes set this value to false
// (0), set |is_cors_enabled| to true (1), and use CORS "Access-Control-Allow-
// Origin" headers to further restrict access.
//
// If |is_secure| is true (1) the scheme will be treated with the same
// security rules as those applied to "https" URLs. For example, loading this
// scheme from other secure schemes will not trigger mixed content warnings.
//
// If |is_cors_enabled| is true (1) the scheme can be sent CORS requests. This
// value should be true (1) in most cases where |is_standard| is true (1).
//
// If |is_csp_bypassing| is true (1) the scheme can bypass Content-Security-
// Policy (CSP) checks. This value should be false (0) in most cases where
// |is_standard| is true (1).
// //
// This function may be called on any thread. It should only be called once // This function may be called on any thread. It should only be called once
// per unique |scheme_name| value. If |scheme_name| is already registered or // per unique |scheme_name| value. If |scheme_name| is already registered or
@@ -74,7 +123,12 @@ typedef struct _cef_scheme_registrar_t {
/// ///
int(CEF_CALLBACK* add_custom_scheme)(struct _cef_scheme_registrar_t* self, int(CEF_CALLBACK* add_custom_scheme)(struct _cef_scheme_registrar_t* self,
const cef_string_t* scheme_name, const cef_string_t* scheme_name,
int options); int is_standard,
int is_local,
int is_display_isolated,
int is_secure,
int is_cors_enabled,
int is_csp_bypassing);
} cef_scheme_registrar_t; } cef_scheme_registrar_t;
/// ///
@@ -94,7 +148,7 @@ typedef struct _cef_scheme_handler_factory_t {
// will be the browser window and frame respectively that originated the // 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 // 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 // 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_resource_handler_t*(CEF_CALLBACK* create)(
struct _cef_scheme_handler_factory_t* self, struct _cef_scheme_handler_factory_t* self,

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=77ac3a2aaea32b649185a58e4c2bbb13b7fe0540$ // $hash=fa6b1185c566277ff593e7e537dff2b8085d1f3a$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_URLREQUEST_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_URLREQUEST_CAPI_H_
@@ -112,25 +112,19 @@ typedef struct _cef_urlrequest_t {
} cef_urlrequest_t; } cef_urlrequest_t;
/// ///
// Create a new URL request that is not associated with a specific browser or // Create a new URL request. Only GET, POST, HEAD, DELETE and PUT request
// frame. Use cef_frame_t::CreateURLRequest instead if you want the request to // functions are supported. Multiple post data elements are not supported and
// have this association, in which case it may be handled differently (see // elements of type PDE_TYPE_FILE are only supported for requests originating
// documentation on that function). Requests may originate from the both browser // from the browser process. Requests originating from the render process will
// process and the render process. // receive the same handling as requests originating from Web content -- if the
// // response contains Content-Disposition or Mime-Type header values that would
// For requests originating from the browser process: // not normally be rendered then the response may receive special handling
// - It may be intercepted by the client via CefResourceRequestHandler or // inside the browser (for example, via the file download code path instead of
// CefSchemeHandlerFactory. // the URL request code path). The |request| object will be marked as read-only
// - POST data may only contain only a single element of type PDE_TYPE_FILE // after calling this function. In the browser process if |request_context| is
// or PDE_TYPE_BYTES. // NULL the global request context will be used. In the render process
// - If |request_context| is empty the global request context will be used. // |request_context| must be NULL and the context associated with the current
// For requests originating from the render process: // renderer process' browser will be used.
// - 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.
/// ///
CEF_EXPORT cef_urlrequest_t* cef_urlrequest_create( CEF_EXPORT cef_urlrequest_t* cef_urlrequest_create(
struct _cef_request_t* request, 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 // |isProxy| indicates whether the host is a proxy server. |host| contains the
// hostname and |port| contains the port number. Return true (1) to continue // hostname and |port| contains the port number. Return true (1) to continue
// the request and call cef_auth_callback_t::cont() when the authentication // the request and call cef_auth_callback_t::cont() when the authentication
// information is available. If the request has an associated browser/frame // information is available. Return false (0) to cancel the request. This
// then returning false (0) will result in a call to GetAuthCredentials on the // function will only be called for requests initiated from the browser
// cef_request_tHandler associated with that browser, if any. Otherwise, // process.
// returning false (0) will cancel the request immediately. This function will
// only be called for requests initiated from the browser process.
/// ///
int(CEF_CALLBACK* get_auth_credentials)( int(CEF_CALLBACK* get_auth_credentials)(
struct _cef_urlrequest_client_t* self, struct _cef_urlrequest_client_t* self,

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=400746f8fac7fa3dba7ee889c10ae6ca22b93fe1$ // $hash=c499099d6f628e58d2eed207537817758161af5d$
// //
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_BROWSER_VIEW_CAPI_H_ #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 // 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| // until this view is added to the views hierarchy.
// 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.
/// ///
CEF_EXPORT cef_browser_view_t* cef_browser_view_create( CEF_EXPORT cef_browser_view_t* cef_browser_view_create(
struct _cef_client_t* client, struct _cef_client_t* client,
const cef_string_t* url, const cef_string_t* url,
const struct _cef_browser_settings_t* settings, const struct _cef_browser_settings_t* settings,
struct _cef_dictionary_value_t* extra_info,
struct _cef_request_context_t* request_context, struct _cef_request_context_t* request_context,
struct _cef_browser_view_delegate_t* delegate); struct _cef_browser_view_delegate_t* delegate);

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=973d3f764a42f1bf255b52dcd1041aaba1f1475b$ // $hash=81babf6211a1e99886028bfc4fb9107ef7517c1f$
// //
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_LABEL_BUTTON_CAPI_H_ #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 // 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 // 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( CEF_EXPORT cef_label_button_t* cef_label_button_create(
struct _cef_button_delegate_t* delegate, struct _cef_button_delegate_t* delegate,
const cef_string_t* text); const cef_string_t* text,
int with_frame);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=889104f0418508aaa66ed8808b627fdd6652102c$ // $hash=ba9968a57c88511feec2b12338c366a400c101ed$
// //
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_MENU_BUTTON_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_MENU_BUTTON_CAPI_H_
@@ -85,11 +85,14 @@ typedef struct _cef_menu_button_t {
// have a visible frame at all times, center alignment, additional padding and a // 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 // 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 // will only have a visible frame on hover/press, left alignment, less padding
// and no default minimum size. // and no default minimum size. If |with_menu_marker| is true (1) a menu marker
// will be added to the button.
/// ///
CEF_EXPORT cef_menu_button_t* cef_menu_button_create( CEF_EXPORT cef_menu_button_t* cef_menu_button_create(
struct _cef_menu_button_delegate_t* delegate, struct _cef_menu_button_delegate_t* delegate,
const cef_string_t* text); const cef_string_t* text,
int with_frame,
int with_menu_marker);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -1,76 +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. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=23774ff0da7e40bab8244ff4b661b1d9fed24107$
//
#ifndef CEF_INCLUDE_API_HASH_H_
#define CEF_INCLUDE_API_HASH_H_
#include "include/internal/cef_export.h"
// The API hash is created by analyzing CEF header files for C API type
// definitions. The hash value will change when header files are modified in a
// 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"
#if defined(OS_WIN)
#define CEF_API_HASH_PLATFORM "031426ad8eb80ee32fcf3605837cff8d3bbae3a4"
#elif defined(OS_MACOSX)
#define CEF_API_HASH_PLATFORM "47422c9703f7c32013642707b976d299c72f42cb"
#elif defined(OS_LINUX)
#define CEF_API_HASH_PLATFORM "d333fdd7eee13c06f58e586513061ce121121e0b"
#endif
#ifdef __cplusplus
extern "C" {
#endif
///
// Returns CEF API hashes for the libcef library. The returned string is owned
// by the library and should not be freed. The |entry| parameter describes which
// hash value will be returned:
// 0 - CEF_API_HASH_PLATFORM
// 1 - CEF_API_HASH_UNIVERSAL
// 2 - CEF_COMMIT_HASH (from cef_version.h)
///
CEF_EXPORT const char* cef_api_hash(int entry);
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_API_HASH_H_

View File

@@ -1,98 +0,0 @@
// Copyright (c) 2018 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_AUDIO_HANDLER_H_
#define CEF_INCLUDE_CEF_AUDIO_HANDLER_H_
#pragma once
#include "include/cef_base.h"
#include "include/cef_browser.h"
///
// Implement this interface to handle audio events
// All methods will be called on the UI thread
///
/*--cef(source=client)--*/
class CefAudioHandler : public virtual CefBaseRefCounted {
public:
typedef cef_channel_layout_t ChannelLayout;
///
// Called when the stream identified by |audio_stream_id| has started.
// |audio_stream_id| will uniquely identify the stream across all future
// CefAudioHandler callbacks. OnAudioSteamStopped will always be called after
// OnAudioStreamStarted; both methods may be called multiple times for the
// same stream. |channels| is the number of channels, |channel_layout| is the
// layout of the channels and |sample_rate| is the stream sample rate.
// |frames_per_buffer| is the maximum number of frames that will occur in the
// PCM packet passed to OnAudioStreamPacket.
///
/*--cef()--*/
virtual void OnAudioStreamStarted(CefRefPtr<CefBrowser> browser,
int audio_stream_id,
int channels,
ChannelLayout channel_layout,
int sample_rate,
int frames_per_buffer) = 0;
///
// Called when a PCM packet is received for the stream identified by
// |audio_stream_id|. |data| is an array representing the raw PCM data as a
// floating point type, i.e. 4-byte value(s). |frames| is the number of frames
// in the PCM packet. |pts| is the presentation timestamp (in milliseconds
// since the Unix Epoch) and represents the time at which the decompressed
// packet should be presented to the user. Based on |frames| and the
// |channel_layout| value passed to OnAudioStreamStarted you can calculate the
// size of the |data| array in bytes.
///
/*--cef()--*/
virtual void OnAudioStreamPacket(CefRefPtr<CefBrowser> browser,
int audio_stream_id,
const float** data,
int frames,
int64 pts) = 0;
///
// Called when the stream identified by |audio_stream_id| has stopped.
// OnAudioSteamStopped will always be called after OnAudioStreamStarted; both
// methods may be called multiple times for the same stream.
///
/*--cef()--*/
virtual void OnAudioStreamStopped(CefRefPtr<CefBrowser> browser,
int audio_stream_id) = 0;
};
#endif // CEF_INCLUDE_CEF_AUDIO_HANDLER_H_

View File

@@ -139,7 +139,7 @@ class CefRefCount {
} \ } \
\ \
private: \ private: \
CefRefCount ref_count_ CefRefCount ref_count_;
/// ///
// Macro that provides a locking implementation. Use the Lock() and Unlock() // Macro that provides a locking implementation. Use the Lock() and Unlock()

View File

@@ -44,6 +44,7 @@
#include "include/cef_frame.h" #include "include/cef_frame.h"
#include "include/cef_image.h" #include "include/cef_image.h"
#include "include/cef_navigation_entry.h" #include "include/cef_navigation_entry.h"
#include "include/cef_process_message.h"
#include "include/cef_request_context.h" #include "include/cef_request_context.h"
class CefBrowserHost; class CefBrowserHost;
@@ -180,6 +181,14 @@ class CefBrowser : public virtual CefBaseRefCounted {
/// ///
/*--cef()--*/ /*--cef()--*/
virtual void GetFrameNames(std::vector<CefString>& names) = 0; 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 // |windowInfo|. All values will be copied internally and the actual window
// will be created on the UI thread. If |request_context| is empty the // 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 // global request context will be used. This method can be called on any
// browser process thread and will not block. The optional |extra_info| // browser process thread and will not block.
// parameter provides an opportunity to specify extra information specific
// to the created browser that will be passed to
// CefRenderProcessHandler::OnBrowserCreated() in the render process.
/// ///
/*--cef(optional_param=client,optional_param=url, /*--cef(optional_param=client,optional_param=url,
optional_param=request_context,optional_param=extra_info)--*/ optional_param=request_context)--*/
static bool CreateBrowser(const CefWindowInfo& windowInfo, static bool CreateBrowser(const CefWindowInfo& windowInfo,
CefRefPtr<CefClient> client, CefRefPtr<CefClient> client,
const CefString& url, const CefString& url,
const CefBrowserSettings& settings, const CefBrowserSettings& settings,
CefRefPtr<CefDictionaryValue> extra_info,
CefRefPtr<CefRequestContext> request_context); CefRefPtr<CefRequestContext> request_context);
/// ///
// Create a new browser window using the window parameters specified by // Create a new browser window using the window parameters specified by
// |windowInfo|. If |request_context| is empty the global request context // |windowInfo|. If |request_context| is empty the global request context
// will be used. This method can only be called on the browser process UI // will be used. This method can only be called on the browser process UI
// thread. The optional |extra_info| parameter provides an opportunity to // thread.
// specify extra information specific to the created browser that will be
// passed to CefRenderProcessHandler::OnBrowserCreated() in the render
// process.
/// ///
/*--cef(optional_param=client,optional_param=url, /*--cef(optional_param=client,optional_param=url,
optional_param=request_context,optional_param=extra_info)--*/ optional_param=request_context)--*/
static CefRefPtr<CefBrowser> CreateBrowserSync( static CefRefPtr<CefBrowser> CreateBrowserSync(
const CefWindowInfo& windowInfo, const CefWindowInfo& windowInfo,
CefRefPtr<CefClient> client, CefRefPtr<CefClient> client,
const CefString& url, const CefString& url,
const CefBrowserSettings& settings, const CefBrowserSettings& settings,
CefRefPtr<CefDictionaryValue> extra_info,
CefRefPtr<CefRequestContext> request_context); CefRefPtr<CefRequestContext> request_context);
/// ///
@@ -637,12 +638,6 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
int deltaX, int deltaX,
int deltaY) = 0; int deltaY) = 0;
///
// Send a touch event to the browser for a windowless browser.
///
/*--cef()--*/
virtual void SendTouchEvent(const CefTouchEvent& event) = 0;
/// ///
// Send a focus event to the browser. // Send a focus event to the browser.
/// ///
@@ -870,19 +865,6 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
/// ///
/*--cef()--*/ /*--cef()--*/
virtual bool IsBackgroundHost() = 0; virtual bool IsBackgroundHost() = 0;
///
// Set whether the browser's audio is muted.
///
/*--cef()--*/
virtual void SetAudioMuted(bool mute) = 0;
///
// Returns true if the browser's audio is muted. This method can only be
// called on the UI thread.
///
/*--cef()--*/
virtual bool IsAudioMuted() = 0;
}; };
#endif // CEF_INCLUDE_CEF_BROWSER_H_ #endif // CEF_INCLUDE_CEF_BROWSER_H_

View File

@@ -47,7 +47,7 @@
// Class used to implement browser process callbacks. The methods of this class // Class used to implement browser process callbacks. The methods of this class
// will be called on the browser process main thread unless otherwise indicated. // will be called on the browser process main thread unless otherwise indicated.
/// ///
/*--cef(source=client,no_debugct_check)--*/ /*--cef(source=client)--*/
class CefBrowserProcessHandler : public virtual CefBaseRefCounted { class CefBrowserProcessHandler : public virtual CefBaseRefCounted {
public: public:
/// ///

View File

@@ -38,7 +38,6 @@
#define CEF_INCLUDE_CEF_CLIENT_H_ #define CEF_INCLUDE_CEF_CLIENT_H_
#pragma once #pragma once
#include "include/cef_audio_handler.h"
#include "include/cef_base.h" #include "include/cef_base.h"
#include "include/cef_context_menu_handler.h" #include "include/cef_context_menu_handler.h"
#include "include/cef_dialog_handler.h" #include "include/cef_dialog_handler.h"
@@ -61,12 +60,6 @@
/*--cef(source=client,no_debugct_check)--*/ /*--cef(source=client,no_debugct_check)--*/
class CefClient : public virtual CefBaseRefCounted { class CefClient : public virtual CefBaseRefCounted {
public: public:
///
// Return the handler for audio rendering events.
///
/*--cef()--*/
virtual CefRefPtr<CefAudioHandler> GetAudioHandler() { return NULL; }
/// ///
// Return the handler for context menus. If no handler is provided the default // Return the handler for context menus. If no handler is provided the default
// implementation will be used. // implementation will be used.
@@ -158,7 +151,6 @@ class CefClient : public virtual CefBaseRefCounted {
/// ///
/*--cef()--*/ /*--cef()--*/
virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser, virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefProcessId source_process, CefProcessId source_process,
CefRefPtr<CefProcessMessage> message) { CefRefPtr<CefProcessMessage> message) {
return false; return false;

View File

@@ -56,7 +56,7 @@ class CefCookieManager : public virtual CefBaseRefCounted {
/// ///
// Returns the global cookie manager. By default data will be stored at // Returns the global cookie manager. By default data will be stored at
// CefSettings.cache_path if specified or in memory otherwise. If |callback| // 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 // manager's storage has been initialized. Using this method is equivalent to
// calling CefRequestContext::GetGlobalContext()->GetDefaultCookieManager(). // calling CefRequestContext::GetGlobalContext()->GetDefaultCookieManager().
/// ///
@@ -65,22 +65,44 @@ class CefCookieManager : public virtual CefBaseRefCounted {
CefRefPtr<CefCompletionCallback> callback); CefRefPtr<CefCompletionCallback> callback);
/// ///
// Set the schemes supported by this manager. If |include_defaults| is true // Returns a cookie manager that neither stores nor retrieves cookies. All
// the default schemes ("http", "https", "ws" and "wss") will also be // usage of cookies will be blocked including cookies accessed via the network
// supported. Calling this method with an empty |schemes| value and // (request/response headers), via JavaScript (document.cookie), and via
// |include_defaults| set to false will disable all loading and saving of // CefCookieManager methods. No cookies will be displayed in DevTools. If you
// cookies for this manager. If |callback| is non-NULL it will be executed // wish to only block cookies sent via the network use the CefRequestHandler
// asnychronously on the UI thread after the change has been applied. Must be // CanGetCookies and CanSetCookie methods instead.
// called before any cookies are accessed. ///
/*--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)--*/ /*--cef(optional_param=callback)--*/
virtual void SetSupportedSchemes( virtual void SetSupportedSchemes(
const std::vector<CefString>& schemes, const std::vector<CefString>& schemes,
bool include_defaults,
CefRefPtr<CefCompletionCallback> callback) = 0; 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 // longest path, then by earliest creation date. Returns false if cookies
// cannot be accessed. // cannot be accessed.
/// ///
@@ -88,7 +110,7 @@ class CefCookieManager : public virtual CefBaseRefCounted {
virtual bool VisitAllCookies(CefRefPtr<CefCookieVisitor> visitor) = 0; 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 // given url scheme, host, domain and path. If |includeHttpOnly| is true
// HTTP-only cookies will also be included in the results. The returned // HTTP-only cookies will also be included in the results. The returned
// cookies are ordered by longest path, then by earliest creation date. // 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 // check for disallowed characters (e.g. the ';' character is disallowed
// within the cookie value attribute) and fail without setting the cookie if // 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 // 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. // false if an invalid URL is specified or if cookies cannot be accessed.
/// ///
/*--cef(optional_param=callback)--*/ /*--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 // 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 // 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 // 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 // cookies have been deleted. Returns false if a non-empty invalid URL is
// specified or if cookies cannot be accessed. Cookies can alternately be // specified or if cookies cannot be accessed. Cookies can alternately be
// deleted using the Visit*Cookies() methods. // deleted using the Visit*Cookies() methods.
@@ -130,9 +152,24 @@ class CefCookieManager : public virtual CefBaseRefCounted {
const CefString& cookie_name, const CefString& cookie_name,
CefRefPtr<CefDeleteCookiesCallback> callback) = 0; 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 // 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. // Returns false if cookies cannot be accessed.
/// ///
/*--cef(optional_param=callback)--*/ /*--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 // 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)--*/ /*--cef(source=client)--*/
class CefCookieVisitor : public virtual CefBaseRefCounted { class CefCookieVisitor : public virtual CefBaseRefCounted {
@@ -184,7 +221,7 @@ class CefDeleteCookiesCallback : public virtual CefBaseRefCounted {
public: public:
/// ///
// Method that will be called upon completion. |num_deleted| will be the // Method that will be called upon completion. |num_deleted| will be the
// number of cookies that were deleted. // number of cookies that were deleted or -1 if unknown.
/// ///
/*--cef()--*/ /*--cef()--*/
virtual void OnComplete(int num_deleted) = 0; virtual void OnComplete(int num_deleted) = 0;

View File

@@ -41,7 +41,6 @@
#include "include/cef_base.h" #include "include/cef_base.h"
#include "include/cef_browser.h" #include "include/cef_browser.h"
#include "include/cef_drag_data.h" #include "include/cef_drag_data.h"
#include "include/cef_frame.h"
/// ///
// Implement this interface to handle events related to dragging. The methods of // Implement this interface to handle events related to dragging. The methods of
@@ -75,7 +74,6 @@ class CefDragHandler : public virtual CefBaseRefCounted {
/*--cef()--*/ /*--cef()--*/
virtual void OnDraggableRegionsChanged( virtual void OnDraggableRegionsChanged(
CefRefPtr<CefBrowser> browser, CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const std::vector<CefDraggableRegion>& regions) {} const std::vector<CefDraggableRegion>& regions) {}
}; };

View File

@@ -40,14 +40,11 @@
#include "include/cef_base.h" #include "include/cef_base.h"
#include "include/cef_dom.h" #include "include/cef_dom.h"
#include "include/cef_process_message.h"
#include "include/cef_request.h" #include "include/cef_request.h"
#include "include/cef_stream.h" #include "include/cef_stream.h"
#include "include/cef_string_visitor.h" #include "include/cef_string_visitor.h"
class CefBrowser; class CefBrowser;
class CefURLRequest;
class CefURLRequestClient;
class CefV8Context; class CefV8Context;
/// ///
@@ -223,42 +220,6 @@ class CefFrame : public virtual CefBaseRefCounted {
/// ///
/*--cef()--*/ /*--cef()--*/
virtual void VisitDOM(CefRefPtr<CefDOMVisitor> visitor) = 0; 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_ #endif // CEF_INCLUDE_CEF_FRAME_H_

View File

@@ -73,10 +73,7 @@ class CefLifeSpanHandler : public virtual CefBaseRefCounted {
// |windowInfo| will be ignored if the parent browser is wrapped in a // |windowInfo| will be ignored if the parent browser is wrapped in a
// CefBrowserView. Popup browser creation will be canceled if the parent // CefBrowserView. Popup browser creation will be canceled if the parent
// browser is destroyed before the popup browser creation completes (indicated // browser is destroyed before the popup browser creation completes (indicated
// by a call to OnAfterCreated for the popup browser). The |extra_info| // by a call to OnAfterCreated for the popup browser).
// 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.
/// ///
/*--cef(optional_param=target_url,optional_param=target_frame_name)--*/ /*--cef(optional_param=target_url,optional_param=target_frame_name)--*/
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser, virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser,
@@ -89,7 +86,6 @@ class CefLifeSpanHandler : public virtual CefBaseRefCounted {
CefWindowInfo& windowInfo, CefWindowInfo& windowInfo,
CefRefPtr<CefClient>& client, CefRefPtr<CefClient>& client,
CefBrowserSettings& settings, CefBrowserSettings& settings,
CefRefPtr<CefDictionaryValue>& extra_info,
bool* no_javascript_access) { bool* no_javascript_access) {
return false; return false;
} }
@@ -195,13 +191,9 @@ class CefLifeSpanHandler : public virtual CefBaseRefCounted {
/// ///
// Called just before a browser is destroyed. Release all references to the // Called just before a browser is destroyed. Release all references to the
// browser object and do not attempt to execute any methods on the browser // browser object and do not attempt to execute any methods on the browser
// object (other than GetIdentifier or IsSame) after this callback returns. // object after this callback returns. This callback will be the last
// This callback will be the last notification that references |browser| on // notification that references |browser|. See DoClose() documentation for
// the UI thread. Any in-progress network requests associated with |browser| // additional usage information.
// 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.
/// ///
/*--cef()--*/ /*--cef()--*/
virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) {} virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) {}

View File

@@ -57,7 +57,6 @@ class CefRenderHandler : public virtual CefBaseRefCounted {
typedef cef_drag_operations_mask_t DragOperationsMask; typedef cef_drag_operations_mask_t DragOperationsMask;
typedef cef_paint_element_type_t PaintElementType; typedef cef_paint_element_type_t PaintElementType;
typedef std::vector<CefRect> RectList; typedef std::vector<CefRect> RectList;
typedef cef_text_input_mode_t TextInputMode;
/// ///
// Return the handler for accessibility notifications. If no handler is // Return the handler for accessibility notifications. If no handler is
@@ -232,16 +231,6 @@ class CefRenderHandler : public virtual CefBaseRefCounted {
virtual void OnTextSelectionChanged(CefRefPtr<CefBrowser> browser, virtual void OnTextSelectionChanged(CefRefPtr<CefBrowser> browser,
const CefString& selected_text, const CefString& selected_text,
const CefRange& selected_range) {} const CefRange& selected_range) {}
///
// Called when an on-screen keyboard should be shown or hidden for the
// specified |browser|. |input_mode| specifies what kind of keyboard
// should be opened. If |input_mode| is CEF_TEXT_INPUT_MODE_NONE, any
// existing keyboard for this browser should be hidden.
///
/*--cef()--*/
virtual void OnVirtualKeyboardRequested(CefRefPtr<CefBrowser> browser,
TextInputMode input_mode) {}
}; };
#endif // CEF_INCLUDE_CEF_RENDER_HANDLER_H_ #endif // CEF_INCLUDE_CEF_RENDER_HANDLER_H_

View File

@@ -52,7 +52,7 @@
// will be called on the render process main thread (TID_RENDERER) unless // will be called on the render process main thread (TID_RENDERER) unless
// otherwise indicated. // otherwise indicated.
/// ///
/*--cef(source=client,no_debugct_check)--*/ /*--cef(source=client)--*/
class CefRenderProcessHandler : public virtual CefBaseRefCounted { class CefRenderProcessHandler : public virtual CefBaseRefCounted {
public: public:
typedef cef_navigation_type_t NavigationType; typedef cef_navigation_type_t NavigationType;
@@ -75,13 +75,10 @@ class CefRenderProcessHandler : public virtual CefBaseRefCounted {
/// ///
// Called after a browser has been created. When browsing cross-origin a new // Called after a browser has been created. When browsing cross-origin a new
// browser will be created before the old browser with the same identifier is // browser will be created before the old browser with the same identifier is
// destroyed. |extra_info| is a read-only value originating from // destroyed.
// CefBrowserHost::CreateBrowser(), CefBrowserHost::CreateBrowserSync(),
// CefLifeSpanHandler::OnBeforePopup() or CefBrowserView::CreateBrowserView().
/// ///
/*--cef()--*/ /*--cef()--*/
virtual void OnBrowserCreated(CefRefPtr<CefBrowser> browser, virtual void OnBrowserCreated(CefRefPtr<CefBrowser> browser) {}
CefRefPtr<CefDictionaryValue> extra_info) {}
/// ///
// Called before a browser is destroyed. // Called before a browser is destroyed.
@@ -148,7 +145,6 @@ class CefRenderProcessHandler : public virtual CefBaseRefCounted {
/// ///
/*--cef()--*/ /*--cef()--*/
virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser, virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefProcessId source_process, CefProcessId source_process,
CefRefPtr<CefProcessMessage> message) { CefRefPtr<CefProcessMessage> message) {
return false; return false;

View File

@@ -99,7 +99,7 @@ class CefRequest : public virtual CefBaseRefCounted {
// fully qualified with an HTTP or HTTPS scheme component. Any username, // fully qualified with an HTTP or HTTPS scheme component. Any username,
// password or ref component will be removed. // password or ref component will be removed.
/// ///
/*--cef(optional_param=referrer_url)--*/ /*--cef()--*/
virtual void SetReferrer(const CefString& referrer_url, virtual void SetReferrer(const CefString& referrer_url,
ReferrerPolicy policy) = 0; ReferrerPolicy policy) = 0;
@@ -140,25 +140,6 @@ class CefRequest : public virtual CefBaseRefCounted {
/*--cef()--*/ /*--cef()--*/
virtual void SetHeaderMap(const HeaderMap& headerMap) = 0; 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. // 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 // Set the URL to the first party for cookies used in combination with
// CefURLRequest. // CefURLRequest.
/// ///
/*--cef(optional_param=url)--*/ /*--cef()--*/
virtual void SetFirstPartyForCookies(const CefString& url) = 0; 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 // Returns the globally unique identifier for this request or 0 if not
// specified. Can be used by CefResourceRequestHandler implementations in the // specified. Can be used by CefRequestHandler implementations in the browser
// browser process to track a single request across multiple callbacks. // process to track a single request across multiple callbacks.
/// ///
/*--cef()--*/ /*--cef()--*/
virtual uint64 GetIdentifier() = 0; virtual uint64 GetIdentifier() = 0;

View File

@@ -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_

View File

@@ -44,9 +44,9 @@
#include "include/cef_cookie.h" #include "include/cef_cookie.h"
#include "include/cef_extension.h" #include "include/cef_extension.h"
#include "include/cef_extension_handler.h" #include "include/cef_extension_handler.h"
#include "include/cef_request_context_handler.h"
#include "include/cef_values.h" #include "include/cef_values.h"
class CefRequestContextHandler;
class CefSchemeHandlerFactory; class CefSchemeHandlerFactory;
/// ///
@@ -144,12 +144,15 @@ class CefRequestContext : public virtual CefBaseRefCounted {
virtual CefString GetCachePath() = 0; virtual CefString GetCachePath() = 0;
/// ///
// Returns the cookie manager for this object. If |callback| is non-NULL it // Returns the default cookie manager for this object. This will be the global
// will be executed asnychronously on the IO thread after the manager's // cookie manager if this object is the global request context. Otherwise,
// storage has been initialized. // 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)--*/ /*--cef(optional_param=callback)--*/
virtual CefRefPtr<CefCookieManager> GetCookieManager( virtual CefRefPtr<CefCookieManager> GetDefaultCookieManager(
CefRefPtr<CefCompletionCallback> callback) = 0; CefRefPtr<CefCompletionCallback> callback) = 0;
/// ///
@@ -249,15 +252,6 @@ class CefRequestContext : public virtual CefBaseRefCounted {
virtual void ClearCertificateExceptions( virtual void ClearCertificateExceptions(
CefRefPtr<CefCompletionCallback> callback) = 0; 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. // Clears all active and idle connections that Chromium currently has.
// This is only recommended if you have released all other CEF objects but // This is only recommended if you have released all other CEF objects but
@@ -276,6 +270,17 @@ class CefRequestContext : public virtual CefBaseRefCounted {
virtual void ResolveHost(const CefString& origin, virtual void ResolveHost(const CefString& origin,
CefRefPtr<CefResolveCallback> callback) = 0; CefRefPtr<CefResolveCallback> callback) = 0;
///
// Attempts to resolve |origin| to a list of associated IP addresses using
// cached data. |resolved_ips| will be populated with the list of resolved IP
// addresses or empty if no cached data is available. Returns ERR_NONE on
// success. This method must be called on the browser process IO thread.
///
/*--cef(default_retval=ERR_FAILED)--*/
virtual cef_errorcode_t ResolveHostCached(
const CefString& origin,
std::vector<CefString>& resolved_ips) = 0;
/// ///
// Load an extension. // Load an extension.
// //

View File

@@ -39,12 +39,11 @@
#pragma once #pragma once
#include "include/cef_base.h" #include "include/cef_base.h"
#include "include/cef_browser.h" #include "include/cef_cookie.h"
#include "include/cef_frame.h"
#include "include/cef_request.h"
#include "include/cef_resource_request_handler.h"
#include "include/cef_web_plugin.h" #include "include/cef_web_plugin.h"
class CefRequestContext;
/// ///
// Implement this interface to provide handler implementations. The handler // Implement this interface to provide handler implementations. The handler
// instance will not be released until all objects related to the context have // 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( virtual void OnRequestContextInitialized(
CefRefPtr<CefRequestContext> request_context) {} 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 // 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. // 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) { PluginPolicy* plugin_policy) {
return false; 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_ #endif // CEF_INCLUDE_CEF_REQUEST_CONTEXT_HANDLER_H_

View File

@@ -45,11 +45,32 @@
#include "include/cef_browser.h" #include "include/cef_browser.h"
#include "include/cef_frame.h" #include "include/cef_frame.h"
#include "include/cef_request.h" #include "include/cef_request.h"
#include "include/cef_request_callback.h" #include "include/cef_resource_handler.h"
#include "include/cef_resource_request_handler.h" #include "include/cef_response.h"
#include "include/cef_response_filter.h"
#include "include/cef_ssl_info.h" #include "include/cef_ssl_info.h"
#include "include/cef_x509_certificate.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. // Callback interface used to select a client certificate for authentication.
/// ///
@@ -71,7 +92,9 @@ class CefSelectClientCertificateCallback : public virtual CefBaseRefCounted {
/*--cef(source=client)--*/ /*--cef(source=client)--*/
class CefRequestHandler : public virtual CefBaseRefCounted { class CefRequestHandler : public virtual CefBaseRefCounted {
public: public:
typedef cef_return_value_t ReturnValue;
typedef cef_termination_status_t TerminationStatus; typedef cef_termination_status_t TerminationStatus;
typedef cef_urlrequest_status_t URLRequestStatus;
typedef cef_window_open_disposition_t WindowOpenDisposition; typedef cef_window_open_disposition_t WindowOpenDisposition;
typedef std::vector<CefRefPtr<CefX509Certificate>> X509CertificateList; 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 // Called on the IO thread before a resource request is loaded. The |request|
// initiated. The |browser| and |frame| values represent the source of the // object may be modified. Return RV_CONTINUE to continue the request
// request. |request| represents the request contents and cannot be modified // immediately. Return RV_CONTINUE_ASYNC and call CefRequestCallback::
// in this callback. |is_navigation| will be true if the resource request is a // Continue() at a later time to continue or cancel the request
// navigation. |is_download| will be true if the resource request is a // asynchronously. Return RV_CANCEL to cancel the request immediately.
// 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.
/// ///
/*--cef(optional_param=request_initiator)--*/ /*--cef(default_retval=RV_CONTINUE)--*/
virtual CefRefPtr<CefResourceRequestHandler> GetResourceRequestHandler( virtual ReturnValue OnBeforeResourceLoad(
CefRefPtr<CefBrowser> browser, CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame, CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request, CefRefPtr<CefRequest> request,
bool is_navigation, CefRefPtr<CefRequestCallback> callback) {
bool is_download, return RV_CONTINUE;
const CefString& request_initiator, }
bool& disable_default_handling) {
///
// 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; 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. // Called on the IO thread when the browser needs credentials from the user.
// |origin_url| is the origin making this authentication request. |isProxy| // |isProxy| indicates whether the host is a proxy server. |host| contains the
// indicates whether the host is a proxy server. |host| contains the hostname // hostname and |port| contains the port number. |realm| is the realm of the
// and |port| contains the port number. |realm| is the realm of the challenge // challenge and may be empty. |scheme| is the authentication scheme used,
// and may be empty. |scheme| is the authentication scheme used, such as // such as "basic" or "digest", and will be empty if the source of the request
// "basic" or "digest", and will be empty if the source of the request is an // is an FTP server. Return true to continue the request and call
// FTP server. Return true to continue the request and call
// CefAuthCallback::Continue() either in this method or at a later time when // CefAuthCallback::Continue() either in this method or at a later time when
// the authentication information is available. Return false to cancel the // the authentication information is available. Return false to cancel the
// request immediately. // request immediately.
/// ///
/*--cef(optional_param=realm,optional_param=scheme)--*/ /*--cef(optional_param=realm,optional_param=scheme)--*/
virtual bool GetAuthCredentials(CefRefPtr<CefBrowser> browser, virtual bool GetAuthCredentials(CefRefPtr<CefBrowser> browser,
const CefString& origin_url, CefRefPtr<CefFrame> frame,
bool isProxy, bool isProxy,
const CefString& host, const CefString& host,
int port, int port,
@@ -172,6 +255,33 @@ class CefRequestHandler : public virtual CefBaseRefCounted {
return false; 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 // Called on the IO thread when JavaScript requests a specific storage quota
// size via the webkitStorageInfo.requestQuota function. |origin_url| is the // size via the webkitStorageInfo.requestQuota function. |origin_url| is the
@@ -188,6 +298,18 @@ class CefRequestHandler : public virtual CefBaseRefCounted {
return false; 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 // Called on the UI thread to handle requests for URLs with an invalid
// SSL certificate. Return true and call CefRequestCallback::Continue() either // SSL certificate. Return true and call CefRequestCallback::Continue() either

View File

@@ -45,79 +45,23 @@
#include "include/cef_request.h" #include "include/cef_request.h"
#include "include/cef_response.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 // 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)--*/ /*--cef(source=client)--*/
class CefResourceHandler : public virtual CefBaseRefCounted { class CefResourceHandler : public virtual CefBaseRefCounted {
public: 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 // Begin processing the request. To handle the request return true and call
// CefCallback::Continue() once the response header information is available // CefCallback::Continue() once the response header information is available
// (CefCallback::Continue() can also be called from inside this method if // (CefCallback::Continue() can also be called from inside this method if
// header information is available immediately). To cancel the request return // header information is available immediately). To cancel the request return
// false. // false.
//
// WARNING: This method is deprecated. Use Open instead.
/// ///
/*--cef()--*/ /*--cef()--*/
virtual bool ProcessRequest(CefRefPtr<CefRequest> request, virtual bool ProcessRequest(CefRefPtr<CefRequest> request,
CefRefPtr<CefCallback> callback) { CefRefPtr<CefCallback> callback) = 0;
return false;
}
/// ///
// Retrieve response header information. If the response length is not known // Retrieve response header information. If the response length is not known
@@ -127,11 +71,7 @@ class CefResourceHandler : public virtual CefBaseRefCounted {
// false or the specified number of bytes have been read. Use the |response| // false or the specified number of bytes have been read. Use the |response|
// object to set the mime type, http status code and other optional header // object to set the mime type, http status code and other optional header
// values. To redirect the request to a new URL set |redirectUrl| to the new // values. To redirect the request to a new URL set |redirectUrl| to the new
// URL. |redirectUrl| can be either a relative or fully qualified URL. // URL. If an error occured while setting up the request you can call
// It is also possible to set |response| to a redirect http status code
// and pass the new URL via a Location header. Likewise with |redirectUrl| it
// is valid to set a relative or fully qualified URL as the Location header
// value. If an error occured while setting up the request you can call
// SetError() on |response| to indicate the error condition. // SetError() on |response| to indicate the error condition.
/// ///
/*--cef()--*/ /*--cef()--*/
@@ -139,62 +79,33 @@ class CefResourceHandler : public virtual CefBaseRefCounted {
int64& response_length, int64& response_length,
CefString& redirectUrl) = 0; 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 // 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_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 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 // |bytes_read| to 0, return true and call CefCallback::Continue() when the
// data is available. To indicate response completion return false. // data is available. To indicate response completion return false.
//
// WARNING: This method is deprecated. Use Skip and Read instead.
/// ///
/*--cef()--*/ /*--cef()--*/
virtual bool ReadResponse(void* data_out, virtual bool ReadResponse(void* data_out,
int bytes_to_read, int bytes_to_read,
int& bytes_read, int& bytes_read,
CefRefPtr<CefCallback> callback) { CefRefPtr<CefCallback> callback) = 0;
bytes_read = -2;
return false; ///
} // 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. // Request processing has been canceled.

View File

@@ -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_

View File

@@ -96,7 +96,7 @@ class CefResponse : public virtual CefBaseRefCounted {
/// ///
// Set the response status text. // Set the response status text.
/// ///
/*--cef(optional_param=statusText)--*/ /*--cef()--*/
virtual void SetStatusText(const CefString& statusText) = 0; virtual void SetStatusText(const CefString& statusText) = 0;
/// ///
@@ -108,20 +108,8 @@ class CefResponse : public virtual CefBaseRefCounted {
/// ///
// Set the response mime type. // Set the response mime type.
/// ///
/*--cef(optional_param=mimeType)--*/
virtual void SetMimeType(const CefString& mimeType) = 0;
///
// Get the response charset.
///
/*--cef()--*/ /*--cef()--*/
virtual CefString GetCharset() = 0; virtual void SetMimeType(const CefString& mimeType) = 0;
///
// Set the response charset.
///
/*--cef(optional_param=charset)--*/
virtual void SetCharset(const CefString& charset) = 0;
/// ///
// Get the value for the specified response header field. // 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. // 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; virtual void SetURL(const CefString& url) = 0;
}; };

View File

@@ -86,21 +86,76 @@ class CefSchemeRegistrar : public CefBaseScoped {
// Register a custom scheme. This method should not be called for the built-in // Register a custom scheme. This method should not be called for the built-in
// HTTP, HTTPS, FILE, FTP, ABOUT and DATA schemes. // HTTP, HTTPS, FILE, FTP, ABOUT and DATA schemes.
// //
// See cef_scheme_options_t for possible values for |options|. // If |is_standard| is true the scheme will be treated as a standard scheme.
// Standard schemes are subject to URL canonicalization and parsing rules as
// defined in the Common Internet Scheme Syntax RFC 1738 Section 3.1 available
// at http://www.ietf.org/rfc/rfc1738.txt
//
// In particular, the syntax for standard scheme URLs must be of the form:
// <pre>
// [scheme]://[username]:[password]@[host]:[port]/[url-path]
// </pre>
// Standard scheme URLs must have a host component that is a fully qualified
// domain name as defined in Section 3.5 of RFC 1034 [13] and Section 2.1 of
// RFC 1123. These URLs will be canonicalized to "scheme://host/path" in the
// simplest case and "scheme://username:password@host:port/path" in the most
// explicit case. For example, "scheme:host/path" and "scheme:///host/path"
// will both be canonicalized to "scheme://host/path". The origin of a
// standard scheme URL is the combination of scheme, host and port (i.e.,
// "scheme://host:port" in the most explicit case).
//
// For non-standard scheme URLs only the "scheme:" component is parsed and
// canonicalized. The remainder of the URL will be passed to the handler
// as-is. For example, "scheme:///some%20text" will remain the same.
// Non-standard scheme URLs cannot be used as a target for form submission.
//
// If |is_local| is true the scheme will be treated with the same security
// rules as those applied to "file" URLs. Normal pages cannot link to or
// access local URLs. Also, by default, local URLs can only perform
// XMLHttpRequest calls to the same URL (origin + path) that originated the
// request. To allow XMLHttpRequest calls from a local URL to other URLs with
// the same origin set the CefSettings.file_access_from_file_urls_allowed
// value to true. To allow XMLHttpRequest calls from a local URL to all
// origins set the CefSettings.universal_access_from_file_urls_allowed value
// to true.
//
// If |is_display_isolated| is true the scheme can only be displayed from
// other content hosted with the same scheme. For example, pages in other
// origins cannot create iframes or hyperlinks to URLs with the scheme. For
// schemes that must be accessible from other schemes set this value to false,
// set |is_cors_enabled| to true, and use CORS "Access-Control-Allow-Origin"
// headers to further restrict access.
//
// If |is_secure| is true the scheme will be treated with the same security
// rules as those applied to "https" URLs. For example, loading this scheme
// from other secure schemes will not trigger mixed content warnings.
//
// If |is_cors_enabled| is true the scheme can be sent CORS requests. This
// value should be true in most cases where |is_standard| is true.
//
// If |is_csp_bypassing| is true the scheme can bypass Content-Security-Policy
// (CSP) checks. This value should be false in most cases where |is_standard|
// is true.
// //
// This function may be called on any thread. It should only be called once // This function may be called on any thread. It should only be called once
// per unique |scheme_name| value. If |scheme_name| is already registered or // per unique |scheme_name| value. If |scheme_name| is already registered or
// if an error occurs this method will return false. // if an error occurs this method will return false.
/// ///
/*--cef()--*/ /*--cef()--*/
virtual bool AddCustomScheme(const CefString& scheme_name, int options) = 0; virtual bool AddCustomScheme(const CefString& scheme_name,
bool is_standard,
bool is_local,
bool is_display_isolated,
bool is_secure,
bool is_cors_enabled,
bool is_csp_bypassing) = 0;
}; };
/// ///
// Class that creates CefResourceHandler instances for handling scheme requests. // Class that creates CefResourceHandler instances for handling scheme requests.
// The methods of this class will always be called on the IO thread. // The methods of this class will always be called on the IO thread.
/// ///
/*--cef(source=client,no_debugct_check)--*/ /*--cef(source=client)--*/
class CefSchemeHandlerFactory : public virtual CefBaseRefCounted { class CefSchemeHandlerFactory : public virtual CefBaseRefCounted {
public: public:
/// ///
@@ -109,7 +164,7 @@ class CefSchemeHandlerFactory : public virtual CefBaseRefCounted {
// will be the browser window and frame respectively that originated the // will be the browser window and frame respectively that originated the
// request or NULL if the request did not originate from a browser window // request or NULL if the request did not originate from a browser window
// (for example, if the request came from CefURLRequest). The |request| object // (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)--*/ /*--cef(optional_param=browser,optional_param=frame)--*/
virtual CefRefPtr<CefResourceHandler> Create( virtual CefRefPtr<CefResourceHandler> Create(

View File

@@ -49,7 +49,7 @@ typedef cef_thread_id_t CefThreadId;
// the target thread. For this reason be cautious when performing work in the // the target thread. For this reason be cautious when performing work in the
// task object destructor. // task object destructor.
/// ///
/*--cef(source=client,no_debugct_check)--*/ /*--cef(source=client)--*/
class CefTask : public virtual CefBaseRefCounted { class CefTask : public virtual CefBaseRefCounted {
public: public:
/// ///

View File

@@ -60,25 +60,19 @@ class CefURLRequest : public virtual CefBaseRefCounted {
typedef cef_errorcode_t ErrorCode; typedef cef_errorcode_t ErrorCode;
/// ///
// Create a new URL request that is not associated with a specific browser or // Create a new URL request. Only GET, POST, HEAD, DELETE and PUT request
// frame. Use CefFrame::CreateURLRequest instead if you want the request to // methods are supported. Multiple post data elements are not supported and
// have this association, in which case it may be handled differently (see // elements of type PDE_TYPE_FILE are only supported for requests originating
// documentation on that method). Requests may originate from the both browser // from the browser process. Requests originating from the render process will
// process and the render process. // receive the same handling as requests originating from Web content -- if
// // the response contains Content-Disposition or Mime-Type header values that
// For requests originating from the browser process: // would not normally be rendered then the response may receive special
// - It may be intercepted by the client via CefResourceRequestHandler or // handling inside the browser (for example, via the file download code path
// CefSchemeHandlerFactory. // instead of the URL request code path). The |request| object will be marked
// - POST data may only contain only a single element of type PDE_TYPE_FILE // as read-only after calling this method. In the browser process if
// or PDE_TYPE_BYTES. // |request_context| is empty the global request context will be used. In the
// - If |request_context| is empty the global request context will be used. // render process |request_context| must be empty and the context associated
// For requests originating from the render process: // with the current renderer process' browser will be used.
// - 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.
/// ///
/*--cef(optional_param=request_context)--*/ /*--cef(optional_param=request_context)--*/
static CefRefPtr<CefURLRequest> Create( 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 // |isProxy| indicates whether the host is a proxy server. |host| contains the
// hostname and |port| contains the port number. Return true to continue the // hostname and |port| contains the port number. Return true to continue the
// request and call CefAuthCallback::Continue() when the authentication // request and call CefAuthCallback::Continue() when the authentication
// information is available. If the request has an associated browser/frame // information is available. Return false to cancel the request. This method
// then returning false will result in a call to GetAuthCredentials on the // will only be called for requests initiated from the browser process.
// 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.
/// ///
/*--cef(optional_param=realm)--*/ /*--cef(optional_param=realm)--*/
virtual bool GetAuthCredentials(bool isProxy, virtual bool GetAuthCredentials(bool isProxy,

View File

@@ -120,7 +120,7 @@ bool CefRegisterExtension(const CefString& extension_name,
// A task runner for posting tasks on the associated thread can be retrieved via // A task runner for posting tasks on the associated thread can be retrieved via
// the CefV8Context::GetTaskRunner() method. // the CefV8Context::GetTaskRunner() method.
/// ///
/*--cef(source=library,no_debugct_check)--*/ /*--cef(source=library)--*/
class CefV8Context : public virtual CefBaseRefCounted { class CefV8Context : public virtual CefBaseRefCounted {
public: public:
/// ///
@@ -224,7 +224,7 @@ typedef std::vector<CefRefPtr<CefV8Value>> CefV8ValueList;
// Interface that should be implemented to handle V8 function calls. The methods // Interface that should be implemented to handle V8 function calls. The methods
// of this class will be called on the thread associated with the V8 function. // of this class will be called on the thread associated with the V8 function.
/// ///
/*--cef(source=client,no_debugct_check)--*/ /*--cef(source=client)--*/
class CefV8Handler : public virtual CefBaseRefCounted { class CefV8Handler : public virtual CefBaseRefCounted {
public: public:
/// ///
@@ -247,7 +247,7 @@ class CefV8Handler : public virtual CefBaseRefCounted {
// identifiers are registered by calling CefV8Value::SetValue(). The methods // identifiers are registered by calling CefV8Value::SetValue(). The methods
// of this class will be called on the thread associated with the V8 accessor. // of this class will be called on the thread associated with the V8 accessor.
/// ///
/*--cef(source=client,no_debugct_check)--*/ /*--cef(source=client)--*/
class CefV8Accessor : public virtual CefBaseRefCounted { class CefV8Accessor : public virtual CefBaseRefCounted {
public: public:
/// ///
@@ -285,7 +285,7 @@ class CefV8Accessor : public virtual CefBaseRefCounted {
// handlers (with first argument of type int) are called when object is indexed // handlers (with first argument of type int) are called when object is indexed
// by integer. // by integer.
/// ///
/*--cef(source=client,no_debugct_check)--*/ /*--cef(source=client)--*/
class CefV8Interceptor : public virtual CefBaseRefCounted { class CefV8Interceptor : public virtual CefBaseRefCounted {
public: public:
/// ///
@@ -349,7 +349,7 @@ class CefV8Interceptor : public virtual CefBaseRefCounted {
// Class representing a V8 exception. The methods of this class may be called on // Class representing a V8 exception. The methods of this class may be called on
// any render process thread. // any render process thread.
/// ///
/*--cef(source=library,no_debugct_check)--*/ /*--cef(source=library)--*/
class CefV8Exception : public virtual CefBaseRefCounted { class CefV8Exception : public virtual CefBaseRefCounted {
public: public:
/// ///
@@ -410,7 +410,7 @@ class CefV8Exception : public virtual CefBaseRefCounted {
/// ///
// Callback interface that is passed to CefV8Value::CreateArrayBuffer. // Callback interface that is passed to CefV8Value::CreateArrayBuffer.
/// ///
/*--cef(source=client,no_debugct_check)--*/ /*--cef(source=client)--*/
class CefV8ArrayBufferReleaseCallback : public virtual CefBaseRefCounted { class CefV8ArrayBufferReleaseCallback : public virtual CefBaseRefCounted {
public: public:
/// ///
@@ -429,7 +429,7 @@ class CefV8ArrayBufferReleaseCallback : public virtual CefBaseRefCounted {
// A task runner for posting tasks on the associated thread can be retrieved via // A task runner for posting tasks on the associated thread can be retrieved via
// the CefV8Context::GetTaskRunner() method. // the CefV8Context::GetTaskRunner() method.
/// ///
/*--cef(source=library,no_debugct_check)--*/ /*--cef(source=library)--*/
class CefV8Value : public virtual CefBaseRefCounted { class CefV8Value : public virtual CefBaseRefCounted {
public: public:
typedef cef_v8_accesscontrol_t AccessControl; typedef cef_v8_accesscontrol_t AccessControl;
@@ -938,7 +938,7 @@ class CefV8StackTrace : public virtual CefBaseRefCounted {
// threads. A task runner for posting tasks on the associated thread can be // threads. A task runner for posting tasks on the associated thread can be
// retrieved via the CefV8Context::GetTaskRunner() method. // retrieved via the CefV8Context::GetTaskRunner() method.
/// ///
/*--cef(source=library,no_debugct_check)--*/ /*--cef(source=library)--*/
class CefV8StackFrame : public virtual CefBaseRefCounted { class CefV8StackFrame : public virtual CefBaseRefCounted {
public: public:
/// ///

View File

@@ -71,16 +71,11 @@ struct CefWindowInfoTraits {
typedef cef_window_info_t struct_type; typedef cef_window_info_t struct_type;
static inline void init(struct_type* s) {} static inline void init(struct_type* s) {}
static inline void clear(struct_type* s) {}
static inline void clear(struct_type* s) {
cef_string_clear(&s->window_name);
}
static inline void set(const struct_type* src, static inline void set(const struct_type* src,
struct_type* target, struct_type* target,
bool copy) { bool copy) {
cef_string_set(src->window_name.str, src->window_name.length,
&target->window_name, copy);
target->x = src->x; target->x = src->x;
target->y = src->y; target->y = src->y;
target->width = src->width; target->width = src->width;

View File

@@ -183,13 +183,6 @@ typedef struct _cef_settings_t {
/// ///
cef_string_t framework_dir_path; 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 // 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 // thread. If false (0) than the CefDoMessageLoopWork() function must be
@@ -226,27 +219,15 @@ typedef struct _cef_settings_t {
int command_line_args_disabled; int command_line_args_disabled;
/// ///
// The location where data for the global browser cache will be stored on // The location where cache data will be stored on disk. If empty then
// disk. If non-empty this must be either equal to or a child directory of // browsers will be created in "incognito mode" where in-memory caches are
// CefSettings.root_cache_path. If empty then browsers will be created in // used for storage and no data is persisted to disk. HTML5 databases such as
// "incognito mode" where in-memory caches are used for storage and no data is // localStorage will only persist across sessions if a cache path is
// persisted to disk. HTML5 databases such as localStorage will only persist // specified. Can be overridden for individual CefRequestContext instances via
// across sessions if a cache path is specified. Can be overridden for // the CefRequestContextSettings.cache_path value.
// individual CefRequestContext instances via the
// CefRequestContextSettings.cache_path value.
/// ///
cef_string_t cache_path; 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 // 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 // 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. // CefRequestContextSettings.accept_language_list value.
/// ///
cef_string_t accept_language_list; 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; } cef_settings_t;
/// ///
@@ -440,14 +413,12 @@ typedef struct _cef_request_context_settings_t {
size_t size; size_t size;
/// ///
// The location where cache data for this request context will be stored on // The location where cache data will be stored on disk. If empty then
// disk. If non-empty this must be either equal to or a child directory of // browsers will be created in "incognito mode" where in-memory caches are
// CefSettings.root_cache_path. If empty then browsers will be created in // used for storage and no data is persisted to disk. HTML5 databases such as
// "incognito mode" where in-memory caches are used for storage and no data is // localStorage will only persist across sessions if a cache path is
// persisted to disk. HTML5 databases such as localStorage will only persist // specified. To share the global browser cache and related configuration set
// across sessions if a cache path is specified. To share the global browser // this value to match the CefSettings.cache_path value.
// cache and related configuration set this value to match the
// CefSettings.cache_path value.
/// ///
cef_string_t cache_path; cef_string_t cache_path;
@@ -895,16 +866,66 @@ typedef enum {
} cef_storage_type_t; } 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 { typedef enum {
// No error.
ERR_NONE = 0, ERR_NONE = 0,
ERR_FAILED = -2,
#define NET_ERROR(label, value) ERR_ ## label = value, ERR_ABORTED = -3,
#include "include/base/internal/cef_net_error_list.h" ERR_INVALID_ARGUMENT = -4,
#undef NET_ERROR 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; } cef_errorcode_t;
/// ///
@@ -973,25 +994,6 @@ typedef enum {
DRAG_OPERATION_EVERY = UINT_MAX DRAG_OPERATION_EVERY = UINT_MAX
} cef_drag_operations_mask_t; } cef_drag_operations_mask_t;
///
// Input mode of a virtual keyboard. These constants match their equivalents
// in Chromium's text_input_mode.h and should not be renumbered.
// See https://html.spec.whatwg.org/#input-modalities:-the-inputmode-attribute
///
typedef enum {
CEF_TEXT_INPUT_MODE_DEFAULT,
CEF_TEXT_INPUT_MODE_NONE,
CEF_TEXT_INPUT_MODE_TEXT,
CEF_TEXT_INPUT_MODE_TEL,
CEF_TEXT_INPUT_MODE_URL,
CEF_TEXT_INPUT_MODE_EMAIL,
CEF_TEXT_INPUT_MODE_NUMERIC,
CEF_TEXT_INPUT_MODE_DECIMAL,
CEF_TEXT_INPUT_MODE_SEARCH,
CEF_TEXT_INPUT_MODE_MAX = CEF_TEXT_INPUT_MODE_SEARCH,
} cef_text_input_mode_t;
/// ///
// V8 access control values. // V8 access control values.
/// ///
@@ -1240,47 +1242,38 @@ typedef enum {
// If set the request will fail if it cannot be served from the cache (or some // If set the request will fail if it cannot be served from the cache (or some
// equivalent local store). Setting this value is equivalent to specifying the // equivalent local store). Setting this value is equivalent to specifying the
// "Cache-Control: only-if-cached" request header. Setting this value in // "Cache-Control: only-if-cached" request header. Setting this value in
// combination with UR_FLAG_SKIP_CACHE or UR_FLAG_DISABLE_CACHE will cause the // combination with UR_FLAG_SKIP_CACHE will cause the request to fail.
// request to fail.
/// ///
UR_FLAG_ONLY_FROM_CACHE = 1 << 1, UR_FLAG_ONLY_FROM_CACHE = 1 << 1,
///
// If set the cache will not be used at all. Setting this value is equivalent
// to specifying the "Cache-Control: no-store" request header. Setting this
// value in combination with UR_FLAG_ONLY_FROM_CACHE will cause the request to
// fail.
///
UR_FLAG_DISABLE_CACHE = 1 << 2,
/// ///
// If set user name, password, and cookies may be sent with the request, and // If set user name, password, and cookies may be sent with the request, and
// cookies may be saved from the response. // cookies may be saved from the response.
/// ///
UR_FLAG_ALLOW_STORED_CREDENTIALS = 1 << 3, UR_FLAG_ALLOW_STORED_CREDENTIALS = 1 << 2,
/// ///
// If set upload progress events will be generated when a request has a body. // If set upload progress events will be generated when a request has a body.
/// ///
UR_FLAG_REPORT_UPLOAD_PROGRESS = 1 << 4, UR_FLAG_REPORT_UPLOAD_PROGRESS = 1 << 3,
/// ///
// If set the CefURLRequestClient::OnDownloadData method will not be called. // If set the CefURLRequestClient::OnDownloadData method will not be called.
/// ///
UR_FLAG_NO_DOWNLOAD_DATA = 1 << 5, UR_FLAG_NO_DOWNLOAD_DATA = 1 << 4,
/// ///
// If set 5XX redirect errors will be propagated to the observer instead of // If set 5XX redirect errors will be propagated to the observer instead of
// automatically re-tried. This currently only applies for requests // automatically re-tried. This currently only applies for requests
// originated in the browser process. // originated in the browser process.
/// ///
UR_FLAG_NO_RETRY_ON_5XX = 1 << 6, UR_FLAG_NO_RETRY_ON_5XX = 1 << 5,
/// ///
// If set 3XX responses will cause the fetch to halt immediately rather than // If set 3XX responses will cause the fetch to halt immediately rather than
// continue through the redirect. // continue through the redirect.
/// ///
UR_FLAG_STOP_ON_REDIRECT = 1 << 7, UR_FLAG_STOP_ON_REDIRECT = 1 << 6,
} cef_urlrequest_flags_t; } cef_urlrequest_flags_t;
/// ///
@@ -1684,90 +1677,6 @@ typedef struct _cef_mouse_event_t {
uint32 modifiers; uint32 modifiers;
} cef_mouse_event_t; } cef_mouse_event_t;
///
// Touch points states types.
///
typedef enum {
CEF_TET_RELEASED = 0,
CEF_TET_PRESSED,
CEF_TET_MOVED,
CEF_TET_CANCELLED
} cef_touch_event_type_t;
///
// The device type that caused the event.
///
typedef enum {
CEF_POINTER_TYPE_TOUCH = 0,
CEF_POINTER_TYPE_MOUSE,
CEF_POINTER_TYPE_PEN,
CEF_POINTER_TYPE_ERASER,
CEF_POINTER_TYPE_UNKNOWN
} cef_pointer_type_t;
///
// Structure representing touch event information.
///
typedef struct _cef_touch_event_t {
///
// Id of a touch point. Must be unique per touch, can be any number except -1.
// Note that a maximum of 16 concurrent touches will be tracked; touches
// beyond that will be ignored.
///
int id;
///
// X coordinate relative to the left side of the view.
///
float x;
///
// Y coordinate relative to the top side of the view.
///
float y;
///
// X radius in pixels. Set to 0 if not applicable.
///
float radius_x;
///
// Y radius in pixels. Set to 0 if not applicable.
///
float radius_y;
///
// Rotation angle in radians. Set to 0 if not applicable.
///
float rotation_angle;
///
// The normalized pressure of the pointer input in the range of [0,1].
// Set to 0 if not applicable.
///
float pressure;
///
// The state of the touch point. Touches begin with one CEF_TET_PRESSED event
// followed by zero or more CEF_TET_MOVED events and finally one
// CEF_TET_RELEASED or CEF_TET_CANCELLED event. Events not respecting this
// order will be ignored.
///
cef_touch_event_type_t type;
///
// Bit flags describing any pressed modifier keys. See
// cef_event_flags_t for values.
///
uint32 modifiers;
///
// The device type that caused the event.
///
cef_pointer_type_t pointer_type;
} cef_touch_event_t;
/// ///
// Paint element types. // Paint element types.
/// ///
@@ -2587,7 +2496,7 @@ typedef enum {
REFERRER_POLICY_NO_REFERRER, REFERRER_POLICY_NO_REFERRER,
// Always the last value in this enumeration. // Always the last value in this enumeration.
REFERRER_POLICY_LAST_VALUE = REFERRER_POLICY_NO_REFERRER, REFERRER_POLICY_LAST_VALUE,
} cef_referrer_policy_t; } cef_referrer_policy_t;
/// ///
@@ -2824,7 +2733,7 @@ typedef enum {
SSL_CONNECTION_VERSION_TLS1 = 3, SSL_CONNECTION_VERSION_TLS1 = 3,
SSL_CONNECTION_VERSION_TLS1_1 = 4, SSL_CONNECTION_VERSION_TLS1_1 = 4,
SSL_CONNECTION_VERSION_TLS1_2 = 5, SSL_CONNECTION_VERSION_TLS1_2 = 5,
SSL_CONNECTION_VERSION_TLS1_3 = 6, // Reserve 6 for TLS 1.3.
SSL_CONNECTION_VERSION_QUIC = 7, SSL_CONNECTION_VERSION_QUIC = 7,
} cef_ssl_version_t; } cef_ssl_version_t;
@@ -2836,90 +2745,6 @@ typedef enum {
SSL_CONTENT_RAN_INSECURE_CONTENT = 1 << 1, SSL_CONTENT_RAN_INSECURE_CONTENT = 1 << 1,
} cef_ssl_content_status_t; } cef_ssl_content_status_t;
//
// Configuration options for registering a custom scheme.
// These values are used when calling AddCustomScheme.
//
typedef enum {
CEF_SCHEME_OPTION_NONE = 0,
///
// If CEF_SCHEME_OPTION_STANDARD is set the scheme will be treated as a
// standard scheme. Standard schemes are subject to URL canonicalization and
// parsing rules as defined in the Common Internet Scheme Syntax RFC 1738
// Section 3.1 available at http://www.ietf.org/rfc/rfc1738.txt
//
// In particular, the syntax for standard scheme URLs must be of the form:
// <pre>
// [scheme]://[username]:[password]@[host]:[port]/[url-path]
// </pre> Standard scheme URLs must have a host component that is a fully
// qualified domain name as defined in Section 3.5 of RFC 1034 [13] and
// Section 2.1 of RFC 1123. These URLs will be canonicalized to
// "scheme://host/path" in the simplest case and
// "scheme://username:password@host:port/path" in the most explicit case. For
// example, "scheme:host/path" and "scheme:///host/path" will both be
// canonicalized to "scheme://host/path". The origin of a standard scheme URL
// is the combination of scheme, host and port (i.e., "scheme://host:port" in
// the most explicit case).
//
// For non-standard scheme URLs only the "scheme:" component is parsed and
// canonicalized. The remainder of the URL will be passed to the handler as-
// is. For example, "scheme:///some%20text" will remain the same. Non-standard
// scheme URLs cannot be used as a target for form submission.
///
CEF_SCHEME_OPTION_STANDARD = 1 << 0,
///
// If CEF_SCHEME_OPTION_LOCAL is set the scheme will be treated with the same
// security rules as those applied to "file" URLs. Normal pages cannot link to
// or access local URLs. Also, by default, local URLs can only perform
// XMLHttpRequest calls to the same URL (origin + path) that originated the
// request. To allow XMLHttpRequest calls from a local URL to other URLs with
// the same origin set the CefSettings.file_access_from_file_urls_allowed
// value to true (1). To allow XMLHttpRequest calls from a local URL to all
// origins set the CefSettings.universal_access_from_file_urls_allowed value
// to true (1).
///
CEF_SCHEME_OPTION_LOCAL = 1 << 1,
///
// If CEF_SCHEME_OPTION_DISPLAY_ISOLATED is set the scheme can only be
// displayed from other content hosted with the same scheme. For example,
// pages in other origins cannot create iframes or hyperlinks to URLs with the
// scheme. For schemes that must be accessible from other schemes don't set
// this, set CEF_SCHEME_OPTION_CORS_ENABLED, and use CORS
// "Access-Control-Allow-Origin" headers to further restrict access.
///
CEF_SCHEME_OPTION_DISPLAY_ISOLATED = 1 << 2,
///
// If CEF_SCHEME_OPTION_SECURE is set the scheme will be treated with the same
// security rules as those applied to "https" URLs. For example, loading this
// scheme from other secure schemes will not trigger mixed content warnings.
///
CEF_SCHEME_OPTION_SECURE = 1 << 3,
///
// If CEF_SCHEME_OPTION_CORS_ENABLED is set the scheme can be sent CORS
// requests. This value should be set in most cases where
// CEF_SCHEME_OPTION_STANDARD is set.
///
CEF_SCHEME_OPTION_CORS_ENABLED = 1 << 4,
///
// If CEF_SCHEME_OPTION_CSP_BYPASSING is set the scheme can bypass Content-
// Security-Policy (CSP) checks. This value should not be set in most cases
// where CEF_SCHEME_OPTION_STANDARD is set.
///
CEF_SCHEME_OPTION_CSP_BYPASSING = 1 << 5,
///
// If CEF_SCHEME_OPTION_FETCH_ENABLED is set the scheme can perform Fetch API
// requests.
///
CEF_SCHEME_OPTION_FETCH_ENABLED = 1 << 6,
} cef_scheme_options_t;
/// ///
// Error codes for CDM registration. See cef_web_plugin.h for details. // Error codes for CDM registration. See cef_web_plugin.h for details.
/// ///
@@ -2972,117 +2797,6 @@ typedef struct _cef_composition_underline_t {
int thick; int thick;
} cef_composition_underline_t; } cef_composition_underline_t;
///
// Enumerates the various representations of the ordering of audio channels.
// Logged to UMA, so never reuse a value, always add new/greater ones!
// See media\base\channel_layout.h
///
typedef enum {
CEF_CHANNEL_LAYOUT_NONE = 0,
CEF_CHANNEL_LAYOUT_UNSUPPORTED = 1,
// Front C
CEF_CHANNEL_LAYOUT_MONO = 2,
// Front L, Front R
CEF_CHANNEL_LAYOUT_STEREO = 3,
// Front L, Front R, Back C
CEF_CHANNEL_LAYOUT_2_1 = 4,
// Front L, Front R, Front C
CEF_CHANNEL_LAYOUT_SURROUND = 5,
// Front L, Front R, Front C, Back C
CEF_CHANNEL_LAYOUT_4_0 = 6,
// Front L, Front R, Side L, Side R
CEF_CHANNEL_LAYOUT_2_2 = 7,
// Front L, Front R, Back L, Back R
CEF_CHANNEL_LAYOUT_QUAD = 8,
// Front L, Front R, Front C, Side L, Side R
CEF_CHANNEL_LAYOUT_5_0 = 9,
// Front L, Front R, Front C, LFE, Side L, Side R
CEF_CHANNEL_LAYOUT_5_1 = 10,
// Front L, Front R, Front C, Back L, Back R
CEF_CHANNEL_LAYOUT_5_0_BACK = 11,
// Front L, Front R, Front C, LFE, Back L, Back R
CEF_CHANNEL_LAYOUT_5_1_BACK = 12,
// Front L, Front R, Front C, Side L, Side R, Back L, Back R
CEF_CHANNEL_LAYOUT_7_0 = 13,
// Front L, Front R, Front C, LFE, Side L, Side R, Back L, Back R
CEF_CHANNEL_LAYOUT_7_1 = 14,
// Front L, Front R, Front C, LFE, Side L, Side R, Front LofC, Front RofC
CEF_CHANNEL_LAYOUT_7_1_WIDE = 15,
// Stereo L, Stereo R
CEF_CHANNEL_LAYOUT_STEREO_DOWNMIX = 16,
// Stereo L, Stereo R, LFE
CEF_CHANNEL_LAYOUT_2POINT1 = 17,
// Stereo L, Stereo R, Front C, LFE
CEF_CHANNEL_LAYOUT_3_1 = 18,
// Stereo L, Stereo R, Front C, Rear C, LFE
CEF_CHANNEL_LAYOUT_4_1 = 19,
// Stereo L, Stereo R, Front C, Side L, Side R, Back C
CEF_CHANNEL_LAYOUT_6_0 = 20,
// Stereo L, Stereo R, Side L, Side R, Front LofC, Front RofC
CEF_CHANNEL_LAYOUT_6_0_FRONT = 21,
// Stereo L, Stereo R, Front C, Rear L, Rear R, Rear C
CEF_CHANNEL_LAYOUT_HEXAGONAL = 22,
// Stereo L, Stereo R, Front C, LFE, Side L, Side R, Rear Center
CEF_CHANNEL_LAYOUT_6_1 = 23,
// Stereo L, Stereo R, Front C, LFE, Back L, Back R, Rear Center
CEF_CHANNEL_LAYOUT_6_1_BACK = 24,
// Stereo L, Stereo R, Side L, Side R, Front LofC, Front RofC, LFE
CEF_CHANNEL_LAYOUT_6_1_FRONT = 25,
// Front L, Front R, Front C, Side L, Side R, Front LofC, Front RofC
CEF_CHANNEL_LAYOUT_7_0_FRONT = 26,
// Front L, Front R, Front C, LFE, Back L, Back R, Front LofC, Front RofC
CEF_CHANNEL_LAYOUT_7_1_WIDE_BACK = 27,
// Front L, Front R, Front C, Side L, Side R, Rear L, Back R, Back C.
CEF_CHANNEL_LAYOUT_OCTAGONAL = 28,
// Channels are not explicitly mapped to speakers.
CEF_CHANNEL_LAYOUT_DISCRETE = 29,
// Front L, Front R, Front C. Front C contains the keyboard mic audio. This
// layout is only intended for input for WebRTC. The Front C channel
// is stripped away in the WebRTC audio input pipeline and never seen outside
// of that.
CEF_CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC = 30,
// Front L, Front R, Side L, Side R, LFE
CEF_CHANNEL_LAYOUT_4_1_QUAD_SIDE = 31,
// Actual channel layout is specified in the bitstream and the actual channel
// count is unknown at Chromium media pipeline level (useful for audio
// pass-through mode).
CEF_CHANNEL_LAYOUT_BITSTREAM = 32,
// Max value, must always equal the largest entry ever logged.
CEF_CHANNEL_LAYOUT_MAX = CEF_CHANNEL_LAYOUT_BITSTREAM
} cef_channel_layout_t;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@@ -32,27 +32,18 @@
#pragma once #pragma once
#include "include/base/cef_build.h" #include "include/base/cef_build.h"
#include "include/cef_config.h"
#if defined(OS_LINUX) #if defined(OS_LINUX)
#if defined(CEF_X11)
typedef union _XEvent XEvent; typedef union _XEvent XEvent;
typedef struct _XDisplay XDisplay; typedef struct _XDisplay XDisplay;
#endif
#include "include/internal/cef_export.h" #include "include/internal/cef_export.h"
#include "include/internal/cef_string.h" #include "include/internal/cef_string.h"
// Handle types. // Handle types.
#if defined(CEF_X11)
#define cef_cursor_handle_t unsigned long #define cef_cursor_handle_t unsigned long
#define cef_event_handle_t XEvent* #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 cef_window_handle_t unsigned long
#define kNullCursorHandle 0 #define kNullCursorHandle 0
@@ -67,9 +58,7 @@ extern "C" {
// Return the singleton X11 display shared with Chromium. The display is not // 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. // thread-safe and must only be accessed on the browser process UI thread.
/// ///
#if defined(CEF_X11)
CEF_EXPORT XDisplay* cef_get_xdisplay(); CEF_EXPORT XDisplay* cef_get_xdisplay();
#endif
/// ///
// Structure representing CefExecuteProcess arguments. // Structure representing CefExecuteProcess arguments.
@@ -83,16 +72,6 @@ typedef struct _cef_main_args_t {
// Class representing window information. // Class representing window information.
/// ///
typedef struct _cef_window_info_t { typedef struct _cef_window_info_t {
///
// The initial title of the window, to be set when the window is created.
// Some layout managers (e.g., Compiz) can look at the window title
// in order to decide where to place the window when it is
// created. When this attribute is not empty, the window title will
// be set before the window is mapped to the dispay. Otherwise the
// title will be initially empty.
///
cef_string_t window_name;
unsigned int x; unsigned int x;
unsigned int y; unsigned int y;
unsigned int width; unsigned int width;

View File

@@ -37,37 +37,29 @@
#include "include/internal/cef_string.h" #include "include/internal/cef_string.h"
// Handle types. // 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* #define cef_cursor_handle_t void*
// Acutally NSEvent*
#define cef_event_handle_t void* #define cef_event_handle_t void*
// Actually NSView*
#define cef_window_handle_t void* #define cef_window_handle_t void*
#endif
#define kNullCursorHandle NULL #define kNullCursorHandle NULL
#define kNullEventHandle NULL #define kNullEventHandle NULL
#define kNullWindowHandle 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 #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@@ -481,25 +481,6 @@ struct CefMouseEventTraits {
/// ///
typedef CefStructBase<CefMouseEventTraits> CefMouseEvent; typedef CefStructBase<CefMouseEventTraits> CefMouseEvent;
struct CefTouchEventTraits {
typedef cef_touch_event_t struct_type;
static inline void init(struct_type* s) {}
static inline void clear(struct_type* s) {}
static inline void set(const struct_type* src,
struct_type* target,
bool copy) {
*target = *src;
}
};
///
// Class representing a touch event.
///
typedef CefStructBase<CefTouchEventTraits> CefTouchEvent;
struct CefPopupFeaturesTraits { struct CefPopupFeaturesTraits {
typedef cef_popup_features_t struct_type; typedef cef_popup_features_t struct_type;
@@ -543,9 +524,7 @@ struct CefSettingsTraits {
static inline void clear(struct_type* s) { static inline void clear(struct_type* s) {
cef_string_clear(&s->browser_subprocess_path); cef_string_clear(&s->browser_subprocess_path);
cef_string_clear(&s->framework_dir_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->cache_path);
cef_string_clear(&s->root_cache_path);
cef_string_clear(&s->user_data_path); cef_string_clear(&s->user_data_path);
cef_string_clear(&s->user_agent); cef_string_clear(&s->user_agent);
cef_string_clear(&s->product_version); cef_string_clear(&s->product_version);
@@ -555,7 +534,6 @@ struct CefSettingsTraits {
cef_string_clear(&s->resources_dir_path); cef_string_clear(&s->resources_dir_path);
cef_string_clear(&s->locales_dir_path); cef_string_clear(&s->locales_dir_path);
cef_string_clear(&s->accept_language_list); 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, static inline void set(const struct_type* src,
@@ -567,8 +545,6 @@ struct CefSettingsTraits {
&target->browser_subprocess_path, copy); &target->browser_subprocess_path, copy);
cef_string_set(src->framework_dir_path.str, src->framework_dir_path.length, cef_string_set(src->framework_dir_path.str, src->framework_dir_path.length,
&target->framework_dir_path, copy); &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->multi_threaded_message_loop = src->multi_threaded_message_loop;
target->external_message_pump = src->external_message_pump; target->external_message_pump = src->external_message_pump;
target->windowless_rendering_enabled = src->windowless_rendering_enabled; target->windowless_rendering_enabled = src->windowless_rendering_enabled;
@@ -576,8 +552,6 @@ struct CefSettingsTraits {
cef_string_set(src->cache_path.str, src->cache_path.length, cef_string_set(src->cache_path.str, src->cache_path.length,
&target->cache_path, copy); &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, cef_string_set(src->user_data_path.str, src->user_data_path.length,
&target->user_data_path, copy); &target->user_data_path, copy);
target->persist_session_cookies = src->persist_session_cookies; target->persist_session_cookies = src->persist_session_cookies;
@@ -610,9 +584,6 @@ struct CefSettingsTraits {
cef_string_set(src->accept_language_list.str, cef_string_set(src->accept_language_list.str,
src->accept_language_list.length, src->accept_language_list.length,
&target->accept_language_list, copy); &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);
} }
}; };

View File

@@ -51,19 +51,14 @@ class CefBrowserView : public CefView {
public: public:
/// ///
// Create a new BrowserView. The underlying CefBrowser will not be created // Create a new BrowserView. The underlying CefBrowser will not be created
// until this view is added to the views hierarchy. The optional |extra_info| // until this view is added to the views hierarchy.
// parameter provides an opportunity to specify extra information specific
// to the created browser that will be passed to
// CefRenderProcessHandler::OnBrowserCreated() in the render process.
/// ///
/*--cef(optional_param=client,optional_param=url, /*--cef(optional_param=client,optional_param=url,
optional_param=request_context,optional_param=delegate, optional_param=request_context,optional_param=delegate)--*/
optional_param=extra_info)--*/
static CefRefPtr<CefBrowserView> CreateBrowserView( static CefRefPtr<CefBrowserView> CreateBrowserView(
CefRefPtr<CefClient> client, CefRefPtr<CefClient> client,
const CefString& url, const CefString& url,
const CefBrowserSettings& settings, const CefBrowserSettings& settings,
CefRefPtr<CefDictionaryValue> extra_info,
CefRefPtr<CefRequestContext> request_context, CefRefPtr<CefRequestContext> request_context,
CefRefPtr<CefBrowserViewDelegate> delegate); CefRefPtr<CefBrowserViewDelegate> delegate);

View File

@@ -59,7 +59,7 @@ class CefButtonDelegate : public CefViewDelegate {
// Called when the state of |button| changes. // Called when the state of |button| changes.
/// ///
/*--cef()--*/ /*--cef()--*/
virtual void OnButtonStateChanged(CefRefPtr<CefButton> button) {} virtual void OnButtonStateChanged(CefRefPtr<CefButton> button){};
}; };
#endif // CEF_INCLUDE_VIEWS_CEF_BUTTON_DELEGATE_H_ #endif // CEF_INCLUDE_VIEWS_CEF_BUTTON_DELEGATE_H_

View File

@@ -54,12 +54,17 @@ class CefLabelButton : public CefButton {
/// ///
// Create a new LabelButton. A |delegate| must be provided to handle the // 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 // 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)--*/ /*--cef(optional_param=text)--*/
static CefRefPtr<CefLabelButton> CreateLabelButton( static CefRefPtr<CefLabelButton> CreateLabelButton(
CefRefPtr<CefButtonDelegate> delegate, 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 // Returns this LabelButton as a MenuButton or NULL if this is not a

View File

@@ -58,12 +58,15 @@ class CefMenuButton : public CefLabelButton {
// have a visible frame at all times, center alignment, additional padding and // 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 // 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 // will only have a visible frame on hover/press, left alignment, less padding
// and no default minimum size. // and no default minimum size. If |with_menu_marker| is true a menu marker
// will be added to the button.
/// ///
/*--cef(optional_param=text)--*/ /*--cef(optional_param=text)--*/
static CefRefPtr<CefMenuButton> CreateMenuButton( static CefRefPtr<CefMenuButton> CreateMenuButton(
CefRefPtr<CefMenuButtonDelegate> delegate, CefRefPtr<CefMenuButtonDelegate> delegate,
const CefString& text); const CefString& text,
bool with_frame,
bool with_menu_marker);
/// ///
// Show a menu with contents |menu_model|. |screen_point| specifies the menu // Show a menu with contents |menu_model|. |screen_point| specifies the menu

View File

@@ -97,9 +97,8 @@ class CefScopedArgArray {
CefScopedArgArray(int argc, char* argv[]) { CefScopedArgArray(int argc, char* argv[]) {
// argv should have (argc + 1) elements, the last one always being NULL. // argv should have (argc + 1) elements, the last one always being NULL.
array_ = new char*[argc + 1]; array_ = new char*[argc + 1];
values_.resize(argc);
for (int i = 0; i < argc; ++i) { 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_[i] = const_cast<char*>(values_[i].c_str());
} }
array_[argc] = NULL; array_[argc] = NULL;

View File

@@ -360,7 +360,6 @@ class CefMessageRouterBrowserSide
/// ///
virtual bool OnProcessMessageReceived( virtual bool OnProcessMessageReceived(
CefRefPtr<CefBrowser> browser, CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefProcessId source_process, CefProcessId source_process,
CefRefPtr<CefProcessMessage> message) = 0; CefRefPtr<CefProcessMessage> message) = 0;
@@ -416,7 +415,6 @@ class CefMessageRouterRendererSide
/// ///
virtual bool OnProcessMessageReceived( virtual bool OnProcessMessageReceived(
CefRefPtr<CefBrowser> browser, CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefProcessId source_process, CefProcessId source_process,
CefRefPtr<CefProcessMessage> message) = 0; CefRefPtr<CefProcessMessage> message) = 0;

View File

@@ -1,107 +0,0 @@
// Copyright (c) 2018 The Chromium Embedded Framework Authors.
// Portions copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/audio_mirror_destination.h"
#include "libcef/browser/audio_push_sink.h"
#include "base/task/post_task.h"
#include "content/public/browser/browser_task_traits.h"
#include "media/base/bind_to_current_loop.h"
CefAudioMirrorDestination::CefAudioMirrorDestination(
CefRefPtr<CefBrowserHostImpl> browser,
CefRefPtr<CefAudioHandler> cef_audio_handler,
content::AudioMirroringManager* mirroring_manager)
: browser_(browser),
cef_audio_handler_(cef_audio_handler),
mirroring_manager_(mirroring_manager) {
DCHECK(mirroring_manager_);
thread_checker_.DetachFromThread();
}
void CefAudioMirrorDestination::Start() {
DCHECK(thread_checker_.CalledOnValidThread());
base::PostTaskWithTraits(
FROM_HERE, {content::BrowserThread::IO},
base::BindOnce(&content::AudioMirroringManager::StartMirroring,
base::Unretained(mirroring_manager_),
base::RetainedRef(this)));
}
void CefAudioMirrorDestination::Stop() {
DCHECK(thread_checker_.CalledOnValidThread());
base::PostTaskWithTraits(
FROM_HERE, {content::BrowserThread::IO},
base::BindOnce(&content::AudioMirroringManager::StopMirroring,
base::Unretained(mirroring_manager_),
base::RetainedRef(this)));
}
// Asynchronously query whether this MirroringDestination wants to consume
// audio sourced from each of the |candidates|. |results_callback| is run
// to indicate which of them (or none) should have audio routed to this
// MirroringDestination. The second parameter of |results_callback|
// indicates whether the MirroringDestination wants either: 1) exclusive
// access to a diverted audio flow versus 2) a duplicate copy of the audio
// flow. |results_callback| must be run on the same thread as the one that
// called QueryForMatches().
void CefAudioMirrorDestination::QueryForMatches(
const std::set<content::GlobalFrameRoutingId>& candidates,
MatchesCallback results_callback) {
base::PostTaskWithTraits(
FROM_HERE, {content::BrowserThread::UI},
base::BindOnce(&CefAudioMirrorDestination::QueryForMatchesOnUIThread,
base::RetainedRef(this), candidates,
media::BindToCurrentLoop(std::move(results_callback))));
}
void CefAudioMirrorDestination::QueryForMatchesOnUIThread(
const std::set<content::GlobalFrameRoutingId>& candidates,
MatchesCallback results_callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
std::set<content::GlobalFrameRoutingId> matches;
for (auto& candidate : candidates) {
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForFrameRoute(candidate.child_id,
candidate.frame_routing_id);
if (browser == browser_) {
matches.insert(candidate);
}
}
std::move(results_callback).Run(matches, true);
}
// Create a consumer of audio data in the format specified by |params|, and
// connect it as an input to mirroring. This is used to provide
// MirroringDestination with exclusive access to pull the audio flow from
// the source. When Close() is called on the returned AudioOutputStream, the
// input is disconnected and the object becomes invalid.
media::AudioOutputStream* CefAudioMirrorDestination::AddInput(
const media::AudioParameters& params) {
// TODO Check and add usage on CEF
return nullptr;
}
// Create a consumer of audio data in the format specified by |params|, and
// connect it as an input to mirroring. This is used to provide
// MirroringDestination with duplicate audio data, which is pushed from the
// main audio flow. When Close() is called on the returned AudioPushSink,
// the input is disconnected and the object becomes invalid.
media::AudioPushSink* CefAudioMirrorDestination::AddPushInput(
const media::AudioParameters& params) {
return new CefAudioPushSink(
params, browser_, cef_audio_handler_,
base::Bind(&CefAudioMirrorDestination::ReleasePushInput,
base::RetainedRef(this)));
}
void CefAudioMirrorDestination::ReleasePushInput(CefAudioPushSink* sink) {
delete sink;
}

View File

@@ -1,83 +0,0 @@
// Copyright (c) 2018 The Chromium Embedded Framework Authors.
// Portions copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_AUDIO_MIRROR_DESTINATION_H_
#define CEF_LIBCEF_BROWSER_AUDIO_MIRROR_DESTINATION_H_
#pragma once
#include "include/cef_audio_handler.h"
#include "include/cef_base.h"
#include "libcef/browser/browser_host_impl.h"
#include "base/callback.h"
#include "base/threading/thread_checker.h"
#include "content/browser/media/capture/audio_mirroring_manager.h"
#include "media/audio/audio_io.h"
#include "media/base/audio_converter.h"
#include "media/base/audio_parameters.h"
class CefAudioPushSink;
class CefBrowserHostImpl;
class CefAudioMirrorDestination
: public base::RefCountedThreadSafe<CefAudioMirrorDestination>,
public content::AudioMirroringManager::MirroringDestination {
public:
CefAudioMirrorDestination(CefRefPtr<CefBrowserHostImpl> browser,
CefRefPtr<CefAudioHandler> cef_audio_handler,
content::AudioMirroringManager* mirroring_manager);
// Start mirroring. This needs to be triggered on the IO thread.
void Start();
// Stop mirroring. This needs to be triggered on the IO thread.
void Stop();
// Asynchronously query whether this MirroringDestination wants to consume
// audio sourced from each of the |candidates|. |results_callback| is run
// to indicate which of them (or none) should have audio routed to this
// MirroringDestination. The second parameter of |results_callback|
// indicates whether the MirroringDestination wants either: 1) exclusive
// access to a diverted audio flow versus 2) a duplicate copy of the audio
// flow. |results_callback| must be run on the same thread as the one that
// called QueryForMatches().
void QueryForMatches(
const std::set<content::GlobalFrameRoutingId>& candidates,
MatchesCallback results_callback) override;
// Create a consumer of audio data in the format specified by |params|, and
// connect it as an input to mirroring. This is used to provide
// MirroringDestination with exclusive access to pull the audio flow from
// the source. When Close() is called on the returned AudioOutputStream, the
// input is disconnected and the object becomes invalid.
media::AudioOutputStream* AddInput(
const media::AudioParameters& params) override;
// Create a consumer of audio data in the format specified by |params|, and
// connect it as an input to mirroring. This is used to provide
// MirroringDestination with duplicate audio data, which is pushed from the
// main audio flow. When Close() is called on the returned AudioPushSink,
// the input is disconnected and the object becomes invalid.
media::AudioPushSink* AddPushInput(
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);
void ReleasePushInput(CefAudioPushSink* sink);
CefRefPtr<CefBrowserHostImpl> browser_;
CefRefPtr<CefAudioHandler> cef_audio_handler_;
content::AudioMirroringManager* mirroring_manager_;
base::ThreadChecker thread_checker_;
};
#endif // CEF_LIBCEF_BROWSER_AUDIO_MIRROR_DESTINATION_H_

View File

@@ -1,172 +0,0 @@
// Copyright (c) 2018 The Chromium Embedded Framework Authors.
// Portions copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/audio_push_sink.h"
#include "libcef/browser/thread_util.h"
#include "base/bind.h"
#include "base/logging.h"
#include "media/base/audio_sample_types.h"
#include "media/base/data_buffer.h"
using namespace media;
namespace {
cef_channel_layout_t TranslateChannelLayout(ChannelLayout channel) {
switch (channel) {
case CHANNEL_LAYOUT_UNSUPPORTED:
return CEF_CHANNEL_LAYOUT_UNSUPPORTED;
case CHANNEL_LAYOUT_MONO:
return CEF_CHANNEL_LAYOUT_MONO;
case CHANNEL_LAYOUT_STEREO:
return CEF_CHANNEL_LAYOUT_STEREO;
case CHANNEL_LAYOUT_2_1:
return CEF_CHANNEL_LAYOUT_2_1;
case CHANNEL_LAYOUT_SURROUND:
return CEF_CHANNEL_LAYOUT_SURROUND;
case CHANNEL_LAYOUT_4_0:
return CEF_CHANNEL_LAYOUT_4_0;
case CHANNEL_LAYOUT_2_2:
return CEF_CHANNEL_LAYOUT_2_2;
case CHANNEL_LAYOUT_QUAD:
return CEF_CHANNEL_LAYOUT_QUAD;
case CHANNEL_LAYOUT_5_0:
return CEF_CHANNEL_LAYOUT_5_0;
case CHANNEL_LAYOUT_5_1:
return CEF_CHANNEL_LAYOUT_5_1;
case CHANNEL_LAYOUT_5_0_BACK:
return CEF_CHANNEL_LAYOUT_5_0_BACK;
case CHANNEL_LAYOUT_5_1_BACK:
return CEF_CHANNEL_LAYOUT_5_1_BACK;
case CHANNEL_LAYOUT_7_0:
return CEF_CHANNEL_LAYOUT_7_0;
case CHANNEL_LAYOUT_7_1:
return CEF_CHANNEL_LAYOUT_7_1;
case CHANNEL_LAYOUT_7_1_WIDE:
return CEF_CHANNEL_LAYOUT_7_1_WIDE;
case CHANNEL_LAYOUT_STEREO_DOWNMIX:
return CEF_CHANNEL_LAYOUT_STEREO_DOWNMIX;
case CHANNEL_LAYOUT_2POINT1:
return CEF_CHANNEL_LAYOUT_2POINT1;
case CHANNEL_LAYOUT_3_1:
return CEF_CHANNEL_LAYOUT_3_1;
case CHANNEL_LAYOUT_4_1:
return CEF_CHANNEL_LAYOUT_4_1;
case CHANNEL_LAYOUT_6_0:
return CEF_CHANNEL_LAYOUT_6_0;
case CHANNEL_LAYOUT_6_0_FRONT:
return CEF_CHANNEL_LAYOUT_6_0_FRONT;
case CHANNEL_LAYOUT_HEXAGONAL:
return CEF_CHANNEL_LAYOUT_HEXAGONAL;
case CHANNEL_LAYOUT_6_1:
return CEF_CHANNEL_LAYOUT_6_1;
case CHANNEL_LAYOUT_6_1_BACK:
return CEF_CHANNEL_LAYOUT_6_1_BACK;
case CHANNEL_LAYOUT_6_1_FRONT:
return CEF_CHANNEL_LAYOUT_6_1_FRONT;
case CHANNEL_LAYOUT_7_0_FRONT:
return CEF_CHANNEL_LAYOUT_7_0_FRONT;
case CHANNEL_LAYOUT_7_1_WIDE_BACK:
return CEF_CHANNEL_LAYOUT_7_1_WIDE_BACK;
case CHANNEL_LAYOUT_OCTAGONAL:
return CEF_CHANNEL_LAYOUT_OCTAGONAL;
case CHANNEL_LAYOUT_DISCRETE:
return CEF_CHANNEL_LAYOUT_DISCRETE;
case CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC:
return CEF_CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC;
case CHANNEL_LAYOUT_4_1_QUAD_SIDE:
return CEF_CHANNEL_LAYOUT_4_1_QUAD_SIDE;
case CHANNEL_LAYOUT_BITSTREAM:
return CEF_CHANNEL_LAYOUT_BITSTREAM;
case CHANNEL_LAYOUT_NONE:
return CEF_CHANNEL_LAYOUT_NONE;
}
return CEF_CHANNEL_LAYOUT_NONE;
}
} // namespace
int CefAudioPushSink::audio_stream_id = 0;
CefAudioPushSink::CefAudioPushSink(const AudioParameters& params,
CefRefPtr<CefBrowserHostImpl> browser,
CefRefPtr<CefAudioHandler> cef_audio_handler,
const CloseCallback& callback)
: params_(params),
browser_(browser),
cef_audio_handler_(cef_audio_handler),
close_callback_(callback),
stop_stream_(false),
audio_stream_id_(++audio_stream_id) {
// Verify that our enum matches Chromium's values.
static_assert(
static_cast<int>(CEF_CHANNEL_LAYOUT_MAX) ==
static_cast<int>(CHANNEL_LAYOUT_MAX),
"cef_channel_layout_t must match the ChannelLayout enum in Chromium");
DCHECK(params_.IsValid());
DCHECK(browser);
DCHECK(cef_audio_handler);
// VAOS can be constructed on any thread, but will DCHECK that all
// AudioOutputStream methods are called from the same thread.
thread_checker_.DetachFromThread();
base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::UI},
base::BindOnce(&CefAudioPushSink::InitOnUIThread,
base::Unretained(this)));
}
CefAudioPushSink::~CefAudioPushSink() = default;
void CefAudioPushSink::InitOnUIThread() {
DCHECK(thread_checker_.CalledOnValidThread());
cef_audio_handler_->OnAudioStreamStarted(
browser_.get(), audio_stream_id_, params_.channels(),
TranslateChannelLayout(params_.channel_layout()), params_.sample_rate(),
params_.frames_per_buffer());
}
void CefAudioPushSink::OnData(std::unique_ptr<media::AudioBus> source,
base::TimeTicks reference_time) {
// early exit if stream already stopped
if (stop_stream_)
return;
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefAudioPushSink::OnData,
base::Unretained(this),
std::move(source), reference_time));
return;
}
const int channels = source->channels();
std::vector<const float*> data(channels);
for (int c = 0; c < channels; ++c) {
data[c] = source->channel(c);
}
// Add the packet to the buffer.
base::TimeDelta pts = reference_time - base::TimeTicks::UnixEpoch();
cef_audio_handler_->OnAudioStreamPacket(browser_.get(), audio_stream_id_,
data.data(), source->frames(),
pts.InMilliseconds());
}
void CefAudioPushSink::Close() {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefAudioPushSink::Close,
base::Unretained(this)));
return;
}
if (!stop_stream_) {
stop_stream_ = true;
cef_audio_handler_->OnAudioStreamStopped(browser_.get(), audio_stream_id_);
if (!close_callback_.is_null()) {
std::move(close_callback_).Run(this);
}
}
}

View File

@@ -1,54 +0,0 @@
// Copyright (c) 2018 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_AUDIO_PUSH_SINK_H_
#define CEF_LIBCEF_BROWSER_AUDIO_PUSH_SINK_H_
#pragma once
#include "include/cef_audio_handler.h"
#include "include/cef_base.h"
#include "libcef/browser/browser_host_impl.h"
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/threading/thread_checker.h"
#include "media/audio/audio_io.h"
#include "media/base/audio_converter.h"
#include "media/base/audio_parameters.h"
#include "media/base/channel_layout.h"
class CefAudioPushSink : public media::AudioPushSink {
public:
typedef base::Callback<void(CefAudioPushSink* sink)> CloseCallback;
CefAudioPushSink(const media::AudioParameters& params,
CefRefPtr<CefBrowserHostImpl> browser,
CefRefPtr<CefAudioHandler> cef_audio_handler,
const CloseCallback& callback);
virtual ~CefAudioPushSink();
void OnData(std::unique_ptr<media::AudioBus> source,
base::TimeTicks reference_time) override;
void Close() override;
private:
void InitOnUIThread();
const media::AudioParameters params_;
CefRefPtr<CefBrowserHostImpl> browser_;
CefRefPtr<CefAudioHandler> cef_audio_handler_;
CloseCallback close_callback_;
base::ThreadChecker thread_checker_;
bool stop_stream_;
int audio_stream_id_;
static int audio_stream_id;
DISALLOW_COPY_AND_ASSIGN(CefAudioPushSink);
};
#endif // CEF_LIBCEF_BROWSER_AUDIO_PUSH_SINK_H_

View File

@@ -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 // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "libcef/browser/browser_context.h" #include "libcef/browser/browser_context.h"
#include <map>
#include <utility>
#include "libcef/browser/content_browser_client.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/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/browser/thread_util.h"
#include "libcef/common/cef_switches.h"
#include "libcef/common/extensions/extensions_util.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/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/plugins/chrome_plugin_service_filter.h"
#include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.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/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/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/browser_thread.h"
#include "content/public/browser/download_manager.h"
#include "content/public/browser/storage_partition.h" #include "content/public/browser/storage_partition.h"
#include "extensions/browser/extension_protocols.h"
#include "extensions/browser/process_manager.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; CefBrowserContext::CefBrowserContext(bool is_proxy)
: is_proxy_(is_proxy), extension_system_(NULL) {}
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() { CefBrowserContext::~CefBrowserContext() {
CEF_REQUIRE_UIT(); // Should be cleared in Shutdown().
DCHECK(!resource_context_.get());
// 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);
} }
void CefBrowserContext::Initialize() { 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()); 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 // This must be called before creating any services to avoid hitting
// DependencyManager::AssertContextWasntDestroyed when creating/destroying // DependencyManager::AssertContextWasntDestroyed when creating/destroying
@@ -312,9 +41,15 @@ void CefBrowserContext::Initialize() {
if (extensions_enabled) { if (extensions_enabled) {
// Create the custom ExtensionSystem first because other KeyedServices // Create the custom ExtensionSystem first because other KeyedServices
// depend on it. // depend on it.
// The same CefExtensionSystem instance is shared by CefBrowserContextImpl
// and CefBrowserContextProxy objects.
extension_system_ = static_cast<extensions::CefExtensionSystem*>( extension_system_ = static_cast<extensions::CefExtensionSystem*>(
extensions::ExtensionSystem::Get(this)); extensions::ExtensionSystem::Get(this));
if (is_proxy_) {
DCHECK(extension_system_->initialized());
} else {
extension_system_->InitForRegularProfile(true); extension_system_->InitForRegularProfile(true);
}
resource_context_->set_extensions_info_map(extension_system_->info_map()); resource_context_->set_extensions_info_map(extension_system_->info_map());
// Make sure the ProcessManager is created so that it receives extension // Make sure the ProcessManager is created so that it receives extension
@@ -322,95 +57,64 @@ void CefBrowserContext::Initialize() {
// background/event pages. // background/event pages.
extensions::ProcessManager::Get(this); extensions::ProcessManager::Get(this);
} }
}
// Initialize visited links management. void CefBrowserContext::PostInitialize() {
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})));
// Spell checking support and possibly other subsystems retrieve the // Spell checking support and possibly other subsystems retrieve the
// PrefService associated with a BrowserContext via UserPrefs::Get(). // PrefService associated with a BrowserContext via UserPrefs::Get().
PrefService* pref_service = GetPrefs(); PrefService* pref_service = GetPrefs();
DCHECK(pref_service); DCHECK(pref_service);
user_prefs::UserPrefs::Set(this, 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(); extension_system_->Init();
ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( ChromePluginServiceFilter::GetInstance()->RegisterResourceContext(
this, resource_context_.get()); this, resource_context_.get());
}
if (!net_service::IsEnabled()) { void CefBrowserContext::Shutdown() {
// Create the CefURLRequestContextGetter via an indirect call to CEF_REQUIRE_UIT();
// CreateRequestContext. Triggers a call to CefURLRequestContextGetter::
// GetURLRequestContext() on the IO thread which creates the // Send notifications to clean up objects associated with this Profile.
// CefURLRequestContext. MaybeSendDestroyedNotification();
GetRequestContext();
DCHECK(url_request_getter_.get()); 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();
}
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());
} }
} }
void CefBrowserContext::AddCefRequestContext(CefRequestContextImpl* context) { base::FilePath CefBrowserContext::GetCachePath() const {
CEF_REQUIRE_UIT(); return GetPath();
request_context_set_.insert(context);
}
void CefBrowserContext::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;
}
// 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();
} }
content::ResourceContext* CefBrowserContext::GetResourceContext() { content::ResourceContext* CefBrowserContext::GetResourceContext() {
return resource_context_.get(); return resource_context_.get();
} }
content::ClientHintsControllerDelegate*
CefBrowserContext::GetClientHintsControllerDelegate() {
return nullptr;
}
net::URLRequestContextGetter* CefBrowserContext::GetRequestContext() { net::URLRequestContextGetter* CefBrowserContext::GetRequestContext() {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
DCHECK(!net_service::IsEnabled());
return GetDefaultStoragePartition(this)->GetURLRequestContext(); return GetDefaultStoragePartition(this)->GetURLRequestContext();
} }
@@ -425,15 +129,6 @@ CefBrowserContext::CreateMediaRequestContextForStoragePartition(
return nullptr; return nullptr;
} }
void CefBrowserContext::SetCorsOriginAccessListForOrigin(
const url::Origin& source_origin,
std::vector<network::mojom::CorsOriginPatternPtr> allow_patterns,
std::vector<network::mojom::CorsOriginPatternPtr> block_patterns,
base::OnceClosure closure) {
// This method is called for Extension support.
base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, std::move(closure));
}
ChromeZoomLevelPrefs* CefBrowserContext::GetZoomLevelPrefs() { ChromeZoomLevelPrefs* CefBrowserContext::GetZoomLevelPrefs() {
return static_cast<ChromeZoomLevelPrefs*>( return static_cast<ChromeZoomLevelPrefs*>(
GetStoragePartition(this, NULL)->GetZoomLevelDelegate()); GetStoragePartition(this, NULL)->GetZoomLevelDelegate());
@@ -445,250 +140,11 @@ CefBrowserContext::GetURLLoaderFactory() {
->GetURLLoaderFactoryForBrowserProcess(); ->GetURLLoaderFactoryForBrowserProcess();
} }
base::FilePath CefBrowserContext::GetPath() const { void CefBrowserContext::OnRenderFrameDeleted(int render_process_id,
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) {
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 render_frame_id,
int frame_tree_node_id,
bool is_main_frame, bool is_main_frame,
bool is_guest_view) { bool is_guest_view) {
CEF_REQUIRE_UIT(); 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) { if (resource_context_ && is_main_frame) {
DCHECK_GE(render_process_id, 0); DCHECK_GE(render_process_id, 0);
// Using base::Unretained() is safe because both this callback and possible // Using base::Unretained() is safe because both this callback and possible
@@ -712,35 +168,3 @@ void CefBrowserContext::OnPurgePluginListCache() {
base::Unretained(resource_context_.get()), -1)); 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();
}

View File

@@ -1,20 +1,16 @@
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
// Use of this source code is governed by a BSD-style license that can be // reserved. Use of this source code is governed by a BSD-style license that
// found in the LICENSE file. // can be found in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_IMPL_H_ #ifndef CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_H_
#define CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_IMPL_H_ #define CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_H_
#pragma once #pragma once
#include "include/cef_request_context_handler.h" #include "include/cef_request_context_handler.h"
#include "libcef/browser/chrome_profile_stub.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 "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_context.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h" #include "content/public/browser/content_browser_client.h"
@@ -24,7 +20,7 @@
// //
// WC = WebContents // WC = WebContents
// Content API representation of a browser. Created by BHI or the system (for // 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 // BHI = CefBrowserHostImpl
// Implements the CefBrowser and CefBrowserHost interfaces which are exposed // Implements the CefBrowser and CefBrowserHost interfaces which are exposed
@@ -33,32 +29,56 @@
// //
// RCI = CefRequestContextImpl // RCI = CefRequestContextImpl
// Implements the CefRequestContext interface which is exposed to clients. // 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 // 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 // SPI indirectly. Owned by CefBrowserMainParts for the global context or RCI
// for non-global contexts. // 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 // SPI = content::StoragePartitionImpl
// Owns storage-related objects like Quota, IndexedDB, Cache, etc. Created by // Owns storage-related objects like Quota, IndexedDB, Cache, etc. Created by
// StoragePartitionImplMap::Get(). Provides access to the URCG. Life span is // StoragePartitionImplMap::Get(). Provides access to the URCGI. Life span is
// controlled indirectly by BC. // 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 // RC = CefResourceContext
// Acts as a bridge for resource loading. URLRequest life span is tied to this // 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 // object. Must be destroyed before the associated URCGI/URCGP. Life span is
// controlled by BC. // controlled by BCI/BCP.
// //
// URCG = CefURLRequestContextGetter // URCGI = CefURLRequestContextGetterImpl
// Creates and owns the URC. Created by StoragePartitionImplMap::Get() // Creates and owns the URCI. Created by StoragePartitionImplMap::Get()
// calling BC::CreateRequestContext(). Life span is controlled by RC and (for // calling BCI::CreateRequestContext(). Life span is controlled by RC and (for
// the global context) CefBrowserMainParts, and SPI. // 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 various network-related objects including the isolated cookie manager.
// Owns URLRequest objects which must be destroyed first. Life span is // 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: // Relationship diagram:
@@ -66,13 +86,17 @@
// own = ownership (std::unique_ptr) // own = ownership (std::unique_ptr)
// ptr = raw pointer // ptr = raw pointer
// //
// CefBrowserMainParts--\ isolated cookie manager, etc. // CefBrowserMainParts----\ isolated cookie manager, etc.
// | \ ^ // | \ ^
// own ref ref/own // own ref ref/own
// v v | // v v |
// BHI -own-> WC -ptr-> BC -own-> SPI -ref-> URCG --own-> URC // /---> 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: // How shutdown works:
@@ -80,24 +104,21 @@
// ref release, etc. // ref release, etc.
// 2. CefRequestContextImpl is destroyed (possibly asynchronously) on the UI // 2. CefRequestContextImpl is destroyed (possibly asynchronously) on the UI
// thread due to CefBrowserHostImpl destruction, ref release, etc. // thread due to CefBrowserHostImpl destruction, ref release, etc.
// 3. CefBrowserContext is destroyed on the UI thread due to // 3. CefBrowserContext* is destroyed on the UI thread due to
// CefRequestContextImpl destruction or deletion in // CefRequestContextImpl destruction (*Impl, *Proxy) or deletion in
// CefBrowserMainParts::PostMainMessageLoopRun(). // CefBrowserMainParts::PostMainMessageLoopRun() (*Impl).
// 4. CefResourceContext is destroyed asynchronously on the IO thread due to // 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. // URLRequests.
// 5. CefURLRequestContextGetter is destroyed asynchronously on the IO thread // 5. CefURLRequestContextGetter* is destroyed asynchronously on the IO thread
// due to CefResourceContext destruction (or ref release in // due to CefResourceContext destruction (*Impl, *Proxy) or ref release in
// CefBrowserMainParts::PostMainMessageLoopRun. This may be delayed if other // CefBrowserMainParts::PostMainMessageLoopRun() (*Impl). This may be delayed
// network-related objects still have a reference to it. // if other network-related objects still have a reference to it.
// 6. CefURLRequestContext is destroyed on the IO thread due to // 6. CefURLRequestContext* is destroyed on the IO thread due to
// CefURLRequestContextGetter destruction. // CefURLRequestContextGetter* destruction.
*/ */
class CefDownloadManagerDelegate;
class CefRequestContextImpl; class CefRequestContextImpl;
class CefSSLHostStateDelegate;
class CefVisitedLinkListener;
class HostContentSettingsMap; class HostContentSettingsMap;
class PrefService; class PrefService;
@@ -105,126 +126,55 @@ namespace extensions {
class CefExtensionSystem; class CefExtensionSystem;
} }
namespace visitedlink {
class VisitedLinkMaster;
}
// Main entry point for configuring behavior on a per-browser basis. An instance // Main entry point for configuring behavior on a per-browser basis. An instance
// of this class is passed to WebContents::Create in CefBrowserHostImpl:: // of this class is passed to WebContents::Create in CefBrowserHostImpl::
// CreateInternal. Only accessed on the UI thread unless otherwise indicated. // CreateInternal. Only accessed on the UI thread unless otherwise indicated.
class CefBrowserContext : public ChromeProfileStub, class CefBrowserContext : public ChromeProfileStub {
public visitedlink::VisitedLinkDelegate {
public: public:
explicit CefBrowserContext(const CefRequestContextSettings& settings); explicit CefBrowserContext(bool is_proxy);
// 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();
// Must be called immediately after this object is created. // Must be called immediately after this object is created.
void Initialize(); virtual void Initialize();
// Track associated CefRequestContextImpl objects. This object will delete
// itself when the count reaches zero.
void AddCefRequestContext(CefRequestContextImpl* context);
void RemoveCefRequestContext(CefRequestContextImpl* context);
// BrowserContext methods. // BrowserContext methods.
base::FilePath GetCachePath() const override;
content::ResourceContext* GetResourceContext() override; content::ResourceContext* GetResourceContext() override;
content::ClientHintsControllerDelegate* GetClientHintsControllerDelegate()
override;
net::URLRequestContextGetter* GetRequestContext() override; net::URLRequestContextGetter* GetRequestContext() override;
net::URLRequestContextGetter* CreateMediaRequestContext() override; net::URLRequestContextGetter* CreateMediaRequestContext() override;
net::URLRequestContextGetter* CreateMediaRequestContextForStoragePartition( net::URLRequestContextGetter* CreateMediaRequestContextForStoragePartition(
const base::FilePath& partition_path, const base::FilePath& partition_path,
bool in_memory) override; bool in_memory) override;
void SetCorsOriginAccessListForOrigin(
const url::Origin& source_origin,
std::vector<network::mojom::CorsOriginPatternPtr> allow_patterns,
std::vector<network::mojom::CorsOriginPatternPtr> block_patterns,
base::OnceClosure closure) override;
base::FilePath GetPath() 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. // Profile methods.
ChromeZoomLevelPrefs* GetZoomLevelPrefs() override; ChromeZoomLevelPrefs* GetZoomLevelPrefs() override;
scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory() 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 // Returns a RequestContext associated with this object. If this object is a
// when creating the NetworkContext. // *Proxy then it will return the single associated proxy RequestContext. If
bool ShouldRestoreOldSessionCookies() override { // this object is an *Impl then it will return the first non-proxy
return should_persist_session_cookies_; // RequestContext, if one exists, otherwise the first proxy RequestContext.
} virtual CefRequestContextImpl* GetCefRequestContext() const = 0;
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 the settings associated with this object. Safe to call from any // Returns the settings associated with this object. Safe to call from any
// thread. // 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. // Settings for plugins and extensions.
HostContentSettingsMap* GetHostContentSettingsMap(); virtual HostContentSettingsMap* GetHostContentSettingsMap() = 0;
// Called from CefBrowserHostImpl::DidNavigateAnyFrame to update the table of // Called from CefBrowserHostImpl::DidNavigateAnyFrame to update the table of
// visited links. // visited links.
void AddVisitedURLs(const std::vector<GURL>& urls); virtual void AddVisitedURLs(const std::vector<GURL>& urls) = 0;
// Called from CefRequestContextImpl::OnRenderFrameCreated. // Called from CefBrowserHostImpl::RenderFrameDeleted or
void OnRenderFrameCreated(CefRequestContextImpl* request_context, // CefMimeHandlerViewGuestDelegate::OnGuestDetached when a render frame is
int render_process_id, // deleted.
void OnRenderFrameDeleted(int render_process_id,
int render_frame_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_main_frame,
bool is_guest_view); bool is_guest_view);
@@ -232,22 +182,6 @@ class CefBrowserContext : public ChromeProfileStub,
// plugin list cache should be purged. // plugin list cache should be purged.
void OnPurgePluginListCache(); 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 { CefResourceContext* resource_context() const {
return resource_context_.get(); return resource_context_.get();
} }
@@ -255,47 +189,27 @@ class CefBrowserContext : public ChromeProfileStub,
return extension_system_; return extension_system_;
} }
// Guaranteed to exist once this object has been initialized. bool is_proxy() const { return is_proxy_; }
scoped_refptr<CefURLRequestContextGetter> request_context_getter() const {
return url_request_getter_;
}
private:
// Allow deletion via std::unique_ptr().
friend std::default_delete<CefBrowserContext>;
protected:
~CefBrowserContext() override; ~CefBrowserContext() override;
// Members initialized during construction are safe to access from any thread. // Must be called after all services have been initialized.
CefRequestContextSettings settings_; void PostInitialize();
base::FilePath cache_path_;
// CefRequestContextImpl objects referencing this object. // Must be called before the child object destructor has completed.
std::set<CefRequestContextImpl*> request_context_set_; void Shutdown();
std::unique_ptr<PrefService> pref_service_; private:
std::unique_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; // True if this CefBrowserContext is a CefBrowserContextProxy.
const bool is_proxy_;
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_;
std::unique_ptr<CefResourceContext> resource_context_; std::unique_ptr<CefResourceContext> resource_context_;
// Owned by the KeyedService system. // Owned by the KeyedService system.
extensions::CefExtensionSystem* extension_system_ = nullptr; extensions::CefExtensionSystem* extension_system_;
// The key to index KeyedService instances created by
// SimpleKeyedServiceFactory.
std::unique_ptr<ProfileKey> key_;
DISALLOW_COPY_AND_ASSIGN(CefBrowserContext); DISALLOW_COPY_AND_ASSIGN(CefBrowserContext);
}; };
#endif // CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_IMPL_H_ #endif // CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_H_

View File

@@ -0,0 +1,555 @@
// 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));
resource_context()->set_url_request_context_getter(url_request_getter_.get());
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();
}
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);
}

View File

@@ -0,0 +1,134 @@
// 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;
const PrefService* GetPrefs() 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_

View File

@@ -0,0 +1,250 @@
// 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"
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::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;
}
void CefBrowserContextProxy::RegisterInProcessServices(
StaticServiceMap* services) {
parent_->RegisterInProcessServices(services);
}
PrefService* CefBrowserContextProxy::GetPrefs() {
return parent_->GetPrefs();
}
const PrefService* CefBrowserContextProxy::GetPrefs() const {
return parent_->GetPrefs();
}
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());
resource_context()->set_url_request_context_getter(
url_request_getter.get());
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();
}

View File

@@ -0,0 +1,96 @@
// 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::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;
void RegisterInProcessServices(StaticServiceMap* services) override;
// Profile methods.
PrefService* GetPrefs() override;
const PrefService* GetPrefs() 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

View File

@@ -8,6 +8,7 @@
#pragma once #pragma once
#include <map> #include <map>
#include <queue>
#include <string> #include <string>
#include <vector> #include <vector>
@@ -15,13 +16,12 @@
#include "include/cef_client.h" #include "include/cef_client.h"
#include "include/cef_frame.h" #include "include/cef_frame.h"
#include "include/views/cef_browser_view.h" #include "include/views/cef_browser_view.h"
#include "libcef/browser/audio_mirror_destination.h"
#include "libcef/browser/browser_info.h" #include "libcef/browser/browser_info.h"
#include "libcef/browser/file_dialog_manager.h" #include "libcef/browser/file_dialog_manager.h"
#include "libcef/browser/frame_host_impl.h" #include "libcef/browser/frame_host_impl.h"
#include "libcef/browser/javascript_dialog_manager.h" #include "libcef/browser/javascript_dialog_manager.h"
#include "libcef/browser/menu_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/observer_list.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
@@ -43,16 +43,23 @@ class Extension;
class ExtensionHost; class ExtensionHost;
} // namespace extensions } // namespace extensions
namespace net {
class URLRequest;
}
#if defined(USE_AURA) #if defined(USE_AURA)
namespace views { namespace views {
class Widget; class Widget;
} }
#endif // defined(USE_AURA) #endif // defined(USE_AURA)
class CefAudioMirrorDestination; struct Cef_DraggableRegion_Params;
struct Cef_Request_Params;
struct Cef_Response_Params;
class CefBrowserInfo; class CefBrowserInfo;
class CefBrowserPlatformDelegate; class CefBrowserPlatformDelegate;
class CefDevToolsFrontend; class CefDevToolsFrontend;
struct CefNavigateParams;
class SiteInstance; class SiteInstance;
// Implementation of CefBrowser. // Implementation of CefBrowser.
@@ -125,8 +132,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
// request context will be used. // request context will be used.
CefRefPtr<CefRequestContext> request_context; CefRefPtr<CefRequestContext> request_context;
CefRefPtr<CefDictionaryValue> extra_info;
// Used when explicitly creating the browser as an extension host via // Used when explicitly creating the browser as an extension host via
// ProcessManager::CreateBackgroundHost. // ProcessManager::CreateBackgroundHost.
const extensions::Extension* extension = nullptr; const extensions::Extension* extension = nullptr;
@@ -145,11 +150,14 @@ class CefBrowserHostImpl : public CefBrowserHost,
// Returns the browser associated with the specified WebContents. // Returns the browser associated with the specified WebContents.
static CefRefPtr<CefBrowserHostImpl> GetBrowserForContents( static CefRefPtr<CefBrowserHostImpl> GetBrowserForContents(
const content::WebContents* contents); 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( static CefRefPtr<CefBrowserHostImpl> GetBrowserForFrameTreeNode(
int frame_tree_node_id); int frame_tree_node_id);
// Returns the browser associated with the specified frame routing IDs. // Returns the browser associated with the specified frame routing IDs.
static CefRefPtr<CefBrowserHostImpl> GetBrowserForFrameRoute( static CefRefPtr<CefBrowserHostImpl> GetBrowserForFrame(
int render_process_id, int render_process_id,
int render_routing_id); int render_routing_id);
@@ -214,7 +222,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
void SendMouseWheelEvent(const CefMouseEvent& event, void SendMouseWheelEvent(const CefMouseEvent& event,
int deltaX, int deltaX,
int deltaY) override; int deltaY) override;
void SendTouchEvent(const CefTouchEvent& event) override;
void SendFocusEvent(bool setFocus) override; void SendFocusEvent(bool setFocus) override;
void SendCaptureLostEvent() override; void SendCaptureLostEvent() override;
void NotifyMoveOrResizeStarted() override; void NotifyMoveOrResizeStarted() override;
@@ -238,8 +245,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
void DragTargetDrop(const CefMouseEvent& event) override; void DragTargetDrop(const CefMouseEvent& event) override;
void DragSourceSystemDragEnded() override; void DragSourceSystemDragEnded() override;
void DragSourceEndedAt(int x, int y, DragOperationsMask op) override; void DragSourceEndedAt(int x, int y, DragOperationsMask op) override;
void SetAudioMuted(bool mute) override;
bool IsAudioMuted() override;
CefRefPtr<CefNavigationEntry> GetVisibleNavigationEntry() override; CefRefPtr<CefNavigationEntry> GetVisibleNavigationEntry() override;
void SetAccessibilityState(cef_state_t accessibility_state) override; void SetAccessibilityState(cef_state_t accessibility_state) override;
void SetAutoResizeEnabled(bool enabled, void SetAutoResizeEnabled(bool enabled,
@@ -269,6 +274,8 @@ class CefBrowserHostImpl : public CefBrowserHost,
size_t GetFrameCount() override; size_t GetFrameCount() override;
void GetFrameIdentifiers(std::vector<int64>& identifiers) override; void GetFrameIdentifiers(std::vector<int64>& identifiers) override;
void GetFrameNames(std::vector<CefString>& names) override; void GetFrameNames(std::vector<CefString>& names) override;
bool SendProcessMessage(CefProcessId target_process,
CefRefPtr<CefProcessMessage> message) override;
// Returns true if windowless rendering is enabled. // Returns true if windowless rendering is enabled.
bool IsWindowless() const; bool IsWindowless() const;
@@ -296,27 +303,49 @@ class CefBrowserHostImpl : public CefBrowserHost,
CefRefPtr<CefBrowserView> GetBrowserView() const; CefRefPtr<CefBrowserView> GetBrowserView() const;
#endif #endif
// Returns the frame associated with the specified RenderFrameHost. // Returns the frame associated with the specified URLRequest.
CefRefPtr<CefFrame> GetFrameForHost(const content::RenderFrameHost* host); CefRefPtr<CefFrame> GetFrameForRequest(const net::URLRequest* request);
// Returns the frame associated with the specified FrameTreeNode ID. // Navigate as specified by the |params| argument.
CefRefPtr<CefFrame> GetFrameForFrameTreeNode(int frame_tree_node_id); void Navigate(const CefNavigateParams& params);
// Load the specified URL in the main frame. // Load the specified request.
void LoadMainFrameURL(const std::string& url, void LoadRequest(int64 frame_id, CefRefPtr<CefRequest> request);
// Load the specified URL.
void LoadURL(int64 frame_id,
const std::string& url,
const content::Referrer& referrer, const content::Referrer& referrer,
ui::PageTransition transition, ui::PageTransition transition,
const std::string& extra_headers); const std::string& extra_headers);
// Called from CefFrameHostImpl. // Load the specified string.
void OnFrameFocused(CefRefPtr<CefFrameHostImpl> frame); void LoadString(int64 frame_id,
void OnDidFinishLoad(CefRefPtr<CefFrameHostImpl> frame, const std::string& string,
const GURL& validated_url, const std::string& url);
int http_status_code);
// 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. // Open the specified text in the default text editor.
void ViewText(const std::string& text); 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 // Convert from view coordinates to screen coordinates. Potential display
// scaling will be applied to the result. // scaling will be applied to the result.
gfx::Point GetScreenPoint(const gfx::Point& view) const; gfx::Point GetScreenPoint(const gfx::Point& view) const;
@@ -335,9 +364,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
CefRefPtr<CefClient> client() const { return client_; } CefRefPtr<CefClient> client() const { return client_; }
scoped_refptr<CefBrowserInfo> browser_info() const { return browser_info_; } scoped_refptr<CefBrowserInfo> browser_info() const { return browser_info_; }
int browser_id() const; int browser_id() const;
CefRefPtr<CefRequestContextImpl> request_context() const {
return request_context_;
}
// Accessors that must be called on the UI thread. // Accessors that must be called on the UI thread.
content::BrowserContext* GetBrowserContext(); content::BrowserContext* GetBrowserContext();
@@ -387,7 +413,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
void CloseContents(content::WebContents* source) override; void CloseContents(content::WebContents* source) override;
void UpdateTargetURL(content::WebContents* source, const GURL& url) override; void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
bool DidAddMessageToConsole(content::WebContents* source, bool DidAddMessageToConsole(content::WebContents* source,
blink::mojom::ConsoleMessageLevel log_level, int32_t level,
const base::string16& message, const base::string16& message,
int32_t line_no, int32_t line_no,
const base::string16& source_id) override; const base::string16& source_id) override;
@@ -395,13 +421,11 @@ class CefBrowserHostImpl : public CefBrowserHost,
bool proceed, bool proceed,
bool* proceed_to_fire_unload) override; bool* proceed_to_fire_unload) override;
bool TakeFocus(content::WebContents* source, bool reverse) override; bool TakeFocus(content::WebContents* source, bool reverse) override;
bool HandleContextMenu(const content::ContextMenuParams& params) override;
bool HandleContextMenu(content::RenderFrameHost* render_frame_host,
const content::ContextMenuParams& params) override;
content::KeyboardEventProcessingResult PreHandleKeyboardEvent( content::KeyboardEventProcessingResult PreHandleKeyboardEvent(
content::WebContents* source, content::WebContents* source,
const content::NativeWebKeyboardEvent& event) override; const content::NativeWebKeyboardEvent& event) override;
bool HandleKeyboardEvent( void HandleKeyboardEvent(
content::WebContents* source, content::WebContents* source,
const content::NativeWebKeyboardEvent& event) override; const content::NativeWebKeyboardEvent& event) override;
bool PreHandleGestureEvent(content::WebContents* source, bool PreHandleGestureEvent(content::WebContents* source,
@@ -455,7 +479,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
content::MediaResponseCallback callback) override; content::MediaResponseCallback callback) override;
bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host, bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host,
const GURL& security_origin, const GURL& security_origin,
blink::MediaStreamType type) override; content::MediaStreamType type) override;
bool IsNeverVisible(content::WebContents* web_contents) override; bool IsNeverVisible(content::WebContents* web_contents) override;
// content::WebContentsObserver methods. // content::WebContentsObserver methods.
@@ -463,7 +487,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
void RenderFrameHostChanged(content::RenderFrameHost* old_host, void RenderFrameHostChanged(content::RenderFrameHost* old_host,
content::RenderFrameHost* new_host) override; content::RenderFrameHost* new_host) override;
void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; void FrameDeleted(content::RenderFrameHost* render_frame_host) override;
void RenderViewCreated(content::RenderViewHost* render_view_host) override; void RenderViewCreated(content::RenderViewHost* render_view_host) override;
void RenderViewDeleted(content::RenderViewHost* render_view_host) override; void RenderViewDeleted(content::RenderViewHost* render_view_host) override;
void RenderViewReady() override; void RenderViewReady() override;
@@ -500,9 +524,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
void RemoveObserver(Observer* observer); void RemoveObserver(Observer* observer);
bool HasObserver(Observer* observer) const; bool HasObserver(Observer* observer) const;
bool StartAudioMirroring();
bool StopAudioMirroring();
class NavigationLock final { class NavigationLock final {
private: private:
friend class CefBrowserHostImpl; friend class CefBrowserHostImpl;
@@ -528,10 +549,25 @@ class CefBrowserHostImpl : public CefBrowserHost,
scoped_refptr<CefBrowserInfo> browser_info, scoped_refptr<CefBrowserInfo> browser_info,
CefRefPtr<CefBrowserHostImpl> opener, CefRefPtr<CefBrowserHostImpl> opener,
bool is_devtools_popup, bool is_devtools_popup,
CefRefPtr<CefRequestContextImpl> request_context, CefRefPtr<CefRequestContext> request_context,
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate, std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate,
CefRefPtr<CefExtension> extension); 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. // content::NotificationObserver methods.
void Observe(int type, void Observe(int type,
const content::NotificationSource& source, const content::NotificationSource& source,
@@ -543,7 +579,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
content::WebContents* web_contents, content::WebContents* web_contents,
scoped_refptr<CefBrowserInfo> browser_info, scoped_refptr<CefBrowserInfo> browser_info,
CefRefPtr<CefBrowserHostImpl> opener, CefRefPtr<CefBrowserHostImpl> opener,
CefRefPtr<CefRequestContextImpl> request_context, CefRefPtr<CefRequestContext> request_context,
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate, std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate,
CefRefPtr<CefExtension> extension); CefRefPtr<CefExtension> extension);
@@ -566,7 +602,42 @@ class CefBrowserHostImpl : public CefBrowserHost,
// Action to be executed once the navigation lock is released. // Action to be executed once the navigation lock is released.
void set_pending_navigation_action(base::OnceClosure action); 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, void OnLoadStart(CefRefPtr<CefFrame> frame,
ui::PageTransition transition_type); ui::PageTransition transition_type);
void OnLoadError(CefRefPtr<CefFrame> frame, const GURL& url, int error_code); void OnLoadError(CefRefPtr<CefFrame> frame, const GURL& url, int error_code);
@@ -583,11 +654,16 @@ class CefBrowserHostImpl : public CefBrowserHost,
void ConfigureAutoResize(); 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_; CefBrowserSettings settings_;
CefRefPtr<CefClient> client_; CefRefPtr<CefClient> client_;
scoped_refptr<CefBrowserInfo> browser_info_; scoped_refptr<CefBrowserInfo> browser_info_;
CefWindowHandle opener_; CefWindowHandle opener_;
CefRefPtr<CefRequestContextImpl> request_context_; CefRefPtr<CefRequestContext> request_context_;
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate_; std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate_;
const bool is_windowless_; const bool is_windowless_;
const bool is_views_hosted_; const bool is_views_hosted_;
@@ -607,8 +683,26 @@ class CefBrowserHostImpl : public CefBrowserHost,
bool has_document_; bool has_document_;
bool is_fullscreen_; bool is_fullscreen_;
// The currently focused frame, or nullptr if the main frame is focused. // Messages we queue while waiting for the RenderView to be ready. We queue
CefRefPtr<CefFrameHostImpl> focused_frame_; // 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 // Represents the current browser destruction state. Only accessed on the UI
// thread. // thread.
@@ -638,6 +732,9 @@ class CefBrowserHostImpl : public CefBrowserHost,
// Used for managing notification subscriptions. // Used for managing notification subscriptions.
std::unique_ptr<content::NotificationRegistrar> registrar_; std::unique_ptr<content::NotificationRegistrar> registrar_;
// Manages response registrations.
std::unique_ptr<CefResponseManager> response_manager_;
// Used for creating and managing file dialogs. // Used for creating and managing file dialogs.
std::unique_ptr<CefFileDialogManager> file_dialog_manager_; std::unique_ptr<CefFileDialogManager> file_dialog_manager_;
@@ -665,9 +762,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
CefRefPtr<CefExtension> extension_; CefRefPtr<CefExtension> extension_;
bool is_background_host_ = false; bool is_background_host_ = false;
// Used to mirror audio streams
scoped_refptr<CefAudioMirrorDestination> audio_mirror_destination_;
// Used with auto-resize. // Used with auto-resize.
bool auto_resize_enabled_ = false; bool auto_resize_enabled_ = false;
gfx::Size auto_resize_min_; gfx::Size auto_resize_min_;

View File

@@ -6,364 +6,140 @@
#include "libcef/browser/browser_host_impl.h" #include "libcef/browser/browser_host_impl.h"
#include "libcef/browser/thread_util.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" #include "ipc/ipc_message.h"
CefBrowserInfo::FrameInfo::~FrameInfo() { // CefBrowserInfo::RenderIDManager
if (frame_ && !is_main_frame_) {
// Disassociate sub-frames from the browser. CefBrowserInfo::RenderIDManager::RenderIDManager(base::Lock* lock)
frame_->Detach(); : lock_(lock) {
} DCHECK(lock);
} }
CefBrowserInfo::CefBrowserInfo(int browser_id, void CefBrowserInfo::RenderIDManager::add_render_frame_id(
bool is_popup, int render_process_id,
bool is_windowless, int render_routing_id) {
CefRefPtr<CefDictionaryValue> extra_info) 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), : browser_id_(browser_id),
is_popup_(is_popup), is_popup_(is_popup),
is_windowless_(is_windowless), is_windowless_(false),
extra_info_(extra_info) { render_id_manager_(&lock_),
guest_render_id_manager_(&lock_),
frame_tree_node_id_manager_(&lock_) {
DCHECK_GT(browser_id, 0); DCHECK_GT(browser_id, 0);
} }
CefBrowserInfo::~CefBrowserInfo() {} CefBrowserInfo::~CefBrowserInfo() {}
void CefBrowserInfo::set_windowless(bool windowless) {
is_windowless_ = windowless;
}
CefRefPtr<CefBrowserHostImpl> CefBrowserInfo::browser() const { CefRefPtr<CefBrowserHostImpl> CefBrowserInfo::browser() const {
base::AutoLock lock_scope(lock_); base::AutoLock lock_scope(lock_);
return browser_; return browser_;
} }
void CefBrowserInfo::SetBrowser(CefRefPtr<CefBrowserHostImpl> browser) { void CefBrowserInfo::set_browser(CefRefPtr<CefBrowserHostImpl> browser) {
base::AutoLock lock_scope(lock_); base::AutoLock lock_scope(lock_);
browser_ = browser; 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();
} }

View File

@@ -7,172 +7,128 @@
#pragma once #pragma once
#include <set> #include <set>
#include <unordered_map>
#include "include/internal/cef_ptr.h" #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/memory/ref_counted.h"
#include "base/synchronization/lock.h" #include "base/synchronization/lock.h"
#include "base/values.h"
namespace content {
class RenderFrameHost;
}
class CefBrowserHostImpl; class CefBrowserHostImpl;
class CefFrameHostImpl;
// CefBrowserInfo is used to associate a browser ID and render view/process // CefBrowserInfo is used to associate a browser ID and render view/process
// IDs with a particular CefBrowserHostImpl. Render view/process IDs may change // IDs with a particular CefBrowserHostImpl. Render view/process IDs may change
// during the lifetime of a single CefBrowserHostImpl. // during the lifetime of a single CefBrowserHostImpl.
// //
// CefBrowserInfo objects are managed by CefBrowserInfoManager and should not be // CefBrowserInfo objects are managed by CefContentBrowserClient and should not
// created directly. // be created directly.
class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> { class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
public: public:
CefBrowserInfo(int browser_id, class RenderIDManager {
bool is_popup, public:
bool is_windowless, explicit RenderIDManager(base::Lock* lock);
CefRefPtr<CefDictionaryValue> extra_info);
int browser_id() const { return browser_id_; } // 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_popup() const { return is_popup_; }
bool is_windowless() const { return is_windowless_; } 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 void set_windowless(bool windowless);
// has been destroyed.
// 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; CefRefPtr<CefBrowserHostImpl> browser() const;
void set_browser(CefRefPtr<CefBrowserHostImpl> browser);
// 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;
private: private:
friend class base::RefCountedThreadSafe<CefBrowserInfo>; friend class base::RefCountedThreadSafe<CefBrowserInfo>;
virtual ~CefBrowserInfo(); ~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();
int browser_id_; int browser_id_;
bool is_popup_; bool is_popup_;
bool is_windowless_; bool is_windowless_;
CefRefPtr<CefDictionaryValue> extra_info_;
mutable base::Lock lock_; mutable base::Lock lock_;
// The below members must be protected by |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_; 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); DISALLOW_COPY_AND_ASSIGN(CefBrowserInfo);
}; };

View File

@@ -12,7 +12,6 @@
#include "libcef/browser/thread_util.h" #include "libcef/browser/thread_util.h"
#include "libcef/common/cef_messages.h" #include "libcef/common/cef_messages.h"
#include "libcef/common/extensions/extensions_util.h" #include "libcef/common/extensions/extensions_util.h"
#include "libcef/common/values_impl.h"
#include "base/logging.h" #include "base/logging.h"
#include "content/common/view_messages.h" #include "content/common/view_messages.h"
@@ -61,37 +60,50 @@ CefBrowserInfoManager* CefBrowserInfoManager::GetInstance() {
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreateBrowserInfo( scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreateBrowserInfo(
bool is_popup, bool is_popup,
bool is_windowless, bool is_windowless) {
CefRefPtr<CefDictionaryValue> extra_info) {
base::AutoLock lock_scope(browser_info_lock_); base::AutoLock lock_scope(browser_info_lock_);
scoped_refptr<CefBrowserInfo> browser_info = new CefBrowserInfo( scoped_refptr<CefBrowserInfo> browser_info =
++next_browser_id_, is_popup, is_windowless, extra_info); new CefBrowserInfo(++next_browser_id_, is_popup);
browser_info_list_.push_back(browser_info); browser_info_list_.push_back(browser_info);
if (is_windowless)
browser_info->set_windowless(true);
return browser_info; return browser_info;
} }
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreatePopupBrowserInfo( scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreatePopupBrowserInfo(
content::WebContents* new_contents, content::WebContents* new_contents,
bool is_windowless, bool is_windowless) {
CefRefPtr<CefDictionaryValue> extra_info) {
base::AutoLock lock_scope(browser_info_lock_); 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 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 = 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); browser_info_list_.push_back(browser_info);
if (is_windowless)
browser_info->set_windowless(true);
// Continue any pending NewBrowserInfo requests. // Continue any pending NewBrowserInfo requests.
auto it = pending_new_browser_info_map_.find(frame_id); PendingNewBrowserInfoList::iterator it =
if (it != pending_new_browser_info_map_.end()) { 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, SendNewBrowserInfoResponse(render_process_id, browser_info, false,
it->second->reply_msg); info->reply_msg);
pending_new_browser_info_map_.erase(it);
pending_new_browser_info_list_.erase(it);
break;
}
} }
return browser_info; return browser_info;
@@ -144,8 +156,8 @@ bool CefBrowserInfoManager::CanCreateWindow(
auto pending_popup = std::make_unique<CefBrowserInfoManager::PendingPopup>(); auto pending_popup = std::make_unique<CefBrowserInfoManager::PendingPopup>();
pending_popup->step = CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW; pending_popup->step = CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW;
pending_popup->opener_render_process_id = opener->GetProcess()->GetID(); pending_popup->opener_process_id = opener->GetProcess()->GetID();
pending_popup->opener_render_routing_id = opener->GetRoutingID(); pending_popup->opener_frame_id = opener->GetRoutingID();
pending_popup->target_url = target_url; pending_popup->target_url = target_url;
pending_popup->target_frame_name = frame_name; pending_popup->target_frame_name = frame_name;
@@ -156,8 +168,8 @@ bool CefBrowserInfoManager::CanCreateWindow(
if (client.get()) { if (client.get()) {
CefRefPtr<CefLifeSpanHandler> handler = client->GetLifeSpanHandler(); CefRefPtr<CefLifeSpanHandler> handler = client->GetLifeSpanHandler();
if (handler.get()) { if (handler.get()) {
CefRefPtr<CefFrame> opener_frame = browser->GetFrameForHost(opener); CefRefPtr<CefFrame> frame =
DCHECK(opener_frame); browser->GetFrame(pending_popup->opener_frame_id);
CefPopupFeatures cef_features; CefPopupFeatures cef_features;
TranslatePopupFeatures(features, cef_features); TranslatePopupFeatures(features, cef_features);
@@ -175,12 +187,11 @@ bool CefBrowserInfoManager::CanCreateWindow(
#endif #endif
allow = !handler->OnBeforePopup( 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, pending_popup->target_frame_name,
static_cast<cef_window_open_disposition_t>(disposition), user_gesture, static_cast<cef_window_open_disposition_t>(disposition), user_gesture,
cef_features, *window_info, pending_popup->client, cef_features, *window_info, pending_popup->client,
pending_popup->settings, pending_popup->extra_info, pending_popup->settings, no_javascript_access);
no_javascript_access);
} }
} }
@@ -192,7 +203,6 @@ bool CefBrowserInfoManager::CanCreateWindow(
create_params.settings = pending_popup->settings; create_params.settings = pending_popup->settings;
create_params.client = pending_popup->client; create_params.client = pending_popup->client;
create_params.extra_info = pending_popup->extra_info;
pending_popup->platform_delegate = pending_popup->platform_delegate =
CefBrowserPlatformDelegate::Create(create_params); CefBrowserPlatformDelegate::Create(create_params);
@@ -214,14 +224,14 @@ bool CefBrowserInfoManager::CanCreateWindow(
void CefBrowserInfoManager::GetCustomWebContentsView( void CefBrowserInfoManager::GetCustomWebContentsView(
const GURL& target_url, const GURL& target_url,
int opener_render_process_id, int opener_render_process_id,
int opener_render_routing_id, int opener_render_frame_id,
content::WebContentsView** view, content::WebContentsView** view,
content::RenderViewHostDelegateView** delegate_view) { content::RenderViewHostDelegateView** delegate_view) {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
std::unique_ptr<CefBrowserInfoManager::PendingPopup> pending_popup = std::unique_ptr<CefBrowserInfoManager::PendingPopup> pending_popup =
PopPendingPopup(CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW, PopPendingPopup(CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW,
opener_render_process_id, opener_render_routing_id, opener_render_process_id, opener_render_frame_id,
target_url); target_url);
DCHECK(pending_popup.get()); DCHECK(pending_popup.get());
DCHECK(pending_popup->platform_delegate.get()); DCHECK(pending_popup->platform_delegate.get());
@@ -239,39 +249,37 @@ void CefBrowserInfoManager::GetCustomWebContentsView(
void CefBrowserInfoManager::WebContentsCreated( void CefBrowserInfoManager::WebContentsCreated(
const GURL& target_url, const GURL& target_url,
int opener_render_process_id, int opener_render_process_id,
int opener_render_routing_id, int opener_render_frame_id,
CefBrowserSettings& settings, CefBrowserSettings& settings,
CefRefPtr<CefClient>& client, CefRefPtr<CefClient>& client,
std::unique_ptr<CefBrowserPlatformDelegate>& platform_delegate, std::unique_ptr<CefBrowserPlatformDelegate>& platform_delegate) {
CefRefPtr<CefDictionaryValue>& extra_info) {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
std::unique_ptr<CefBrowserInfoManager::PendingPopup> pending_popup = std::unique_ptr<CefBrowserInfoManager::PendingPopup> pending_popup =
PopPendingPopup( PopPendingPopup(
CefBrowserInfoManager::PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW, 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.get());
DCHECK(pending_popup->platform_delegate.get()); DCHECK(pending_popup->platform_delegate.get());
settings = pending_popup->settings; settings = pending_popup->settings;
client = pending_popup->client; client = pending_popup->client;
platform_delegate = std::move(pending_popup->platform_delegate); platform_delegate = std::move(pending_popup->platform_delegate);
extra_info = pending_popup->extra_info;
} }
void CefBrowserInfoManager::OnGetNewBrowserInfo(int render_process_id, void CefBrowserInfoManager::OnGetNewBrowserInfo(int render_process_id,
int render_routing_id, int render_frame_routing_id,
IPC::Message* reply_msg) { IPC::Message* reply_msg) {
DCHECK_NE(render_process_id, content::ChildProcessHost::kInvalidUniqueID); DCHECK_NE(render_process_id, content::ChildProcessHost::kInvalidUniqueID);
DCHECK_GT(render_routing_id, 0); DCHECK_GT(render_frame_routing_id, 0);
DCHECK(reply_msg); DCHECK(reply_msg);
base::AutoLock lock_scope(browser_info_lock_); base::AutoLock lock_scope(browser_info_lock_);
bool is_guest_view = false; bool is_guest_view = false;
scoped_refptr<CefBrowserInfo> browser_info = scoped_refptr<CefBrowserInfo> browser_info = GetBrowserInfo(
GetBrowserInfo(render_process_id, render_routing_id, &is_guest_view); render_process_id, render_frame_routing_id, &is_guest_view);
if (browser_info.get()) { if (browser_info.get()) {
// Send the response immediately. // Send the response immediately.
@@ -280,20 +288,27 @@ void CefBrowserInfoManager::OnGetNewBrowserInfo(int render_process_id,
return; return;
} }
const auto frame_id = #if DCHECK_IS_ON()
CefFrameHostImpl::MakeFrameId(render_process_id, render_routing_id);
// Verify that no request for the same route is currently queued. // 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. // Queue the request.
std::unique_ptr<PendingNewBrowserInfo> pending(new PendingNewBrowserInfo()); std::unique_ptr<PendingNewBrowserInfo> pending(new PendingNewBrowserInfo());
pending->render_process_id = render_process_id; 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->reply_msg = reply_msg;
pending_new_browser_info_map_.insert( pending_new_browser_info_list_.push_back(std::move(pending));
std::make_pair(frame_id, std::move(pending)));
} }
void CefBrowserInfoManager::RemoveBrowserInfo( void CefBrowserInfoManager::RemoveBrowserInfo(
@@ -341,8 +356,8 @@ void CefBrowserInfoManager::DestroyAllBrowsers() {
#endif #endif
} }
scoped_refptr<CefBrowserInfo> scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::GetBrowserInfoForFrame(
CefBrowserInfoManager::GetBrowserInfoForFrameRoute(int render_process_id, int render_process_id,
int render_routing_id, int render_routing_id,
bool* is_guest_view) { bool* is_guest_view) {
base::AutoLock lock_scope(browser_info_lock_); base::AutoLock lock_scope(browser_info_lock_);
@@ -350,23 +365,17 @@ CefBrowserInfoManager::GetBrowserInfoForFrameRoute(int render_process_id,
} }
scoped_refptr<CefBrowserInfo> scoped_refptr<CefBrowserInfo>
CefBrowserInfoManager::GetBrowserInfoForFrameTreeNode(int frame_tree_node_id, CefBrowserInfoManager::GetBrowserInfoForFrameTreeNode(int frame_tree_node_id) {
bool* is_guest_view) {
if (is_guest_view)
*is_guest_view = false;
if (frame_tree_node_id < 0) if (frame_tree_node_id < 0)
return nullptr; return nullptr;
base::AutoLock lock_scope(browser_info_lock_); base::AutoLock lock_scope(browser_info_lock_);
for (const auto& browser_info : browser_info_list_) { BrowserInfoList::const_iterator it = browser_info_list_.begin();
bool is_guest_view_tmp; for (; it != browser_info_list_.end(); ++it) {
auto frame = browser_info->GetFrameForFrameTreeNode(frame_tree_node_id, const scoped_refptr<CefBrowserInfo>& browser_info = *it;
&is_guest_view_tmp); if (browser_info->frame_tree_node_id_manager()->is_frame_tree_node_id_match(
if (frame || is_guest_view_tmp) { frame_tree_node_id)) {
if (is_guest_view)
*is_guest_view = is_guest_view_tmp;
return browser_info; return browser_info;
} }
} }
@@ -374,12 +383,9 @@ CefBrowserInfoManager::GetBrowserInfoForFrameTreeNode(int frame_tree_node_id,
return nullptr; return nullptr;
} }
CefBrowserInfoManager::BrowserInfoList void CefBrowserInfoManager::GetBrowserInfoList(BrowserInfoList& list) {
CefBrowserInfoManager::GetBrowserInfoList() {
base::AutoLock lock_scope(browser_info_lock_); base::AutoLock lock_scope(browser_info_lock_);
BrowserInfoList copy; list = browser_info_list_;
copy.assign(browser_info_list_.begin(), browser_info_list_.end());
return copy;
} }
void CefBrowserInfoManager::RenderProcessHostDestroyed( void CefBrowserInfoManager::RenderProcessHostDestroyed(
@@ -393,12 +399,12 @@ void CefBrowserInfoManager::RenderProcessHostDestroyed(
{ {
base::AutoLock lock_scope(browser_info_lock_); base::AutoLock lock_scope(browser_info_lock_);
PendingNewBrowserInfoMap::iterator it = PendingNewBrowserInfoList::iterator it =
pending_new_browser_info_map_.begin(); pending_new_browser_info_list_.begin();
while (it != pending_new_browser_info_map_.end()) { while (it != pending_new_browser_info_list_.end()) {
auto info = it->second.get(); PendingNewBrowserInfo* info = it->get();
if (info->render_process_id == render_process_id) 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 else
++it; ++it;
} }
@@ -409,7 +415,7 @@ void CefBrowserInfoManager::RenderProcessHostDestroyed(
PendingPopupList::iterator it = pending_popup_list_.begin(); PendingPopupList::iterator it = pending_popup_list_.begin();
while (it != pending_popup_list_.end()) { while (it != pending_popup_list_.end()) {
PendingPopup* popup = it->get(); 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); it = pending_popup_list_.erase(it);
} else { } else {
++it; ++it;
@@ -426,19 +432,18 @@ void CefBrowserInfoManager::PushPendingPopup(
std::unique_ptr<CefBrowserInfoManager::PendingPopup> std::unique_ptr<CefBrowserInfoManager::PendingPopup>
CefBrowserInfoManager::PopPendingPopup(PendingPopup::Step step, CefBrowserInfoManager::PopPendingPopup(PendingPopup::Step step,
int opener_render_process_id, int opener_process_id,
int opener_render_routing_id, int opener_frame_id,
const GURL& target_url) { const GURL& target_url) {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
DCHECK_GT(opener_render_process_id, 0); DCHECK_GT(opener_process_id, 0);
DCHECK_GT(opener_render_routing_id, 0); DCHECK_GT(opener_frame_id, 0);
PendingPopupList::iterator it = pending_popup_list_.begin(); PendingPopupList::iterator it = pending_popup_list_.begin();
for (; it != pending_popup_list_.end(); ++it) { for (; it != pending_popup_list_.end(); ++it) {
PendingPopup* popup = it->get(); PendingPopup* popup = it->get();
if (popup->step == step && if (popup->step == step && popup->opener_process_id == opener_process_id &&
popup->opener_render_process_id == opener_render_process_id && popup->opener_frame_id == opener_frame_id &&
popup->opener_render_routing_id == opener_render_routing_id &&
popup->target_url == target_url) { popup->target_url == target_url) {
// Transfer ownership of the pointer. // Transfer ownership of the pointer.
it->release(); it->release();
@@ -451,24 +456,29 @@ CefBrowserInfoManager::PopPendingPopup(PendingPopup::Step step,
} }
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::GetBrowserInfo( scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::GetBrowserInfo(
int render_process_id, int render_frame_process_id,
int render_routing_id, int render_frame_routing_id,
bool* is_guest_view) { bool* is_guest_view) {
browser_info_lock_.AssertAcquired(); browser_info_lock_.AssertAcquired();
if (is_guest_view) if (is_guest_view)
*is_guest_view = false; *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; return nullptr;
for (const auto& browser_info : browser_info_list_) { BrowserInfoList::const_iterator it = browser_info_list_.begin();
bool is_guest_view_tmp; for (; it != browser_info_list_.end(); ++it) {
auto frame = browser_info->GetFrameForRoute( const scoped_refptr<CefBrowserInfo>& browser_info = *it;
render_process_id, render_routing_id, &is_guest_view_tmp); if (browser_info->render_id_manager()->is_render_frame_id_match(
if (frame || is_guest_view_tmp) { 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) if (is_guest_view)
*is_guest_view = is_guest_view_tmp; *is_guest_view = true;
return browser_info; return browser_info;
} }
} }
@@ -503,14 +513,6 @@ void CefBrowserInfoManager::SendNewBrowserInfoResponse(
params.is_popup = browser_info->is_popup(); params.is_popup = browser_info->is_popup();
params.is_guest_view = is_guest_view; 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(&params.extra_info);
}
CefProcessHostMsg_GetNewBrowserInfo::WriteReplyParams(reply_msg, params); CefProcessHostMsg_GetNewBrowserInfo::WriteReplyParams(reply_msg, params);
host->Send(reply_msg); host->Send(reply_msg);
} }

View File

@@ -8,7 +8,7 @@
#include "include/cef_client.h" #include "include/cef_client.h"
#include <map> #include <list>
#include <memory> #include <memory>
#include <vector> #include <vector>
@@ -16,7 +16,7 @@
#include "base/synchronization/lock.h" #include "base/synchronization/lock.h"
#include "content/public/browser/render_process_host_observer.h" #include "content/public/browser/render_process_host_observer.h"
#include "third_party/blink/public/mojom/window_features/window_features.mojom.h" #include "third_party/blink/public/web/window_features.mojom.h"
#include "ui/base/window_open_disposition.h" #include "ui/base/window_open_disposition.h"
#include "url/gurl.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 // Called from CefBrowserHostImpl::Create when a new browser is being created
// directly. In this case |is_popup| will be true only for DevTools browsers. // directly. In this case |is_popup| will be true only for DevTools browsers.
scoped_refptr<CefBrowserInfo> CreateBrowserInfo( scoped_refptr<CefBrowserInfo> CreateBrowserInfo(bool is_popup,
bool is_popup, bool is_windowless);
bool is_windowless,
CefRefPtr<CefDictionaryValue> extra_info);
// Called from CefBrowserHostImpl::WebContentsCreated when a new browser is // Called from CefBrowserHostImpl::WebContentsCreated when a new browser is
// being created for a traditional popup (e.g. window.open() or targeted // 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. // response will be sent when this method is called.
scoped_refptr<CefBrowserInfo> CreatePopupBrowserInfo( scoped_refptr<CefBrowserInfo> CreatePopupBrowserInfo(
content::WebContents* new_contents, content::WebContents* new_contents,
bool is_windowless, bool is_windowless);
CefRefPtr<CefDictionaryValue> extra_info);
// Called from CefContentBrowserClient::CanCreateWindow. See comments on // Called from CefContentBrowserClient::CanCreateWindow. See comments on
// PendingPopup for more information. // PendingPopup for more information.
@@ -80,7 +77,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
void GetCustomWebContentsView( void GetCustomWebContentsView(
const GURL& target_url, const GURL& target_url,
int opener_render_process_id, int opener_render_process_id,
int opener_render_routing_id, int opener_render_frame_id,
content::WebContentsView** view, content::WebContentsView** view,
content::RenderViewHostDelegateView** delegate_view); content::RenderViewHostDelegateView** delegate_view);
@@ -89,11 +86,10 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
void WebContentsCreated( void WebContentsCreated(
const GURL& target_url, const GURL& target_url,
int opener_render_process_id, int opener_render_process_id,
int opener_render_routing_id, int opener_render_frame_id,
CefBrowserSettings& settings, CefBrowserSettings& settings,
CefRefPtr<CefClient>& client, CefRefPtr<CefClient>& client,
std::unique_ptr<CefBrowserPlatformDelegate>& platform_delegate, std::unique_ptr<CefBrowserPlatformDelegate>& platform_delegate);
CefRefPtr<CefDictionaryValue>& extra_info);
// Called from CefBrowserMessageFilter::OnGetNewBrowserInfo for delivering // Called from CefBrowserMessageFilter::OnGetNewBrowserInfo for delivering
// browser info to the renderer process. If the browser info already exists // browser info to the renderer process. If the browser info already exists
@@ -103,7 +99,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
// already exist for traditional popup browsers depending on timing. See // already exist for traditional popup browsers depending on timing. See
// comments on PendingPopup for more information. // comments on PendingPopup for more information.
void OnGetNewBrowserInfo(int render_process_id, void OnGetNewBrowserInfo(int render_process_id,
int render_routing_id, int render_frame_routing_id,
IPC::Message* reply_msg); IPC::Message* reply_msg);
// Called from CefBrowserHostImpl::DestroyBrowser() when a browser is // 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. // Called from CefContext::FinishShutdownOnUIThread() to destroy all browsers.
void DestroyAllBrowsers(); void DestroyAllBrowsers();
// Returns the CefBrowserInfo matching the specified IDs or nullptr if no // Retrieves the CefBrowserInfo matching the specified IDs or an empty
// match is found. It is allowed to add new callers of this method but // pointer if no match is found. It is allowed to add new callers of this
// consider using CefBrowserHostImpl::GetBrowserForFrameRoute() or // method but consider using CefBrowserHostImpl::GetBrowserForFrame()
// extensions::GetOwnerBrowserForFrameRoute() instead. If |is_guest_view| is // or extensions::GetOwnerBrowserForFrame() instead.
// non-nullptr it will be set to true if the IDs match a guest view associated // |is_guest_view| will be set to true if the IDs match a guest view
// with the returned browser info instead of the browser itself. // associated with the returned browser info instead of the browser itself.
scoped_refptr<CefBrowserInfo> GetBrowserInfoForFrameRoute( scoped_refptr<CefBrowserInfo> GetBrowserInfoForFrame(int render_process_id,
int render_process_id,
int render_routing_id, int render_routing_id,
bool* is_guest_view = nullptr); bool* is_guest_view);
// Returns the CefBrowserInfo matching the specified ID or nullptr if no match // Retrieves the CefBrowserInfo matching the specified ID or an empty
// is found. It is allowed to add new callers of this method but consider // pointer if no match is found. It is allowed to add new callers of this
// using CefBrowserHostImpl::GetBrowserForFrameTreeNode() instead. If // method but consider using CefBrowserHostImpl::GetBrowserForRequest()
// |is_guest_view| is non-nullptr it will be set to true if the IDs match a // instead since we generally use this mapping for URLRequests on the IO
// guest view associated with the returned browser info instead of the browser // thread.
// itself.
scoped_refptr<CefBrowserInfo> GetBrowserInfoForFrameTreeNode( scoped_refptr<CefBrowserInfo> GetBrowserInfoForFrameTreeNode(
int frame_tree_node_id, int frame_tree_node_id);
bool* is_guest_view = nullptr);
// Returns all existing CefBrowserInfo objects. // Retrieves all existing CefBrowserInfo objects.
typedef std::list<scoped_refptr<CefBrowserInfo>> BrowserInfoList; typedef std::list<scoped_refptr<CefBrowserInfo>> BrowserInfoList;
BrowserInfoList GetBrowserInfoList(); void GetBrowserInfoList(BrowserInfoList& list);
private: private:
// RenderProcessHostObserver methods: // RenderProcessHostObserver methods:
@@ -167,15 +160,14 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
// Initial state from ViewHostMsg_CreateWindow. // Initial state from ViewHostMsg_CreateWindow.
// |target_url| will be empty if a popup is created via window.open() and // |target_url| will be empty if a popup is created via window.open() and
// never navigated. For example: javascript:window.open(); // never navigated. For example: javascript:window.open();
int opener_render_process_id; int opener_process_id;
int opener_render_routing_id; int opener_frame_id;
GURL target_url; GURL target_url;
std::string target_frame_name; std::string target_frame_name;
// Values specified by OnBeforePopup. // Values specified by OnBeforePopup.
CefBrowserSettings settings; CefBrowserSettings settings;
CefRefPtr<CefClient> client; CefRefPtr<CefClient> client;
CefRefPtr<CefDictionaryValue> extra_info;
// Platform delegate specific to the new popup. // Platform delegate specific to the new popup.
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate; std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate;
@@ -185,13 +177,13 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
void PushPendingPopup(std::unique_ptr<PendingPopup> popup); void PushPendingPopup(std::unique_ptr<PendingPopup> popup);
std::unique_ptr<PendingPopup> PopPendingPopup(PendingPopup::Step step, std::unique_ptr<PendingPopup> PopPendingPopup(PendingPopup::Step step,
int opener_process_id, int opener_process_id,
int opener_routing_id, int opener_frame_id,
const GURL& target_url); const GURL& target_url);
// Retrieves the BrowserInfo matching the specified IDs. If both sets are // Retrieves the BrowserInfo matching the specified IDs. If both sets are
// valid then this method makes sure both sets have been registered. // valid then this method makes sure both sets have been registered.
scoped_refptr<CefBrowserInfo> GetBrowserInfo(int render_process_id, scoped_refptr<CefBrowserInfo> GetBrowserInfo(int render_frame_process_id,
int render_routing_id, int render_frame_routing_id,
bool* is_guest_view); bool* is_guest_view);
// Send the response for a pending OnGetNewBrowserInfo request. // Send the response for a pending OnGetNewBrowserInfo request.
@@ -204,7 +196,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
// Pending request for OnGetNewBrowserInfo. // Pending request for OnGetNewBrowserInfo.
struct PendingNewBrowserInfo { struct PendingNewBrowserInfo {
int render_process_id; int render_process_id;
int render_routing_id; int render_frame_routing_id;
IPC::Message* reply_msg; IPC::Message* reply_msg;
}; };
@@ -215,10 +207,9 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
BrowserInfoList browser_info_list_; BrowserInfoList browser_info_list_;
int next_browser_id_; int next_browser_id_;
// Map of frame ID to info. using PendingNewBrowserInfoList =
using PendingNewBrowserInfoMap = std::vector<std::unique_ptr<PendingNewBrowserInfo>>;
std::map<int64_t, std::unique_ptr<PendingNewBrowserInfo>>; PendingNewBrowserInfoList pending_new_browser_info_list_;
PendingNewBrowserInfoMap pending_new_browser_info_map_;
// Only accessed on the UI thread. // Only accessed on the UI thread.
using PendingPopupList = std::vector<std::unique_ptr<PendingPopup>>; using PendingPopupList = std::vector<std::unique_ptr<PendingPopup>>;

View File

@@ -8,11 +8,11 @@
#include <string> #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/browser_context_keyed_service_factories.h"
#include "libcef/browser/content_browser_client.h" #include "libcef/browser/content_browser_client.h"
#include "libcef/browser/context.h" #include "libcef/browser/context.h"
#include "libcef/browser/devtools/devtools_manager_delegate.h" #include "libcef/browser/devtools_manager_delegate.h"
#include "libcef/browser/extensions/extension_system_factory.h" #include "libcef/browser/extensions/extension_system_factory.h"
#include "libcef/browser/extensions/extensions_browser_client.h" #include "libcef/browser/extensions/extensions_browser_client.h"
#include "libcef/browser/net/chrome_scheme_handler.h" #include "libcef/browser/net/chrome_scheme_handler.h"
@@ -21,15 +21,12 @@
#include "libcef/common/extensions/extensions_client.h" #include "libcef/common/extensions/extensions_client.h"
#include "libcef/common/extensions/extensions_util.h" #include "libcef/common/extensions/extensions_util.h"
#include "libcef/common/net/net_resource_provider.h" #include "libcef/common/net/net_resource_provider.h"
#include "libcef/common/net_service/util.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_browser_main_extra_parts.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 "chrome/browser/plugins/plugin_finder.h"
#include "content/public/browser/gpu_data_manager.h" #include "content/public/browser/gpu_data_manager.h"
#include "extensions/browser/extension_system.h" #include "extensions/browser/extension_system.h"
@@ -39,10 +36,6 @@
#include "ui/base/material_design/material_design_controller.h" #include "ui/base/material_design/material_design_controller.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#if defined(USE_AURA) && defined(USE_X11)
#include "ui/events/devices/x11/touch_factory_x11.h"
#endif
#if defined(USE_AURA) #if defined(USE_AURA)
#include "ui/aura/env.h" #include "ui/aura/env.h"
#include "ui/display/screen.h" #include "ui/display/screen.h"
@@ -56,18 +49,13 @@
#endif // defined(USE_AURA) #endif // defined(USE_AURA)
#if defined(USE_AURA) && defined(OS_LINUX) #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 #endif
#if defined(OS_LINUX) #if defined(OS_LINUX)
#include "libcef/browser/printing/print_dialog_linux.h" #include "libcef/browser/printing/print_dialog_linux.h"
#endif #endif
#if defined(OS_MACOSX)
#include "chrome/browser/browser_process.h"
#include "components/os_crypt/os_crypt.h"
#endif
CefBrowserMainParts::CefBrowserMainParts( CefBrowserMainParts::CefBrowserMainParts(
const content::MainFunctionParams& parameters) const content::MainFunctionParams& parameters)
: BrowserMainParts(), devtools_delegate_(NULL) {} : BrowserMainParts(), devtools_delegate_(NULL) {}
@@ -119,19 +107,6 @@ void CefBrowserMainParts::ToolkitInitialized() {
} }
void CefBrowserMainParts::PreMainMessageLoopStart() { void CefBrowserMainParts::PreMainMessageLoopStart() {
#if defined(USE_AURA) && defined(USE_X11)
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) for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PreMainMessageLoopStart(); chrome_extra_parts_[i]->PreMainMessageLoopStart();
} }
@@ -155,13 +130,9 @@ int CefBrowserMainParts::PreCreateThreads() {
net::NetModule::SetResourceProvider(&NetResourceProvider); 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. // before the IO thread is started.
content::GpuDataManager::GetInstance(); 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) for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PreCreateThreads(); chrome_extra_parts_[i]->PreCreateThreads();
@@ -219,7 +190,7 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
// Create the global RequestContext. // Create the global RequestContext.
global_request_context_ = global_request_context_ =
CefRequestContextImpl::CreateGlobalRequestContext(settings); CefRequestContextImpl::CreateGlobalRequestContext(settings);
CefBrowserContext* browser_context = static_cast<CefBrowserContext*>( CefBrowserContextImpl* browser_context = static_cast<CefBrowserContextImpl*>(
global_request_context_->GetBrowserContext()); global_request_context_->GetBrowserContext());
PostProfileInit(); PostProfileInit();

View File

@@ -6,7 +6,7 @@
#define CEF_LIBCEF_BROWSER_BROWSER_MAIN_H_ #define CEF_LIBCEF_BROWSER_BROWSER_MAIN_H_
#pragma once #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 "libcef/browser/request_context_impl.h"
#include "base/macros.h" #include "base/macros.h"

View File

@@ -7,21 +7,16 @@
#include "libcef/common/content_client.h" #include "libcef/common/content_client.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/message_loop/message_pump.h"
#include "base/message_loop/message_pump_for_ui.h"
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
#include "base/mac/scoped_nsautorelease_pool.h" #include "base/mac/scoped_nsautorelease_pool.h"
#include "base/message_loop/message_pump_mac.h"
#endif #endif
#include "content/public/browser/browser_thread.h"
namespace { namespace {
// MessagePump implementation that delegates to OnScheduleMessagePumpWork() for // MessagePump implementation that delegates to OnScheduleMessagePumpWork() for
// scheduling. // scheduling.
class MessagePumpExternal : public base::MessagePumpForUI { class MessagePumpExternal : public base::MessagePump {
public: public:
MessagePumpExternal(float max_time_slice, MessagePumpExternal(float max_time_slice,
CefRefPtr<CefBrowserProcessHandler> handler) CefRefPtr<CefBrowserProcessHandler> handler)
@@ -87,27 +82,23 @@ CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() {
return nullptr; return nullptr;
} }
std::unique_ptr<base::MessagePump> MessagePumpFactoryForUI() { std::unique_ptr<base::MessagePump> CreatePump() {
if (!content::BrowserThread::IsThreadInitialized( const CefSettings& settings = CefContext::Get()->settings();
content::BrowserThread::UI) || if (settings.external_message_pump) {
content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) {
CefRefPtr<CefBrowserProcessHandler> handler = GetBrowserProcessHandler(); CefRefPtr<CefBrowserProcessHandler> handler = GetBrowserProcessHandler();
if (handler) if (handler)
return std::make_unique<MessagePumpExternal>(0.01f, handler); return base::WrapUnique(new MessagePumpExternal(0.01f, handler));
} }
#if defined(OS_MACOSX) return base::MessageLoop::CreateMessagePumpForType(
return base::MessagePumpMac::Create(); base::MessageLoop::TYPE_UI);
#else
return std::make_unique<base::MessagePumpForUI>();
#endif
} }
} // namespace } // namespace
void InitMessagePumpFactoryForUI() { CefBrowserMessageLoop::CefBrowserMessageLoop()
const CefSettings& settings = CefContext::Get()->settings(); : base::MessageLoopForUI(CreatePump()) {
if (settings.external_message_pump) { BindToCurrentThread();
base::MessagePump::OverrideMessagePumpForUIFactory(MessagePumpFactoryForUI);
}
} }
CefBrowserMessageLoop::~CefBrowserMessageLoop() {}

View File

@@ -4,7 +4,21 @@
#ifndef CEF_LIBCEF_BROWSER_BROWSER_MESSAGE_LOOP_H_ #ifndef CEF_LIBCEF_BROWSER_BROWSER_MESSAGE_LOOP_H_
#define CEF_LIBCEF_BROWSER_BROWSER_MESSAGE_LOOP_H_ #define CEF_LIBCEF_BROWSER_BROWSER_MESSAGE_LOOP_H_
#pragma once
void InitMessagePumpFactoryForUI(); #include "base/macros.h"
#include "base/message_loop/message_loop.h"
// Class used to process events on the current message loop.
class CefBrowserMessageLoop : public base::MessageLoopForUI {
typedef base::MessageLoopForUI inherited;
public:
CefBrowserMessageLoop();
~CefBrowserMessageLoop() override;
private:
DISALLOW_COPY_AND_ASSIGN(CefBrowserMessageLoop);
};
#endif // CEF_LIBCEF_BROWSER_BROWSER_MESSAGE_LOOP_H_ #endif // CEF_LIBCEF_BROWSER_BROWSER_MESSAGE_LOOP_H_

View File

@@ -22,7 +22,6 @@ namespace blink {
class WebMouseEvent; class WebMouseEvent;
class WebMouseWheelEvent; class WebMouseWheelEvent;
class WebInputEvent; class WebInputEvent;
class WebTouchEvent;
} // namespace blink } // namespace blink
namespace content { namespace content {
@@ -151,9 +150,6 @@ class CefBrowserPlatformDelegate {
virtual void SendMouseEvent(const blink::WebMouseEvent& event) = 0; virtual void SendMouseEvent(const blink::WebMouseEvent& event) = 0;
virtual void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event) = 0; virtual void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event) = 0;
// Send touch events.
virtual void SendTouchEvent(const CefTouchEvent& event) = 0;
// Send focus event. The browser's WebContents may be NULL when this method is // Send focus event. The browser's WebContents may be NULL when this method is
// called. // called.
virtual void SendFocusEvent(bool setFocus) = 0; virtual void SendFocusEvent(bool setFocus) = 0;
@@ -180,11 +176,11 @@ class CefBrowserPlatformDelegate {
// Forward the keyboard event to the application or frame window to allow // Forward the keyboard event to the application or frame window to allow
// processing of shortcut keys. // processing of shortcut keys.
virtual bool HandleKeyboardEvent( virtual void HandleKeyboardEvent(
const content::NativeWebKeyboardEvent& event) = 0; const content::NativeWebKeyboardEvent& event) = 0;
// Invoke platform specific handling for the external protocol. // 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. // Translate CEF events to Chromium/Blink events.
virtual void TranslateKeyEvent(content::NativeWebKeyboardEvent& result, virtual void TranslateKeyEvent(content::NativeWebKeyboardEvent& result,

View File

@@ -46,7 +46,7 @@ std::unique_ptr<CefBrowserPlatformDelegateNative> CreateNativeDelegate(
window_info, background_color); window_info, background_color);
#elif defined(OS_LINUX) #elif defined(OS_LINUX)
return std::make_unique<CefBrowserPlatformDelegateNativeLinux>( return std::make_unique<CefBrowserPlatformDelegateNativeLinux>(
window_info, background_color, use_external_begin_frame); window_info, background_color);
#endif #endif
} }

View File

@@ -2,7 +2,7 @@
// reserved. Use of this source code is governed by a BSD-style license that can // reserved. Use of this source code is governed by a BSD-style license that can
// be found in the LICENSE file. // 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 <string>
#include <utility> #include <utility>
@@ -36,7 +36,7 @@ namespace {
class CefURLFetcherDelegate : public net::URLFetcherDelegate { class CefURLFetcherDelegate : public net::URLFetcherDelegate {
public: public:
CefURLFetcherDelegate(CefBrowserURLRequestOld::Context* context, CefURLFetcherDelegate(CefBrowserURLRequest::Context* context,
int request_flags); int request_flags);
~CefURLFetcherDelegate() override; ~CefURLFetcherDelegate() override;
@@ -52,14 +52,14 @@ class CefURLFetcherDelegate : public net::URLFetcherDelegate {
private: private:
// The context_ pointer will outlive this object. // The context_ pointer will outlive this object.
CefBrowserURLRequestOld::Context* context_; CefBrowserURLRequest::Context* context_;
int request_flags_; int request_flags_;
}; };
class CefURLFetcherResponseWriter : public net::URLFetcherResponseWriter { class CefURLFetcherResponseWriter : public net::URLFetcherResponseWriter {
public: public:
CefURLFetcherResponseWriter( CefURLFetcherResponseWriter(
CefRefPtr<CefBrowserURLRequestOld> url_request, CefRefPtr<CefBrowserURLRequest> url_request,
scoped_refptr<base::SequencedTaskRunner> task_runner) scoped_refptr<base::SequencedTaskRunner> task_runner)
: url_request_(url_request), task_runner_(task_runner) {} : url_request_(url_request), task_runner_(task_runner) {}
@@ -91,7 +91,7 @@ class CefURLFetcherResponseWriter : public net::URLFetcherResponseWriter {
private: private:
static void WriteOnClientThread( static void WriteOnClientThread(
CefRefPtr<CefBrowserURLRequestOld> url_request, CefRefPtr<CefBrowserURLRequest> url_request,
scoped_refptr<net::IOBuffer> buffer, scoped_refptr<net::IOBuffer> buffer,
int num_bytes, int num_bytes,
net::CompletionOnceCallback callback, net::CompletionOnceCallback callback,
@@ -111,7 +111,7 @@ class CefURLFetcherResponseWriter : public net::URLFetcherResponseWriter {
std::move(callback).Run(num_bytes); std::move(callback).Run(num_bytes);
} }
CefRefPtr<CefBrowserURLRequestOld> url_request_; CefRefPtr<CefBrowserURLRequest> url_request_;
scoped_refptr<base::SequencedTaskRunner> task_runner_; scoped_refptr<base::SequencedTaskRunner> task_runner_;
DISALLOW_COPY_AND_ASSIGN(CefURLFetcherResponseWriter); DISALLOW_COPY_AND_ASSIGN(CefURLFetcherResponseWriter);
@@ -124,13 +124,12 @@ std::unique_ptr<base::SupportsUserData::Data> CreateURLRequestUserData(
} // namespace } // namespace
// CefBrowserURLRequestOld::Context // CefBrowserURLRequest::Context ----------------------------------------------
// ----------------------------------------------
class CefBrowserURLRequestOld::Context class CefBrowserURLRequest::Context
: public base::RefCountedThreadSafe<CefBrowserURLRequestOld::Context> { : public base::RefCountedThreadSafe<CefBrowserURLRequest::Context> {
public: public:
Context(CefRefPtr<CefBrowserURLRequestOld> url_request, Context(CefRefPtr<CefBrowserURLRequest> url_request,
CefRefPtr<CefRequest> request, CefRefPtr<CefRequest> request,
CefRefPtr<CefURLRequestClient> client, CefRefPtr<CefURLRequestClient> client,
CefRefPtr<CefRequestContext> request_context) CefRefPtr<CefRequestContext> request_context)
@@ -178,11 +177,9 @@ class CefBrowserURLRequestOld::Context
base::PostTaskWithTraitsAndReply( base::PostTaskWithTraitsAndReply(
FROM_HERE, {BrowserThread::UI}, FROM_HERE, {BrowserThread::UI},
base::Bind( base::Bind(&CefBrowserURLRequest::Context::GetRequestContextOnUIThread,
&CefBrowserURLRequestOld::Context::GetRequestContextOnUIThread,
this), this),
base::Bind( base::Bind(&CefBrowserURLRequest::Context::ContinueOnOriginatingThread,
&CefBrowserURLRequestOld::Context::ContinueOnOriginatingThread,
this, url, request_type)); this, url, request_type));
return true; return true;
@@ -333,7 +330,7 @@ class CefBrowserURLRequestOld::Context
bool response_was_cached() const { return response_was_cached_; } bool response_was_cached() const { return response_was_cached_; }
private: private:
friend class base::RefCountedThreadSafe<CefBrowserURLRequestOld::Context>; friend class base::RefCountedThreadSafe<CefBrowserURLRequest::Context>;
~Context() { ~Context() {
if (fetcher_.get()) { if (fetcher_.get()) {
@@ -372,7 +369,7 @@ class CefBrowserURLRequestOld::Context
} }
// Members only accessed on the initialization thread. // Members only accessed on the initialization thread.
CefRefPtr<CefBrowserURLRequestOld> url_request_; CefRefPtr<CefBrowserURLRequest> url_request_;
CefRefPtr<CefRequest> request_; CefRefPtr<CefRequest> request_;
CefRefPtr<CefURLRequestClient> client_; CefRefPtr<CefURLRequestClient> client_;
CefRefPtr<CefRequestContext> request_context_; CefRefPtr<CefRequestContext> request_context_;
@@ -394,7 +391,7 @@ class CefBrowserURLRequestOld::Context
namespace { namespace {
CefURLFetcherDelegate::CefURLFetcherDelegate( CefURLFetcherDelegate::CefURLFetcherDelegate(
CefBrowserURLRequestOld::Context* context, CefBrowserURLRequest::Context* context,
int request_flags) int request_flags)
: context_(context), request_flags_(request_flags) {} : context_(context), request_flags_(request_flags) {}
@@ -405,7 +402,7 @@ void CefURLFetcherDelegate::OnURLFetchComplete(const net::URLFetcher* source) {
// in the call stack. // in the call stack.
CefTaskRunnerImpl::GetCurrentTaskRunner()->PostTask( CefTaskRunnerImpl::GetCurrentTaskRunner()->PostTask(
FROM_HERE, FROM_HERE,
base::Bind(&CefBrowserURLRequestOld::Context::OnComplete, context_)); base::Bind(&CefBrowserURLRequest::Context::OnComplete, context_));
} }
void CefURLFetcherDelegate::OnURLFetchDownloadProgress( void CefURLFetcherDelegate::OnURLFetchDownloadProgress(
@@ -426,67 +423,66 @@ void CefURLFetcherDelegate::OnURLFetchUploadProgress(
} // namespace } // namespace
// CefBrowserURLRequestOld // CefBrowserURLRequest -------------------------------------------------------
// -------------------------------------------------------
CefBrowserURLRequestOld::CefBrowserURLRequestOld( CefBrowserURLRequest::CefBrowserURLRequest(
CefRefPtr<CefRequest> request, CefRefPtr<CefRequest> request,
CefRefPtr<CefURLRequestClient> client, CefRefPtr<CefURLRequestClient> client,
CefRefPtr<CefRequestContext> request_context) { CefRefPtr<CefRequestContext> request_context) {
context_ = new Context(this, request, client, request_context); context_ = new Context(this, request, client, request_context);
} }
CefBrowserURLRequestOld::~CefBrowserURLRequestOld() {} CefBrowserURLRequest::~CefBrowserURLRequest() {}
bool CefBrowserURLRequestOld::Start() { bool CefBrowserURLRequest::Start() {
if (!VerifyContext()) if (!VerifyContext())
return false; return false;
return context_->Start(); return context_->Start();
} }
CefRefPtr<CefRequest> CefBrowserURLRequestOld::GetRequest() { CefRefPtr<CefRequest> CefBrowserURLRequest::GetRequest() {
if (!VerifyContext()) if (!VerifyContext())
return NULL; return NULL;
return context_->request(); return context_->request();
} }
CefRefPtr<CefURLRequestClient> CefBrowserURLRequestOld::GetClient() { CefRefPtr<CefURLRequestClient> CefBrowserURLRequest::GetClient() {
if (!VerifyContext()) if (!VerifyContext())
return NULL; return NULL;
return context_->client(); return context_->client();
} }
CefURLRequest::Status CefBrowserURLRequestOld::GetRequestStatus() { CefURLRequest::Status CefBrowserURLRequest::GetRequestStatus() {
if (!VerifyContext()) if (!VerifyContext())
return UR_UNKNOWN; return UR_UNKNOWN;
return context_->status(); return context_->status();
} }
CefURLRequest::ErrorCode CefBrowserURLRequestOld::GetRequestError() { CefURLRequest::ErrorCode CefBrowserURLRequest::GetRequestError() {
if (!VerifyContext()) if (!VerifyContext())
return ERR_NONE; return ERR_NONE;
return context_->error_code(); return context_->error_code();
} }
CefRefPtr<CefResponse> CefBrowserURLRequestOld::GetResponse() { CefRefPtr<CefResponse> CefBrowserURLRequest::GetResponse() {
if (!VerifyContext()) if (!VerifyContext())
return NULL; return NULL;
return context_->response(); return context_->response();
} }
bool CefBrowserURLRequestOld::ResponseWasCached() { bool CefBrowserURLRequest::ResponseWasCached() {
if (!VerifyContext()) if (!VerifyContext())
return false; return false;
return context_->response_was_cached(); return context_->response_was_cached();
} }
void CefBrowserURLRequestOld::Cancel() { void CefBrowserURLRequest::Cancel() {
if (!VerifyContext()) if (!VerifyContext())
return; return;
return context_->Cancel(); return context_->Cancel();
} }
bool CefBrowserURLRequestOld::VerifyContext() { bool CefBrowserURLRequest::VerifyContext() {
DCHECK(context_.get()); DCHECK(context_.get());
if (!context_->CalledOnValidThread()) { if (!context_->CalledOnValidThread()) {
NOTREACHED() << "called on invalid thread"; NOTREACHED() << "called on invalid thread";

View File

@@ -2,21 +2,21 @@
// reserved. Use of this source code is governed by a BSD-style license that can // reserved. Use of this source code is governed by a BSD-style license that can
// be found in the LICENSE file. // be found in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_NET_BROWSER_URLREQUEST_OLD_IMPL_H_ #ifndef CEF_LIBCEF_BROWSER_BROWSER_URLREQUEST_IMPL_H_
#define CEF_LIBCEF_BROWSER_NET_BROWSER_URLREQUEST_OLD_IMPL_H_ #define CEF_LIBCEF_BROWSER_BROWSER_URLREQUEST_IMPL_H_
#include "include/cef_urlrequest.h" #include "include/cef_urlrequest.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
class CefBrowserURLRequestOld : public CefURLRequest { class CefBrowserURLRequest : public CefURLRequest {
public: public:
class Context; class Context;
CefBrowserURLRequestOld(CefRefPtr<CefRequest> request, CefBrowserURLRequest(CefRefPtr<CefRequest> request,
CefRefPtr<CefURLRequestClient> client, CefRefPtr<CefURLRequestClient> client,
CefRefPtr<CefRequestContext> request_context); CefRefPtr<CefRequestContext> request_context);
~CefBrowserURLRequestOld() override; ~CefBrowserURLRequest() override;
bool Start(); bool Start();
@@ -34,7 +34,7 @@ class CefBrowserURLRequestOld : public CefURLRequest {
scoped_refptr<Context> context_; 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_

View File

@@ -5,25 +5,17 @@
#include "libcef/browser/chrome_browser_process_stub.h" #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/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/browser/thread_util.h"
#include "libcef/common/cef_switches.h" #include "libcef/common/cef_switches.h"
#include "libcef/common/net_service/util.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "chrome/browser/net/system_network_context_manager.h" #include "chrome/browser/net/chrome_net_log_helper.h"
#include "chrome/browser/policy/chrome_browser_policy_connector.h"
#include "chrome/browser/printing/print_job_manager.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/chrome_net_log.h"
#include "components/net_log/net_export_file_writer.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 "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/network_switches.h"
#include "services/network/public/cpp/shared_url_loader_factory.h" #include "services/network/public/cpp/shared_url_loader_factory.h"
@@ -31,10 +23,14 @@ ChromeBrowserProcessStub::ChromeBrowserProcessStub()
: initialized_(false), : initialized_(false),
context_initialized_(false), context_initialized_(false),
shutdown_(false), shutdown_(false),
locale_("en-US") {} locale_("en-US") {
chrome::SetBrowserContextIncognitoHelper(this);
}
ChromeBrowserProcessStub::~ChromeBrowserProcessStub() { ChromeBrowserProcessStub::~ChromeBrowserProcessStub() {
DCHECK((!initialized_ && !context_initialized_) || shutdown_); DCHECK((!initialized_ && !context_initialized_) || shutdown_);
g_browser_process = NULL;
chrome::SetBrowserContextIncognitoHelper(nullptr);
} }
void ChromeBrowserProcessStub::Initialize() { void ChromeBrowserProcessStub::Initialize() {
@@ -42,9 +38,6 @@ void ChromeBrowserProcessStub::Initialize() {
DCHECK(!context_initialized_); DCHECK(!context_initialized_);
DCHECK(!shutdown_); DCHECK(!shutdown_);
// Initialize this early before any code tries to check feature flags.
content::SetUpFieldTrialsAndFeatureList();
initialized_ = true; initialized_ = true;
} }
@@ -77,31 +70,16 @@ void ChromeBrowserProcessStub::Shutdown() {
profile_manager_.reset(); profile_manager_.reset();
event_router_forwarder_ = nullptr; 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; shutdown_ = true;
} }
void ChromeBrowserProcessStub::ResourceDispatcherHostCreated() { void ChromeBrowserProcessStub::ResourceDispatcherHostCreated() {
NOTREACHED(); NOTREACHED();
} };
void ChromeBrowserProcessStub::EndSession() { void ChromeBrowserProcessStub::EndSession() {
NOTREACHED(); NOTREACHED();
} };
void ChromeBrowserProcessStub::FlushLocalStateAndReply( void ChromeBrowserProcessStub::FlushLocalStateAndReply(
base::OnceClosure reply) { base::OnceClosure reply) {
@@ -130,8 +108,8 @@ IOThread* ChromeBrowserProcessStub::io_thread() {
SystemNetworkContextManager* SystemNetworkContextManager*
ChromeBrowserProcessStub::system_network_context_manager() { ChromeBrowserProcessStub::system_network_context_manager() {
DCHECK(SystemNetworkContextManager::GetInstance()); NOTREACHED();
return SystemNetworkContextManager::GetInstance(); return NULL;
} }
net_log::NetExportFileWriter* net_log::NetExportFileWriter*
@@ -159,17 +137,9 @@ ProfileManager* ChromeBrowserProcessStub::profile_manager() {
} }
PrefService* ChromeBrowserProcessStub::local_state() { PrefService* ChromeBrowserProcessStub::local_state() {
DCHECK(initialized_); DCHECK(context_initialized_);
if (!local_state_) { return profile_manager_->GetLastUsedProfile(profile_manager_->user_data_dir())
const CefSettings& settings = CefContext::Get()->settings(); ->GetPrefs();
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();
} }
net::URLRequestContextGetter* net::URLRequestContextGetter*
@@ -213,15 +183,13 @@ ChromeBrowserProcessStub::notification_platform_bridge() {
policy::ChromeBrowserPolicyConnector* policy::ChromeBrowserPolicyConnector*
ChromeBrowserProcessStub::browser_policy_connector() { ChromeBrowserProcessStub::browser_policy_connector() {
if (!browser_policy_connector_) { NOTREACHED();
browser_policy_connector_ = return NULL;
std::make_unique<policy::ChromeBrowserPolicyConnector>();
}
return browser_policy_connector_.get();
} }
policy::PolicyService* ChromeBrowserProcessStub::policy_service() { policy::PolicyService* ChromeBrowserProcessStub::policy_service() {
return browser_policy_connector()->GetPolicyService(); NOTREACHED();
return NULL;
} }
IconManager* ChromeBrowserProcessStub::icon_manager() { IconManager* ChromeBrowserProcessStub::icon_manager() {
@@ -275,8 +243,9 @@ const std::string& ChromeBrowserProcessStub::GetApplicationLocale() {
return locale_; return locale_;
} }
void ChromeBrowserProcessStub::SetApplicationLocale(const std::string& locale) { void ChromeBrowserProcessStub::SetApplicationLocale(
locale_ = locale; const std::string& actual_locale) {
locale_ = actual_locale;
} }
DownloadStatusUpdater* ChromeBrowserProcessStub::download_status_updater() { DownloadStatusUpdater* ChromeBrowserProcessStub::download_status_updater() {
@@ -315,7 +284,7 @@ ChromeBrowserProcessStub::safe_browsing_detection_service() {
return NULL; return NULL;
} }
subresource_filter::RulesetService* subresource_filter::ContentRulesetService*
ChromeBrowserProcessStub::subresource_filter_ruleset_service() { ChromeBrowserProcessStub::subresource_filter_ruleset_service() {
NOTREACHED(); NOTREACHED();
return NULL; return NULL;
@@ -327,11 +296,6 @@ ChromeBrowserProcessStub::optimization_guide_service() {
return NULL; return NULL;
} }
StartupData* ChromeBrowserProcessStub::startup_data() {
NOTREACHED();
return NULL;
}
#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
void ChromeBrowserProcessStub::StartAutoupdateTimer() {} void ChromeBrowserProcessStub::StartAutoupdateTimer() {}
#endif #endif
@@ -345,8 +309,7 @@ net_log::ChromeNetLog* ChromeBrowserProcessStub::net_log() {
if (command_line.HasSwitch(network::switches::kLogNetLog)) { if (command_line.HasSwitch(network::switches::kLogNetLog)) {
net_log_->StartWritingToFile( net_log_->StartWritingToFile(
command_line.GetSwitchValuePath(network::switches::kLogNetLog), command_line.GetSwitchValuePath(network::switches::kLogNetLog),
net::GetNetCaptureModeFromCommandLine(command_line, GetNetCaptureModeFromCommandLine(command_line),
network::switches::kLogNetLog),
command_line.GetCommandLineString(), std::string()); command_line.GetCommandLineString(), std::string());
} }
} }
@@ -398,14 +361,20 @@ resource_coordinator::TabManager* ChromeBrowserProcessStub::GetTabManager() {
return NULL; return NULL;
} }
resource_coordinator::ResourceCoordinatorParts*
ChromeBrowserProcessStub::resource_coordinator_parts() {
NOTREACHED();
return NULL;
}
prefs::InProcessPrefServiceFactory* prefs::InProcessPrefServiceFactory*
ChromeBrowserProcessStub::pref_service_factory() const { ChromeBrowserProcessStub::pref_service_factory() const {
NOTREACHED(); NOTREACHED();
return NULL; return NULL;
} }
content::BrowserContext*
ChromeBrowserProcessStub::GetBrowserContextRedirectedInIncognito(
content::BrowserContext* context) {
return CefBrowserContextImpl::GetForContext(context);
}
content::BrowserContext*
ChromeBrowserProcessStub::GetBrowserContextOwnInstanceInIncognito(
content::BrowserContext* context) {
return GetBrowserContextRedirectedInIncognito(context);
}

View File

@@ -15,6 +15,7 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/event_router_forwarder.h" #include "chrome/browser/extensions/event_router_forwarder.h"
#include "chrome/browser/profiles/incognito_helpers.h"
#include "media/media_buildflags.h" #include "media/media_buildflags.h"
class ChromeProfileManagerStub; class ChromeProfileManagerStub;
@@ -28,7 +29,8 @@ class BackgroundModeManager {
DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager); DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager);
}; };
class ChromeBrowserProcessStub : public BrowserProcess { class ChromeBrowserProcessStub : public BrowserProcess,
public chrome::BrowserContextIncognitoHelper {
public: public:
ChromeBrowserProcessStub(); ChromeBrowserProcessStub();
~ChromeBrowserProcessStub() override; ~ChromeBrowserProcessStub() override;
@@ -73,7 +75,7 @@ class ChromeBrowserProcessStub : public BrowserProcess {
printing::BackgroundPrintingManager* background_printing_manager() override; printing::BackgroundPrintingManager* background_printing_manager() override;
IntranetRedirectDetector* intranet_redirect_detector() override; IntranetRedirectDetector* intranet_redirect_detector() override;
const std::string& GetApplicationLocale() override; const std::string& GetApplicationLocale() override;
void SetApplicationLocale(const std::string& locale) override; void SetApplicationLocale(const std::string& actual_locale) override;
DownloadStatusUpdater* download_status_updater() override; DownloadStatusUpdater* download_status_updater() override;
DownloadRequestLimiter* download_request_limiter() override; DownloadRequestLimiter* download_request_limiter() override;
BackgroundModeManager* background_mode_manager() override; BackgroundModeManager* background_mode_manager() override;
@@ -83,11 +85,10 @@ class ChromeBrowserProcessStub : public BrowserProcess {
safe_browsing::SafeBrowsingService* safe_browsing_service() override; safe_browsing::SafeBrowsingService* safe_browsing_service() override;
safe_browsing::ClientSideDetectionService* safe_browsing_detection_service() safe_browsing::ClientSideDetectionService* safe_browsing_detection_service()
override; override;
subresource_filter::RulesetService* subresource_filter_ruleset_service() subresource_filter::ContentRulesetService*
override; subresource_filter_ruleset_service() override;
optimization_guide::OptimizationGuideService* optimization_guide_service() optimization_guide::OptimizationGuideService* optimization_guide_service()
override; override;
StartupData* startup_data() override;
#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
void StartAutoupdateTimer() override; void StartAutoupdateTimer() override;
@@ -104,10 +105,14 @@ class ChromeBrowserProcessStub : public BrowserProcess {
shell_integration::DefaultWebClientState CachedDefaultWebClientState() shell_integration::DefaultWebClientState CachedDefaultWebClientState()
override; override;
resource_coordinator::TabManager* GetTabManager() override; resource_coordinator::TabManager* GetTabManager() override;
resource_coordinator::ResourceCoordinatorParts* resource_coordinator_parts()
override;
prefs::InProcessPrefServiceFactory* pref_service_factory() const 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: private:
bool initialized_; bool initialized_;
bool context_initialized_; bool context_initialized_;
@@ -119,10 +124,6 @@ class ChromeBrowserProcessStub : public BrowserProcess {
scoped_refptr<extensions::EventRouterForwarder> event_router_forwarder_; scoped_refptr<extensions::EventRouterForwarder> event_router_forwarder_;
std::unique_ptr<net_log::ChromeNetLog> net_log_; std::unique_ptr<net_log::ChromeNetLog> net_log_;
std::unique_ptr<net_log::NetExportFileWriter> net_export_file_writer_; 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); DISALLOW_COPY_AND_ASSIGN(ChromeBrowserProcessStub);
}; };

View File

@@ -1,15 +0,0 @@
// Copyright (c) 2019 The Chromium Embedded Framework Authors.
// Portions copyright (c) 2013 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 "build/build_config.h"
#if defined(OS_MACOSX)
#include "chrome/app/chrome_crash_reporter_client.h"
// Required due to https://crrev.com/1c9f89a06f
void ChromeCrashReporterClient::Create() {}
#endif // defined(OS_MACOSX)

View File

@@ -5,7 +5,7 @@
#include "libcef/browser/chrome_profile_manager_stub.h" #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" #include "libcef/browser/content_browser_client.h"
namespace { namespace {
@@ -20,8 +20,8 @@ namespace {
// context for the currently active browser (e.g. the browser with input focus). // 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 // Return the main context for now since we don't currently have a good way to
// determine that. // determine that.
CefBrowserContext* GetActiveBrowserContext() { CefBrowserContextImpl* GetActiveBrowserContext() {
return static_cast<CefBrowserContext*>( return static_cast<CefBrowserContextImpl*>(
CefContentBrowserClient::Get()->request_context()->GetBrowserContext()); CefContentBrowserClient::Get()->request_context()->GetBrowserContext());
} }
@@ -34,8 +34,8 @@ ChromeProfileManagerStub::~ChromeProfileManagerStub() {}
Profile* ChromeProfileManagerStub::GetProfile( Profile* ChromeProfileManagerStub::GetProfile(
const base::FilePath& profile_dir) { const base::FilePath& profile_dir) {
CefBrowserContext* browser_context = CefBrowserContextImpl* browser_context =
CefBrowserContext::GetForCachePath(profile_dir); CefBrowserContextImpl::GetForCachePath(profile_dir);
if (!browser_context) { if (!browser_context) {
// ProfileManager makes assumptions about profile directory paths that do // ProfileManager makes assumptions about profile directory paths that do
// not match CEF usage. For example, the default Chrome profile name is // 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) { bool ChromeProfileManagerStub::IsValidProfile(const void* profile) {
if (!profile) if (!profile)
return false; return false;
return !!CefBrowserContext::GetForContext( return !!CefBrowserContextImpl::GetForContext(
reinterpret_cast<content::BrowserContext*>(const_cast<void*>(profile))); reinterpret_cast<content::BrowserContext*>(const_cast<void*>(profile)));
} }

View File

@@ -73,10 +73,10 @@ PrefService* ChromeProfileStub::GetOffTheRecordPrefs() {
base::OnceCallback<net::CookieStore*()> base::OnceCallback<net::CookieStore*()>
ChromeProfileStub::GetExtensionsCookieStoreGetter() { ChromeProfileStub::GetExtensionsCookieStoreGetter() {
return base::BindOnce( return base::BindOnce(
[](scoped_refptr<net::URLRequestContextGetter> context) { [](content::ResourceContext* context) {
return context->GetURLRequestContext()->cookie_store(); return context->GetRequestContext()->cookie_store();
}, },
base::WrapRefCounted(GetRequestContext())); GetResourceContext());
} }
bool ChromeProfileStub::IsSameProfile(Profile* profile) { bool ChromeProfileStub::IsSameProfile(Profile* profile) {

View File

@@ -7,8 +7,7 @@
#include <algorithm> #include <algorithm>
#include <utility> #include <utility>
#include "include/cef_version.h" #include "libcef/browser/browser_context_impl.h"
#include "libcef/browser/browser_context.h"
#include "libcef/browser/browser_host_impl.h" #include "libcef/browser/browser_host_impl.h"
#include "libcef/browser/browser_info.h" #include "libcef/browser/browser_info.h"
#include "libcef/browser/browser_info_manager.h" #include "libcef/browser/browser_info_manager.h"
@@ -16,15 +15,10 @@
#include "libcef/browser/browser_message_filter.h" #include "libcef/browser/browser_message_filter.h"
#include "libcef/browser/browser_platform_delegate.h" #include "libcef/browser/browser_platform_delegate.h"
#include "libcef/browser/context.h" #include "libcef/browser/context.h"
#include "libcef/browser/devtools/devtools_manager_delegate.h" #include "libcef/browser/devtools_manager_delegate.h"
#include "libcef/browser/extensions/extension_system.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/media_capture_devices_dispatcher.h"
#include "libcef/browser/net/chrome_scheme_handler.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/plugins/plugin_service_filter.h"
#include "libcef/browser/prefs/renderer_prefs.h" #include "libcef/browser/prefs/renderer_prefs.h"
#include "libcef/browser/printing/printing_message_filter.h" #include "libcef/browser/printing/printing_message_filter.h"
@@ -39,47 +33,27 @@
#include "libcef/common/content_client.h" #include "libcef/common/content_client.h"
#include "libcef/common/extensions/extensions_util.h" #include "libcef/common/extensions/extensions_util.h"
#include "libcef/common/net/scheme_registration.h" #include "libcef/common/net/scheme_registration.h"
#include "libcef/common/net_service/util.h"
#include "libcef/common/request_impl.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_renderer_manifest.h"
#include "base/base_switches.h" #include "base/base_switches.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/json/json_reader.h" #include "base/json/json_reader.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "base/stl_util.h"
#include "base/threading/thread_restrictions.h"
#include "cef/grit/cef_resources.h" #include "cef/grit/cef_resources.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_content_browser_client.h"
#include "chrome/browser/chrome_service.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_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/profiles/profile.h"
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.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/chrome_switches.h"
#include "chrome/common/constants.mojom.h" #include "chrome/common/constants.mojom.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/browser_resources.h" #include "chrome/grit/browser_resources.h"
#include "chrome/grit/generated_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 "chrome/services/printing/public/mojom/constants.mojom.h"
#include "components/navigation_interception/intercept_navigation_throttle.h" #include "components/navigation_interception/intercept_navigation_throttle.h"
#include "components/navigation_interception/navigation_params.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/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" #include "content/browser/frame_host/navigation_handle_impl.h"
#include "content/browser/frame_host/render_frame_host_impl.h" #include "content/browser/frame_host/render_frame_host_impl.h"
#include "content/browser/plugin_service_impl.h" #include "content/browser/plugin_service_impl.h"
@@ -98,13 +72,11 @@
#include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/resource_dispatcher_host.h" #include "content/public/browser/resource_dispatcher_host.h"
#include "content/public/browser/storage_partition.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/content_switches.h"
#include "content/public/common/service_names.mojom.h" #include "content/public/common/service_names.mojom.h"
#include "content/public/common/storage_quota_params.h" #include "content/public/common/storage_quota_params.h"
#include "content/public/common/url_constants.h"
#include "content/public/common/user_agent.h"
#include "content/public/common/web_preferences.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_message_filter.h"
#include "extensions/browser/extension_protocols.h" #include "extensions/browser/extension_protocols.h"
#include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_registry.h"
@@ -114,13 +86,8 @@
#include "extensions/browser/io_thread_extension_message_filter.h" #include "extensions/browser/io_thread_extension_message_filter.h"
#include "extensions/common/constants.h" #include "extensions/common/constants.h"
#include "extensions/common/switches.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 "net/ssl/ssl_cert_request_info.h"
#include "ppapi/host/ppapi_host.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/embedder/switches.h"
#include "services/service_manager/public/mojom/connector.mojom.h" #include "services/service_manager/public/mojom/connector.mojom.h"
#include "services/service_manager/sandbox/switches.h" #include "services/service_manager/sandbox/switches.h"
@@ -344,7 +311,7 @@ class CefQuotaPermissionContext : public content::QuotaPermissionContext {
bool handled = false; bool handled = false;
CefRefPtr<CefBrowserHostImpl> browser = CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForFrameRoute(render_process_id, CefBrowserHostImpl::GetBrowserForFrame(render_process_id,
params.render_frame_id); params.render_frame_id);
if (browser.get()) { if (browser.get()) {
CefRefPtr<CefClient> client = browser->GetClient(); CefRefPtr<CefClient> client = browser->GetClient();
@@ -437,9 +404,8 @@ int GetCrashSignalFD(const base::CommandLine& command_line) {
// |is_main_frame| argument once this problem is fixed. // |is_main_frame| argument once this problem is fixed.
bool NavigationOnUIThread( bool NavigationOnUIThread(
bool is_main_frame, bool is_main_frame,
int64_t frame_id, int64 frame_id,
int64_t parent_frame_id, int64 parent_frame_id,
int frame_tree_node_id,
content::WebContents* source, content::WebContents* source,
const navigation_interception::NavigationParams& params) { const navigation_interception::NavigationParams& params) {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
@@ -458,14 +424,13 @@ bool NavigationOnUIThread(
frame = browser->GetMainFrame(); frame = browser->GetMainFrame();
} else if (frame_id >= 0) { } else if (frame_id >= 0) {
frame = browser->GetFrame(frame_id); frame = browser->GetFrame(frame_id);
} DCHECK(frame);
if (!frame && frame_tree_node_id >= 0) { } else {
frame = browser->GetFrameForFrameTreeNode(frame_tree_node_id);
}
if (!frame) {
// Create a temporary frame object for navigation of sub-frames that // Create a temporary frame object for navigation of sub-frames that
// don't yet exist. // 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(); CefRefPtr<CefRequestImpl> request = new CefRequestImpl();
@@ -487,30 +452,6 @@ bool NavigationOnUIThread(
return ignore_navigation; return ignore_navigation;
} }
const extensions::ExtensionSet* GetEnabledExtensions(
content::BrowserContext* context) {
auto registry = extensions::ExtensionRegistry::Get(context);
return &registry->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 } // namespace
CefContentBrowserClient::CefContentBrowserClient() : browser_main_parts_(NULL) { CefContentBrowserClient::CefContentBrowserClient() : browser_main_parts_(NULL) {
@@ -529,13 +470,12 @@ CefContentBrowserClient* CefContentBrowserClient::Get() {
CefContentClient::Get()->browser()); CefContentClient::Get()->browser());
} }
std::unique_ptr<content::BrowserMainParts> content::BrowserMainParts* CefContentBrowserClient::CreateBrowserMainParts(
CefContentBrowserClient::CreateBrowserMainParts(
const content::MainFunctionParams& parameters) { const content::MainFunctionParams& parameters) {
browser_main_parts_ = new CefBrowserMainParts(parameters); browser_main_parts_ = new CefBrowserMainParts(parameters);
browser_main_parts_->AddParts( browser_main_parts_->AddParts(
ChromeService::GetInstance()->CreateExtraParts()); ChromeService::GetInstance()->CreateExtraParts());
return base::WrapUnique(browser_main_parts_); return browser_main_parts_;
} }
void CefContentBrowserClient::RenderProcessWillLaunch( void CefContentBrowserClient::RenderProcessWillLaunch(
@@ -564,16 +504,15 @@ void CefContentBrowserClient::RenderProcessWillLaunch(
host->Send( host->Send(
new CefProcessMsg_SetIsIncognitoProcess(profile->IsOffTheRecord())); new CefProcessMsg_SetIsIncognitoProcess(profile->IsOffTheRecord()));
service_manager::mojom::ServicePtrInfo service; service_manager::mojom::ServicePtr service;
*service_request = mojo::MakeRequest(&service); *service_request = mojo::MakeRequest(&service);
service_manager::mojom::PIDReceiverPtr pid_receiver;
service_manager::Identity renderer_identity = host->GetChildIdentity(); service_manager::Identity renderer_identity = host->GetChildIdentity();
mojo::Remote<service_manager::mojom::ProcessMetadata> metadata; ChromeService::GetInstance()->connector()->StartService(
ChromeService::GetInstance()->connector()->RegisterServiceInstance(
service_manager::Identity(chrome::mojom::kRendererServiceName, service_manager::Identity(chrome::mojom::kRendererServiceName,
renderer_identity.instance_group(), renderer_identity.user_id(),
renderer_identity.instance_id(), renderer_identity.instance()),
base::Token::CreateRandom()), std::move(service), mojo::MakeRequest(&pid_receiver));
std::move(service), metadata.BindNewPipeAndPassReceiver());
} }
bool CefContentBrowserClient::ShouldUseProcessPerSite( bool CefContentBrowserClient::ShouldUseProcessPerSite(
@@ -603,47 +542,6 @@ bool CefContentBrowserClient::ShouldUseProcessPerSite(
return true; return true;
} }
// Based on
// ChromeContentBrowserClientExtensionsPart::DoesSiteRequireDedicatedProcess.
bool CefContentBrowserClient::DoesSiteRequireDedicatedProcess(
content::BrowserOrResourceContext browser_or_resource_context,
const GURL& effective_site_url) {
if (!extensions::ExtensionsEnabled())
return false;
auto extension = GetEnabledExtensions(browser_or_resource_context)
->GetExtensionOrAppByURL(effective_site_url);
// 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);
}
bool CefContentBrowserClient::IsHandledURL(const GURL& url) { bool CefContentBrowserClient::IsHandledURL(const GURL& url) {
if (!url.is_valid()) if (!url.is_valid())
return false; return false;
@@ -712,63 +610,62 @@ void CefContentBrowserClient::SiteInstanceDeleting(
site_instance->GetId())); site_instance->GetId()));
} }
void CefContentBrowserClient::RunServiceInstance( void CefContentBrowserClient::RegisterInProcessServices(
const service_manager::Identity& identity, StaticServiceMap* services,
mojo::PendingReceiver<service_manager::mojom::Service>* receiver) { content::ServiceManagerConnection* connection) {
const std::string& service_name = identity.name(); {
if (service_name == printing::mojom::kServiceName) { // For spell checking.
service_manager::Service::RunAsyncUntilTermination( service_manager::EmbeddedServiceInfo info;
printing::CreatePdfCompositorService(std::move(*receiver))); info.factory = ChromeService::GetInstance()->CreateChromeServiceFactory();
return; services->insert(std::make_pair(chrome::mojom::kServiceName, info));
}
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::RunServiceInstanceOnIOThread( void CefContentBrowserClient::RegisterOutOfProcessServices(
const service_manager::Identity& identity, OutOfProcessServiceMap* services) {
mojo::PendingReceiver<service_manager::mojom::Service>* receiver) { (*services)[printing::mojom::kServiceName] =
if (identity.name() == chrome::mojom::kServiceName) { base::BindRepeating(&base::ASCIIToUTF16, "PDF Compositor Service");
ChromeService::GetInstance()->CreateChromeServiceRequestHandler().Run( (*services)[printing::mojom::kChromePrintingServiceName] =
std::move(*receiver)); base::BindRepeating(&base::ASCIIToUTF16, "Printing Service");
return; (*services)[proxy_resolver::mojom::kProxyResolverServiceName] =
} base::BindRepeating(&l10n_util::GetStringUTF16,
if (identity.name() == heap_profiling::mojom::kServiceName) { IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME);
heap_profiling::HeapProfilingService::GetServiceFactory().Run(
std::move(*receiver));
return;
}
} }
base::Optional<service_manager::Manifest> std::unique_ptr<base::Value> CefContentBrowserClient::GetServiceManifestOverlay(
CefContentBrowserClient::GetServiceManifestOverlay(base::StringPiece name) { base::StringPiece name) {
if (name == content::mojom::kBrowserServiceName) { int id = -1;
return GetCefContentBrowserOverlayManifest(); if (name == content::mojom::kBrowserServiceName)
} else if (name == content::mojom::kGpuServiceName) { id = IDR_CEF_BROWSER_MANIFEST_OVERLAY;
return GetCefContentGpuOverlayManifest(); else if (name == content::mojom::kPackagedServicesServiceName)
} else if (name == content::mojom::kRendererServiceName) { id = IDR_CEF_PACKAGED_SERVICES_MANIFEST_OVERLAY;
return GetCefContentRendererOverlayManifest(); else if (name == content::mojom::kRendererServiceName)
} else if (name == content::mojom::kUtilityServiceName) { id = IDR_CEF_RENDERER_MANIFEST_OVERLAY;
return GetCefContentUtilityOverlayManifest(); else if (name == content::mojom::kUtilityServiceName)
} id = IDR_CEF_UTILITY_MANIFEST_OVERLAY;
if (id == -1)
return nullptr;
return base::nullopt; base::StringPiece manifest_contents =
ui::ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(
id, ui::ScaleFactor::SCALE_FACTOR_NONE);
return base::JSONReader::Read(manifest_contents);
} }
std::vector<service_manager::Manifest> std::vector<content::ContentBrowserClient::ServiceManifestInfo>
CefContentBrowserClient::GetExtraServiceManifests() { CefContentBrowserClient::GetExtraServiceManifests() {
auto manifests = GetBuiltinServiceManifests(); return std::vector<ServiceManifestInfo>({
manifests.push_back(GetCefRendererManifest()); {printing::mojom::kServiceName, IDR_PDF_COMPOSITOR_MANIFEST},
return manifests; {chrome::mojom::kRendererServiceName,
IDR_CHROME_RENDERER_SERVICE_MANIFEST},
});
}
bool CefContentBrowserClient::IsSameBrowserContext(
content::BrowserContext* context1,
content::BrowserContext* context2) {
return CefBrowserContextImpl::GetForContext(context1) ==
CefBrowserContextImpl::GetForContext(context2);
} }
void CefContentBrowserClient::AppendExtraCommandLineSwitches( void CefContentBrowserClient::AppendExtraCommandLineSwitches(
@@ -783,7 +680,6 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
switches::kDisablePackLoading, switches::kDisablePackLoading,
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
switches::kFrameworkDirPath, switches::kFrameworkDirPath,
switches::kMainBundlePath,
#endif #endif
switches::kLocalesDirPath, switches::kLocalesDirPath,
switches::kLogFile, switches::kLogFile,
@@ -793,7 +689,7 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
switches::kUserAgent, switches::kUserAgent,
}; };
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames, command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
base::size(kSwitchNames)); arraysize(kSwitchNames));
} }
const std::string& process_type = const std::string& process_type =
@@ -813,10 +709,9 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
switches::kPpapiFlashPath, switches::kPpapiFlashPath,
switches::kPpapiFlashVersion, switches::kPpapiFlashVersion,
switches::kUncaughtExceptionStackSize, switches::kUncaughtExceptionStackSize,
network::switches::kUnsafelyTreatInsecureOriginAsSecure,
}; };
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames, command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
base::size(kSwitchNames)); arraysize(kSwitchNames));
if (extensions::ExtensionsEnabled()) { if (extensions::ExtensionsEnabled()) {
// Based on ChromeContentBrowserClientExtensionsPart:: // Based on ChromeContentBrowserClientExtensionsPart::
@@ -837,7 +732,7 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
switches::kLang, switches::kLang,
}; };
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames, command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
base::size(kSwitchNames)); arraysize(kSwitchNames));
} }
#if defined(OS_LINUX) #if defined(OS_LINUX)
@@ -845,11 +740,10 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
// Propagate the following switches to the zygote command line (along with // Propagate the following switches to the zygote command line (along with
// any associated values) if present in the browser command line. // any associated values) if present in the browser command line.
static const char* const kSwitchNames[] = { static const char* const kSwitchNames[] = {
switches::kPpapiFlashPath, switches::kPpapiFlashPath, switches::kPpapiFlashVersion,
switches::kPpapiFlashVersion,
}; };
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames, command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
base::size(kSwitchNames)); arraysize(kSwitchNames));
#if BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(ENABLE_LIBRARY_CDMS) #if BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
if (!browser_cmd->HasSwitch(service_manager::switches::kNoSandbox)) { if (!browser_cmd->HasSwitch(service_manager::switches::kNoSandbox)) {
@@ -912,27 +806,7 @@ std::string CefContentBrowserClient::GetApplicationLocale() {
return g_browser_process->GetApplicationLocale(); return g_browser_process->GetApplicationLocale();
} }
scoped_refptr<network::SharedURLLoaderFactory> content::QuotaPermissionContext*
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>
CefContentBrowserClient::CreateQuotaPermissionContext() { CefContentBrowserClient::CreateQuotaPermissionContext() {
return new CefQuotaPermissionContext(); return new CefQuotaPermissionContext();
} }
@@ -943,8 +817,7 @@ void CefContentBrowserClient::GetQuotaSettings(
storage::OptionalQuotaSettingsCallback callback) { storage::OptionalQuotaSettingsCallback callback) {
const base::FilePath& cache_path = partition->GetPath(); const base::FilePath& cache_path = partition->GetPath();
storage::GetNominalDynamicSettings( storage::GetNominalDynamicSettings(
cache_path, cache_path.empty() /* is_incognito */, cache_path, cache_path.empty() /* is_incognito */, std::move(callback));
storage::GetDefaultDiskInfoHelper(), std::move(callback));
} }
content::MediaObserver* CefContentBrowserClient::GetMediaObserver() { content::MediaObserver* CefContentBrowserClient::GetMediaObserver() {
@@ -961,30 +834,19 @@ CefContentBrowserClient::CreateSpeechRecognitionManagerDelegate() {
return NULL; return NULL;
} }
content::GeneratedCodeCacheSettings
CefContentBrowserClient::GetGeneratedCodeCacheSettings(
content::BrowserContext* context) {
// If we pass 0 for size, disk_cache will pick a default size using the
// heuristics based on available disk size. These are implemented in
// disk_cache::PreferredCacheSize in net/disk_cache/cache_util.cc.
const base::FilePath& cache_path = context->GetPath();
return content::GeneratedCodeCacheSettings(!cache_path.empty() /* enabled */,
0 /* size */, cache_path);
}
void CefContentBrowserClient::AllowCertificateError( void CefContentBrowserClient::AllowCertificateError(
content::WebContents* web_contents, content::WebContents* web_contents,
int cert_error, int cert_error,
const net::SSLInfo& ssl_info, const net::SSLInfo& ssl_info,
const GURL& request_url, const GURL& request_url,
bool is_main_frame_request, content::ResourceType resource_type,
bool strict_enforcement, bool strict_enforcement,
bool expired_previous_decision, bool expired_previous_decision,
const base::Callback<void(content::CertificateRequestResultType)>& const base::Callback<void(content::CertificateRequestResultType)>&
callback) { callback) {
CEF_REQUIRE_UIT(); 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 // A sub-resource has a certificate error. The user doesn't really
// have a context for making the right decision, so block the request // have a context for making the right decision, so block the request
// hard. // hard.
@@ -1061,7 +923,7 @@ bool CefContentBrowserClient::CanCreateWindow(
content::RenderFrameHost* opener, content::RenderFrameHost* opener,
const GURL& opener_url, const GURL& opener_url,
const GURL& opener_top_level_frame_url, const GURL& opener_top_level_frame_url,
const url::Origin& source_origin, const GURL& source_origin,
content::mojom::WindowContainerType container_type, content::mojom::WindowContainerType container_type,
const GURL& target_url, const GURL& target_url,
const content::Referrer& referrer, const content::Referrer& referrer,
@@ -1129,50 +991,34 @@ CefContentBrowserClient::CreateThrottlesForNavigation(
const bool is_main_frame = navigation_handle->IsInMainFrame(); const bool is_main_frame = navigation_handle->IsInMainFrame();
int64 parent_frame_id = CefFrameHostImpl::kUnspecifiedFrameId;
if (!is_main_frame) {
// Identify the RenderFrameHost that originated the navigation. // Identify the RenderFrameHost that originated the navigation.
const int64_t parent_frame_id = content::RenderFrameHost* parent_frame_host =
!is_main_frame navigation_handle->GetParentFrame();
? CefFrameHostImpl::MakeFrameId(navigation_handle->GetParentFrame()) DCHECK(parent_frame_host);
: CefFrameHostImpl::kInvalidFrameId; 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() int64 frame_id = CefFrameHostImpl::kInvalidFrameId;
? CefFrameHostImpl::MakeFrameId( if (!is_main_frame && navigation_handle->HasCommitted()) {
navigation_handle->GetRenderFrameHost()) frame_id = navigation_handle->GetRenderFrameHost()->GetRoutingID();
: CefFrameHostImpl::kInvalidFrameId; if (frame_id < 0)
frame_id = CefFrameHostImpl::kInvalidFrameId;
}
// Must use SynchronyMode::kSync to ensure that OnBeforeBrowse is always
// called before OnBeforeResourceLoad.
std::unique_ptr<content::NavigationThrottle> throttle = std::unique_ptr<content::NavigationThrottle> throttle =
std::make_unique<navigation_interception::InterceptNavigationThrottle>( std::make_unique<navigation_interception::InterceptNavigationThrottle>(
navigation_handle, navigation_handle, base::Bind(&NavigationOnUIThread, is_main_frame,
base::Bind(&NavigationOnUIThread, is_main_frame, frame_id, frame_id, parent_frame_id));
parent_frame_id, navigation_handle->GetFrameTreeNodeId()),
navigation_interception::SynchronyMode::kSync);
throttles.push_back(std::move(throttle)); throttles.push_back(std::move(throttle));
return throttles; 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) #if defined(OS_LINUX)
void CefContentBrowserClient::GetAdditionalMappedFilesForChildProcess( void CefContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line, const base::CommandLine& command_line,
@@ -1226,21 +1072,6 @@ CefContentBrowserClient::CreateClientCertStore(
->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( void CefContentBrowserClient::RegisterNonNetworkNavigationURLLoaderFactories(
int frame_tree_node_id, int frame_tree_node_id,
NonNetworkURLLoaderFactoryMap* factories) { NonNetworkURLLoaderFactoryMap* factories) {
@@ -1267,111 +1098,26 @@ void CefContentBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories(
render_frame_id); render_frame_id);
if (factory) if (factory)
factories->emplace(extensions::kExtensionScheme, std::move(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( bool CefContentBrowserClient::WillCreateURLLoaderFactory(
content::BrowserContext* browser_context, content::BrowserContext* browser_context,
content::RenderFrameHost* frame, content::RenderFrameHost* frame,
int render_process_id,
bool is_navigation, bool is_navigation,
bool is_download,
const url::Origin& request_initiator, const url::Origin& request_initiator,
network::mojom::URLLoaderFactoryRequest* factory_request, network::mojom::URLLoaderFactoryRequest* factory_request,
network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client,
bool* bypass_redirect_checks) { bool* bypass_redirect_checks) {
if (!net_service::IsEnabled()) if (!extensions::ExtensionsEnabled())
return false; return false;
auto request_handler = net_service::CreateInterceptedRequestHandler( auto* web_request_api =
browser_context, frame, render_process_id, is_navigation, is_download, extensions::BrowserContextKeyedAPIFactory<extensions::WebRequestAPI>::Get(
request_initiator); browser_context);
bool use_proxy = web_request_api->MaybeProxyURLLoaderFactory(
net_service::ProxyURLLoaderFactory::CreateProxy( frame, is_navigation, factory_request);
browser_context, factory_request, header_client, if (bypass_redirect_checks)
std::move(request_handler)); *bypass_redirect_checks = use_proxy;
return true; return use_proxy;
}
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};
} }
bool CefContentBrowserClient::HandleExternalProtocol( bool CefContentBrowserClient::HandleExternalProtocol(
@@ -1381,77 +1127,14 @@ bool CefContentBrowserClient::HandleExternalProtocol(
content::NavigationUIData* navigation_data, content::NavigationUIData* navigation_data,
bool is_main_frame, bool is_main_frame,
ui::PageTransition page_transition, ui::PageTransition page_transition,
bool has_user_gesture, bool has_user_gesture) {
network::mojom::URLLoaderFactoryRequest* factory_request, CEF_POST_TASK(
network::mojom::URLLoaderFactory*& out_factory) { CEF_UIT,
if (net_service::IsEnabled()) { base::Bind(
// Call the other HandleExternalProtocol variant. base::IgnoreResult(
&CefContentBrowserClient::HandleExternalProtocolOnUIThread),
url, web_contents_getter));
return false; return false;
}
CefRefPtr<CefRequestImpl> requestPtr = new CefRequestImpl();
requestPtr->SetURL(url.spec());
requestPtr->SetReadOnly(true);
net_util::HandleExternalProtocol(requestPtr, 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();
}
std::string CefContentBrowserClient::GetChromeProduct() const {
return version_info::GetProductNameAndVersionForUserAgent();
}
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();
}
blink::UserAgentMetadata CefContentBrowserClient::GetUserAgentMetadata() const {
blink::UserAgentMetadata metadata;
metadata.brand = version_info::GetProductName();
metadata.full_version = version_info::GetVersionNumber();
metadata.platform = version_info::GetOSType();
// TODO(mkwst): Poke at BuildUserAgentFromProduct to split out these pieces.
metadata.architecture = "";
metadata.model = "";
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) { void CefContentBrowserClient::RegisterCustomScheme(const std::string& scheme) {
@@ -1497,3 +1180,18 @@ const extensions::Extension* CefContentBrowserClient::GetExtension(
return registry->enabled_extensions().GetExtensionOrAppByURL( return registry->enabled_extensions().GetExtensionOrAppByURL(
site_instance->GetSiteURL()); 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);
}
}

View File

@@ -10,7 +10,7 @@
#include <utility> #include <utility>
#include "include/cef_request_context_handler.h" #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 "libcef/browser/request_context_impl.h"
#include "base/macros.h" #include "base/macros.h"
@@ -41,37 +41,25 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
static CefContentBrowserClient* Get(); static CefContentBrowserClient* Get();
// ContentBrowserClient implementation. // ContentBrowserClient implementation.
std::unique_ptr<content::BrowserMainParts> CreateBrowserMainParts( content::BrowserMainParts* CreateBrowserMainParts(
const content::MainFunctionParams& parameters) override; const content::MainFunctionParams& parameters) override;
void RenderProcessWillLaunch( void RenderProcessWillLaunch(
content::RenderProcessHost* host, content::RenderProcessHost* host,
service_manager::mojom::ServiceRequest* service_request) override; service_manager::mojom::ServiceRequest* service_request) override;
bool ShouldUseProcessPerSite(content::BrowserContext* browser_context, bool ShouldUseProcessPerSite(content::BrowserContext* browser_context,
const GURL& effective_url) override; 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 IsHandledURL(const GURL& url) override; bool IsHandledURL(const GURL& url) override;
void SiteInstanceGotProcess(content::SiteInstance* site_instance) override; void SiteInstanceGotProcess(content::SiteInstance* site_instance) override;
void SiteInstanceDeleting(content::SiteInstance* site_instance) override; void SiteInstanceDeleting(content::SiteInstance* site_instance) override;
void RunServiceInstance( void RegisterInProcessServices(
const service_manager::Identity& identity, StaticServiceMap* services,
mojo::PendingReceiver<service_manager::mojom::Service>* receiver) content::ServiceManagerConnection* connection) override;
override; void RegisterOutOfProcessServices(OutOfProcessServiceMap* services) override;
void RunServiceInstanceOnIOThread( std::unique_ptr<base::Value> GetServiceManifestOverlay(
const service_manager::Identity& identity,
mojo::PendingReceiver<service_manager::mojom::Service>* receiver)
override;
base::Optional<service_manager::Manifest> GetServiceManifestOverlay(
base::StringPiece name) override; base::StringPiece name) override;
std::vector<service_manager::Manifest> GetExtraServiceManifests() override; std::vector<ServiceManifestInfo> GetExtraServiceManifests() override;
bool IsSameBrowserContext(content::BrowserContext* context1,
content::BrowserContext* context2) override;
void AppendExtraCommandLineSwitches(base::CommandLine* command_line, void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
int child_process_id) override; int child_process_id) override;
void AdjustUtilityServiceProcessCommandLine( void AdjustUtilityServiceProcessCommandLine(
@@ -79,11 +67,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
base::CommandLine* command_line) override; base::CommandLine* command_line) override;
bool ShouldEnableStrictSiteIsolation() override; bool ShouldEnableStrictSiteIsolation() override;
std::string GetApplicationLocale() override; std::string GetApplicationLocale() override;
scoped_refptr<network::SharedURLLoaderFactory> content::QuotaPermissionContext* CreateQuotaPermissionContext() override;
GetSystemSharedURLLoaderFactory() override;
network::mojom::NetworkContext* GetSystemNetworkContext() override;
scoped_refptr<content::QuotaPermissionContext> CreateQuotaPermissionContext()
override;
void GetQuotaSettings( void GetQuotaSettings(
content::BrowserContext* context, content::BrowserContext* context,
content::StoragePartition* partition, content::StoragePartition* partition,
@@ -91,14 +75,12 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
content::MediaObserver* GetMediaObserver() override; content::MediaObserver* GetMediaObserver() override;
content::SpeechRecognitionManagerDelegate* content::SpeechRecognitionManagerDelegate*
CreateSpeechRecognitionManagerDelegate() override; CreateSpeechRecognitionManagerDelegate() override;
content::GeneratedCodeCacheSettings GetGeneratedCodeCacheSettings(
content::BrowserContext* context) override;
void AllowCertificateError( void AllowCertificateError(
content::WebContents* web_contents, content::WebContents* web_contents,
int cert_error, int cert_error,
const net::SSLInfo& ssl_info, const net::SSLInfo& ssl_info,
const GURL& request_url, const GURL& request_url,
bool is_main_frame_request, content::ResourceType resource_type,
bool strict_enforcement, bool strict_enforcement,
bool expired_previous_decision, bool expired_previous_decision,
const base::Callback<void(content::CertificateRequestResultType)>& const base::Callback<void(content::CertificateRequestResultType)>&
@@ -111,7 +93,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
bool CanCreateWindow(content::RenderFrameHost* opener, bool CanCreateWindow(content::RenderFrameHost* opener,
const GURL& opener_url, const GURL& opener_url,
const GURL& opener_top_level_frame_url, const GURL& opener_top_level_frame_url,
const url::Origin& source_origin, const GURL& source_origin,
content::mojom::WindowContainerType container_type, content::mojom::WindowContainerType container_type,
const GURL& target_url, const GURL& target_url,
const content::Referrer& referrer, const content::Referrer& referrer,
@@ -131,13 +113,6 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
std::vector<std::unique_ptr<content::NavigationThrottle>> std::vector<std::unique_ptr<content::NavigationThrottle>>
CreateThrottlesForNavigation( CreateThrottlesForNavigation(
content::NavigationHandle* navigation_handle) override; content::NavigationHandle* navigation_handle) override;
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) #if defined(OS_LINUX)
void GetAdditionalMappedFilesForChildProcess( void GetAdditionalMappedFilesForChildProcess(
@@ -155,17 +130,10 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
service_manager::BinderRegistry* registry, service_manager::BinderRegistry* registry,
blink::AssociatedInterfaceRegistry* associated_registry, blink::AssociatedInterfaceRegistry* associated_registry,
content::RenderProcessHost* render_process_host) override; content::RenderProcessHost* render_process_host) override;
std::unique_ptr<net::ClientCertStore> CreateClientCertStore( std::unique_ptr<net::ClientCertStore> CreateClientCertStore(
content::ResourceContext* resource_context) override; 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( void RegisterNonNetworkNavigationURLLoaderFactories(
int frame_tree_node_id, int frame_tree_node_id,
NonNetworkURLLoaderFactoryMap* factories) override; NonNetworkURLLoaderFactoryMap* factories) override;
@@ -176,20 +144,11 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
bool WillCreateURLLoaderFactory( bool WillCreateURLLoaderFactory(
content::BrowserContext* browser_context, content::BrowserContext* browser_context,
content::RenderFrameHost* frame, content::RenderFrameHost* frame,
int render_process_id,
bool is_navigation, bool is_navigation,
bool is_download,
const url::Origin& request_initiator, const url::Origin& request_initiator,
network::mojom::URLLoaderFactoryRequest* factory_request, network::mojom::URLLoaderFactoryRequest* factory_request,
network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client,
bool* bypass_redirect_checks) override; 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( bool HandleExternalProtocol(
const GURL& url, const GURL& url,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter, content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
@@ -197,22 +156,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
content::NavigationUIData* navigation_data, content::NavigationUIData* navigation_data,
bool is_main_frame, bool is_main_frame,
ui::PageTransition page_transition, ui::PageTransition page_transition,
bool has_user_gesture, bool has_user_gesture) override;
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;
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. // Perform browser process registration for the custom scheme.
void RegisterCustomScheme(const std::string& scheme); void RegisterCustomScheme(const std::string& scheme);
@@ -229,6 +173,11 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
const extensions::Extension* GetExtension( const extensions::Extension* GetExtension(
content::SiteInstance* site_instance); content::SiteInstance* site_instance);
static void HandleExternalProtocolOnUIThread(
const GURL& url,
const content::ResourceRequestInfo::WebContentsGetter&
web_contents_getter);
CefBrowserMainParts* browser_main_parts_; CefBrowserMainParts* browser_main_parts_;
std::unique_ptr<content::PluginServiceFilter> plugin_service_filter_; std::unique_ptr<content::PluginServiceFilter> plugin_service_filter_;

Some files were not shown because too many files have changed in this diff Show More