mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
29 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
3b5a9dfb50 | ||
|
7c94248e45 | ||
|
344f01c1a8 | ||
|
5dc6f2f29c | ||
|
fe66d80346 | ||
|
37e6a4002e | ||
|
96006d1193 | ||
|
36934ebbc5 | ||
|
84beb5a7e1 | ||
|
d1c786e7fe | ||
|
615db2f583 | ||
|
4de18f0d4b | ||
|
2830d3a706 | ||
|
8e5da68011 | ||
|
9eac4fa487 | ||
|
059f2446c0 | ||
|
f3023f8ca0 | ||
|
8311b6cfba | ||
|
a5cda9c3dc | ||
|
b36991c674 | ||
|
74f62fd38c | ||
|
071f544b5a | ||
|
2cb5ebb3db | ||
|
3463fdd061 | ||
|
b3fe8ad6d7 | ||
|
0bebcc9e97 | ||
|
9eb3683b09 | ||
|
0c9655dfb7 | ||
|
7b50b32953 |
343
BUILD.gn
343
BUILD.gn
@@ -319,16 +319,6 @@ group("cef") {
|
||||
":libcef_static_unittests",
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
deps += [
|
||||
":bootstrap",
|
||||
":bootstrapc",
|
||||
":cefclient_dll",
|
||||
":cefsimple_dll",
|
||||
":ceftests_dll",
|
||||
]
|
||||
}
|
||||
|
||||
if (!is_linux || ozone_platform_x11) {
|
||||
deps += [ ":cefclient" ]
|
||||
}
|
||||
@@ -350,7 +340,7 @@ if (is_win) {
|
||||
# to maintain.
|
||||
"//chrome/common/crash_keys.cc",
|
||||
"//chrome/common/chrome_switches.cc",
|
||||
"//components/webui/flags/flags_ui_switches.cc",
|
||||
"//components/flags_ui/flags_ui_switches.cc",
|
||||
"//content/public/common/content_switches.cc",
|
||||
]
|
||||
|
||||
@@ -383,10 +373,6 @@ if (is_win) {
|
||||
# Required by content_switches.cc
|
||||
"//media:media_buildflags",
|
||||
|
||||
# Required by crash_keys.cc
|
||||
"//content/public/common:buildflags",
|
||||
"//tools/v8_context_snapshot:buildflags",
|
||||
|
||||
# Required by crash_keys.cc (from base/stl_util.h)
|
||||
"//third_party/abseil-cpp:absl",
|
||||
]
|
||||
@@ -562,8 +548,6 @@ source_set("libcef_static") {
|
||||
"libcef/browser/context.h",
|
||||
"libcef/browser/context_menu_params_impl.cc",
|
||||
"libcef/browser/context_menu_params_impl.h",
|
||||
"libcef/browser/crashpad_runner.cc",
|
||||
"libcef/browser/crashpad_runner.h",
|
||||
"libcef/browser/devtools/devtools_controller.cc",
|
||||
"libcef/browser/devtools/devtools_controller.h",
|
||||
"libcef/browser/devtools/devtools_protocol_manager.cc",
|
||||
@@ -855,7 +839,6 @@ source_set("libcef_static") {
|
||||
"libcef/common/values_impl.h",
|
||||
"libcef/common/waitable_event_impl.cc",
|
||||
"libcef/common/waitable_event_impl.h",
|
||||
"libcef/renderer/browser_config.h",
|
||||
"libcef/renderer/browser_impl.cc",
|
||||
"libcef/renderer/browser_impl.h",
|
||||
"libcef/renderer/chrome/chrome_content_renderer_client_cef.cc",
|
||||
@@ -1008,9 +991,6 @@ source_set("libcef_static") {
|
||||
"libcef/browser/native/browser_platform_delegate_native_win.h",
|
||||
"libcef/browser/osr/browser_platform_delegate_osr_win.cc",
|
||||
"libcef/browser/osr/browser_platform_delegate_osr_win.h",
|
||||
"libcef/browser/preferred_stack_size_win.inc",
|
||||
"libcef_dll/bootstrap/bootstrap_util_win.cc",
|
||||
"libcef_dll/bootstrap/bootstrap_util_win.h",
|
||||
]
|
||||
|
||||
deps += [
|
||||
@@ -1175,9 +1155,6 @@ config("libcef_dll_wrapper_config") {
|
||||
# Increase the initial stack size to 8MiB from the default 1MiB.
|
||||
ldflags = [ "/STACK:0x800000" ]
|
||||
}
|
||||
|
||||
# Required to support CefScopedLibraryLoader.
|
||||
ldflags += [ "/DELAYLOAD:libcef.dll" ]
|
||||
}
|
||||
|
||||
# Build using the minimum C++ version supported by the CEF binary distribution.
|
||||
@@ -1213,14 +1190,6 @@ static_library("libcef_dll_wrapper") {
|
||||
sources += gypi_paths2.libcef_dll_wrapper_sources_mac
|
||||
}
|
||||
|
||||
if (is_win) {
|
||||
sources += gypi_paths2.libcef_dll_wrapper_sources_win
|
||||
libs = [
|
||||
"crypt32.lib",
|
||||
"wintrust.lib",
|
||||
]
|
||||
}
|
||||
|
||||
defines = [ "WRAPPING_CEF_SHARED" ]
|
||||
|
||||
configs += [ ":libcef_dll_wrapper_config" ]
|
||||
@@ -1240,13 +1209,14 @@ if (is_win) {
|
||||
configs += [ ":libcef_includes_config" ]
|
||||
deps = [
|
||||
":make_config_header",
|
||||
"libcef/features:buildflags",
|
||||
"//sandbox",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if (is_mac) {
|
||||
shared_library("cef_sandbox") {
|
||||
static_library("cef_sandbox") {
|
||||
sources = [ "libcef_dll/sandbox/sandbox_mac.mm" ]
|
||||
configs += [ ":libcef_includes_config" ]
|
||||
deps = [
|
||||
@@ -1257,97 +1227,6 @@ if (is_mac) {
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# bootstrap target.
|
||||
#
|
||||
|
||||
if (is_win) {
|
||||
bootstrap_sources = includes_common +
|
||||
includes_win + [
|
||||
"include/wrapper/cef_certificate_util_win.h",
|
||||
"include/wrapper/cef_util_win.h",
|
||||
"libcef_dll/bootstrap/bootstrap_util_win.cc",
|
||||
"libcef_dll/bootstrap/bootstrap_util_win.h",
|
||||
"libcef_dll/bootstrap/bootstrap_win.cc",
|
||||
"libcef_dll/bootstrap/win/bootstrap.rc",
|
||||
"libcef_dll/bootstrap/win/resource.h",
|
||||
"libcef_dll/wrapper/cef_certificate_util_win.cc",
|
||||
"libcef_dll/wrapper/cef_util_win.cc",
|
||||
"libcef/browser/crashpad_runner.cc",
|
||||
"libcef/browser/crashpad_runner.h",
|
||||
"libcef/browser/preferred_stack_size_win.inc",
|
||||
"//chrome/app/delay_load_failure_hook_win.cc",
|
||||
"//chrome/app/delay_load_failure_hook_win.h",
|
||||
"//chrome/common/win/delay_load_failure_support.cc",
|
||||
"//chrome/common/win/delay_load_failure_support.h",
|
||||
"//content/app/sandbox_helper_win.cc",
|
||||
"//content/public/app/sandbox_helper_win.h",
|
||||
]
|
||||
|
||||
bootstrap_deps = [
|
||||
":make_api_versions_header",
|
||||
":make_config_header",
|
||||
":make_version_header",
|
||||
"//base",
|
||||
"//build/win:default_exe_manifest",
|
||||
"//chrome/install_static:secondary_module",
|
||||
"//chrome/chrome_elf",
|
||||
"//sandbox",
|
||||
"//sandbox/policy",
|
||||
"//third_party/crashpad/crashpad/handler",
|
||||
]
|
||||
|
||||
bootstrap_libs = [
|
||||
"crypt32.lib",
|
||||
"wintrust.lib",
|
||||
]
|
||||
|
||||
bootstrap_configs = [
|
||||
":libcef_includes_config",
|
||||
|
||||
# Delay-load as many DLLs as possible for sandbox and startup perf
|
||||
# improvements.
|
||||
"//build/config/win:delayloads",
|
||||
"//build/config/win:delayloads_not_for_child_dll",
|
||||
]
|
||||
|
||||
# Windows application that initializes the sandbox and then passes
|
||||
# execution to a client-provided DLL.
|
||||
executable("bootstrap") {
|
||||
# Necessary because the libcef target is testonly.
|
||||
testonly = true
|
||||
|
||||
sources = bootstrap_sources
|
||||
deps = bootstrap_deps
|
||||
libs = bootstrap_libs
|
||||
configs += bootstrap_configs
|
||||
|
||||
# Set /SUBSYSTEM:WINDOWS.
|
||||
configs -= [ "//build/config/win:console" ]
|
||||
configs += [ "//build/config/win:windowed" ]
|
||||
|
||||
defines = [
|
||||
"CEF_BUILD_BOOTSTRAP",
|
||||
]
|
||||
}
|
||||
|
||||
# Like "bootstrap", but as a console application.
|
||||
executable("bootstrapc") {
|
||||
# Necessary because the libcef target is testonly.
|
||||
testonly = true
|
||||
|
||||
sources = bootstrap_sources
|
||||
deps = bootstrap_deps
|
||||
libs = bootstrap_libs
|
||||
configs += bootstrap_configs
|
||||
|
||||
defines = [
|
||||
"CEF_BUILD_BOOTSTRAP",
|
||||
"CEF_BUILD_BOOTSTRAP_CONSOLE",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Resource grit/pack targets.
|
||||
#
|
||||
@@ -1661,46 +1540,17 @@ if (is_mac) {
|
||||
]
|
||||
}
|
||||
|
||||
if (!use_static_angle) {
|
||||
# Add the ANGLE .dylibs in the MODULE_DIR of the Framework app bundle.
|
||||
bundle_data("cef_framework_angle_binaries") {
|
||||
sources = [
|
||||
"$root_out_dir/egl_intermediates/libEGL.dylib",
|
||||
"$root_out_dir/egl_intermediates/libGLESv2.dylib",
|
||||
]
|
||||
outputs = [
|
||||
"{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
|
||||
]
|
||||
public_deps = [
|
||||
"//ui/gl:angle_library_copy",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
# We need to copy the CEF libraries so that the bundle_data dependencies have
|
||||
# a "copy" target type. Otherwise for "shared_library" target types it will
|
||||
# try to link things into the CEF Framework when we want to keep the libraries
|
||||
# separate instead.
|
||||
copy("cef_library_copy") {
|
||||
# Add the ANGLE .dylibs in the MODULE_DIR of the Framework app bundle.
|
||||
bundle_data("cef_framework_angle_binaries") {
|
||||
sources = [
|
||||
"$root_out_dir/libcef_sandbox.dylib",
|
||||
]
|
||||
outputs = [ "$root_out_dir/cef_intermediates/{{source_file_part}}" ]
|
||||
deps = [
|
||||
":cef_sandbox",
|
||||
]
|
||||
}
|
||||
|
||||
# Add the CEF .dylibs in the MODULE_DIR of the Framework app bundle.
|
||||
bundle_data("cef_framework_cef_binaries") {
|
||||
sources = [
|
||||
"$root_out_dir/cef_intermediates/libcef_sandbox.dylib",
|
||||
"$root_out_dir/egl_intermediates/libEGL.dylib",
|
||||
"$root_out_dir/egl_intermediates/libGLESv2.dylib",
|
||||
]
|
||||
outputs = [
|
||||
"{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
|
||||
]
|
||||
public_deps = [
|
||||
":cef_library_copy",
|
||||
"//ui/gl:angle_library_copy",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1733,15 +1583,11 @@ if (is_mac) {
|
||||
sources = libcef_sources_common + includes_mac
|
||||
|
||||
deps = libcef_deps_common + [
|
||||
":cef_framework_cef_binaries",
|
||||
":cef_framework_angle_binaries",
|
||||
":cef_framework_resources",
|
||||
":cef_framework_swiftshader_binaries",
|
||||
]
|
||||
|
||||
if (!use_static_angle) {
|
||||
deps += [ ":cef_framework_angle_binaries" ]
|
||||
}
|
||||
|
||||
configs += [
|
||||
":libcef_autogen_config",
|
||||
":libcef_includes_config",
|
||||
@@ -1806,8 +1652,7 @@ if (is_mac) {
|
||||
]
|
||||
|
||||
# Delay-load as many DLLs as possible for sandbox and startup perf
|
||||
# improvements. Don't use "delayloads_not_for_child_dll" here because
|
||||
# we need some DLLs loaded in child processes before sandbox lockdown.
|
||||
# improvements.
|
||||
configs += [ "//build/config/win:delayloads" ]
|
||||
|
||||
libs = [
|
||||
@@ -1903,6 +1748,7 @@ if (is_mac) {
|
||||
|
||||
deps = [
|
||||
":cef_make_headers",
|
||||
":cef_sandbox",
|
||||
":libcef_dll_wrapper",
|
||||
]
|
||||
if (defined(invoker.helper_deps)) {
|
||||
@@ -2303,7 +2149,6 @@ if (is_mac) {
|
||||
|
||||
if (is_win) {
|
||||
sources += includes_win +
|
||||
gypi_paths2.includes_wrapper_win +
|
||||
gypi_paths2.shared_sources_win +
|
||||
gypi_paths2.cefclient_sources_win +
|
||||
gypi_paths2.cefclient_sources_resources_win_rc
|
||||
@@ -2314,10 +2159,7 @@ if (is_mac) {
|
||||
|
||||
# Delay-load as many DLLs as possible for sandbox and startup perf
|
||||
# improvements.
|
||||
configs += [
|
||||
"//build/config/win:delayloads",
|
||||
"//build/config/win:delayloads_not_for_child_dll",
|
||||
]
|
||||
configs += [ "//build/config/win:delayloads" ]
|
||||
|
||||
defines += [
|
||||
"CEF_USE_ATL",
|
||||
@@ -2381,70 +2223,6 @@ if (is_mac) {
|
||||
}
|
||||
}
|
||||
|
||||
if (is_win) {
|
||||
# Like the "cefclient" executable target, but building a DLL to be loaded by
|
||||
# bootstrap.exe.
|
||||
shared_library("cefclient_dll") {
|
||||
# Necessary because the libcef target is testonly.
|
||||
testonly = true
|
||||
|
||||
output_name = "cefclient"
|
||||
|
||||
sources = includes_common +
|
||||
includes_win +
|
||||
gypi_paths2.includes_wrapper +
|
||||
gypi_paths2.includes_wrapper_win +
|
||||
gypi_paths2.shared_sources_browser +
|
||||
gypi_paths2.shared_sources_common +
|
||||
gypi_paths2.shared_sources_renderer +
|
||||
gypi_paths2.shared_sources_win +
|
||||
gypi_paths2.cefclient_sources_browser +
|
||||
gypi_paths2.cefclient_sources_common +
|
||||
gypi_paths2.cefclient_sources_renderer +
|
||||
gypi_paths2.cefclient_sources_win +
|
||||
gypi_paths2.cefclient_sources_resources_win_rc
|
||||
|
||||
deps = [
|
||||
":bootstrap",
|
||||
":libcef",
|
||||
":libcef_dll_wrapper",
|
||||
]
|
||||
|
||||
defines = [
|
||||
"CEF_USE_ATL",
|
||||
"CEF_USE_BOOTSTRAP",
|
||||
]
|
||||
|
||||
# Delay-load as many DLLs as possible for sandbox and startup perf
|
||||
# improvements.
|
||||
configs += [
|
||||
"//build/config/win:delayloads",
|
||||
"//build/config/win:delayloads_not_for_child_dll",
|
||||
]
|
||||
|
||||
libs = [
|
||||
"comctl32.lib",
|
||||
"d3d11.lib",
|
||||
"imm32.lib",
|
||||
"oleacc.lib",
|
||||
"rpcrt4.lib",
|
||||
"shlwapi.lib",
|
||||
]
|
||||
|
||||
if (target_cpu != "arm64") {
|
||||
libs += [
|
||||
"glu32.lib",
|
||||
"opengl32.lib",
|
||||
]
|
||||
ldflags = [
|
||||
"/DELAYLOAD:glu32.dll",
|
||||
"/DELAYLOAD:oleaut32.dll",
|
||||
"/DELAYLOAD:opengl32.dll",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# cefsimple targets.
|
||||
@@ -2469,7 +2247,6 @@ if (is_mac) {
|
||||
|
||||
if (is_win) {
|
||||
sources += includes_win +
|
||||
gypi_paths2.includes_wrapper_win +
|
||||
gypi_paths2.cefsimple_sources_win +
|
||||
gypi_paths2.cefsimple_sources_resources_win_rc
|
||||
|
||||
@@ -2479,10 +2256,7 @@ if (is_mac) {
|
||||
|
||||
# Delay-load as many DLLs as possible for sandbox and startup perf
|
||||
# improvements.
|
||||
configs += [
|
||||
"//build/config/win:delayloads",
|
||||
"//build/config/win:delayloads_not_for_child_dll",
|
||||
]
|
||||
configs += [ "//build/config/win:delayloads" ]
|
||||
|
||||
deps += [
|
||||
":cef_sandbox",
|
||||
@@ -2513,48 +2287,6 @@ if (is_mac) {
|
||||
}
|
||||
}
|
||||
|
||||
if (is_win) {
|
||||
# Like the "cefsimple" executable target, but building a DLL to be loaded by
|
||||
# bootstrap.exe.
|
||||
shared_library("cefsimple_dll") {
|
||||
# Necessary because the libcef target is testonly.
|
||||
testonly = true
|
||||
|
||||
output_name = "cefsimple"
|
||||
|
||||
sources = includes_common +
|
||||
includes_win +
|
||||
gypi_paths2.includes_wrapper +
|
||||
gypi_paths2.includes_wrapper_win +
|
||||
gypi_paths2.cefsimple_sources_common +
|
||||
gypi_paths2.cefsimple_sources_win +
|
||||
gypi_paths2.cefsimple_sources_resources_win_rc
|
||||
|
||||
deps = [
|
||||
":bootstrap",
|
||||
":libcef",
|
||||
":libcef_dll_wrapper",
|
||||
]
|
||||
|
||||
defines = [
|
||||
"CEF_USE_BOOTSTRAP",
|
||||
]
|
||||
|
||||
# Delay-load as many DLLs as possible for sandbox and startup perf
|
||||
# improvements.
|
||||
configs += [
|
||||
"//build/config/win:delayloads",
|
||||
"//build/config/win:delayloads_not_for_child_dll",
|
||||
]
|
||||
|
||||
libs = [
|
||||
"comctl32.lib",
|
||||
"shlwapi.lib",
|
||||
"rpcrt4.lib",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# ceftests targets.
|
||||
@@ -2590,17 +2322,13 @@ if (is_mac) {
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
sources += gypi_paths2.includes_wrapper_win +
|
||||
gypi_paths2.shared_sources_win +
|
||||
sources += gypi_paths2.shared_sources_win +
|
||||
gypi_paths2.ceftests_sources_win +
|
||||
gypi_paths2.ceftests_sources_resources_win_rc
|
||||
|
||||
# Delay-load as many DLLs as possible for sandbox and startup perf
|
||||
# improvements.
|
||||
configs += [
|
||||
"//build/config/win:delayloads",
|
||||
"//build/config/win:delayloads_not_for_child_dll",
|
||||
]
|
||||
configs += [ "//build/config/win:delayloads" ]
|
||||
|
||||
deps += [
|
||||
":cef_sandbox",
|
||||
@@ -2632,45 +2360,4 @@ if (is_mac) {
|
||||
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
|
||||
}
|
||||
}
|
||||
|
||||
if (is_win) {
|
||||
# Like the "ceftests" executable target, but building a DLL to be loaded by
|
||||
# bootstrapc.exe.
|
||||
shared_library("ceftests_dll") {
|
||||
testonly = true
|
||||
|
||||
output_name = "ceftests"
|
||||
|
||||
sources = includes_common +
|
||||
gypi_paths2.includes_wrapper +
|
||||
gypi_paths2.includes_wrapper_win +
|
||||
gypi_paths2.shared_sources_browser +
|
||||
gypi_paths2.shared_sources_common +
|
||||
gypi_paths2.shared_sources_renderer +
|
||||
gypi_paths2.shared_sources_win +
|
||||
gypi_paths2.ceftests_sources_common +
|
||||
gypi_paths2.ceftests_sources_win +
|
||||
gypi_paths2.ceftests_sources_resources_win_rc
|
||||
|
||||
deps = [
|
||||
":bootstrapc",
|
||||
":libcef",
|
||||
":libcef_dll_wrapper",
|
||||
":gtest_teamcity",
|
||||
"//testing/gtest",
|
||||
]
|
||||
|
||||
defines = [
|
||||
"CEF_USE_BOOTSTRAP",
|
||||
"CEF_TESTS_IN_SRC_DIRECTORY",
|
||||
]
|
||||
|
||||
# Delay-load as many DLLs as possible for sandbox and startup perf
|
||||
# improvements.
|
||||
configs += [
|
||||
"//build/config/win:delayloads",
|
||||
"//build/config/win:delayloads_not_for_child_dll",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -7,5 +7,6 @@
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'refs/tags/138.0.7204.4'
|
||||
'chromium_checkout': 'refs/tags/134.0.6998.178',
|
||||
'depot_tools_checkout': 'f35efa5b85'
|
||||
}
|
||||
|
@@ -43,7 +43,9 @@ def _declare_helper_app(name, info_plist, deps, helper_base_name, helper_suffix,
|
||||
bundle_id = "{}.{}.helper{}".format(MACOS_BUNDLE_ID_BASE, name.lower(), bundle_id_suffix),
|
||||
infoplists = [":{}_InfoPList".format(helper_base_name)],
|
||||
minimum_os_version = MACOS_DEPLOYMENT_TARGET,
|
||||
deps = deps,
|
||||
deps = [
|
||||
"@cef//:cef_sandbox",
|
||||
] + deps,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
|
@@ -47,6 +47,7 @@ def declare_exe(name, srcs, manifest_srcs, rc_file, resources_srcs, resources_de
|
||||
srcs = srcs,
|
||||
deps = [
|
||||
"@cef//:cef_wrapper",
|
||||
"@cef//:cef_sandbox",
|
||||
] + deps,
|
||||
linkopts = [
|
||||
"$(location @cef//:cef_lib)",
|
||||
|
@@ -32,13 +32,9 @@ DLLS_X64 = [
|
||||
# processes. Conversely, some DLLs must be loaded before sandbox lockdown. In
|
||||
# unsandboxed processes they will load when first needed. The linker will
|
||||
# automatically ignore anything which is not linked to the binary at all (it is
|
||||
# harmless to have an unmatched /delayload). Lists should be kept in sync with
|
||||
# targets from Chromium's //build/config/win/BUILD.gn file.
|
||||
# harmless to have an unmatched /delayload). This list should be kept in sync
|
||||
# with Chromium's "delayloads" target from the //build/config/win/BUILD.gn file.
|
||||
DELAYLOAD_DLLS = [
|
||||
# Required to support CefScopedLibraryLoader.
|
||||
"libcef.dll"
|
||||
|
||||
# "delayloads" target.
|
||||
"api-ms-win-core-winrt-error-l1-1-0.dll",
|
||||
"api-ms-win-core-winrt-l1-1-0.dll",
|
||||
"api-ms-win-core-winrt-string-l1-1-0.dll",
|
||||
@@ -80,36 +76,38 @@ DELAYLOAD_DLLS = [
|
||||
"winusb.dll",
|
||||
"wsock32.dll",
|
||||
"wtsapi32.dll",
|
||||
|
||||
# "delayloads_not_for_child_dll" target.
|
||||
"crypt32.dll",
|
||||
"dbghelp.dll",
|
||||
"dhcpcsvc.dll",
|
||||
"dwrite.dll",
|
||||
"iphlpapi.dll",
|
||||
"oleaut32.dll",
|
||||
"secur32.dll",
|
||||
"userenv.dll",
|
||||
"winhttp.dll",
|
||||
"winmm.dll",
|
||||
"winspool.drv",
|
||||
"wintrust.dll",
|
||||
"ws2_32.dll",
|
||||
]
|
||||
|
||||
# Standard link libraries.
|
||||
STANDARD_LIBS = [
|
||||
"comctl32.lib",
|
||||
"crypt32.lib",
|
||||
"delayimp.lib",
|
||||
"gdi32.lib",
|
||||
"rpcrt4.lib",
|
||||
"shlwapi.lib",
|
||||
"user32.lib",
|
||||
"wintrust.lib",
|
||||
"ws2_32.lib",
|
||||
]
|
||||
|
||||
# Sandbox link libraries.
|
||||
SANDBOX_LIBS = [
|
||||
"Advapi32.lib",
|
||||
"dbghelp.lib",
|
||||
"Delayimp.lib",
|
||||
"ntdll.lib",
|
||||
"OleAut32.lib",
|
||||
"PowrProf.lib",
|
||||
"Propsys.lib",
|
||||
"psapi.lib",
|
||||
"SetupAPI.lib",
|
||||
"Shcore.lib",
|
||||
"Shell32.lib",
|
||||
"Userenv.lib",
|
||||
"version.lib",
|
||||
"wbemuuid.lib",
|
||||
"WindowsApp.lib",
|
||||
"winmm.lib",
|
||||
]
|
||||
|
||||
COMMON_LINKOPTS_DEBUG = [
|
||||
]
|
||||
|
||||
@@ -180,9 +178,18 @@ COMMON_DEFINES = [
|
||||
"WIN32_LEAN_AND_MEAN",
|
||||
# Disable exceptions
|
||||
"_HAS_EXCEPTIONS=0",
|
||||
|
||||
# Required by cef_sandbox.lib
|
||||
"PSAPI_VERSION=1",
|
||||
# Used by apps to test if the sandbox is enabled
|
||||
"CEF_USE_SANDBOX",
|
||||
]
|
||||
|
||||
COMMON_DEFINES_DEBUG = [
|
||||
# Required by cef_sandbox.lib
|
||||
# Disable iterator debugging
|
||||
"HAS_ITERATOR_DEBUGGING=0",
|
||||
"_ITERATOR_DEBUG_LEVEL=0",
|
||||
]
|
||||
|
||||
COMMON_DEFINES_RELEASE = [
|
||||
|
@@ -41,38 +41,8 @@
|
||||
"linux": "b14bee2c0fd250da67faea421f620b58e5dea9a2",
|
||||
"mac": "b54732b528bc2669481ec0cf17c7b97b033720b9",
|
||||
"windows": "751255204f006b8b883a8baf552a2da792f8aa44"
|
||||
},
|
||||
"13500": {
|
||||
"comment": "Added March 12, 2025.",
|
||||
"linux": "5b7c2284ed2542cf6212981d62ca9122fb2a4e88",
|
||||
"mac": "9862177631e8059a497d6086058168dd47477ab7",
|
||||
"windows": "3e78b6fe5fd31d69049499450849ada17a720a53"
|
||||
},
|
||||
"13600": {
|
||||
"comment": "Added April 07, 2025.",
|
||||
"linux": "eb353ba7b8b9bcbef890217971cd8ec41efeaa75",
|
||||
"mac": "22c77d1f2305de8a6147f14e52f074b4a4e5222c",
|
||||
"windows": "a8832519b4eb058567d68b65be1e1c9e80aae566"
|
||||
},
|
||||
"13601": {
|
||||
"comment": "Added April 22, 2025.",
|
||||
"linux": "40b224f295a20694241c5db49721bc90a3796f30",
|
||||
"mac": "ff885fe921f9eae1a5ce6a71b30b0c37b306bf56",
|
||||
"windows": "116a4153047ee1ee67f17fc938f084ee72b24e54"
|
||||
},
|
||||
"13700": {
|
||||
"comment": "Added May 07, 2025.",
|
||||
"linux": "e5ac12b1bd88b9ece6ceaa57848aaba61ab85242",
|
||||
"mac": "9e84009c92c25aa80935727b5e4526b23439a575",
|
||||
"windows": "65c7157dd3e8eba9bcc38db2bd7f26508c717f3e"
|
||||
},
|
||||
"13800": {
|
||||
"comment": "Added June 02, 2025.",
|
||||
"linux": "72c83a1455706c0f964505a6edcbf00c4a00575d",
|
||||
"mac": "09110c1f3bbe0e8a8c26ddf6df3388d73a6593d1",
|
||||
"windows": "1cde3ec27f93747ba42c0f2aa00467a5a16adfd4"
|
||||
}
|
||||
},
|
||||
"last": "13800",
|
||||
"last": "13401",
|
||||
"min": "13300"
|
||||
}
|
@@ -17,7 +17,6 @@
|
||||
'include/base/cef_cancelable_callback.h',
|
||||
'include/base/cef_compiler_specific.h',
|
||||
'include/base/cef_dump_without_crashing.h',
|
||||
'include/base/cef_immediate_crash.h',
|
||||
'include/base/cef_lock.h',
|
||||
'include/base/cef_logging.h',
|
||||
'include/base/cef_macros.h',
|
||||
@@ -80,11 +79,6 @@
|
||||
'includes_wrapper_mac': [
|
||||
'include/wrapper/cef_library_loader.h',
|
||||
],
|
||||
'includes_wrapper_win': [
|
||||
'include/wrapper/cef_certificate_util_win.h',
|
||||
'include/wrapper/cef_library_loader.h',
|
||||
'include/wrapper/cef_util_win.h',
|
||||
],
|
||||
'includes_win': [
|
||||
'include/cef_sandbox_win.h',
|
||||
'include/internal/cef_win.h',
|
||||
@@ -171,15 +165,9 @@
|
||||
'libcef_dll/wrapper/libcef_dll_wrapper2.cc',
|
||||
],
|
||||
'libcef_dll_wrapper_sources_mac': [
|
||||
'libcef_dll/wrapper/cef_scoped_library_loader_mac.mm',
|
||||
'libcef_dll/wrapper/cef_scoped_sandbox_context_mac.mm',
|
||||
'libcef_dll/wrapper/cef_library_loader_mac.mm',
|
||||
'libcef_dll/wrapper/libcef_dll_dylib.cc',
|
||||
],
|
||||
'libcef_dll_wrapper_sources_win': [
|
||||
'libcef_dll/wrapper/cef_certificate_util_win.cc',
|
||||
'libcef_dll/wrapper/cef_scoped_library_loader_win.cc',
|
||||
'libcef_dll/wrapper/cef_util_win.cc',
|
||||
],
|
||||
'shared_sources_browser': [
|
||||
'tests/shared/browser/client_app_browser.cc',
|
||||
'tests/shared/browser/client_app_browser.h',
|
||||
@@ -422,8 +410,6 @@
|
||||
'tests/cefclient/browser/temp_window_mac.mm',
|
||||
'tests/cefclient/browser/text_input_client_osr_mac.h',
|
||||
'tests/cefclient/browser/text_input_client_osr_mac.mm',
|
||||
'tests/cefclient/browser/util_mac.h',
|
||||
'tests/cefclient/browser/util_mac.mm',
|
||||
'tests/cefclient/browser/views_window_mac.mm',
|
||||
'tests/cefclient/browser/window_test_runner_mac.h',
|
||||
'tests/cefclient/browser/window_test_runner_mac.mm',
|
||||
@@ -540,7 +526,6 @@
|
||||
'tests/ceftests/permission_prompt_unittest.cc',
|
||||
'tests/ceftests/preference_unittest.cc',
|
||||
'tests/ceftests/print_unittest.cc',
|
||||
'tests/ceftests/print_to_pdf_unittest.cc',
|
||||
'tests/ceftests/process_message_unittest.cc',
|
||||
'tests/ceftests/request_context_unittest.cc',
|
||||
'tests/ceftests/request_handler_unittest.cc',
|
||||
|
@@ -36,7 +36,11 @@ macro(PRINT_CEF_CONFIG)
|
||||
|
||||
message(STATUS "CEF sandbox: ${USE_SANDBOX}")
|
||||
|
||||
message(STATUS "Standard libraries: ${CEF_STANDARD_LIBS}")
|
||||
set(_libraries ${CEF_STANDARD_LIBS})
|
||||
if(OS_WINDOWS AND USE_SANDBOX)
|
||||
list(APPEND _libraries ${CEF_SANDBOX_STANDARD_LIBS})
|
||||
endif()
|
||||
message(STATUS "Standard libraries: ${_libraries}")
|
||||
|
||||
message(STATUS "Compile defines: ${CEF_COMPILER_DEFINES}")
|
||||
message(STATUS "Compile defines (Debug): ${CEF_COMPILER_DEFINES_DEBUG}")
|
||||
|
@@ -326,7 +326,7 @@ if(OS_MAC)
|
||||
|
||||
# Find the newest available base SDK.
|
||||
execute_process(COMMAND xcode-select --print-path OUTPUT_VARIABLE XCODE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
foreach(OS_VERSION 15.4 14.2 14.0 11.0)
|
||||
foreach(OS_VERSION 14.2 14.0 11.0)
|
||||
set(SDK "${XCODE_PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${OS_VERSION}.sdk")
|
||||
if(NOT "${CMAKE_OSX_SYSROOT}" AND EXISTS "${SDK}" AND IS_DIRECTORY "${SDK}")
|
||||
set(CMAKE_OSX_SYSROOT ${SDK})
|
||||
@@ -361,6 +361,14 @@ if(OS_MAC)
|
||||
list(APPEND CEF_COMPILER_DEFINES
|
||||
CEF_USE_SANDBOX # Used by apps to test if the sandbox is enabled
|
||||
)
|
||||
|
||||
list(APPEND CEF_STANDARD_LIBS
|
||||
-lsandbox
|
||||
)
|
||||
|
||||
# CEF sandbox library paths.
|
||||
set(CEF_SANDBOX_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/cef_sandbox.a")
|
||||
set(CEF_SANDBOX_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/cef_sandbox.a")
|
||||
endif()
|
||||
|
||||
# CEF Helper app suffixes.
|
||||
@@ -388,6 +396,15 @@ if(OS_WINDOWS)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "")
|
||||
endif()
|
||||
|
||||
if(USE_SANDBOX)
|
||||
# Check if the current MSVC version is compatible with the cef_sandbox.lib
|
||||
# static library. We require VS2015 or newer.
|
||||
if(MSVC_VERSION LESS 1900)
|
||||
message(WARNING "CEF sandbox is not compatible with the current MSVC version (${MSVC_VERSION})")
|
||||
set(USE_SANDBOX OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Consumers who run into LNK4099 warnings can pass /Z7 instead (see issue #385).
|
||||
set(CEF_DEBUG_INFO_FLAG "/Zi" CACHE STRING "Optional flag specifying specific /Z flag to use")
|
||||
|
||||
@@ -432,20 +449,18 @@ if(OS_WINDOWS)
|
||||
list(APPEND CEF_LINKER_FLAGS_DEBUG
|
||||
/DEBUG # Generate debug information
|
||||
)
|
||||
list(APPEND CEF_EXE_LINKER_FLAGS
|
||||
/MANIFEST:NO # No default manifest (see ADD_WINDOWS_MANIFEST macro usage)
|
||||
/LARGEADDRESSAWARE # Allow 32-bit processes to access 3GB of RAM
|
||||
|
||||
# Delayload most libraries as the dlls are simply not required at startup (or
|
||||
# at all, depending on the process type). Some dlls open handles when they are
|
||||
# loaded, and we may not want them to be loaded in renderers or other sandboxed
|
||||
# processes. Conversely, some dlls must be loaded before sandbox lockdown. In
|
||||
# unsandboxed processes they will load when first needed. The linker will
|
||||
# automatically ignore anything which is not linked to the binary at all (it is
|
||||
# harmless to have an unmatched /delayload). Lists should be kept in sync with
|
||||
# targets from Chromium's //build/config/win/BUILD.gn file.
|
||||
set(CEF_DELAYLOAD_FLAGS
|
||||
# Required to support CefScopedLibraryLoader.
|
||||
/DELAYLOAD:libcef.dll
|
||||
|
||||
# "delayloads" target.
|
||||
# Delayload most libraries as the dlls are simply not required at startup (or
|
||||
# at all, depending on the process type). Some dlls open handles when they are
|
||||
# loaded, and we may not want them to be loaded in renderers or other sandboxed
|
||||
# processes. Conversely, some dlls must be loaded before sandbox lockdown. In
|
||||
# unsandboxed processes they will load when first needed. The linker will
|
||||
# automatically ignore anything which is not linked to the binary at all (it is
|
||||
# harmless to have an unmatched /delayload). This list should be kept in sync
|
||||
# with Chromium's "delayloads" target from the //build/config/win/BUILD.gn file.
|
||||
/DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll
|
||||
/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll
|
||||
/DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll
|
||||
@@ -487,31 +502,6 @@ if(OS_WINDOWS)
|
||||
/DELAYLOAD:winusb.dll
|
||||
/DELAYLOAD:wsock32.dll
|
||||
/DELAYLOAD:wtsapi32.dll
|
||||
|
||||
# "delayloads_not_for_child_dll" target.
|
||||
/DELAYLOAD:crypt32.dll
|
||||
/DELAYLOAD:dbghelp.dll
|
||||
/DELAYLOAD:dhcpcsvc.dll
|
||||
/DELAYLOAD:dwrite.dll
|
||||
/DELAYLOAD:iphlpapi.dll
|
||||
/DELAYLOAD:oleaut32.dll
|
||||
/DELAYLOAD:secur32.dll
|
||||
/DELAYLOAD:userenv.dll
|
||||
/DELAYLOAD:winhttp.dll
|
||||
/DELAYLOAD:winmm.dll
|
||||
/DELAYLOAD:winspool.drv
|
||||
/DELAYLOAD:wintrust.dll
|
||||
/DELAYLOAD:ws2_32.dll
|
||||
)
|
||||
list(APPEND CEF_EXE_LINKER_FLAGS
|
||||
# For executable targets.
|
||||
/MANIFEST:NO # No default manifest (see ADD_WINDOWS_MANIFEST macro usage)
|
||||
/LARGEADDRESSAWARE # Allow 32-bit processes to access 3GB of RAM
|
||||
${CEF_DELAYLOAD_FLAGS}
|
||||
)
|
||||
list(APPEND CEF_SHARED_LINKER_FLAGS
|
||||
# For shared library targets.
|
||||
${CEF_DELAYLOAD_FLAGS}
|
||||
)
|
||||
list(APPEND CEF_COMPILER_DEFINES
|
||||
WIN32 _WIN32 _WINDOWS # Windows platform
|
||||
@@ -550,12 +540,9 @@ if(OS_WINDOWS)
|
||||
# Standard libraries.
|
||||
set(CEF_STANDARD_LIBS
|
||||
comctl32.lib
|
||||
crypt32.lib
|
||||
delayimp.lib
|
||||
gdi32.lib
|
||||
rpcrt4.lib
|
||||
shlwapi.lib
|
||||
wintrust.lib
|
||||
ws2_32.lib
|
||||
)
|
||||
|
||||
@@ -600,8 +587,36 @@ if(OS_WINDOWS)
|
||||
|
||||
if(USE_SANDBOX)
|
||||
list(APPEND CEF_COMPILER_DEFINES
|
||||
CEF_USE_BOOTSTRAP # Used by apps to test if the bootstrap is enabled
|
||||
PSAPI_VERSION=1 # Required by cef_sandbox.lib
|
||||
CEF_USE_SANDBOX # Used by apps to test if the sandbox is enabled
|
||||
)
|
||||
list(APPEND CEF_COMPILER_DEFINES_DEBUG
|
||||
_HAS_ITERATOR_DEBUGGING=0 # Disable iterator debugging
|
||||
)
|
||||
|
||||
# Libraries required by cef_sandbox.lib.
|
||||
set(CEF_SANDBOX_STANDARD_LIBS
|
||||
Advapi32.lib
|
||||
dbghelp.lib
|
||||
Delayimp.lib
|
||||
ntdll.lib
|
||||
OleAut32.lib
|
||||
PowrProf.lib
|
||||
Propsys.lib
|
||||
psapi.lib
|
||||
SetupAPI.lib
|
||||
Shell32.lib
|
||||
Shcore.lib
|
||||
Userenv.lib
|
||||
version.lib
|
||||
wbemuuid.lib
|
||||
WindowsApp.lib
|
||||
winmm.lib
|
||||
)
|
||||
|
||||
# CEF sandbox library paths.
|
||||
set(CEF_SANDBOX_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/cef_sandbox.lib")
|
||||
set(CEF_SANDBOX_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/cef_sandbox.lib")
|
||||
endif()
|
||||
|
||||
# Configure use of ATL.
|
||||
|
@@ -47,46 +47,30 @@
|
||||
#define CEF_INCLUDE_BASE_CEF_DUMP_WITHOUT_CRASHING_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_api_hash.h"
|
||||
|
||||
constexpr long long kOneDayInMilliseconds = 86400000;
|
||||
|
||||
///
|
||||
/// This function allows for generating of crash dumps with a throttling
|
||||
/// CefDumpWithoutCrashing allows for generating crash dumps with a throttling
|
||||
/// mechanism, preventing frequent dumps from being generated in a short period
|
||||
/// of time from the same location. If should only be called after CefInitialize
|
||||
/// has been successfully called. The |function_name|, |file_name|, and
|
||||
/// |line_number| parameters specify the origin location of the dump. The
|
||||
/// of time from the same location. The |function_name|, |file_name|, and
|
||||
/// |line_number| determine the location of the dump. The
|
||||
/// |mseconds_between_dumps| is an interval between consecutive dumps in
|
||||
/// milliseconds from the same location.
|
||||
///
|
||||
/// Returns true if the dump was successfully generated, false otherwise.
|
||||
///
|
||||
/// For detailed behavior, usage instructions, and considerations, refer to the
|
||||
/// documentation of DumpWithoutCrashing in base/debug/dump_without_crashing.h.
|
||||
///
|
||||
bool CefDumpWithoutCrashing(
|
||||
long long mseconds_between_dumps = kOneDayInMilliseconds,
|
||||
const char* function_name = __builtin_FUNCTION(),
|
||||
const char* file_name = __builtin_FILE(),
|
||||
int line_number = __builtin_LINE());
|
||||
|
||||
#if CEF_API_REMOVED(13500)
|
||||
///
|
||||
/// This function allows for generating of crash dumps without any throttling
|
||||
/// constraints. If should also only be called after CefInitialize has been
|
||||
/// successfully called.
|
||||
/// CefDumpWithoutCrashingUnthrottled allows for immediate crash dumping without
|
||||
/// any throttling constraints.
|
||||
///
|
||||
/// Returns true if the dump was successfully generated, false otherwise.
|
||||
///
|
||||
/// For detailed behavior, usage instructions, and considerations, refer to the
|
||||
/// documentation of DumpWithoutCrashingUnthrottled in
|
||||
/// base/debug/dump_without_crashing.h.
|
||||
///
|
||||
/// This function is removed in API version 13500. Use CefDumpWithoutCrashing()
|
||||
/// instead.
|
||||
///
|
||||
bool CefDumpWithoutCrashingUnthrottled();
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_DUMP_WITHOUT_CRASHING_H_
|
||||
|
@@ -1,197 +0,0 @@
|
||||
// Copyright (c) 2025 Marshall A. Greenblatt. Portions copyright (c) 2019
|
||||
// Google Inc. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_CEF_IMMEDIATE_CRASH_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_IMMEDIATE_CRASH_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/immediate_crash.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include "include/base/cef_build.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
// Crashes in the fastest possible way with no attempt at logging.
|
||||
// There are several constraints; see http://crbug.com/664209 for more context.
|
||||
//
|
||||
// - TRAP_SEQUENCE_() must be fatal. It should not be possible to ignore the
|
||||
// resulting exception or simply hit 'continue' to skip over it in a debugger.
|
||||
// - Different instances of TRAP_SEQUENCE_() must not be folded together, to
|
||||
// ensure crash reports are debuggable. Unlike __builtin_trap(), asm volatile
|
||||
// blocks will not be folded together.
|
||||
// Note: TRAP_SEQUENCE_() previously required an instruction with a unique
|
||||
// nonce since unlike clang, GCC folds together identical asm volatile
|
||||
// blocks.
|
||||
// - TRAP_SEQUENCE_() must produce a signal that is distinct from an invalid
|
||||
// memory access.
|
||||
// - TRAP_SEQUENCE_() must be treated as a set of noreturn instructions.
|
||||
// __builtin_unreachable() is used to provide that hint here. clang also uses
|
||||
// this as a heuristic to pack the instructions in the function epilogue to
|
||||
// improve code density.
|
||||
// - base::ImmediateCrash() is used in allocation hooks. To prevent recursions,
|
||||
// TRAP_SEQUENCE_() must not allocate.
|
||||
//
|
||||
// Additional properties that are nice to have:
|
||||
// - TRAP_SEQUENCE_() should be as compact as possible.
|
||||
// - The first instruction of TRAP_SEQUENCE_() should not change, to avoid
|
||||
// shifting crash reporting clusters. As a consequence of this, explicit
|
||||
// assembly is preferred over intrinsics.
|
||||
// Note: this last bullet point may no longer be true, and may be removed in
|
||||
// the future.
|
||||
|
||||
// Note: TRAP_SEQUENCE Is currently split into two macro helpers due to the fact
|
||||
// that clang emits an actual instruction for __builtin_unreachable() on certain
|
||||
// platforms (see https://crbug.com/958675). In addition, the int3/bkpt/brk will
|
||||
// be removed in followups, so splitting it up like this now makes it easy to
|
||||
// land the followups.
|
||||
|
||||
#if defined(COMPILER_GCC)
|
||||
|
||||
#if defined(ARCH_CPU_X86_FAMILY)
|
||||
|
||||
// TODO(crbug.com/40625592): In theory, it should be possible to use just
|
||||
// int3. However, there are a number of crashes with SIGILL as the exception
|
||||
// code, so it seems likely that there's a signal handler that allows execution
|
||||
// to continue after SIGTRAP.
|
||||
#define TRAP_SEQUENCE1_() asm volatile("int3")
|
||||
|
||||
#if defined(OS_APPLE)
|
||||
// Intentionally empty: __builtin_unreachable() is always part of the sequence
|
||||
// (see IMMEDIATE_CRASH below) and already emits a ud2 on Mac.
|
||||
#define TRAP_SEQUENCE2_() asm volatile("")
|
||||
#else
|
||||
#define TRAP_SEQUENCE2_() asm volatile("ud2")
|
||||
#endif // defined(OS_APPLE)
|
||||
|
||||
#elif defined(ARCH_CPU_ARMEL)
|
||||
|
||||
// bkpt will generate a SIGBUS when running on armv7 and a SIGTRAP when running
|
||||
// as a 32 bit userspace app on arm64. There doesn't seem to be any way to
|
||||
// cause a SIGTRAP from userspace without using a syscall (which would be a
|
||||
// problem for sandboxing).
|
||||
// TODO(crbug.com/40625592): Remove bkpt from this sequence.
|
||||
#define TRAP_SEQUENCE1_() asm volatile("bkpt #0")
|
||||
#define TRAP_SEQUENCE2_() asm volatile("udf #0")
|
||||
|
||||
#elif defined(ARCH_CPU_ARM64)
|
||||
|
||||
// This will always generate a SIGTRAP on arm64.
|
||||
// TODO(crbug.com/40625592): Remove brk from this sequence.
|
||||
#define TRAP_SEQUENCE1_() asm volatile("brk #0")
|
||||
#define TRAP_SEQUENCE2_() asm volatile("hlt #0")
|
||||
|
||||
#else
|
||||
|
||||
// Crash report accuracy will not be guaranteed on other architectures, but at
|
||||
// least this will crash as expected.
|
||||
#define TRAP_SEQUENCE1_() __builtin_trap()
|
||||
#define TRAP_SEQUENCE2_() asm volatile("")
|
||||
|
||||
#endif // ARCH_CPU_*
|
||||
|
||||
#elif defined(COMPILER_MSVC)
|
||||
|
||||
#if !defined(__clang__)
|
||||
|
||||
// MSVC x64 doesn't support inline asm, so use the MSVC intrinsic.
|
||||
#define TRAP_SEQUENCE1_() __debugbreak()
|
||||
#define TRAP_SEQUENCE2_()
|
||||
|
||||
#elif defined(ARCH_CPU_ARM64)
|
||||
|
||||
// Windows ARM64 uses "BRK #F000" as its breakpoint instruction, and
|
||||
// __debugbreak() generates that in both VC++ and clang.
|
||||
#define TRAP_SEQUENCE1_() __debugbreak()
|
||||
// Intentionally empty: __builtin_unreachable() is always part of the sequence
|
||||
// (see IMMEDIATE_CRASH below) and already emits a ud2 on Win64,
|
||||
// https://crbug.com/958373
|
||||
#define TRAP_SEQUENCE2_() __asm volatile("")
|
||||
|
||||
#else
|
||||
|
||||
#define TRAP_SEQUENCE1_() asm volatile("int3")
|
||||
#define TRAP_SEQUENCE2_() asm volatile("ud2")
|
||||
|
||||
#endif // __clang__
|
||||
|
||||
#else
|
||||
|
||||
#error No supported trap sequence!
|
||||
|
||||
#endif // COMPILER_GCC
|
||||
|
||||
#define TRAP_SEQUENCE_() \
|
||||
do { \
|
||||
TRAP_SEQUENCE1_(); \
|
||||
TRAP_SEQUENCE2_(); \
|
||||
} while (false)
|
||||
|
||||
// This version of ALWAYS_INLINE inlines even in is_debug=true.
|
||||
// TODO(pbos): See if NDEBUG can be dropped from ALWAYS_INLINE as well, and if
|
||||
// so merge. Otherwise document why it cannot inline in debug in
|
||||
// base/compiler_specific.h.
|
||||
#if defined(COMPILER_GCC)
|
||||
#define IMMEDIATE_CRASH_ALWAYS_INLINE inline __attribute__((__always_inline__))
|
||||
#elif defined(COMPILER_MSVC)
|
||||
#define IMMEDIATE_CRASH_ALWAYS_INLINE __forceinline
|
||||
#else
|
||||
#define IMMEDIATE_CRASH_ALWAYS_INLINE inline
|
||||
#endif
|
||||
|
||||
namespace base {
|
||||
|
||||
[[noreturn]] IMMEDIATE_CRASH_ALWAYS_INLINE void ImmediateCrash() {
|
||||
#if defined(OS_WIN)
|
||||
// We can't use abort() on Windows because it results in the
|
||||
// abort/retry/ignore dialog which disrupts automated tests.
|
||||
// TODO(crbug.com/40948553): investigate if such dialogs can
|
||||
// be suppressed
|
||||
TRAP_SEQUENCE_();
|
||||
#if defined(__clang__) || defined(COMPILER_GCC)
|
||||
__builtin_unreachable();
|
||||
#endif // defined(__clang__) || defined(COMPILER_GCC)
|
||||
#else // !defined(OS_WIN)
|
||||
abort();
|
||||
#endif // !defined(OS_WIN)
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_LOCK_H_
|
@@ -189,50 +189,16 @@
|
||||
namespace cef {
|
||||
namespace logging {
|
||||
|
||||
class ScopedEarlySupport;
|
||||
|
||||
namespace internal {
|
||||
|
||||
// Structure defining the baseline logging implementation used by client
|
||||
// and wrapper code that links libcef_dll_wrapper.
|
||||
struct Implementation {
|
||||
decltype(&cef_get_min_log_level) get_min_log_level;
|
||||
decltype(&cef_get_vlog_level) get_vlog_level;
|
||||
decltype(&cef_log) log;
|
||||
};
|
||||
|
||||
// Returns the currently configured logging implementation.
|
||||
const Implementation* GetImplementation();
|
||||
|
||||
// Change the logging implementation for the lifespan of this scoped object.
|
||||
// See ScopedEarlySupport for usage.
|
||||
class ScopedImplementation {
|
||||
public:
|
||||
ScopedImplementation(const ScopedImplementation&) = delete;
|
||||
ScopedImplementation& operator=(const ScopedImplementation&) = delete;
|
||||
|
||||
private:
|
||||
friend class logging::ScopedEarlySupport;
|
||||
|
||||
ScopedImplementation();
|
||||
~ScopedImplementation();
|
||||
void Init(const Implementation* impl);
|
||||
|
||||
const Implementation* previous_ = nullptr;
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
|
||||
// Gets the current log level.
|
||||
inline int GetMinLogLevel() {
|
||||
return internal::GetImplementation()->get_min_log_level();
|
||||
return cef_get_min_log_level();
|
||||
}
|
||||
|
||||
// Gets the current vlog level for the given file (usually taken from
|
||||
// __FILE__). Note that |N| is the size *with* the null terminator.
|
||||
template <size_t N>
|
||||
int GetVlogLevel(const char (&file)[N]) {
|
||||
return internal::GetImplementation()->get_vlog_level(file, N);
|
||||
return cef_get_vlog_level(file, N);
|
||||
}
|
||||
|
||||
typedef int LogSeverity;
|
||||
@@ -252,64 +218,6 @@ const LogSeverity LOG_DFATAL = LOG_ERROR;
|
||||
const LogSeverity LOG_DFATAL = LOG_FATAL;
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Support the use of CEF logging macros during early application startup,
|
||||
/// prior to loading libcef. Not for use during or after CEF initialization.
|
||||
/// Support is scoped to this object's lifespan. This implementation is not
|
||||
/// thread-safe and should not be used for logging from multiple threads.
|
||||
///
|
||||
class ScopedEarlySupport final : public internal::ScopedImplementation {
|
||||
public:
|
||||
///
|
||||
/// Logging configuration.
|
||||
///
|
||||
struct Config {
|
||||
///
|
||||
/// Configure logging level.
|
||||
///
|
||||
int min_log_level = LOG_ERROR;
|
||||
int vlog_level = 0;
|
||||
|
||||
///
|
||||
/// Configure log line formatting.
|
||||
///
|
||||
const char* log_prefix = nullptr;
|
||||
bool log_process_id = true;
|
||||
bool log_thread_id = true;
|
||||
bool log_timestamp = true;
|
||||
bool log_tickcount = true;
|
||||
|
||||
///
|
||||
/// Optionally override the default handling of formatted log lines. For
|
||||
/// example, this callback could be used to write |log_line| to a file.
|
||||
/// Return false to proceed with the default behavior of writing to stderr
|
||||
/// or debugger console. FATAL errors will still intentionally crash the
|
||||
/// application.
|
||||
///
|
||||
bool (*formatted_log_handler)(const char* /*log_line*/) = nullptr;
|
||||
};
|
||||
|
||||
explicit ScopedEarlySupport(const Config& config);
|
||||
|
||||
ScopedEarlySupport(const ScopedEarlySupport&) = delete;
|
||||
ScopedEarlySupport& operator=(const ScopedEarlySupport&) = delete;
|
||||
|
||||
private:
|
||||
static const Config& GetConfig();
|
||||
|
||||
static int get_min_log_level();
|
||||
static int get_vlog_level(const char* file_start, size_t N);
|
||||
static void log(const char* file,
|
||||
int line,
|
||||
int severity,
|
||||
const char* message);
|
||||
|
||||
const struct Impl {
|
||||
internal::Implementation ptrs;
|
||||
Config config;
|
||||
} impl_;
|
||||
};
|
||||
|
||||
// A few definitions of macros that don't generate much code. These are used
|
||||
// by LOG() and LOG_IF, etc. Since these are used all over our code, it's
|
||||
// better to have compact code for these operations.
|
||||
|
@@ -72,8 +72,8 @@ int CefExecuteProcess(const CefMainArgs& args,
|
||||
/// early exit is desired (for example, due to process singleton relaunch
|
||||
/// behavior). If this function returns false then the application should exit
|
||||
/// immediately without calling any other CEF functions except, optionally,
|
||||
/// CefGetExitCode. The |windows_sandbox_info| parameter is only used on Windows
|
||||
/// and may be NULL (see cef_sandbox_win.h for details).
|
||||
/// CefGetErrorCode. The |windows_sandbox_info| parameter is only used on
|
||||
/// Windows and may be NULL (see cef_sandbox_win.h for details).
|
||||
///
|
||||
/*--cef(api_hash_check,optional_param=application,
|
||||
optional_param=windows_sandbox_info)--*/
|
||||
|
@@ -707,24 +707,12 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
|
||||
virtual void WasHidden(bool hidden) = 0;
|
||||
|
||||
///
|
||||
/// Notify the browser that screen information has changed. Updated
|
||||
/// information will be sent to the renderer process to configure screen size
|
||||
/// and position values used by CSS and JavaScript (window.deviceScaleFactor,
|
||||
/// window.screenX/Y, window.outerWidth/Height, etc.). For background see
|
||||
/// https://bitbucket.org/chromiumembedded/cef/wiki/GeneralUsage.md#markdown-header-coordinate-systems
|
||||
///
|
||||
/// This method is used with (a) windowless rendering and (b) windowed
|
||||
/// rendering with external (client-provided) root window.
|
||||
///
|
||||
/// With windowless rendering the browser will call
|
||||
/// CefRenderHandler::GetScreenInfo, CefRenderHandler::GetRootScreenRect and
|
||||
/// CefRenderHandler::GetViewRect. This simulates moving or resizing the root
|
||||
/// window in the current display, moving the root window from one display to
|
||||
/// another, or changing the properties of the current display.
|
||||
///
|
||||
/// With windowed rendering the browser will call
|
||||
/// CefDisplayHandler::GetRootWindowScreenRect and use the associated
|
||||
/// display properties.
|
||||
/// Send a notification to the browser that the screen info has changed. The
|
||||
/// browser will then call CefRenderHandler::GetScreenInfo to update the
|
||||
/// screen information with the new values. This simulates moving the webview
|
||||
/// window from one display to another, or changing the properties of the
|
||||
/// current display. This method is only used when window rendering is
|
||||
/// disabled.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void NotifyScreenInfoChanged() = 0;
|
||||
|
@@ -38,7 +38,6 @@
|
||||
#define CEF_INCLUDE_CEF_DISPLAY_HANDLER_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_api_hash.h"
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_frame.h"
|
||||
@@ -124,7 +123,7 @@ class CefDisplayHandler : public virtual CefBaseRefCounted {
|
||||
///
|
||||
/// Called when auto-resize is enabled via
|
||||
/// CefBrowserHost::SetAutoResizeEnabled and the contents have auto-resized.
|
||||
/// |new_size| will be the desired size in DIP coordinates. Return true if
|
||||
/// |new_size| will be the desired size in view coordinates. Return true if
|
||||
/// the resize was handled or false for default handling.
|
||||
///
|
||||
/*--cef()--*/
|
||||
@@ -163,46 +162,6 @@ class CefDisplayHandler : public virtual CefBaseRefCounted {
|
||||
virtual void OnMediaAccessChange(CefRefPtr<CefBrowser> browser,
|
||||
bool has_video_access,
|
||||
bool has_audio_access) {}
|
||||
|
||||
#if CEF_API_ADDED(13700)
|
||||
///
|
||||
/// Called when JavaScript is requesting new bounds via window.moveTo/By() or
|
||||
/// window.resizeTo/By(). |new_bounds| are in DIP screen coordinates.
|
||||
///
|
||||
/// With Views-hosted browsers |new_bounds| are the desired bounds for
|
||||
/// the containing CefWindow and may be passed directly to
|
||||
/// CefWindow::SetBounds. With external (client-provided) parent on macOS and
|
||||
/// Windows |new_bounds| are the desired frame bounds for the containing root
|
||||
/// window. With other non-Views browsers |new_bounds| are the desired bounds
|
||||
/// for the browser content only unless the client implements either
|
||||
/// CefDisplayHandler::GetRootWindowScreenRect for windowed browsers or
|
||||
/// CefRenderHandler::GetWindowScreenRect for windowless browsers. Clients may
|
||||
/// expand browser content bounds to window bounds using OS-specific or
|
||||
/// CefDisplay methods.
|
||||
///
|
||||
/// Return true if this method was handled or false for default handling.
|
||||
/// Default move/resize behavior is only provided with Views-hosted Chrome
|
||||
/// style browsers.
|
||||
///
|
||||
/*--cef(added=13700)--*/
|
||||
virtual bool OnContentsBoundsChange(CefRefPtr<CefBrowser> browser,
|
||||
const CefRect& new_bounds) {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
/// Called to retrieve the external (client-provided) root window rectangle in
|
||||
/// screen DIP coordinates. Only called for windowed browsers on Windows and
|
||||
/// Linux. Return true if the rectangle was provided. Return false to use the
|
||||
/// root window bounds on Windows or the browser content bounds on Linux. For
|
||||
/// additional usage details see CefBrowserHost::NotifyScreenInfoChanged.
|
||||
///
|
||||
/*--cef(added=13700)--*/
|
||||
virtual bool GetRootWindowScreenRect(CefRefPtr<CefBrowser> browser,
|
||||
CefRect& rect) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_DISPLAY_HANDLER_H_
|
||||
|
@@ -48,8 +48,14 @@ extern "C" {
|
||||
/// The sandbox is used to restrict sub-processes (renderer, GPU, etc) from
|
||||
/// directly accessing system resources. This helps to protect the user from
|
||||
/// untrusted and potentially malicious Web content. See
|
||||
/// https://bitbucket.org/chromiumembedded/cef/wiki/SandboxSetup.md for usage
|
||||
/// details. See include/wrapper/cef_library_loader.h for example usage.
|
||||
/// http://www.chromium.org/developers/design-documents/sandbox for complete
|
||||
/// details.
|
||||
///
|
||||
/// To enable the sandbox on macOS the following requirements must be met:
|
||||
/// 1. Link the helper process executable with the cef_sandbox static library.
|
||||
/// 2. Call the cef_sandbox_initialize() function at the beginning of the
|
||||
/// helper executable main() function and before loading the CEF framework
|
||||
/// library. See include/wrapper/cef_library_loader.h for example usage.
|
||||
///
|
||||
|
||||
///
|
||||
@@ -70,7 +76,7 @@ CEF_EXPORT void cef_sandbox_destroy(void* sandbox_context);
|
||||
///
|
||||
/// Scoped helper for managing the life span of a sandbox context handle.
|
||||
///
|
||||
class CefScopedSandboxContext final {
|
||||
class CEF_EXPORT CefScopedSandboxContext {
|
||||
public:
|
||||
CefScopedSandboxContext();
|
||||
~CefScopedSandboxContext();
|
||||
@@ -81,8 +87,7 @@ class CefScopedSandboxContext final {
|
||||
bool Initialize(int argc, char** argv);
|
||||
|
||||
private:
|
||||
void* library_handle_ = nullptr;
|
||||
void* sandbox_context_ = nullptr;
|
||||
void* sandbox_context_;
|
||||
};
|
||||
#endif // __cplusplus
|
||||
|
||||
|
@@ -37,12 +37,6 @@
|
||||
|
||||
#if defined(OS_WIN)
|
||||
|
||||
#include "include/cef_version_info.h"
|
||||
|
||||
#if !defined(GENERATING_CEF_API_HASH)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -52,9 +46,17 @@ extern "C" {
|
||||
/// The sandbox is used to restrict sub-processes (renderer, GPU, etc) from
|
||||
/// directly accessing system resources. This helps to protect the user from
|
||||
/// untrusted and potentially malicious Web content. See
|
||||
/// https://bitbucket.org/chromiumembedded/cef/wiki/SandboxSetup.md for usage
|
||||
/// http://www.chromium.org/developers/design-documents/sandbox for complete
|
||||
/// details.
|
||||
///
|
||||
/// To enable the sandbox on Windows the following requirements must be met:
|
||||
/// 1. Use the same executable for the browser process and all sub-processes.
|
||||
/// 2. Link the executable with the cef_sandbox static library.
|
||||
/// 3. Call the cef_sandbox_info_create() function from within the executable
|
||||
/// (not from a separate DLL) and pass the resulting pointer into both the
|
||||
/// CefExecuteProcess() and CefInitialize() functions via the
|
||||
/// |windows_sandbox_info| parameter.
|
||||
///
|
||||
|
||||
///
|
||||
/// Create the sandbox information object for this process. It is safe to create
|
||||
@@ -74,7 +76,7 @@ void cef_sandbox_info_destroy(void* sandbox_info);
|
||||
///
|
||||
/// Manages the life span of a sandbox information object.
|
||||
///
|
||||
class CefScopedSandboxInfo final {
|
||||
class CefScopedSandboxInfo {
|
||||
public:
|
||||
CefScopedSandboxInfo() { sandbox_info_ = cef_sandbox_info_create(); }
|
||||
~CefScopedSandboxInfo() { cef_sandbox_info_destroy(sandbox_info_); }
|
||||
@@ -86,39 +88,6 @@ class CefScopedSandboxInfo final {
|
||||
};
|
||||
#endif // __cplusplus
|
||||
|
||||
#if defined(CEF_BUILD_BOOTSTRAP)
|
||||
#define CEF_BOOTSTRAP_EXPORT __declspec(dllimport)
|
||||
#else
|
||||
#define CEF_BOOTSTRAP_EXPORT __declspec(dllexport)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Entry point to be implemented by client DLLs using bootstrap.exe for
|
||||
/// windows (/SUBSYSTEM:WINDOWS) applications.
|
||||
///
|
||||
CEF_BOOTSTRAP_EXPORT int RunWinMain(HINSTANCE hInstance,
|
||||
LPTSTR lpCmdLine,
|
||||
int nCmdShow,
|
||||
void* sandbox_info,
|
||||
cef_version_info_t* version_info);
|
||||
|
||||
///
|
||||
/// Entry point to be implemented by client DLLs using bootstrapc.exe for
|
||||
/// console (/SUBSYSTEM:CONSOLE) applications.
|
||||
///
|
||||
CEF_BOOTSTRAP_EXPORT int RunConsoleMain(int argc,
|
||||
char* argv[],
|
||||
void* sandbox_info,
|
||||
cef_version_info_t* version_info);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // defined(OS_WIN)
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_SANDBOX_WIN_H_
|
||||
|
@@ -30,9 +30,6 @@
|
||||
#ifndef CEF_INCLUDE_CEF_VERSION_INFO_H_
|
||||
#define CEF_INCLUDE_CEF_VERSION_INFO_H_
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "include/cef_api_hash.h"
|
||||
#include "include/internal/cef_export.h"
|
||||
|
||||
#if !defined(GENERATING_CEF_API_HASH)
|
||||
@@ -58,66 +55,6 @@ extern "C" {
|
||||
///
|
||||
CEF_EXPORT int cef_version_info(int entry);
|
||||
|
||||
#if CEF_API_ADDED(13800)
|
||||
|
||||
///
|
||||
/// Structure representing all CEF version information.
|
||||
///
|
||||
typedef struct _cef_version_info_t {
|
||||
///
|
||||
/// Size of this structure.
|
||||
///
|
||||
size_t size;
|
||||
|
||||
int cef_version_major;
|
||||
int cef_version_minor;
|
||||
int cef_version_patch;
|
||||
int cef_commit_number;
|
||||
int chrome_version_major;
|
||||
int chrome_version_minor;
|
||||
int chrome_version_build;
|
||||
int chrome_version_patch;
|
||||
} cef_version_info_t;
|
||||
|
||||
///
|
||||
/// Return all CEF version information for the libcef library.
|
||||
///
|
||||
CEF_EXPORT void cef_version_info_all(cef_version_info_t* info);
|
||||
|
||||
#elif !defined(GENERATING_CEF_API_HASH)
|
||||
|
||||
// Unversioned definition to support use of the bootstrap and
|
||||
// CefScopedLibraryLoader with older API versions.
|
||||
typedef struct _cef_version_info_t {
|
||||
// Size of this structure.
|
||||
size_t size;
|
||||
|
||||
int cef_version_major;
|
||||
int cef_version_minor;
|
||||
int cef_version_patch;
|
||||
int cef_commit_number;
|
||||
int chrome_version_major;
|
||||
int chrome_version_minor;
|
||||
int chrome_version_build;
|
||||
int chrome_version_patch;
|
||||
} cef_version_info_t;
|
||||
|
||||
#endif // !defined(GENERATING_CEF_API_HASH)
|
||||
|
||||
///
|
||||
/// Populate CEF version information for the client library.
|
||||
///
|
||||
#define CEF_POPULATE_VERSION_INFO(info) \
|
||||
(info)->size = sizeof(cef_version_info_t); \
|
||||
(info)->cef_version_major = CEF_VERSION_MAJOR; \
|
||||
(info)->cef_version_minor = CEF_VERSION_MINOR; \
|
||||
(info)->cef_version_patch = CEF_VERSION_PATCH; \
|
||||
(info)->cef_commit_number = CEF_COMMIT_NUMBER; \
|
||||
(info)->chrome_version_major = CHROME_VERSION_MAJOR; \
|
||||
(info)->chrome_version_minor = CHROME_VERSION_MINOR; \
|
||||
(info)->chrome_version_build = CHROME_VERSION_BUILD; \
|
||||
(info)->chrome_version_patch = CHROME_VERSION_PATCH
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -41,8 +41,6 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "include/internal/cef_export.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@@ -42,37 +42,22 @@ extern "C" {
|
||||
// See include/base/cef_dump_without_crashing.h for intended usage.
|
||||
|
||||
///
|
||||
/// This function allows for generating of crash dumps with a throttling
|
||||
/// mechanism, preventing frequent dumps from being generated in a short period
|
||||
/// of time from the same location. If should only be called after CefInitialize
|
||||
/// has been successfully called. The |function_name|, |file_name|, and
|
||||
/// |line_number| parameters specify the origin location of the dump. The
|
||||
/// |mseconds_between_dumps| is an interval between consecutive dumps in
|
||||
/// milliseconds from the same location.
|
||||
///
|
||||
/// Returns true (1) if the dump was successfully generated, false otherwise.
|
||||
///
|
||||
/// For detailed behavior, usage instructions, and considerations, refer to the
|
||||
/// documentation of DumpWithoutCrashing in base/debug/dump_without_crashing.h.
|
||||
/// cef_dump_without_crashing allows for capturing crash dumps in a throttled
|
||||
/// manner. This function should only be called after CefInitialize has been
|
||||
/// successfully called. For detailed behavior, usage instructions, and
|
||||
/// considerations, refer to the documentation of DumpWithoutCrashing in
|
||||
/// base/debug/dump_without_crashing.h.
|
||||
///
|
||||
CEF_EXPORT int cef_dump_without_crashing(long long mseconds_between_dumps,
|
||||
const char* function_name,
|
||||
const char* file_name,
|
||||
int line_number);
|
||||
|
||||
///
|
||||
/// This function allows for generating of crash dumps without any throttling
|
||||
/// constraints. If should also only be called after CefInitialize has been
|
||||
/// successfully called.
|
||||
///
|
||||
/// Returns true (1) if the dump was successfully generated, false otherwise.
|
||||
///
|
||||
/// For detailed behavior, usage instructions, and considerations, refer to the
|
||||
/// documentation of DumpWithoutCrashingUnthrottled in
|
||||
/// base/debug/dump_without_crashing.h.
|
||||
///
|
||||
/// This function is removed in API version 13500. Use
|
||||
/// cef_dump_without_crashing() instead.
|
||||
/// cef_dump_without_crashing_unthrottled allows for capturing crash dumps
|
||||
/// without any throttling constraints. This function should also only be called
|
||||
/// after CefInitialize has been successfully called. For detailed behavior,
|
||||
/// usage instructions, and considerations, refer to the documentation of
|
||||
/// DumpWithoutCrashingUnthrottled in base/debug/dump_without_crashing.h.
|
||||
///
|
||||
CEF_EXPORT int cef_dump_without_crashing_unthrottled();
|
||||
|
||||
|
@@ -672,11 +672,7 @@ typedef struct _cef_browser_settings_t {
|
||||
/// Controls whether databases can be used. Also configurable using the
|
||||
/// "disable-databases" command-line switch.
|
||||
///
|
||||
#if CEF_API_ADDED(13800)
|
||||
cef_state_t databases_deprecated;
|
||||
#else
|
||||
cef_state_t databases;
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Controls whether WebGL can be used. Note that WebGL requires hardware
|
||||
@@ -1065,11 +1061,6 @@ typedef enum {
|
||||
|
||||
CEF_RESULT_CODE_CHROME_FIRST,
|
||||
|
||||
#if CEF_API_ADDED(13800)
|
||||
/// The process is of an unknown type.
|
||||
CEF_RESULT_CODE_BAD_PROCESS_TYPE = 6,
|
||||
#endif
|
||||
|
||||
/// A critical chrome file is missing.
|
||||
CEF_RESULT_CODE_MISSING_DATA = 7,
|
||||
|
||||
@@ -1102,16 +1093,7 @@ typedef enum {
|
||||
/// system state can't be recovered and will be unstable.
|
||||
CEF_RESULT_CODE_SYSTEM_RESOURCE_EXHAUSTED = 37,
|
||||
|
||||
#if CEF_API_ADDED(13800)
|
||||
/// The browser process exited because it was re-launched without elevation.
|
||||
CEF_RESULT_CODE_NORMAL_EXIT_AUTO_DE_ELEVATED = 38,
|
||||
#endif
|
||||
|
||||
#if CEF_API_ADDED(13800)
|
||||
CEF_RESULT_CODE_CHROME_LAST = 39,
|
||||
#else
|
||||
CEF_RESULT_CODE_CHROME_LAST = 38,
|
||||
#endif
|
||||
|
||||
// The following values should be kept in sync with Chromium's
|
||||
// sandbox::TerminationCodes type.
|
||||
@@ -1289,11 +1271,7 @@ typedef enum {
|
||||
PDE_TYPE_BYTES,
|
||||
PDE_TYPE_FILE,
|
||||
|
||||
#if CEF_API_ADDED(13601)
|
||||
PDE_TYPE_NUM_VALUES,
|
||||
#else
|
||||
PDF_TYPE_NUM_VALUES,
|
||||
#endif
|
||||
} cef_postdataelement_type_t;
|
||||
|
||||
///
|
||||
@@ -3646,9 +3624,6 @@ typedef enum {
|
||||
#endif
|
||||
#if CEF_API_ADDED(13400)
|
||||
CEF_CPAIT_CHANGE_PASSWORD,
|
||||
#endif
|
||||
#if CEF_API_ADDED(13800)
|
||||
CEF_CPAIT_LENS_OVERLAY_HOMEWORK,
|
||||
#endif
|
||||
CEF_CPAIT_NUM_VALUES,
|
||||
} cef_chrome_page_action_icon_type_t;
|
||||
@@ -3659,13 +3634,8 @@ typedef enum {
|
||||
///
|
||||
typedef enum {
|
||||
CEF_CTBT_CAST,
|
||||
#if CEF_API_REMOVED(13600)
|
||||
CEF_CTBT_DOWNLOAD,
|
||||
CEF_CTBT_SEND_TAB_TO_SELF,
|
||||
#else
|
||||
CEF_CTBT_DOWNLOAD_DEPRECATED,
|
||||
CEF_CTBT_SEND_TAB_TO_SELF_DEPRECATED,
|
||||
#endif
|
||||
CEF_CTBT_SIDE_PANEL,
|
||||
CEF_CTBT_NUM_VALUES,
|
||||
} cef_chrome_toolbar_button_type_t;
|
||||
@@ -3818,9 +3788,6 @@ typedef enum {
|
||||
CEF_PERMISSION_TYPE_WEB_APP_INSTALLATION = 1 << 22,
|
||||
CEF_PERMISSION_TYPE_WINDOW_MANAGEMENT = 1 << 23,
|
||||
CEF_PERMISSION_TYPE_FILE_SYSTEM_ACCESS = 1 << 24,
|
||||
#if CEF_API_ADDED(13600)
|
||||
CEF_PERMISSION_TYPE_LOCAL_NETWORK_ACCESS = 1 << 25,
|
||||
#endif
|
||||
} cef_permission_request_types_t;
|
||||
|
||||
///
|
||||
|
@@ -43,12 +43,11 @@ extern "C" {
|
||||
/// ContentSettingsType type.
|
||||
///
|
||||
typedef enum {
|
||||
/// This setting governs whether cookies are enabled by the user in the
|
||||
// This setting governs whether cookies are enabled by the user in the
|
||||
/// provided context. However, it may be overridden by other settings. This
|
||||
/// enum should NOT be read directly to determine whether cookies are enabled;
|
||||
/// the client should instead rely on the CookieSettings API.
|
||||
CEF_CONTENT_SETTING_TYPE_COOKIES,
|
||||
|
||||
CEF_CONTENT_SETTING_TYPE_IMAGES,
|
||||
CEF_CONTENT_SETTING_TYPE_JAVASCRIPT,
|
||||
|
||||
@@ -236,15 +235,11 @@ typedef enum {
|
||||
/// screens. See also: https://w3c.github.io/window-placement
|
||||
CEF_CONTENT_SETTING_TYPE_WINDOW_MANAGEMENT,
|
||||
|
||||
/// Stores whether to allow insecure websites to make private network
|
||||
/// requests.
|
||||
/// See also: https://wicg.github.io/cors-rfc1918
|
||||
/// Set through enterprise policies only.
|
||||
#if CEF_API_ADDED(13800)
|
||||
CEF_CONTENT_SETTING_TYPE_INSECURE_PRIVATE_NETWORK_DEPRECATED,
|
||||
#else
|
||||
/// Stores whether to allow insecure websites to make private network
|
||||
/// requests.
|
||||
/// See also: https://wicg.github.io/cors-rfc1918
|
||||
/// Set through enterprise policies only.
|
||||
CEF_CONTENT_SETTING_TYPE_INSECURE_PRIVATE_NETWORK,
|
||||
#endif
|
||||
|
||||
/// Content setting which stores whether or not a site can access low-level
|
||||
/// locally installed font data using the Local Fonts Access API.
|
||||
@@ -334,7 +329,7 @@ typedef enum {
|
||||
/// HTTP header.
|
||||
CEF_CONTENT_SETTING_TYPE_FEDERATED_IDENTITY_IDENTITY_PROVIDER_SIGNIN_STATUS,
|
||||
|
||||
/// Website setting which is used for RevokedPermissionsService to
|
||||
/// Website setting which is used for UnusedSitePermissionsService to
|
||||
/// store revoked permissions of unused sites from unused site permissions
|
||||
/// feature.
|
||||
CEF_CONTENT_SETTING_TYPE_REVOKED_UNUSED_SITE_PERMISSIONS,
|
||||
@@ -387,16 +382,12 @@ typedef enum {
|
||||
/// a requesting-origin/top-level-site combination and persistent.
|
||||
CEF_CONTENT_SETTING_TYPE_TOP_LEVEL_TPCD_TRIAL,
|
||||
|
||||
/// Content Setting for a first-party origin trial that allows websites to
|
||||
/// enable third-party cookie deprecation.
|
||||
/// ALLOW (default): no effect (e.g. third-party cookies allowed, if not
|
||||
/// blocked otherwise).
|
||||
/// BLOCK: third-party cookies blocked, but 3PCD mitigations enabled.
|
||||
#if CEF_API_ADDED(13601)
|
||||
CEF_CONTENT_SETTING_TYPE_TOP_LEVEL_TPCD_ORIGIN_TRIAL,
|
||||
#else
|
||||
/// Content Setting for a first-party origin trial that allows websites to
|
||||
/// enable third-party cookie deprecation.
|
||||
/// ALLOW (default): no effect (e.g. third-party cookies allowed, if not
|
||||
/// blocked otherwise).
|
||||
/// BLOCK: third-party cookies blocked, but 3PCD mitigations enabled.
|
||||
CEF_CONTENT_SETTING_TOP_LEVEL_TPCD_ORIGIN_TRIAL,
|
||||
#endif
|
||||
|
||||
/// Content setting used to indicate whether entering picture-in-picture
|
||||
/// automatically should be enabled.
|
||||
@@ -447,7 +438,7 @@ typedef enum {
|
||||
/// access to mouse inputs.
|
||||
CEF_CONTENT_SETTING_TYPE_POINTER_LOCK,
|
||||
|
||||
/// Website setting which is used for RevokedPermissionsService to store
|
||||
/// Website setting which is used for UnusedSitePermissionsService to store
|
||||
/// auto-revoked notification permissions from abusive sites.
|
||||
CEF_CONTENT_SETTING_TYPE_REVOKED_ABUSIVE_NOTIFICATION_PERMISSIONS,
|
||||
|
||||
@@ -504,33 +495,6 @@ typedef enum {
|
||||
CEF_CONTENT_SETTING_TYPE_CONTROLLED_FRAME,
|
||||
#endif
|
||||
|
||||
#if CEF_API_ADDED(13500)
|
||||
/// Website setting which is used for RevokedPermissionsService to
|
||||
/// store revoked notification permissions of disruptive sites.
|
||||
CEF_CONTENT_SETTING_TYPE_REVOKED_DISRUPTIVE_NOTIFICATION_PERMISSIONS,
|
||||
#endif
|
||||
|
||||
#if CEF_API_ADDED(13600)
|
||||
/// Content setting for whether the site is allowed to make local network
|
||||
/// requests.
|
||||
CEF_CONTENT_SETTING_TYPE_LOCAL_NETWORK_ACCESS,
|
||||
#endif
|
||||
|
||||
#if CEF_API_ADDED(13800)
|
||||
/// Stores information on-device language packs for which a site has
|
||||
/// installed using the Web Speech API.
|
||||
CEF_CONTENT_SETTING_TYPE_ON_DEVICE_SPEECH_RECOGNITION_LANGUAGES_DOWNLOADED,
|
||||
|
||||
/// Stores which Translator API language packs the site has initialized.
|
||||
CEF_CONTENT_SETTING_TYPE_INITIALIZED_TRANSLATIONS,
|
||||
|
||||
/// Stores a list of notification ids where content detection found the
|
||||
/// notification to be suspicious and a warning has already been shown for the
|
||||
/// site. Used for recovering notification contents from the database if the
|
||||
/// user decides they would like to see all of these notifications.
|
||||
CEF_CONTENT_SETTING_TYPE_SUSPICIOUS_NOTIFICATION_IDS,
|
||||
#endif
|
||||
|
||||
CEF_CONTENT_SETTING_TYPE_NUM_VALUES,
|
||||
} cef_content_setting_types_t;
|
||||
|
||||
|
@@ -567,9 +567,7 @@ struct CefBrowserSettingsTraits {
|
||||
target->text_area_resize = src->text_area_resize;
|
||||
target->tab_to_links = src->tab_to_links;
|
||||
target->local_storage = src->local_storage;
|
||||
#if !CEF_API_ADDED(13800)
|
||||
target->databases = src->databases;
|
||||
#endif
|
||||
target->webgl = src->webgl;
|
||||
|
||||
target->background_color = src->background_color;
|
||||
|
@@ -38,7 +38,6 @@
|
||||
#define CEF_INCLUDE_VIEWS_CEF_BROWSER_VIEW_DELEGATE_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_api_hash.h"
|
||||
#include "include/cef_client.h"
|
||||
#include "include/views/cef_view_delegate.h"
|
||||
|
||||
@@ -130,18 +129,6 @@ class CefBrowserViewDelegate : public CefViewDelegate {
|
||||
return false;
|
||||
}
|
||||
|
||||
#if CEF_API_ADDED(13601)
|
||||
///
|
||||
/// Return true to allow the use of JavaScript moveTo/By() and resizeTo/By()
|
||||
/// (without user activation) with Document picture-in-picture popups.
|
||||
///
|
||||
/*--cef(added=13601)--*/
|
||||
virtual bool AllowMoveForPictureInPicture(
|
||||
CefRefPtr<CefBrowserView> browser_view) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Called when |browser_view| receives a gesture command. Return true to
|
||||
/// handle (or disable) a |gesture_command| or false to propagate the gesture
|
||||
|
@@ -50,9 +50,6 @@
|
||||
/// indicated. Methods must be called on the browser process UI thread unless
|
||||
/// otherwise indicated.
|
||||
///
|
||||
/// For details on coordinate systems and usage see
|
||||
/// https://bitbucket.org/chromiumembedded/cef/wiki/GeneralUsage#markdown-header-coordinate-systems
|
||||
///
|
||||
/*--cef(source=library)--*/
|
||||
class CefDisplay : public CefBaseRefCounted {
|
||||
public:
|
||||
@@ -132,9 +129,7 @@ class CefDisplay : public CefBaseRefCounted {
|
||||
/// Returns this Display's device pixel scale factor. This specifies how much
|
||||
/// the UI should be scaled when the actual output has more pixels than
|
||||
/// standard displays (which is around 100~120dpi). The potential return
|
||||
/// values differ by platform. Windowed browsers with 1.0 zoom will have a
|
||||
/// JavaScript `window.devicePixelRatio` value matching the associated
|
||||
/// Display's GetDeviceScaleFactor() value.
|
||||
/// values differ by platform.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual float GetDeviceScaleFactor() = 0;
|
||||
|
@@ -1,151 +0,0 @@
|
||||
// Copyright (c) 2025 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 are only available to applications that link
|
||||
// against the libcef_dll_wrapper target.
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_WRAPPER_CEF_CERTIFICATE_UTIL_WIN_H_
|
||||
#define CEF_INCLUDE_WRAPPER_CEF_CERTIFICATE_UTIL_WIN_H_
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace cef_certificate_util {
|
||||
|
||||
// SHA1 upper-case hex encoded = 40 characters.
|
||||
inline constexpr size_t kThumbprintLength = 40U;
|
||||
|
||||
///
|
||||
/// Structure populated by GetClientThumbprints().
|
||||
///
|
||||
struct ThumbprintsInfo {
|
||||
///
|
||||
/// True if one or more signatures exist and all are valid.
|
||||
///
|
||||
bool IsSignedAndValid() const {
|
||||
return !valid_thumbprints.empty() && errors.empty();
|
||||
}
|
||||
|
||||
///
|
||||
/// True if unsigned, or if one or more signatures exist and all are valid.
|
||||
///
|
||||
bool IsUnsignedOrValid() const {
|
||||
return !has_signature || IsSignedAndValid();
|
||||
}
|
||||
|
||||
///
|
||||
/// True if this and |other| have the same signature status. If
|
||||
/// |allow_unsigned| is true then both may be unsigned. Otherwise, one or more
|
||||
/// signatures must exist, all must be valid, and the primary fingerprint must
|
||||
/// be the same for both.
|
||||
///
|
||||
bool IsSame(const ThumbprintsInfo& other, bool allow_unsigned) const {
|
||||
if (allow_unsigned && !has_signature && !other.has_signature) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return IsSignedAndValid() &&
|
||||
other.HasPrimaryThumbprint(valid_thumbprints[0]);
|
||||
}
|
||||
|
||||
///
|
||||
/// True if a valid primary signature exists and it matches the specified
|
||||
/// |thumbprint|.
|
||||
///
|
||||
bool HasPrimaryThumbprint(const std::string& thumbprint) const {
|
||||
return IsSignedAndValid() && valid_thumbprints[0] == thumbprint;
|
||||
}
|
||||
|
||||
///
|
||||
/// True if a primary signature exists, irrespective of validity.
|
||||
///
|
||||
bool has_signature = false;
|
||||
|
||||
///
|
||||
/// Thumbprints for signatures, if any, that passed verification.
|
||||
///
|
||||
std::vector<std::string> valid_thumbprints;
|
||||
|
||||
///
|
||||
/// Thumbprints for signatures, if any, that failed verification. Will not be
|
||||
/// populated if |verify_binary=true| was passed to GetClientThumbprints().
|
||||
///
|
||||
std::vector<std::string> invalid_thumbprints;
|
||||
|
||||
///
|
||||
/// Errors (newline delimited) if any signatures failed verification.
|
||||
///
|
||||
std::wstring errors;
|
||||
};
|
||||
|
||||
///
|
||||
/// Process client signatures for the binary at the specified abolute
|
||||
/// |binary_path| and populate |info|. If |verify_binary| is true and the
|
||||
/// primary signature fails verification then no further signatures will be
|
||||
/// processed. For a code signing example and usage details see
|
||||
/// https://github.com/chromiumembedded/cef/issues/3824#issuecomment-2892139995
|
||||
///
|
||||
void GetClientThumbprints(const std::wstring& binary_path,
|
||||
bool verify_binary,
|
||||
ThumbprintsInfo& info);
|
||||
|
||||
///
|
||||
/// Evaluate the binary at the specified absolute |binary_path| for common
|
||||
/// requirements and populate |info|. If the binary is code signed then all
|
||||
/// signatures must be valid. If |thumbprint| is a SHA1 hash (e.g. 40 character
|
||||
/// upper-case hex-encoded value) then the primary signature must match that
|
||||
/// thumbprint. If |allow_unsigned| is true and |thumbprint| is nullptr then the
|
||||
/// binary may be unsigned, otherwise it must be validly signed. Returns true if
|
||||
/// all requirements are met.
|
||||
///
|
||||
bool ValidateCodeSigning(const std::wstring& binary_path,
|
||||
const char* thumbprint,
|
||||
bool allow_unsigned,
|
||||
ThumbprintsInfo& info);
|
||||
|
||||
///
|
||||
/// Same as ValidateCodeSigning, but failures result in a FATAL error and
|
||||
/// application termination. Optionally populate |info| is validation succeeds.
|
||||
/// Usage must be protected by cef::logging::ScopedEarlySupport if called prior
|
||||
/// to libcef loading.
|
||||
///
|
||||
void ValidateCodeSigningAssert(const std::wstring& binary_path,
|
||||
const char* thumbprint,
|
||||
bool allow_unsigned,
|
||||
ThumbprintsInfo* info = nullptr);
|
||||
|
||||
} // namespace cef_certificate_util
|
||||
|
||||
#endif // CEF_INCLUDE_WRAPPER_CEF_CERTIFICATE_UTIL_WIN_H_
|
@@ -33,11 +33,11 @@
|
||||
|
||||
#include "include/base/cef_build.h"
|
||||
|
||||
#if defined(OS_MAC)
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <string>
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif // __cplusplus
|
||||
|
||||
///
|
||||
/// Load the CEF library at the specified |path|. Returns true (1) on
|
||||
@@ -53,12 +53,6 @@ int cef_unload_library(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // defined(OS_MAC)
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <string>
|
||||
|
||||
#if defined(OS_MAC)
|
||||
|
||||
@@ -90,8 +84,7 @@ int cef_unload_library(void);
|
||||
/// #include "include/wrapper/cef_library_loader.h"
|
||||
///
|
||||
/// int main(int argc, char* argv[]) {
|
||||
/// // Dynamically load and initialize the macOS sandbox for this helper
|
||||
/// // process.
|
||||
/// // Initialize the macOS sandbox for this helper process.
|
||||
/// CefScopedSandboxContext sandbox_context;
|
||||
/// if (!sandbox_context.Initialize(argc, argv))
|
||||
/// return 1;
|
||||
@@ -105,7 +98,7 @@ int cef_unload_library(void);
|
||||
/// }
|
||||
/// </pre>
|
||||
///
|
||||
class CefScopedLibraryLoader final {
|
||||
class CefScopedLibraryLoader {
|
||||
public:
|
||||
CefScopedLibraryLoader();
|
||||
|
||||
@@ -131,101 +124,10 @@ class CefScopedLibraryLoader final {
|
||||
private:
|
||||
bool Load(bool helper);
|
||||
|
||||
bool loaded_ = false;
|
||||
bool loaded_;
|
||||
};
|
||||
|
||||
#elif defined(OS_WIN)
|
||||
#include <windows.h>
|
||||
|
||||
#include "include/cef_version_info.h"
|
||||
|
||||
///
|
||||
/// Scoped helper for loading the CEF library at runtime from a specific
|
||||
/// location on disk. Can optionally be used to verify code signing status and
|
||||
/// Chromium version compatibility at the same time. Binaries using this helper
|
||||
/// must be built with the "/DELAYLOAD:libcef.dll" linker flag.
|
||||
///
|
||||
/// Example usage:
|
||||
///
|
||||
/// <pre>
|
||||
/// #include "include/wrapper/cef_library_loader.h"
|
||||
///
|
||||
/// int APIENTRY wWinMain(HINSTANCE hInstance,
|
||||
/// HINSTANCE hPrevInstance,
|
||||
/// LPTSTR lpCmdLine,
|
||||
/// int nCmdShow)
|
||||
/// // Version that was used to compile the CEF client app.
|
||||
/// cef_version_info_t version_info = {};
|
||||
/// CEF_POPULATE_VERSION_INFO(&version_info);
|
||||
///
|
||||
/// // Dynamically load libcef.dll from the specified location, and verify
|
||||
/// // that the Chromium version is compatible. Any failures will
|
||||
/// // intentionally crash the application. All CEF distribution resources
|
||||
/// // (DLLs, pak, etc) must be located in the same directory.
|
||||
/// CefScopedLibraryLoader library_loader;
|
||||
/// if (!library_loader.LoadInSubProcessAssert(&version_info)) {
|
||||
/// // Not running as a potentially sandboxed sub-process.
|
||||
/// // Choose the appropriate path for loading libcef.dll...
|
||||
/// const wchar_t* path = L"c:\\path\\to\\myapp\\cef\\libcef.dll";
|
||||
/// if (!library_loader.LoadInMainAssert(path, nullptr, true,
|
||||
/// &version_info)) {
|
||||
/// // The load failed. We'll crash before reaching this line.
|
||||
/// NOTREACHED();
|
||||
/// return CEF_RESULT_CODE_KILLED;
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
/// // Continue with CEF initialization...
|
||||
/// }
|
||||
/// </pre>
|
||||
///
|
||||
class CefScopedLibraryLoader final {
|
||||
public:
|
||||
CefScopedLibraryLoader();
|
||||
|
||||
CefScopedLibraryLoader(const CefScopedLibraryLoader&) = delete;
|
||||
CefScopedLibraryLoader& operator=(const CefScopedLibraryLoader&) = delete;
|
||||
|
||||
~CefScopedLibraryLoader();
|
||||
|
||||
///
|
||||
/// Load the CEF library (libcef.dll) in the main process from the specified
|
||||
/// absolute path. If libcef.dll is code signed then all signatures must be
|
||||
/// valid. If |thumbprint| is a SHA1 hash (e.g. 40 character upper-case
|
||||
/// hex-encoded value) then the primary signature must match that thumbprint.
|
||||
/// If |allow_unsigned| is true and |thumbprint| is nullptr then libcef.dll
|
||||
/// may be unsigned, otherwise it must be validly signed. Failure of code
|
||||
/// signing requirements or DLL loading will result in a FATAL error and
|
||||
/// application termination. If |version_info| is specified then the
|
||||
/// libcef.dll version information must also match. Returns true if the load
|
||||
/// succeeds. Usage must be protected by cef::logging::ScopedEarlySupport.
|
||||
///
|
||||
bool LoadInMainAssert(const wchar_t* dll_path,
|
||||
const char* thumbprint,
|
||||
bool allow_unsigned,
|
||||
cef_version_info_t* version_info);
|
||||
|
||||
///
|
||||
/// Load the CEF library (libcef.dll) in a sub-process that may be sandboxed.
|
||||
/// The path will be determined based on command-line arguments for the
|
||||
/// current process. Failure of DLL loading will result in a FATAL error and
|
||||
/// application termination. If |version_info| is specified then the
|
||||
/// libcef.dll version information must match. Returns true if the load
|
||||
/// succeeds. Usage must be protected by cef::logging::ScopedEarlySupport.
|
||||
///
|
||||
bool LoadInSubProcessAssert(cef_version_info_t* version_info);
|
||||
|
||||
private:
|
||||
HMODULE handle_ = nullptr;
|
||||
};
|
||||
|
||||
namespace switches {
|
||||
// Changes to this value require rebuilding libcef.dll.
|
||||
inline constexpr char kLibcefPath[] = "libcef-path";
|
||||
inline constexpr wchar_t kLibcefPathW[] = L"libcef-path";
|
||||
} // namespace switches
|
||||
|
||||
#endif // defined(OS_WIN)
|
||||
#endif // defined(OS_MAC)
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // CEF_INCLUDE_WRAPPER_CEF_LIBRARY_LOADER_H_
|
||||
|
@@ -1,65 +0,0 @@
|
||||
// Copyright (c) 2025 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 are only available to applications that link
|
||||
// against the libcef_dll_wrapper target.
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_WRAPPER_CEF_UTIL_WIN_H_
|
||||
#define CEF_INCLUDE_WRAPPER_CEF_UTIL_WIN_H_
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace cef_util {
|
||||
|
||||
// Returns the fully qualified file path for the executable module.
|
||||
std::wstring GetExePath();
|
||||
|
||||
// Returns the fully qualified file path for |module|.
|
||||
std::wstring GetModulePath(HMODULE module);
|
||||
|
||||
// Returns the value of GetLastError() as a string.
|
||||
std::wstring GetLastErrorAsString();
|
||||
|
||||
// Parse command line arguments for |hInstance|.
|
||||
std::vector<std::wstring> ParseCommandLineArgs(const wchar_t* str);
|
||||
|
||||
// Returns the value for |name| in |command_line|, if any.
|
||||
std::wstring GetCommandLineValue(const std::vector<std::wstring>& command_line,
|
||||
const std::wstring& name);
|
||||
|
||||
} // namespace cef_util
|
||||
|
||||
#endif // CEF_INCLUDE_WRAPPER_CEF_UTIL_WIN_H_
|
@@ -117,7 +117,8 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::Create(
|
||||
|
||||
scoped_refptr<CefBrowserInfo> info =
|
||||
CefBrowserInfoManager::GetInstance()->CreateBrowserInfo(
|
||||
/*is_devtools_popup=*/false, platform_delegate->GetBrowserConfig(),
|
||||
/*is_devtools_popup=*/false, platform_delegate->IsWindowless(),
|
||||
platform_delegate->IsPrintPreviewSupported(),
|
||||
create_params.extra_info);
|
||||
|
||||
bool own_web_contents = false;
|
||||
@@ -131,7 +132,8 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::Create(
|
||||
|
||||
CefRefPtr<AlloyBrowserHostImpl> browser =
|
||||
CreateInternal(create_params.settings, create_params.client, web_contents,
|
||||
own_web_contents, info, /*opener=*/nullptr,
|
||||
own_web_contents, info,
|
||||
/*opener=*/nullptr, /*is_devtools_popup=*/false,
|
||||
request_context_impl, std::move(platform_delegate));
|
||||
if (!browser) {
|
||||
return nullptr;
|
||||
@@ -158,6 +160,7 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::CreateInternal(
|
||||
bool own_web_contents,
|
||||
scoped_refptr<CefBrowserInfo> browser_info,
|
||||
CefRefPtr<AlloyBrowserHostImpl> opener,
|
||||
bool is_devtools_popup,
|
||||
CefRefPtr<CefRequestContextImpl> request_context,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate) {
|
||||
CEF_REQUIRE_UIT();
|
||||
@@ -182,7 +185,7 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::CreateInternal(
|
||||
// new browser's platform delegate.
|
||||
opener->platform_delegate_->PopupWebContentsCreated(
|
||||
settings, client, web_contents, platform_delegate.get(),
|
||||
/*is_devtools=*/false);
|
||||
is_devtools_popup);
|
||||
}
|
||||
|
||||
// Take ownership of |web_contents| if |own_web_contents| is true.
|
||||
@@ -205,7 +208,7 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::CreateInternal(
|
||||
// result in a call to CefBrowserViewDelegate::OnPopupBrowserViewCreated().
|
||||
// Do this first for consistency with Chrome style.
|
||||
opener->platform_delegate_->PopupBrowserCreated(
|
||||
browser->platform_delegate(), browser.get(), /*is_devtools=*/false);
|
||||
browser->platform_delegate(), browser.get(), is_devtools_popup);
|
||||
}
|
||||
|
||||
// 2. Notify the browser's LifeSpanHandler. This must always be the first
|
||||
@@ -416,6 +419,24 @@ void AlloyBrowserHostImpl::WasHidden(bool hidden) {
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::NotifyScreenInfoChanged() {
|
||||
if (!IsWindowless()) {
|
||||
DCHECK(false) << "Window rendering is not disabled";
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&AlloyBrowserHostImpl::NotifyScreenInfoChanged, this));
|
||||
return;
|
||||
}
|
||||
|
||||
if (platform_delegate_) {
|
||||
platform_delegate_->NotifyScreenInfoChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::Invalidate(PaintElementType type) {
|
||||
if (!IsWindowless()) {
|
||||
DCHECK(false) << "Window rendering is not disabled";
|
||||
@@ -880,6 +901,29 @@ void AlloyBrowserHostImpl::DragSourceEndedAt(
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::SetAudioMuted(bool mute) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::SetAudioMuted,
|
||||
this, mute));
|
||||
return;
|
||||
}
|
||||
if (!web_contents()) {
|
||||
return;
|
||||
}
|
||||
web_contents()->SetAudioMuted(mute);
|
||||
}
|
||||
|
||||
bool AlloyBrowserHostImpl::IsAudioMuted() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return false;
|
||||
}
|
||||
if (!web_contents()) {
|
||||
return false;
|
||||
}
|
||||
return web_contents()->IsAudioMuted();
|
||||
}
|
||||
|
||||
// content::WebContentsDelegate methods.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -980,11 +1024,6 @@ void AlloyBrowserHostImpl::CloseContents(content::WebContents* source) {
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::SetContentsBounds(content::WebContents* source,
|
||||
const gfx::Rect& bounds) {
|
||||
contents_delegate_.SetContentsBoundsEx(source, bounds);
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::UpdateTargetURL(content::WebContents* source,
|
||||
const GURL& url) {
|
||||
contents_delegate_.UpdateTargetURL(source, url);
|
||||
@@ -1018,7 +1057,14 @@ void AlloyBrowserHostImpl::BeforeUnloadFired(content::WebContents* source,
|
||||
|
||||
bool AlloyBrowserHostImpl::TakeFocus(content::WebContents* source,
|
||||
bool reverse) {
|
||||
return contents_delegate_.TakeFocus(source, reverse);
|
||||
if (client_.get()) {
|
||||
CefRefPtr<CefFocusHandler> handler = client_->GetFocusHandler();
|
||||
if (handler.get()) {
|
||||
handler->OnTakeFocus(this, !reverse);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::CanDownload(
|
||||
@@ -1105,7 +1151,8 @@ void AlloyBrowserHostImpl::WebContentsCreated(
|
||||
|
||||
scoped_refptr<CefBrowserInfo> info =
|
||||
CefBrowserInfoManager::GetInstance()->CreatePopupBrowserInfo(
|
||||
new_contents, platform_delegate->GetBrowserConfig(), extra_info);
|
||||
new_contents, platform_delegate->IsWindowless(),
|
||||
platform_delegate->IsPrintPreviewSupported(), extra_info);
|
||||
CHECK(info.get());
|
||||
CHECK(info->is_popup());
|
||||
|
||||
@@ -1123,7 +1170,8 @@ void AlloyBrowserHostImpl::WebContentsCreated(
|
||||
// However, we need to install observers/delegates here.
|
||||
CefRefPtr<AlloyBrowserHostImpl> browser = CreateInternal(
|
||||
settings, client, new_contents, /*own_web_contents=*/false, info, opener,
|
||||
request_context, std::move(platform_delegate));
|
||||
/*is_devtools_popup=*/false, request_context,
|
||||
std::move(platform_delegate));
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::RendererUnresponsive(
|
||||
|
@@ -90,6 +90,7 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
bool IsWindowRenderingDisabled() override;
|
||||
void WasResized() override;
|
||||
void WasHidden(bool hidden) override;
|
||||
void NotifyScreenInfoChanged() override;
|
||||
void Invalidate(PaintElementType type) override;
|
||||
void SendExternalBeginFrame() override;
|
||||
void SendTouchEvent(const CefTouchEvent& event) override;
|
||||
@@ -114,6 +115,8 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
void DragTargetDrop(const CefMouseEvent& event) override;
|
||||
void DragSourceSystemDragEnded() override;
|
||||
void DragSourceEndedAt(int x, int y, DragOperationsMask op) override;
|
||||
void SetAudioMuted(bool mute) override;
|
||||
bool IsAudioMuted() override;
|
||||
void SetAutoResizeEnabled(bool enabled,
|
||||
const CefSize& min_size,
|
||||
const CefSize& max_size) override;
|
||||
@@ -192,8 +195,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
void LoadingStateChanged(content::WebContents* source,
|
||||
bool should_show_loading_ui) override;
|
||||
void CloseContents(content::WebContents* source) override;
|
||||
void SetContentsBounds(content::WebContents* source,
|
||||
const gfx::Rect& bounds) override;
|
||||
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
|
||||
bool DidAddMessageToConsole(content::WebContents* source,
|
||||
blink::mojom::ConsoleMessageLevel log_level,
|
||||
@@ -299,6 +300,7 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
bool own_web_contents,
|
||||
scoped_refptr<CefBrowserInfo> browser_info,
|
||||
CefRefPtr<AlloyBrowserHostImpl> opener,
|
||||
bool is_devtools_popup,
|
||||
CefRefPtr<CefRequestContextImpl> request_context,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate);
|
||||
|
||||
|
@@ -74,7 +74,7 @@ CefAudioCapturer::CefAudioCapturer(const CefAudioParameters& params,
|
||||
DCHECK(browser_->web_contents());
|
||||
|
||||
channels_ = audio_params.channels();
|
||||
audio_input_device_ = base::MakeRefCounted<media::AudioInputDevice>(
|
||||
audio_input_device_ = new media::AudioInputDevice(
|
||||
std::make_unique<mirroring::CapturedAudioInput>(
|
||||
base::BindRepeating(&StreamCreatorHelper,
|
||||
base::Unretained(browser_->web_contents()),
|
||||
|
@@ -142,18 +142,6 @@ content::WebContents* CefBrowserContentsDelegate::OpenURLFromTabEx(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CefBrowserContentsDelegate::SetContentsBoundsEx(
|
||||
content::WebContents* source,
|
||||
const gfx::Rect& bounds) {
|
||||
if (auto c = client()) {
|
||||
if (auto handler = c->GetDisplayHandler()) {
|
||||
return handler->OnContentsBoundsChange(
|
||||
browser(), {bounds.x(), bounds.y(), bounds.width(), bounds.height()});
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefBrowserContentsDelegate::LoadingStateChanged(
|
||||
content::WebContents* source,
|
||||
bool should_show_loading_ui) {
|
||||
@@ -390,11 +378,11 @@ void CefBrowserContentsDelegate::RenderViewReady() {
|
||||
void CefBrowserContentsDelegate::PrimaryMainFrameRenderProcessGone(
|
||||
base::TerminationStatus status) {
|
||||
static_assert(static_cast<int>(CEF_RESULT_CODE_CHROME_FIRST) ==
|
||||
static_cast<int>(CHROME_RESULT_CODE_CHROME_START),
|
||||
static_cast<int>(chrome::RESULT_CODE_CHROME_START),
|
||||
"CEF_RESULT_CODE_CHROME_FIRST must match "
|
||||
"chrome::RESULT_CODE_CHROME_START");
|
||||
static_assert(static_cast<int>(CEF_RESULT_CODE_CHROME_LAST) ==
|
||||
static_cast<int>(CHROME_RESULT_CODE_CHROME_LAST_CODE),
|
||||
static_cast<int>(chrome::RESULT_CODE_CHROME_LAST_CODE),
|
||||
"CEF_RESULT_CODE_CHROME_LAST must match "
|
||||
"chrome::RESULT_CODE_CHROME_LAST_CODE");
|
||||
|
||||
@@ -641,17 +629,6 @@ void CefBrowserContentsDelegate::OnFocusChangedInPage(
|
||||
details->is_editable_node;
|
||||
}
|
||||
|
||||
bool CefBrowserContentsDelegate::TakeFocus(content::WebContents* source,
|
||||
bool reverse) {
|
||||
if (auto c = client()) {
|
||||
if (auto handler = c->GetFocusHandler()) {
|
||||
handler->OnTakeFocus(browser(), !reverse);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefBrowserContentsDelegate::WebContentsDestroyed() {
|
||||
auto wc = web_contents();
|
||||
ObserveWebContents(nullptr);
|
||||
|
@@ -87,10 +87,6 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
|
||||
base::OnceCallback<void(content::NavigationHandle&)>&
|
||||
navigation_handle_callback);
|
||||
|
||||
// Same as SetContentsBounds but returning false if unhandled.
|
||||
bool SetContentsBoundsEx(content::WebContents* source,
|
||||
const gfx::Rect& bounds);
|
||||
|
||||
// WebContentsDelegate methods:
|
||||
void LoadingStateChanged(content::WebContents* source,
|
||||
bool should_show_loading_ui) override;
|
||||
@@ -148,7 +144,6 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
|
||||
void OnWebContentsFocused(
|
||||
content::RenderWidgetHost* render_widget_host) override;
|
||||
void OnFocusChangedInPage(content::FocusedNodeDetails* details) override;
|
||||
bool TakeFocus(content::WebContents* source, bool reverse) override;
|
||||
void WebContentsDestroyed() override;
|
||||
|
||||
// Accessors for state information. Changes will be signaled to
|
||||
|
@@ -246,8 +246,7 @@ void CefBrowserContext::RemoveCefRequestContext(
|
||||
Shutdown();
|
||||
|
||||
// Allow the current call stack to unwind before deleting |this|.
|
||||
content::BrowserThread::GetTaskRunnerForThread(CEF_UIT)->DeleteSoon(
|
||||
FROM_HERE, this);
|
||||
content::BrowserThread::DeleteSoon(CEF_UIT, FROM_HERE, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -783,28 +783,6 @@ CefRefPtr<CefNavigationEntry> CefBrowserHostBase::GetVisibleNavigationEntry() {
|
||||
return new CefNavigationEntryImpl(entry);
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::SetAudioMuted(bool mute) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostBase::SetAudioMuted,
|
||||
this, mute));
|
||||
return;
|
||||
}
|
||||
if (auto web_contents = GetWebContents()) {
|
||||
web_contents->SetAudioMuted(mute);
|
||||
}
|
||||
}
|
||||
|
||||
bool CefBrowserHostBase::IsAudioMuted() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return false;
|
||||
}
|
||||
if (auto web_contents = GetWebContents()) {
|
||||
return web_contents->IsAudioMuted();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::NotifyMoveOrResizeStarted() {
|
||||
#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC))
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
@@ -817,30 +795,9 @@ void CefBrowserHostBase::NotifyMoveOrResizeStarted() {
|
||||
if (platform_delegate_) {
|
||||
platform_delegate_->NotifyMoveOrResizeStarted();
|
||||
}
|
||||
#else
|
||||
LOG(WARNING)
|
||||
<< "Incorrect usage of CefBrowserHost::NotifyMoveOrResizeStarted";
|
||||
#endif
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::NotifyScreenInfoChanged() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostBase::NotifyScreenInfoChanged, this));
|
||||
return;
|
||||
}
|
||||
|
||||
if (platform_delegate_) {
|
||||
if (IsWindowless() || platform_delegate_->HasExternalParent()) {
|
||||
platform_delegate_->NotifyScreenInfoChanged();
|
||||
} else {
|
||||
LOG(WARNING)
|
||||
<< "Incorrect usage of CefBrowserHost::NotifyScreenInfoChanged";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CefBrowserHostBase::IsFullscreen() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
@@ -1441,19 +1398,6 @@ CefDevToolsWindowRunner* CefBrowserHostBase::GetDevToolsWindowRunner() {
|
||||
return devtools_window_runner_.get();
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::set_context_menu_observer(
|
||||
RenderViewContextMenuObserver* observer) {
|
||||
context_menu_observer_ = observer;
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::clear_context_menu_observer(
|
||||
RenderViewContextMenuObserver* observer) {
|
||||
// Don't clear if a new Observer has already been assigned.
|
||||
if (context_menu_observer_ == observer) {
|
||||
context_menu_observer_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
views::Widget* CefBrowserHostBase::GetWindowWidget() const {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!platform_delegate_) {
|
||||
|
@@ -262,10 +262,7 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
void GetNavigationEntries(CefRefPtr<CefNavigationEntryVisitor> visitor,
|
||||
bool current_only) override;
|
||||
CefRefPtr<CefNavigationEntry> GetVisibleNavigationEntry() override;
|
||||
void SetAudioMuted(bool mute) override;
|
||||
bool IsAudioMuted() override;
|
||||
void NotifyMoveOrResizeStarted() override;
|
||||
void NotifyScreenInfoChanged() override;
|
||||
bool IsFullscreen() override;
|
||||
void ExitFullscreen(bool will_cause_resize) override;
|
||||
bool IsRenderProcessUnresponsive() override;
|
||||
@@ -393,8 +390,9 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
RenderViewContextMenuObserver* context_menu_observer() const {
|
||||
return context_menu_observer_;
|
||||
}
|
||||
void set_context_menu_observer(RenderViewContextMenuObserver* observer);
|
||||
void clear_context_menu_observer(RenderViewContextMenuObserver* observer);
|
||||
void set_context_menu_observer(RenderViewContextMenuObserver* observer) {
|
||||
context_menu_observer_ = observer;
|
||||
}
|
||||
|
||||
// Returns the Widget owner for the browser window. Only used with windowed
|
||||
// browsers.
|
||||
|
@@ -28,11 +28,13 @@ CefBrowserInfo::FrameInfo::~FrameInfo() {
|
||||
|
||||
CefBrowserInfo::CefBrowserInfo(int browser_id,
|
||||
bool is_popup,
|
||||
const cef::BrowserConfig& config,
|
||||
bool is_windowless,
|
||||
bool print_preview_enabled,
|
||||
CefRefPtr<CefDictionaryValue> extra_info)
|
||||
: browser_id_(browser_id),
|
||||
is_popup_(is_popup),
|
||||
config_(config),
|
||||
is_windowless_(is_windowless),
|
||||
print_preview_enabled_(print_preview_enabled),
|
||||
extra_info_(extra_info) {
|
||||
DCHECK_GT(browser_id, 0);
|
||||
|
||||
|
@@ -19,7 +19,6 @@
|
||||
#include "base/values.h"
|
||||
#include "cef/include/internal/cef_ptr.h"
|
||||
#include "cef/libcef/common/values_impl.h"
|
||||
#include "cef/libcef/renderer/browser_config.h"
|
||||
#include "content/public/browser/global_routing_id.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
|
||||
@@ -37,7 +36,8 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
public:
|
||||
CefBrowserInfo(int browser_id,
|
||||
bool is_popup,
|
||||
const cef::BrowserConfig& config,
|
||||
bool is_windowless,
|
||||
bool print_preview_enabled,
|
||||
CefRefPtr<CefDictionaryValue> extra_info);
|
||||
|
||||
CefBrowserInfo(const CefBrowserInfo&) = delete;
|
||||
@@ -45,7 +45,8 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
|
||||
int browser_id() const { return browser_id_; }
|
||||
bool is_popup() const { return is_popup_; }
|
||||
const cef::BrowserConfig& config() const { return config_; }
|
||||
bool is_windowless() const { return is_windowless_; }
|
||||
bool print_preview_enabled() const { return print_preview_enabled_; }
|
||||
CefRefPtr<CefDictionaryValue> extra_info() const { return extra_info_; }
|
||||
|
||||
// May return nullptr if the browser has not yet been created (before
|
||||
@@ -201,7 +202,8 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
|
||||
const int browser_id_;
|
||||
const bool is_popup_;
|
||||
const cef::BrowserConfig config_;
|
||||
const bool is_windowless_;
|
||||
const bool print_preview_enabled_;
|
||||
CefRefPtr<CefDictionaryValue> extra_info_;
|
||||
|
||||
// Navigation will be blocked while |navigation_lock_| exists.
|
||||
|
@@ -69,13 +69,15 @@ CefBrowserInfoManager* CefBrowserInfoManager::GetInstance() {
|
||||
}
|
||||
|
||||
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreateBrowserInfo(
|
||||
bool is_devtools_popup,
|
||||
const cef::BrowserConfig& config,
|
||||
bool is_popup,
|
||||
bool is_windowless,
|
||||
bool print_preview_enabled,
|
||||
CefRefPtr<CefDictionaryValue> extra_info) {
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
|
||||
scoped_refptr<CefBrowserInfo> browser_info = new CefBrowserInfo(
|
||||
++next_browser_id_, is_devtools_popup, config, extra_info);
|
||||
scoped_refptr<CefBrowserInfo> browser_info =
|
||||
new CefBrowserInfo(++next_browser_id_, is_popup, is_windowless,
|
||||
print_preview_enabled, extra_info);
|
||||
browser_info_list_.push_back(browser_info);
|
||||
|
||||
return browser_info;
|
||||
@@ -83,7 +85,8 @@ scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreateBrowserInfo(
|
||||
|
||||
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreatePopupBrowserInfo(
|
||||
content::WebContents* new_contents,
|
||||
const cef::BrowserConfig& config,
|
||||
bool is_windowless,
|
||||
bool print_preview_enabled,
|
||||
CefRefPtr<CefDictionaryValue> extra_info) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
@@ -92,8 +95,8 @@ scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreatePopupBrowserInfo(
|
||||
scoped_refptr<CefBrowserInfo> browser_info;
|
||||
{
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
browser_info =
|
||||
new CefBrowserInfo(++next_browser_id_, true, config, extra_info);
|
||||
browser_info = new CefBrowserInfo(++next_browser_id_, true, is_windowless,
|
||||
print_preview_enabled, extra_info);
|
||||
browser_info_list_.push_back(browser_info);
|
||||
}
|
||||
|
||||
@@ -774,14 +777,9 @@ void CefBrowserInfoManager::SendNewBrowserInfoResponse(
|
||||
|
||||
if (browser_info) {
|
||||
params->browser_id = browser_info->browser_id();
|
||||
|
||||
auto config = cef::mojom::NewBrowserConfig::New();
|
||||
config->is_popup = browser_info->is_popup();
|
||||
config->is_windowless = browser_info->config().is_windowless;
|
||||
config->print_preview_enabled =
|
||||
browser_info->config().print_preview_enabled;
|
||||
config->move_pip_enabled = browser_info->config().move_pip_enabled;
|
||||
params->config = std::move(config);
|
||||
params->is_windowless = browser_info->is_windowless();
|
||||
params->is_popup = browser_info->is_popup();
|
||||
params->print_preview_enabled = browser_info->print_preview_enabled();
|
||||
|
||||
auto extra_info = browser_info->extra_info();
|
||||
if (extra_info) {
|
||||
|
@@ -53,10 +53,11 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
static CefBrowserInfoManager* GetInstance();
|
||||
|
||||
// Called immediately before a new CefBrowserHost implementation is created
|
||||
// directly.
|
||||
// directly. In this case |is_popup| will be true only for DevTools browsers.
|
||||
scoped_refptr<CefBrowserInfo> CreateBrowserInfo(
|
||||
bool is_devtools_popup,
|
||||
const cef::BrowserConfig& config,
|
||||
bool is_popup,
|
||||
bool is_windowless,
|
||||
bool print_preview_enabled,
|
||||
CefRefPtr<CefDictionaryValue> extra_info);
|
||||
|
||||
// Called from WebContentsDelegate::WebContentsCreated when a new browser is
|
||||
@@ -65,7 +66,8 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
// response will be sent when this method is called.
|
||||
scoped_refptr<CefBrowserInfo> CreatePopupBrowserInfo(
|
||||
content::WebContents* new_contents,
|
||||
const cef::BrowserConfig& config,
|
||||
bool is_windowless,
|
||||
bool print_preview_enabled,
|
||||
CefRefPtr<CefDictionaryValue> extra_info);
|
||||
|
||||
// Called from ContentBrowserClient::CanCreateWindow. See comments on
|
||||
|
@@ -244,7 +244,8 @@ void CefBrowserPlatformDelegate::PopupBrowserCreated(
|
||||
return;
|
||||
}
|
||||
|
||||
auto new_browser_view = new_browser->GetBrowserView();
|
||||
CefRefPtr<CefBrowserView> new_browser_view =
|
||||
CefBrowserView::GetForBrowser(new_browser);
|
||||
CHECK(new_browser_view);
|
||||
|
||||
bool popup_handled = false;
|
||||
@@ -388,7 +389,9 @@ bool CefBrowserPlatformDelegate::IsHidden() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::NotifyScreenInfoChanged() {}
|
||||
void CefBrowserPlatformDelegate::NotifyScreenInfoChanged() {
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::Invalidate(cef_paint_element_type_t type) {
|
||||
DCHECK(false);
|
||||
@@ -564,15 +567,6 @@ bool CefBrowserPlatformDelegate::IsPrintPreviewSupported() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefBrowserPlatformDelegate::IsMovePictureInPictureEnabled() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
cef::BrowserConfig CefBrowserPlatformDelegate::GetBrowserConfig() const {
|
||||
return {IsWindowless(), IsPrintPreviewSupported(),
|
||||
IsMovePictureInPictureEnabled()};
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::Find(const CefString& searchText,
|
||||
bool forward,
|
||||
bool matchCase,
|
||||
|
@@ -15,7 +15,6 @@
|
||||
#include "cef/include/cef_drag_data.h"
|
||||
#include "cef/include/internal/cef_types.h"
|
||||
#include "cef/include/views/cef_browser_view.h"
|
||||
#include "cef/libcef/renderer/browser_config.h"
|
||||
#include "third_party/blink/public/common/page/drag_operation.h"
|
||||
#include "third_party/blink/public/mojom/drag/drag.mojom-forward.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
@@ -306,7 +305,7 @@ class CefBrowserPlatformDelegate {
|
||||
virtual bool IsHidden() const;
|
||||
|
||||
// Notify the browser that screen information has changed. Only used with
|
||||
// windowless rendering and external (client-provided) root window.
|
||||
// windowless rendering.
|
||||
virtual void NotifyScreenInfoChanged();
|
||||
|
||||
// Invalidate the view. Only used with windowless rendering.
|
||||
@@ -371,12 +370,6 @@ class CefBrowserPlatformDelegate {
|
||||
bool findNext);
|
||||
virtual void StopFinding(bool clearSelection);
|
||||
|
||||
virtual bool IsMovePictureInPictureEnabled() const;
|
||||
|
||||
// CefBrowser configuration determined prior to CefBrowserHost creation and
|
||||
// passed to the renderer process via the GetNewBrowserInfo Mojo request.
|
||||
cef::BrowserConfig GetBrowserConfig() const;
|
||||
|
||||
protected:
|
||||
// Allow deletion via std::unique_ptr only.
|
||||
friend std::default_delete<CefBrowserPlatformDelegate>;
|
||||
|
@@ -99,8 +99,8 @@ class BrowserDelegate : public content::WebContentsDelegate {
|
||||
|
||||
enum class ToolbarButtonType {
|
||||
kCast = 0,
|
||||
kDownload_DEPRECATED,
|
||||
kSendTabToSelf_DEPRECATED,
|
||||
kDownload,
|
||||
kSendTabToSelf,
|
||||
kSidePanel,
|
||||
kMaxValue = kSidePanel,
|
||||
};
|
||||
@@ -173,12 +173,6 @@ class BrowserDelegate : public content::WebContentsDelegate {
|
||||
navigation_handle_callback) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Same as SetContentsBounds but returning false if unhandled.
|
||||
virtual bool SetContentsBoundsEx(content::WebContents* source,
|
||||
const gfx::Rect& bounds) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace cef
|
||||
|
@@ -260,8 +260,8 @@ void ChromeBrowserDelegate::SetAsDelegate(content::WebContents* web_contents,
|
||||
CHECK(platform_delegate->IsChromeStyle());
|
||||
|
||||
auto browser_info = CefBrowserInfoManager::GetInstance()->CreateBrowserInfo(
|
||||
is_devtools_popup, platform_delegate->GetBrowserConfig(),
|
||||
create_params_.extra_info);
|
||||
is_devtools_popup, /*is_windowless=*/false,
|
||||
platform_delegate->IsPrintPreviewSupported(), create_params_.extra_info);
|
||||
|
||||
auto request_context_impl =
|
||||
CefRequestContextImpl::GetOrCreateForRequestContext(
|
||||
@@ -476,14 +476,6 @@ void ChromeBrowserDelegate::DraggableRegionsChanged(
|
||||
}
|
||||
}
|
||||
|
||||
bool ChromeBrowserDelegate::TakeFocus(content::WebContents* source,
|
||||
bool reverse) {
|
||||
if (auto delegate = GetDelegateForWebContents(source)) {
|
||||
return delegate->TakeFocus(source, reverse);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ChromeBrowserDelegate::WindowFullscreenStateChanged() {
|
||||
// Use a synchronous callback for notification on Windows/Linux. MacOS gets
|
||||
// notified asynchronously via CefNativeWidgetMac callbacks.
|
||||
@@ -573,14 +565,6 @@ bool ChromeBrowserDelegate::OpenURLFromTabEx(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChromeBrowserDelegate::SetContentsBoundsEx(content::WebContents* source,
|
||||
const gfx::Rect& bounds) {
|
||||
if (auto delegate = GetDelegateForWebContents(source)) {
|
||||
return delegate->SetContentsBoundsEx(source, bounds);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ChromeBrowserDelegate::LoadingStateChanged(content::WebContents* source,
|
||||
bool should_show_loading_ui) {
|
||||
if (auto delegate = GetDelegateForWebContents(source)) {
|
||||
@@ -767,7 +751,8 @@ ChromeBrowserDelegate::CreateBrowserHostForPopup(
|
||||
|
||||
auto browser_info =
|
||||
CefBrowserInfoManager::GetInstance()->CreatePopupBrowserInfo(
|
||||
web_contents, platform_delegate->GetBrowserConfig(), extra_info);
|
||||
web_contents, /*is_windowless=*/false,
|
||||
platform_delegate->IsPrintPreviewSupported(), extra_info);
|
||||
CHECK(browser_info->is_popup());
|
||||
|
||||
// Popups must share the same RequestContext as the parent.
|
||||
|
@@ -94,8 +94,6 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
|
||||
const content::OpenURLParams& params,
|
||||
base::OnceCallback<void(content::NavigationHandle&)>&
|
||||
navigation_handle_callback) override;
|
||||
bool SetContentsBoundsEx(content::WebContents* source,
|
||||
const gfx::Rect& bounds) override;
|
||||
|
||||
// WebContentsDelegate methods:
|
||||
void WebContentsCreated(content::WebContents* source_contents,
|
||||
@@ -129,7 +127,6 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
|
||||
void DraggableRegionsChanged(
|
||||
const std::vector<blink::mojom::DraggableRegionPtr>& regions,
|
||||
content::WebContents* contents) override;
|
||||
bool TakeFocus(content::WebContents* source, bool reverse) override;
|
||||
|
||||
Browser* browser() const { return browser_; }
|
||||
|
||||
|
@@ -250,6 +250,10 @@ void ChromeBrowserHostImpl::WasHidden(bool hidden) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::NotifyScreenInfoChanged() {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::Invalidate(PaintElementType type) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
@@ -323,6 +327,15 @@ void ChromeBrowserHostImpl::DragSourceEndedAt(int x,
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::SetAudioMuted(bool mute) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
bool ChromeBrowserHostImpl::IsAudioMuted() {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::SetAutoResizeEnabled(bool enabled,
|
||||
const CefSize& min_size,
|
||||
const CefSize& max_size) {
|
||||
@@ -496,7 +509,8 @@ void ChromeBrowserHostImpl::Attach(content::WebContents* web_contents,
|
||||
is_devtools_popup);
|
||||
}
|
||||
|
||||
platform_delegate_->WebContentsCreated(web_contents, /*owned=*/false);
|
||||
platform_delegate_->WebContentsCreated(web_contents,
|
||||
/*own_web_contents=*/false);
|
||||
contents_delegate_.ObserveWebContents(web_contents);
|
||||
|
||||
// Associate the platform delegate with this browser.
|
||||
|
@@ -84,6 +84,7 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
|
||||
bool IsWindowRenderingDisabled() override { return false; }
|
||||
void WasResized() override;
|
||||
void WasHidden(bool hidden) override;
|
||||
void NotifyScreenInfoChanged() override;
|
||||
void Invalidate(PaintElementType type) override;
|
||||
void SendExternalBeginFrame() override;
|
||||
void SendTouchEvent(const CefTouchEvent& event) override;
|
||||
@@ -108,6 +109,8 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
|
||||
void DragTargetDrop(const CefMouseEvent& event) override;
|
||||
void DragSourceSystemDragEnded() override;
|
||||
void DragSourceEndedAt(int x, int y, DragOperationsMask op) override;
|
||||
void SetAudioMuted(bool mute) override;
|
||||
bool IsAudioMuted() override;
|
||||
void SetAutoResizeEnabled(bool enabled,
|
||||
const CefSize& min_size,
|
||||
const CefSize& max_size) override;
|
||||
|
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/path_service.h"
|
||||
#include "cef/include/wrapper/cef_library_loader.h"
|
||||
#include "cef/libcef/browser/browser_frame.h"
|
||||
#include "cef/libcef/browser/browser_host_base.h"
|
||||
#include "cef/libcef/browser/browser_info_manager.h"
|
||||
@@ -51,10 +50,6 @@
|
||||
#include "cef/libcef/browser/chrome/chrome_web_contents_view_delegate_cef.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#include "cef/libcef_dll/bootstrap/bootstrap_util_win.h"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
class CefSelectClientCertificateCallbackImpl
|
||||
@@ -137,7 +132,7 @@ void HandleExternalProtocolHelper(
|
||||
ChromeContentBrowserClientCef* self,
|
||||
content::WebContents::Getter web_contents_getter,
|
||||
content::FrameTreeNodeId frame_tree_node_id,
|
||||
std::unique_ptr<content::NavigationUIData> navigation_data,
|
||||
content::NavigationUIData* navigation_data,
|
||||
bool is_primary_main_frame,
|
||||
bool is_in_fenced_frame_tree,
|
||||
network::mojom::WebSandboxFlags sandbox_flags,
|
||||
@@ -158,25 +153,13 @@ void HandleExternalProtocolHelper(
|
||||
// NavigationURLLoaderImpl::PrepareForNonInterceptedRequest.
|
||||
self->HandleExternalProtocol(
|
||||
resource_request.url, web_contents_getter, frame_tree_node_id,
|
||||
navigation_data.get(), is_primary_main_frame, is_in_fenced_frame_tree,
|
||||
navigation_data, is_primary_main_frame, is_in_fenced_frame_tree,
|
||||
sandbox_flags,
|
||||
static_cast<ui::PageTransition>(resource_request.transition_type),
|
||||
resource_request.has_user_gesture, initiating_origin, initiator_rfh,
|
||||
isolation_info, nullptr);
|
||||
}
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// Returns the module handle that contains this code (e.g. libcef.dll).
|
||||
HINSTANCE GetCodeModuleHandle() {
|
||||
HMODULE hModule = nullptr;
|
||||
CHECK(::GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
|
||||
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
|
||||
reinterpret_cast<LPCWSTR>(GetCodeModuleHandle),
|
||||
&hModule));
|
||||
return hModule;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
||||
ChromeContentBrowserClientCef::ChromeContentBrowserClientCef() = default;
|
||||
@@ -231,23 +214,6 @@ void ChromeContentBrowserClientCef::AppendExtraCommandLineSwitches(
|
||||
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames);
|
||||
}
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
{
|
||||
const auto& exe_path = bootstrap_util::GetExePath();
|
||||
const auto& module_value =
|
||||
bootstrap_util::GetValidatedModuleValue(*browser_cmd, exe_path);
|
||||
if (!module_value.empty()) {
|
||||
command_line->AppendSwitchNative(bootstrap_util::switches::kModule,
|
||||
module_value);
|
||||
}
|
||||
const auto& libcef_path =
|
||||
bootstrap_util::GetModulePath(GetCodeModuleHandle());
|
||||
if (libcef_path.DirName() != exe_path.DirName()) {
|
||||
command_line->AppendSwitchPath(switches::kLibcefPath, libcef_path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
const std::string& process_type =
|
||||
command_line->GetSwitchValueASCII(switches::kProcessType);
|
||||
|
||||
@@ -578,20 +544,23 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
|
||||
web_contents_getter, frame_tree_node_id, request,
|
||||
base::BindRepeating(HandleExternalProtocolHelper, base::Unretained(this),
|
||||
web_contents_getter, frame_tree_node_id,
|
||||
base::Passed(navigation_data->Clone()),
|
||||
is_primary_main_frame, is_in_fenced_frame_tree,
|
||||
sandbox_flags, request, initiating_origin,
|
||||
std::move(weak_initiator_document), isolation_info));
|
||||
navigation_data, is_primary_main_frame,
|
||||
is_in_fenced_frame_tree, sandbox_flags, request,
|
||||
initiating_origin, std::move(weak_initiator_document),
|
||||
isolation_info));
|
||||
|
||||
net_service::ProxyURLLoaderFactory::CreateProxy(
|
||||
web_contents_getter, std::move(receiver), std::move(request_handler));
|
||||
return true;
|
||||
}
|
||||
|
||||
void ChromeContentBrowserClientCef::CreateThrottlesForNavigation(
|
||||
content::NavigationThrottleRegistry& registry) {
|
||||
ChromeContentBrowserClient::CreateThrottlesForNavigation(registry);
|
||||
throttle::CreateThrottlesForNavigation(registry);
|
||||
std::vector<std::unique_ptr<content::NavigationThrottle>>
|
||||
ChromeContentBrowserClientCef::CreateThrottlesForNavigation(
|
||||
content::NavigationHandle* navigation_handle) {
|
||||
auto throttles = ChromeContentBrowserClient::CreateThrottlesForNavigation(
|
||||
navigation_handle);
|
||||
throttle::CreateThrottlesForNavigation(navigation_handle, throttles);
|
||||
return throttles;
|
||||
}
|
||||
|
||||
bool ChromeContentBrowserClientCef::ConfigureNetworkContextParams(
|
||||
@@ -633,7 +602,7 @@ ChromeContentBrowserClientCef::CreateLoginDelegate(
|
||||
scoped_refptr<net::HttpResponseHeaders> response_headers,
|
||||
bool first_auth_attempt,
|
||||
content::GuestPageHolder* guest,
|
||||
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback) {
|
||||
LoginAuthRequiredCallback auth_required_callback) {
|
||||
// |web_contents| is nullptr for CefURLRequests without an associated frame.
|
||||
if (!web_contents || base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
switches::kDisableChromeLoginPrompt)) {
|
||||
|
@@ -113,8 +113,9 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
|
||||
const net::IsolationInfo& isolation_info,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
|
||||
override;
|
||||
void CreateThrottlesForNavigation(
|
||||
content::NavigationThrottleRegistry& registry) override;
|
||||
std::vector<std::unique_ptr<content::NavigationThrottle>>
|
||||
CreateThrottlesForNavigation(
|
||||
content::NavigationHandle* navigation_handle) override;
|
||||
bool ConfigureNetworkContextParams(
|
||||
content::BrowserContext* context,
|
||||
bool in_memory,
|
||||
@@ -133,8 +134,7 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
|
||||
scoped_refptr<net::HttpResponseHeaders> response_headers,
|
||||
bool first_auth_attempt,
|
||||
content::GuestPageHolder* guest,
|
||||
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback)
|
||||
override;
|
||||
LoginAuthRequiredCallback auth_required_callback) override;
|
||||
void ExposeInterfacesToRenderer(
|
||||
service_manager::BinderRegistry* registry,
|
||||
blink::AssociatedInterfaceRegistry* associated_registry,
|
||||
|
@@ -82,8 +82,7 @@ class CefContextMenuObserver : public RenderViewContextMenuObserver,
|
||||
CefRefPtr<CefBrowserHostBase> browser,
|
||||
CefRefPtr<CefContextMenuHandler> handler)
|
||||
: context_menu_(context_menu), browser_(browser), handler_(handler) {
|
||||
// Association remains valid until the next time a context menu is created,
|
||||
// or this Observer is destroyed.
|
||||
// This remains valid until the next time a context menu is created.
|
||||
browser_->set_context_menu_observer(this);
|
||||
}
|
||||
|
||||
@@ -164,7 +163,6 @@ class CefContextMenuObserver : public RenderViewContextMenuObserver,
|
||||
|
||||
// Clear stored state because this object won't be deleted until a new
|
||||
// context menu is created or the associated browser is destroyed.
|
||||
browser_->clear_context_menu_observer(this);
|
||||
browser_ = nullptr;
|
||||
handler_ = nullptr;
|
||||
params_ = nullptr;
|
||||
|
@@ -130,16 +130,6 @@ bool CefBrowserPlatformDelegateChromeViews::IsViewsHosted() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefBrowserPlatformDelegateChromeViews::IsMovePictureInPictureEnabled()
|
||||
const {
|
||||
if (browser_view_) {
|
||||
if (auto* delegate = browser_view_->delegate()) {
|
||||
return delegate->AllowMoveForPictureInPicture(browser_view_.get());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CefWindowImpl* CefBrowserPlatformDelegateChromeViews::GetWindowImpl() const {
|
||||
if (auto* widget = GetWindowWidget()) {
|
||||
CefRefPtr<CefWindow> window = view_util::GetWindowFor(widget);
|
||||
|
@@ -34,7 +34,6 @@ class CefBrowserPlatformDelegateChromeViews
|
||||
void SetBrowserView(CefRefPtr<CefBrowserView> browser_view) override;
|
||||
void SetFocus(bool setFocus) override;
|
||||
bool IsViewsHosted() const override;
|
||||
bool IsMovePictureInPictureEnabled() const override;
|
||||
|
||||
CefBrowserViewImpl* browser_view() const { return browser_view_.get(); }
|
||||
|
||||
|
@@ -14,10 +14,6 @@
|
||||
#include "ui/views/win/hwnd_util.h"
|
||||
#endif
|
||||
|
||||
#if defined(USE_AURA)
|
||||
#include "cef/libcef/browser/native/browser_platform_delegate_native_aura.h"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
gfx::AcceleratedWidget GetParentWidget(const CefWindowInfo& window_info) {
|
||||
@@ -65,9 +61,6 @@ class ChildWindowDelegate : public CefWindowDelegate {
|
||||
void OnWindowDestroyed(CefRefPtr<CefWindow> window) override {
|
||||
browser_view_ = nullptr;
|
||||
window_ = nullptr;
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
native_delegate_ = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
CefRect GetInitialBounds(CefRefPtr<CefWindow> window) override {
|
||||
@@ -78,38 +71,22 @@ class ChildWindowDelegate : public CefWindowDelegate {
|
||||
return initial_bounds;
|
||||
}
|
||||
|
||||
#if defined(USE_AURA)
|
||||
void OnWindowBoundsChanged(CefRefPtr<CefWindow> window,
|
||||
const CefRect& new_bounds) override {
|
||||
if (native_delegate_) {
|
||||
// Send new bounds to the renderer process and trigger the resize event.
|
||||
native_delegate_->NotifyScreenInfoChanged();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
void ShowWindow() {
|
||||
#if defined(USE_AURA)
|
||||
auto browser = CefBrowserHostBase::FromBrowser(browser_view_->GetBrowser());
|
||||
auto platform_delegate = browser->platform_delegate();
|
||||
DCHECK(platform_delegate->IsViewsHosted());
|
||||
auto chrome_delegate =
|
||||
static_cast<CefBrowserPlatformDelegateChromeViews*>(platform_delegate);
|
||||
native_delegate_ = static_cast<CefBrowserPlatformDelegateNativeAura*>(
|
||||
chrome_delegate->native_delegate());
|
||||
native_delegate_->InstallRootWindowBoundsCallback();
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
auto widget = static_cast<CefWindowImpl*>(window_.get())->widget();
|
||||
DCHECK(widget);
|
||||
const HWND widget_hwnd = HWNDForWidget(widget);
|
||||
DCHECK(widget_hwnd);
|
||||
|
||||
// The Windows delegate needs state to perform some actions.
|
||||
auto* delegate_win =
|
||||
static_cast<CefBrowserPlatformDelegateNativeWin*>(native_delegate_);
|
||||
delegate_win->set_widget(widget, widget_hwnd);
|
||||
// The native delegate needs state to perform some actions.
|
||||
auto browser = CefBrowserHostBase::FromBrowser(browser_view_->GetBrowser());
|
||||
auto platform_delegate = browser->platform_delegate();
|
||||
DCHECK(platform_delegate->IsViewsHosted());
|
||||
auto chrome_delegate =
|
||||
static_cast<CefBrowserPlatformDelegateChromeViews*>(platform_delegate);
|
||||
auto native_delegate = static_cast<CefBrowserPlatformDelegateNativeWin*>(
|
||||
chrome_delegate->native_delegate());
|
||||
native_delegate->set_widget(widget, widget_hwnd);
|
||||
|
||||
if (window_info_.ex_style & WS_EX_NOACTIVATE) {
|
||||
const DWORD widget_ex_styles = GetWindowLongPtr(widget_hwnd, GWL_EXSTYLE);
|
||||
@@ -128,7 +105,6 @@ class ChildWindowDelegate : public CefWindowDelegate {
|
||||
return;
|
||||
}
|
||||
#endif // BUILDFLAG(IS_WIN)
|
||||
#endif // defined(USE_AURA)
|
||||
|
||||
window_->Show();
|
||||
|
||||
@@ -136,6 +112,7 @@ class ChildWindowDelegate : public CefWindowDelegate {
|
||||
browser_view_->RequestFocus();
|
||||
}
|
||||
|
||||
private:
|
||||
ChildWindowDelegate(CefRefPtr<CefBrowserView> browser_view,
|
||||
const CefWindowInfo& window_info)
|
||||
: browser_view_(browser_view), window_info_(window_info) {}
|
||||
@@ -145,11 +122,6 @@ class ChildWindowDelegate : public CefWindowDelegate {
|
||||
|
||||
CefRefPtr<CefWindow> window_;
|
||||
|
||||
#if defined(USE_AURA)
|
||||
base::raw_ptr<CefBrowserPlatformDelegateNativeAura> native_delegate_ =
|
||||
nullptr;
|
||||
#endif
|
||||
|
||||
IMPLEMENT_REFCOUNTING(ChildWindowDelegate);
|
||||
};
|
||||
|
||||
|
@@ -22,9 +22,9 @@
|
||||
#include "ui/base/ui_base_switches.h"
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#include "base/debug/alias.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "cef/include/internal/cef_win.h"
|
||||
#include "cef/libcef/browser/preferred_stack_size_win.inc"
|
||||
#include "chrome/chrome_elf/chrome_elf_main.h"
|
||||
#include "chrome/install_static/initialize_from_primary_module.h"
|
||||
#endif
|
||||
@@ -185,6 +185,110 @@ base::FilePath NormalizeCachePathAndSet(cef_string_t& path_str,
|
||||
return path;
|
||||
}
|
||||
|
||||
// Based on chrome/app/chrome_exe_main_win.cc.
|
||||
// In 32-bit builds, the main thread starts with the default (small) stack size.
|
||||
// The ARCH_CPU_32_BITS blocks here and below are in support of moving the main
|
||||
// thread to a fiber with a larger stack size.
|
||||
#if BUILDFLAG(IS_WIN) && defined(ARCH_CPU_32_BITS)
|
||||
// The information needed to transfer control to the large-stack fiber and later
|
||||
// pass the main routine's exit code back to the small-stack fiber prior to
|
||||
// termination.
|
||||
struct FiberState {
|
||||
FiberState(wWinMainPtr wWinMain,
|
||||
HINSTANCE hInstance,
|
||||
LPWSTR lpCmdLine,
|
||||
int nCmdShow) {
|
||||
this->wWinMain = wWinMain;
|
||||
this->hInstance = hInstance;
|
||||
this->lpCmdLine = lpCmdLine;
|
||||
this->nCmdShow = nCmdShow;
|
||||
}
|
||||
|
||||
FiberState(mainPtr main, int argc, char** argv) {
|
||||
this->main = main;
|
||||
this->argc = argc;
|
||||
this->argv = argv;
|
||||
}
|
||||
|
||||
wWinMainPtr wWinMain = nullptr;
|
||||
HINSTANCE hInstance;
|
||||
LPWSTR lpCmdLine;
|
||||
int nCmdShow;
|
||||
|
||||
mainPtr main = nullptr;
|
||||
int argc;
|
||||
char** argv;
|
||||
|
||||
LPVOID original_fiber;
|
||||
int fiber_result;
|
||||
};
|
||||
|
||||
// A PFIBER_START_ROUTINE function run on a large-stack fiber that calls the
|
||||
// main routine, stores its return value, and returns control to the small-stack
|
||||
// fiber. |params| must be a pointer to a FiberState struct.
|
||||
void WINAPI FiberBinder(void* params) {
|
||||
auto* fiber_state = static_cast<FiberState*>(params);
|
||||
// Call the main routine from the fiber. Reusing the entry point minimizes
|
||||
// confusion when examining call stacks in crash reports - seeing wWinMain on
|
||||
// the stack is a handy hint that this is the main thread of the process.
|
||||
if (fiber_state->main) {
|
||||
fiber_state->fiber_result =
|
||||
fiber_state->main(fiber_state->argc, fiber_state->argv);
|
||||
} else {
|
||||
fiber_state->fiber_result =
|
||||
fiber_state->wWinMain(fiber_state->hInstance, nullptr,
|
||||
fiber_state->lpCmdLine, fiber_state->nCmdShow);
|
||||
}
|
||||
|
||||
// Switch back to the main thread to exit.
|
||||
::SwitchToFiber(fiber_state->original_fiber);
|
||||
}
|
||||
|
||||
int RunMainWithPreferredStackSize(FiberState& fiber_state) {
|
||||
enum class FiberStatus { kConvertFailed, kCreateFiberFailed, kSuccess };
|
||||
FiberStatus fiber_status = FiberStatus::kSuccess;
|
||||
// GetLastError result if fiber conversion failed.
|
||||
DWORD fiber_error = ERROR_SUCCESS;
|
||||
if (!::IsThreadAFiber()) {
|
||||
// Make the main thread's stack size 4 MiB so that it has roughly the same
|
||||
// effective size as the 64-bit build's 8 MiB stack.
|
||||
constexpr size_t kStackSize = 4 * 1024 * 1024; // 4 MiB
|
||||
// Leak the fiber on exit.
|
||||
LPVOID original_fiber =
|
||||
::ConvertThreadToFiberEx(nullptr, FIBER_FLAG_FLOAT_SWITCH);
|
||||
if (original_fiber) {
|
||||
fiber_state.original_fiber = original_fiber;
|
||||
// Create a fiber with a bigger stack and switch to it. Leak the fiber on
|
||||
// exit.
|
||||
LPVOID big_stack_fiber = ::CreateFiberEx(
|
||||
0, kStackSize, FIBER_FLAG_FLOAT_SWITCH, FiberBinder, &fiber_state);
|
||||
if (big_stack_fiber) {
|
||||
::SwitchToFiber(big_stack_fiber);
|
||||
// The fibers must be cleaned up to avoid obscure TLS-related shutdown
|
||||
// crashes.
|
||||
::DeleteFiber(big_stack_fiber);
|
||||
::ConvertFiberToThread();
|
||||
// Control returns here after CEF has finished running on FiberMain.
|
||||
return fiber_state.fiber_result;
|
||||
}
|
||||
fiber_status = FiberStatus::kCreateFiberFailed;
|
||||
} else {
|
||||
fiber_status = FiberStatus::kConvertFailed;
|
||||
}
|
||||
// If we reach here then creating and switching to a fiber has failed. This
|
||||
// probably means we are low on memory and will soon crash. Try to report
|
||||
// this error once crash reporting is initialized.
|
||||
fiber_error = ::GetLastError();
|
||||
base::debug::Alias(&fiber_error);
|
||||
}
|
||||
|
||||
// If we are already a fiber then continue normal execution.
|
||||
// Intentionally crash if converting to a fiber failed.
|
||||
CHECK_EQ(fiber_status, FiberStatus::kSuccess);
|
||||
return -1;
|
||||
}
|
||||
#endif // BUILDFLAG(IS_WIN) && defined(ARCH_CPU_32_BITS)
|
||||
|
||||
} // namespace
|
||||
|
||||
NO_STACK_PROTECTOR
|
||||
@@ -314,6 +418,23 @@ void CefQuitMessageLoop() {
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
|
||||
#if defined(ARCH_CPU_32_BITS)
|
||||
int CefRunWinMainWithPreferredStackSize(wWinMainPtr wWinMain,
|
||||
HINSTANCE hInstance,
|
||||
LPWSTR lpCmdLine,
|
||||
int nCmdShow) {
|
||||
CHECK(wWinMain && hInstance);
|
||||
FiberState fiber_state(wWinMain, hInstance, lpCmdLine, nCmdShow);
|
||||
return RunMainWithPreferredStackSize(fiber_state);
|
||||
}
|
||||
|
||||
int CefRunMainWithPreferredStackSize(mainPtr main, int argc, char* argv[]) {
|
||||
CHECK(main);
|
||||
FiberState fiber_state(main, argc, argv);
|
||||
return RunMainWithPreferredStackSize(fiber_state);
|
||||
}
|
||||
#endif // defined(ARCH_CPU_32_BITS)
|
||||
|
||||
void CefSetOSModalLoop(bool osModalLoop) {
|
||||
// Verify that the context is in a valid state.
|
||||
if (!CONTEXT_STATE_VALID()) {
|
||||
|
@@ -110,7 +110,7 @@ class CefContext {
|
||||
int exit_code_ = -1;
|
||||
|
||||
// The thread on which the context was initialized.
|
||||
base::PlatformThreadId init_thread_id_;
|
||||
base::PlatformThreadId init_thread_id_ = 0;
|
||||
|
||||
CefSettings settings_;
|
||||
CefRefPtr<CefApp> application_;
|
||||
|
@@ -1,55 +0,0 @@
|
||||
// Copyright 2020 The Chromium Embedded Framework Authors.
|
||||
// Portions copyright 2014 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 "cef/libcef/browser/crashpad_runner.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "third_party/crashpad/crashpad/handler/handler_main.h"
|
||||
|
||||
namespace crashpad_runner {
|
||||
|
||||
// Based on components/crash/core/app/run_as_crashpad_handler_win.cc
|
||||
int RunAsCrashpadHandler(const base::CommandLine& command_line) {
|
||||
// Remove the "--type=crashpad-handler" command-line flag that will otherwise
|
||||
// confuse the crashpad handler.
|
||||
base::CommandLine::StringVector argv = command_line.argv();
|
||||
const base::CommandLine::StringType process_type =
|
||||
FILE_PATH_LITERAL("--type=");
|
||||
argv.erase(
|
||||
std::remove_if(argv.begin(), argv.end(),
|
||||
[&process_type](const base::CommandLine::StringType& str) {
|
||||
return base::StartsWith(str, process_type,
|
||||
base::CompareCase::SENSITIVE) ||
|
||||
(!str.empty() && str[0] == L'/');
|
||||
}),
|
||||
argv.end());
|
||||
|
||||
#if BUILDFLAG(IS_POSIX)
|
||||
// HandlerMain on POSIX uses the system version of getopt_long which expects
|
||||
// the first argument to be the program name.
|
||||
argv.insert(argv.begin(), command_line.GetProgram().value());
|
||||
#endif
|
||||
|
||||
std::unique_ptr<char*[]> argv_as_utf8(new char*[argv.size() + 1]);
|
||||
std::vector<std::string> storage;
|
||||
storage.reserve(argv.size());
|
||||
for (size_t i = 0; i < argv.size(); ++i) {
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
storage.push_back(base::WideToUTF8(argv[i]));
|
||||
#else
|
||||
storage.push_back(argv[i]);
|
||||
#endif
|
||||
argv_as_utf8[i] = &storage[i][0];
|
||||
}
|
||||
argv_as_utf8[argv.size()] = nullptr;
|
||||
argv.clear();
|
||||
return crashpad::HandlerMain(static_cast<int>(storage.size()),
|
||||
argv_as_utf8.get(), nullptr);
|
||||
}
|
||||
|
||||
} // namespace crashpad_runner
|
@@ -1,22 +0,0 @@
|
||||
// Copyright 2020 The Chromium Embedded Framework Authors.
|
||||
// Portions copyright 2014 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_CRASHPAD_RUNNER_H_
|
||||
#define CEF_LIBCEF_BROWSER_CRASHPAD_RUNNER_H_
|
||||
|
||||
#include "base/command_line.h"
|
||||
|
||||
namespace crashpad_runner {
|
||||
|
||||
// Chrome uses an embedded crashpad handler on Windows only and imports this
|
||||
// function via the existing "run_as_crashpad_handler" target defined in
|
||||
// components/crash/core/app/BUILD.gn. CEF uses an embedded handler on all
|
||||
// platforms so we define the function here instead of using the existing
|
||||
// target (because we can't use that target on macOS).
|
||||
int RunAsCrashpadHandler(const base::CommandLine& command_line);
|
||||
|
||||
} // namespace crashpad_runner
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_CRASHPAD_RUNNER_H_
|
@@ -128,7 +128,7 @@ class CefSelectFileDialog final : public ui::SelectFileDialog {
|
||||
}
|
||||
|
||||
private:
|
||||
gfx::NativeWindow owning_window_ = gfx::NativeWindow();
|
||||
gfx::NativeWindow owning_window_ = nullptr;
|
||||
bool has_multiple_file_choices_ = false;
|
||||
|
||||
CefRefPtr<CefBrowserHostBase> browser_;
|
||||
|
@@ -12,8 +12,8 @@
|
||||
#include "cef/libcef/common/api_version_util.h"
|
||||
#include "chrome/browser/about_flags.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "components/flags_ui/pref_service_flags_storage.h"
|
||||
#include "components/variations/synthetic_trials_active_group_id_provider.h"
|
||||
#include "components/webui/flags/pref_service_flags_storage.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@@ -13,13 +13,11 @@
|
||||
#include "base/synchronization/waitable_event.h"
|
||||
#include "cef/libcef/browser/browser_message_loop.h"
|
||||
#include "cef/libcef/browser/chrome/chrome_content_browser_client_cef.h"
|
||||
#include "cef/libcef/browser/crashpad_runner.h"
|
||||
#include "cef/libcef/browser/thread_util.h"
|
||||
#include "cef/libcef/common/app_manager.h"
|
||||
#include "cef/libcef/common/cef_switches.h"
|
||||
#include "chrome/browser/browser_process_impl.h"
|
||||
#include "chrome/browser/chrome_process_singleton.h"
|
||||
#include "chrome/chrome_elf/chrome_elf_main.h"
|
||||
#include "chrome/common/chrome_result_codes.h"
|
||||
#include "components/crash/core/app/crash_switches.h"
|
||||
#include "components/keep_alive_registry/keep_alive_types.h"
|
||||
@@ -29,6 +27,7 @@
|
||||
#include "content/public/app/content_main.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "third_party/crashpad/crashpad/handler/handler_main.h"
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#include <windows.h>
|
||||
@@ -36,11 +35,57 @@
|
||||
#include <memory>
|
||||
|
||||
#include "content/public/app/sandbox_helper_win.h"
|
||||
#include "sandbox/policy/mojom/sandbox.mojom.h"
|
||||
#include "sandbox/policy/sandbox_type.h"
|
||||
#include "sandbox/win/src/sandbox_types.h"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
// Based on components/crash/core/app/run_as_crashpad_handler_win.cc
|
||||
// Remove the "--type=crashpad-handler" command-line flag that will otherwise
|
||||
// confuse the crashpad handler.
|
||||
// Chrome uses an embedded crashpad handler on Windows only and imports this
|
||||
// function via the existing "run_as_crashpad_handler" target defined in
|
||||
// components/crash/core/app/BUILD.gn. CEF uses an embedded handler on all
|
||||
// platforms so we define the function here instead of using the existing
|
||||
// target (because we can't use that target on macOS).
|
||||
int RunAsCrashpadHandler(const base::CommandLine& command_line) {
|
||||
base::CommandLine::StringVector argv = command_line.argv();
|
||||
const base::CommandLine::StringType process_type =
|
||||
FILE_PATH_LITERAL("--type=");
|
||||
argv.erase(
|
||||
std::remove_if(argv.begin(), argv.end(),
|
||||
[&process_type](const base::CommandLine::StringType& str) {
|
||||
return base::StartsWith(str, process_type,
|
||||
base::CompareCase::SENSITIVE) ||
|
||||
(!str.empty() && str[0] == L'/');
|
||||
}),
|
||||
argv.end());
|
||||
|
||||
#if BUILDFLAG(IS_POSIX)
|
||||
// HandlerMain on POSIX uses the system version of getopt_long which expects
|
||||
// the first argument to be the program name.
|
||||
argv.insert(argv.begin(), command_line.GetProgram().value());
|
||||
#endif
|
||||
|
||||
std::unique_ptr<char*[]> argv_as_utf8(new char*[argv.size() + 1]);
|
||||
std::vector<std::string> storage;
|
||||
storage.reserve(argv.size());
|
||||
for (size_t i = 0; i < argv.size(); ++i) {
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
storage.push_back(base::WideToUTF8(argv[i]));
|
||||
#else
|
||||
storage.push_back(argv[i]);
|
||||
#endif
|
||||
argv_as_utf8[i] = &storage[i][0];
|
||||
}
|
||||
argv_as_utf8[argv.size()] = nullptr;
|
||||
argv.clear();
|
||||
return crashpad::HandlerMain(static_cast<int>(storage.size()),
|
||||
argv_as_utf8.get(), nullptr);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefMainRunner::CefMainRunner(bool multi_threaded_message_loop,
|
||||
bool external_message_pump)
|
||||
: multi_threaded_message_loop_(multi_threaded_message_loop),
|
||||
@@ -72,7 +117,8 @@ bool CefMainRunner::Initialize(CefSettings* settings,
|
||||
if (exit_code_ != content::RESULT_CODE_NORMAL_EXIT) {
|
||||
// Some exit codes are used to exit early, but are otherwise a normal
|
||||
// result. Don't log for those codes.
|
||||
if (!IsNormalResultCode(static_cast<ResultCode>(exit_code_))) {
|
||||
if (!chrome::IsNormalResultCode(
|
||||
static_cast<chrome::ResultCode>(exit_code_))) {
|
||||
LOG(ERROR) << "ContentMainRun failed with exit code " << exit_code_;
|
||||
}
|
||||
return false;
|
||||
@@ -179,15 +225,10 @@ int CefMainRunner::RunAsHelperProcess(const CefMainArgs& args,
|
||||
|
||||
// If no process type is specified then it represents the browser process and
|
||||
// we do nothing.
|
||||
if (!command_line.HasSwitch(switches::kProcessType)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
const std::string& process_type =
|
||||
command_line.GetSwitchValueASCII(switches::kProcessType);
|
||||
if (process_type.empty()) {
|
||||
// Early exit on invalid process type.
|
||||
return CEF_RESULT_CODE_BAD_PROCESS_TYPE;
|
||||
return -1;
|
||||
}
|
||||
|
||||
auto main_delegate = std::make_unique<ChromeMainDelegateCef>(
|
||||
@@ -195,35 +236,15 @@ int CefMainRunner::RunAsHelperProcess(const CefMainArgs& args,
|
||||
BeforeMainInitialize(args);
|
||||
|
||||
if (process_type == crash_reporter::switches::kCrashpadHandler) {
|
||||
return crashpad_runner::RunAsCrashpadHandler(command_line);
|
||||
return RunAsCrashpadHandler(command_line);
|
||||
}
|
||||
|
||||
// Execute the secondary process.
|
||||
content::ContentMainParams main_params(main_delegate.get());
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// Initialize the sandbox services.
|
||||
// Match the logic in MainDllLoader::Launch.
|
||||
sandbox::SandboxInterfaceInfo sandbox_info = {nullptr};
|
||||
|
||||
// IsUnsandboxedSandboxType() can't be used here because its result can be
|
||||
// gated behind a feature flag, which are not yet initialized.
|
||||
const bool is_sandboxed =
|
||||
sandbox::policy::SandboxTypeFromCommandLine(command_line) !=
|
||||
sandbox::mojom::Sandbox::kNoSandbox;
|
||||
|
||||
// When using cef_sandbox_info_create() the sandbox info will always be
|
||||
// initialized. This is incorrect for cases where the sandbox is disabled, and
|
||||
// we adjust for that here.
|
||||
if (!is_sandboxed || windows_sandbox_info == nullptr) {
|
||||
if (is_sandboxed) {
|
||||
// For child processes that are running as --no-sandbox, don't
|
||||
// initialize the sandbox info, otherwise they'll be treated as brokers
|
||||
// (as if they were the browser).
|
||||
content::InitializeSandboxInfo(
|
||||
&sandbox_info, IsExtensionPointDisableSet()
|
||||
? sandbox::MITIGATION_EXTENSION_POINT_DISABLE
|
||||
: 0);
|
||||
}
|
||||
if (windows_sandbox_info == nullptr) {
|
||||
content::InitializeSandboxInfo(&sandbox_info);
|
||||
windows_sandbox_info = &sandbox_info;
|
||||
}
|
||||
|
||||
@@ -440,7 +461,7 @@ void CefMainRunner::FinishShutdownOnUIThread() {
|
||||
ChromeProcessSingleton::DeleteInstance();
|
||||
}
|
||||
|
||||
static_cast<content::ContentMainRunnerImpl*>(main_runner_.get())
|
||||
static_cast<content::ContentMainRunnerImpl*>(main_runner_.get())
|
||||
->ShutdownOnUIThread();
|
||||
}
|
||||
|
||||
|
@@ -5,7 +5,6 @@
|
||||
#include "cef/libcef/browser/native/browser_platform_delegate_native.h"
|
||||
|
||||
#include "cef/libcef/browser/alloy/alloy_browser_host_impl.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/render_widget_host.h"
|
||||
#include "third_party/blink/public/common/input/web_mouse_event.h"
|
||||
@@ -25,25 +24,3 @@ void CefBrowserPlatformDelegateNative::WasResized() {
|
||||
host->GetWidget()->SynchronizeVisualProperties();
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateNative::NotifyScreenInfoChanged() {
|
||||
content::RenderWidgetHostImpl* render_widget_host = nullptr;
|
||||
if (web_contents_) {
|
||||
if (auto* rvh = web_contents_->GetRenderViewHost()) {
|
||||
render_widget_host =
|
||||
content::RenderWidgetHostImpl::From(rvh->GetWidget());
|
||||
}
|
||||
}
|
||||
if (!render_widget_host) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Send updated screen bounds information to the renderer process.
|
||||
if (render_widget_host->delegate()) {
|
||||
render_widget_host->delegate()->SendScreenRects();
|
||||
} else {
|
||||
render_widget_host->SendScreenRects();
|
||||
}
|
||||
|
||||
render_widget_host->NotifyScreenInfoChanged();
|
||||
}
|
||||
|
@@ -32,7 +32,6 @@ class CefBrowserPlatformDelegateNative
|
||||
// CefBrowserPlatformDelegate methods:
|
||||
SkColor GetBackgroundColor() const override;
|
||||
void WasResized() override;
|
||||
void NotifyScreenInfoChanged() override;
|
||||
|
||||
// Translate CEF events to Chromium/Blink Web events.
|
||||
virtual input::NativeWebKeyboardEvent TranslateWebKeyEvent(
|
||||
|
@@ -4,7 +4,6 @@
|
||||
|
||||
#include "cef/libcef/browser/native/browser_platform_delegate_native_aura.h"
|
||||
|
||||
#include "cef/libcef/browser/browser_host_base.h"
|
||||
#include "cef/libcef/browser/native/menu_runner_views_aura.h"
|
||||
#include "cef/libcef/browser/views/view_util.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_view_aura.h"
|
||||
@@ -20,42 +19,6 @@ CefBrowserPlatformDelegateNativeAura::CefBrowserPlatformDelegateNativeAura(
|
||||
SkColor background_color)
|
||||
: CefBrowserPlatformDelegateNative(window_info, background_color) {}
|
||||
|
||||
void CefBrowserPlatformDelegateNativeAura::InstallRootWindowBoundsCallback() {
|
||||
auto* host_view = GetHostView();
|
||||
CHECK(host_view);
|
||||
|
||||
host_view->SetRootWindowBoundsCallback(base::BindRepeating(
|
||||
[](base::WeakPtr<CefBrowserPlatformDelegateNativeAura> self) {
|
||||
return self->RootWindowBoundsCallback();
|
||||
},
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
}
|
||||
|
||||
std::optional<gfx::Rect>
|
||||
CefBrowserPlatformDelegateNativeAura::RootWindowBoundsCallback() {
|
||||
if (browser_) {
|
||||
if (auto client = browser_->client()) {
|
||||
if (auto handler = client->GetDisplayHandler()) {
|
||||
CefRect rect;
|
||||
if (handler->GetRootWindowScreenRect(browser_.get(), rect) &&
|
||||
!rect.IsEmpty()) {
|
||||
return gfx::Rect(rect.x, rect.y, rect.width, rect.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Call the default platform implementation, if any.
|
||||
return GetRootWindowBounds();
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateNativeAura::RenderViewReady() {
|
||||
CefBrowserPlatformDelegateNative::RenderViewReady();
|
||||
|
||||
// The RWHV should now exist for Alloy style browsers.
|
||||
InstallRootWindowBoundsCallback();
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateNativeAura::SendKeyEvent(
|
||||
const CefKeyEvent& event) {
|
||||
auto view = GetHostView();
|
||||
|
@@ -5,19 +5,19 @@
|
||||
#ifndef CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_AURA_H_
|
||||
#define CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_AURA_H_
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "cef/libcef/browser/native/browser_platform_delegate_native.h"
|
||||
#include "ui/events/event.h"
|
||||
#include "ui/gfx/geometry/rect.h"
|
||||
#include "ui/gfx/geometry/vector2d.h"
|
||||
|
||||
namespace content {
|
||||
class RenderWidgetHostViewAura;
|
||||
}
|
||||
|
||||
namespace gfx {
|
||||
class Vector2d;
|
||||
}
|
||||
|
||||
// Windowed browser implementation for Aura platforms.
|
||||
class CefBrowserPlatformDelegateNativeAura
|
||||
: public CefBrowserPlatformDelegateNative {
|
||||
@@ -25,10 +25,7 @@ class CefBrowserPlatformDelegateNativeAura
|
||||
CefBrowserPlatformDelegateNativeAura(const CefWindowInfo& window_info,
|
||||
SkColor background_color);
|
||||
|
||||
void InstallRootWindowBoundsCallback();
|
||||
|
||||
// CefBrowserPlatformDelegate methods:
|
||||
void RenderViewReady() override;
|
||||
void SendKeyEvent(const CefKeyEvent& event) override;
|
||||
void SendMouseClickEvent(const CefMouseEvent& event,
|
||||
CefBrowserHost::MouseButtonType type,
|
||||
@@ -74,16 +71,9 @@ class CefBrowserPlatformDelegateNativeAura
|
||||
int deltaY) const;
|
||||
virtual gfx::Vector2d GetUiWheelEventOffset(int deltaX, int deltaY) const;
|
||||
|
||||
// Returns the root window bounds in screen DIP coordinates.
|
||||
virtual std::optional<gfx::Rect> GetRootWindowBounds() {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
protected:
|
||||
base::OnceClosure GetWidgetDeleteCallback();
|
||||
|
||||
std::optional<gfx::Rect> RootWindowBoundsCallback();
|
||||
|
||||
static base::TimeTicks GetEventTimeStamp();
|
||||
static int TranslateUiEventModifiers(uint32_t cef_modifiers);
|
||||
static int TranslateUiChangedButtonFlags(uint32_t cef_modifiers);
|
||||
|
@@ -73,7 +73,7 @@ CefRect GetScreenFrameRectFromDIPContentRect(HWND window,
|
||||
// Convert from DIP using a method that can handle multiple displays with
|
||||
// different DPI. If |window| is nullptr the closest display will be used.
|
||||
const auto screen_rect =
|
||||
display::win::GetScreenWin()->DIPToScreenRect(window, dip_rect);
|
||||
display::win::ScreenWin::DIPToScreenRect(window, dip_rect);
|
||||
|
||||
RECT rect = {screen_rect.x(), screen_rect.y(),
|
||||
screen_rect.x() + screen_rect.width(),
|
||||
@@ -109,7 +109,7 @@ CefRect GetAdjustedScreenFrameRect(CefRect screen_rect,
|
||||
|
||||
// Convert to DIP using a method that can handle multiple displays with
|
||||
// different DPI.
|
||||
const auto dip_rect = display::win::GetScreenWin()->ScreenToDIPRect(
|
||||
const auto dip_rect = display::win::ScreenWin::ScreenToDIPRect(
|
||||
nullptr, gfx::Rect(screen_rect.x, screen_rect.y, screen_rect.width,
|
||||
screen_rect.height));
|
||||
const auto visible_dip_rect = MakeVisibleOnScreenRect(
|
||||
@@ -173,11 +173,10 @@ bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() {
|
||||
window_info_.parent_window, window_info_.menu,
|
||||
::GetModuleHandle(nullptr), this);
|
||||
|
||||
// It's possible for CreateWindowEx to fail if the parent window was destroyed
|
||||
// between the call to CreateBrowser and the above one. It's also possible
|
||||
// that |browser_| will be nullptr if BrowserDestroyed() was called during
|
||||
// this time.
|
||||
if (!window_info_.window || !browser_) {
|
||||
// It's possible for CreateWindowEx to fail if the parent window was
|
||||
// destroyed between the call to CreateBrowser and the above one.
|
||||
DCHECK(window_info_.window);
|
||||
if (!window_info_.window) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -206,7 +205,7 @@ bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() {
|
||||
|
||||
// Convert to DIP using a method that can handle multiple displays with
|
||||
// different DPI. Client coordinates always have origin (0,0).
|
||||
const gfx::Rect dip_rect = display::win::GetScreenWin()->ScreenToDIPRect(
|
||||
const gfx::Rect dip_rect = display::win::ScreenWin::ScreenToDIPRect(
|
||||
window_info_.window, gfx::Rect(0, 0, cr.right, cr.bottom));
|
||||
|
||||
// Stay on top if top-most window hosting the web view is topmost.
|
||||
@@ -427,27 +426,6 @@ CefEventHandle CefBrowserPlatformDelegateNativeWin::GetEventHandle(
|
||||
const_cast<CHROME_MSG*>(&event.os_event->native_event()));
|
||||
}
|
||||
|
||||
std::optional<gfx::Rect>
|
||||
CefBrowserPlatformDelegateNativeWin::GetRootWindowBounds() {
|
||||
if (window_widget_) {
|
||||
if (HWND hwnd = GetHostWindowHandle()) {
|
||||
if (HWND root_hwnd = ::GetAncestor(hwnd, GA_ROOT)) {
|
||||
RECT root_rect = {};
|
||||
if (::GetWindowRect(root_hwnd, &root_rect)) {
|
||||
auto* top_level =
|
||||
window_widget_->GetNativeWindow()->GetToplevelWindow();
|
||||
gfx::Rect bounds(root_rect);
|
||||
bounds = display::Screen::GetScreen()->ScreenToDIPRectInWindow(
|
||||
top_level, bounds);
|
||||
return bounds;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
ui::KeyEvent CefBrowserPlatformDelegateNativeWin::TranslateUiKeyEvent(
|
||||
const CefKeyEvent& key_event) const {
|
||||
int flags = TranslateUiEventModifiers(key_event.modifiers);
|
||||
@@ -591,14 +569,10 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
|
||||
// Clear the user data pointer.
|
||||
gfx::SetWindowUserData(hwnd, nullptr);
|
||||
|
||||
// |browser| may be nullptr if the window was destroyed during browser
|
||||
// creation (e.g. CreateHostWindow() returned false).
|
||||
if (browser) {
|
||||
// Force the browser to be destroyed. This will result in a call to
|
||||
// BrowserDestroyed() that will release the reference added in
|
||||
// CreateHostWindow().
|
||||
AlloyBrowserHostImpl::FromBaseChecked(browser)->WindowDestroyed();
|
||||
}
|
||||
// Force the browser to be destroyed. This will result in a call to
|
||||
// BrowserDestroyed() that will release the reference added in
|
||||
// CreateHostWindow().
|
||||
AlloyBrowserHostImpl::FromBaseChecked(browser)->WindowDestroyed();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -617,8 +591,8 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
|
||||
|
||||
case WM_MOVING:
|
||||
case WM_MOVE:
|
||||
if (platform_delegate) {
|
||||
platform_delegate->NotifyMoveOrResizeStarted();
|
||||
if (browser) {
|
||||
browser->NotifyMoveOrResizeStarted();
|
||||
}
|
||||
return 0;
|
||||
|
||||
|
@@ -32,7 +32,6 @@ class CefBrowserPlatformDelegateNativeWin
|
||||
bool HandleKeyboardEvent(const input::NativeWebKeyboardEvent& event) override;
|
||||
CefEventHandle GetEventHandle(
|
||||
const input::NativeWebKeyboardEvent& event) const override;
|
||||
std::optional<gfx::Rect> GetRootWindowBounds() override;
|
||||
|
||||
// CefBrowserPlatformDelegateNativeAura methods:
|
||||
ui::KeyEvent TranslateUiKeyEvent(const CefKeyEvent& key_event) const override;
|
||||
|
@@ -21,7 +21,8 @@ bool CefMenuRunnerMac::RunContextMenu(
|
||||
// Create a menu controller based on the model.
|
||||
MenuControllerCocoa* menu_controller =
|
||||
[[MenuControllerCocoa alloc] initWithModel:model->model()
|
||||
delegate:nil];
|
||||
delegate:nil
|
||||
useWithPopUpButtonCell:NO];
|
||||
|
||||
menu_controller_ = menu_controller;
|
||||
|
||||
|
@@ -68,10 +68,8 @@ void CefWindowDelegateView::Init(gfx::AcceleratedWidget parent_widget,
|
||||
DCHECK(widget->widget_delegate()->CanActivate());
|
||||
|
||||
// WidgetDelegate::DeleteDelegate() will execute the registered callback.
|
||||
RegisterDeleteDelegateCallback(
|
||||
RegisterDeleteCallbackPassKey(),
|
||||
base::BindOnce(&CefWindowDelegateView::DeleteDelegate,
|
||||
base::Unretained(this)));
|
||||
RegisterDeleteDelegateCallback(base::BindOnce(
|
||||
&CefWindowDelegateView::DeleteDelegate, base::Unretained(this)));
|
||||
}
|
||||
|
||||
void CefWindowDelegateView::InitContent() {
|
||||
|
@@ -92,19 +92,19 @@ void NavigationOnUIThread(
|
||||
|
||||
} // namespace
|
||||
|
||||
void CreateThrottlesForNavigation(
|
||||
content::NavigationThrottleRegistry& registry) {
|
||||
void CreateThrottlesForNavigation(content::NavigationHandle* navigation_handle,
|
||||
NavigationThrottleList& throttles) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
// Must use SynchronyMode::kSync to ensure that OnBeforeBrowse is always
|
||||
// called before OnBeforeResourceLoad.
|
||||
std::unique_ptr<content::NavigationThrottle> throttle =
|
||||
std::make_unique<navigation_interception::InterceptNavigationThrottle>(
|
||||
registry, base::BindRepeating(&NavigationOnUIThread),
|
||||
navigation_handle, base::BindRepeating(&NavigationOnUIThread),
|
||||
navigation_interception::SynchronyMode::kSync, std::nullopt);
|
||||
|
||||
// Always execute our throttle first.
|
||||
registry.AddThrottle(std::move(throttle), /*first=*/true);
|
||||
throttles.emplace(throttles.begin(), std::move(throttle));
|
||||
}
|
||||
|
||||
} // namespace throttle
|
||||
|
@@ -6,14 +6,21 @@
|
||||
#define CEF_LIBCEF_BROWSER_NET_THROTTLE_HANDLER_H_
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace content {
|
||||
class NavigationThrottleRegistry;
|
||||
class NavigationHandle;
|
||||
class NavigationThrottle;
|
||||
} // namespace content
|
||||
|
||||
namespace throttle {
|
||||
|
||||
void CreateThrottlesForNavigation(
|
||||
content::NavigationThrottleRegistry& registry);
|
||||
using NavigationThrottleList =
|
||||
std::vector<std::unique_ptr<content::NavigationThrottle>>;
|
||||
|
||||
void CreateThrottlesForNavigation(content::NavigationHandle* navigation_handle,
|
||||
NavigationThrottleList& throttles);
|
||||
|
||||
} // namespace throttle
|
||||
|
||||
|
@@ -252,7 +252,7 @@ void LoadCookies(const CefBrowserContext::Getter& browser_context_getter,
|
||||
if (request.trusted_params.has_value() &&
|
||||
!request.trusted_params->isolation_info.IsEmpty()) {
|
||||
const auto& isolation_info = request.trusted_params->isolation_info;
|
||||
partition_key_collection = net::CookiePartitionKeyCollection(
|
||||
partition_key_collection = net::CookiePartitionKeyCollection::FromOptional(
|
||||
net::CookiePartitionKey::FromNetworkIsolationKey(
|
||||
isolation_info.network_isolation_key(), request.site_for_cookies,
|
||||
net::SchemefulSite(request.url),
|
||||
|
@@ -111,12 +111,11 @@ void RunCallbackOnIOThread(
|
||||
}
|
||||
} // namespace
|
||||
|
||||
LoginDelegate::LoginDelegate(
|
||||
const net::AuthChallengeInfo& auth_info,
|
||||
content::WebContents* web_contents,
|
||||
const content::GlobalRequestID& request_id,
|
||||
const GURL& origin_url,
|
||||
content::LoginDelegate::LoginAuthRequiredCallback callback)
|
||||
LoginDelegate::LoginDelegate(const net::AuthChallengeInfo& auth_info,
|
||||
content::WebContents* web_contents,
|
||||
const content::GlobalRequestID& request_id,
|
||||
const GURL& origin_url,
|
||||
LoginAuthRequiredCallback callback)
|
||||
: callback_(std::move(callback)), weak_ptr_factory_(this) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
|
@@ -29,7 +29,7 @@ class LoginDelegate : public content::LoginDelegate {
|
||||
content::WebContents* web_contents,
|
||||
const content::GlobalRequestID& request_id,
|
||||
const GURL& origin_url,
|
||||
content::LoginDelegate::LoginAuthRequiredCallback callback);
|
||||
LoginAuthRequiredCallback callback);
|
||||
|
||||
void Continue(const CefString& username, const CefString& password);
|
||||
void Cancel();
|
||||
@@ -40,7 +40,7 @@ class LoginDelegate : public content::LoginDelegate {
|
||||
const content::GlobalRequestID& request_id,
|
||||
const GURL& origin_url);
|
||||
|
||||
content::LoginDelegate::LoginAuthRequiredCallback callback_;
|
||||
LoginAuthRequiredCallback callback_;
|
||||
base::WeakPtrFactory<LoginDelegate> weak_ptr_factory_;
|
||||
};
|
||||
|
||||
|
@@ -103,8 +103,8 @@ class ResourceContextData : public base::SupportsUserData::Data {
|
||||
// Maybe the browser was destroyed while AddProxyOnUIThread was pending.
|
||||
if (!web_contents) {
|
||||
// Delete on the IO thread as expected by mojo bindings.
|
||||
content::BrowserThread::GetTaskRunnerForThread(CEF_IOT)->DeleteSoon(
|
||||
FROM_HERE, proxy);
|
||||
content::BrowserThread::DeleteSoon(content::BrowserThread::IO, FROM_HERE,
|
||||
proxy);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -341,7 +341,6 @@ class InterceptedRequest : public network::mojom::URLLoader,
|
||||
|
||||
network::URLLoaderCompletionStatus status_;
|
||||
bool got_loader_error_ = false;
|
||||
bool completed_ = false;
|
||||
|
||||
// Used for rate limiting OnUploadProgress callbacks.
|
||||
bool waiting_for_upload_progress_ack_ = false;
|
||||
@@ -1142,17 +1141,7 @@ void InterceptedRequest::OnDestroy() {
|
||||
// We don't want any callbacks after this point.
|
||||
weak_factory_.InvalidateWeakPtrs();
|
||||
|
||||
bool handled_externally = false;
|
||||
factory_->request_handler_->OnRequestComplete(id_, request_, status_,
|
||||
handled_externally);
|
||||
|
||||
// Don't call OnComplete() if an unhandled request might be handled
|
||||
// externally. The request will instead be canceled implicitly with
|
||||
// ERR_ABORTED.
|
||||
if (!handled_externally && target_client_ && !completed_) {
|
||||
target_client_->OnComplete(status_);
|
||||
completed_ = true;
|
||||
}
|
||||
factory_->request_handler_->OnRequestComplete(id_, request_, status_);
|
||||
|
||||
// Destroys |this|.
|
||||
factory_->RemoveRequest(this);
|
||||
@@ -1204,7 +1193,6 @@ void InterceptedRequest::CallOnComplete(
|
||||
|
||||
if (target_client_) {
|
||||
target_client_->OnComplete(status);
|
||||
completed_ = true;
|
||||
}
|
||||
|
||||
if (proxied_loader_receiver_.is_bound() &&
|
||||
@@ -1239,6 +1227,7 @@ void InterceptedRequest::SendErrorStatusAndCompleteImmediately(
|
||||
const network::URLLoaderCompletionStatus& status) {
|
||||
status_ = status;
|
||||
SendErrorCallback(status_.error_code, false);
|
||||
target_client_->OnComplete(status_);
|
||||
OnDestroy();
|
||||
}
|
||||
|
||||
|
@@ -121,8 +121,7 @@ class InterceptedRequestHandler {
|
||||
virtual void OnRequestComplete(
|
||||
int32_t request_id,
|
||||
const network::ResourceRequest& request,
|
||||
const network::URLLoaderCompletionStatus& status,
|
||||
bool& handled_externally) {}
|
||||
const network::URLLoaderCompletionStatus& status) {}
|
||||
|
||||
// Called on error.
|
||||
virtual void OnRequestError(int32_t request_id,
|
||||
|
@@ -1069,10 +1069,10 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
}
|
||||
}
|
||||
|
||||
void OnRequestComplete(int32_t request_id,
|
||||
const network::ResourceRequest& request,
|
||||
const network::URLLoaderCompletionStatus& status,
|
||||
bool& handled_externally) override {
|
||||
void OnRequestComplete(
|
||||
int32_t request_id,
|
||||
const network::ResourceRequest& request,
|
||||
const network::URLLoaderCompletionStatus& status) override {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
RequestState* state = GetState(request_id);
|
||||
@@ -1116,7 +1116,6 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
init_state_->browser_, init_state_->frame_,
|
||||
state->pending_request_.get(), allow_os_execution);
|
||||
if (allow_os_execution && init_state_->unhandled_request_callback_) {
|
||||
handled_externally = true;
|
||||
CEF_POST_TASK(TID_UI, init_state_->unhandled_request_callback_);
|
||||
}
|
||||
}
|
||||
|
@@ -197,7 +197,7 @@ struct PopulateAxNodeAttributes {
|
||||
case ax::mojom::IntAttribute::kAriaNotificationPriorityDeprecated: {
|
||||
auto state =
|
||||
static_cast<ax::mojom::AriaNotificationPriority>(attr.second);
|
||||
if (ax::mojom::AriaNotificationPriority::kNormal != state) {
|
||||
if (ax::mojom::AriaNotificationPriority::kNone != state) {
|
||||
attributes->SetString(ToString(attr.first), ToString(state));
|
||||
}
|
||||
} break;
|
||||
|
@@ -443,9 +443,7 @@ void CefRenderWidgetHostViewOSR::Hide() {
|
||||
}
|
||||
|
||||
if (render_widget_host_) {
|
||||
if (render_widget_host_->delegate()) {
|
||||
render_widget_host_->WasHidden();
|
||||
}
|
||||
render_widget_host_->WasHidden();
|
||||
|
||||
auto provider = content::RenderWidgetHostImpl::From(render_widget_host_)
|
||||
->render_frame_metadata_provider();
|
||||
@@ -503,11 +501,7 @@ CefRenderWidgetHostViewOSR::GetDisplayFeature() {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::DisableDisplayFeatureOverrideForEmulation() {
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::OverrideDisplayFeatureForEmulation(
|
||||
void CefRenderWidgetHostViewOSR::SetDisplayFeatureForTesting(
|
||||
const content::DisplayFeature* display_feature) {
|
||||
DCHECK(false);
|
||||
}
|
||||
@@ -1870,7 +1864,8 @@ void CefRenderWidgetHostViewOSR::RequestImeCompositionUpdate(
|
||||
|
||||
void CefRenderWidgetHostViewOSR::ImeCompositionRangeChanged(
|
||||
const gfx::Range& range,
|
||||
const std::optional<std::vector<gfx::Rect>>& character_bounds) {
|
||||
const std::optional<std::vector<gfx::Rect>>& character_bounds,
|
||||
const std::optional<std::vector<gfx::Rect>>& line_bounds) {
|
||||
if (browser_impl_.get()) {
|
||||
CefRange cef_range(range.start(), range.end());
|
||||
CefRenderHandler::RectList rcList;
|
||||
|
@@ -132,8 +132,7 @@ class CefRenderWidgetHostViewOSR
|
||||
std::optional<SkColor> GetBackgroundColor() override;
|
||||
void UpdateBackgroundColor() override;
|
||||
std::optional<content::DisplayFeature> GetDisplayFeature() override;
|
||||
void DisableDisplayFeatureOverrideForEmulation() override;
|
||||
void OverrideDisplayFeatureForEmulation(
|
||||
void SetDisplayFeatureForTesting(
|
||||
const content::DisplayFeature* display_feature) override;
|
||||
blink::mojom::PointerLockResult LockPointer(
|
||||
bool request_unadjusted_movement) override;
|
||||
@@ -186,7 +185,8 @@ class CefRenderWidgetHostViewOSR
|
||||
viz::SurfaceId GetCurrentSurfaceId() const override;
|
||||
void ImeCompositionRangeChanged(
|
||||
const gfx::Range& range,
|
||||
const std::optional<std::vector<gfx::Rect>>& character_bounds) override;
|
||||
const std::optional<std::vector<gfx::Rect>>& character_bounds,
|
||||
const std::optional<std::vector<gfx::Rect>>& line_bounds) override;
|
||||
std::unique_ptr<content::SyntheticGestureTarget>
|
||||
CreateSyntheticGestureTarget() override;
|
||||
bool TransformPointToCoordSpaceForView(
|
||||
|
@@ -187,7 +187,7 @@ void CefVideoConsumerOSR::OnFrameCaptured(
|
||||
view_->OnAcceleratedPaint(damage_rect, info->coded_size, paint_info);
|
||||
#elif BUILDFLAG(IS_LINUX)
|
||||
auto& gmb_handle = data->get_gpu_memory_buffer_handle();
|
||||
auto& native_pixmap = gmb_handle.native_pixmap_handle();
|
||||
auto& native_pixmap = gmb_handle.native_pixmap_handle;
|
||||
CHECK(native_pixmap.planes.size() <= kAcceleratedPaintMaxPlanes);
|
||||
|
||||
cef_accelerated_paint_info_t paint_info;
|
||||
|
@@ -9,7 +9,6 @@
|
||||
#include "base/notreached.h"
|
||||
#include "cef/libcef/browser/browser_host_base.h"
|
||||
#include "chrome/browser/ui/permission_bubble/permission_prompt.h"
|
||||
#include "components/permissions/permission_request.h"
|
||||
|
||||
namespace permission_prompt {
|
||||
|
||||
@@ -246,8 +245,6 @@ cef_permission_request_types_t GetCefRequestType(
|
||||
return CEF_PERMISSION_TYPE_WINDOW_MANAGEMENT;
|
||||
case permissions::RequestType::kFileSystemAccess:
|
||||
return CEF_PERMISSION_TYPE_FILE_SYSTEM_ACCESS;
|
||||
case permissions::RequestType::kLocalNetworkAccess:
|
||||
return CEF_PERMISSION_TYPE_LOCAL_NETWORK_ACCESS;
|
||||
}
|
||||
|
||||
DCHECK(false);
|
||||
|
@@ -1,129 +0,0 @@
|
||||
#include "build/build_config.h"
|
||||
|
||||
// Based on chrome/app/chrome_exe_main_win.cc.
|
||||
// In 32-bit builds, the main thread starts with the default (small) stack size.
|
||||
// The ARCH_CPU_32_BITS blocks here and below are in support of moving the main
|
||||
// thread to a fiber with a larger stack size.
|
||||
#if BUILDFLAG(IS_WIN) && defined(ARCH_CPU_32_BITS)
|
||||
|
||||
#include "base/debug/alias.h"
|
||||
#include "include/internal/cef_app_win.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// The information needed to transfer control to the large-stack fiber and later
|
||||
// pass the main routine's exit code back to the small-stack fiber prior to
|
||||
// termination.
|
||||
struct FiberState {
|
||||
FiberState(wWinMainPtr wWinMain,
|
||||
HINSTANCE hInstance,
|
||||
LPWSTR lpCmdLine,
|
||||
int nCmdShow) {
|
||||
this->wWinMain = wWinMain;
|
||||
this->hInstance = hInstance;
|
||||
this->lpCmdLine = lpCmdLine;
|
||||
this->nCmdShow = nCmdShow;
|
||||
}
|
||||
|
||||
FiberState(mainPtr main, int argc, char** argv) {
|
||||
this->main = main;
|
||||
this->argc = argc;
|
||||
this->argv = argv;
|
||||
}
|
||||
|
||||
wWinMainPtr wWinMain = nullptr;
|
||||
HINSTANCE hInstance;
|
||||
LPWSTR lpCmdLine;
|
||||
int nCmdShow;
|
||||
|
||||
mainPtr main = nullptr;
|
||||
int argc;
|
||||
char** argv;
|
||||
|
||||
LPVOID original_fiber;
|
||||
int fiber_result;
|
||||
};
|
||||
|
||||
// A PFIBER_START_ROUTINE function run on a large-stack fiber that calls the
|
||||
// main routine, stores its return value, and returns control to the small-stack
|
||||
// fiber. |params| must be a pointer to a FiberState struct.
|
||||
void WINAPI FiberBinder(void* params) {
|
||||
auto* fiber_state = static_cast<FiberState*>(params);
|
||||
// Call the main routine from the fiber. Reusing the entry point minimizes
|
||||
// confusion when examining call stacks in crash reports - seeing wWinMain on
|
||||
// the stack is a handy hint that this is the main thread of the process.
|
||||
if (fiber_state->main) {
|
||||
fiber_state->fiber_result =
|
||||
fiber_state->main(fiber_state->argc, fiber_state->argv);
|
||||
} else {
|
||||
fiber_state->fiber_result =
|
||||
fiber_state->wWinMain(fiber_state->hInstance, nullptr,
|
||||
fiber_state->lpCmdLine, fiber_state->nCmdShow);
|
||||
}
|
||||
|
||||
// Switch back to the main thread to exit.
|
||||
::SwitchToFiber(fiber_state->original_fiber);
|
||||
}
|
||||
|
||||
int RunMainWithPreferredStackSize(FiberState& fiber_state) {
|
||||
enum class FiberStatus { kConvertFailed, kCreateFiberFailed, kSuccess };
|
||||
FiberStatus fiber_status = FiberStatus::kSuccess;
|
||||
// GetLastError result if fiber conversion failed.
|
||||
DWORD fiber_error = ERROR_SUCCESS;
|
||||
if (!::IsThreadAFiber()) {
|
||||
// Make the main thread's stack size 4 MiB so that it has roughly the same
|
||||
// effective size as the 64-bit build's 8 MiB stack.
|
||||
constexpr size_t kStackSize = 4 * 1024 * 1024; // 4 MiB
|
||||
// Leak the fiber on exit.
|
||||
LPVOID original_fiber =
|
||||
::ConvertThreadToFiberEx(nullptr, FIBER_FLAG_FLOAT_SWITCH);
|
||||
if (original_fiber) {
|
||||
fiber_state.original_fiber = original_fiber;
|
||||
// Create a fiber with a bigger stack and switch to it. Leak the fiber on
|
||||
// exit.
|
||||
LPVOID big_stack_fiber = ::CreateFiberEx(
|
||||
0, kStackSize, FIBER_FLAG_FLOAT_SWITCH, FiberBinder, &fiber_state);
|
||||
if (big_stack_fiber) {
|
||||
::SwitchToFiber(big_stack_fiber);
|
||||
// The fibers must be cleaned up to avoid obscure TLS-related shutdown
|
||||
// crashes.
|
||||
::DeleteFiber(big_stack_fiber);
|
||||
::ConvertFiberToThread();
|
||||
// Control returns here after CEF has finished running on FiberMain.
|
||||
return fiber_state.fiber_result;
|
||||
}
|
||||
fiber_status = FiberStatus::kCreateFiberFailed;
|
||||
} else {
|
||||
fiber_status = FiberStatus::kConvertFailed;
|
||||
}
|
||||
// If we reach here then creating and switching to a fiber has failed. This
|
||||
// probably means we are low on memory and will soon crash. Try to report
|
||||
// this error once crash reporting is initialized.
|
||||
fiber_error = ::GetLastError();
|
||||
base::debug::Alias(&fiber_error);
|
||||
}
|
||||
|
||||
// If we are already a fiber then continue normal execution.
|
||||
// Intentionally crash if converting to a fiber failed.
|
||||
CHECK_EQ(fiber_status, FiberStatus::kSuccess);
|
||||
return -1;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int CefRunWinMainWithPreferredStackSize(wWinMainPtr wWinMain,
|
||||
HINSTANCE hInstance,
|
||||
LPWSTR lpCmdLine,
|
||||
int nCmdShow) {
|
||||
CHECK(wWinMain && hInstance);
|
||||
FiberState fiber_state(wWinMain, hInstance, lpCmdLine, nCmdShow);
|
||||
return RunMainWithPreferredStackSize(fiber_state);
|
||||
}
|
||||
|
||||
int CefRunMainWithPreferredStackSize(mainPtr main, int argc, char* argv[]) {
|
||||
CHECK(main);
|
||||
FiberState fiber_state(main, argc, argv);
|
||||
return RunMainWithPreferredStackSize(fiber_state);
|
||||
}
|
||||
|
||||
#endif // BUILDFLAG(IS_WIN) && defined(ARCH_CPU_32_BITS)
|
@@ -93,6 +93,7 @@ void SetCefPrefs(const CefBrowserSettings& cef,
|
||||
SET_STATE(cef.text_area_resize, web.text_areas_are_resizable);
|
||||
SET_STATE(cef.tab_to_links, web.tabs_to_links);
|
||||
SET_STATE(cef.local_storage, web.local_storage_enabled);
|
||||
SET_STATE(cef.databases, web.databases_enabled);
|
||||
|
||||
// Never explicitly enable GPU-related functions in this method because the
|
||||
// GPU blacklist is not being checked here.
|
||||
|
@@ -107,7 +107,7 @@ void PrintToPDF(content::WebContents* web_contents,
|
||||
}
|
||||
}
|
||||
|
||||
std::variant<printing::mojom::PrintPagesParamsPtr, std::string>
|
||||
absl::variant<printing::mojom::PrintPagesParamsPtr, std::string>
|
||||
print_pages_params = print_to_pdf::GetPrintPagesParams(
|
||||
web_contents->GetPrimaryMainFrame()->GetLastCommittedURL(),
|
||||
!!settings.landscape, display_header_footer,
|
||||
@@ -117,14 +117,14 @@ void PrintToPDF(content::WebContents* web_contents,
|
||||
CefString(&settings.footer_template), !!settings.prefer_css_page_size,
|
||||
!!settings.generate_tagged_pdf, !!settings.generate_document_outline);
|
||||
|
||||
if (std::holds_alternative<std::string>(print_pages_params)) {
|
||||
if (absl::holds_alternative<std::string>(print_pages_params)) {
|
||||
LOG(ERROR) << "PrintToPDF failed with error: "
|
||||
<< std::get<std::string>(print_pages_params);
|
||||
<< absl::get<std::string>(print_pages_params);
|
||||
callback->OnPdfPrintFinished(CefString(), false);
|
||||
return;
|
||||
}
|
||||
|
||||
DCHECK(std::holds_alternative<printing::mojom::PrintPagesParamsPtr>(
|
||||
DCHECK(absl::holds_alternative<printing::mojom::PrintPagesParamsPtr>(
|
||||
print_pages_params));
|
||||
|
||||
if (auto* print_manager =
|
||||
|
@@ -530,18 +530,14 @@ CefRefPtr<CefValue> CefRequestContextImpl::GetWebsiteSetting(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const auto setting_type = setting_helper::FromCefType(content_type);
|
||||
if (!setting_type) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Either or both URLs may be invalid.
|
||||
GURL requesting_gurl(requesting_url.ToString());
|
||||
GURL top_level_gurl(top_level_url.ToString());
|
||||
|
||||
content_settings::SettingInfo info;
|
||||
base::Value value = settings_map->GetWebsiteSetting(
|
||||
requesting_gurl, top_level_gurl, *setting_type, &info);
|
||||
requesting_gurl, top_level_gurl,
|
||||
static_cast<ContentSettingsType>(content_type), &info);
|
||||
if (value.is_none()) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -580,22 +576,19 @@ cef_content_setting_values_t CefRequestContextImpl::GetContentSetting(
|
||||
return CEF_CONTENT_SETTING_VALUE_DEFAULT;
|
||||
}
|
||||
|
||||
const auto setting_type = setting_helper::FromCefType(content_type);
|
||||
if (!setting_type) {
|
||||
return CEF_CONTENT_SETTING_VALUE_DEFAULT;
|
||||
}
|
||||
|
||||
ContentSetting value = ContentSetting::CONTENT_SETTING_DEFAULT;
|
||||
|
||||
if (requesting_url.empty() && top_level_url.empty()) {
|
||||
value = settings_map->GetDefaultContentSetting(*setting_type,
|
||||
/*provider_id=*/nullptr);
|
||||
value = settings_map->GetDefaultContentSetting(
|
||||
static_cast<ContentSettingsType>(content_type),
|
||||
/*provider_id=*/nullptr);
|
||||
} else {
|
||||
GURL requesting_gurl(requesting_url.ToString());
|
||||
GURL top_level_gurl(top_level_url.ToString());
|
||||
if (requesting_gurl.is_valid() || top_level_gurl.is_valid()) {
|
||||
value = settings_map->GetContentSetting(requesting_gurl, top_level_gurl,
|
||||
*setting_type);
|
||||
value = settings_map->GetContentSetting(
|
||||
requesting_gurl, top_level_gurl,
|
||||
static_cast<ContentSettingsType>(content_type));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -908,11 +901,6 @@ void CefRequestContextImpl::SetWebsiteSettingInternal(
|
||||
return;
|
||||
}
|
||||
|
||||
const auto setting_type = setting_helper::FromCefType(content_type);
|
||||
if (!setting_type) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Starts as a NONE value.
|
||||
base::Value new_value;
|
||||
if (value && value->IsValid()) {
|
||||
@@ -922,13 +910,14 @@ void CefRequestContextImpl::SetWebsiteSettingInternal(
|
||||
if (requesting_url.empty() && top_level_url.empty()) {
|
||||
settings_map->SetWebsiteSettingCustomScope(
|
||||
ContentSettingsPattern::Wildcard(), ContentSettingsPattern::Wildcard(),
|
||||
*setting_type, std::move(new_value));
|
||||
static_cast<ContentSettingsType>(content_type), std::move(new_value));
|
||||
} else {
|
||||
GURL requesting_gurl(requesting_url.ToString());
|
||||
GURL top_level_gurl(top_level_url.ToString());
|
||||
if (requesting_gurl.is_valid() || top_level_gurl.is_valid()) {
|
||||
settings_map->SetWebsiteSettingDefaultScope(
|
||||
requesting_gurl, top_level_gurl, *setting_type, std::move(new_value));
|
||||
requesting_gurl, top_level_gurl,
|
||||
static_cast<ContentSettingsType>(content_type), std::move(new_value));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -950,20 +939,17 @@ void CefRequestContextImpl::SetContentSettingInternal(
|
||||
return;
|
||||
}
|
||||
|
||||
const auto setting_type = setting_helper::FromCefType(content_type);
|
||||
if (!setting_type) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (requesting_url.empty() && top_level_url.empty()) {
|
||||
settings_map->SetDefaultContentSetting(*setting_type,
|
||||
static_cast<ContentSetting>(value));
|
||||
settings_map->SetDefaultContentSetting(
|
||||
static_cast<ContentSettingsType>(content_type),
|
||||
static_cast<ContentSetting>(value));
|
||||
} else {
|
||||
GURL requesting_gurl(requesting_url.ToString());
|
||||
GURL top_level_gurl(top_level_url.ToString());
|
||||
if (requesting_gurl.is_valid() || top_level_gurl.is_valid()) {
|
||||
settings_map->SetContentSettingDefaultScope(
|
||||
requesting_gurl, top_level_gurl, *setting_type,
|
||||
requesting_gurl, top_level_gurl,
|
||||
static_cast<ContentSettingsType>(content_type),
|
||||
static_cast<ContentSetting>(value));
|
||||
}
|
||||
}
|
||||
|
@@ -107,283 +107,12 @@ void Registrar::OnContentSettingChanged(
|
||||
|
||||
const CefString requesting_url(primary_pattern.ToRepresentativeUrl().spec());
|
||||
const CefString top_level_url(secondary_pattern.ToRepresentativeUrl().spec());
|
||||
const auto content_type = ToCefType(content_type_set.GetType());
|
||||
const auto content_type =
|
||||
static_cast<cef_content_setting_types_t>(content_type_set.GetType());
|
||||
|
||||
for (Registration& registration : observers_) {
|
||||
registration.RunCallback(requesting_url, top_level_url, content_type);
|
||||
}
|
||||
}
|
||||
|
||||
#define TO_CEF_TYPE(name) \
|
||||
case ContentSettingsType::name: \
|
||||
return CEF_CONTENT_SETTING_TYPE_##name
|
||||
|
||||
cef_content_setting_types_t ToCefType(ContentSettingsType type) {
|
||||
switch (type) {
|
||||
TO_CEF_TYPE(COOKIES);
|
||||
TO_CEF_TYPE(IMAGES);
|
||||
TO_CEF_TYPE(JAVASCRIPT);
|
||||
TO_CEF_TYPE(POPUPS);
|
||||
TO_CEF_TYPE(GEOLOCATION);
|
||||
TO_CEF_TYPE(NOTIFICATIONS);
|
||||
TO_CEF_TYPE(AUTO_SELECT_CERTIFICATE);
|
||||
TO_CEF_TYPE(MIXEDSCRIPT);
|
||||
TO_CEF_TYPE(MEDIASTREAM_MIC);
|
||||
TO_CEF_TYPE(MEDIASTREAM_CAMERA);
|
||||
TO_CEF_TYPE(PROTOCOL_HANDLERS);
|
||||
TO_CEF_TYPE(DEPRECATED_PPAPI_BROKER);
|
||||
TO_CEF_TYPE(AUTOMATIC_DOWNLOADS);
|
||||
TO_CEF_TYPE(MIDI_SYSEX);
|
||||
TO_CEF_TYPE(SSL_CERT_DECISIONS);
|
||||
TO_CEF_TYPE(PROTECTED_MEDIA_IDENTIFIER);
|
||||
TO_CEF_TYPE(APP_BANNER);
|
||||
TO_CEF_TYPE(SITE_ENGAGEMENT);
|
||||
TO_CEF_TYPE(DURABLE_STORAGE);
|
||||
TO_CEF_TYPE(USB_CHOOSER_DATA);
|
||||
TO_CEF_TYPE(BLUETOOTH_GUARD);
|
||||
TO_CEF_TYPE(BACKGROUND_SYNC);
|
||||
TO_CEF_TYPE(AUTOPLAY);
|
||||
TO_CEF_TYPE(IMPORTANT_SITE_INFO);
|
||||
TO_CEF_TYPE(PERMISSION_AUTOBLOCKER_DATA);
|
||||
TO_CEF_TYPE(ADS);
|
||||
TO_CEF_TYPE(ADS_DATA);
|
||||
TO_CEF_TYPE(MIDI);
|
||||
TO_CEF_TYPE(PASSWORD_PROTECTION);
|
||||
TO_CEF_TYPE(MEDIA_ENGAGEMENT);
|
||||
TO_CEF_TYPE(SOUND);
|
||||
TO_CEF_TYPE(CLIENT_HINTS);
|
||||
TO_CEF_TYPE(SENSORS);
|
||||
TO_CEF_TYPE(DEPRECATED_ACCESSIBILITY_EVENTS);
|
||||
TO_CEF_TYPE(PAYMENT_HANDLER);
|
||||
TO_CEF_TYPE(USB_GUARD);
|
||||
TO_CEF_TYPE(BACKGROUND_FETCH);
|
||||
TO_CEF_TYPE(INTENT_PICKER_DISPLAY);
|
||||
TO_CEF_TYPE(IDLE_DETECTION);
|
||||
TO_CEF_TYPE(SERIAL_GUARD);
|
||||
TO_CEF_TYPE(SERIAL_CHOOSER_DATA);
|
||||
TO_CEF_TYPE(PERIODIC_BACKGROUND_SYNC);
|
||||
TO_CEF_TYPE(BLUETOOTH_SCANNING);
|
||||
TO_CEF_TYPE(HID_GUARD);
|
||||
TO_CEF_TYPE(HID_CHOOSER_DATA);
|
||||
TO_CEF_TYPE(WAKE_LOCK_SCREEN);
|
||||
TO_CEF_TYPE(WAKE_LOCK_SYSTEM);
|
||||
TO_CEF_TYPE(LEGACY_COOKIE_ACCESS);
|
||||
TO_CEF_TYPE(FILE_SYSTEM_WRITE_GUARD);
|
||||
TO_CEF_TYPE(NFC);
|
||||
TO_CEF_TYPE(BLUETOOTH_CHOOSER_DATA);
|
||||
TO_CEF_TYPE(CLIPBOARD_READ_WRITE);
|
||||
TO_CEF_TYPE(CLIPBOARD_SANITIZED_WRITE);
|
||||
TO_CEF_TYPE(SAFE_BROWSING_URL_CHECK_DATA);
|
||||
TO_CEF_TYPE(VR);
|
||||
TO_CEF_TYPE(AR);
|
||||
TO_CEF_TYPE(FILE_SYSTEM_READ_GUARD);
|
||||
TO_CEF_TYPE(STORAGE_ACCESS);
|
||||
TO_CEF_TYPE(CAMERA_PAN_TILT_ZOOM);
|
||||
TO_CEF_TYPE(WINDOW_MANAGEMENT);
|
||||
TO_CEF_TYPE(LOCAL_FONTS);
|
||||
TO_CEF_TYPE(PERMISSION_AUTOREVOCATION_DATA);
|
||||
TO_CEF_TYPE(FILE_SYSTEM_LAST_PICKED_DIRECTORY);
|
||||
TO_CEF_TYPE(DISPLAY_CAPTURE);
|
||||
TO_CEF_TYPE(FILE_SYSTEM_ACCESS_CHOOSER_DATA);
|
||||
TO_CEF_TYPE(FEDERATED_IDENTITY_SHARING);
|
||||
TO_CEF_TYPE(JAVASCRIPT_JIT);
|
||||
TO_CEF_TYPE(HTTP_ALLOWED);
|
||||
TO_CEF_TYPE(FORMFILL_METADATA);
|
||||
TO_CEF_TYPE(DEPRECATED_FEDERATED_IDENTITY_ACTIVE_SESSION);
|
||||
TO_CEF_TYPE(AUTO_DARK_WEB_CONTENT);
|
||||
TO_CEF_TYPE(REQUEST_DESKTOP_SITE);
|
||||
TO_CEF_TYPE(FEDERATED_IDENTITY_API);
|
||||
TO_CEF_TYPE(NOTIFICATION_INTERACTIONS);
|
||||
TO_CEF_TYPE(REDUCED_ACCEPT_LANGUAGE);
|
||||
TO_CEF_TYPE(NOTIFICATION_PERMISSION_REVIEW);
|
||||
TO_CEF_TYPE(PRIVATE_NETWORK_GUARD);
|
||||
TO_CEF_TYPE(PRIVATE_NETWORK_CHOOSER_DATA);
|
||||
TO_CEF_TYPE(FEDERATED_IDENTITY_IDENTITY_PROVIDER_SIGNIN_STATUS);
|
||||
TO_CEF_TYPE(REVOKED_UNUSED_SITE_PERMISSIONS);
|
||||
TO_CEF_TYPE(TOP_LEVEL_STORAGE_ACCESS);
|
||||
TO_CEF_TYPE(FEDERATED_IDENTITY_AUTO_REAUTHN_PERMISSION);
|
||||
TO_CEF_TYPE(FEDERATED_IDENTITY_IDENTITY_PROVIDER_REGISTRATION);
|
||||
TO_CEF_TYPE(ANTI_ABUSE);
|
||||
TO_CEF_TYPE(THIRD_PARTY_STORAGE_PARTITIONING);
|
||||
TO_CEF_TYPE(HTTPS_ENFORCED);
|
||||
TO_CEF_TYPE(ALL_SCREEN_CAPTURE);
|
||||
TO_CEF_TYPE(COOKIE_CONTROLS_METADATA);
|
||||
TO_CEF_TYPE(TPCD_HEURISTICS_GRANTS);
|
||||
TO_CEF_TYPE(TPCD_METADATA_GRANTS);
|
||||
TO_CEF_TYPE(TPCD_TRIAL);
|
||||
TO_CEF_TYPE(TOP_LEVEL_TPCD_TRIAL);
|
||||
TO_CEF_TYPE(TOP_LEVEL_TPCD_ORIGIN_TRIAL);
|
||||
TO_CEF_TYPE(AUTO_PICTURE_IN_PICTURE);
|
||||
TO_CEF_TYPE(FILE_SYSTEM_ACCESS_EXTENDED_PERMISSION);
|
||||
TO_CEF_TYPE(FILE_SYSTEM_ACCESS_RESTORE_PERMISSION);
|
||||
TO_CEF_TYPE(CAPTURED_SURFACE_CONTROL);
|
||||
TO_CEF_TYPE(SMART_CARD_GUARD);
|
||||
TO_CEF_TYPE(SMART_CARD_DATA);
|
||||
TO_CEF_TYPE(WEB_PRINTING);
|
||||
TO_CEF_TYPE(AUTOMATIC_FULLSCREEN);
|
||||
TO_CEF_TYPE(SUB_APP_INSTALLATION_PROMPTS);
|
||||
TO_CEF_TYPE(SPEAKER_SELECTION);
|
||||
TO_CEF_TYPE(DIRECT_SOCKETS);
|
||||
TO_CEF_TYPE(KEYBOARD_LOCK);
|
||||
TO_CEF_TYPE(POINTER_LOCK);
|
||||
TO_CEF_TYPE(REVOKED_ABUSIVE_NOTIFICATION_PERMISSIONS);
|
||||
TO_CEF_TYPE(TRACKING_PROTECTION);
|
||||
TO_CEF_TYPE(DISPLAY_MEDIA_SYSTEM_AUDIO);
|
||||
TO_CEF_TYPE(JAVASCRIPT_OPTIMIZER);
|
||||
TO_CEF_TYPE(STORAGE_ACCESS_HEADER_ORIGIN_TRIAL);
|
||||
TO_CEF_TYPE(HAND_TRACKING);
|
||||
TO_CEF_TYPE(WEB_APP_INSTALLATION);
|
||||
TO_CEF_TYPE(DIRECT_SOCKETS_PRIVATE_NETWORK_ACCESS);
|
||||
TO_CEF_TYPE(LEGACY_COOKIE_SCOPE);
|
||||
TO_CEF_TYPE(ARE_SUSPICIOUS_NOTIFICATIONS_ALLOWLISTED_BY_USER);
|
||||
TO_CEF_TYPE(CONTROLLED_FRAME);
|
||||
TO_CEF_TYPE(REVOKED_DISRUPTIVE_NOTIFICATION_PERMISSIONS);
|
||||
TO_CEF_TYPE(LOCAL_NETWORK_ACCESS);
|
||||
TO_CEF_TYPE(ON_DEVICE_SPEECH_RECOGNITION_LANGUAGES_DOWNLOADED);
|
||||
TO_CEF_TYPE(INITIALIZED_TRANSLATIONS);
|
||||
TO_CEF_TYPE(SUSPICIOUS_NOTIFICATION_IDS);
|
||||
case ContentSettingsType::DEFAULT:
|
||||
break;
|
||||
}
|
||||
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
#define FROM_CEF_TYPE(name) \
|
||||
case CEF_CONTENT_SETTING_TYPE_##name: \
|
||||
return ContentSettingsType::name
|
||||
|
||||
std::optional<ContentSettingsType> FromCefType(
|
||||
cef_content_setting_types_t type) {
|
||||
switch (type) {
|
||||
FROM_CEF_TYPE(COOKIES);
|
||||
FROM_CEF_TYPE(IMAGES);
|
||||
FROM_CEF_TYPE(JAVASCRIPT);
|
||||
FROM_CEF_TYPE(POPUPS);
|
||||
FROM_CEF_TYPE(GEOLOCATION);
|
||||
FROM_CEF_TYPE(NOTIFICATIONS);
|
||||
FROM_CEF_TYPE(AUTO_SELECT_CERTIFICATE);
|
||||
FROM_CEF_TYPE(MIXEDSCRIPT);
|
||||
FROM_CEF_TYPE(MEDIASTREAM_MIC);
|
||||
FROM_CEF_TYPE(MEDIASTREAM_CAMERA);
|
||||
FROM_CEF_TYPE(PROTOCOL_HANDLERS);
|
||||
FROM_CEF_TYPE(DEPRECATED_PPAPI_BROKER);
|
||||
FROM_CEF_TYPE(AUTOMATIC_DOWNLOADS);
|
||||
FROM_CEF_TYPE(MIDI_SYSEX);
|
||||
FROM_CEF_TYPE(SSL_CERT_DECISIONS);
|
||||
FROM_CEF_TYPE(PROTECTED_MEDIA_IDENTIFIER);
|
||||
FROM_CEF_TYPE(APP_BANNER);
|
||||
FROM_CEF_TYPE(SITE_ENGAGEMENT);
|
||||
FROM_CEF_TYPE(DURABLE_STORAGE);
|
||||
FROM_CEF_TYPE(USB_CHOOSER_DATA);
|
||||
FROM_CEF_TYPE(BLUETOOTH_GUARD);
|
||||
FROM_CEF_TYPE(BACKGROUND_SYNC);
|
||||
FROM_CEF_TYPE(AUTOPLAY);
|
||||
FROM_CEF_TYPE(IMPORTANT_SITE_INFO);
|
||||
FROM_CEF_TYPE(PERMISSION_AUTOBLOCKER_DATA);
|
||||
FROM_CEF_TYPE(ADS);
|
||||
FROM_CEF_TYPE(ADS_DATA);
|
||||
FROM_CEF_TYPE(MIDI);
|
||||
FROM_CEF_TYPE(PASSWORD_PROTECTION);
|
||||
FROM_CEF_TYPE(MEDIA_ENGAGEMENT);
|
||||
FROM_CEF_TYPE(SOUND);
|
||||
FROM_CEF_TYPE(CLIENT_HINTS);
|
||||
FROM_CEF_TYPE(SENSORS);
|
||||
FROM_CEF_TYPE(DEPRECATED_ACCESSIBILITY_EVENTS);
|
||||
FROM_CEF_TYPE(PAYMENT_HANDLER);
|
||||
FROM_CEF_TYPE(USB_GUARD);
|
||||
FROM_CEF_TYPE(BACKGROUND_FETCH);
|
||||
FROM_CEF_TYPE(INTENT_PICKER_DISPLAY);
|
||||
FROM_CEF_TYPE(IDLE_DETECTION);
|
||||
FROM_CEF_TYPE(SERIAL_GUARD);
|
||||
FROM_CEF_TYPE(SERIAL_CHOOSER_DATA);
|
||||
FROM_CEF_TYPE(PERIODIC_BACKGROUND_SYNC);
|
||||
FROM_CEF_TYPE(BLUETOOTH_SCANNING);
|
||||
FROM_CEF_TYPE(HID_GUARD);
|
||||
FROM_CEF_TYPE(HID_CHOOSER_DATA);
|
||||
FROM_CEF_TYPE(WAKE_LOCK_SCREEN);
|
||||
FROM_CEF_TYPE(WAKE_LOCK_SYSTEM);
|
||||
FROM_CEF_TYPE(LEGACY_COOKIE_ACCESS);
|
||||
FROM_CEF_TYPE(FILE_SYSTEM_WRITE_GUARD);
|
||||
FROM_CEF_TYPE(NFC);
|
||||
FROM_CEF_TYPE(BLUETOOTH_CHOOSER_DATA);
|
||||
FROM_CEF_TYPE(CLIPBOARD_READ_WRITE);
|
||||
FROM_CEF_TYPE(CLIPBOARD_SANITIZED_WRITE);
|
||||
FROM_CEF_TYPE(SAFE_BROWSING_URL_CHECK_DATA);
|
||||
FROM_CEF_TYPE(VR);
|
||||
FROM_CEF_TYPE(AR);
|
||||
FROM_CEF_TYPE(FILE_SYSTEM_READ_GUARD);
|
||||
FROM_CEF_TYPE(STORAGE_ACCESS);
|
||||
FROM_CEF_TYPE(CAMERA_PAN_TILT_ZOOM);
|
||||
FROM_CEF_TYPE(WINDOW_MANAGEMENT);
|
||||
FROM_CEF_TYPE(LOCAL_FONTS);
|
||||
FROM_CEF_TYPE(PERMISSION_AUTOREVOCATION_DATA);
|
||||
FROM_CEF_TYPE(FILE_SYSTEM_LAST_PICKED_DIRECTORY);
|
||||
FROM_CEF_TYPE(DISPLAY_CAPTURE);
|
||||
FROM_CEF_TYPE(FILE_SYSTEM_ACCESS_CHOOSER_DATA);
|
||||
FROM_CEF_TYPE(FEDERATED_IDENTITY_SHARING);
|
||||
FROM_CEF_TYPE(JAVASCRIPT_JIT);
|
||||
FROM_CEF_TYPE(HTTP_ALLOWED);
|
||||
FROM_CEF_TYPE(FORMFILL_METADATA);
|
||||
FROM_CEF_TYPE(DEPRECATED_FEDERATED_IDENTITY_ACTIVE_SESSION);
|
||||
FROM_CEF_TYPE(AUTO_DARK_WEB_CONTENT);
|
||||
FROM_CEF_TYPE(REQUEST_DESKTOP_SITE);
|
||||
FROM_CEF_TYPE(FEDERATED_IDENTITY_API);
|
||||
FROM_CEF_TYPE(NOTIFICATION_INTERACTIONS);
|
||||
FROM_CEF_TYPE(REDUCED_ACCEPT_LANGUAGE);
|
||||
FROM_CEF_TYPE(NOTIFICATION_PERMISSION_REVIEW);
|
||||
FROM_CEF_TYPE(PRIVATE_NETWORK_GUARD);
|
||||
FROM_CEF_TYPE(PRIVATE_NETWORK_CHOOSER_DATA);
|
||||
FROM_CEF_TYPE(FEDERATED_IDENTITY_IDENTITY_PROVIDER_SIGNIN_STATUS);
|
||||
FROM_CEF_TYPE(REVOKED_UNUSED_SITE_PERMISSIONS);
|
||||
FROM_CEF_TYPE(TOP_LEVEL_STORAGE_ACCESS);
|
||||
FROM_CEF_TYPE(FEDERATED_IDENTITY_AUTO_REAUTHN_PERMISSION);
|
||||
FROM_CEF_TYPE(FEDERATED_IDENTITY_IDENTITY_PROVIDER_REGISTRATION);
|
||||
FROM_CEF_TYPE(ANTI_ABUSE);
|
||||
FROM_CEF_TYPE(THIRD_PARTY_STORAGE_PARTITIONING);
|
||||
FROM_CEF_TYPE(HTTPS_ENFORCED);
|
||||
FROM_CEF_TYPE(ALL_SCREEN_CAPTURE);
|
||||
FROM_CEF_TYPE(COOKIE_CONTROLS_METADATA);
|
||||
FROM_CEF_TYPE(TPCD_HEURISTICS_GRANTS);
|
||||
FROM_CEF_TYPE(TPCD_METADATA_GRANTS);
|
||||
FROM_CEF_TYPE(TPCD_TRIAL);
|
||||
FROM_CEF_TYPE(TOP_LEVEL_TPCD_TRIAL);
|
||||
FROM_CEF_TYPE(TOP_LEVEL_TPCD_ORIGIN_TRIAL);
|
||||
FROM_CEF_TYPE(AUTO_PICTURE_IN_PICTURE);
|
||||
FROM_CEF_TYPE(FILE_SYSTEM_ACCESS_EXTENDED_PERMISSION);
|
||||
FROM_CEF_TYPE(FILE_SYSTEM_ACCESS_RESTORE_PERMISSION);
|
||||
FROM_CEF_TYPE(CAPTURED_SURFACE_CONTROL);
|
||||
FROM_CEF_TYPE(SMART_CARD_GUARD);
|
||||
FROM_CEF_TYPE(SMART_CARD_DATA);
|
||||
FROM_CEF_TYPE(WEB_PRINTING);
|
||||
FROM_CEF_TYPE(AUTOMATIC_FULLSCREEN);
|
||||
FROM_CEF_TYPE(SUB_APP_INSTALLATION_PROMPTS);
|
||||
FROM_CEF_TYPE(SPEAKER_SELECTION);
|
||||
FROM_CEF_TYPE(DIRECT_SOCKETS);
|
||||
FROM_CEF_TYPE(KEYBOARD_LOCK);
|
||||
FROM_CEF_TYPE(POINTER_LOCK);
|
||||
FROM_CEF_TYPE(REVOKED_ABUSIVE_NOTIFICATION_PERMISSIONS);
|
||||
FROM_CEF_TYPE(TRACKING_PROTECTION);
|
||||
FROM_CEF_TYPE(DISPLAY_MEDIA_SYSTEM_AUDIO);
|
||||
FROM_CEF_TYPE(JAVASCRIPT_OPTIMIZER);
|
||||
FROM_CEF_TYPE(STORAGE_ACCESS_HEADER_ORIGIN_TRIAL);
|
||||
FROM_CEF_TYPE(HAND_TRACKING);
|
||||
FROM_CEF_TYPE(WEB_APP_INSTALLATION);
|
||||
FROM_CEF_TYPE(DIRECT_SOCKETS_PRIVATE_NETWORK_ACCESS);
|
||||
FROM_CEF_TYPE(LEGACY_COOKIE_SCOPE);
|
||||
FROM_CEF_TYPE(ARE_SUSPICIOUS_NOTIFICATIONS_ALLOWLISTED_BY_USER);
|
||||
FROM_CEF_TYPE(CONTROLLED_FRAME);
|
||||
FROM_CEF_TYPE(REVOKED_DISRUPTIVE_NOTIFICATION_PERMISSIONS);
|
||||
FROM_CEF_TYPE(LOCAL_NETWORK_ACCESS);
|
||||
FROM_CEF_TYPE(ON_DEVICE_SPEECH_RECOGNITION_LANGUAGES_DOWNLOADED);
|
||||
FROM_CEF_TYPE(INITIALIZED_TRANSLATIONS);
|
||||
FROM_CEF_TYPE(SUSPICIOUS_NOTIFICATION_IDS);
|
||||
case CEF_CONTENT_SETTING_TYPE_INSECURE_PRIVATE_NETWORK_DEPRECATED:
|
||||
case CEF_CONTENT_SETTING_TYPE_NUM_VALUES:
|
||||
break;
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
} // namespace setting_helper
|
||||
|
@@ -5,14 +5,10 @@
|
||||
#ifndef CEF_LIBCEF_BROWSER_SETTING_HELPER_H_
|
||||
#define CEF_LIBCEF_BROWSER_SETTING_HELPER_H_
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/observer_list.h"
|
||||
#include "cef/include/cef_registration.h"
|
||||
#include "cef/include/internal/cef_types_content_settings.h"
|
||||
#include "components/content_settings/core/browser/content_settings_observer.h"
|
||||
#include "components/content_settings/core/common/content_settings_types.h"
|
||||
|
||||
class CefSettingObserver;
|
||||
class CefRegistration;
|
||||
@@ -80,11 +76,6 @@ class Registrar final : public content_settings::Observer {
|
||||
base::ObserverList<Registration> observers_;
|
||||
};
|
||||
|
||||
// Convert between cef_content_setting_types_t and ContentSettingsType.
|
||||
cef_content_setting_types_t ToCefType(ContentSettingsType type);
|
||||
std::optional<ContentSettingsType> FromCefType(
|
||||
cef_content_setting_types_t type);
|
||||
|
||||
} // namespace setting_helper
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_SETTING_HELPER_H_
|
||||
|
@@ -3,6 +3,7 @@
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "base/feature_list.h"
|
||||
#include "base/features.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/path_service.h"
|
||||
#include "cef/include/test/cef_test_helpers.h"
|
||||
@@ -19,6 +20,7 @@ bool CefIsFeatureEnabledForTests(const CefString& feature_name) {
|
||||
// Only includes values that are queried by unit tests.
|
||||
const base::Feature* features[] = {
|
||||
&net::features::kIgnoreHSTSForLocalhost,
|
||||
&base::features::kUseRustJsonParser,
|
||||
&network::features::kReduceAcceptLanguage,
|
||||
};
|
||||
|
||||
|
@@ -62,12 +62,12 @@ CEF_LABEL_BUTTON_IMPL_T class CefLabelButtonImpl : public CEF_BUTTON_IMPL_D {
|
||||
CEF_LABEL_BUTTON_IMPL_T void CEF_LABEL_BUTTON_IMPL_D::SetText(
|
||||
const CefString& text) {
|
||||
CEF_REQUIRE_VALID_RETURN_VOID();
|
||||
ParentClass::root_view()->SetText(text.ToString16());
|
||||
ParentClass::root_view()->SetText(text);
|
||||
}
|
||||
|
||||
CEF_LABEL_BUTTON_IMPL_T CefString CEF_LABEL_BUTTON_IMPL_D::GetText() {
|
||||
CEF_REQUIRE_VALID_RETURN(CefString());
|
||||
return std::u16string(ParentClass::root_view()->GetText());
|
||||
return ParentClass::root_view()->GetText();
|
||||
}
|
||||
|
||||
CEF_LABEL_BUTTON_IMPL_T void CEF_LABEL_BUTTON_IMPL_D::SetImage(
|
||||
|
@@ -190,9 +190,7 @@ void CefOverlayViewHost::Init(views::View* host_view,
|
||||
// Initialize the Widget. |widget_| will be deleted by the NativeWidget or
|
||||
// when WidgetDelegate::DeleteDelegate() deletes |this|.
|
||||
widget_ = std::make_unique<ThemeCopyingWidget>(window_view_->GetWidget());
|
||||
views::Widget::InitParams params(
|
||||
views::Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET,
|
||||
views::Widget::InitParams::TYPE_CONTROL);
|
||||
views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL);
|
||||
params.delegate = this;
|
||||
params.name = "CefOverlayViewHost";
|
||||
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
|
||||
@@ -216,9 +214,8 @@ void CefOverlayViewHost::Init(views::View* host_view,
|
||||
|
||||
// Cause WidgetDelegate::DeleteDelegate() to delete |this| after executing the
|
||||
// registered DeleteDelegate callback.
|
||||
SetOwnedByWidget(OwnedByWidgetPassKey());
|
||||
SetOwnedByWidget(true);
|
||||
RegisterDeleteDelegateCallback(
|
||||
RegisterDeleteCallbackPassKey(),
|
||||
base::BindOnce(&CefOverlayViewHost::Cleanup, base::Unretained(this)));
|
||||
|
||||
if (window_view_->IsChromeStyle()) {
|
||||
|
@@ -77,12 +77,12 @@ bool CefTextfieldImpl::IsReadOnly() {
|
||||
|
||||
CefString CefTextfieldImpl::GetText() {
|
||||
CEF_REQUIRE_VALID_RETURN(CefString());
|
||||
return std::u16string(root_view()->GetText());
|
||||
return root_view()->GetText();
|
||||
}
|
||||
|
||||
void CefTextfieldImpl::SetText(const CefString& text) {
|
||||
CEF_REQUIRE_VALID_RETURN_VOID();
|
||||
root_view()->SetText(text.ToString16());
|
||||
root_view()->SetText(text);
|
||||
}
|
||||
|
||||
void CefTextfieldImpl::AppendText(const CefString& text) {
|
||||
@@ -102,7 +102,7 @@ bool CefTextfieldImpl::HasSelection() {
|
||||
|
||||
CefString CefTextfieldImpl::GetSelectedText() {
|
||||
CEF_REQUIRE_VALID_RETURN(CefString());
|
||||
return std::u16string(root_view()->GetSelectedText());
|
||||
return root_view()->GetSelectedText();
|
||||
}
|
||||
|
||||
void CefTextfieldImpl::SelectAll(bool reversed) {
|
||||
@@ -208,12 +208,12 @@ void CefTextfieldImpl::ClearEditHistory() {
|
||||
|
||||
void CefTextfieldImpl::SetPlaceholderText(const CefString& text) {
|
||||
CEF_REQUIRE_VALID_RETURN_VOID();
|
||||
root_view()->SetPlaceholderText(text.ToString16());
|
||||
root_view()->SetPlaceholderText(text);
|
||||
}
|
||||
|
||||
CefString CefTextfieldImpl::GetPlaceholderText() {
|
||||
CEF_REQUIRE_VALID_RETURN(CefString());
|
||||
return std::u16string(root_view()->GetPlaceholderText());
|
||||
return root_view()->GetPlaceholderText();
|
||||
}
|
||||
|
||||
void CefTextfieldImpl::SetPlaceholderTextColor(cef_color_t color) {
|
||||
|
@@ -218,7 +218,7 @@ display::Display GetDisplayNearestPoint(const gfx::Point& point,
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
if (input_pixel_coords) {
|
||||
find_point = gfx::ToFlooredPoint(
|
||||
display::win::GetScreenWin()->ScreenToDIPPoint(gfx::PointF(point)));
|
||||
display::win::ScreenWin::ScreenToDIPPoint(gfx::PointF(point)));
|
||||
}
|
||||
#endif
|
||||
return display::Screen::GetScreen()->GetDisplayNearestPoint(find_point);
|
||||
@@ -230,7 +230,7 @@ display::Display GetDisplayMatchingBounds(const gfx::Rect& bounds,
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
if (input_pixel_coords) {
|
||||
find_bounds =
|
||||
display::win::GetScreenWin()->ScreenToDIPRect(nullptr, find_bounds);
|
||||
display::win::ScreenWin::ScreenToDIPRect(nullptr, find_bounds);
|
||||
}
|
||||
#endif
|
||||
return display::Screen::GetScreen()->GetDisplayMatching(find_bounds);
|
||||
@@ -249,19 +249,19 @@ void ConvertPointToPixels(gfx::Point* point, float device_scale_factor) {
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
gfx::Point ConvertPointFromPixels(const gfx::Point& point) {
|
||||
return gfx::ToFlooredPoint(
|
||||
display::win::GetScreenWin()->ScreenToDIPPoint(gfx::PointF(point)));
|
||||
display::win::ScreenWin::ScreenToDIPPoint(gfx::PointF(point)));
|
||||
}
|
||||
|
||||
gfx::Point ConvertPointToPixels(const gfx::Point& point) {
|
||||
return display::win::GetScreenWin()->DIPToScreenPoint(point);
|
||||
return display::win::ScreenWin::DIPToScreenPoint(point);
|
||||
}
|
||||
|
||||
gfx::Rect ConvertRectFromPixels(const gfx::Rect& rect) {
|
||||
return display::win::GetScreenWin()->ScreenToDIPRect(nullptr, rect);
|
||||
return display::win::ScreenWin::ScreenToDIPRect(nullptr, rect);
|
||||
}
|
||||
|
||||
gfx::Rect ConvertRectToPixels(const gfx::Rect& rect) {
|
||||
return display::win::GetScreenWin()->DIPToScreenRect(nullptr, rect);
|
||||
return display::win::ScreenWin::DIPToScreenRect(nullptr, rect);
|
||||
}
|
||||
#endif // BUILDFLAG(IS_WIN)
|
||||
|
||||
@@ -377,7 +377,7 @@ std::optional<SkColor> GetBackgroundColor(const views::View* view,
|
||||
bool allow_transparent) {
|
||||
// Return the configured background color, if any.
|
||||
if (view->background()) {
|
||||
return view->background()->color().GetSkColor();
|
||||
return view->background()->get_color();
|
||||
}
|
||||
|
||||
// If the containing Widget is an overlay then it has a transparent background
|
||||
|
@@ -110,7 +110,7 @@ class NativeFrameViewEx : public views::NativeFrameView {
|
||||
// Convert from DIP to pixel coordinates using a method that can handle
|
||||
// multiple displays with different DPI.
|
||||
const auto screen_rect =
|
||||
display::win::GetScreenWin()->DIPToScreenRect(window, client_bounds);
|
||||
display::win::ScreenWin::DIPToScreenRect(window, client_bounds);
|
||||
|
||||
RECT rect = {screen_rect.x(), screen_rect.y(),
|
||||
screen_rect.x() + screen_rect.width(),
|
||||
@@ -123,7 +123,7 @@ class NativeFrameViewEx : public views::NativeFrameView {
|
||||
rect.right - rect.left, rect.bottom - rect.top);
|
||||
|
||||
// Convert back to DIP.
|
||||
return display::win::GetScreenWin()->ScreenToDIPRect(window, pixel_rect);
|
||||
return display::win::ScreenWin::ScreenToDIPRect(window, pixel_rect);
|
||||
#else
|
||||
// Use the default implementation.
|
||||
return views::NativeFrameView::GetWindowBoundsForClientBounds(
|
||||
@@ -420,9 +420,8 @@ void CefWindowView::CreateWidget(gfx::AcceleratedWidget parent_widget) {
|
||||
|
||||
// Cause WidgetDelegate::DeleteDelegate() to delete |this| after executing the
|
||||
// registered DeleteDelegate callback.
|
||||
SetOwnedByWidget(OwnedByWidgetPassKey());
|
||||
SetOwnedByWidget(true);
|
||||
RegisterDeleteDelegateCallback(
|
||||
RegisterDeleteCallbackPassKey(),
|
||||
base::BindOnce(&CefWindowView::DeleteDelegate, base::Unretained(this)));
|
||||
|
||||
if (cef_delegate()) {
|
||||
|
@@ -11,7 +11,6 @@
|
||||
#include "cef/include/internal/cef_logging_internal.h"
|
||||
#include "cef/include/internal/cef_thread_internal.h"
|
||||
#include "cef/include/internal/cef_trace_event_internal.h"
|
||||
#include "cef/libcef/common/api_version_util.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -219,13 +218,13 @@ CEF_EXPORT void cef_log(const char* file,
|
||||
}
|
||||
|
||||
CEF_EXPORT cef_platform_thread_id_t cef_get_current_platform_thread_id() {
|
||||
return base::PlatformThread::CurrentId().raw();
|
||||
return base::PlatformThread::CurrentId();
|
||||
}
|
||||
|
||||
CEF_EXPORT cef_platform_thread_handle_t
|
||||
cef_get_current_platform_thread_handle() {
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
return base::PlatformThread::CurrentId().raw();
|
||||
return base::PlatformThread::CurrentId();
|
||||
#else
|
||||
return base::PlatformThread::CurrentHandle().platform_handle();
|
||||
#endif
|
||||
@@ -241,7 +240,5 @@ CEF_EXPORT int cef_dump_without_crashing(long long mseconds_between_dumps,
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_dump_without_crashing_unthrottled() {
|
||||
CEF_API_REQUIRE_REMOVED(13500);
|
||||
NOTIMPLEMENTED();
|
||||
return 0;
|
||||
return base::debug::DumpWithoutCrashingUnthrottled();
|
||||
}
|
||||
|
@@ -463,7 +463,7 @@ std::optional<int> ChromeMainDelegateCef::PostEarlyInitialization(
|
||||
const auto result = ChromeMainDelegate::PostEarlyInitialization(invoked_in);
|
||||
if (!result) {
|
||||
const auto* invoked_in_browser =
|
||||
std::get_if<InvokedInBrowserProcess>(&invoked_in);
|
||||
absl::get_if<InvokedInBrowserProcess>(&invoked_in);
|
||||
if (invoked_in_browser) {
|
||||
// At this point local_state has been created but ownership has not yet
|
||||
// been passed to BrowserProcessImpl (g_browser_process is nullptr).
|
||||
@@ -479,7 +479,7 @@ std::optional<int> ChromeMainDelegateCef::PostEarlyInitialization(
|
||||
return result;
|
||||
}
|
||||
|
||||
std::variant<int, content::MainFunctionParams>
|
||||
absl::variant<int, content::MainFunctionParams>
|
||||
ChromeMainDelegateCef::RunProcess(
|
||||
const std::string& process_type,
|
||||
content::MainFunctionParams main_function_params) {
|
||||
|
@@ -43,7 +43,7 @@ class ChromeMainDelegateCef : public ChromeMainDelegate,
|
||||
void SandboxInitialized(const std::string& process_type) override;
|
||||
std::optional<int> PreBrowserMain() override;
|
||||
std::optional<int> PostEarlyInitialization(InvokedIn invoked_in) override;
|
||||
std::variant<int, content::MainFunctionParams> RunProcess(
|
||||
absl::variant<int, content::MainFunctionParams> RunProcess(
|
||||
const std::string& process_type,
|
||||
content::MainFunctionParams main_function_params) override;
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
|
@@ -548,12 +548,13 @@ bool CefCrashReporterClient::ReadCrashConfigFile() {
|
||||
// Allow override of some values via environment variables.
|
||||
{
|
||||
std::unique_ptr<base::Environment> env(base::Environment::Create());
|
||||
if (const auto& var_str = env->GetVar("CEF_CRASH_REPORTER_SERVER_URL")) {
|
||||
ParseURL(*var_str, &server_url_);
|
||||
std::string val_str;
|
||||
|
||||
if (env->GetVar("CEF_CRASH_REPORTER_SERVER_URL", &val_str)) {
|
||||
ParseURL(val_str, &server_url_);
|
||||
}
|
||||
if (const auto& var_str =
|
||||
env->GetVar("CEF_CRASH_REPORTER_RATE_LIMIT_ENABLED")) {
|
||||
rate_limit_ = ParseBool(*var_str);
|
||||
if (env->GetVar("CEF_CRASH_REPORTER_RATE_LIMIT_ENABLED", &val_str)) {
|
||||
rate_limit_ = ParseBool(val_str);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -641,9 +642,11 @@ bool CefCrashReporterClient::GetCrashDumpLocation(base::FilePath* crash_dir) {
|
||||
// By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate
|
||||
// location to write breakpad crash dumps can be set.
|
||||
std::unique_ptr<base::Environment> env(base::Environment::Create());
|
||||
if (const auto& val = env->GetVar("BREAKPAD_DUMP_LOCATION")) {
|
||||
base::PathService::Override(chrome::DIR_CRASH_DUMPS,
|
||||
base::FilePath::FromUTF8Unsafe(*val));
|
||||
std::string alternate_crash_dump_location;
|
||||
if (env->GetVar("BREAKPAD_DUMP_LOCATION", &alternate_crash_dump_location)) {
|
||||
base::FilePath crash_dumps_dir_path =
|
||||
base::FilePath::FromUTF8Unsafe(alternate_crash_dump_location);
|
||||
base::PathService::Override(chrome::DIR_CRASH_DUMPS, crash_dumps_dir_path);
|
||||
}
|
||||
return base::PathService::Get(chrome::DIR_CRASH_DUMPS, crash_dir);
|
||||
}
|
||||
@@ -723,7 +726,8 @@ bool CefCrashReporterClient::EnableBrowserCrashForwarding() {
|
||||
// storage for each key size and later substituting the actual key name during
|
||||
// crash dump processing.
|
||||
|
||||
#define IDKEY(name) {name, IDKey::Tag::kArray}
|
||||
#define IDKEY(name) \
|
||||
{ name, IDKey::Tag::kArray }
|
||||
|
||||
#define IDKEY_ENTRIES(n) \
|
||||
IDKEY(n "-A"), IDKEY(n "-B"), IDKEY(n "-C"), IDKEY(n "-D"), IDKEY(n "-E"), \
|
||||
|
@@ -62,7 +62,7 @@ bool CefCreateTempDirectoryInDirectory(const CefString& base_dir,
|
||||
base::FilePath result;
|
||||
base::FilePath::StringType prefix_str = prefix;
|
||||
if (base::CreateTemporaryDirInDir(
|
||||
base_dir, base::FilePath::StringViewType(prefix_str), &result)) {
|
||||
base_dir, base::FilePath::StringPieceType(prefix_str), &result)) {
|
||||
new_dir = result.value();
|
||||
return true;
|
||||
}
|
||||
|
@@ -111,19 +111,12 @@ struct NewRenderThreadInfo {
|
||||
array<CrossOriginWhiteListEntry>? cross_origin_whitelist_entries;
|
||||
};
|
||||
|
||||
struct NewBrowserConfig {
|
||||
bool is_popup;
|
||||
|
||||
// Values from cef::BrowserConfig.
|
||||
bool is_windowless;
|
||||
bool print_preview_enabled;
|
||||
bool move_pip_enabled;
|
||||
};
|
||||
|
||||
struct NewBrowserInfo {
|
||||
int32 browser_id;
|
||||
bool? is_popup;
|
||||
bool? is_windowless;
|
||||
bool? print_preview_enabled;
|
||||
bool is_excluded;
|
||||
NewBrowserConfig? config;
|
||||
mojo_base.mojom.DictionaryValue? extra_info;
|
||||
};
|
||||
|
||||
|
@@ -36,7 +36,9 @@ std::string GenerateHeaders(const HeaderMap& map) {
|
||||
|
||||
void ParseHeaders(const std::string& header_str, HeaderMap& map) {
|
||||
// Parse the request header values
|
||||
for (net::HttpUtil::HeadersIterator i(header_str, "\n\r"); i.GetNext();) {
|
||||
for (net::HttpUtil::HeadersIterator i(header_str.begin(), header_str.end(),
|
||||
"\n\r");
|
||||
i.GetNext();) {
|
||||
map.insert(std::make_pair(i.name(), i.values()));
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user