mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
36 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
cb937fc9cd | ||
|
56227877aa | ||
|
e710be4f64 | ||
|
458cc98590 | ||
|
1d1fe01a48 | ||
|
5e6699b223 | ||
|
678fa78c28 | ||
|
924c2e339e | ||
|
c8ac6c879d | ||
|
5969b2bbb8 | ||
|
fbc59483b9 | ||
|
dcdb070ecd | ||
|
b69a4a2e3d | ||
|
df6fb4f06e | ||
|
b8ca094aca | ||
|
01ef24d928 | ||
|
ce3a5d5a7b | ||
|
36bc0371bf | ||
|
391685c279 | ||
|
7016b2def6 | ||
|
f9b6257652 | ||
|
6d61f0c90f | ||
|
006d0629a0 | ||
|
8f5df4027b | ||
|
1489b9dde4 | ||
|
e858849615 | ||
|
876e82f444 | ||
|
74b4a5fe27 | ||
|
b3f2995808 | ||
|
5fa11acf79 | ||
|
a64237bcb0 | ||
|
ea0e213bef | ||
|
a659b48fd1 | ||
|
4cc3a221c3 | ||
|
dec98a5534 | ||
|
fcad76b405 |
122
BUILD.gn
122
BUILD.gn
@@ -350,6 +350,8 @@ static_library("libcef_static") {
|
|||||||
"libcef/browser/extensions/component_extension_resource_manager.h",
|
"libcef/browser/extensions/component_extension_resource_manager.h",
|
||||||
"libcef/browser/extensions/extensions_api_client.cc",
|
"libcef/browser/extensions/extensions_api_client.cc",
|
||||||
"libcef/browser/extensions/extensions_api_client.h",
|
"libcef/browser/extensions/extensions_api_client.h",
|
||||||
|
"libcef/browser/extensions/extensions_browser_api_provider.cc",
|
||||||
|
"libcef/browser/extensions/extensions_browser_api_provider.h",
|
||||||
"libcef/browser/extensions/extensions_browser_client.cc",
|
"libcef/browser/extensions/extensions_browser_client.cc",
|
||||||
"libcef/browser/extensions/extensions_browser_client.h",
|
"libcef/browser/extensions/extensions_browser_client.h",
|
||||||
"libcef/browser/extensions/extension_background_host.cc",
|
"libcef/browser/extensions/extension_background_host.cc",
|
||||||
@@ -403,6 +405,8 @@ static_library("libcef_static") {
|
|||||||
"libcef/browser/net/chrome_scheme_handler.h",
|
"libcef/browser/net/chrome_scheme_handler.h",
|
||||||
"libcef/browser/net/cookie_store_proxy.cc",
|
"libcef/browser/net/cookie_store_proxy.cc",
|
||||||
"libcef/browser/net/cookie_store_proxy.h",
|
"libcef/browser/net/cookie_store_proxy.h",
|
||||||
|
"libcef/browser/net/cookie_store_source.cc",
|
||||||
|
"libcef/browser/net/cookie_store_source.h",
|
||||||
"libcef/browser/net/crlset_file_util_impl.cc",
|
"libcef/browser/net/crlset_file_util_impl.cc",
|
||||||
"libcef/browser/net/devtools_scheme_handler.cc",
|
"libcef/browser/net/devtools_scheme_handler.cc",
|
||||||
"libcef/browser/net/devtools_scheme_handler.h",
|
"libcef/browser/net/devtools_scheme_handler.h",
|
||||||
@@ -520,6 +524,8 @@ static_library("libcef_static") {
|
|||||||
"libcef/common/drag_data_impl.h",
|
"libcef/common/drag_data_impl.h",
|
||||||
"libcef/common/extensions/chrome_generated_schemas.cc",
|
"libcef/common/extensions/chrome_generated_schemas.cc",
|
||||||
"libcef/common/extensions/chrome_generated_schemas.h",
|
"libcef/common/extensions/chrome_generated_schemas.h",
|
||||||
|
"libcef/common/extensions/extensions_api_provider.cc",
|
||||||
|
"libcef/common/extensions/extensions_api_provider.h",
|
||||||
"libcef/common/extensions/extensions_client.cc",
|
"libcef/common/extensions/extensions_client.cc",
|
||||||
"libcef/common/extensions/extensions_client.h",
|
"libcef/common/extensions/extensions_client.h",
|
||||||
"libcef/common/extensions/extensions_util.cc",
|
"libcef/common/extensions/extensions_util.cc",
|
||||||
@@ -635,9 +641,7 @@ static_library("libcef_static") {
|
|||||||
]
|
]
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
# Generate pack files and associated CEF header files.
|
":cef_make_headers",
|
||||||
":make_pack_header_resources",
|
|
||||||
":make_pack_header_strings",
|
|
||||||
|
|
||||||
# Generate API bindings for extensions.
|
# Generate API bindings for extensions.
|
||||||
# TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
|
# TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
|
||||||
@@ -675,6 +679,7 @@ static_library("libcef_static") {
|
|||||||
"//components/printing/browser",
|
"//components/printing/browser",
|
||||||
"//components/printing/common",
|
"//components/printing/common",
|
||||||
"//components/printing/renderer",
|
"//components/printing/renderer",
|
||||||
|
"//components/safe_browsing/db:test_database_manager",
|
||||||
"//components/services/pdf_compositor:pdf_compositor_manifest",
|
"//components/services/pdf_compositor:pdf_compositor_manifest",
|
||||||
"//components/services/pdf_compositor/public/cpp:utils",
|
"//components/services/pdf_compositor/public/cpp:utils",
|
||||||
"//components/services/pdf_compositor/public/interfaces",
|
"//components/services/pdf_compositor/public/interfaces",
|
||||||
@@ -698,9 +703,10 @@ static_library("libcef_static") {
|
|||||||
"//crypto",
|
"//crypto",
|
||||||
"//device/base",
|
"//device/base",
|
||||||
"//extensions/browser",
|
"//extensions/browser",
|
||||||
"//extensions/browser/api:api_registration",
|
"//extensions/browser:core_api_provider",
|
||||||
"//extensions/buildflags",
|
"//extensions/buildflags",
|
||||||
"//extensions/common/api",
|
"//extensions/common/api",
|
||||||
|
"//extensions/common:core_api_provider",
|
||||||
"//extensions/renderer",
|
"//extensions/renderer",
|
||||||
"//gpu",
|
"//gpu",
|
||||||
"//ipc",
|
"//ipc",
|
||||||
@@ -768,6 +774,7 @@ static_library("libcef_static") {
|
|||||||
]
|
]
|
||||||
|
|
||||||
deps += [
|
deps += [
|
||||||
|
"//chrome/install_static:secondary_module",
|
||||||
"//chrome_elf",
|
"//chrome_elf",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -799,7 +806,6 @@ static_library("libcef_static") {
|
|||||||
|
|
||||||
deps += [
|
deps += [
|
||||||
"//build/config/freetype",
|
"//build/config/freetype",
|
||||||
"//services/ui:lib",
|
|
||||||
"//third_party/fontconfig",
|
"//third_party/fontconfig",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -920,7 +926,6 @@ static_library("libcef_static") {
|
|||||||
]
|
]
|
||||||
|
|
||||||
deps += [
|
deps += [
|
||||||
"//services/ui",
|
|
||||||
"//ui/aura",
|
"//ui/aura",
|
||||||
"//ui/events",
|
"//ui/events",
|
||||||
"//ui/strings",
|
"//ui/strings",
|
||||||
@@ -1004,6 +1009,10 @@ static_library("libcef_dll_wrapper") {
|
|||||||
gypi_paths2.libcef_dll_wrapper_sources_common +
|
gypi_paths2.libcef_dll_wrapper_sources_common +
|
||||||
gypi_paths.autogen_client_side
|
gypi_paths.autogen_client_side
|
||||||
|
|
||||||
|
if (is_mac) {
|
||||||
|
sources += gypi_paths2.libcef_dll_wrapper_sources_mac
|
||||||
|
}
|
||||||
|
|
||||||
defines = [ "WRAPPING_CEF_SHARED" ]
|
defines = [ "WRAPPING_CEF_SHARED" ]
|
||||||
|
|
||||||
configs += [ ":libcef_dll_wrapper_config" ]
|
configs += [ ":libcef_dll_wrapper_config" ]
|
||||||
@@ -1024,6 +1033,15 @@ if (is_win) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_mac) {
|
||||||
|
static_library("cef_sandbox") {
|
||||||
|
sources = [ "libcef_dll/sandbox/sandbox_mac.mm" ]
|
||||||
|
# CEF sources use include paths relative to the CEF root directory.
|
||||||
|
include_dirs = [ "." ]
|
||||||
|
deps = [ "//sandbox/mac:seatbelt" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Service manifests.
|
# Service manifests.
|
||||||
@@ -1313,6 +1331,14 @@ make_pack_header("strings") {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Generate pack files and associated CEF header files.
|
||||||
|
group("cef_make_headers") {
|
||||||
|
deps = [
|
||||||
|
":make_pack_header_resources",
|
||||||
|
":make_pack_header_strings",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# libcef dll/framework target.
|
# libcef dll/framework target.
|
||||||
@@ -1463,14 +1489,9 @@ if (is_mac) {
|
|||||||
":libcef_static",
|
":libcef_static",
|
||||||
]
|
]
|
||||||
|
|
||||||
# Both the main app executable and helper executables need to link the
|
# We don't link the framework so just use the path from the main executable.
|
||||||
# framework. Because they are at different directory depths, using
|
|
||||||
# @executable_path as the install_name would require using install_name_tool
|
|
||||||
# on one of the executables. However install_name_tool only operates
|
|
||||||
# in-place, which is problematic to express in GN. Instead, use rpath-based
|
|
||||||
# loading.
|
|
||||||
ldflags = [
|
ldflags = [
|
||||||
"-Wl,-install_name,@rpath/Frameworks/$output_name.framework/$output_name",
|
"-Wl,-install_name,@executable_path/../Frameworks/$output_name.framework/$output_name",
|
||||||
"-compatibility_version",
|
"-compatibility_version",
|
||||||
cef_dylib_version,
|
cef_dylib_version,
|
||||||
"-current_version",
|
"-current_version",
|
||||||
@@ -1569,7 +1590,8 @@ if (is_mac) {
|
|||||||
sources = invoker.helper_sources
|
sources = invoker.helper_sources
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":cef_framework+link",
|
":cef_make_headers",
|
||||||
|
":cef_sandbox",
|
||||||
":libcef_dll_wrapper",
|
":libcef_dll_wrapper",
|
||||||
]
|
]
|
||||||
if (defined(invoker.helper_deps)) {
|
if (defined(invoker.helper_deps)) {
|
||||||
@@ -1578,12 +1600,16 @@ if (is_mac) {
|
|||||||
|
|
||||||
ldflags = [
|
ldflags = [
|
||||||
# The helper is in $app_name.app/Contents/Frameworks/$app_name Helper.app/Contents/MacOS/
|
# The helper is in $app_name.app/Contents/Frameworks/$app_name Helper.app/Contents/MacOS/
|
||||||
# so set rpath up to Contents/ so that the loader can find Frameworks/.
|
# so set rpath up to the base.
|
||||||
"-rpath",
|
"-rpath",
|
||||||
"@executable_path/../../../..",
|
"@executable_path/../../../../../..",
|
||||||
]
|
]
|
||||||
|
|
||||||
info_plist_target = ":${app_name}_helper_plist"
|
info_plist_target = ":${app_name}_helper_plist"
|
||||||
|
|
||||||
|
if (defined(invoker.helper_defines)) {
|
||||||
|
defines = invoker.helper_defines
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bundle_data("${app_name}_framework_bundle_data") {
|
bundle_data("${app_name}_framework_bundle_data") {
|
||||||
@@ -1594,7 +1620,7 @@ if (is_mac) {
|
|||||||
]
|
]
|
||||||
|
|
||||||
public_deps = [
|
public_deps = [
|
||||||
":cef_framework+link",
|
":cef_framework",
|
||||||
":${app_name}_helper_app",
|
":${app_name}_helper_app",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1620,6 +1646,7 @@ if (is_mac) {
|
|||||||
sources = invoker.sources
|
sources = invoker.sources
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
|
":libcef_dll_wrapper",
|
||||||
":${app_name}_framework_bundle_data",
|
":${app_name}_framework_bundle_data",
|
||||||
]
|
]
|
||||||
if (defined(invoker.deps)) {
|
if (defined(invoker.deps)) {
|
||||||
@@ -1630,12 +1657,9 @@ if (is_mac) {
|
|||||||
libs = invoker.libs
|
libs = invoker.libs
|
||||||
}
|
}
|
||||||
|
|
||||||
ldflags = [
|
if (defined(invoker.defines)) {
|
||||||
# The main app is at $app_name.app/Contents/MacOS/$app_name
|
defines = invoker.defines
|
||||||
# so set rpath up to Contents/ so that the loader can find Frameworks/.
|
}
|
||||||
"-rpath",
|
|
||||||
"@executable_path/../",
|
|
||||||
]
|
|
||||||
|
|
||||||
info_plist_target = ":${app_name}_plist"
|
info_plist_target = ":${app_name}_plist"
|
||||||
}
|
}
|
||||||
@@ -1687,19 +1711,21 @@ if (is_mac) {
|
|||||||
helper_sources = gypi_paths2.includes_mac +
|
helper_sources = gypi_paths2.includes_mac +
|
||||||
gypi_paths2.includes_common +
|
gypi_paths2.includes_common +
|
||||||
gypi_paths2.includes_wrapper +
|
gypi_paths2.includes_wrapper +
|
||||||
|
gypi_paths2.includes_wrapper_mac +
|
||||||
gypi_paths2.shared_sources_common +
|
gypi_paths2.shared_sources_common +
|
||||||
gypi_paths2.shared_sources_renderer +
|
gypi_paths2.shared_sources_renderer +
|
||||||
gypi_paths2.shared_sources_mac_helper +
|
gypi_paths2.shared_sources_mac_helper +
|
||||||
gypi_paths2.cefclient_sources_common +
|
gypi_paths2.cefclient_sources_common +
|
||||||
gypi_paths2.cefclient_sources_renderer
|
gypi_paths2.cefclient_sources_renderer
|
||||||
helper_deps = [
|
helper_defines = [
|
||||||
":libcef_dll_wrapper",
|
"CEF_USE_SANDBOX",
|
||||||
]
|
]
|
||||||
|
|
||||||
info_plist = "tests/cefclient/resources/mac/Info.plist"
|
info_plist = "tests/cefclient/resources/mac/Info.plist"
|
||||||
sources = gypi_paths2.includes_mac +
|
sources = gypi_paths2.includes_mac +
|
||||||
gypi_paths2.includes_common +
|
gypi_paths2.includes_common +
|
||||||
gypi_paths2.includes_wrapper +
|
gypi_paths2.includes_wrapper +
|
||||||
|
gypi_paths2.includes_wrapper_mac +
|
||||||
gypi_paths2.shared_sources_browser +
|
gypi_paths2.shared_sources_browser +
|
||||||
gypi_paths2.shared_sources_common +
|
gypi_paths2.shared_sources_common +
|
||||||
gypi_paths2.shared_sources_mac +
|
gypi_paths2.shared_sources_mac +
|
||||||
@@ -1711,12 +1737,14 @@ if (is_mac) {
|
|||||||
":cefclient_resources_bundle_data_extensions_set_page_color",
|
":cefclient_resources_bundle_data_extensions_set_page_color",
|
||||||
":cefclient_resources_bundle_data_english",
|
":cefclient_resources_bundle_data_english",
|
||||||
":cefclient_xibs",
|
":cefclient_xibs",
|
||||||
":libcef_dll_wrapper",
|
|
||||||
]
|
]
|
||||||
libs = [
|
libs = [
|
||||||
"AppKit.framework",
|
"AppKit.framework",
|
||||||
"OpenGL.framework",
|
"OpenGL.framework",
|
||||||
]
|
]
|
||||||
|
defines = [
|
||||||
|
"CEF_USE_SANDBOX",
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1757,22 +1785,26 @@ if (is_mac) {
|
|||||||
helper_sources = gypi_paths2.includes_mac +
|
helper_sources = gypi_paths2.includes_mac +
|
||||||
gypi_paths2.includes_common +
|
gypi_paths2.includes_common +
|
||||||
gypi_paths2.includes_wrapper +
|
gypi_paths2.includes_wrapper +
|
||||||
|
gypi_paths2.includes_wrapper_mac +
|
||||||
gypi_paths2.cefsimple_sources_mac_helper
|
gypi_paths2.cefsimple_sources_mac_helper
|
||||||
helper_deps = [
|
helper_defines = [
|
||||||
":libcef_dll_wrapper",
|
"CEF_USE_SANDBOX",
|
||||||
]
|
]
|
||||||
|
|
||||||
info_plist = "tests/cefsimple/mac/Info.plist"
|
info_plist = "tests/cefsimple/mac/Info.plist"
|
||||||
sources = gypi_paths2.includes_mac +
|
sources = gypi_paths2.includes_mac +
|
||||||
gypi_paths2.includes_common +
|
gypi_paths2.includes_common +
|
||||||
gypi_paths2.includes_wrapper +
|
gypi_paths2.includes_wrapper +
|
||||||
|
gypi_paths2.includes_wrapper_mac +
|
||||||
gypi_paths2.cefsimple_sources_common +
|
gypi_paths2.cefsimple_sources_common +
|
||||||
gypi_paths2.cefsimple_sources_mac
|
gypi_paths2.cefsimple_sources_mac
|
||||||
deps = [
|
deps = [
|
||||||
":cefsimple_resources_bundle_data",
|
":cefsimple_resources_bundle_data",
|
||||||
":cefsimple_resources_bundle_data_english",
|
":cefsimple_resources_bundle_data_english",
|
||||||
":cefsimple_xibs",
|
":cefsimple_xibs",
|
||||||
":libcef_dll_wrapper",
|
]
|
||||||
|
defines = [
|
||||||
|
"CEF_USE_SANDBOX",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1818,14 +1850,17 @@ if (is_mac) {
|
|||||||
gypi_paths2.shared_sources_mac_helper +
|
gypi_paths2.shared_sources_mac_helper +
|
||||||
gypi_paths2.ceftests_sources_mac_helper
|
gypi_paths2.ceftests_sources_mac_helper
|
||||||
helper_deps = [
|
helper_deps = [
|
||||||
":libcef_dll_wrapper",
|
|
||||||
"//testing/gtest",
|
"//testing/gtest",
|
||||||
]
|
]
|
||||||
|
helper_defines = [
|
||||||
|
"CEF_USE_SANDBOX",
|
||||||
|
]
|
||||||
|
|
||||||
info_plist = "tests/ceftests/resources/mac/Info.plist"
|
info_plist = "tests/ceftests/resources/mac/Info.plist"
|
||||||
sources = gypi_paths2.includes_mac +
|
sources = gypi_paths2.includes_mac +
|
||||||
gypi_paths2.includes_common +
|
gypi_paths2.includes_common +
|
||||||
gypi_paths2.includes_wrapper +
|
gypi_paths2.includes_wrapper +
|
||||||
|
gypi_paths2.includes_wrapper_mac +
|
||||||
gypi_paths2.shared_sources_browser +
|
gypi_paths2.shared_sources_browser +
|
||||||
gypi_paths2.shared_sources_common +
|
gypi_paths2.shared_sources_common +
|
||||||
gypi_paths2.shared_sources_mac +
|
gypi_paths2.shared_sources_mac +
|
||||||
@@ -1835,12 +1870,14 @@ if (is_mac) {
|
|||||||
":ceftests_resources_bundle_data",
|
":ceftests_resources_bundle_data",
|
||||||
":ceftests_resources_bundle_data_english",
|
":ceftests_resources_bundle_data_english",
|
||||||
":ceftests_xibs",
|
":ceftests_xibs",
|
||||||
":libcef_dll_wrapper",
|
|
||||||
"//testing/gtest",
|
"//testing/gtest",
|
||||||
]
|
]
|
||||||
libs = [
|
libs = [
|
||||||
"AppKit.framework",
|
"AppKit.framework",
|
||||||
]
|
]
|
||||||
|
defines = [
|
||||||
|
"CEF_USE_SANDBOX",
|
||||||
|
]
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#
|
#
|
||||||
@@ -1897,6 +1934,10 @@ if (is_mac) {
|
|||||||
":libcef_dll_wrapper",
|
":libcef_dll_wrapper",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
defines = [
|
||||||
|
"CEF_USE_SANDBOX",
|
||||||
|
]
|
||||||
|
|
||||||
if (is_win) {
|
if (is_win) {
|
||||||
sources += gypi_paths2.includes_win +
|
sources += gypi_paths2.includes_win +
|
||||||
gypi_paths2.shared_sources_win +
|
gypi_paths2.shared_sources_win +
|
||||||
@@ -1906,9 +1947,8 @@ if (is_mac) {
|
|||||||
configs -= [ "//build/config/win:console" ]
|
configs -= [ "//build/config/win:console" ]
|
||||||
configs += [ "//build/config/win:windowed" ]
|
configs += [ "//build/config/win:windowed" ]
|
||||||
|
|
||||||
defines = [
|
defines += [
|
||||||
"CEF_USE_ATL",
|
"CEF_USE_ATL",
|
||||||
"CEF_USE_SANDBOX",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
deps += [
|
deps += [
|
||||||
@@ -1970,6 +2010,10 @@ if (is_mac) {
|
|||||||
":libcef_dll_wrapper",
|
":libcef_dll_wrapper",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
defines = [
|
||||||
|
"CEF_USE_SANDBOX",
|
||||||
|
]
|
||||||
|
|
||||||
if (is_win) {
|
if (is_win) {
|
||||||
sources += gypi_paths2.includes_win +
|
sources += gypi_paths2.includes_win +
|
||||||
gypi_paths2.cefsimple_sources_win
|
gypi_paths2.cefsimple_sources_win
|
||||||
@@ -1978,10 +2022,6 @@ if (is_mac) {
|
|||||||
configs -= [ "//build/config/win:console" ]
|
configs -= [ "//build/config/win:console" ]
|
||||||
configs += [ "//build/config/win:windowed" ]
|
configs += [ "//build/config/win:windowed" ]
|
||||||
|
|
||||||
defines = [
|
|
||||||
"CEF_USE_SANDBOX",
|
|
||||||
]
|
|
||||||
|
|
||||||
deps += [
|
deps += [
|
||||||
":cef_sandbox",
|
":cef_sandbox",
|
||||||
"//build/win:default_exe_manifest",
|
"//build/win:default_exe_manifest",
|
||||||
@@ -2039,14 +2079,14 @@ if (is_mac) {
|
|||||||
"//testing/gtest",
|
"//testing/gtest",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
defines = [
|
||||||
|
"CEF_USE_SANDBOX",
|
||||||
|
]
|
||||||
|
|
||||||
if (is_win) {
|
if (is_win) {
|
||||||
sources += gypi_paths2.shared_sources_win +
|
sources += gypi_paths2.shared_sources_win +
|
||||||
gypi_paths2.ceftests_sources_win
|
gypi_paths2.ceftests_sources_win
|
||||||
|
|
||||||
defines = [
|
|
||||||
"CEF_USE_SANDBOX",
|
|
||||||
]
|
|
||||||
|
|
||||||
deps += [
|
deps += [
|
||||||
":cef_sandbox",
|
":cef_sandbox",
|
||||||
"//build/win:default_exe_manifest",
|
"//build/win:default_exe_manifest",
|
||||||
|
@@ -7,5 +7,5 @@
|
|||||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||||
|
|
||||||
{
|
{
|
||||||
'chromium_checkout': 'refs/tags/69.0.3497.0',
|
'chromium_checkout': 'refs/tags/70.0.3538.102',
|
||||||
}
|
}
|
||||||
|
@@ -65,6 +65,9 @@
|
|||||||
'include/wrapper/cef_xml_object.h',
|
'include/wrapper/cef_xml_object.h',
|
||||||
'include/wrapper/cef_zip_archive.h',
|
'include/wrapper/cef_zip_archive.h',
|
||||||
],
|
],
|
||||||
|
'includes_wrapper_mac': [
|
||||||
|
'include/wrapper/cef_library_loader.h',
|
||||||
|
],
|
||||||
'includes_win': [
|
'includes_win': [
|
||||||
'include/base/internal/cef_atomicops_x86_msvc.h',
|
'include/base/internal/cef_atomicops_x86_msvc.h',
|
||||||
'include/base/internal/cef_bind_internal_win.h',
|
'include/base/internal/cef_bind_internal_win.h',
|
||||||
@@ -76,6 +79,7 @@
|
|||||||
'include/base/internal/cef_atomicops_atomicword_compat.h',
|
'include/base/internal/cef_atomicops_atomicword_compat.h',
|
||||||
'include/base/internal/cef_atomicops_mac.h',
|
'include/base/internal/cef_atomicops_mac.h',
|
||||||
'include/cef_application_mac.h',
|
'include/cef_application_mac.h',
|
||||||
|
'include/cef_sandbox_mac.h',
|
||||||
'include/internal/cef_mac.h',
|
'include/internal/cef_mac.h',
|
||||||
'include/internal/cef_types_mac.h',
|
'include/internal/cef_types_mac.h',
|
||||||
],
|
],
|
||||||
@@ -141,6 +145,10 @@
|
|||||||
'libcef_dll/wrapper/libcef_dll_wrapper.cc',
|
'libcef_dll/wrapper/libcef_dll_wrapper.cc',
|
||||||
'libcef_dll/wrapper/libcef_dll_wrapper2.cc',
|
'libcef_dll/wrapper/libcef_dll_wrapper2.cc',
|
||||||
],
|
],
|
||||||
|
'libcef_dll_wrapper_sources_mac': [
|
||||||
|
'libcef_dll/wrapper/cef_library_loader_mac.mm',
|
||||||
|
'libcef_dll/wrapper/libcef_dll_dylib.cc',
|
||||||
|
],
|
||||||
'shared_sources_browser': [
|
'shared_sources_browser': [
|
||||||
'tests/shared/browser/client_app_browser.cc',
|
'tests/shared/browser/client_app_browser.cc',
|
||||||
'tests/shared/browser/client_app_browser.h',
|
'tests/shared/browser/client_app_browser.h',
|
||||||
@@ -368,6 +376,8 @@
|
|||||||
'tests/cefclient/browser/dialog_handler_gtk.cc',
|
'tests/cefclient/browser/dialog_handler_gtk.cc',
|
||||||
'tests/cefclient/browser/dialog_handler_gtk.h',
|
'tests/cefclient/browser/dialog_handler_gtk.h',
|
||||||
'tests/cefclient/browser/main_context_impl_posix.cc',
|
'tests/cefclient/browser/main_context_impl_posix.cc',
|
||||||
|
'tests/cefclient/browser/main_message_loop_multithreaded_gtk.cc',
|
||||||
|
'tests/cefclient/browser/main_message_loop_multithreaded_gtk.h',
|
||||||
'tests/cefclient/browser/print_handler_gtk.cc',
|
'tests/cefclient/browser/print_handler_gtk.cc',
|
||||||
'tests/cefclient/browser/print_handler_gtk.h',
|
'tests/cefclient/browser/print_handler_gtk.h',
|
||||||
'tests/cefclient/browser/resource_util_linux.cc',
|
'tests/cefclient/browser/resource_util_linux.cc',
|
||||||
@@ -377,6 +387,8 @@
|
|||||||
'tests/cefclient/browser/root_window_views.h',
|
'tests/cefclient/browser/root_window_views.h',
|
||||||
'tests/cefclient/browser/temp_window_x11.cc',
|
'tests/cefclient/browser/temp_window_x11.cc',
|
||||||
'tests/cefclient/browser/temp_window_x11.h',
|
'tests/cefclient/browser/temp_window_x11.h',
|
||||||
|
'tests/cefclient/browser/util_gtk.cc',
|
||||||
|
'tests/cefclient/browser/util_gtk.h',
|
||||||
'tests/cefclient/browser/views_menu_bar.cc',
|
'tests/cefclient/browser/views_menu_bar.cc',
|
||||||
'tests/cefclient/browser/views_menu_bar.h',
|
'tests/cefclient/browser/views_menu_bar.h',
|
||||||
'tests/cefclient/browser/views_style.cc',
|
'tests/cefclient/browser/views_style.cc',
|
||||||
|
@@ -31,10 +31,11 @@ macro(PRINT_CEF_CONFIG)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(OS_WINDOWS)
|
if(OS_WINDOWS)
|
||||||
message(STATUS "CEF Windows sandbox: ${USE_SANDBOX}")
|
|
||||||
message(STATUS "Visual Studio ATL support: ${USE_ATL}")
|
message(STATUS "Visual Studio ATL support: ${USE_ATL}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "CEF sandbox: ${USE_SANDBOX}")
|
||||||
|
|
||||||
set(_libraries ${CEF_STANDARD_LIBS})
|
set(_libraries ${CEF_STANDARD_LIBS})
|
||||||
if(OS_WINDOWS AND USE_SANDBOX)
|
if(OS_WINDOWS AND USE_SANDBOX)
|
||||||
list(APPEND _libraries ${CEF_SANDBOX_STANDARD_LIBS})
|
list(APPEND _libraries ${CEF_SANDBOX_STANDARD_LIBS})
|
||||||
@@ -185,22 +186,6 @@ endif(OS_LINUX)
|
|||||||
|
|
||||||
if(OS_MACOSX)
|
if(OS_MACOSX)
|
||||||
|
|
||||||
# Fix the framework rpath in the helper executable.
|
|
||||||
macro(FIX_MACOSX_HELPER_FRAMEWORK_RPATH target)
|
|
||||||
# The helper is in $app_name.app/Contents/Frameworks/$app_name Helper.app/Contents/MacOS/
|
|
||||||
# so set rpath up to Contents/ so that the loader can find Frameworks/.
|
|
||||||
set_target_properties(${target} PROPERTIES INSTALL_RPATH "@executable_path/../../../..")
|
|
||||||
set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# Fix the framework rpath in the main executable.
|
|
||||||
macro(FIX_MACOSX_MAIN_FRAMEWORK_RPATH target)
|
|
||||||
# The main app is at $app_name.app/Contents/MacOS/$app_name
|
|
||||||
# so set rpath up to Contents/ so that the loader can find Frameworks/.
|
|
||||||
set_target_properties(${target} PROPERTIES INSTALL_RPATH "@executable_path/..")
|
|
||||||
set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# Manually process and copy over resource files.
|
# Manually process and copy over resource files.
|
||||||
macro(COPY_MACOSX_RESOURCES resource_list prefix_list target source_dir app_path)
|
macro(COPY_MACOSX_RESOURCES resource_list prefix_list target source_dir app_path)
|
||||||
foreach(FILENAME ${resource_list})
|
foreach(FILENAME ${resource_list})
|
||||||
|
@@ -66,6 +66,10 @@ list(APPEND CEF_COMPILER_DEFINES
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# Configure use of the sandbox.
|
||||||
|
option(USE_SANDBOX "Enable or disable use of the sandbox." ON)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Linux configuration.
|
# Linux configuration.
|
||||||
#
|
#
|
||||||
@@ -217,6 +221,12 @@ if(OS_LINUX)
|
|||||||
icudtl.dat
|
icudtl.dat
|
||||||
locales
|
locales
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(USE_SANDBOX)
|
||||||
|
list(APPEND CEF_COMPILER_DEFINES
|
||||||
|
CEF_USE_SANDBOX # Used by apps to test if the sandbox is enabled
|
||||||
|
)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
@@ -314,9 +324,15 @@ if(OS_MACOSX)
|
|||||||
set(CEF_BINARY_DIR_DEBUG "${_CEF_ROOT}/Debug")
|
set(CEF_BINARY_DIR_DEBUG "${_CEF_ROOT}/Debug")
|
||||||
set(CEF_BINARY_DIR_RELEASE "${_CEF_ROOT}/Release")
|
set(CEF_BINARY_DIR_RELEASE "${_CEF_ROOT}/Release")
|
||||||
|
|
||||||
# CEF library paths.
|
if(USE_SANDBOX)
|
||||||
set(CEF_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/Chromium Embedded Framework.framework/Chromium Embedded Framework")
|
list(APPEND CEF_COMPILER_DEFINES
|
||||||
set(CEF_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/Chromium Embedded Framework.framework/Chromium Embedded Framework")
|
CEF_USE_SANDBOX # Used by apps to test if the sandbox is enabled
|
||||||
|
)
|
||||||
|
|
||||||
|
# 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()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
@@ -333,8 +349,6 @@ if(OS_WINDOWS)
|
|||||||
set(CMAKE_CXX_FLAGS_RELEASE "")
|
set(CMAKE_CXX_FLAGS_RELEASE "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Configure use of the sandbox.
|
|
||||||
option(USE_SANDBOX "Enable or disable use of the sandbox." ON)
|
|
||||||
if(USE_SANDBOX)
|
if(USE_SANDBOX)
|
||||||
# Check if the current MSVC version is compatible with the cef_sandbox.lib
|
# Check if the current MSVC version is compatible with the cef_sandbox.lib
|
||||||
# static library. For a list of all version numbers see
|
# static library. For a list of all version numbers see
|
||||||
@@ -346,6 +360,7 @@ if(OS_WINDOWS)
|
|||||||
1912 # VS2017 version 15.5
|
1912 # VS2017 version 15.5
|
||||||
1913 # VS2017 version 15.6
|
1913 # VS2017 version 15.6
|
||||||
1914 # VS2017 version 15.7
|
1914 # VS2017 version 15.7
|
||||||
|
1915 # VS2017 version 15.8
|
||||||
)
|
)
|
||||||
list(FIND supported_msvc_versions ${MSVC_VERSION} _index)
|
list(FIND supported_msvc_versions ${MSVC_VERSION} _index)
|
||||||
if (${_index} EQUAL -1)
|
if (${_index} EQUAL -1)
|
||||||
@@ -464,6 +479,7 @@ if(OS_WINDOWS)
|
|||||||
dbghelp.lib
|
dbghelp.lib
|
||||||
psapi.lib
|
psapi.lib
|
||||||
version.lib
|
version.lib
|
||||||
|
wbemuuid.lib
|
||||||
winmm.lib
|
winmm.lib
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -51,6 +51,7 @@
|
|||||||
#include "include/base/cef_atomic_ref_count.h"
|
#include "include/base/cef_atomic_ref_count.h"
|
||||||
#include "include/base/cef_build.h"
|
#include "include/base/cef_build.h"
|
||||||
#include "include/base/cef_logging.h"
|
#include "include/base/cef_logging.h"
|
||||||
|
#include "include/base/cef_macros.h"
|
||||||
|
|
||||||
namespace base {
|
namespace base {
|
||||||
|
|
||||||
@@ -59,6 +60,7 @@ namespace cef_subtle {
|
|||||||
class RefCountedBase {
|
class RefCountedBase {
|
||||||
public:
|
public:
|
||||||
bool HasOneRef() const { return ref_count_ == 1; }
|
bool HasOneRef() const { return ref_count_ == 1; }
|
||||||
|
bool HasAtLeastOneRef() const { return ref_count_ >= 1; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RefCountedBase()
|
RefCountedBase()
|
||||||
@@ -109,6 +111,7 @@ class RefCountedBase {
|
|||||||
class RefCountedThreadSafeBase {
|
class RefCountedThreadSafeBase {
|
||||||
public:
|
public:
|
||||||
bool HasOneRef() const;
|
bool HasOneRef() const;
|
||||||
|
bool HasAtLeastOneRef() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RefCountedThreadSafeBase();
|
RefCountedThreadSafeBase();
|
||||||
|
@@ -69,6 +69,11 @@ typedef struct _cef_base_ref_counted_t {
|
|||||||
// Returns true (1) if the current reference count is 1.
|
// Returns true (1) if the current reference count is 1.
|
||||||
///
|
///
|
||||||
int(CEF_CALLBACK* has_one_ref)(struct _cef_base_ref_counted_t* self);
|
int(CEF_CALLBACK* has_one_ref)(struct _cef_base_ref_counted_t* self);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Returns true (1) if the current reference count is at least 1.
|
||||||
|
///
|
||||||
|
int(CEF_CALLBACK* has_at_least_one_ref)(struct _cef_base_ref_counted_t* self);
|
||||||
} cef_base_ref_counted_t;
|
} cef_base_ref_counted_t;
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@@ -68,6 +68,11 @@ class CefBaseRefCounted {
|
|||||||
///
|
///
|
||||||
virtual bool HasOneRef() const = 0;
|
virtual bool HasOneRef() const = 0;
|
||||||
|
|
||||||
|
///
|
||||||
|
// Returns true if the reference count is at least 1.
|
||||||
|
///
|
||||||
|
virtual bool HasAtLeastOneRef() const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~CefBaseRefCounted() {}
|
virtual ~CefBaseRefCounted() {}
|
||||||
};
|
};
|
||||||
@@ -102,6 +107,13 @@ class CefRefCount {
|
|||||||
///
|
///
|
||||||
bool HasOneRef() const { return base::AtomicRefCountIsOne(&ref_count_); }
|
bool HasOneRef() const { return base::AtomicRefCountIsOne(&ref_count_); }
|
||||||
|
|
||||||
|
///
|
||||||
|
// Returns true if the reference count is at least 1.
|
||||||
|
///
|
||||||
|
bool HasAtLeastOneRef() const {
|
||||||
|
return !base::AtomicRefCountIsZero(&ref_count_);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable base::AtomicRefCount ref_count_;
|
mutable base::AtomicRefCount ref_count_;
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefRefCount);
|
DISALLOW_COPY_AND_ASSIGN(CefRefCount);
|
||||||
@@ -122,6 +134,9 @@ class CefRefCount {
|
|||||||
return false; \
|
return false; \
|
||||||
} \
|
} \
|
||||||
bool HasOneRef() const OVERRIDE { return ref_count_.HasOneRef(); } \
|
bool HasOneRef() const OVERRIDE { return ref_count_.HasOneRef(); } \
|
||||||
|
bool HasAtLeastOneRef() const OVERRIDE { \
|
||||||
|
return ref_count_.HasAtLeastOneRef(); \
|
||||||
|
} \
|
||||||
\
|
\
|
||||||
private: \
|
private: \
|
||||||
CefRefCount ref_count_;
|
CefRefCount ref_count_;
|
||||||
|
87
include/cef_sandbox_mac.h
Normal file
87
include/cef_sandbox_mac.h
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||||
|
// Framework nor the names of its contributors may be used to endorse
|
||||||
|
// or promote products derived from this software without specific prior
|
||||||
|
// written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
#ifndef CEF_INCLUDE_CEF_SANDBOX_MAC_H_
|
||||||
|
#define CEF_INCLUDE_CEF_SANDBOX_MAC_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "include/base/cef_build.h"
|
||||||
|
|
||||||
|
#if defined(OS_MACOSX)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// The sandbox is used to restrict sub-processes (renderer, plugin, GPU, etc)
|
||||||
|
// from directly accessing system resources. This helps to protect the user
|
||||||
|
// from untrusted and potentially malicious Web content.
|
||||||
|
// See 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.
|
||||||
|
|
||||||
|
///
|
||||||
|
// Initialize the sandbox for this process. Returns the sandbox context
|
||||||
|
// handle on success or NULL on failure. The returned handle should be
|
||||||
|
// passed to cef_sandbox_destroy() immediately before process termination.
|
||||||
|
///
|
||||||
|
void* cef_sandbox_initialize(int argc, char** argv);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Destroy the specified sandbox context handle.
|
||||||
|
///
|
||||||
|
void cef_sandbox_destroy(void* sandbox_context);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
// Scoped helper for managing the life span of a sandbox context handle.
|
||||||
|
///
|
||||||
|
class CefScopedSandboxContext {
|
||||||
|
public:
|
||||||
|
CefScopedSandboxContext();
|
||||||
|
~CefScopedSandboxContext();
|
||||||
|
|
||||||
|
// Load the sandbox for this process. Returns true on success.
|
||||||
|
bool Initialize(int argc, char** argv);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void* sandbox_context_;
|
||||||
|
};
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#endif // defined(OS_MACOSX)
|
||||||
|
|
||||||
|
#endif // CEF_INCLUDE_CEF_SANDBOX_MAC_H_
|
@@ -181,7 +181,7 @@ typedef struct _cef_settings_t {
|
|||||||
// Set to true (1) to have the browser process message loop run in a separate
|
// Set to true (1) to have the browser process message loop run in a separate
|
||||||
// thread. If false (0) than the CefDoMessageLoopWork() function must be
|
// thread. If false (0) than the CefDoMessageLoopWork() function must be
|
||||||
// called from your application message loop. This option is only supported on
|
// called from your application message loop. This option is only supported on
|
||||||
// Windows.
|
// Windows and Linux.
|
||||||
///
|
///
|
||||||
int multi_threaded_message_loop;
|
int multi_threaded_message_loop;
|
||||||
|
|
||||||
@@ -789,6 +789,11 @@ typedef enum {
|
|||||||
// Segmentation fault.
|
// Segmentation fault.
|
||||||
///
|
///
|
||||||
TS_PROCESS_CRASHED,
|
TS_PROCESS_CRASHED,
|
||||||
|
|
||||||
|
///
|
||||||
|
// Out of memory. Some platforms may use TS_PROCESS_CRASHED instead.
|
||||||
|
///
|
||||||
|
TS_PROCESS_OOM,
|
||||||
} cef_termination_status_t;
|
} cef_termination_status_t;
|
||||||
|
|
||||||
///
|
///
|
||||||
|
128
include/wrapper/cef_library_loader.h
Normal file
128
include/wrapper/cef_library_loader.h
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||||
|
// Framework nor the names of its contributors may be used to endorse
|
||||||
|
// or promote products derived from this software without specific prior
|
||||||
|
// written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
#ifndef CEF_INCLUDE_WRAPPER_CEF_LIBRARY_LOADER_H_
|
||||||
|
#define CEF_INCLUDE_WRAPPER_CEF_LIBRARY_LOADER_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "include/base/cef_build.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "include/base/cef_macros.h"
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
///
|
||||||
|
// Load the CEF library at the specified |path|. Returns true (1) on
|
||||||
|
// success and false (0) on failure.
|
||||||
|
///
|
||||||
|
int cef_load_library(const char* path);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Unload the CEF library that was previously loaded. Returns true (1)
|
||||||
|
// on success and false (0) on failure.
|
||||||
|
///
|
||||||
|
int cef_unload_library();
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(OS_MACOSX)
|
||||||
|
|
||||||
|
///
|
||||||
|
// Scoped helper for loading and unloading the CEF framework library at
|
||||||
|
// runtime from the expected location in the app bundle. Loading at runtime
|
||||||
|
// instead of linking directly is a requirement of the macOS sandbox
|
||||||
|
// implementation.
|
||||||
|
//
|
||||||
|
// Example usage in the main process:
|
||||||
|
//
|
||||||
|
// #include "include/wrapper/cef_library_loader.h"
|
||||||
|
//
|
||||||
|
// int main(int argc, char* argv[]) {
|
||||||
|
// // Dynamically load the CEF framework library.
|
||||||
|
// CefScopedLibraryLoader library_loader;
|
||||||
|
// if (!library_loader.LoadInMain())
|
||||||
|
// return 1;
|
||||||
|
//
|
||||||
|
// // Continue with CEF initialization...
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Example usage in the helper process:
|
||||||
|
//
|
||||||
|
// #include "include/cef_sandbox_mac.h"
|
||||||
|
// #include "include/wrapper/cef_library_loader.h"
|
||||||
|
//
|
||||||
|
// int main(int argc, char* argv[]) {
|
||||||
|
// // Initialize the macOS sandbox for this helper process.
|
||||||
|
// CefScopedSandboxContext sandbox_context;
|
||||||
|
// if (!sandbox_context.Initialize(argc, argv))
|
||||||
|
// return 1;
|
||||||
|
//
|
||||||
|
// // Dynamically load the CEF framework library.
|
||||||
|
// CefScopedLibraryLoader library_loader;
|
||||||
|
// if (!library_loader.LoadInHelper())
|
||||||
|
// return 1;
|
||||||
|
//
|
||||||
|
// // Continue with CEF initialization...
|
||||||
|
// }
|
||||||
|
///
|
||||||
|
class CefScopedLibraryLoader {
|
||||||
|
public:
|
||||||
|
CefScopedLibraryLoader();
|
||||||
|
~CefScopedLibraryLoader();
|
||||||
|
|
||||||
|
///
|
||||||
|
// Load the CEF framework in the main process from the expected app
|
||||||
|
// bundle location relative to the executable. Returns true if the
|
||||||
|
// load succeeds.
|
||||||
|
///
|
||||||
|
bool LoadInMain() { return Load(false); }
|
||||||
|
|
||||||
|
///
|
||||||
|
// Load the CEF framework in the helper process from the expected app
|
||||||
|
// bundle location relative to the executable. Returns true if the
|
||||||
|
// load succeeds.
|
||||||
|
///
|
||||||
|
bool LoadInHelper() { return Load(true); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool Load(bool helper);
|
||||||
|
|
||||||
|
bool loaded_;
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefScopedLibraryLoader);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // defined(OS_MACOSX)
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#endif // CEF_INCLUDE_WRAPPER_CEF_LIBRARY_LOADER_H_
|
@@ -105,6 +105,10 @@ void CefBrowserContext::Shutdown() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
base::FilePath CefBrowserContext::GetCachePath() const {
|
||||||
|
return GetPath();
|
||||||
|
}
|
||||||
|
|
||||||
content::ResourceContext* CefBrowserContext::GetResourceContext() {
|
content::ResourceContext* CefBrowserContext::GetResourceContext() {
|
||||||
return resource_context_.get();
|
return resource_context_.get();
|
||||||
}
|
}
|
||||||
|
@@ -137,6 +137,7 @@ class CefBrowserContext : public ChromeProfileStub {
|
|||||||
virtual void Initialize();
|
virtual void Initialize();
|
||||||
|
|
||||||
// BrowserContext methods.
|
// BrowserContext methods.
|
||||||
|
base::FilePath GetCachePath() const override;
|
||||||
content::ResourceContext* GetResourceContext() override;
|
content::ResourceContext* GetResourceContext() override;
|
||||||
net::URLRequestContextGetter* GetRequestContext() override;
|
net::URLRequestContextGetter* GetRequestContext() override;
|
||||||
net::URLRequestContextGetter* CreateMediaRequestContext() override;
|
net::URLRequestContextGetter* CreateMediaRequestContext() override;
|
||||||
|
@@ -519,7 +519,7 @@ HostContentSettingsMap* CefBrowserContextImpl::GetHostContentSettingsMap() {
|
|||||||
// that can be stored in the settings map (for example, default values set
|
// that can be stored in the settings map (for example, default values set
|
||||||
// via DefaultProvider::SetWebsiteSetting).
|
// via DefaultProvider::SetWebsiteSetting).
|
||||||
host_content_settings_map_ =
|
host_content_settings_map_ =
|
||||||
new HostContentSettingsMap(GetPrefs(), false, false, false);
|
new HostContentSettingsMap(GetPrefs(), false, false, false, false);
|
||||||
|
|
||||||
// Change the default plugin policy.
|
// Change the default plugin policy.
|
||||||
const base::CommandLine* command_line =
|
const base::CommandLine* command_line =
|
||||||
|
@@ -1213,6 +1213,11 @@ void CefBrowserHostImpl::SendMouseMoveEvent(const CefMouseEvent& event,
|
|||||||
void CefBrowserHostImpl::SendMouseWheelEvent(const CefMouseEvent& event,
|
void CefBrowserHostImpl::SendMouseWheelEvent(const CefMouseEvent& event,
|
||||||
int deltaX,
|
int deltaX,
|
||||||
int deltaY) {
|
int deltaY) {
|
||||||
|
if (deltaX == 0 && deltaY == 0) {
|
||||||
|
// Nothing to do.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||||
CEF_POST_TASK(CEF_UIT,
|
CEF_POST_TASK(CEF_UIT,
|
||||||
base::BindOnce(&CefBrowserHostImpl::SendMouseWheelEvent, this,
|
base::BindOnce(&CefBrowserHostImpl::SendMouseWheelEvent, this,
|
||||||
@@ -2606,7 +2611,7 @@ void CefBrowserHostImpl::RequestMediaAccessPermission(
|
|||||||
bool webcam_requested =
|
bool webcam_requested =
|
||||||
(request.video_type == content::MEDIA_DEVICE_VIDEO_CAPTURE);
|
(request.video_type == content::MEDIA_DEVICE_VIDEO_CAPTURE);
|
||||||
bool screen_requested =
|
bool screen_requested =
|
||||||
(request.video_type == content::MEDIA_DESKTOP_VIDEO_CAPTURE);
|
(request.video_type == content::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE);
|
||||||
if (microphone_requested || webcam_requested || screen_requested) {
|
if (microphone_requested || webcam_requested || screen_requested) {
|
||||||
// Pick the desired device or fall back to the first available of the
|
// Pick the desired device or fall back to the first available of the
|
||||||
// given type.
|
// given type.
|
||||||
@@ -2628,8 +2633,9 @@ void CefBrowserHostImpl::RequestMediaAccessPermission(
|
|||||||
media_id =
|
media_id =
|
||||||
content::DesktopMediaID::Parse(request.requested_video_device_id);
|
content::DesktopMediaID::Parse(request.requested_video_device_id);
|
||||||
}
|
}
|
||||||
devices.push_back(content::MediaStreamDevice(
|
devices.push_back(
|
||||||
content::MEDIA_DESKTOP_VIDEO_CAPTURE, media_id.ToString(), "Screen"));
|
content::MediaStreamDevice(content::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE,
|
||||||
|
media_id.ToString(), "Screen"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2780,6 +2786,8 @@ void CefBrowserHostImpl::RenderProcessGone(base::TerminationStatus status) {
|
|||||||
ts = TS_PROCESS_WAS_KILLED;
|
ts = TS_PROCESS_WAS_KILLED;
|
||||||
else if (status == base::TERMINATION_STATUS_PROCESS_CRASHED)
|
else if (status == base::TERMINATION_STATUS_PROCESS_CRASHED)
|
||||||
ts = TS_PROCESS_CRASHED;
|
ts = TS_PROCESS_CRASHED;
|
||||||
|
else if (status == base::TERMINATION_STATUS_OOM)
|
||||||
|
ts = TS_PROCESS_OOM;
|
||||||
else if (status != base::TERMINATION_STATUS_ABNORMAL_TERMINATION)
|
else if (status != base::TERMINATION_STATUS_ABNORMAL_TERMINATION)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@@ -749,7 +749,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||||||
CefDevToolsFrontend* devtools_frontend_;
|
CefDevToolsFrontend* devtools_frontend_;
|
||||||
|
|
||||||
// Observers that want to be notified of changes to this object.
|
// Observers that want to be notified of changes to this object.
|
||||||
base::ObserverList<Observer> observers_;
|
base::ObserverList<Observer>::Unchecked observers_;
|
||||||
|
|
||||||
// Used to provide unique incremental IDs for each find request.
|
// Used to provide unique incremental IDs for each find request.
|
||||||
int find_request_id_counter_ = 0;
|
int find_request_id_counter_ = 0;
|
||||||
|
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#include "libcef/browser/browser_context_impl.h"
|
#include "libcef/browser/browser_context_impl.h"
|
||||||
#include "libcef/browser/browser_context_keyed_service_factories.h"
|
#include "libcef/browser/browser_context_keyed_service_factories.h"
|
||||||
#include "libcef/browser/browser_message_loop.h"
|
|
||||||
#include "libcef/browser/content_browser_client.h"
|
#include "libcef/browser/content_browser_client.h"
|
||||||
#include "libcef/browser/context.h"
|
#include "libcef/browser/context.h"
|
||||||
#include "libcef/browser/devtools_manager_delegate.h"
|
#include "libcef/browser/devtools_manager_delegate.h"
|
||||||
@@ -26,7 +25,7 @@
|
|||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/message_loop/message_loop.h"
|
#include "base/message_loop/message_loop.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
#include "base/strings/string_number_conversions.h"
|
||||||
#include "base/task_scheduler/post_task.h"
|
#include "base/task/post_task.h"
|
||||||
#include "chrome/browser/chrome_browser_main_extra_parts.h"
|
#include "chrome/browser/chrome_browser_main_extra_parts.h"
|
||||||
#include "chrome/browser/plugins/plugin_finder.h"
|
#include "chrome/browser/plugins/plugin_finder.h"
|
||||||
#include "content/public/browser/gpu_data_manager.h"
|
#include "content/public/browser/gpu_data_manager.h"
|
||||||
@@ -34,6 +33,7 @@
|
|||||||
#include "extensions/common/constants.h"
|
#include "extensions/common/constants.h"
|
||||||
#include "net/base/net_module.h"
|
#include "net/base/net_module.h"
|
||||||
#include "services/service_manager/embedder/result_codes.h"
|
#include "services/service_manager/embedder/result_codes.h"
|
||||||
|
#include "ui/base/material_design/material_design_controller.h"
|
||||||
#include "ui/base/resource/resource_bundle.h"
|
#include "ui/base/resource/resource_bundle.h"
|
||||||
|
|
||||||
#if defined(USE_AURA)
|
#if defined(USE_AURA)
|
||||||
@@ -107,11 +107,6 @@ void CefBrowserMainParts::ToolkitInitialized() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserMainParts::PreMainMessageLoopStart() {
|
void CefBrowserMainParts::PreMainMessageLoopStart() {
|
||||||
if (!base::MessageLoop::current()) {
|
|
||||||
// Create the browser message loop.
|
|
||||||
message_loop_.reset(new CefBrowserMessageLoop());
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
|
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
|
||||||
chrome_extra_parts_[i]->PreMainMessageLoopStart();
|
chrome_extra_parts_[i]->PreMainMessageLoopStart();
|
||||||
}
|
}
|
||||||
@@ -156,6 +151,8 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
|
|||||||
display::Screen::SetScreenInstance(views::CreateDesktopScreen());
|
display::Screen::SetScreenInstance(views::CreateDesktopScreen());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
ui::MaterialDesignController::Initialize();
|
||||||
|
|
||||||
// CEF's profile is a BrowserContext.
|
// CEF's profile is a BrowserContext.
|
||||||
PreProfileInit();
|
PreProfileInit();
|
||||||
|
|
||||||
@@ -178,7 +175,7 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
|
|||||||
printing::CefPrintingMessageFilter::EnsureShutdownNotifierFactoryBuilt();
|
printing::CefPrintingMessageFilter::EnsureShutdownNotifierFactoryBuilt();
|
||||||
|
|
||||||
background_task_runner_ = base::CreateSingleThreadTaskRunnerWithTraits(
|
background_task_runner_ = base::CreateSingleThreadTaskRunnerWithTraits(
|
||||||
{base::TaskPriority::BACKGROUND,
|
{base::TaskPriority::BEST_EFFORT,
|
||||||
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
||||||
user_visible_task_runner_ = base::CreateSingleThreadTaskRunnerWithTraits(
|
user_visible_task_runner_ = base::CreateSingleThreadTaskRunnerWithTraits(
|
||||||
{base::TaskPriority::USER_VISIBLE,
|
{base::TaskPriority::USER_VISIBLE,
|
||||||
@@ -222,16 +219,16 @@ void CefBrowserMainParts::PostMainMessageLoopRun() {
|
|||||||
DCHECK(global_request_context_->HasOneRef());
|
DCHECK(global_request_context_->HasOneRef());
|
||||||
global_request_context_ = NULL;
|
global_request_context_ = NULL;
|
||||||
|
|
||||||
if (extensions::ExtensionsEnabled()) {
|
|
||||||
extensions::ExtensionsBrowserClient::Set(NULL);
|
|
||||||
extensions_browser_client_.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
|
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
|
||||||
chrome_extra_parts_[i]->PostMainMessageLoopRun();
|
chrome_extra_parts_[i]->PostMainMessageLoopRun();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserMainParts::PostDestroyThreads() {
|
void CefBrowserMainParts::PostDestroyThreads() {
|
||||||
|
if (extensions::ExtensionsEnabled()) {
|
||||||
|
extensions::ExtensionsBrowserClient::Set(NULL);
|
||||||
|
extensions_browser_client_.reset();
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(USE_AURA)
|
#if defined(USE_AURA)
|
||||||
// Delete the DesktopTestViewsDelegate.
|
// Delete the DesktopTestViewsDelegate.
|
||||||
delete views::ViewsDelegate::GetInstance();
|
delete views::ViewsDelegate::GetInstance();
|
||||||
|
@@ -16,11 +16,6 @@
|
|||||||
#include "content/public/browser/browser_main_parts.h"
|
#include "content/public/browser/browser_main_parts.h"
|
||||||
#include "net/url_request/url_request_context_getter.h"
|
#include "net/url_request/url_request_context_getter.h"
|
||||||
|
|
||||||
namespace base {
|
|
||||||
class MessageLoop;
|
|
||||||
class Thread;
|
|
||||||
} // namespace base
|
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
struct MainFunctionParams;
|
struct MainFunctionParams;
|
||||||
}
|
}
|
||||||
@@ -89,7 +84,6 @@ class CefBrowserMainParts : public content::BrowserMainParts {
|
|||||||
|
|
||||||
CefRefPtr<CefRequestContextImpl> global_request_context_;
|
CefRefPtr<CefRequestContextImpl> global_request_context_;
|
||||||
CefDevToolsDelegate* devtools_delegate_; // Deletes itself.
|
CefDevToolsDelegate* devtools_delegate_; // Deletes itself.
|
||||||
std::unique_ptr<base::MessageLoop> message_loop_;
|
|
||||||
|
|
||||||
std::unique_ptr<extensions::ExtensionsClient> extensions_client_;
|
std::unique_ptr<extensions::ExtensionsClient> extensions_client_;
|
||||||
std::unique_ptr<extensions::ExtensionsBrowserClient>
|
std::unique_ptr<extensions::ExtensionsBrowserClient>
|
||||||
|
@@ -62,26 +62,26 @@ class CefURLFetcherResponseWriter : public net::URLFetcherResponseWriter {
|
|||||||
: url_request_(url_request), task_runner_(task_runner) {}
|
: url_request_(url_request), task_runner_(task_runner) {}
|
||||||
|
|
||||||
// net::URLFetcherResponseWriter methods.
|
// net::URLFetcherResponseWriter methods.
|
||||||
int Initialize(const net::CompletionCallback& callback) override {
|
int Initialize(net::CompletionOnceCallback callback) override {
|
||||||
return net::OK;
|
return net::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Write(net::IOBuffer* buffer,
|
int Write(net::IOBuffer* buffer,
|
||||||
int num_bytes,
|
int num_bytes,
|
||||||
const net::CompletionCallback& callback) override {
|
net::CompletionOnceCallback callback) override {
|
||||||
if (url_request_.get()) {
|
if (url_request_.get()) {
|
||||||
task_runner_->PostTask(
|
task_runner_->PostTask(
|
||||||
FROM_HERE,
|
FROM_HERE,
|
||||||
base::Bind(&CefURLFetcherResponseWriter::WriteOnClientThread,
|
base::Bind(&CefURLFetcherResponseWriter::WriteOnClientThread,
|
||||||
url_request_, scoped_refptr<net::IOBuffer>(buffer),
|
url_request_, scoped_refptr<net::IOBuffer>(buffer),
|
||||||
num_bytes, callback,
|
num_bytes, base::Passed(std::move(callback)),
|
||||||
CefTaskRunnerImpl::GetCurrentTaskRunner()));
|
CefTaskRunnerImpl::GetCurrentTaskRunner()));
|
||||||
return net::ERR_IO_PENDING;
|
return net::ERR_IO_PENDING;
|
||||||
}
|
}
|
||||||
return num_bytes;
|
return num_bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Finish(int net_error, const net::CompletionCallback& callback) override {
|
int Finish(int net_error, net::CompletionOnceCallback callback) override {
|
||||||
if (url_request_.get())
|
if (url_request_.get())
|
||||||
url_request_ = NULL;
|
url_request_ = NULL;
|
||||||
return net::OK;
|
return net::OK;
|
||||||
@@ -92,7 +92,7 @@ class CefURLFetcherResponseWriter : public net::URLFetcherResponseWriter {
|
|||||||
CefRefPtr<CefBrowserURLRequest> url_request,
|
CefRefPtr<CefBrowserURLRequest> url_request,
|
||||||
scoped_refptr<net::IOBuffer> buffer,
|
scoped_refptr<net::IOBuffer> buffer,
|
||||||
int num_bytes,
|
int num_bytes,
|
||||||
const net::CompletionCallback& callback,
|
net::CompletionOnceCallback callback,
|
||||||
scoped_refptr<base::SequencedTaskRunner> source_message_loop_proxy) {
|
scoped_refptr<base::SequencedTaskRunner> source_message_loop_proxy) {
|
||||||
CefRefPtr<CefURLRequestClient> client = url_request->GetClient();
|
CefRefPtr<CefURLRequestClient> client = url_request->GetClient();
|
||||||
if (client.get())
|
if (client.get())
|
||||||
@@ -101,12 +101,12 @@ class CefURLFetcherResponseWriter : public net::URLFetcherResponseWriter {
|
|||||||
source_message_loop_proxy->PostTask(
|
source_message_loop_proxy->PostTask(
|
||||||
FROM_HERE,
|
FROM_HERE,
|
||||||
base::Bind(&CefURLFetcherResponseWriter::ContinueOnSourceThread,
|
base::Bind(&CefURLFetcherResponseWriter::ContinueOnSourceThread,
|
||||||
num_bytes, callback));
|
num_bytes, base::Passed(std::move(callback))));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ContinueOnSourceThread(int num_bytes,
|
static void ContinueOnSourceThread(int num_bytes,
|
||||||
const net::CompletionCallback& callback) {
|
net::CompletionOnceCallback callback) {
|
||||||
callback.Run(num_bytes);
|
std::move(callback).Run(num_bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
CefRefPtr<CefBrowserURLRequest> url_request_;
|
CefRefPtr<CefBrowserURLRequest> url_request_;
|
||||||
|
@@ -111,12 +111,6 @@ ChromeBrowserProcessStub::system_network_context_manager() {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
content::NetworkConnectionTracker*
|
|
||||||
ChromeBrowserProcessStub::network_connection_tracker() {
|
|
||||||
NOTREACHED();
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
network::NetworkQualityTracker*
|
network::NetworkQualityTracker*
|
||||||
ChromeBrowserProcessStub::network_quality_tracker() {
|
ChromeBrowserProcessStub::network_quality_tracker() {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
|
@@ -49,7 +49,6 @@ class ChromeBrowserProcessStub : public BrowserProcess,
|
|||||||
rappor::RapporServiceImpl* rappor_service() override;
|
rappor::RapporServiceImpl* rappor_service() override;
|
||||||
IOThread* io_thread() override;
|
IOThread* io_thread() override;
|
||||||
SystemNetworkContextManager* system_network_context_manager() override;
|
SystemNetworkContextManager* system_network_context_manager() override;
|
||||||
content::NetworkConnectionTracker* network_connection_tracker() override;
|
|
||||||
network::NetworkQualityTracker* network_quality_tracker() override;
|
network::NetworkQualityTracker* network_quality_tracker() override;
|
||||||
WatchDogThread* watchdog_thread() override;
|
WatchDogThread* watchdog_thread() override;
|
||||||
ProfileManager* profile_manager() override;
|
ProfileManager* profile_manager() override;
|
||||||
|
@@ -53,7 +53,6 @@ bool ChromeProfileStub::IsChild() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ChromeProfileStub::IsLegacySupervised() const {
|
bool ChromeProfileStub::IsLegacySupervised() const {
|
||||||
NOTREACHED();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -772,6 +772,17 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CefContentBrowserClient::ShouldEnableStrictSiteIsolation() {
|
||||||
|
// TODO(cef): Enable this mode once we figure out why it breaks ceftests that
|
||||||
|
// rely on command-line arguments passed to the renderer process. It looks
|
||||||
|
// like the first renderer process is getting all of the callbacks despite
|
||||||
|
// multiple renderer processes being launched.
|
||||||
|
// For example, V8RendererTest::OnBrowserCreated appears to get the same
|
||||||
|
// kV8TestCmdArg value twice when running with:
|
||||||
|
// --gtest_filter=V8Test.ContextEvalCspBypassUnsafeEval:V8Test.ContextEntered
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::string CefContentBrowserClient::GetApplicationLocale() {
|
std::string CefContentBrowserClient::GetApplicationLocale() {
|
||||||
return g_browser_process->GetApplicationLocale();
|
return g_browser_process->GetApplicationLocale();
|
||||||
}
|
}
|
||||||
@@ -786,8 +797,8 @@ void CefContentBrowserClient::GetQuotaSettings(
|
|||||||
content::StoragePartition* partition,
|
content::StoragePartition* partition,
|
||||||
storage::OptionalQuotaSettingsCallback callback) {
|
storage::OptionalQuotaSettingsCallback callback) {
|
||||||
const base::FilePath& cache_path = partition->GetPath();
|
const base::FilePath& cache_path = partition->GetPath();
|
||||||
storage::GetNominalDynamicSettings(cache_path, !cache_path.empty(),
|
storage::GetNominalDynamicSettings(
|
||||||
std::move(callback));
|
cache_path, cache_path.empty() /* is_incognito */, std::move(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
content::MediaObserver* CefContentBrowserClient::GetMediaObserver() {
|
content::MediaObserver* CefContentBrowserClient::GetMediaObserver() {
|
||||||
@@ -1074,6 +1085,7 @@ bool CefContentBrowserClient::WillCreateURLLoaderFactory(
|
|||||||
content::BrowserContext* browser_context,
|
content::BrowserContext* browser_context,
|
||||||
content::RenderFrameHost* frame,
|
content::RenderFrameHost* frame,
|
||||||
bool is_navigation,
|
bool is_navigation,
|
||||||
|
const GURL& url,
|
||||||
network::mojom::URLLoaderFactoryRequest* factory_request) {
|
network::mojom::URLLoaderFactoryRequest* factory_request) {
|
||||||
if (!extensions::ExtensionsEnabled())
|
if (!extensions::ExtensionsEnabled())
|
||||||
return false;
|
return false;
|
||||||
|
@@ -62,6 +62,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
|||||||
content::BrowserContext* context2) override;
|
content::BrowserContext* context2) override;
|
||||||
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
|
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
|
||||||
int child_process_id) override;
|
int child_process_id) override;
|
||||||
|
bool ShouldEnableStrictSiteIsolation() override;
|
||||||
std::string GetApplicationLocale() override;
|
std::string GetApplicationLocale() override;
|
||||||
content::QuotaPermissionContext* CreateQuotaPermissionContext() override;
|
content::QuotaPermissionContext* CreateQuotaPermissionContext() override;
|
||||||
void GetQuotaSettings(
|
void GetQuotaSettings(
|
||||||
@@ -141,6 +142,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
|||||||
content::BrowserContext* browser_context,
|
content::BrowserContext* browser_context,
|
||||||
content::RenderFrameHost* frame,
|
content::RenderFrameHost* frame,
|
||||||
bool is_navigation,
|
bool is_navigation,
|
||||||
|
const GURL& url,
|
||||||
network::mojom::URLLoaderFactoryRequest* factory_request) override;
|
network::mojom::URLLoaderFactoryRequest* factory_request) override;
|
||||||
|
|
||||||
bool HandleExternalProtocol(
|
bool HandleExternalProtocol(
|
||||||
|
@@ -29,10 +29,12 @@
|
|||||||
#include "content/public/browser/render_process_host.h"
|
#include "content/public/browser/render_process_host.h"
|
||||||
#include "content/public/common/content_switches.h"
|
#include "content/public/common/content_switches.h"
|
||||||
#include "services/service_manager/embedder/main.h"
|
#include "services/service_manager/embedder/main.h"
|
||||||
|
#include "ui/base/resource/resource_bundle.h"
|
||||||
#include "ui/base/ui_base_switches.h"
|
#include "ui/base/ui_base_switches.h"
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
|
#include "chrome/install_static/initialize_from_primary_module.h"
|
||||||
#include "chrome_elf/chrome_elf_main.h"
|
#include "chrome_elf/chrome_elf_main.h"
|
||||||
#include "components/crash/content/app/crashpad.h"
|
#include "components/crash/content/app/crashpad.h"
|
||||||
#include "content/public/app/sandbox_helper_win.h"
|
#include "content/public/app/sandbox_helper_win.h"
|
||||||
@@ -71,6 +73,16 @@ void DisableFMA3() {
|
|||||||
}
|
}
|
||||||
#endif // defined(ARCH_CPU_X86_64)
|
#endif // defined(ARCH_CPU_X86_64)
|
||||||
|
|
||||||
|
// Transfer state from chrome_elf.dll to the libcef.dll. Accessed when
|
||||||
|
// loading chrome://system.
|
||||||
|
void InitInstallDetails() {
|
||||||
|
static bool initialized = false;
|
||||||
|
if (initialized)
|
||||||
|
return;
|
||||||
|
initialized = true;
|
||||||
|
install_static::InitializeFromPrimaryModule();
|
||||||
|
}
|
||||||
|
|
||||||
// Signal chrome_elf to initialize crash reporting, rather than doing it in
|
// Signal chrome_elf to initialize crash reporting, rather than doing it in
|
||||||
// DllMain. See https://crbug.com/656800 for details.
|
// DllMain. See https://crbug.com/656800 for details.
|
||||||
void InitCrashReporter() {
|
void InitCrashReporter() {
|
||||||
@@ -156,6 +168,7 @@ int CefExecuteProcess(const CefMainArgs& args,
|
|||||||
#if defined(ARCH_CPU_X86_64)
|
#if defined(ARCH_CPU_X86_64)
|
||||||
DisableFMA3();
|
DisableFMA3();
|
||||||
#endif
|
#endif
|
||||||
|
InitInstallDetails();
|
||||||
InitCrashReporter();
|
InitCrashReporter();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -215,6 +228,7 @@ bool CefInitialize(const CefMainArgs& args,
|
|||||||
#if defined(ARCH_CPU_X86_64)
|
#if defined(ARCH_CPU_X86_64)
|
||||||
DisableFMA3();
|
DisableFMA3();
|
||||||
#endif
|
#endif
|
||||||
|
InitInstallDetails();
|
||||||
InitCrashReporter();
|
InitCrashReporter();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -343,7 +357,7 @@ bool CefContext::Initialize(const CefMainArgs& args,
|
|||||||
init_thread_id_ = base::PlatformThread::CurrentId();
|
init_thread_id_ = base::PlatformThread::CurrentId();
|
||||||
settings_ = settings;
|
settings_ = settings;
|
||||||
|
|
||||||
#if !defined(OS_WIN)
|
#if !(defined(OS_WIN) || defined(OS_LINUX))
|
||||||
if (settings.multi_threaded_message_loop) {
|
if (settings.multi_threaded_message_loop) {
|
||||||
NOTIMPLEMENTED() << "multi_threaded_message_loop is not supported.";
|
NOTIMPLEMENTED() << "multi_threaded_message_loop is not supported.";
|
||||||
return false;
|
return false;
|
||||||
@@ -526,6 +540,8 @@ void CefContext::FinishShutdownOnUIThread(
|
|||||||
|
|
||||||
static_cast<ChromeBrowserProcessStub*>(g_browser_process)->Shutdown();
|
static_cast<ChromeBrowserProcessStub*>(g_browser_process)->Shutdown();
|
||||||
|
|
||||||
|
ui::ResourceBundle::GetSharedInstance().CleanupOnUIThread();
|
||||||
|
|
||||||
if (uithread_shutdown_event)
|
if (uithread_shutdown_event)
|
||||||
uithread_shutdown_event->Signal();
|
uithread_shutdown_event->Signal();
|
||||||
}
|
}
|
||||||
|
@@ -10,19 +10,20 @@
|
|||||||
|
|
||||||
#include "libcef/browser/content_browser_client.h"
|
#include "libcef/browser/content_browser_client.h"
|
||||||
#include "libcef/browser/context.h"
|
#include "libcef/browser/context.h"
|
||||||
|
#include "libcef/browser/net/cookie_store_source.h"
|
||||||
#include "libcef/browser/net/network_delegate.h"
|
#include "libcef/browser/net/network_delegate.h"
|
||||||
#include "libcef/common/task_runner_impl.h"
|
#include "libcef/common/task_runner_impl.h"
|
||||||
#include "libcef/common/time_util.h"
|
#include "libcef/common/time_util.h"
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/files/file_util.h"
|
|
||||||
#include "base/format_macros.h"
|
#include "base/format_macros.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/threading/thread_restrictions.h"
|
#include "base/threading/thread_restrictions.h"
|
||||||
|
#include "chrome/browser/browser_process.h"
|
||||||
|
#include "components/net_log/chrome_net_log.h"
|
||||||
#include "content/browser/storage_partition_impl.h"
|
#include "content/browser/storage_partition_impl.h"
|
||||||
#include "net/cookies/cookie_util.h"
|
#include "net/cookies/cookie_util.h"
|
||||||
#include "net/cookies/parsed_cookie.h"
|
#include "net/cookies/parsed_cookie.h"
|
||||||
#include "net/extras/sqlite/sqlite_persistent_cookie_store.h"
|
|
||||||
#include "net/url_request/url_request_context.h"
|
#include "net/url_request/url_request_context.h"
|
||||||
#include "url/gurl.h"
|
#include "url/gurl.h"
|
||||||
|
|
||||||
@@ -162,7 +163,7 @@ void CefCookieManagerImpl::GetCookieStore(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DCHECK(is_blocking_ || cookie_store_.get());
|
DCHECK(is_blocking_ || cookie_source_);
|
||||||
|
|
||||||
// Binding ref-counted |this| to CookieStoreGetter may result in
|
// Binding ref-counted |this| to CookieStoreGetter may result in
|
||||||
// heap-use-after-free if (a) the CookieStoreGetter contains the last
|
// heap-use-after-free if (a) the CookieStoreGetter contains the last
|
||||||
@@ -185,8 +186,8 @@ void CefCookieManagerImpl::GetCookieStore(
|
|||||||
|
|
||||||
net::CookieStore* CefCookieManagerImpl::GetExistingCookieStore() {
|
net::CookieStore* CefCookieManagerImpl::GetExistingCookieStore() {
|
||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
if (cookie_store_.get()) {
|
if (cookie_source_) {
|
||||||
return cookie_store_.get();
|
return cookie_source_->GetCookieStore();
|
||||||
} else if (request_context_impl_.get()) {
|
} else if (request_context_impl_.get()) {
|
||||||
net::CookieStore* cookie_store =
|
net::CookieStore* cookie_store =
|
||||||
request_context_impl_->GetExistingCookieStore();
|
request_context_impl_->GetExistingCookieStore();
|
||||||
@@ -287,44 +288,14 @@ bool CefCookieManagerImpl::SetStoragePath(
|
|||||||
if (!path.empty())
|
if (!path.empty())
|
||||||
new_path = base::FilePath(path);
|
new_path = base::FilePath(path);
|
||||||
|
|
||||||
if (cookie_store_.get() &&
|
if (!cookie_source_) {
|
||||||
((storage_path_.empty() && path.empty()) || storage_path_ == new_path)) {
|
cookie_source_.reset(new CefCookieStoreOwnerSource());
|
||||||
// The path has not changed so don't do anything.
|
|
||||||
RunAsyncCompletionOnIOThread(callback);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_refptr<net::SQLitePersistentCookieStore> persistent_store;
|
cookie_source_->SetCookieStoragePath(new_path, persist_session_cookies,
|
||||||
if (!new_path.empty()) {
|
g_browser_process->net_log());
|
||||||
// TODO(cef): Move directory creation to the blocking pool instead of
|
|
||||||
// allowing file IO on this thread.
|
|
||||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
|
||||||
if (base::DirectoryExists(new_path) || base::CreateDirectory(new_path)) {
|
|
||||||
const base::FilePath& cookie_path = new_path.AppendASCII("Cookies");
|
|
||||||
persistent_store = new net::SQLitePersistentCookieStore(
|
|
||||||
cookie_path, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
|
|
||||||
// Intentionally using the background task runner exposed by CEF to
|
|
||||||
// facilitate unit test expectations. This task runner MUST be
|
|
||||||
// configured with BLOCK_SHUTDOWN.
|
|
||||||
CefContentBrowserClient::Get()->background_task_runner(),
|
|
||||||
persist_session_cookies, NULL);
|
|
||||||
} else {
|
|
||||||
NOTREACHED() << "The cookie storage directory could not be created";
|
|
||||||
storage_path_.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the new cookie store that will be used for all new requests. The old
|
|
||||||
// cookie store, if any, will be automatically flushed and closed when no
|
|
||||||
// longer referenced.
|
|
||||||
cookie_store_.reset(new net::CookieMonster(persistent_store.get(), NULL));
|
|
||||||
if (persistent_store.get() && persist_session_cookies)
|
|
||||||
cookie_store_->SetPersistSessionCookies(true);
|
|
||||||
storage_path_ = new_path;
|
|
||||||
|
|
||||||
// Restore the previously supported schemes.
|
|
||||||
SetSupportedSchemesInternal(supported_schemes_, callback);
|
|
||||||
|
|
||||||
|
RunAsyncCompletionOnIOThread(callback);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -502,10 +473,9 @@ void CefCookieManagerImpl::SetSupportedSchemesInternal(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DCHECK(is_blocking_ || cookie_store_.get());
|
DCHECK(is_blocking_ || cookie_source_);
|
||||||
if (cookie_store_) {
|
if (cookie_source_) {
|
||||||
supported_schemes_ = schemes;
|
cookie_source_->SetCookieSupportedSchemes(schemes);
|
||||||
SetCookieMonsterSchemes(cookie_store_.get(), supported_schemes_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RunAsyncCompletionOnIOThread(callback);
|
RunAsyncCompletionOnIOThread(callback);
|
||||||
|
@@ -15,6 +15,8 @@
|
|||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
#include "net/cookies/cookie_monster.h"
|
#include "net/cookies/cookie_monster.h"
|
||||||
|
|
||||||
|
class CefCookieStoreOwnerSource;
|
||||||
|
|
||||||
// Implementation of the CefCookieManager interface.
|
// Implementation of the CefCookieManager interface.
|
||||||
class CefCookieManagerImpl : public CefCookieManager {
|
class CefCookieManagerImpl : public CefCookieManager {
|
||||||
public:
|
public:
|
||||||
@@ -122,9 +124,7 @@ class CefCookieManagerImpl : public CefCookieManager {
|
|||||||
scoped_refptr<CefURLRequestContextGetterImpl> request_context_impl_;
|
scoped_refptr<CefURLRequestContextGetterImpl> request_context_impl_;
|
||||||
|
|
||||||
// Used for cookie monsters owned by this object.
|
// Used for cookie monsters owned by this object.
|
||||||
base::FilePath storage_path_;
|
std::unique_ptr<CefCookieStoreOwnerSource> cookie_source_;
|
||||||
std::vector<std::string> supported_schemes_;
|
|
||||||
std::unique_ptr<net::CookieMonster> cookie_store_;
|
|
||||||
|
|
||||||
// Must be the last member.
|
// Must be the last member.
|
||||||
base::WeakPtrFactory<CefCookieManagerImpl> weak_ptr_factory_;
|
base::WeakPtrFactory<CefCookieManagerImpl> weak_ptr_factory_;
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
#include "content/public/common/content_client.h"
|
#include "content/public/common/content_client.h"
|
||||||
#include "content/public/common/url_constants.h"
|
#include "content/public/common/url_constants.h"
|
||||||
#include "ipc/ipc_channel.h"
|
#include "ipc/ipc_channel.h"
|
||||||
|
#include "net/base/completion_once_callback.h"
|
||||||
#include "net/base/io_buffer.h"
|
#include "net/base/io_buffer.h"
|
||||||
#include "net/base/net_errors.h"
|
#include "net/base/net_errors.h"
|
||||||
#include "net/http/http_response_headers.h"
|
#include "net/http/http_response_headers.h"
|
||||||
@@ -52,11 +53,11 @@ class ResponseWriter : public net::URLFetcherResponseWriter {
|
|||||||
~ResponseWriter() override;
|
~ResponseWriter() override;
|
||||||
|
|
||||||
// URLFetcherResponseWriter overrides:
|
// URLFetcherResponseWriter overrides:
|
||||||
int Initialize(const net::CompletionCallback& callback) override;
|
int Initialize(net::CompletionOnceCallback callback) override;
|
||||||
int Write(net::IOBuffer* buffer,
|
int Write(net::IOBuffer* buffer,
|
||||||
int num_bytes,
|
int num_bytes,
|
||||||
const net::CompletionCallback& callback) override;
|
net::CompletionOnceCallback callback) override;
|
||||||
int Finish(int net_error, const net::CompletionCallback& callback) override;
|
int Finish(int net_error, net::CompletionOnceCallback callback) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
base::WeakPtr<CefDevToolsFrontend> shell_devtools_;
|
base::WeakPtr<CefDevToolsFrontend> shell_devtools_;
|
||||||
@@ -72,13 +73,13 @@ ResponseWriter::ResponseWriter(
|
|||||||
|
|
||||||
ResponseWriter::~ResponseWriter() {}
|
ResponseWriter::~ResponseWriter() {}
|
||||||
|
|
||||||
int ResponseWriter::Initialize(const net::CompletionCallback& callback) {
|
int ResponseWriter::Initialize(net::CompletionOnceCallback callback) {
|
||||||
return net::OK;
|
return net::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ResponseWriter::Write(net::IOBuffer* buffer,
|
int ResponseWriter::Write(net::IOBuffer* buffer,
|
||||||
int num_bytes,
|
int num_bytes,
|
||||||
const net::CompletionCallback& callback) {
|
net::CompletionOnceCallback callback) {
|
||||||
std::string chunk = std::string(buffer->data(), num_bytes);
|
std::string chunk = std::string(buffer->data(), num_bytes);
|
||||||
if (!base::IsStringUTF8(chunk))
|
if (!base::IsStringUTF8(chunk))
|
||||||
return num_bytes;
|
return num_bytes;
|
||||||
@@ -95,7 +96,7 @@ int ResponseWriter::Write(net::IOBuffer* buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ResponseWriter::Finish(int net_error,
|
int ResponseWriter::Finish(int net_error,
|
||||||
const net::CompletionCallback& callback) {
|
net::CompletionOnceCallback callback) {
|
||||||
return net::OK;
|
return net::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
|
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "base/task_scheduler/post_task.h"
|
#include "base/task/post_task.h"
|
||||||
#include "chrome/browser/extensions/api/tabs/tabs_constants.h"
|
#include "chrome/browser/extensions/api/tabs/tabs_constants.h"
|
||||||
#include "chrome/browser/extensions/extension_tab_util.h"
|
#include "chrome/browser/extensions/extension_tab_util.h"
|
||||||
#include "chrome/browser/profiles/profile.h"
|
#include "chrome/browser/profiles/profile.h"
|
||||||
|
@@ -62,4 +62,16 @@ ExtensionHostQueue* CefExtensionHostDelegate::GetExtensionHostQueue() const {
|
|||||||
return CefExtensionsBrowserClient::Get()->GetExtensionHostQueue();
|
return CefExtensionsBrowserClient::Get()->GetExtensionHostQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gfx::Size CefExtensionHostDelegate::EnterPictureInPicture(
|
||||||
|
content::WebContents* web_contents,
|
||||||
|
const viz::SurfaceId& surface_id,
|
||||||
|
const gfx::Size& natural_size) {
|
||||||
|
NOTREACHED();
|
||||||
|
return gfx::Size();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefExtensionHostDelegate::ExitPictureInPicture() {
|
||||||
|
NOTREACHED();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace extensions
|
} // namespace extensions
|
||||||
|
@@ -35,6 +35,10 @@ class CefExtensionHostDelegate : public ExtensionHostDelegate {
|
|||||||
content::MediaStreamType type,
|
content::MediaStreamType type,
|
||||||
const Extension* extension) override;
|
const Extension* extension) override;
|
||||||
ExtensionHostQueue* GetExtensionHostQueue() const override;
|
ExtensionHostQueue* GetExtensionHostQueue() const override;
|
||||||
|
gfx::Size EnterPictureInPicture(content::WebContents* web_contents,
|
||||||
|
const viz::SurfaceId& surface_id,
|
||||||
|
const gfx::Size& natural_size) override;
|
||||||
|
void ExitPictureInPicture() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefExtensionHostDelegate);
|
DISALLOW_COPY_AND_ASSIGN(CefExtensionHostDelegate);
|
||||||
|
@@ -9,8 +9,6 @@
|
|||||||
#include "content/public/browser/render_process_host.h"
|
#include "content/public/browser/render_process_host.h"
|
||||||
#include "content/public/common/url_constants.h"
|
#include "content/public/common/url_constants.h"
|
||||||
|
|
||||||
DEFINE_WEB_CONTENTS_USER_DATA_KEY(extensions::CefExtensionWebContentsObserver);
|
|
||||||
|
|
||||||
namespace extensions {
|
namespace extensions {
|
||||||
|
|
||||||
CefExtensionWebContentsObserver::CefExtensionWebContentsObserver(
|
CefExtensionWebContentsObserver::CefExtensionWebContentsObserver(
|
||||||
|
@@ -38,7 +38,8 @@ class CefExtensionWebContentsObserver
|
|||||||
|
|
||||||
// Our content script observers. Declare at top so that it will outlive all
|
// Our content script observers. Declare at top so that it will outlive all
|
||||||
// other members, since they might add themselves as observers.
|
// other members, since they might add themselves as observers.
|
||||||
base::ObserverList<ScriptExecutionObserver> script_execution_observers_;
|
base::ObserverList<ScriptExecutionObserver>::Unchecked
|
||||||
|
script_execution_observers_;
|
||||||
|
|
||||||
std::unique_ptr<ScriptExecutor> script_executor_;
|
std::unique_ptr<ScriptExecutor> script_executor_;
|
||||||
|
|
||||||
|
29
libcef/browser/extensions/extensions_browser_api_provider.cc
Normal file
29
libcef/browser/extensions/extensions_browser_api_provider.cc
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
// Copyright 2018 The Chromium Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "libcef/browser/extensions/chrome_api_registration.h"
|
||||||
|
#include "libcef/browser/extensions/extensions_browser_api_provider.h"
|
||||||
|
|
||||||
|
//#include "cef/libcef/browser/extensions/api/generated_api_registration.h"
|
||||||
|
#include "extensions/browser/api/generated_api_registration.h"
|
||||||
|
|
||||||
|
namespace extensions {
|
||||||
|
|
||||||
|
CefExtensionsBrowserAPIProvider::CefExtensionsBrowserAPIProvider() =
|
||||||
|
default;
|
||||||
|
CefExtensionsBrowserAPIProvider::~CefExtensionsBrowserAPIProvider() =
|
||||||
|
default;
|
||||||
|
|
||||||
|
void CefExtensionsBrowserAPIProvider::RegisterExtensionFunctions(
|
||||||
|
ExtensionFunctionRegistry* registry) {
|
||||||
|
// CEF-only APIs.
|
||||||
|
// TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
|
||||||
|
// libcef/common/extensions/api/README.txt for details.
|
||||||
|
// api::cef::CefGeneratedFunctionRegistry::RegisterAll(registry);
|
||||||
|
|
||||||
|
// Chrome APIs whitelisted by CEF.
|
||||||
|
api::cef::ChromeFunctionRegistry::RegisterAll(registry);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace extensions
|
26
libcef/browser/extensions/extensions_browser_api_provider.h
Normal file
26
libcef/browser/extensions/extensions_browser_api_provider.h
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// Copyright 2018 The Chromium Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSIONS_BROWSER_API_PROVIDER_H_
|
||||||
|
#define CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSIONS_BROWSER_API_PROVIDER_H_
|
||||||
|
|
||||||
|
#include "base/macros.h"
|
||||||
|
#include "extensions/browser/extensions_browser_api_provider.h"
|
||||||
|
|
||||||
|
namespace extensions {
|
||||||
|
|
||||||
|
class CefExtensionsBrowserAPIProvider : public ExtensionsBrowserAPIProvider {
|
||||||
|
public:
|
||||||
|
CefExtensionsBrowserAPIProvider();
|
||||||
|
~CefExtensionsBrowserAPIProvider() override;
|
||||||
|
|
||||||
|
void RegisterExtensionFunctions(ExtensionFunctionRegistry* registry) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefExtensionsBrowserAPIProvider);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace extensions
|
||||||
|
|
||||||
|
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSIONS_BROWSER_API_PROVIDER_H_
|
@@ -9,15 +9,14 @@
|
|||||||
|
|
||||||
#include "libcef/browser/browser_context_impl.h"
|
#include "libcef/browser/browser_context_impl.h"
|
||||||
#include "libcef/browser/browser_host_impl.h"
|
#include "libcef/browser/browser_host_impl.h"
|
||||||
#include "libcef/browser/extensions/chrome_api_registration.h"
|
|
||||||
#include "libcef/browser/extensions/component_extension_resource_manager.h"
|
#include "libcef/browser/extensions/component_extension_resource_manager.h"
|
||||||
#include "libcef/browser/extensions/extension_system.h"
|
#include "libcef/browser/extensions/extension_system.h"
|
||||||
#include "libcef/browser/extensions/extension_system_factory.h"
|
#include "libcef/browser/extensions/extension_system_factory.h"
|
||||||
#include "libcef/browser/extensions/extension_web_contents_observer.h"
|
#include "libcef/browser/extensions/extension_web_contents_observer.h"
|
||||||
#include "libcef/browser/extensions/extensions_api_client.h"
|
#include "libcef/browser/extensions/extensions_api_client.h"
|
||||||
|
#include "libcef/browser/extensions/extensions_browser_api_provider.h"
|
||||||
#include "libcef/browser/request_context_impl.h"
|
#include "libcef/browser/request_context_impl.h"
|
||||||
|
|
||||||
//#include "cef/libcef/browser/extensions/api/generated_api_registration.h"
|
|
||||||
#include "chrome/browser/browser_process.h"
|
#include "chrome/browser/browser_process.h"
|
||||||
#include "chrome/browser/extensions/chrome_url_request_util.h"
|
#include "chrome/browser/extensions/chrome_url_request_util.h"
|
||||||
#include "chrome/browser/extensions/event_router_forwarder.h"
|
#include "chrome/browser/extensions/event_router_forwarder.h"
|
||||||
@@ -25,11 +24,10 @@
|
|||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/browser/render_frame_host.h"
|
#include "content/public/browser/render_frame_host.h"
|
||||||
#include "extensions/browser/api/extensions_api_client.h"
|
#include "extensions/browser/api/extensions_api_client.h"
|
||||||
#include "extensions/browser/api/generated_api_registration.h"
|
|
||||||
#include "extensions/browser/api/runtime/runtime_api_delegate.h"
|
#include "extensions/browser/api/runtime/runtime_api_delegate.h"
|
||||||
#include "extensions/browser/app_sorting.h"
|
#include "extensions/browser/app_sorting.h"
|
||||||
|
#include "extensions/browser/core_extensions_browser_api_provider.h"
|
||||||
#include "extensions/browser/event_router.h"
|
#include "extensions/browser/event_router.h"
|
||||||
#include "extensions/browser/extension_function_registry.h"
|
|
||||||
#include "extensions/browser/extension_host_delegate.h"
|
#include "extensions/browser/extension_host_delegate.h"
|
||||||
#include "extensions/browser/mojo/interface_registration.h"
|
#include "extensions/browser/mojo/interface_registration.h"
|
||||||
#include "extensions/browser/serial_extension_host_queue.h"
|
#include "extensions/browser/serial_extension_host_queue.h"
|
||||||
@@ -43,7 +41,10 @@ namespace extensions {
|
|||||||
|
|
||||||
CefExtensionsBrowserClient::CefExtensionsBrowserClient()
|
CefExtensionsBrowserClient::CefExtensionsBrowserClient()
|
||||||
: api_client_(new CefExtensionsAPIClient),
|
: api_client_(new CefExtensionsAPIClient),
|
||||||
resource_manager_(new CefComponentExtensionResourceManager) {}
|
resource_manager_(new CefComponentExtensionResourceManager) {
|
||||||
|
AddAPIProvider(std::make_unique<CoreExtensionsBrowserAPIProvider>());
|
||||||
|
AddAPIProvider(std::make_unique<CefExtensionsBrowserAPIProvider>());
|
||||||
|
}
|
||||||
|
|
||||||
CefExtensionsBrowserClient::~CefExtensionsBrowserClient() {}
|
CefExtensionsBrowserClient::~CefExtensionsBrowserClient() {}
|
||||||
|
|
||||||
@@ -258,6 +259,11 @@ bool CefExtensionsBrowserClient::IsInDemoMode() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CefExtensionsBrowserClient::IsScreensaverInDemoMode(
|
||||||
|
const std::string& app_id) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool CefExtensionsBrowserClient::IsRunningInForcedAppMode() {
|
bool CefExtensionsBrowserClient::IsRunningInForcedAppMode() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -276,20 +282,6 @@ CefExtensionsBrowserClient::GetExtensionSystemFactory() {
|
|||||||
return CefExtensionSystemFactory::GetInstance();
|
return CefExtensionSystemFactory::GetInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefExtensionsBrowserClient::RegisterExtensionFunctions(
|
|
||||||
ExtensionFunctionRegistry* registry) const {
|
|
||||||
// Register core extension-system APIs.
|
|
||||||
api::GeneratedFunctionRegistry::RegisterAll(registry);
|
|
||||||
|
|
||||||
// CEF-only APIs.
|
|
||||||
// TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
|
|
||||||
// libcef/common/extensions/api/README.txt for details.
|
|
||||||
// api::cef::CefGeneratedFunctionRegistry::RegisterAll(registry);
|
|
||||||
|
|
||||||
// Chrome APIs whitelisted by CEF.
|
|
||||||
api::cef::ChromeFunctionRegistry::RegisterAll(registry);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefExtensionsBrowserClient::RegisterExtensionInterfaces(
|
void CefExtensionsBrowserClient::RegisterExtensionInterfaces(
|
||||||
service_manager::BinderRegistryWithArgs<content::RenderFrameHost*>*
|
service_manager::BinderRegistryWithArgs<content::RenderFrameHost*>*
|
||||||
registry,
|
registry,
|
||||||
|
@@ -85,12 +85,11 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
|
|||||||
bool DidVersionUpdate(content::BrowserContext* context) override;
|
bool DidVersionUpdate(content::BrowserContext* context) override;
|
||||||
void PermitExternalProtocolHandler() override;
|
void PermitExternalProtocolHandler() override;
|
||||||
bool IsInDemoMode() override;
|
bool IsInDemoMode() override;
|
||||||
|
bool IsScreensaverInDemoMode(const std::string& app_id) override;
|
||||||
bool IsRunningInForcedAppMode() override;
|
bool IsRunningInForcedAppMode() override;
|
||||||
bool IsAppModeForcedForApp(const ExtensionId& extension_id) override;
|
bool IsAppModeForcedForApp(const ExtensionId& extension_id) override;
|
||||||
bool IsLoggedInAsPublicAccount() override;
|
bool IsLoggedInAsPublicAccount() override;
|
||||||
ExtensionSystemProvider* GetExtensionSystemFactory() override;
|
ExtensionSystemProvider* GetExtensionSystemFactory() override;
|
||||||
void RegisterExtensionFunctions(
|
|
||||||
ExtensionFunctionRegistry* registry) const override;
|
|
||||||
void RegisterExtensionInterfaces(service_manager::BinderRegistryWithArgs<
|
void RegisterExtensionInterfaces(service_manager::BinderRegistryWithArgs<
|
||||||
content::RenderFrameHost*>* registry,
|
content::RenderFrameHost*>* registry,
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
|
@@ -78,8 +78,8 @@ bool CefBrowserPlatformDelegateNativeLinux::CreateHostWindow() {
|
|||||||
// Add a reference that will be released in BrowserDestroyed().
|
// Add a reference that will be released in BrowserDestroyed().
|
||||||
browser_->AddRef();
|
browser_->AddRef();
|
||||||
|
|
||||||
CefWindowDelegateView* delegate_view =
|
CefWindowDelegateView* delegate_view = new CefWindowDelegateView(
|
||||||
new CefWindowDelegateView(GetBackgroundColor());
|
GetBackgroundColor(), window_x11_->TopLevelAlwaysOnTop());
|
||||||
delegate_view->Init(window_info_.window, browser_->web_contents(),
|
delegate_view->Init(window_info_.window, browser_->web_contents(),
|
||||||
gfx::Rect(gfx::Point(), rect.size()));
|
gfx::Rect(gfx::Point(), rect.size()));
|
||||||
|
|
||||||
|
@@ -99,6 +99,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)cleanup:(id)window {
|
- (void)cleanup:(id)window {
|
||||||
|
[window_ setDelegate:nil];
|
||||||
[self release];
|
[self release];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -189,8 +189,15 @@ bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() {
|
|||||||
point =
|
point =
|
||||||
gfx::ToFlooredPoint(gfx::ScalePoint(gfx::PointF(point), 1.0f / scale));
|
gfx::ToFlooredPoint(gfx::ScalePoint(gfx::PointF(point), 1.0f / scale));
|
||||||
|
|
||||||
|
// Stay on top if top-most window hosting the web view is topmost.
|
||||||
|
HWND top_level_window = GetAncestor(window_info_.window, GA_ROOT);
|
||||||
|
DWORD top_level_window_ex_styles =
|
||||||
|
GetWindowLongPtr(top_level_window, GWL_EXSTYLE);
|
||||||
|
bool always_on_top =
|
||||||
|
(top_level_window_ex_styles & WS_EX_TOPMOST) == WS_EX_TOPMOST;
|
||||||
|
|
||||||
CefWindowDelegateView* delegate_view =
|
CefWindowDelegateView* delegate_view =
|
||||||
new CefWindowDelegateView(GetBackgroundColor());
|
new CefWindowDelegateView(GetBackgroundColor(), always_on_top);
|
||||||
delegate_view->Init(window_info_.window, browser_->web_contents(),
|
delegate_view->Init(window_info_.window, browser_->web_contents(),
|
||||||
gfx::Rect(0, 0, point.x(), point.y()));
|
gfx::Rect(0, 0, point.x(), point.y()));
|
||||||
|
|
||||||
|
@@ -140,7 +140,7 @@ class CefNativeMenuWin : public MenuWrapper {
|
|||||||
MenuAction menu_action_;
|
MenuAction menu_action_;
|
||||||
|
|
||||||
// A list of listeners to call when the menu opens.
|
// A list of listeners to call when the menu opens.
|
||||||
base::ObserverList<MenuListener> listeners_;
|
base::ObserverList<MenuListener>::Unchecked listeners_;
|
||||||
|
|
||||||
// Keep track of whether the listeners have already been called at least
|
// Keep track of whether the listeners have already been called at least
|
||||||
// once.
|
// once.
|
||||||
|
@@ -12,8 +12,11 @@
|
|||||||
#include "ui/views/layout/fill_layout.h"
|
#include "ui/views/layout/fill_layout.h"
|
||||||
#include "ui/views/widget/widget.h"
|
#include "ui/views/widget/widget.h"
|
||||||
|
|
||||||
CefWindowDelegateView::CefWindowDelegateView(SkColor background_color)
|
CefWindowDelegateView::CefWindowDelegateView(SkColor background_color,
|
||||||
: background_color_(background_color), web_view_(NULL) {}
|
bool always_on_top)
|
||||||
|
: background_color_(background_color),
|
||||||
|
web_view_(NULL),
|
||||||
|
always_on_top_(always_on_top) {}
|
||||||
|
|
||||||
void CefWindowDelegateView::Init(gfx::AcceleratedWidget parent_widget,
|
void CefWindowDelegateView::Init(gfx::AcceleratedWidget parent_widget,
|
||||||
content::WebContents* web_contents,
|
content::WebContents* web_contents,
|
||||||
@@ -44,6 +47,8 @@ void CefWindowDelegateView::Init(gfx::AcceleratedWidget parent_widget,
|
|||||||
// CefBrowserHostImpl::PlatformSetFocus.
|
// CefBrowserHostImpl::PlatformSetFocus.
|
||||||
params.activatable = views::Widget::InitParams::ACTIVATABLE_YES;
|
params.activatable = views::Widget::InitParams::ACTIVATABLE_YES;
|
||||||
|
|
||||||
|
params.keep_on_top = always_on_top_;
|
||||||
|
|
||||||
// Results in a call to InitContent().
|
// Results in a call to InitContent().
|
||||||
widget->Init(params);
|
widget->Init(params);
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@ class WebView;
|
|||||||
// will be deleted automatically when the associated root window is destroyed.
|
// will be deleted automatically when the associated root window is destroyed.
|
||||||
class CefWindowDelegateView : public views::WidgetDelegateView {
|
class CefWindowDelegateView : public views::WidgetDelegateView {
|
||||||
public:
|
public:
|
||||||
explicit CefWindowDelegateView(SkColor background_color);
|
CefWindowDelegateView(SkColor background_color, bool always_on_top);
|
||||||
|
|
||||||
// Create the Widget and associated root window.
|
// Create the Widget and associated root window.
|
||||||
void Init(gfx::AcceleratedWidget parent_widget,
|
void Init(gfx::AcceleratedWidget parent_widget,
|
||||||
@@ -43,6 +43,7 @@ class CefWindowDelegateView : public views::WidgetDelegateView {
|
|||||||
private:
|
private:
|
||||||
SkColor background_color_;
|
SkColor background_color_;
|
||||||
views::WebView* web_view_;
|
views::WebView* web_view_;
|
||||||
|
bool always_on_top_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefWindowDelegateView);
|
DISALLOW_COPY_AND_ASSIGN(CefWindowDelegateView);
|
||||||
};
|
};
|
||||||
|
@@ -104,6 +104,7 @@ CefWindowX11::CefWindowX11(CefRefPtr<CefBrowserHostImpl> browser,
|
|||||||
InputOutput,
|
InputOutput,
|
||||||
CopyFromParent, // visual
|
CopyFromParent, // visual
|
||||||
CWBackPixmap | CWOverrideRedirect, &swa);
|
CWBackPixmap | CWOverrideRedirect, &swa);
|
||||||
|
CHECK(xwindow_);
|
||||||
|
|
||||||
if (ui::PlatformEventSource::GetInstance())
|
if (ui::PlatformEventSource::GetInstance())
|
||||||
ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
|
ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
|
||||||
@@ -395,3 +396,34 @@ void CefWindowX11::ContinueFocus() {
|
|||||||
browser_->SetFocus(true);
|
browser_->SetFocus(true);
|
||||||
focus_pending_ = false;
|
focus_pending_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CefWindowX11::TopLevelAlwaysOnTop() const {
|
||||||
|
::Window toplevel_window = FindToplevelParent(xdisplay_, xwindow_);
|
||||||
|
|
||||||
|
Atom state_atom = gfx::GetAtom("_NET_WM_STATE");
|
||||||
|
Atom state_keep_above = gfx::GetAtom("_NET_WM_STATE_KEEP_ABOVE");
|
||||||
|
Atom* states;
|
||||||
|
|
||||||
|
Atom actual_type;
|
||||||
|
int actual_format;
|
||||||
|
unsigned long num_items;
|
||||||
|
unsigned long bytes_after;
|
||||||
|
|
||||||
|
XGetWindowProperty(xdisplay_, toplevel_window, state_atom, 0, 1024,
|
||||||
|
x11::False, XA_ATOM, &actual_type, &actual_format,
|
||||||
|
&num_items, &bytes_after,
|
||||||
|
reinterpret_cast<unsigned char**>(&states));
|
||||||
|
|
||||||
|
bool always_on_top = false;
|
||||||
|
|
||||||
|
for (unsigned long i = 0; i < num_items; ++i) {
|
||||||
|
if (states[i] == state_keep_above) {
|
||||||
|
always_on_top = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
XFree(states);
|
||||||
|
|
||||||
|
return always_on_top;
|
||||||
|
}
|
||||||
|
@@ -52,6 +52,8 @@ class CefWindowX11 : public ui::PlatformEventDispatcher {
|
|||||||
::Window xwindow() const { return xwindow_; }
|
::Window xwindow() const { return xwindow_; }
|
||||||
gfx::Rect bounds() const { return bounds_; }
|
gfx::Rect bounds() const { return bounds_; }
|
||||||
|
|
||||||
|
bool TopLevelAlwaysOnTop() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ContinueFocus();
|
void ContinueFocus();
|
||||||
|
|
||||||
|
@@ -62,7 +62,7 @@ const char kChromeUIWebUIHostsHost[] = "webui-hosts";
|
|||||||
// testing all related functionality in CEF.
|
// testing all related functionality in CEF.
|
||||||
const char* kAllowedWebUIHosts[] = {
|
const char* kAllowedWebUIHosts[] = {
|
||||||
content::kChromeUIAppCacheInternalsHost,
|
content::kChromeUIAppCacheInternalsHost,
|
||||||
content::kChromeUIAccessibilityHost,
|
chrome::kChromeUIAccessibilityHost,
|
||||||
content::kChromeUIBlobInternalsHost,
|
content::kChromeUIBlobInternalsHost,
|
||||||
chrome::kChromeUICreditsHost,
|
chrome::kChromeUICreditsHost,
|
||||||
content::kChromeUIGpuHost,
|
content::kChromeUIGpuHost,
|
||||||
|
@@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
#include "libcef/browser/net/cookie_store_proxy.h"
|
#include "libcef/browser/net/cookie_store_proxy.h"
|
||||||
|
|
||||||
#include "libcef/browser/cookie_manager_impl.h"
|
#include "include/cef_request_context.h"
|
||||||
#include "libcef/browser/net/url_request_context_impl.h"
|
#include "libcef/browser/net/cookie_store_source.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "net/url_request/url_request_context.h"
|
#include "net/cookies/cookie_change_dispatcher.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -44,12 +44,10 @@ class NullCookieChangeDispatcher : public net::CookieChangeDispatcher {
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
CefCookieStoreProxy::CefCookieStoreProxy(
|
CefCookieStoreProxy::CefCookieStoreProxy(
|
||||||
CefURLRequestContextImpl* parent,
|
std::unique_ptr<CefCookieStoreSource> source)
|
||||||
CefRefPtr<CefRequestContextHandler> handler)
|
: source_(std::move(source)) {
|
||||||
: parent_(parent), handler_(handler) {
|
|
||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
DCHECK(parent_);
|
DCHECK(source_);
|
||||||
DCHECK(handler_.get());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CefCookieStoreProxy::~CefCookieStoreProxy() {
|
CefCookieStoreProxy::~CefCookieStoreProxy() {
|
||||||
@@ -189,24 +187,5 @@ bool CefCookieStoreProxy::IsEphemeral() {
|
|||||||
|
|
||||||
net::CookieStore* CefCookieStoreProxy::GetCookieStore() {
|
net::CookieStore* CefCookieStoreProxy::GetCookieStore() {
|
||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
|
return source_->GetCookieStore();
|
||||||
CefRefPtr<CefCookieManager> manager = handler_->GetCookieManager();
|
|
||||||
if (manager.get()) {
|
|
||||||
// Use the cookie store provided by the manager. May be nullptr if the
|
|
||||||
// cookie manager is blocking.
|
|
||||||
return reinterpret_cast<CefCookieManagerImpl*>(manager.get())
|
|
||||||
->GetExistingCookieStore();
|
|
||||||
}
|
|
||||||
|
|
||||||
DCHECK(parent_);
|
|
||||||
if (parent_) {
|
|
||||||
// Use the cookie store from the parent.
|
|
||||||
net::CookieStore* cookie_store = parent_->cookie_store();
|
|
||||||
DCHECK(cookie_store);
|
|
||||||
if (!cookie_store)
|
|
||||||
LOG(ERROR) << "Cookie store does not exist";
|
|
||||||
return cookie_store;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
@@ -6,19 +6,15 @@
|
|||||||
#define CEF_LIBCEF_BROWSER_COOKIE_STORE_PROXY_H_
|
#define CEF_LIBCEF_BROWSER_COOKIE_STORE_PROXY_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "include/cef_request_context_handler.h"
|
|
||||||
|
|
||||||
#include "net/cookies/cookie_store.h"
|
#include "net/cookies/cookie_store.h"
|
||||||
|
|
||||||
class CefURLRequestContextImpl;
|
class CefCookieStoreSource;
|
||||||
|
|
||||||
// Proxies cookie requests to the CefRequestContextHandler or global cookie
|
// Proxies cookie requests to a CefCookieStoreSource (see comments on the
|
||||||
// store. Life span is controlled by CefURLRequestContextProxy. Only accessed on
|
// implementation classes for details). Only accessed on the IO thread.
|
||||||
// the IO thread. See browser_context.h for an object relationship diagram.
|
|
||||||
class CefCookieStoreProxy : public net::CookieStore {
|
class CefCookieStoreProxy : public net::CookieStore {
|
||||||
public:
|
public:
|
||||||
CefCookieStoreProxy(CefURLRequestContextImpl* parent,
|
explicit CefCookieStoreProxy(std::unique_ptr<CefCookieStoreSource> source);
|
||||||
CefRefPtr<CefRequestContextHandler> handler);
|
|
||||||
~CefCookieStoreProxy() override;
|
~CefCookieStoreProxy() override;
|
||||||
|
|
||||||
// net::CookieStore methods.
|
// net::CookieStore methods.
|
||||||
@@ -52,11 +48,7 @@ class CefCookieStoreProxy : public net::CookieStore {
|
|||||||
private:
|
private:
|
||||||
net::CookieStore* GetCookieStore();
|
net::CookieStore* GetCookieStore();
|
||||||
|
|
||||||
// The |parent_| pointer is kept alive by CefURLRequestContextGetterProxy
|
std::unique_ptr<CefCookieStoreSource> const source_;
|
||||||
// which has a ref to the owning CefURLRequestContextGetterImpl.
|
|
||||||
CefURLRequestContextImpl* parent_;
|
|
||||||
CefRefPtr<CefRequestContextHandler> handler_;
|
|
||||||
|
|
||||||
std::unique_ptr<net::CookieChangeDispatcher> null_dispatcher_;
|
std::unique_ptr<net::CookieChangeDispatcher> null_dispatcher_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefCookieStoreProxy);
|
DISALLOW_COPY_AND_ASSIGN(CefCookieStoreProxy);
|
||||||
|
111
libcef/browser/net/cookie_store_source.cc
Normal file
111
libcef/browser/net/cookie_store_source.cc
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
// Copyright (c) 2018 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that can
|
||||||
|
// be found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "libcef/browser/net/cookie_store_source.h"
|
||||||
|
|
||||||
|
#include "libcef/browser/content_browser_client.h"
|
||||||
|
#include "libcef/browser/cookie_manager_impl.h"
|
||||||
|
#include "libcef/browser/net/url_request_context_impl.h"
|
||||||
|
#include "libcef/browser/thread_util.h"
|
||||||
|
|
||||||
|
#include "base/files/file_util.h"
|
||||||
|
#include "base/logging.h"
|
||||||
|
#include "net/extras/sqlite/sqlite_persistent_cookie_store.h"
|
||||||
|
|
||||||
|
CefCookieStoreHandlerSource::CefCookieStoreHandlerSource(
|
||||||
|
CefURLRequestContextImpl* parent,
|
||||||
|
CefRefPtr<CefRequestContextHandler> handler)
|
||||||
|
: parent_(parent), handler_(handler) {
|
||||||
|
DCHECK(parent_);
|
||||||
|
DCHECK(handler_);
|
||||||
|
}
|
||||||
|
|
||||||
|
net::CookieStore* CefCookieStoreHandlerSource::GetCookieStore() {
|
||||||
|
CEF_REQUIRE_IOT();
|
||||||
|
|
||||||
|
CefRefPtr<CefCookieManager> manager = handler_->GetCookieManager();
|
||||||
|
if (manager) {
|
||||||
|
// Use the cookie store provided by the manager. May be nullptr if the
|
||||||
|
// cookie manager is blocking.
|
||||||
|
return reinterpret_cast<CefCookieManagerImpl*>(manager.get())
|
||||||
|
->GetExistingCookieStore();
|
||||||
|
}
|
||||||
|
|
||||||
|
DCHECK(parent_);
|
||||||
|
if (parent_) {
|
||||||
|
// Use the cookie store from the parent.
|
||||||
|
net::CookieStore* cookie_store = parent_->cookie_store();
|
||||||
|
DCHECK(cookie_store);
|
||||||
|
if (!cookie_store)
|
||||||
|
LOG(ERROR) << "Cookie store does not exist";
|
||||||
|
return cookie_store;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
CefCookieStoreOwnerSource::CefCookieStoreOwnerSource() {}
|
||||||
|
|
||||||
|
void CefCookieStoreOwnerSource::SetCookieStoragePath(
|
||||||
|
const base::FilePath& path,
|
||||||
|
bool persist_session_cookies,
|
||||||
|
net::NetLog* net_log) {
|
||||||
|
CEF_REQUIRE_IOT();
|
||||||
|
|
||||||
|
if (cookie_store_ && ((path_.empty() && path.empty()) || path_ == path)) {
|
||||||
|
// The path has not changed so don't do anything.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
scoped_refptr<net::SQLitePersistentCookieStore> persistent_store;
|
||||||
|
if (!path.empty()) {
|
||||||
|
// TODO(cef): Move directory creation to the blocking pool instead of
|
||||||
|
// allowing file IO on this thread.
|
||||||
|
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||||
|
if (base::DirectoryExists(path) || base::CreateDirectory(path)) {
|
||||||
|
const base::FilePath& cookie_path = path.AppendASCII("Cookies");
|
||||||
|
persistent_store = new net::SQLitePersistentCookieStore(
|
||||||
|
cookie_path,
|
||||||
|
content::BrowserThread::GetTaskRunnerForThread(
|
||||||
|
content::BrowserThread::IO),
|
||||||
|
// Intentionally using the background task runner exposed by CEF to
|
||||||
|
// facilitate unit test expectations. This task runner MUST be
|
||||||
|
// configured with BLOCK_SHUTDOWN.
|
||||||
|
CefContentBrowserClient::Get()->background_task_runner(),
|
||||||
|
persist_session_cookies, NULL);
|
||||||
|
} else {
|
||||||
|
NOTREACHED() << "The cookie storage directory could not be created";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the new cookie store that will be used for all new requests. The old
|
||||||
|
// cookie store, if any, will be automatically flushed and closed when no
|
||||||
|
// longer referenced.
|
||||||
|
std::unique_ptr<net::CookieMonster> cookie_monster(
|
||||||
|
new net::CookieMonster(persistent_store.get(), nullptr, net_log));
|
||||||
|
if (persistent_store.get() && persist_session_cookies)
|
||||||
|
cookie_monster->SetPersistSessionCookies(true);
|
||||||
|
path_ = path;
|
||||||
|
|
||||||
|
// Restore the previously supported schemes.
|
||||||
|
CefCookieManagerImpl::SetCookieMonsterSchemes(cookie_monster.get(),
|
||||||
|
supported_schemes_);
|
||||||
|
|
||||||
|
cookie_store_ = std::move(cookie_monster);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefCookieStoreOwnerSource::SetCookieSupportedSchemes(
|
||||||
|
const std::vector<std::string>& schemes) {
|
||||||
|
CEF_REQUIRE_IOT();
|
||||||
|
|
||||||
|
supported_schemes_ = schemes;
|
||||||
|
CefCookieManagerImpl::SetCookieMonsterSchemes(
|
||||||
|
static_cast<net::CookieMonster*>(cookie_store_.get()),
|
||||||
|
supported_schemes_);
|
||||||
|
}
|
||||||
|
|
||||||
|
net::CookieStore* CefCookieStoreOwnerSource::GetCookieStore() {
|
||||||
|
CEF_REQUIRE_IOT();
|
||||||
|
return cookie_store_.get();
|
||||||
|
}
|
75
libcef/browser/net/cookie_store_source.h
Normal file
75
libcef/browser/net/cookie_store_source.h
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
// Copyright (c) 2018 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that can
|
||||||
|
// be found in the LICENSE file.
|
||||||
|
|
||||||
|
#ifndef CEF_LIBCEF_BROWSER_COOKIE_STORE_SOURCE_H_
|
||||||
|
#define CEF_LIBCEF_BROWSER_COOKIE_STORE_SOURCE_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "include/cef_request_context_handler.h"
|
||||||
|
|
||||||
|
#include "base/macros.h"
|
||||||
|
|
||||||
|
namespace base {
|
||||||
|
class FilePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace net {
|
||||||
|
class CookieStore;
|
||||||
|
class NetLog;
|
||||||
|
} // namespace net
|
||||||
|
|
||||||
|
class CefURLRequestContextImpl;
|
||||||
|
|
||||||
|
// Abstract base class for CookieStore sources. Only accessed on the IO thread.
|
||||||
|
class CefCookieStoreSource {
|
||||||
|
public:
|
||||||
|
virtual net::CookieStore* GetCookieStore() = 0;
|
||||||
|
virtual ~CefCookieStoreSource() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Sources a cookie store that is created/owned by a CefCookieManager or the
|
||||||
|
// parent context. Life span is controlled by CefURLRequestContextProxy. See
|
||||||
|
// browser_context.h for an object relationship diagram.
|
||||||
|
class CefCookieStoreHandlerSource : public CefCookieStoreSource {
|
||||||
|
public:
|
||||||
|
CefCookieStoreHandlerSource(CefURLRequestContextImpl* parent,
|
||||||
|
CefRefPtr<CefRequestContextHandler> handler);
|
||||||
|
|
||||||
|
net::CookieStore* GetCookieStore() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// The |parent_| pointer is kept alive by CefURLRequestContextGetterProxy
|
||||||
|
// which has a ref to the owning CefURLRequestContextGetterImpl.
|
||||||
|
CefURLRequestContextImpl* parent_;
|
||||||
|
CefRefPtr<CefRequestContextHandler> handler_;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefCookieStoreHandlerSource);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Sources a cookie store that is created/owned by this object. Life span is
|
||||||
|
// controlled by the owning URLRequestContext.
|
||||||
|
class CefCookieStoreOwnerSource : public CefCookieStoreSource {
|
||||||
|
public:
|
||||||
|
CefCookieStoreOwnerSource();
|
||||||
|
|
||||||
|
void SetCookieStoragePath(const base::FilePath& path,
|
||||||
|
bool persist_session_cookies,
|
||||||
|
net::NetLog* net_log);
|
||||||
|
void SetCookieSupportedSchemes(const std::vector<std::string>& schemes);
|
||||||
|
|
||||||
|
net::CookieStore* GetCookieStore() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unique_ptr<net::CookieStore> cookie_store_;
|
||||||
|
base::FilePath path_;
|
||||||
|
std::vector<std::string> supported_schemes_;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefCookieStoreOwnerSource);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CEF_LIBCEF_BROWSER_COOKIE_STORE_SOURCE_H_
|
@@ -19,7 +19,7 @@ namespace {
|
|||||||
|
|
||||||
void SetCRLSetIfNewer(scoped_refptr<net::CRLSet> crl_set) {
|
void SetCRLSetIfNewer(scoped_refptr<net::CRLSet> crl_set) {
|
||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
net::SSLConfigService::SetCRLSetIfNewer(crl_set);
|
// TODO(cef): Re-implement via NetworkService.
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadFromDisk(const base::FilePath& path) {
|
void LoadFromDisk(const base::FilePath& path) {
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/metrics/field_trial.h"
|
#include "base/metrics/field_trial.h"
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "chrome/browser/net/safe_search_util.h"
|
#include "chrome/common/net/safe_search_util.h"
|
||||||
#include "components/prefs/pref_member.h"
|
#include "components/prefs/pref_member.h"
|
||||||
#include "components/prefs/pref_service.h"
|
#include "components/prefs/pref_service.h"
|
||||||
#include "content/public/common/content_switches.h"
|
#include "content/public/common/content_switches.h"
|
||||||
@@ -143,7 +143,7 @@ class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
|
|||||||
// Only execute the callback if the request has not been canceled.
|
// Only execute the callback if the request has not been canceled.
|
||||||
if (request->status().status() != net::URLRequestStatus::CANCELED) {
|
if (request->status().status() != net::URLRequestStatus::CANCELED) {
|
||||||
if (force_google_safesearch && allow && new_url->is_empty())
|
if (force_google_safesearch && allow && new_url->is_empty())
|
||||||
safe_search_util::ForceGoogleSafeSearch(request, new_url);
|
safe_search_util::ForceGoogleSafeSearch(request->url(), new_url);
|
||||||
|
|
||||||
std::move(callback).Run(allow ? net::OK : net::ERR_ABORTED);
|
std::move(callback).Run(allow ? net::OK : net::ERR_ABORTED);
|
||||||
}
|
}
|
||||||
@@ -333,7 +333,7 @@ int CefNetworkDelegate::OnBeforeURLRequest(net::URLRequest* request,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (force_google_safesearch && new_url->is_empty())
|
if (force_google_safesearch && new_url->is_empty())
|
||||||
safe_search_util::ForceGoogleSafeSearch(request, new_url);
|
safe_search_util::ForceGoogleSafeSearch(request->url(), new_url);
|
||||||
|
|
||||||
// Continue the request immediately.
|
// Continue the request immediately.
|
||||||
return net::OK;
|
return net::OK;
|
||||||
@@ -445,10 +445,7 @@ net::NetworkDelegate::AuthRequiredResponse CefNetworkDelegate::OnAuthRequired(
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CefNetworkDelegate::OnCanGetCookies(const net::URLRequest& request,
|
bool CefNetworkDelegate::OnCanGetCookies(const net::URLRequest& request,
|
||||||
const net::CookieList& cookie_list,
|
const net::CookieList& cookie_list) {
|
||||||
bool allowed_from_caller) {
|
|
||||||
if (!allowed_from_caller)
|
|
||||||
return false;
|
|
||||||
if (net_util::IsInternalRequest(&request))
|
if (net_util::IsInternalRequest(&request))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -475,10 +472,7 @@ bool CefNetworkDelegate::OnCanGetCookies(const net::URLRequest& request,
|
|||||||
|
|
||||||
bool CefNetworkDelegate::OnCanSetCookie(const net::URLRequest& request,
|
bool CefNetworkDelegate::OnCanSetCookie(const net::URLRequest& request,
|
||||||
const net::CanonicalCookie& cookie,
|
const net::CanonicalCookie& cookie,
|
||||||
net::CookieOptions* options,
|
net::CookieOptions* options) {
|
||||||
bool allowed_from_caller) {
|
|
||||||
if (!allowed_from_caller)
|
|
||||||
return false;
|
|
||||||
if (net_util::IsInternalRequest(&request))
|
if (net_util::IsInternalRequest(&request))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@@ -41,12 +41,10 @@ class CefNetworkDelegate : public net::NetworkDelegateImpl {
|
|||||||
bool started,
|
bool started,
|
||||||
int net_error) override;
|
int net_error) override;
|
||||||
bool OnCanGetCookies(const net::URLRequest& request,
|
bool OnCanGetCookies(const net::URLRequest& request,
|
||||||
const net::CookieList& cookie_list,
|
const net::CookieList& cookie_list) override;
|
||||||
bool allowed_from_caller) override;
|
|
||||||
bool OnCanSetCookie(const net::URLRequest& request,
|
bool OnCanSetCookie(const net::URLRequest& request,
|
||||||
const net::CanonicalCookie& cookie,
|
const net::CanonicalCookie& cookie,
|
||||||
net::CookieOptions* options,
|
net::CookieOptions* options) override;
|
||||||
bool allowed_from_caller) override;
|
|
||||||
bool OnCanAccessFile(const net::URLRequest& request,
|
bool OnCanAccessFile(const net::URLRequest& request,
|
||||||
const base::FilePath& original_path,
|
const base::FilePath& original_path,
|
||||||
const base::FilePath& absolute_path) const override;
|
const base::FilePath& absolute_path) const override;
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
#include "libcef/common/net/scheme_registration.h"
|
#include "libcef/common/net/scheme_registration.h"
|
||||||
|
|
||||||
#include "base/memory/ptr_util.h"
|
#include "base/memory/ptr_util.h"
|
||||||
#include "base/task_scheduler/post_task.h"
|
#include "base/task/post_task.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/common/url_constants.h"
|
#include "content/public/common/url_constants.h"
|
||||||
#include "net/net_buildflags.h"
|
#include "net/net_buildflags.h"
|
||||||
|
@@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
#include "libcef/browser/content_browser_client.h"
|
#include "libcef/browser/content_browser_client.h"
|
||||||
#include "libcef/browser/cookie_manager_impl.h"
|
#include "libcef/browser/cookie_manager_impl.h"
|
||||||
|
#include "libcef/browser/net/cookie_store_proxy.h"
|
||||||
|
#include "libcef/browser/net/cookie_store_source.h"
|
||||||
#include "libcef/browser/net/network_delegate.h"
|
#include "libcef/browser/net/network_delegate.h"
|
||||||
#include "libcef/browser/net/scheme_handler.h"
|
#include "libcef/browser/net/scheme_handler.h"
|
||||||
#include "libcef/browser/net/url_request_interceptor.h"
|
#include "libcef/browser/net/url_request_interceptor.h"
|
||||||
@@ -18,7 +20,6 @@
|
|||||||
#include "libcef/common/content_client.h"
|
#include "libcef/common/content_client.h"
|
||||||
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/files/file_util.h"
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/memory/ptr_util.h"
|
#include "base/memory/ptr_util.h"
|
||||||
#include "base/stl_util.h"
|
#include "base/stl_util.h"
|
||||||
@@ -43,7 +44,6 @@
|
|||||||
#include "net/cert/multi_log_ct_verifier.h"
|
#include "net/cert/multi_log_ct_verifier.h"
|
||||||
#include "net/cookies/cookie_monster.h"
|
#include "net/cookies/cookie_monster.h"
|
||||||
#include "net/dns/host_resolver.h"
|
#include "net/dns/host_resolver.h"
|
||||||
#include "net/extras/sqlite/sqlite_persistent_cookie_store.h"
|
|
||||||
#include "net/ftp/ftp_network_layer.h"
|
#include "net/ftp/ftp_network_layer.h"
|
||||||
#include "net/http/http_auth_handler_factory.h"
|
#include "net/http/http_auth_handler_factory.h"
|
||||||
#include "net/http/http_auth_preferences.h"
|
#include "net/http/http_auth_preferences.h"
|
||||||
@@ -473,57 +473,21 @@ void CefURLRequestContextGetterImpl::SetCookieStoragePath(
|
|||||||
const base::FilePath& path,
|
const base::FilePath& path,
|
||||||
bool persist_session_cookies) {
|
bool persist_session_cookies) {
|
||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
|
if (!io_state_->cookie_source_) {
|
||||||
if (io_state_->url_request_context_->cookie_store() &&
|
// Use a proxy because we can't change the URLRequestContext's CookieStore
|
||||||
((io_state_->cookie_store_path_.empty() && path.empty()) ||
|
// during runtime.
|
||||||
io_state_->cookie_store_path_ == path)) {
|
io_state_->cookie_source_ = new CefCookieStoreOwnerSource();
|
||||||
// The path has not changed so don't do anything.
|
io_state_->storage_->set_cookie_store(std::make_unique<CefCookieStoreProxy>(
|
||||||
return;
|
base::WrapUnique(io_state_->cookie_source_)));
|
||||||
}
|
}
|
||||||
|
io_state_->cookie_source_->SetCookieStoragePath(path, persist_session_cookies,
|
||||||
scoped_refptr<net::SQLitePersistentCookieStore> persistent_store;
|
io_state_->net_log_);
|
||||||
if (!path.empty()) {
|
|
||||||
// TODO(cef): Move directory creation to the blocking pool instead of
|
|
||||||
// allowing file IO on this thread.
|
|
||||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
|
||||||
if (base::DirectoryExists(path) || base::CreateDirectory(path)) {
|
|
||||||
const base::FilePath& cookie_path = path.AppendASCII("Cookies");
|
|
||||||
persistent_store = new net::SQLitePersistentCookieStore(
|
|
||||||
cookie_path, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
|
|
||||||
// Intentionally using the background task runner exposed by CEF to
|
|
||||||
// facilitate unit test expectations. This task runner MUST be
|
|
||||||
// configured with BLOCK_SHUTDOWN.
|
|
||||||
CefContentBrowserClient::Get()->background_task_runner(),
|
|
||||||
persist_session_cookies, NULL);
|
|
||||||
} else {
|
|
||||||
NOTREACHED() << "The cookie storage directory could not be created";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the new cookie store that will be used for all new requests. The old
|
|
||||||
// cookie store, if any, will be automatically flushed and closed when no
|
|
||||||
// longer referenced.
|
|
||||||
std::unique_ptr<net::CookieMonster> cookie_monster(
|
|
||||||
new net::CookieMonster(persistent_store.get(), NULL));
|
|
||||||
if (persistent_store.get() && persist_session_cookies)
|
|
||||||
cookie_monster->SetPersistSessionCookies(true);
|
|
||||||
io_state_->cookie_store_path_ = path;
|
|
||||||
|
|
||||||
// Restore the previously supported schemes.
|
|
||||||
CefCookieManagerImpl::SetCookieMonsterSchemes(
|
|
||||||
cookie_monster.get(), io_state_->cookie_supported_schemes_);
|
|
||||||
|
|
||||||
io_state_->storage_->set_cookie_store(std::move(cookie_monster));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefURLRequestContextGetterImpl::SetCookieSupportedSchemes(
|
void CefURLRequestContextGetterImpl::SetCookieSupportedSchemes(
|
||||||
const std::vector<std::string>& schemes) {
|
const std::vector<std::string>& schemes) {
|
||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
|
io_state_->cookie_source_->SetCookieSupportedSchemes(schemes);
|
||||||
io_state_->cookie_supported_schemes_ = schemes;
|
|
||||||
CefCookieManagerImpl::SetCookieMonsterSchemes(
|
|
||||||
static_cast<net::CookieMonster*>(GetExistingCookieStore()),
|
|
||||||
io_state_->cookie_supported_schemes_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefURLRequestContextGetterImpl::AddHandler(
|
void CefURLRequestContextGetterImpl::AddHandler(
|
||||||
@@ -540,9 +504,8 @@ void CefURLRequestContextGetterImpl::AddHandler(
|
|||||||
net::CookieStore* CefURLRequestContextGetterImpl::GetExistingCookieStore()
|
net::CookieStore* CefURLRequestContextGetterImpl::GetExistingCookieStore()
|
||||||
const {
|
const {
|
||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
if (io_state_->url_request_context_ &&
|
if (io_state_->cookie_source_) {
|
||||||
io_state_->url_request_context_->cookie_store()) {
|
return io_state_->cookie_source_->GetCookieStore();
|
||||||
return io_state_->url_request_context_->cookie_store();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(ERROR) << "Cookie store does not exist";
|
LOG(ERROR) << "Cookie store does not exist";
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
#include "content/public/browser/browser_context.h"
|
#include "content/public/browser/browser_context.h"
|
||||||
#include "net/url_request/url_request_job_factory.h"
|
#include "net/url_request/url_request_job_factory.h"
|
||||||
|
|
||||||
|
class CefCookieStoreOwnerSource;
|
||||||
class PrefRegistrySimple;
|
class PrefRegistrySimple;
|
||||||
class PrefService;
|
class PrefService;
|
||||||
|
|
||||||
@@ -113,8 +114,8 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
|
|||||||
content::ProtocolHandlerMap protocol_handlers_;
|
content::ProtocolHandlerMap protocol_handlers_;
|
||||||
content::URLRequestInterceptorScopedVector request_interceptors_;
|
content::URLRequestInterceptorScopedVector request_interceptors_;
|
||||||
|
|
||||||
base::FilePath cookie_store_path_;
|
// Owned by the URLRequestContextStorage.
|
||||||
std::vector<std::string> cookie_supported_schemes_;
|
CefCookieStoreOwnerSource* cookie_source_ = nullptr;
|
||||||
|
|
||||||
std::vector<CefRefPtr<CefRequestContextHandler>> handler_list_;
|
std::vector<CefRefPtr<CefRequestContextHandler>> handler_list_;
|
||||||
|
|
||||||
|
@@ -5,6 +5,7 @@
|
|||||||
#include "libcef/browser/net/url_request_context_proxy.h"
|
#include "libcef/browser/net/url_request_context_proxy.h"
|
||||||
|
|
||||||
#include "libcef/browser/net/cookie_store_proxy.h"
|
#include "libcef/browser/net/cookie_store_proxy.h"
|
||||||
|
#include "libcef/browser/net/cookie_store_source.h"
|
||||||
#include "libcef/browser/net/url_request_context_impl.h"
|
#include "libcef/browser/net/url_request_context_impl.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
|
|
||||||
@@ -16,7 +17,8 @@ CefURLRequestContextProxy::CefURLRequestContextProxy(
|
|||||||
DCHECK(handler.get());
|
DCHECK(handler.get());
|
||||||
|
|
||||||
// Cookie store that proxies to the browser implementation.
|
// Cookie store that proxies to the browser implementation.
|
||||||
cookie_store_proxy_.reset(new CefCookieStoreProxy(parent, handler));
|
cookie_store_proxy_.reset(new CefCookieStoreProxy(
|
||||||
|
std::make_unique<CefCookieStoreHandlerSource>(parent, handler)));
|
||||||
set_cookie_store(cookie_store_proxy_.get());
|
set_cookie_store(cookie_store_proxy_.get());
|
||||||
|
|
||||||
// All other values refer to the parent request context.
|
// All other values refer to the parent request context.
|
||||||
|
@@ -192,15 +192,7 @@ bool CefBrowserPlatformDelegateOsr::IsViewsHosted() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserPlatformDelegateOsr::WasHidden(bool hidden) {
|
void CefBrowserPlatformDelegateOsr::WasHidden(bool hidden) {
|
||||||
CefRenderWidgetHostViewOSR* view = GetOSRHostView();
|
// The WebContentsImpl will notify the OSR view.
|
||||||
if (view) {
|
|
||||||
if (hidden)
|
|
||||||
view->Hide();
|
|
||||||
else
|
|
||||||
view->Show();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Also notify the WebContentsImpl for consistency.
|
|
||||||
content::WebContentsImpl* web_contents =
|
content::WebContentsImpl* web_contents =
|
||||||
static_cast<content::WebContentsImpl*>(browser_->web_contents());
|
static_cast<content::WebContentsImpl*>(browser_->web_contents());
|
||||||
if (web_contents) {
|
if (web_contents) {
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
#include "content/browser/bad_message.h"
|
#include "content/browser/bad_message.h"
|
||||||
#include "content/browser/compositor/image_transport_factory.h"
|
#include "content/browser/compositor/image_transport_factory.h"
|
||||||
#include "content/browser/frame_host/render_widget_host_view_guest.h"
|
#include "content/browser/frame_host/render_widget_host_view_guest.h"
|
||||||
|
#include "content/browser/renderer_host/cursor_manager.h"
|
||||||
#include "content/browser/renderer_host/dip_util.h"
|
#include "content/browser/renderer_host/dip_util.h"
|
||||||
#include "content/browser/renderer_host/render_widget_host_delegate.h"
|
#include "content/browser/renderer_host/render_widget_host_delegate.h"
|
||||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||||
@@ -245,7 +246,6 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
|||||||
// Matching the attributes from BrowserCompositorMac.
|
// Matching the attributes from BrowserCompositorMac.
|
||||||
delegated_frame_host_ = std::make_unique<content::DelegatedFrameHost>(
|
delegated_frame_host_ = std::make_unique<content::DelegatedFrameHost>(
|
||||||
AllocateFrameSinkId(is_guest_view_hack), this,
|
AllocateFrameSinkId(is_guest_view_hack), this,
|
||||||
base::FeatureList::IsEnabled(features::kVizDisplayCompositor),
|
|
||||||
true /* should_register_frame_sink_id */);
|
true /* should_register_frame_sink_id */);
|
||||||
|
|
||||||
root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
|
root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
|
||||||
@@ -278,6 +278,8 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
|||||||
if (browser_impl_.get())
|
if (browser_impl_.get())
|
||||||
ResizeRootLayer(false);
|
ResizeRootLayer(false);
|
||||||
|
|
||||||
|
cursor_manager_.reset(new content::CursorManager(this));
|
||||||
|
|
||||||
// Do this last because it may result in a call to SetNeedsBeginFrames.
|
// Do this last because it may result in a call to SetNeedsBeginFrames.
|
||||||
render_widget_host_->SetView(this);
|
render_widget_host_->SetView(this);
|
||||||
}
|
}
|
||||||
@@ -291,7 +293,7 @@ CefRenderWidgetHostViewOSR::~CefRenderWidgetHostViewOSR() {
|
|||||||
// necessary to remove all connections to its old ui::Compositor.
|
// necessary to remove all connections to its old ui::Compositor.
|
||||||
if (is_showing_)
|
if (is_showing_)
|
||||||
delegated_frame_host_->WasHidden();
|
delegated_frame_host_->WasHidden();
|
||||||
delegated_frame_host_->ResetCompositor();
|
delegated_frame_host_->DetachFromCompositor();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PlatformDestroyCompositorWidget();
|
PlatformDestroyCompositorWidget();
|
||||||
@@ -362,7 +364,7 @@ void CefRenderWidgetHostViewOSR::Show() {
|
|||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
browser_compositor_->SetRenderWidgetHostIsHidden(false);
|
browser_compositor_->SetRenderWidgetHostIsHidden(false);
|
||||||
#else
|
#else
|
||||||
delegated_frame_host_->SetCompositor(compositor_.get());
|
delegated_frame_host_->AttachToCompositor(compositor_.get());
|
||||||
delegated_frame_host_->WasShown(GetLocalSurfaceId(),
|
delegated_frame_host_->WasShown(GetLocalSurfaceId(),
|
||||||
GetRootLayer()->bounds().size(), false);
|
GetRootLayer()->bounds().size(), false);
|
||||||
#endif
|
#endif
|
||||||
@@ -387,7 +389,7 @@ void CefRenderWidgetHostViewOSR::Hide() {
|
|||||||
browser_compositor_->SetRenderWidgetHostIsHidden(true);
|
browser_compositor_->SetRenderWidgetHostIsHidden(true);
|
||||||
#else
|
#else
|
||||||
GetDelegatedFrameHost()->WasHidden();
|
GetDelegatedFrameHost()->WasHidden();
|
||||||
GetDelegatedFrameHost()->ResetCompositor();
|
GetDelegatedFrameHost()->DetachFromCompositor();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
is_showing_ = false;
|
is_showing_ = false;
|
||||||
@@ -536,6 +538,10 @@ void CefRenderWidgetHostViewOSR::ClearCompositorFrame() {
|
|||||||
GetDelegatedFrameHost()->ClearDelegatedFrame();
|
GetDelegatedFrameHost()->ClearDelegatedFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefRenderWidgetHostViewOSR::ResetFallbackToFirstNavigationSurface() {
|
||||||
|
GetDelegatedFrameHost()->ResetFallbackToFirstNavigationSurface();
|
||||||
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::InitAsPopup(
|
void CefRenderWidgetHostViewOSR::InitAsPopup(
|
||||||
content::RenderWidgetHostView* parent_host_view,
|
content::RenderWidgetHostView* parent_host_view,
|
||||||
const gfx::Rect& pos) {
|
const gfx::Rect& pos) {
|
||||||
@@ -633,6 +639,10 @@ void CefRenderWidgetHostViewOSR::UpdateCursor(
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
content::CursorManager* CefRenderWidgetHostViewOSR::GetCursorManager() {
|
||||||
|
return cursor_manager_.get();
|
||||||
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::SetIsLoading(bool is_loading) {}
|
void CefRenderWidgetHostViewOSR::SetIsLoading(bool is_loading) {}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::RenderProcessGone(
|
void CefRenderWidgetHostViewOSR::RenderProcessGone(
|
||||||
@@ -759,12 +769,6 @@ CefRenderWidgetHostViewOSR::CreateBrowserAccessibilityManager(
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(TOOLKIT_VIEWS) || defined(USE_AURA)
|
|
||||||
void CefRenderWidgetHostViewOSR::ShowDisambiguationPopup(
|
|
||||||
const gfx::Rect& rect_pixels,
|
|
||||||
const SkBitmap& zoomed_bitmap) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::ImeSetComposition(
|
void CefRenderWidgetHostViewOSR::ImeSetComposition(
|
||||||
const CefString& text,
|
const CefString& text,
|
||||||
const std::vector<CefCompositionUnderline>& underlines,
|
const std::vector<CefCompositionUnderline>& underlines,
|
||||||
@@ -913,11 +917,7 @@ bool CefRenderWidgetHostViewOSR::TransformPointToCoordSpaceForView(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// In TransformPointToLocalCoordSpace() there is a Point-to-Pixel conversion,
|
return false;
|
||||||
// but it is not necessary here because the final target view is responsible
|
|
||||||
// for converting before computing the final transform.
|
|
||||||
return GetDelegatedFrameHost()->TransformPointToCoordSpaceForView(
|
|
||||||
point, target_view, transformed_point, source);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::DidNavigate() {
|
void CefRenderWidgetHostViewOSR::DidNavigate() {
|
||||||
@@ -952,7 +952,8 @@ ui::Layer* CefRenderWidgetHostViewOSR::DelegatedFrameHostGetLayer() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CefRenderWidgetHostViewOSR::DelegatedFrameHostIsVisible() const {
|
bool CefRenderWidgetHostViewOSR::DelegatedFrameHostIsVisible() const {
|
||||||
return !render_widget_host_->is_hidden();
|
// Called indirectly from DelegatedFrameHost::WasShown.
|
||||||
|
return is_showing_;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkColor CefRenderWidgetHostViewOSR::DelegatedFrameHostGetGutterColor() const {
|
SkColor CefRenderWidgetHostViewOSR::DelegatedFrameHostGetGutterColor() const {
|
||||||
@@ -979,10 +980,6 @@ void CefRenderWidgetHostViewOSR::OnFrameTokenChanged(uint32_t frame_token) {
|
|||||||
render_widget_host_->DidProcessFrame(frame_token);
|
render_widget_host_->DidProcessFrame(frame_token);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::DidReceiveFirstFrameAfterNavigation() {
|
|
||||||
render_widget_host_->DidReceiveFirstFrameAfterNavigation();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // !defined(OS_MACOSX)
|
#endif // !defined(OS_MACOSX)
|
||||||
|
|
||||||
bool CefRenderWidgetHostViewOSR::InstallTransparency() {
|
bool CefRenderWidgetHostViewOSR::InstallTransparency() {
|
||||||
|
@@ -34,11 +34,17 @@
|
|||||||
#include "ui/gfx/win/window_impl.h"
|
#include "ui/gfx/win/window_impl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(USE_AURA)
|
||||||
|
#include "third_party/blink/public/platform/web_cursor_info.h"
|
||||||
|
#include "ui/base/cursor/cursor.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
class RenderWidgetHost;
|
class RenderWidgetHost;
|
||||||
class RenderWidgetHostImpl;
|
class RenderWidgetHostImpl;
|
||||||
class RenderWidgetHostViewGuest;
|
class RenderWidgetHostViewGuest;
|
||||||
class BackingStore;
|
class BackingStore;
|
||||||
|
class CursorManager;
|
||||||
} // namespace content
|
} // namespace content
|
||||||
|
|
||||||
class CefBeginFrameTimer;
|
class CefBeginFrameTimer;
|
||||||
@@ -135,6 +141,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
|||||||
viz::CompositorFrame frame,
|
viz::CompositorFrame frame,
|
||||||
base::Optional<viz::HitTestRegionList> hit_test_region_list) override;
|
base::Optional<viz::HitTestRegionList> hit_test_region_list) override;
|
||||||
void ClearCompositorFrame() override;
|
void ClearCompositorFrame() override;
|
||||||
|
void ResetFallbackToFirstNavigationSurface() override;
|
||||||
void InitAsPopup(content::RenderWidgetHostView* parent_host_view,
|
void InitAsPopup(content::RenderWidgetHostView* parent_host_view,
|
||||||
const gfx::Rect& pos) override;
|
const gfx::Rect& pos) override;
|
||||||
void InitAsFullscreen(
|
void InitAsFullscreen(
|
||||||
@@ -147,6 +154,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
|||||||
int error_code) override;
|
int error_code) override;
|
||||||
void Destroy() override;
|
void Destroy() override;
|
||||||
void SetTooltipText(const base::string16& tooltip_text) override;
|
void SetTooltipText(const base::string16& tooltip_text) override;
|
||||||
|
content::CursorManager* GetCursorManager() override;
|
||||||
|
|
||||||
gfx::Size GetCompositorViewportPixelSize() const override;
|
gfx::Size GetCompositorViewportPixelSize() const override;
|
||||||
void CopyFromSurface(
|
void CopyFromSurface(
|
||||||
@@ -165,10 +173,6 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
|||||||
content::BrowserAccessibilityDelegate* delegate,
|
content::BrowserAccessibilityDelegate* delegate,
|
||||||
bool for_root_frame) override;
|
bool for_root_frame) override;
|
||||||
|
|
||||||
#if defined(TOOLKIT_VIEWS) || defined(USE_AURA)
|
|
||||||
void ShowDisambiguationPopup(const gfx::Rect& rect_pixels,
|
|
||||||
const SkBitmap& zoomed_bitmap) override;
|
|
||||||
#endif
|
|
||||||
void ImeCompositionRangeChanged(
|
void ImeCompositionRangeChanged(
|
||||||
const gfx::Range& range,
|
const gfx::Range& range,
|
||||||
const std::vector<gfx::Rect>& character_bounds) override;
|
const std::vector<gfx::Rect>& character_bounds) override;
|
||||||
@@ -206,7 +210,6 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
|||||||
void OnFirstSurfaceActivation(const viz::SurfaceInfo& surface_info) override;
|
void OnFirstSurfaceActivation(const viz::SurfaceInfo& surface_info) override;
|
||||||
void OnBeginFrame(base::TimeTicks frame_time) override;
|
void OnBeginFrame(base::TimeTicks frame_time) override;
|
||||||
void OnFrameTokenChanged(uint32_t frame_token) override;
|
void OnFrameTokenChanged(uint32_t frame_token) override;
|
||||||
void DidReceiveFirstFrameAfterNavigation() override;
|
|
||||||
#endif // !defined(OS_MACOSX)
|
#endif // !defined(OS_MACOSX)
|
||||||
|
|
||||||
bool InstallTransparency();
|
bool InstallTransparency();
|
||||||
@@ -345,6 +348,8 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
|||||||
std::unique_ptr<ui::XScopedCursor> invisible_cursor_;
|
std::unique_ptr<ui::XScopedCursor> invisible_cursor_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
std::unique_ptr<content::CursorManager> cursor_manager_;
|
||||||
|
|
||||||
// Used to control the VSync rate in subprocesses when BeginFrame scheduling
|
// Used to control the VSync rate in subprocesses when BeginFrame scheduling
|
||||||
// is enabled.
|
// is enabled.
|
||||||
std::unique_ptr<CefBeginFrameTimer> begin_frame_timer_;
|
std::unique_ptr<CefBeginFrameTimer> begin_frame_timer_;
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include "base/compiler_specific.h"
|
#include "base/compiler_specific.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
|
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||||
#include "content/common/view_messages.h"
|
#include "content/common/view_messages.h"
|
||||||
#include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
|
#include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
|
||||||
#include "ui/display/screen.h"
|
#include "ui/display/screen.h"
|
||||||
@@ -44,10 +45,6 @@ class MacHelper : public content::BrowserCompositorMacClient,
|
|||||||
view_->render_widget_host()->DidProcessFrame(frame_token);
|
view_->render_widget_host()->DidProcessFrame(frame_token);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DidReceiveFirstFrameAfterNavigation() override {
|
|
||||||
view_->render_widget_host()->DidReceiveFirstFrameAfterNavigation();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DestroyCompositorForShutdown() override {}
|
void DestroyCompositorForShutdown() override {}
|
||||||
|
|
||||||
bool SynchronizeVisualProperties(
|
bool SynchronizeVisualProperties(
|
||||||
@@ -171,8 +168,8 @@ void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget(
|
|||||||
|
|
||||||
mac_helper_ = new MacHelper(this);
|
mac_helper_ = new MacHelper(this);
|
||||||
browser_compositor_.reset(new content::BrowserCompositorMac(
|
browser_compositor_.reset(new content::BrowserCompositorMac(
|
||||||
mac_helper_, mac_helper_, render_widget_host_->is_hidden(), true,
|
mac_helper_, mac_helper_, render_widget_host_->is_hidden(), GetDisplay(),
|
||||||
GetDisplay(), AllocateFrameSinkId(is_guest_view_hack)));
|
AllocateFrameSinkId(is_guest_view_hack)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() {
|
void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() {
|
||||||
|
@@ -13,8 +13,9 @@
|
|||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
#include "base/strings/string_number_conversions.h"
|
||||||
#include "base/task_scheduler/post_task.h"
|
#include "base/task/post_task.h"
|
||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
|
#include "chrome/browser/accessibility/accessibility_ui.h"
|
||||||
#include "chrome/browser/net/prediction_options.h"
|
#include "chrome/browser/net/prediction_options.h"
|
||||||
#include "chrome/browser/plugins/plugin_info_host_impl.h"
|
#include "chrome/browser/plugins/plugin_info_host_impl.h"
|
||||||
#include "chrome/browser/prefs/chrome_command_line_pref_store.h"
|
#include "chrome/browser/prefs/chrome_command_line_pref_store.h"
|
||||||
@@ -86,7 +87,7 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
|||||||
const base::FilePath& pref_path =
|
const base::FilePath& pref_path =
|
||||||
cache_path.AppendASCII(browser_prefs::kUserPrefsFileName);
|
cache_path.AppendASCII(browser_prefs::kUserPrefsFileName);
|
||||||
scoped_refptr<JsonPrefStore> json_pref_store = new JsonPrefStore(
|
scoped_refptr<JsonPrefStore> json_pref_store = new JsonPrefStore(
|
||||||
pref_path, sequenced_task_runner, std::unique_ptr<PrefFilter>());
|
pref_path, std::unique_ptr<PrefFilter>(), sequenced_task_runner);
|
||||||
factory.set_user_prefs(json_pref_store.get());
|
factory.set_user_prefs(json_pref_store.get());
|
||||||
} else {
|
} else {
|
||||||
scoped_refptr<CefPrefStore> cef_pref_store = new CefPrefStore();
|
scoped_refptr<CefPrefStore> cef_pref_store = new CefPrefStore();
|
||||||
@@ -142,6 +143,7 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
|||||||
->RegisterProfilePrefsForServices(profile, registry.get());
|
->RegisterProfilePrefsForServices(profile, registry.get());
|
||||||
|
|
||||||
// Default preferences.
|
// Default preferences.
|
||||||
|
AccessibilityUIMessageHandler::RegisterProfilePrefs(registry.get());
|
||||||
CefMediaCaptureDevicesDispatcher::RegisterPrefs(registry.get());
|
CefMediaCaptureDevicesDispatcher::RegisterPrefs(registry.get());
|
||||||
CefURLRequestContextGetterImpl::RegisterPrefs(registry.get());
|
CefURLRequestContextGetterImpl::RegisterPrefs(registry.get());
|
||||||
chrome_browser_net::RegisterPredictionOptionsProfilePrefs(registry.get());
|
chrome_browser_net::RegisterPredictionOptionsProfilePrefs(registry.get());
|
||||||
|
@@ -94,9 +94,12 @@ void CefPrefStore::ReadPrefsAsync(ReadErrorDelegate* error_delegate) {
|
|||||||
NotifyInitializationCompleted();
|
NotifyInitializationCompleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefPrefStore::CommitPendingWrite(base::OnceClosure done_callback) {
|
void CefPrefStore::CommitPendingWrite(
|
||||||
|
base::OnceClosure done_callback,
|
||||||
|
base::OnceClosure synchronous_done_callback) {
|
||||||
committed_ = true;
|
committed_ = true;
|
||||||
PersistentPrefStore::CommitPendingWrite(std::move(done_callback));
|
PersistentPrefStore::CommitPendingWrite(std::move(done_callback),
|
||||||
|
std::move(synchronous_done_callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefPrefStore::SchedulePendingLossyWrites() {}
|
void CefPrefStore::SchedulePendingLossyWrites() {}
|
||||||
|
@@ -45,7 +45,9 @@ class CefPrefStore : public PersistentPrefStore {
|
|||||||
PrefReadError GetReadError() const override;
|
PrefReadError GetReadError() const override;
|
||||||
PersistentPrefStore::PrefReadError ReadPrefs() override;
|
PersistentPrefStore::PrefReadError ReadPrefs() override;
|
||||||
void ReadPrefsAsync(ReadErrorDelegate* error_delegate) override;
|
void ReadPrefsAsync(ReadErrorDelegate* error_delegate) override;
|
||||||
virtual void CommitPendingWrite(base::OnceClosure done_callback) override;
|
virtual void CommitPendingWrite(
|
||||||
|
base::OnceClosure done_callback,
|
||||||
|
base::OnceClosure synchronous_done_callback) override;
|
||||||
void SchedulePendingLossyWrites() override;
|
void SchedulePendingLossyWrites() override;
|
||||||
void ClearMutableValues() override;
|
void ClearMutableValues() override;
|
||||||
void OnStoreDeletionFromDisk() override;
|
void OnStoreDeletionFromDisk() override;
|
||||||
@@ -109,7 +111,7 @@ class CefPrefStore : public PersistentPrefStore {
|
|||||||
bool committed_;
|
bool committed_;
|
||||||
|
|
||||||
std::unique_ptr<ReadErrorDelegate> error_delegate_;
|
std::unique_ptr<ReadErrorDelegate> error_delegate_;
|
||||||
base::ObserverList<PrefStore::Observer, true> observers_;
|
base::ObserverList<PrefStore::Observer, true>::Unchecked observers_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefPrefStore);
|
DISALLOW_COPY_AND_ASSIGN(CefPrefStore);
|
||||||
};
|
};
|
||||||
|
@@ -20,14 +20,12 @@
|
|||||||
#include "content/public/browser/render_frame_host.h"
|
#include "content/public/browser/render_frame_host.h"
|
||||||
#include "content/public/browser/render_process_host.h"
|
#include "content/public/browser/render_process_host.h"
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
#include "printing/pdf_metafile_skia.h"
|
#include "printing/metafile_skia.h"
|
||||||
|
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
|
|
||||||
using content::BrowserThread;
|
using content::BrowserThread;
|
||||||
|
|
||||||
DEFINE_WEB_CONTENTS_USER_DATA_KEY(printing::CefPrintViewManager);
|
|
||||||
|
|
||||||
namespace printing {
|
namespace printing {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -150,7 +148,7 @@ void SavePdfFile(scoped_refptr<base::RefCountedBytes> data,
|
|||||||
CEF_REQUIRE_BLOCKING();
|
CEF_REQUIRE_BLOCKING();
|
||||||
DCHECK_GT(data->size(), 0U);
|
DCHECK_GT(data->size(), 0U);
|
||||||
|
|
||||||
PdfMetafileSkia metafile;
|
MetafileSkia metafile;
|
||||||
metafile.InitFromData(static_cast<const void*>(data->front()), data->size());
|
metafile.InitFromData(static_cast<const void*>(data->front()), data->size());
|
||||||
|
|
||||||
base::File file(path,
|
base::File file(path,
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
#include "base/run_loop.h"
|
#include "base/run_loop.h"
|
||||||
#include "base/single_thread_task_runner.h"
|
#include "base/single_thread_task_runner.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "base/task_scheduler/post_task.h"
|
#include "base/task/post_task.h"
|
||||||
#include "base/threading/thread_task_runner_handle.h"
|
#include "base/threading/thread_task_runner_handle.h"
|
||||||
#include "base/timer/timer.h"
|
#include "base/timer/timer.h"
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
@@ -27,7 +27,6 @@
|
|||||||
#include "chrome/browser/printing/printer_query.h"
|
#include "chrome/browser/printing/printer_query.h"
|
||||||
#include "chrome/browser/profiles/profile.h"
|
#include "chrome/browser/profiles/profile.h"
|
||||||
#include "chrome/common/pref_names.h"
|
#include "chrome/common/pref_names.h"
|
||||||
#include "chrome/common/webui_url_constants.h"
|
|
||||||
#include "chrome/grit/generated_resources.h"
|
#include "chrome/grit/generated_resources.h"
|
||||||
#include "components/prefs/pref_service.h"
|
#include "components/prefs/pref_service.h"
|
||||||
#include "components/printing/browser/print_composite_client.h"
|
#include "components/printing/browser/print_composite_client.h"
|
||||||
@@ -43,14 +42,12 @@
|
|||||||
#include "content/public/browser/render_process_host.h"
|
#include "content/public/browser/render_process_host.h"
|
||||||
#include "content/public/browser/render_view_host.h"
|
#include "content/public/browser/render_view_host.h"
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
#include "extensions/common/constants.h"
|
|
||||||
#include "mojo/public/cpp/system/buffer.h"
|
#include "mojo/public/cpp/system/buffer.h"
|
||||||
#include "printing/buildflags/buildflags.h"
|
#include "printing/buildflags/buildflags.h"
|
||||||
#include "printing/pdf_metafile_skia.h"
|
#include "printing/metafile_skia.h"
|
||||||
#include "printing/print_settings.h"
|
#include "printing/print_settings.h"
|
||||||
#include "printing/printed_document.h"
|
#include "printing/printed_document.h"
|
||||||
#include "ui/base/l10n/l10n_util.h"
|
#include "ui/base/l10n/l10n_util.h"
|
||||||
#include "url/gurl.h"
|
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
@@ -62,18 +59,6 @@ using content::BrowserThread;
|
|||||||
|
|
||||||
namespace printing {
|
namespace printing {
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
bool PrintingPdfContent(content::RenderFrameHost* rfh) {
|
|
||||||
GURL url = rfh->GetLastCommittedURL();
|
|
||||||
// Whether it is inside print preview or pdf plugin extension.
|
|
||||||
return url.GetOrigin() == chrome::kChromeUIPrintURL ||
|
|
||||||
(url.SchemeIs(extensions::kExtensionScheme) &&
|
|
||||||
url.host_piece() == extension_misc::kPdfExtensionId);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
CefPrintViewManagerBase::CefPrintViewManagerBase(
|
CefPrintViewManagerBase::CefPrintViewManagerBase(
|
||||||
content::WebContents* web_contents)
|
content::WebContents* web_contents)
|
||||||
: PrintManager(web_contents),
|
: PrintManager(web_contents),
|
||||||
@@ -113,8 +98,7 @@ void CefPrintViewManagerBase::PrintDocument(
|
|||||||
print_job_->StartConversionToNativeFormat(print_data, page_size, content_area,
|
print_job_->StartConversionToNativeFormat(print_data, page_size, content_area,
|
||||||
offsets);
|
offsets);
|
||||||
#else
|
#else
|
||||||
std::unique_ptr<PdfMetafileSkia> metafile =
|
std::unique_ptr<MetafileSkia> metafile = std::make_unique<MetafileSkia>();
|
||||||
std::make_unique<PdfMetafileSkia>();
|
|
||||||
CHECK(metafile->InitFromData(print_data->front(), print_data->size()));
|
CHECK(metafile->InitFromData(print_data->front(), print_data->size()));
|
||||||
|
|
||||||
// Update the rendered document. It will send notifications to the listener.
|
// Update the rendered document. It will send notifications to the listener.
|
||||||
@@ -196,10 +180,9 @@ void CefPrintViewManagerBase::OnDidPrintDocument(
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto* client = PrintCompositeClient::FromWebContents(web_contents());
|
auto* client = PrintCompositeClient::FromWebContents(web_contents());
|
||||||
if (IsOopifEnabled() && !PrintingPdfContent(render_frame_host)) {
|
if (IsOopifEnabled() && print_job_->document()->settings().is_modifiable()) {
|
||||||
client->DoCompositeDocumentToPdf(
|
client->DoCompositeDocumentToPdf(
|
||||||
params.document_cookie, render_frame_host, content.metafile_data_handle,
|
params.document_cookie, render_frame_host, content,
|
||||||
content.data_size, content.subframe_content_info,
|
|
||||||
base::BindOnce(&CefPrintViewManagerBase::OnComposePdfDone,
|
base::BindOnce(&CefPrintViewManagerBase::OnComposePdfDone,
|
||||||
weak_ptr_factory_.GetWeakPtr(), params));
|
weak_ptr_factory_.GetWeakPtr(), params));
|
||||||
return;
|
return;
|
||||||
|
@@ -88,6 +88,11 @@ CefStoragePartitionProxy::GetCacheStorageContext() {
|
|||||||
return parent_->GetCacheStorageContext();
|
return parent_->GetCacheStorageContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
content::GeneratedCodeCacheContext*
|
||||||
|
CefStoragePartitionProxy::GetGeneratedCodeCacheContext() {
|
||||||
|
return parent_->GetGeneratedCodeCacheContext();
|
||||||
|
}
|
||||||
|
|
||||||
content::HostZoomMap* CefStoragePartitionProxy::GetHostZoomMap() {
|
content::HostZoomMap* CefStoragePartitionProxy::GetHostZoomMap() {
|
||||||
return parent_->GetHostZoomMap();
|
return parent_->GetHostZoomMap();
|
||||||
}
|
}
|
||||||
@@ -156,6 +161,10 @@ void CefStoragePartitionProxy::Flush() {
|
|||||||
parent_->Flush();
|
parent_->Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefStoragePartitionProxy::ResetURLLoaderFactories() {
|
||||||
|
parent_->ResetURLLoaderFactories();
|
||||||
|
}
|
||||||
|
|
||||||
void CefStoragePartitionProxy::ClearBluetoothAllowedDevicesMapForTesting() {
|
void CefStoragePartitionProxy::ClearBluetoothAllowedDevicesMapForTesting() {
|
||||||
parent_->ClearBluetoothAllowedDevicesMapForTesting();
|
parent_->ClearBluetoothAllowedDevicesMapForTesting();
|
||||||
}
|
}
|
||||||
|
@@ -40,6 +40,7 @@ class CefStoragePartitionProxy : public content::StoragePartition {
|
|||||||
content::ServiceWorkerContext* GetServiceWorkerContext() override;
|
content::ServiceWorkerContext* GetServiceWorkerContext() override;
|
||||||
content::SharedWorkerService* GetSharedWorkerService() override;
|
content::SharedWorkerService* GetSharedWorkerService() override;
|
||||||
content::CacheStorageContext* GetCacheStorageContext() override;
|
content::CacheStorageContext* GetCacheStorageContext() override;
|
||||||
|
content::GeneratedCodeCacheContext* GetGeneratedCodeCacheContext() override;
|
||||||
content::HostZoomMap* GetHostZoomMap() override;
|
content::HostZoomMap* GetHostZoomMap() override;
|
||||||
content::HostZoomLevelContext* GetHostZoomLevelContext() override;
|
content::HostZoomLevelContext* GetHostZoomLevelContext() override;
|
||||||
content::ZoomLevelDelegate* GetZoomLevelDelegate() override;
|
content::ZoomLevelDelegate* GetZoomLevelDelegate() override;
|
||||||
@@ -69,6 +70,7 @@ class CefStoragePartitionProxy : public content::StoragePartition {
|
|||||||
const base::Callback<bool(const GURL&)>& url_matcher,
|
const base::Callback<bool(const GURL&)>& url_matcher,
|
||||||
base::OnceClosure callback) override;
|
base::OnceClosure callback) override;
|
||||||
void Flush() override;
|
void Flush() override;
|
||||||
|
void ResetURLLoaderFactories() override;
|
||||||
void ClearBluetoothAllowedDevicesMapForTesting() override;
|
void ClearBluetoothAllowedDevicesMapForTesting() override;
|
||||||
void FlushNetworkInterfaceForTesting() override;
|
void FlushNetworkInterfaceForTesting() override;
|
||||||
void WaitForDeletionTasksForTesting() override;
|
void WaitForDeletionTasksForTesting() override;
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include "base/location.h"
|
#include "base/location.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/task_scheduler/post_task.h"
|
#include "base/task/post_task.h"
|
||||||
#include "base/threading/thread_restrictions.h"
|
#include "base/threading/thread_restrictions.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
// Post a blocking task where the user won't notice if it takes an arbitrarily
|
// Post a blocking task where the user won't notice if it takes an arbitrarily
|
||||||
// long time to complete.
|
// long time to complete.
|
||||||
#define CEF_POST_BACKGROUND_TASK(task) \
|
#define CEF_POST_BACKGROUND_TASK(task) \
|
||||||
CEF_POST_BLOCKING_TASK(base::TaskPriority::BACKGROUND, task)
|
CEF_POST_BLOCKING_TASK(base::TaskPriority::BEST_EFFORT, task)
|
||||||
|
|
||||||
// Assert that blocking is allowed on the current thread.
|
// Assert that blocking is allowed on the current thread.
|
||||||
#define CEF_REQUIRE_BLOCKING() base::AssertBlockingAllowed()
|
#define CEF_REQUIRE_BLOCKING() base::AssertBlockingAllowed()
|
||||||
@@ -87,6 +87,9 @@
|
|||||||
return false; \
|
return false; \
|
||||||
} \
|
} \
|
||||||
bool HasOneRef() const OVERRIDE { return ref_count_.HasOneRef(); } \
|
bool HasOneRef() const OVERRIDE { return ref_count_.HasOneRef(); } \
|
||||||
|
bool HasAtLeastOneRef() const OVERRIDE { \
|
||||||
|
return ref_count_.HasAtLeastOneRef(); \
|
||||||
|
} \
|
||||||
\
|
\
|
||||||
private: \
|
private: \
|
||||||
CefRefCount ref_count_;
|
CefRefCount ref_count_;
|
||||||
|
@@ -323,7 +323,7 @@ void CefWindowView::CreateWidget() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Atom mwmHintsProperty = XInternAtom(display, "_MOTIF_WM_HINTS", 0);
|
Atom mwmHintsProperty = XInternAtom(display, "_MOTIF_WM_HINTS", 0);
|
||||||
struct MwmHints hints;
|
struct MwmHints hints = {};
|
||||||
hints.flags = MWM_HINTS_DECORATIONS;
|
hints.flags = MWM_HINTS_DECORATIONS;
|
||||||
hints.decorations = 0;
|
hints.decorations = 0;
|
||||||
XChangeProperty(display, window, mwmHintsProperty, mwmHintsProperty, 32,
|
XChangeProperty(display, window, mwmHintsProperty, mwmHintsProperty, 32,
|
||||||
|
@@ -96,9 +96,6 @@ CefString CefDragDataImpl::GetFragmentBaseURL() {
|
|||||||
|
|
||||||
CefString CefDragDataImpl::GetFileName() {
|
CefString CefDragDataImpl::GetFileName() {
|
||||||
base::AutoLock lock_scope(lock_);
|
base::AutoLock lock_scope(lock_);
|
||||||
if (data_.file_contents_content_disposition.empty())
|
|
||||||
return CefString();
|
|
||||||
|
|
||||||
base::Optional<base::FilePath> filename =
|
base::Optional<base::FilePath> filename =
|
||||||
data_.GetSafeFilenameForImageFileContents();
|
data_.GetSafeFilenameForImageFileContents();
|
||||||
return filename ? CefString(filename->value()) : CefString();
|
return filename ? CefString(filename->value()) : CefString();
|
||||||
|
@@ -18,20 +18,18 @@ import("//tools/json_schema_compiler/json_features.gni")
|
|||||||
#schema_include_rules = "//cef/libcef/browser/extensions/api:extensions::api::cef::%(namespace)s"
|
#schema_include_rules = "//cef/libcef/browser/extensions/api:extensions::api::cef::%(namespace)s"
|
||||||
#schema_dependencies = [ "//extensions/common/api" ]
|
#schema_dependencies = [ "//extensions/common/api" ]
|
||||||
#
|
#
|
||||||
#json_schema_api("api") {
|
#generated_json_strings("api") {
|
||||||
# sources = schema_sources
|
# sources = schema_sources
|
||||||
# schemas = true
|
# schemas = true
|
||||||
# bundle = true
|
|
||||||
# configs = [ "//build/config:precompiled_headers" ]
|
# configs = [ "//build/config:precompiled_headers" ]
|
||||||
# bundle_name = "Cef"
|
# bundle_name = "Cef"
|
||||||
#
|
#
|
||||||
# deps = schema_dependencies
|
# deps = schema_dependencies
|
||||||
#}
|
#}
|
||||||
#
|
#
|
||||||
#json_schema_api("api_registration") {
|
#function_registration("api_registration") {
|
||||||
# sources = schema_sources
|
# sources = schema_sources
|
||||||
# impl_dir = "//cef/libcef/browser/extensions/api"
|
# impl_dir = "//cef/libcef/browser/extensions/api"
|
||||||
# bundle_registration = true
|
|
||||||
# configs = [ "//build/config:precompiled_headers" ]
|
# configs = [ "//build/config:precompiled_headers" ]
|
||||||
# bundle_name = "Cef"
|
# bundle_name = "Cef"
|
||||||
#
|
#
|
||||||
|
89
libcef/common/extensions/extensions_api_provider.cc
Normal file
89
libcef/common/extensions/extensions_api_provider.cc
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
// Copyright 2018 The Chromium Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "libcef/common/extensions/extensions_api_provider.h"
|
||||||
|
|
||||||
|
#include "libcef/common/extensions/chrome_generated_schemas.h"
|
||||||
|
|
||||||
|
#include "cef/grit/cef_resources.h"
|
||||||
|
//#include "cef/libcef/common/extensions/api/generated_schemas.h"
|
||||||
|
#include "cef/libcef/common/extensions/api/cef_api_features.h"
|
||||||
|
#include "cef/libcef/common/extensions/api/cef_manifest_features.h"
|
||||||
|
#include "cef/libcef/common/extensions/api/cef_permission_features.h"
|
||||||
|
#include "chrome/common/extensions/chrome_aliases.h"
|
||||||
|
#include "chrome/common/extensions/chrome_manifest_handlers.h"
|
||||||
|
#include "extensions/common/features/json_feature_provider_source.h"
|
||||||
|
#include "extensions/common/permissions/permissions_info.h"
|
||||||
|
|
||||||
|
namespace extensions {
|
||||||
|
|
||||||
|
CefExtensionsAPIProvider::CefExtensionsAPIProvider() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefExtensionsAPIProvider::AddAPIFeatures(FeatureProvider* provider) {
|
||||||
|
AddCEFAPIFeatures(provider);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefExtensionsAPIProvider::AddManifestFeatures(
|
||||||
|
FeatureProvider* provider) {
|
||||||
|
AddCEFManifestFeatures(provider);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefExtensionsAPIProvider::AddPermissionFeatures(
|
||||||
|
FeatureProvider* provider) {
|
||||||
|
AddCEFPermissionFeatures(provider);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefExtensionsAPIProvider::AddBehaviorFeatures(
|
||||||
|
FeatureProvider* provider) {
|
||||||
|
// No CEF-specific behavior features.
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefExtensionsAPIProvider::AddAPIJSONSources(
|
||||||
|
JSONFeatureProviderSource* json_source) {
|
||||||
|
// Extension API features specific to CEF. See
|
||||||
|
// libcef/common/extensions/api/README.txt for additional details.
|
||||||
|
json_source->LoadJSON(IDR_CEF_EXTENSION_API_FEATURES);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CefExtensionsAPIProvider::IsAPISchemaGenerated(const std::string& name) {
|
||||||
|
// Schema for CEF-only APIs.
|
||||||
|
// TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
|
||||||
|
// libcef/common/extensions/api/README.txt for details.
|
||||||
|
// if (api::cef::CefGeneratedSchemas::IsGenerated(name))
|
||||||
|
// return true;
|
||||||
|
|
||||||
|
// Chrome APIs whitelisted by CEF.
|
||||||
|
if (api::cef::ChromeGeneratedSchemas::IsGenerated(name))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
base::StringPiece CefExtensionsAPIProvider::GetAPISchema(
|
||||||
|
const std::string& name) {
|
||||||
|
// Schema for CEF-only APIs.
|
||||||
|
// TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
|
||||||
|
// libcef/common/extensions/api/README.txt for details.
|
||||||
|
// if (api::cef::CefGeneratedSchemas::IsGenerated(name))
|
||||||
|
// return api::cef::CefGeneratedSchemas::Get(name);
|
||||||
|
|
||||||
|
// Chrome APIs whitelisted by CEF.
|
||||||
|
if (api::cef::ChromeGeneratedSchemas::IsGenerated(name))
|
||||||
|
return api::cef::ChromeGeneratedSchemas::Get(name);
|
||||||
|
|
||||||
|
return base::StringPiece();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefExtensionsAPIProvider::AddPermissionsProviders(
|
||||||
|
PermissionsInfo* permissions_info) {
|
||||||
|
permissions_info->AddProvider(chrome_api_permissions_,
|
||||||
|
GetChromePermissionAliases());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefExtensionsAPIProvider::RegisterManifestHandlers() {
|
||||||
|
RegisterChromeManifestHandlers();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace extensions
|
37
libcef/common/extensions/extensions_api_provider.h
Normal file
37
libcef/common/extensions/extensions_api_provider.h
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
// Copyright 2018 The Chromium Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#ifndef CEF_LIBCEF_COMMON_EXTENSIONS_EXTENSIONS_API_PROVIDER_H_
|
||||||
|
#define CEF_LIBCEF_COMMON_EXTENSIONS_EXTENSIONS_API_PROVIDER_H_
|
||||||
|
|
||||||
|
#include "base/macros.h"
|
||||||
|
#include "chrome/common/extensions/permissions/chrome_api_permissions.h"
|
||||||
|
#include "extensions/common/extensions_api_provider.h"
|
||||||
|
|
||||||
|
namespace extensions {
|
||||||
|
|
||||||
|
class CefExtensionsAPIProvider : public ExtensionsAPIProvider {
|
||||||
|
public:
|
||||||
|
CefExtensionsAPIProvider();
|
||||||
|
|
||||||
|
// ExtensionsAPIProvider:
|
||||||
|
void AddAPIFeatures(FeatureProvider* provider) override;
|
||||||
|
void AddManifestFeatures(FeatureProvider* provider) override;
|
||||||
|
void AddPermissionFeatures(FeatureProvider* provider) override;
|
||||||
|
void AddBehaviorFeatures(FeatureProvider* provider) override;
|
||||||
|
void AddAPIJSONSources(JSONFeatureProviderSource* json_source) override;
|
||||||
|
bool IsAPISchemaGenerated(const std::string& name) override;
|
||||||
|
base::StringPiece GetAPISchema(const std::string& name) override;
|
||||||
|
void AddPermissionsProviders(PermissionsInfo* permissions_info) override;
|
||||||
|
void RegisterManifestHandlers() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
const ChromeAPIPermissions chrome_api_permissions_;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefExtensionsAPIProvider);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace extensions
|
||||||
|
|
||||||
|
#endif // CEF_LIBCEF_COMMON_EXTENSIONS_EXTENSIONS_API_PROVIDER_H_
|
@@ -8,34 +8,15 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "libcef/common/cef_switches.h"
|
#include "libcef/common/cef_switches.h"
|
||||||
#include "libcef/common/extensions/chrome_generated_schemas.h"
|
#include "libcef/common/extensions/extensions_api_provider.h"
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "cef/grit/cef_resources.h"
|
#include "extensions/common/core_extensions_api_provider.h"
|
||||||
//#include "cef/libcef/common/extensions/api/generated_schemas.h"
|
|
||||||
#include "cef/libcef/common/extensions/api/cef_api_features.h"
|
|
||||||
#include "cef/libcef/common/extensions/api/cef_manifest_features.h"
|
|
||||||
#include "cef/libcef/common/extensions/api/cef_permission_features.h"
|
|
||||||
#include "chrome/common/extensions/chrome_aliases.h"
|
|
||||||
#include "chrome/common/extensions/chrome_manifest_handlers.h"
|
|
||||||
#include "chrome/grit/common_resources.h"
|
|
||||||
#include "extensions/common/api/api_features.h"
|
|
||||||
#include "extensions/common/api/behavior_features.h"
|
|
||||||
#include "extensions/common/api/generated_schemas.h"
|
|
||||||
#include "extensions/common/api/manifest_features.h"
|
|
||||||
#include "extensions/common/api/permission_features.h"
|
|
||||||
#include "extensions/common/common_manifest_handlers.h"
|
|
||||||
#include "extensions/common/extension_urls.h"
|
#include "extensions/common/extension_urls.h"
|
||||||
#include "extensions/common/extensions_aliases.h"
|
|
||||||
#include "extensions/common/features/feature_provider.h"
|
|
||||||
#include "extensions/common/features/json_feature_provider_source.h"
|
|
||||||
#include "extensions/common/features/simple_feature.h"
|
#include "extensions/common/features/simple_feature.h"
|
||||||
#include "extensions/common/manifest_handler.h"
|
|
||||||
#include "extensions/common/permissions/permission_message_provider.h"
|
#include "extensions/common/permissions/permission_message_provider.h"
|
||||||
#include "extensions/common/permissions/permissions_info.h"
|
|
||||||
#include "extensions/common/permissions/permissions_provider.h"
|
#include "extensions/common/permissions/permissions_provider.h"
|
||||||
#include "extensions/common/url_pattern_set.h"
|
#include "extensions/common/url_pattern_set.h"
|
||||||
#include "extensions/grit/extensions_resources.h"
|
|
||||||
|
|
||||||
namespace extensions {
|
namespace extensions {
|
||||||
|
|
||||||
@@ -50,22 +31,14 @@ SimpleFeature* CreateFeature() {
|
|||||||
|
|
||||||
CefExtensionsClient::CefExtensionsClient()
|
CefExtensionsClient::CefExtensionsClient()
|
||||||
: webstore_base_url_(extension_urls::kChromeWebstoreBaseURL),
|
: webstore_base_url_(extension_urls::kChromeWebstoreBaseURL),
|
||||||
webstore_update_url_(extension_urls::kChromeWebstoreUpdateURL) {}
|
webstore_update_url_(extension_urls::kChromeWebstoreUpdateURL) {
|
||||||
|
AddAPIProvider(std::make_unique<CoreExtensionsAPIProvider>());
|
||||||
|
AddAPIProvider(std::make_unique<CefExtensionsAPIProvider>());
|
||||||
|
}
|
||||||
|
|
||||||
CefExtensionsClient::~CefExtensionsClient() {}
|
CefExtensionsClient::~CefExtensionsClient() {}
|
||||||
|
|
||||||
void CefExtensionsClient::Initialize() {
|
void CefExtensionsClient::Initialize() {}
|
||||||
RegisterCommonManifestHandlers();
|
|
||||||
RegisterChromeManifestHandlers();
|
|
||||||
ManifestHandler::FinalizeRegistration();
|
|
||||||
// TODO(jamescook): Do we need to whitelist any extensions?
|
|
||||||
|
|
||||||
// Set up permissions.
|
|
||||||
PermissionsInfo::GetInstance()->AddProvider(chrome_api_permissions_,
|
|
||||||
GetChromePermissionAliases());
|
|
||||||
PermissionsInfo::GetInstance()->AddProvider(extensions_api_permissions_,
|
|
||||||
GetExtensionsPermissionAliases());
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefExtensionsClient::InitializeWebStoreUrls(
|
void CefExtensionsClient::InitializeWebStoreUrls(
|
||||||
base::CommandLine* command_line) {}
|
base::CommandLine* command_line) {}
|
||||||
@@ -79,40 +52,6 @@ const std::string CefExtensionsClient::GetProductName() {
|
|||||||
return "cef";
|
return "cef";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<FeatureProvider> CefExtensionsClient::CreateFeatureProvider(
|
|
||||||
const std::string& name) const {
|
|
||||||
auto provider = std::make_unique<FeatureProvider>();
|
|
||||||
if (name == "api") {
|
|
||||||
AddCoreAPIFeatures(provider.get());
|
|
||||||
AddCEFAPIFeatures(provider.get());
|
|
||||||
} else if (name == "manifest") {
|
|
||||||
AddCoreManifestFeatures(provider.get());
|
|
||||||
AddCEFManifestFeatures(provider.get());
|
|
||||||
} else if (name == "permission") {
|
|
||||||
AddCorePermissionFeatures(provider.get());
|
|
||||||
AddCEFPermissionFeatures(provider.get());
|
|
||||||
} else if (name == "behavior") {
|
|
||||||
// Note: There are no CEF-specific behavior features.
|
|
||||||
AddCoreBehaviorFeatures(provider.get());
|
|
||||||
} else {
|
|
||||||
NOTREACHED();
|
|
||||||
}
|
|
||||||
return provider;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<JSONFeatureProviderSource>
|
|
||||||
CefExtensionsClient::CreateAPIFeatureSource() const {
|
|
||||||
std::unique_ptr<JSONFeatureProviderSource> source(
|
|
||||||
new JSONFeatureProviderSource("api"));
|
|
||||||
source->LoadJSON(IDR_EXTENSION_API_FEATURES);
|
|
||||||
|
|
||||||
// Extension API features specific to CEF. See
|
|
||||||
// libcef/common/extensions/api/README.txt for additional details.
|
|
||||||
source->LoadJSON(IDR_CEF_EXTENSION_API_FEATURES);
|
|
||||||
|
|
||||||
return source;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefExtensionsClient::FilterHostPermissions(
|
void CefExtensionsClient::FilterHostPermissions(
|
||||||
const URLPatternSet& hosts,
|
const URLPatternSet& hosts,
|
||||||
URLPatternSet* new_hosts,
|
URLPatternSet* new_hosts,
|
||||||
@@ -142,40 +81,6 @@ bool CefExtensionsClient::IsScriptableURL(const GURL& url,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefExtensionsClient::IsAPISchemaGenerated(const std::string& name) const {
|
|
||||||
// Schema for CEF-only APIs.
|
|
||||||
// TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
|
|
||||||
// libcef/common/extensions/api/README.txt for details.
|
|
||||||
// if (api::cef::CefGeneratedSchemas::IsGenerated(name))
|
|
||||||
// return true;
|
|
||||||
|
|
||||||
// Chrome APIs whitelisted by CEF.
|
|
||||||
if (api::cef::ChromeGeneratedSchemas::IsGenerated(name))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// Core extensions APIs.
|
|
||||||
if (api::GeneratedSchemas::IsGenerated(name))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
base::StringPiece CefExtensionsClient::GetAPISchema(
|
|
||||||
const std::string& name) const {
|
|
||||||
// Schema for CEF-only APIs.
|
|
||||||
// TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
|
|
||||||
// libcef/common/extensions/api/README.txt for details.
|
|
||||||
// if (api::cef::CefGeneratedSchemas::IsGenerated(name))
|
|
||||||
// return api::cef::CefGeneratedSchemas::Get(name);
|
|
||||||
|
|
||||||
// Chrome APIs whitelisted by CEF.
|
|
||||||
if (api::cef::ChromeGeneratedSchemas::IsGenerated(name))
|
|
||||||
return api::cef::ChromeGeneratedSchemas::Get(name);
|
|
||||||
|
|
||||||
// Core extensions APIs.
|
|
||||||
return api::GeneratedSchemas::Get(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CefExtensionsClient::ShouldSuppressFatalErrors() const {
|
bool CefExtensionsClient::ShouldSuppressFatalErrors() const {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -8,10 +8,8 @@
|
|||||||
|
|
||||||
#include "base/compiler_specific.h"
|
#include "base/compiler_specific.h"
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "chrome/common/extensions/permissions/chrome_api_permissions.h"
|
|
||||||
#include "chrome/common/extensions/permissions/chrome_permission_message_provider.h"
|
#include "chrome/common/extensions/permissions/chrome_permission_message_provider.h"
|
||||||
#include "extensions/common/extensions_client.h"
|
#include "extensions/common/extensions_client.h"
|
||||||
#include "extensions/common/permissions/extensions_api_permissions.h"
|
|
||||||
#include "url/gurl.h"
|
#include "url/gurl.h"
|
||||||
|
|
||||||
namespace extensions {
|
namespace extensions {
|
||||||
@@ -28,10 +26,6 @@ class CefExtensionsClient : public ExtensionsClient {
|
|||||||
const PermissionMessageProvider& GetPermissionMessageProvider()
|
const PermissionMessageProvider& GetPermissionMessageProvider()
|
||||||
const override;
|
const override;
|
||||||
const std::string GetProductName() override;
|
const std::string GetProductName() override;
|
||||||
std::unique_ptr<FeatureProvider> CreateFeatureProvider(
|
|
||||||
const std::string& name) const override;
|
|
||||||
std::unique_ptr<JSONFeatureProviderSource> CreateAPIFeatureSource()
|
|
||||||
const override;
|
|
||||||
void FilterHostPermissions(const URLPatternSet& hosts,
|
void FilterHostPermissions(const URLPatternSet& hosts,
|
||||||
URLPatternSet* new_hosts,
|
URLPatternSet* new_hosts,
|
||||||
PermissionIDSet* permissions) const override;
|
PermissionIDSet* permissions) const override;
|
||||||
@@ -41,8 +35,6 @@ class CefExtensionsClient : public ExtensionsClient {
|
|||||||
const Extension* extension,
|
const Extension* extension,
|
||||||
const APIPermissionSet& api_permissions) const override;
|
const APIPermissionSet& api_permissions) const override;
|
||||||
bool IsScriptableURL(const GURL& url, std::string* error) const override;
|
bool IsScriptableURL(const GURL& url, std::string* error) const override;
|
||||||
bool IsAPISchemaGenerated(const std::string& name) const override;
|
|
||||||
base::StringPiece GetAPISchema(const std::string& name) const override;
|
|
||||||
bool ShouldSuppressFatalErrors() const override;
|
bool ShouldSuppressFatalErrors() const override;
|
||||||
void RecordDidSuppressFatalError() override;
|
void RecordDidSuppressFatalError() override;
|
||||||
const GURL& GetWebstoreBaseURL() const override;
|
const GURL& GetWebstoreBaseURL() const override;
|
||||||
@@ -50,8 +42,6 @@ class CefExtensionsClient : public ExtensionsClient {
|
|||||||
bool IsBlacklistUpdateURL(const GURL& url) const override;
|
bool IsBlacklistUpdateURL(const GURL& url) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const ChromeAPIPermissions chrome_api_permissions_;
|
|
||||||
const ExtensionsAPIPermissions extensions_api_permissions_;
|
|
||||||
const ChromePermissionMessageProvider permission_message_provider_;
|
const ChromePermissionMessageProvider permission_message_provider_;
|
||||||
|
|
||||||
ScriptingWhitelist scripting_whitelist_;
|
ScriptingWhitelist scripting_whitelist_;
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "libcef/common/main_delegate.h"
|
#include "libcef/common/main_delegate.h"
|
||||||
|
#include "libcef/browser/browser_message_loop.h"
|
||||||
#include "libcef/browser/content_browser_client.h"
|
#include "libcef/browser/content_browser_client.h"
|
||||||
#include "libcef/browser/context.h"
|
#include "libcef/browser/context.h"
|
||||||
#include "libcef/common/cef_switches.h"
|
#include "libcef/common/cef_switches.h"
|
||||||
@@ -12,6 +13,7 @@
|
|||||||
#include "libcef/renderer/content_renderer_client.h"
|
#include "libcef/renderer/content_renderer_client.h"
|
||||||
#include "libcef/utility/content_utility_client.h"
|
#include "libcef/utility/content_utility_client.h"
|
||||||
|
|
||||||
|
#include "base/at_exit.h"
|
||||||
#include "base/base_switches.h"
|
#include "base/base_switches.h"
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
@@ -39,7 +41,6 @@
|
|||||||
#include "pdf/pdf_ppapi.h"
|
#include "pdf/pdf_ppapi.h"
|
||||||
#include "services/service_manager/sandbox/switches.h"
|
#include "services/service_manager/sandbox/switches.h"
|
||||||
#include "ui/base/layout.h"
|
#include "ui/base/layout.h"
|
||||||
#include "ui/base/material_design/material_design_controller.h"
|
|
||||||
#include "ui/base/resource/resource_bundle.h"
|
#include "ui/base/resource/resource_bundle.h"
|
||||||
#include "ui/base/ui_base_paths.h"
|
#include "ui/base/ui_base_paths.h"
|
||||||
#include "ui/base/ui_base_switches.h"
|
#include "ui/base/ui_base_switches.h"
|
||||||
@@ -98,6 +99,20 @@ void OverrideFrameworkBundlePath() {
|
|||||||
base::mac::SetOverrideFrameworkBundlePath(framework_path);
|
base::mac::SetOverrideFrameworkBundlePath(framework_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OverrideOuterBundlePath() {
|
||||||
|
base::FilePath bundle_path = util_mac::GetMainBundlePath();
|
||||||
|
DCHECK(!bundle_path.empty());
|
||||||
|
|
||||||
|
base::mac::SetOverrideOuterBundlePath(bundle_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OverrideBaseBundleID() {
|
||||||
|
std::string bundle_id = util_mac::GetMainBundleID();
|
||||||
|
DCHECK(!bundle_id.empty());
|
||||||
|
|
||||||
|
base::mac::SetBaseBundleID(bundle_id.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
void OverrideChildProcessPath() {
|
void OverrideChildProcessPath() {
|
||||||
base::FilePath child_process_path =
|
base::FilePath child_process_path =
|
||||||
base::CommandLine::ForCurrentProcess()->GetSwitchValuePath(
|
base::CommandLine::ForCurrentProcess()->GetSwitchValuePath(
|
||||||
@@ -266,6 +281,14 @@ class CefUIThread : public base::Thread {
|
|||||||
browser_runner_->Shutdown();
|
browser_runner_->Shutdown();
|
||||||
browser_runner_.reset(NULL);
|
browser_runner_.reset(NULL);
|
||||||
|
|
||||||
|
// Release MessagePump resources registered with the AtExitManager.
|
||||||
|
base::MessageLoop* ml = const_cast<base::MessageLoop*>(message_loop());
|
||||||
|
base::MessageLoopCurrent::UnbindFromCurrentThreadInternal(ml);
|
||||||
|
ml->ReleasePump();
|
||||||
|
|
||||||
|
// Run exit callbacks on the UI thread to avoid sequence check failures.
|
||||||
|
base::AtExitManager::ProcessCallbacksNow();
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
// Closes the COM library on the current thread. CoInitialize must
|
// Closes the COM library on the current thread. CoInitialize must
|
||||||
// be balanced by a corresponding call to CoUninitialize.
|
// be balanced by a corresponding call to CoUninitialize.
|
||||||
@@ -290,6 +313,11 @@ CefMainDelegate::CefMainDelegate(CefRefPtr<CefApp> application)
|
|||||||
|
|
||||||
CefMainDelegate::~CefMainDelegate() {}
|
CefMainDelegate::~CefMainDelegate() {}
|
||||||
|
|
||||||
|
void CefMainDelegate::PreCreateMainMessageLoop() {
|
||||||
|
// Create the main message loop.
|
||||||
|
message_loop_.reset(new CefBrowserMessageLoop());
|
||||||
|
}
|
||||||
|
|
||||||
bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
|
bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
|
||||||
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
||||||
std::string process_type =
|
std::string process_type =
|
||||||
@@ -436,29 +464,6 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
|
|||||||
switches::kUncaughtExceptionStackSize,
|
switches::kUncaughtExceptionStackSize,
|
||||||
base::IntToString(settings.uncaught_exception_stack_size));
|
base::IntToString(settings.uncaught_exception_stack_size));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
|
||||||
std::vector<std::string> disable_features;
|
|
||||||
|
|
||||||
// TODO: Remove once MacV2Sandbox is supported. See issue #2459.
|
|
||||||
if (features::kMacV2Sandbox.default_state ==
|
|
||||||
base::FEATURE_ENABLED_BY_DEFAULT) {
|
|
||||||
disable_features.push_back(features::kMacV2Sandbox.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!disable_features.empty()) {
|
|
||||||
DCHECK(!base::FeatureList::GetInstance());
|
|
||||||
std::string disable_features_str =
|
|
||||||
command_line->GetSwitchValueASCII(switches::kDisableFeatures);
|
|
||||||
for (auto feature_str : disable_features) {
|
|
||||||
if (!disable_features_str.empty())
|
|
||||||
disable_features_str += ",";
|
|
||||||
disable_features_str += feature_str;
|
|
||||||
}
|
|
||||||
command_line->AppendSwitchASCII(switches::kDisableFeatures,
|
|
||||||
disable_features_str);
|
|
||||||
}
|
|
||||||
#endif // defined(OS_MACOSX)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (content_client_.application().get()) {
|
if (content_client_.application().get()) {
|
||||||
@@ -517,6 +522,8 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
|
|||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
OverrideFrameworkBundlePath();
|
OverrideFrameworkBundlePath();
|
||||||
|
OverrideOuterBundlePath();
|
||||||
|
OverrideBaseBundleID();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -636,6 +643,9 @@ void CefMainDelegate::ShutdownBrowser() {
|
|||||||
browser_runner_->Shutdown();
|
browser_runner_->Shutdown();
|
||||||
browser_runner_.reset(NULL);
|
browser_runner_.reset(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message_loop_.reset();
|
||||||
|
|
||||||
if (ui_thread_.get()) {
|
if (ui_thread_.get()) {
|
||||||
// Blocks until the thread has stopped.
|
// Blocks until the thread has stopped.
|
||||||
ui_thread_->Stop();
|
ui_thread_->Stop();
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
namespace base {
|
namespace base {
|
||||||
class CommandLine;
|
class CommandLine;
|
||||||
|
class MessageLoop;
|
||||||
class Thread;
|
class Thread;
|
||||||
} // namespace base
|
} // namespace base
|
||||||
|
|
||||||
@@ -32,6 +33,7 @@ class CefMainDelegate : public content::ContentMainDelegate {
|
|||||||
explicit CefMainDelegate(CefRefPtr<CefApp> application);
|
explicit CefMainDelegate(CefRefPtr<CefApp> application);
|
||||||
~CefMainDelegate() override;
|
~CefMainDelegate() override;
|
||||||
|
|
||||||
|
void PreCreateMainMessageLoop() override;
|
||||||
bool BasicStartupComplete(int* exit_code) override;
|
bool BasicStartupComplete(int* exit_code) override;
|
||||||
void PreSandboxStartup() override;
|
void PreSandboxStartup() override;
|
||||||
void SandboxInitialized(const std::string& process_type) override;
|
void SandboxInitialized(const std::string& process_type) override;
|
||||||
@@ -55,6 +57,7 @@ class CefMainDelegate : public content::ContentMainDelegate {
|
|||||||
private:
|
private:
|
||||||
void InitializeResourceBundle();
|
void InitializeResourceBundle();
|
||||||
|
|
||||||
|
std::unique_ptr<base::MessageLoop> message_loop_;
|
||||||
std::unique_ptr<content::BrowserMainRunner> browser_runner_;
|
std::unique_ptr<content::BrowserMainRunner> browser_runner_;
|
||||||
std::unique_ptr<base::Thread> ui_thread_;
|
std::unique_ptr<base::Thread> ui_thread_;
|
||||||
|
|
||||||
|
@@ -3,8 +3,13 @@
|
|||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
#include "libcef/common/net/net_resource_provider.h"
|
#include "libcef/common/net/net_resource_provider.h"
|
||||||
#include "libcef/common/content_client.h"
|
|
||||||
|
#include "chrome/common/net/net_resource_provider.h"
|
||||||
|
|
||||||
base::StringPiece NetResourceProvider(int key) {
|
base::StringPiece NetResourceProvider(int key) {
|
||||||
return CefContentClient::Get()->GetDataResource(key, ui::SCALE_FACTOR_NONE);
|
// Chrome performs substitution of localized strings for directory listings.
|
||||||
|
base::StringPiece value = chrome_common_net::NetResourceProvider(key);
|
||||||
|
if (value.empty())
|
||||||
|
LOG(ERROR) << "No data resource available for id " << key;
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "base/task_scheduler/post_task.h"
|
#include "base/task/post_task.h"
|
||||||
#include "components/navigation_interception/navigation_params.h"
|
#include "components/navigation_interception/navigation_params.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/browser/resource_request_info.h"
|
#include "content/public/browser/resource_request_info.h"
|
||||||
|
@@ -6,6 +6,8 @@
|
|||||||
#define CEF_LIBCEF_COMMON_UTIL_MAC_H_
|
#define CEF_LIBCEF_COMMON_UTIL_MAC_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace base {
|
namespace base {
|
||||||
class FilePath;
|
class FilePath;
|
||||||
}
|
}
|
||||||
@@ -31,6 +33,13 @@ base::FilePath GetFrameworkResourcesDirectory();
|
|||||||
// "myapp.app/Contents/MacOS/myapp").
|
// "myapp.app/Contents/MacOS/myapp").
|
||||||
base::FilePath GetMainProcessPath();
|
base::FilePath GetMainProcessPath();
|
||||||
|
|
||||||
|
// Returns the path to the top-level app bundle that contains the main process
|
||||||
|
// executable (e.g. "myapp.app").
|
||||||
|
base::FilePath GetMainBundlePath();
|
||||||
|
|
||||||
|
// Returns the identifier for the top-level app bundle.
|
||||||
|
std::string GetMainBundleID();
|
||||||
|
|
||||||
// Returns the path to the Resources directory inside the top-level app bundle
|
// Returns the path to the Resources directory inside the top-level app bundle
|
||||||
// (e.g. "myapp.app/Contents/Resources"). May return an empty value if not
|
// (e.g. "myapp.app/Contents/Resources"). May return an empty value if not
|
||||||
// running in an app bundle.
|
// running in an app bundle.
|
||||||
|
@@ -9,19 +9,15 @@
|
|||||||
#include "base/base_paths.h"
|
#include "base/base_paths.h"
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
|
#include "base/mac/bundle_locations.h"
|
||||||
#include "base/mac/foundation_util.h"
|
#include "base/mac/foundation_util.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
|
#include "base/strings/sys_string_conversions.h"
|
||||||
|
|
||||||
namespace util_mac {
|
namespace util_mac {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// Returns the path to the top-level app bundle that contains the main process
|
|
||||||
// executable.
|
|
||||||
base::FilePath GetMainBundlePath() {
|
|
||||||
return base::mac::GetAppBundlePath(GetMainProcessPath());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the path to the Frameworks directory inside the top-level app bundle.
|
// Returns the path to the Frameworks directory inside the top-level app bundle.
|
||||||
base::FilePath GetFrameworksPath() {
|
base::FilePath GetFrameworksPath() {
|
||||||
base::FilePath bundle_path = GetMainBundlePath();
|
base::FilePath bundle_path = GetMainBundlePath();
|
||||||
@@ -68,6 +64,15 @@ base::FilePath GetMainProcessPath() {
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
base::FilePath GetMainBundlePath() {
|
||||||
|
return base::mac::GetAppBundlePath(GetMainProcessPath());
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string GetMainBundleID() {
|
||||||
|
NSBundle* bundle = base::mac::OuterBundle();
|
||||||
|
return base::SysNSStringToUTF8([bundle bundleIdentifier]);
|
||||||
|
}
|
||||||
|
|
||||||
base::FilePath GetMainResourcesDirectory() {
|
base::FilePath GetMainResourcesDirectory() {
|
||||||
base::FilePath bundle_path = GetMainBundlePath();
|
base::FilePath bundle_path = GetMainBundlePath();
|
||||||
if (bundle_path.empty())
|
if (bundle_path.empty())
|
||||||
|
@@ -553,7 +553,7 @@ size_t CefBinaryValueImpl::GetData(void* buffer,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
size = std::min(buffer_size, size - data_offset);
|
size = std::min(buffer_size, size - data_offset);
|
||||||
const char* data = const_value().GetBlob().data();
|
auto* data = const_value().GetBlob().data();
|
||||||
memcpy(buffer, data + data_offset, size);
|
memcpy(buffer, data + data_offset, size);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
@@ -5,9 +5,6 @@
|
|||||||
|
|
||||||
#include "libcef/renderer/blink_glue.h"
|
#include "libcef/renderer/blink_glue.h"
|
||||||
|
|
||||||
#include "base/compiler_specific.h"
|
|
||||||
|
|
||||||
MSVC_PUSH_WARNING_LEVEL(0);
|
|
||||||
#include "third_party/blink/public/platform/web_string.h"
|
#include "third_party/blink/public/platform/web_string.h"
|
||||||
#include "third_party/blink/public/platform/web_url_response.h"
|
#include "third_party/blink/public/platform/web_url_response.h"
|
||||||
#include "third_party/blink/public/web/web_document.h"
|
#include "third_party/blink/public/web/web_document.h"
|
||||||
@@ -32,7 +29,6 @@ MSVC_PUSH_WARNING_LEVEL(0);
|
|||||||
#include "third_party/blink/renderer/platform/bindings/v8_binding.h"
|
#include "third_party/blink/renderer/platform/bindings/v8_binding.h"
|
||||||
#include "third_party/blink/renderer/platform/loader/fetch/resource_response.h"
|
#include "third_party/blink/renderer/platform/loader/fetch/resource_response.h"
|
||||||
#include "third_party/blink/renderer/platform/weborigin/scheme_registry.h"
|
#include "third_party/blink/renderer/platform/weborigin/scheme_registry.h"
|
||||||
MSVC_POP_WARNING();
|
|
||||||
#undef LOG
|
#undef LOG
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
|
@@ -272,7 +272,7 @@ void CefContentRendererClient::WebKitInitialized() {
|
|||||||
const Cef_CrossOriginWhiteListEntry_Params& entry =
|
const Cef_CrossOriginWhiteListEntry_Params& entry =
|
||||||
cross_origin_whitelist_entries_[i];
|
cross_origin_whitelist_entries_[i];
|
||||||
GURL gurl = GURL(entry.source_origin);
|
GURL gurl = GURL(entry.source_origin);
|
||||||
blink::WebSecurityPolicy::AddOriginAccessWhitelistEntry(
|
blink::WebSecurityPolicy::AddOriginAccessAllowListEntry(
|
||||||
gurl, blink::WebString::FromUTF8(entry.target_protocol),
|
gurl, blink::WebString::FromUTF8(entry.target_protocol),
|
||||||
blink::WebString::FromUTF8(entry.target_domain),
|
blink::WebString::FromUTF8(entry.target_domain),
|
||||||
entry.allow_target_subdomains);
|
entry.allow_target_subdomains);
|
||||||
@@ -492,8 +492,7 @@ bool CefContentRendererClient::ShouldFork(blink::WebLocalFrame* frame,
|
|||||||
const GURL& url,
|
const GURL& url,
|
||||||
const std::string& http_method,
|
const std::string& http_method,
|
||||||
bool is_initial_navigation,
|
bool is_initial_navigation,
|
||||||
bool is_server_redirect,
|
bool is_server_redirect) {
|
||||||
bool* send_referrer) {
|
|
||||||
DCHECK(!frame->Parent());
|
DCHECK(!frame->Parent());
|
||||||
|
|
||||||
// For now, we skip the rest for POST submissions. This is because
|
// For now, we skip the rest for POST submissions. This is because
|
||||||
@@ -505,7 +504,7 @@ bool CefContentRendererClient::ShouldFork(blink::WebLocalFrame* frame,
|
|||||||
|
|
||||||
if (extensions::ExtensionsEnabled()) {
|
if (extensions::ExtensionsEnabled()) {
|
||||||
return extensions::CefExtensionsRendererClient::ShouldFork(
|
return extensions::CefExtensionsRendererClient::ShouldFork(
|
||||||
frame, url, is_initial_navigation, is_server_redirect, send_referrer);
|
frame, url, is_initial_navigation, is_server_redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@@ -112,8 +112,7 @@ class CefContentRendererClient : public content::ContentRendererClient,
|
|||||||
const GURL& url,
|
const GURL& url,
|
||||||
const std::string& http_method,
|
const std::string& http_method,
|
||||||
bool is_initial_navigation,
|
bool is_initial_navigation,
|
||||||
bool is_server_redirect,
|
bool is_server_redirect) override;
|
||||||
bool* send_referrer) override;
|
|
||||||
void WillSendRequest(blink::WebLocalFrame* frame,
|
void WillSendRequest(blink::WebLocalFrame* frame,
|
||||||
ui::PageTransition transition_type,
|
ui::PageTransition transition_type,
|
||||||
const blink::WebURL& url,
|
const blink::WebURL& url,
|
||||||
|
@@ -226,8 +226,7 @@ bool CefExtensionsRendererClient::IsStandaloneExtensionProcess() {
|
|||||||
bool CefExtensionsRendererClient::ShouldFork(blink::WebLocalFrame* frame,
|
bool CefExtensionsRendererClient::ShouldFork(blink::WebLocalFrame* frame,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
bool is_initial_navigation,
|
bool is_initial_navigation,
|
||||||
bool is_server_redirect,
|
bool is_server_redirect) {
|
||||||
bool* send_referrer) {
|
|
||||||
const extensions::RendererExtensionRegistry* extension_registry =
|
const extensions::RendererExtensionRegistry* extension_registry =
|
||||||
extensions::RendererExtensionRegistry::Get();
|
extensions::RendererExtensionRegistry::Get();
|
||||||
|
|
||||||
@@ -246,10 +245,6 @@ bool CefExtensionsRendererClient::ShouldFork(blink::WebLocalFrame* frame,
|
|||||||
if (!is_server_redirect &&
|
if (!is_server_redirect &&
|
||||||
CrossesExtensionExtents(frame, url, is_extension_url,
|
CrossesExtensionExtents(frame, url, is_extension_url,
|
||||||
is_initial_navigation)) {
|
is_initial_navigation)) {
|
||||||
// Include the referrer in this case since we're going from a hosted web
|
|
||||||
// page. (the packaged case is handled previously by the extension
|
|
||||||
// navigation test)
|
|
||||||
*send_referrer = true;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -72,8 +72,7 @@ class CefExtensionsRendererClient : public ExtensionsRendererClient {
|
|||||||
static bool ShouldFork(blink::WebLocalFrame* frame,
|
static bool ShouldFork(blink::WebLocalFrame* frame,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
bool is_initial_navigation,
|
bool is_initial_navigation,
|
||||||
bool is_server_redirect,
|
bool is_server_redirect);
|
||||||
bool* send_referrer);
|
|
||||||
static content::BrowserPluginDelegate* CreateBrowserPluginDelegate(
|
static content::BrowserPluginDelegate* CreateBrowserPluginDelegate(
|
||||||
content::RenderFrame* render_frame,
|
content::RenderFrame* render_frame,
|
||||||
const content::WebPluginInfo& info,
|
const content::WebPluginInfo& info,
|
||||||
|
@@ -51,9 +51,8 @@ bool CefPrintRenderFrameHelperDelegate::OverridePrint(
|
|||||||
if (!frame->GetDocument().IsPluginDocument())
|
if (!frame->GetDocument().IsPluginDocument())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::vector<extensions::MimeHandlerViewContainer*> mime_handlers =
|
auto mime_handlers = extensions::MimeHandlerViewContainer::FromRenderFrame(
|
||||||
extensions::MimeHandlerViewContainer::FromRenderFrame(
|
content::RenderFrame::FromWebFrame(frame));
|
||||||
content::RenderFrame::FromWebFrame(frame));
|
|
||||||
if (!mime_handlers.empty()) {
|
if (!mime_handlers.empty()) {
|
||||||
// This message is handled in chrome/browser/resources/pdf/pdf.js and
|
// This message is handled in chrome/browser/resources/pdf/pdf.js and
|
||||||
// instructs the PDF plugin to print. This is to make window.print() on a
|
// instructs the PDF plugin to print. This is to make window.print() on a
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include "libcef/common/cef_messages.h"
|
#include "libcef/common/cef_messages.h"
|
||||||
#include "libcef/common/net/net_resource_provider.h"
|
#include "libcef/common/net/net_resource_provider.h"
|
||||||
|
#include "libcef/renderer/blink_glue.h"
|
||||||
#include "libcef/renderer/content_renderer_client.h"
|
#include "libcef/renderer/content_renderer_client.h"
|
||||||
|
|
||||||
#include "components/visitedlink/renderer/visitedlink_slave.h"
|
#include "components/visitedlink/renderer/visitedlink_slave.h"
|
||||||
@@ -64,18 +65,15 @@ void CefRenderThreadObserver::OnModifyCrossOriginWhitelistEntry(
|
|||||||
const Cef_CrossOriginWhiteListEntry_Params& params) {
|
const Cef_CrossOriginWhiteListEntry_Params& params) {
|
||||||
GURL gurl = GURL(params.source_origin);
|
GURL gurl = GURL(params.source_origin);
|
||||||
if (add) {
|
if (add) {
|
||||||
blink::WebSecurityPolicy::AddOriginAccessWhitelistEntry(
|
blink::WebSecurityPolicy::AddOriginAccessAllowListEntry(
|
||||||
gurl, blink::WebString::FromUTF8(params.target_protocol),
|
gurl, blink::WebString::FromUTF8(params.target_protocol),
|
||||||
blink::WebString::FromUTF8(params.target_domain),
|
blink::WebString::FromUTF8(params.target_domain),
|
||||||
params.allow_target_subdomains);
|
params.allow_target_subdomains);
|
||||||
} else {
|
} else {
|
||||||
blink::WebSecurityPolicy::RemoveOriginAccessWhitelistEntry(
|
blink::WebSecurityPolicy::ClearOriginAccessAllowListForOrigin(gurl);
|
||||||
gurl, blink::WebString::FromUTF8(params.target_protocol),
|
|
||||||
blink::WebString::FromUTF8(params.target_domain),
|
|
||||||
params.allow_target_subdomains);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderThreadObserver::OnClearCrossOriginWhitelist() {
|
void CefRenderThreadObserver::OnClearCrossOriginWhitelist() {
|
||||||
blink::WebSecurityPolicy::ResetOriginAccessWhitelists();
|
blink::WebSecurityPolicy::ClearOriginAccessAllowList();
|
||||||
}
|
}
|
||||||
|
@@ -117,7 +117,8 @@ class CefRenderURLRequest::Context
|
|||||||
|
|
||||||
loader_ =
|
loader_ =
|
||||||
CefContentRendererClient::Get()->url_loader_factory()->CreateURLLoader(
|
CefContentRendererClient::Get()->url_loader_factory()->CreateURLLoader(
|
||||||
urlRequest, task_runner_.get());
|
urlRequest, blink::scheduler::WebResourceLoadingTaskRunnerHandle::
|
||||||
|
CreateUnprioritized(task_runner_.get()));
|
||||||
loader_->LoadAsynchronously(urlRequest, url_client_.get());
|
loader_->LoadAsynchronously(urlRequest, url_client_.get());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -314,6 +314,8 @@ class V8TrackArrayBuffer : public CefTrackNode {
|
|||||||
buffer_(buffer),
|
buffer_(buffer),
|
||||||
release_callback_(release_callback) {
|
release_callback_(release_callback) {
|
||||||
DCHECK(isolate_);
|
DCHECK(isolate_);
|
||||||
|
isolate_->AdjustAmountOfExternalAllocatedMemory(
|
||||||
|
static_cast<int>(sizeof(V8TrackArrayBuffer)));
|
||||||
}
|
}
|
||||||
|
|
||||||
~V8TrackArrayBuffer() {
|
~V8TrackArrayBuffer() {
|
||||||
@@ -330,6 +332,13 @@ class V8TrackArrayBuffer : public CefTrackNode {
|
|||||||
|
|
||||||
void Neuter() { buffer_ = nullptr; }
|
void Neuter() { buffer_ = nullptr; }
|
||||||
|
|
||||||
|
// Attach this track object to the specified V8 object.
|
||||||
|
void AttachTo(v8::Local<v8::Context> context,
|
||||||
|
v8::Local<v8::ArrayBuffer> arrayBuffer) {
|
||||||
|
SetPrivate(context, arrayBuffer, kCefTrackObject,
|
||||||
|
v8::External::New(isolate_, this));
|
||||||
|
}
|
||||||
|
|
||||||
// Retrieve the track object for the specified V8 object.
|
// Retrieve the track object for the specified V8 object.
|
||||||
static V8TrackArrayBuffer* Unwrap(v8::Local<v8::Context> context,
|
static V8TrackArrayBuffer* Unwrap(v8::Local<v8::Context> context,
|
||||||
v8::Local<v8::Object> object) {
|
v8::Local<v8::Object> object) {
|
||||||
@@ -341,35 +350,10 @@ class V8TrackArrayBuffer : public CefTrackNode {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attach this track object to the specified V8 object.
|
|
||||||
void AttachTo(v8::Local<v8::Context> context,
|
|
||||||
v8::Local<v8::ArrayBuffer> arrayBuffer) {
|
|
||||||
isolate_->AdjustAmountOfExternalAllocatedMemory(
|
|
||||||
static_cast<int>(sizeof(V8TrackArrayBuffer)));
|
|
||||||
|
|
||||||
SetPrivate(context, arrayBuffer, kCefTrackObject,
|
|
||||||
v8::External::New(isolate_, this));
|
|
||||||
|
|
||||||
handle_.Reset(isolate_, arrayBuffer);
|
|
||||||
handle_.SetWeak(this, FirstWeakCallback, v8::WeakCallbackType::kParameter);
|
|
||||||
handle_.MarkIndependent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void FirstWeakCallback(
|
|
||||||
const v8::WeakCallbackInfo<V8TrackArrayBuffer>& data) {
|
|
||||||
V8TrackArrayBuffer* wrapper = data.GetParameter();
|
|
||||||
if (wrapper->buffer_ != nullptr) {
|
|
||||||
wrapper->release_callback_->ReleaseBuffer(wrapper->buffer_);
|
|
||||||
wrapper->buffer_ = nullptr;
|
|
||||||
}
|
|
||||||
wrapper->handle_.Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
v8::Isolate* isolate_;
|
v8::Isolate* isolate_;
|
||||||
void* buffer_;
|
void* buffer_;
|
||||||
CefRefPtr<CefV8ArrayBufferReleaseCallback> release_callback_;
|
CefRefPtr<CefV8ArrayBufferReleaseCallback> release_callback_;
|
||||||
v8::Persistent<v8::ArrayBuffer> handle_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Object wrapped in a v8::External and passed as the Data argument to
|
// Object wrapped in a v8::External and passed as the Data argument to
|
||||||
@@ -476,7 +460,9 @@ void v8impl_string_dtor(char* str) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Convert a v8::String to CefString.
|
// Convert a v8::String to CefString.
|
||||||
void GetCefString(v8::Local<v8::String> str, CefString& out) {
|
void GetCefString(v8::Isolate* isolate,
|
||||||
|
v8::Local<v8::String> str,
|
||||||
|
CefString& out) {
|
||||||
if (str.IsEmpty())
|
if (str.IsEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -486,7 +472,7 @@ void GetCefString(v8::Local<v8::String> str, CefString& out) {
|
|||||||
if (len == 0)
|
if (len == 0)
|
||||||
return;
|
return;
|
||||||
char* buf = new char[len + 1];
|
char* buf = new char[len + 1];
|
||||||
str->WriteUtf8(buf, len + 1);
|
str->WriteUtf8(isolate, buf, len + 1);
|
||||||
|
|
||||||
// Perform conversion to the wide type.
|
// Perform conversion to the wide type.
|
||||||
cef_string_t* retws = out.GetWritableStruct();
|
cef_string_t* retws = out.GetWritableStruct();
|
||||||
@@ -499,14 +485,14 @@ void GetCefString(v8::Local<v8::String> str, CefString& out) {
|
|||||||
if (len == 0)
|
if (len == 0)
|
||||||
return;
|
return;
|
||||||
char16* buf = new char16[len + 1];
|
char16* buf = new char16[len + 1];
|
||||||
str->Write(reinterpret_cast<uint16_t*>(buf), 0, len + 1);
|
str->Write(isolate, reinterpret_cast<uint16_t*>(buf), 0, len + 1);
|
||||||
#else
|
#else
|
||||||
// Allocate enough space for a worst-case conversion.
|
// Allocate enough space for a worst-case conversion.
|
||||||
int len = str->Utf8Length();
|
int len = str->Utf8Length();
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
return;
|
return;
|
||||||
char* buf = new char[len + 1];
|
char* buf = new char[len + 1];
|
||||||
str->WriteUtf8(buf, len + 1);
|
str->WriteUtf8(isolate, buf, len + 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Don't perform an extra string copy.
|
// Don't perform an extra string copy.
|
||||||
@@ -575,7 +561,7 @@ void AccessorNameGetterCallbackImpl(
|
|||||||
CefRefPtr<CefV8Value> retval;
|
CefRefPtr<CefV8Value> retval;
|
||||||
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(isolate, context, obj);
|
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(isolate, context, obj);
|
||||||
CefString name, exception;
|
CefString name, exception;
|
||||||
GetCefString(v8::Local<v8::String>::Cast(property), name);
|
GetCefString(isolate, v8::Local<v8::String>::Cast(property), name);
|
||||||
if (accessorPtr->Get(name, object, retval, exception)) {
|
if (accessorPtr->Get(name, object, retval, exception)) {
|
||||||
if (!exception.empty()) {
|
if (!exception.empty()) {
|
||||||
info.GetReturnValue().Set(isolate->ThrowException(
|
info.GetReturnValue().Set(isolate->ThrowException(
|
||||||
@@ -614,7 +600,7 @@ void AccessorNameSetterCallbackImpl(
|
|||||||
CefRefPtr<CefV8Value> cefValue =
|
CefRefPtr<CefV8Value> cefValue =
|
||||||
new CefV8ValueImpl(isolate, context, value);
|
new CefV8ValueImpl(isolate, context, value);
|
||||||
CefString name, exception;
|
CefString name, exception;
|
||||||
GetCefString(v8::Local<v8::String>::Cast(property), name);
|
GetCefString(isolate, v8::Local<v8::String>::Cast(property), name);
|
||||||
accessorPtr->Set(name, object, cefValue, exception);
|
accessorPtr->Set(name, object, cefValue, exception);
|
||||||
if (!exception.empty()) {
|
if (!exception.empty()) {
|
||||||
isolate->ThrowException(
|
isolate->ThrowException(
|
||||||
@@ -625,13 +611,13 @@ void AccessorNameSetterCallbackImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Two helper functions for V8 Interceptor callbacks.
|
// Two helper functions for V8 Interceptor callbacks.
|
||||||
CefString PropertyToIndex(v8::Local<v8::Name> property) {
|
CefString PropertyToIndex(v8::Isolate* isolate, v8::Local<v8::Name> property) {
|
||||||
CefString name;
|
CefString name;
|
||||||
GetCefString(property.As<v8::String>(), name);
|
GetCefString(isolate, property.As<v8::String>(), name);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PropertyToIndex(uint32_t index) {
|
int PropertyToIndex(v8::Isolate* isolate, uint32_t index) {
|
||||||
return static_cast<int>(index);
|
return static_cast<int>(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -657,7 +643,8 @@ void InterceptorGetterCallbackImpl(
|
|||||||
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(isolate, context, obj);
|
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(isolate, context, obj);
|
||||||
CefRefPtr<CefV8Value> retval;
|
CefRefPtr<CefV8Value> retval;
|
||||||
CefString exception;
|
CefString exception;
|
||||||
interceptorPtr->Get(PropertyToIndex(property), object, retval, exception);
|
interceptorPtr->Get(PropertyToIndex(isolate, property), object, retval,
|
||||||
|
exception);
|
||||||
if (!exception.empty()) {
|
if (!exception.empty()) {
|
||||||
info.GetReturnValue().Set(isolate->ThrowException(
|
info.GetReturnValue().Set(isolate->ThrowException(
|
||||||
v8::Exception::Error(GetV8String(isolate, exception))));
|
v8::Exception::Error(GetV8String(isolate, exception))));
|
||||||
@@ -688,7 +675,8 @@ void InterceptorSetterCallbackImpl(
|
|||||||
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(isolate, context, obj);
|
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(isolate, context, obj);
|
||||||
CefRefPtr<CefV8Value> cefValue = new CefV8ValueImpl(isolate, context, value);
|
CefRefPtr<CefV8Value> cefValue = new CefV8ValueImpl(isolate, context, value);
|
||||||
CefString exception;
|
CefString exception;
|
||||||
interceptorPtr->Set(PropertyToIndex(property), object, cefValue, exception);
|
interceptorPtr->Set(PropertyToIndex(isolate, property), object, cefValue,
|
||||||
|
exception);
|
||||||
if (!exception.empty()) {
|
if (!exception.empty()) {
|
||||||
isolate->ThrowException(
|
isolate->ThrowException(
|
||||||
v8::Exception::Error(GetV8String(isolate, exception)));
|
v8::Exception::Error(GetV8String(isolate, exception)));
|
||||||
@@ -711,7 +699,7 @@ class ExtensionWrapper : public v8::Extension {
|
|||||||
return v8::Local<v8::FunctionTemplate>();
|
return v8::Local<v8::FunctionTemplate>();
|
||||||
|
|
||||||
CefString func_name;
|
CefString func_name;
|
||||||
GetCefString(name, func_name);
|
GetCefString(isolate, name, func_name);
|
||||||
|
|
||||||
v8::Local<v8::External> function_data =
|
v8::Local<v8::External> function_data =
|
||||||
V8FunctionData::Create(isolate, func_name, handler_);
|
V8FunctionData::Create(isolate, func_name, handler_);
|
||||||
@@ -736,13 +724,18 @@ class CefV8ExceptionImpl : public CefV8Exception {
|
|||||||
if (message.IsEmpty())
|
if (message.IsEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GetCefString(message->Get(), message_);
|
v8::Isolate* isolate = context->GetIsolate();
|
||||||
|
GetCefString(isolate, message->Get(), message_);
|
||||||
v8::MaybeLocal<v8::String> source_line = message->GetSourceLine(context);
|
v8::MaybeLocal<v8::String> source_line = message->GetSourceLine(context);
|
||||||
if (!source_line.IsEmpty())
|
if (!source_line.IsEmpty())
|
||||||
GetCefString(source_line.ToLocalChecked(), source_line_);
|
GetCefString(isolate, source_line.ToLocalChecked(), source_line_);
|
||||||
|
|
||||||
if (!message->GetScriptResourceName().IsEmpty())
|
if (!message->GetScriptResourceName().IsEmpty()) {
|
||||||
GetCefString(message->GetScriptResourceName()->ToString(), script_);
|
GetCefString(
|
||||||
|
isolate,
|
||||||
|
message->GetScriptResourceName()->ToString(context).ToLocalChecked(),
|
||||||
|
script_);
|
||||||
|
}
|
||||||
|
|
||||||
v8::Maybe<int> line_number = message->GetLineNumber(context);
|
v8::Maybe<int> line_number = message->GetLineNumber(context);
|
||||||
if (!line_number.IsNothing())
|
if (!line_number.IsNothing())
|
||||||
@@ -1506,7 +1499,8 @@ void CefV8ValueImpl::InitFromV8Value(v8::Local<v8::Context> context,
|
|||||||
CefTime(value->ToNumber(context).ToLocalChecked()->Value() / 1000));
|
CefTime(value->ToNumber(context).ToLocalChecked()->Value() / 1000));
|
||||||
} else if (value->IsString()) {
|
} else if (value->IsString()) {
|
||||||
CefString rv;
|
CefString rv;
|
||||||
GetCefString(value->ToString(), rv);
|
GetCefString(context->GetIsolate(),
|
||||||
|
value->ToString(context).ToLocalChecked(), rv);
|
||||||
InitString(rv);
|
InitString(rv);
|
||||||
} else if (value->IsObject()) {
|
} else if (value->IsObject()) {
|
||||||
InitObject(value, NULL);
|
InitObject(value, NULL);
|
||||||
@@ -1785,7 +1779,7 @@ bool CefV8ValueImpl::IsUserCreated() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||||
v8::Local<v8::Object> obj = value->ToObject();
|
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||||
|
|
||||||
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
||||||
return (tracker != NULL);
|
return (tracker != NULL);
|
||||||
@@ -1836,7 +1830,7 @@ bool CefV8ValueImpl::HasValue(const CefString& key) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||||
v8::Local<v8::Object> obj = value->ToObject();
|
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||||
return obj->Has(context, GetV8String(isolate, key)).FromJust();
|
return obj->Has(context, GetV8String(isolate, key)).FromJust();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1858,7 +1852,7 @@ bool CefV8ValueImpl::HasValue(int index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||||
v8::Local<v8::Object> obj = value->ToObject();
|
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||||
return obj->Has(context, index).FromJust();
|
return obj->Has(context, index).FromJust();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1875,7 +1869,7 @@ bool CefV8ValueImpl::DeleteValue(const CefString& key) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||||
v8::Local<v8::Object> obj = value->ToObject();
|
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||||
|
|
||||||
v8::TryCatch try_catch(isolate);
|
v8::TryCatch try_catch(isolate);
|
||||||
try_catch.SetVerbose(true);
|
try_catch.SetVerbose(true);
|
||||||
@@ -1901,7 +1895,7 @@ bool CefV8ValueImpl::DeleteValue(int index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||||
v8::Local<v8::Object> obj = value->ToObject();
|
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||||
|
|
||||||
v8::TryCatch try_catch(isolate);
|
v8::TryCatch try_catch(isolate);
|
||||||
try_catch.SetVerbose(true);
|
try_catch.SetVerbose(true);
|
||||||
@@ -1922,7 +1916,7 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::GetValue(const CefString& key) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||||
v8::Local<v8::Object> obj = value->ToObject();
|
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||||
|
|
||||||
v8::TryCatch try_catch(isolate);
|
v8::TryCatch try_catch(isolate);
|
||||||
try_catch.SetVerbose(true);
|
try_catch.SetVerbose(true);
|
||||||
@@ -1950,7 +1944,7 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::GetValue(int index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||||
v8::Local<v8::Object> obj = value->ToObject();
|
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||||
|
|
||||||
v8::TryCatch try_catch(isolate);
|
v8::TryCatch try_catch(isolate);
|
||||||
try_catch.SetVerbose(true);
|
try_catch.SetVerbose(true);
|
||||||
@@ -1977,7 +1971,7 @@ bool CefV8ValueImpl::SetValue(const CefString& key,
|
|||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||||
v8::Local<v8::Object> obj = value->ToObject();
|
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||||
|
|
||||||
v8::TryCatch try_catch(isolate);
|
v8::TryCatch try_catch(isolate);
|
||||||
try_catch.SetVerbose(true);
|
try_catch.SetVerbose(true);
|
||||||
@@ -2021,7 +2015,7 @@ bool CefV8ValueImpl::SetValue(int index, CefRefPtr<CefV8Value> value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||||
v8::Local<v8::Object> obj = value->ToObject();
|
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||||
|
|
||||||
v8::TryCatch try_catch(isolate);
|
v8::TryCatch try_catch(isolate);
|
||||||
try_catch.SetVerbose(true);
|
try_catch.SetVerbose(true);
|
||||||
@@ -2048,7 +2042,7 @@ bool CefV8ValueImpl::SetValue(const CefString& key,
|
|||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||||
v8::Local<v8::Object> obj = value->ToObject();
|
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||||
|
|
||||||
CefRefPtr<CefV8Accessor> accessorPtr;
|
CefRefPtr<CefV8Accessor> accessorPtr;
|
||||||
|
|
||||||
@@ -2080,15 +2074,22 @@ bool CefV8ValueImpl::GetKeys(std::vector<CefString>& keys) {
|
|||||||
|
|
||||||
v8::Isolate* isolate = handle_->isolate();
|
v8::Isolate* isolate = handle_->isolate();
|
||||||
v8::HandleScope handle_scope(isolate);
|
v8::HandleScope handle_scope(isolate);
|
||||||
|
|
||||||
|
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||||
|
if (context.IsEmpty()) {
|
||||||
|
NOTREACHED() << "not currently in a V8 context";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||||
v8::Local<v8::Object> obj = value->ToObject();
|
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||||
|
|
||||||
v8::Local<v8::Array> arr_keys = obj->GetPropertyNames();
|
v8::Local<v8::Array> arr_keys = obj->GetPropertyNames();
|
||||||
uint32_t len = arr_keys->Length();
|
uint32_t len = arr_keys->Length();
|
||||||
for (uint32_t i = 0; i < len; ++i) {
|
for (uint32_t i = 0; i < len; ++i) {
|
||||||
v8::Local<v8::Value> value = arr_keys->Get(v8::Integer::New(isolate, i));
|
v8::Local<v8::Value> value = arr_keys->Get(v8::Integer::New(isolate, i));
|
||||||
CefString str;
|
CefString str;
|
||||||
GetCefString(value->ToString(), str);
|
GetCefString(isolate, value->ToString(context).ToLocalChecked(), str);
|
||||||
keys.push_back(str);
|
keys.push_back(str);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -2107,7 +2108,7 @@ bool CefV8ValueImpl::SetUserData(CefRefPtr<CefBaseRefCounted> user_data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||||
v8::Local<v8::Object> obj = value->ToObject();
|
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||||
|
|
||||||
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
||||||
if (tracker) {
|
if (tracker) {
|
||||||
@@ -2131,7 +2132,7 @@ CefRefPtr<CefBaseRefCounted> CefV8ValueImpl::GetUserData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||||
v8::Local<v8::Object> obj = value->ToObject();
|
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||||
|
|
||||||
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
||||||
if (tracker)
|
if (tracker)
|
||||||
@@ -2153,7 +2154,7 @@ int CefV8ValueImpl::GetExternallyAllocatedMemory() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||||
v8::Local<v8::Object> obj = value->ToObject();
|
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||||
|
|
||||||
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
||||||
if (tracker)
|
if (tracker)
|
||||||
@@ -2175,7 +2176,7 @@ int CefV8ValueImpl::AdjustExternallyAllocatedMemory(int change_in_bytes) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||||
v8::Local<v8::Object> obj = value->ToObject();
|
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||||
|
|
||||||
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
||||||
if (tracker)
|
if (tracker)
|
||||||
@@ -2187,14 +2188,22 @@ int CefV8ValueImpl::AdjustExternallyAllocatedMemory(int change_in_bytes) {
|
|||||||
int CefV8ValueImpl::GetArrayLength() {
|
int CefV8ValueImpl::GetArrayLength() {
|
||||||
CEF_V8_REQUIRE_OBJECT_RETURN(0);
|
CEF_V8_REQUIRE_OBJECT_RETURN(0);
|
||||||
|
|
||||||
v8::HandleScope handle_scope(handle_->isolate());
|
v8::Isolate* isolate = handle_->isolate();
|
||||||
|
v8::HandleScope handle_scope(isolate);
|
||||||
|
|
||||||
|
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||||
|
if (context.IsEmpty()) {
|
||||||
|
NOTREACHED() << "not currently in a V8 context";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||||
if (!value->IsArray()) {
|
if (!value->IsArray()) {
|
||||||
NOTREACHED() << "V8 value is not an array";
|
NOTREACHED() << "V8 value is not an array";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Object> obj = value->ToObject();
|
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||||
v8::Local<v8::Array> arr = v8::Local<v8::Array>::Cast(obj);
|
v8::Local<v8::Array> arr = v8::Local<v8::Array>::Cast(obj);
|
||||||
return arr->Length();
|
return arr->Length();
|
||||||
}
|
}
|
||||||
@@ -2205,18 +2214,20 @@ CefV8ValueImpl::GetArrayBufferReleaseCallback() {
|
|||||||
|
|
||||||
v8::Isolate* isolate = handle_->isolate();
|
v8::Isolate* isolate = handle_->isolate();
|
||||||
v8::HandleScope handle_scope(isolate);
|
v8::HandleScope handle_scope(isolate);
|
||||||
|
|
||||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||||
if (context.IsEmpty()) {
|
if (context.IsEmpty()) {
|
||||||
NOTREACHED() << "not currently in a V8 context";
|
NOTREACHED() << "not currently in a V8 context";
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||||
if (!value->IsArrayBuffer()) {
|
if (!value->IsArrayBuffer()) {
|
||||||
NOTREACHED() << "V8 value is not an array buffer";
|
NOTREACHED() << "V8 value is not an array buffer";
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Object> obj = value->ToObject();
|
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||||
|
|
||||||
V8TrackArrayBuffer* tracker = V8TrackArrayBuffer::Unwrap(context, obj);
|
V8TrackArrayBuffer* tracker = V8TrackArrayBuffer::Unwrap(context, obj);
|
||||||
if (tracker)
|
if (tracker)
|
||||||
@@ -2230,6 +2241,7 @@ bool CefV8ValueImpl::NeuterArrayBuffer() {
|
|||||||
|
|
||||||
v8::Isolate* isolate = handle_->isolate();
|
v8::Isolate* isolate = handle_->isolate();
|
||||||
v8::HandleScope handle_scope(isolate);
|
v8::HandleScope handle_scope(isolate);
|
||||||
|
|
||||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||||
if (context.IsEmpty()) {
|
if (context.IsEmpty()) {
|
||||||
NOTREACHED() << "not currently in a V8 context";
|
NOTREACHED() << "not currently in a V8 context";
|
||||||
@@ -2241,7 +2253,7 @@ bool CefV8ValueImpl::NeuterArrayBuffer() {
|
|||||||
NOTREACHED() << "V8 value is not an array buffer";
|
NOTREACHED() << "V8 value is not an array buffer";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
v8::Local<v8::Object> obj = value->ToObject();
|
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||||
v8::Local<v8::ArrayBuffer> arr = v8::Local<v8::ArrayBuffer>::Cast(obj);
|
v8::Local<v8::ArrayBuffer> arr = v8::Local<v8::ArrayBuffer>::Cast(obj);
|
||||||
if (!arr->IsNeuterable()) {
|
if (!arr->IsNeuterable()) {
|
||||||
return false;
|
return false;
|
||||||
@@ -2257,16 +2269,25 @@ CefString CefV8ValueImpl::GetFunctionName() {
|
|||||||
CefString rv;
|
CefString rv;
|
||||||
CEF_V8_REQUIRE_OBJECT_RETURN(rv);
|
CEF_V8_REQUIRE_OBJECT_RETURN(rv);
|
||||||
|
|
||||||
v8::HandleScope handle_scope(handle_->isolate());
|
v8::Isolate* isolate = handle_->isolate();
|
||||||
|
v8::HandleScope handle_scope(isolate);
|
||||||
|
|
||||||
|
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||||
|
if (context.IsEmpty()) {
|
||||||
|
NOTREACHED() << "not currently in a V8 context";
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||||
if (!value->IsFunction()) {
|
if (!value->IsFunction()) {
|
||||||
NOTREACHED() << "V8 value is not a function";
|
NOTREACHED() << "V8 value is not a function";
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Object> obj = value->ToObject();
|
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||||
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(obj);
|
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(obj);
|
||||||
GetCefString(v8::Handle<v8::String>::Cast(func->GetName()), rv);
|
GetCefString(handle_->isolate(),
|
||||||
|
v8::Handle<v8::String>::Cast(func->GetName()), rv);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2288,7 +2309,7 @@ CefRefPtr<CefV8Handler> CefV8ValueImpl::GetFunctionHandler() {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Object> obj = value->ToObject();
|
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||||
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
||||||
if (tracker)
|
if (tracker)
|
||||||
return tracker->GetHandler();
|
return tracker->GetHandler();
|
||||||
@@ -2348,7 +2369,7 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::ExecuteFunctionWithContext(
|
|||||||
|
|
||||||
v8::Context::Scope context_scope(context_local);
|
v8::Context::Scope context_scope(context_local);
|
||||||
|
|
||||||
v8::Local<v8::Object> obj = value->ToObject();
|
v8::Local<v8::Object> obj = value->ToObject(context_local).ToLocalChecked();
|
||||||
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(obj);
|
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(obj);
|
||||||
v8::Local<v8::Object> recv;
|
v8::Local<v8::Object> recv;
|
||||||
|
|
||||||
@@ -2429,7 +2450,7 @@ CefV8StackTraceImpl::CefV8StackTraceImpl(v8::Isolate* isolate,
|
|||||||
frames_.reserve(frame_count);
|
frames_.reserve(frame_count);
|
||||||
for (int i = 0; i < frame_count; ++i)
|
for (int i = 0; i < frame_count; ++i)
|
||||||
frames_.push_back(
|
frames_.push_back(
|
||||||
new CefV8StackFrameImpl(isolate, handle->GetFrame(i)));
|
new CefV8StackFrameImpl(isolate, handle->GetFrame(isolate, i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2457,9 +2478,10 @@ CefV8StackFrameImpl::CefV8StackFrameImpl(v8::Isolate* isolate,
|
|||||||
: line_number_(0), column_(0), is_eval_(false), is_constructor_(false) {
|
: line_number_(0), column_(0), is_eval_(false), is_constructor_(false) {
|
||||||
if (handle.IsEmpty())
|
if (handle.IsEmpty())
|
||||||
return;
|
return;
|
||||||
GetCefString(handle->GetScriptName(), script_name_);
|
GetCefString(isolate, handle->GetScriptName(), script_name_);
|
||||||
GetCefString(handle->GetScriptNameOrSourceURL(), script_name_or_source_url_);
|
GetCefString(isolate, handle->GetScriptNameOrSourceURL(),
|
||||||
GetCefString(handle->GetFunctionName(), function_name_);
|
script_name_or_source_url_);
|
||||||
|
GetCefString(isolate, handle->GetFunctionName(), function_name_);
|
||||||
line_number_ = handle->GetLineNumber();
|
line_number_ = handle->GetLineNumber();
|
||||||
column_ = handle->GetColumn();
|
column_ = handle->GetColumn();
|
||||||
is_eval_ = handle->IsEval();
|
is_eval_ = handle->IsEval();
|
||||||
|
@@ -27,11 +27,13 @@ set(CEF_TARGET libcef_dll_wrapper)
|
|||||||
'includes_capi',
|
'includes_capi',
|
||||||
'autogen_capi_includes',
|
'autogen_capi_includes',
|
||||||
'includes_wrapper',
|
'includes_wrapper',
|
||||||
|
'includes_wrapper_mac:MACOSX',
|
||||||
'includes_win:WINDOWS',
|
'includes_win:WINDOWS',
|
||||||
'includes_mac:MACOSX',
|
'includes_mac:MACOSX',
|
||||||
'includes_linux:LINUX',
|
'includes_linux:LINUX',
|
||||||
'libcef_dll_wrapper_sources_base',
|
'libcef_dll_wrapper_sources_base',
|
||||||
'libcef_dll_wrapper_sources_common',
|
'libcef_dll_wrapper_sources_common',
|
||||||
|
'libcef_dll_wrapper_sources_mac:MACOSX',
|
||||||
'autogen_client_side',
|
'autogen_client_side',
|
||||||
],
|
],
|
||||||
}}
|
}}
|
||||||
|
@@ -13,6 +13,11 @@ bool RefCountedThreadSafeBase::HasOneRef() const {
|
|||||||
&const_cast<RefCountedThreadSafeBase*>(this)->ref_count_);
|
&const_cast<RefCountedThreadSafeBase*>(this)->ref_count_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RefCountedThreadSafeBase::HasAtLeastOneRef() const {
|
||||||
|
return !AtomicRefCountIsZero(
|
||||||
|
&const_cast<RefCountedThreadSafeBase*>(this)->ref_count_);
|
||||||
|
}
|
||||||
|
|
||||||
RefCountedThreadSafeBase::RefCountedThreadSafeBase() : ref_count_(0) {
|
RefCountedThreadSafeBase::RefCountedThreadSafeBase() : ref_count_(0) {
|
||||||
#if DCHECK_IS_ON()
|
#if DCHECK_IS_ON()
|
||||||
in_dtor_ = false;
|
in_dtor_ = false;
|
||||||
|
@@ -89,6 +89,7 @@ class CefCppToCRefCounted : public CefBaseRefCounted {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool HasOneRef() const { return UnderlyingHasOneRef(); }
|
bool HasOneRef() const { return UnderlyingHasOneRef(); }
|
||||||
|
bool HasAtLeastOneRef() const { return UnderlyingHasAtLeastOneRef(); }
|
||||||
|
|
||||||
#if DCHECK_IS_ON()
|
#if DCHECK_IS_ON()
|
||||||
// Simple tracking of allocated objects.
|
// Simple tracking of allocated objects.
|
||||||
@@ -107,6 +108,7 @@ class CefCppToCRefCounted : public CefBaseRefCounted {
|
|||||||
base->add_ref = struct_add_ref;
|
base->add_ref = struct_add_ref;
|
||||||
base->release = struct_release;
|
base->release = struct_release;
|
||||||
base->has_one_ref = struct_has_one_ref;
|
base->has_one_ref = struct_has_one_ref;
|
||||||
|
base->has_at_least_one_ref = struct_has_at_least_one_ref;
|
||||||
|
|
||||||
#if DCHECK_IS_ON()
|
#if DCHECK_IS_ON()
|
||||||
base::AtomicRefCountInc(&DebugObjCt);
|
base::AtomicRefCountInc(&DebugObjCt);
|
||||||
@@ -147,6 +149,9 @@ class CefCppToCRefCounted : public CefBaseRefCounted {
|
|||||||
bool UnderlyingHasOneRef() const {
|
bool UnderlyingHasOneRef() const {
|
||||||
return wrapper_struct_.object_->HasOneRef();
|
return wrapper_struct_.object_->HasOneRef();
|
||||||
}
|
}
|
||||||
|
bool UnderlyingHasAtLeastOneRef() const {
|
||||||
|
return wrapper_struct_.object_->HasAtLeastOneRef();
|
||||||
|
}
|
||||||
|
|
||||||
static void CEF_CALLBACK struct_add_ref(cef_base_ref_counted_t* base) {
|
static void CEF_CALLBACK struct_add_ref(cef_base_ref_counted_t* base) {
|
||||||
DCHECK(base);
|
DCHECK(base);
|
||||||
@@ -187,6 +192,20 @@ class CefCppToCRefCounted : public CefBaseRefCounted {
|
|||||||
return wrapperStruct->wrapper_->HasOneRef();
|
return wrapperStruct->wrapper_->HasOneRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int CEF_CALLBACK
|
||||||
|
struct_has_at_least_one_ref(cef_base_ref_counted_t* base) {
|
||||||
|
DCHECK(base);
|
||||||
|
if (!base)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
WrapperStruct* wrapperStruct =
|
||||||
|
GetWrapperStruct(reinterpret_cast<StructName*>(base));
|
||||||
|
// Verify that the wrapper offset was calculated correctly.
|
||||||
|
DCHECK_EQ(kWrapperType, wrapperStruct->type_);
|
||||||
|
|
||||||
|
return wrapperStruct->wrapper_->HasAtLeastOneRef();
|
||||||
|
}
|
||||||
|
|
||||||
WrapperStruct wrapper_struct_;
|
WrapperStruct wrapper_struct_;
|
||||||
CefRefCount ref_count_;
|
CefRefCount ref_count_;
|
||||||
|
|
||||||
|
@@ -35,6 +35,7 @@ class CefCToCppRefCounted : public BaseName {
|
|||||||
}
|
}
|
||||||
bool Release() const;
|
bool Release() const;
|
||||||
bool HasOneRef() const { return UnderlyingHasOneRef(); }
|
bool HasOneRef() const { return UnderlyingHasOneRef(); }
|
||||||
|
bool HasAtLeastOneRef() const { return UnderlyingHasAtLeastOneRef(); }
|
||||||
|
|
||||||
#if DCHECK_IS_ON()
|
#if DCHECK_IS_ON()
|
||||||
// Simple tracking of allocated objects.
|
// Simple tracking of allocated objects.
|
||||||
@@ -99,6 +100,15 @@ class CefCToCppRefCounted : public BaseName {
|
|||||||
return base->has_one_ref(base) ? true : false;
|
return base->has_one_ref(base) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NO_SANITIZE("cfi-icall")
|
||||||
|
bool UnderlyingHasAtLeastOneRef() const {
|
||||||
|
cef_base_ref_counted_t* base =
|
||||||
|
reinterpret_cast<cef_base_ref_counted_t*>(GetStruct());
|
||||||
|
if (!base->has_one_ref)
|
||||||
|
return false;
|
||||||
|
return base->has_at_least_one_ref(base) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
CefRefCount ref_count_;
|
CefRefCount ref_count_;
|
||||||
|
|
||||||
static CefWrapperType kWrapperType;
|
static CefWrapperType kWrapperType;
|
||||||
|
65
libcef_dll/sandbox/sandbox_mac.mm
Normal file
65
libcef_dll/sandbox/sandbox_mac.mm
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
// Copyright 2018 The Chromium Embedded Framework Authors. Portions Copyright
|
||||||
|
// 2018 the Chromium Authors. All rights reserved. Use of this source code is
|
||||||
|
// governed by a BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
#include <mach-o/dyld.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include "sandbox/mac/seatbelt_exec.h"
|
||||||
|
|
||||||
|
#include "include/cef_sandbox_mac.h"
|
||||||
|
|
||||||
|
void* cef_sandbox_initialize(int argc, char** argv) {
|
||||||
|
uint32_t exec_path_size = 0;
|
||||||
|
int rv = _NSGetExecutablePath(NULL, &exec_path_size);
|
||||||
|
if (rv != -1) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<char[]> exec_path(new char[exec_path_size]);
|
||||||
|
rv = _NSGetExecutablePath(exec_path.get(), &exec_path_size);
|
||||||
|
if (rv != 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
sandbox::SeatbeltExecServer::CreateFromArgumentsResult seatbelt =
|
||||||
|
sandbox::SeatbeltExecServer::CreateFromArguments(exec_path.get(), argc,
|
||||||
|
argv);
|
||||||
|
if (seatbelt.sandbox_required) {
|
||||||
|
if (!seatbelt.server) {
|
||||||
|
fprintf(stderr, "Failed to create the seatbelt sandbox server.\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (!seatbelt.server->InitializeSandbox()) {
|
||||||
|
fprintf(stderr, "Failed to initialize the sandbox.\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto* copy = new sandbox::SeatbeltExecServer::CreateFromArgumentsResult();
|
||||||
|
copy->sandbox_required = seatbelt.sandbox_required;
|
||||||
|
copy->server.swap(seatbelt.server);
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cef_sandbox_destroy(void* sandbox_context) {
|
||||||
|
delete static_cast<sandbox::SeatbeltExecServer::CreateFromArgumentsResult*>(
|
||||||
|
sandbox_context);
|
||||||
|
}
|
||||||
|
|
||||||
|
CefScopedSandboxContext::CefScopedSandboxContext() : sandbox_context_(NULL) {}
|
||||||
|
|
||||||
|
CefScopedSandboxContext::~CefScopedSandboxContext() {
|
||||||
|
if (sandbox_context_) {
|
||||||
|
cef_sandbox_destroy(sandbox_context_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CefScopedSandboxContext::Initialize(int argc, char** argv) {
|
||||||
|
if (sandbox_context_)
|
||||||
|
return false;
|
||||||
|
sandbox_context_ = cef_sandbox_initialize(argc, argv);
|
||||||
|
return !!sandbox_context_;
|
||||||
|
}
|
77
libcef_dll/wrapper/cef_library_loader_mac.mm
Normal file
77
libcef_dll/wrapper/cef_library_loader_mac.mm
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
// Copyright (c) 2018 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "include/wrapper/cef_library_loader.h"
|
||||||
|
|
||||||
|
#include <libgen.h>
|
||||||
|
#include <mach-o/dyld.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
const char kFrameworkPath[] =
|
||||||
|
"Chromium Embedded Framework.framework/Chromium Embedded Framework";
|
||||||
|
const char kPathFromHelperExe[] = "../../..";
|
||||||
|
const char kPathFromMainExe[] = "../Frameworks";
|
||||||
|
|
||||||
|
std::string GetFrameworkPath(bool helper) {
|
||||||
|
uint32_t exec_path_size = 0;
|
||||||
|
int rv = _NSGetExecutablePath(NULL, &exec_path_size);
|
||||||
|
if (rv != -1) {
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<char[]> exec_path(new char[exec_path_size]);
|
||||||
|
rv = _NSGetExecutablePath(exec_path.get(), &exec_path_size);
|
||||||
|
if (rv != 0) {
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the directory path of the executable.
|
||||||
|
const char* parent_dir = dirname(exec_path.get());
|
||||||
|
if (!parent_dir) {
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Append the relative path to the framework.
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << parent_dir << "/" << (helper ? kPathFromHelperExe : kPathFromMainExe)
|
||||||
|
<< "/" << kFrameworkPath;
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
CefScopedLibraryLoader::CefScopedLibraryLoader() : loaded_(false) {}
|
||||||
|
|
||||||
|
bool CefScopedLibraryLoader::Load(bool helper) {
|
||||||
|
if (loaded_) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string& framework_path = GetFrameworkPath(helper);
|
||||||
|
if (framework_path.empty()) {
|
||||||
|
fprintf(stderr, "App does not have the expected bundle structure.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load the CEF framework library.
|
||||||
|
if (!cef_load_library(framework_path.c_str())) {
|
||||||
|
fprintf(stderr, "Failed to load the CEF framework.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
loaded_ = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
CefScopedLibraryLoader::~CefScopedLibraryLoader() {
|
||||||
|
if (loaded_) {
|
||||||
|
// Unload the CEF framework library.
|
||||||
|
cef_unload_library();
|
||||||
|
}
|
||||||
|
}
|
2190
libcef_dll/wrapper/libcef_dll_dylib.cc
Normal file
2190
libcef_dll/wrapper/libcef_dll_dylib.cc
Normal file
File diff suppressed because it is too large
Load Diff
@@ -41,17 +41,16 @@ patches = [
|
|||||||
# https://bitbucket.org/chromiumembedded/cef/issues/1617
|
# https://bitbucket.org/chromiumembedded/cef/issues/1617
|
||||||
'name': 'component_build_1617',
|
'name': 'component_build_1617',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
# Support loading of password protected zip archives.
|
|
||||||
# https://bitbucket.org/chromiumembedded/cef/issues/496
|
|
||||||
'name': 'zlib',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
# Revert change on Windows that removes MessageLoop::os_modal_loop().
|
# Revert change on Windows that removes MessageLoop::os_modal_loop().
|
||||||
# https://codereview.chromium.org/1992243003
|
# https://codereview.chromium.org/1992243003
|
||||||
#
|
#
|
||||||
# Revert change that removes MessageLoopForUI constructor.
|
# Revert change that removes MessageLoopForUI constructor.
|
||||||
# https://chromium-review.googlesource.com/751322
|
# https://chromium-review.googlesource.com/751322
|
||||||
|
#
|
||||||
|
# Add MessageLoop::ReleasePump to fix crashes during shutdown with multi-
|
||||||
|
# threaded message loop mode.
|
||||||
|
# https://bitbucket.org/chromiumembedded/cef/issues/2362
|
||||||
'name': 'message_loop',
|
'name': 'message_loop',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -125,12 +124,6 @@ patches = [
|
|||||||
# https://codereview.chromium.org/208313009
|
# https://codereview.chromium.org/208313009
|
||||||
'name': 'ui_dragdrop_355390',
|
'name': 'ui_dragdrop_355390',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
# Windows: Fix AtExitManager assertion on *ServiceFactory destruction during
|
|
||||||
# multi-threaded message loop shutdown.
|
|
||||||
# https://bitbucket.org/chromiumembedded/cef/issues/1680
|
|
||||||
'name': 'service_factory_1680',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
# Make URLRequest::set_is_pending() public so that it can be called from
|
# Make URLRequest::set_is_pending() public so that it can be called from
|
||||||
# CefRequestInterceptor::MaybeInterceptResponse().
|
# CefRequestInterceptor::MaybeInterceptResponse().
|
||||||
@@ -332,13 +325,13 @@ patches = [
|
|||||||
# Linux: Fix 32-bit build fails with ld.gold: internal error in
|
# Linux: Fix 32-bit build fails with ld.gold: internal error in
|
||||||
# get_section_contents, at icf.cc:467
|
# get_section_contents, at icf.cc:467
|
||||||
# https://bitbucket.org/chromiumembedded/cef/issues/2256
|
# https://bitbucket.org/chromiumembedded/cef/issues/2256
|
||||||
#
|
|
||||||
# Linux: Fix GTK2 compile errors.
|
|
||||||
#
|
|
||||||
# Linux: Fix cfi-icall failure in atk_util_auralinux_gtk2.cc.
|
|
||||||
# https://bugs.chromium.org/p/chromium/issues/detail?id=863090
|
|
||||||
'name': 'linux_build',
|
'name': 'linux_build',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
# Linux: Remove GTK build dependency.
|
||||||
|
# https://bitbucket.org/chromiumembedded/cef/issues/2014
|
||||||
|
'name': 'linux_gtk_2014',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
# Changes necessary to support for chrome extensions:
|
# Changes necessary to support for chrome extensions:
|
||||||
# (a) Add a new ExtensionHost constructor that allows CEF to create the
|
# (a) Add a new ExtensionHost constructor that allows CEF to create the
|
||||||
@@ -383,10 +376,24 @@ patches = [
|
|||||||
'name': 'linux_poll_2466',
|
'name': 'linux_poll_2466',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
# Fix tools/clang/scripts/update.py failure with custom VS toolchain on
|
# Allow ResourceBundle creation/destruction on the main thread and usage on
|
||||||
# Windows. This needs to be done in DEPS because it executes during the
|
# the UI thread.
|
||||||
# `gclient runhooks` step.
|
# https://bitbucket.org/chromiumembedded/cef/issues/2398
|
||||||
# https://bugs.chromium.org/p/chromium/issues/detail?id=863130
|
'name': 'resource_bundle_2512',
|
||||||
'name': 'DEPS',
|
},
|
||||||
|
{
|
||||||
|
# Fix VR target dependencies.
|
||||||
|
# https://bugs.chromium.org/p/chromium/issues/detail?id=873170
|
||||||
|
'name': 'vr_build_873170',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
# Fix redraw of OSR PDF viewer.
|
||||||
|
# https://bitbucket.org/chromiumembedded/cef/issues/2507
|
||||||
|
'name': 'browser_child_frame_2507',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
# macOS: Fix crash when showing a select popup with CefDoMessageLoopWork.
|
||||||
|
# https://bitbucket.org/chromiumembedded/cef/issues/2495
|
||||||
|
'name': 'message_pump_mac_2495',
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user