mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
68 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
19ba7216a0 | ||
|
3c44b04c4e | ||
|
7a604aacf4 | ||
|
f03d75a333 | ||
|
c53c523f4d | ||
|
5c92ffb78d | ||
|
044c82849e | ||
|
02ae4597d8 | ||
|
f2f0bfbdb5 | ||
|
d330790ec6 | ||
|
af832bf118 | ||
|
cd9342c39f | ||
|
74c66a3a43 | ||
|
f718c8947c | ||
|
c6a4331904 | ||
|
af0e86206a | ||
|
e37ceabdf8 | ||
|
7823df5a45 | ||
|
691c9c2dcc | ||
|
c48a79756c | ||
|
d4386da6c3 | ||
|
8656f19907 | ||
|
df150f8ae0 | ||
|
d98971fc9e | ||
|
10b7a443cb | ||
|
fe5b0df2fa | ||
|
5bfcfaab73 | ||
|
f048a5ddba | ||
|
9f05dc2447 | ||
|
4d20de09f3 | ||
|
c04a578821 | ||
|
44829818b0 | ||
|
cd40496573 | ||
|
210c1d6b4f | ||
|
c04592e2a7 | ||
|
6ad29642e2 | ||
|
1b36d3538c | ||
|
d399c7220a | ||
|
1cd3f8a3af | ||
|
35a360fe66 | ||
|
2ecefdf30b | ||
|
0ad85c19aa | ||
|
1232df3646 | ||
|
dc12a89f28 | ||
|
4011b1e2ab | ||
|
8d23e96edf | ||
|
2e4c4750b6 | ||
|
69a8839ce9 | ||
|
47f15dd307 | ||
|
505bf24abb | ||
|
a17c59ce1d | ||
|
74db00fc89 | ||
|
1587d6da03 | ||
|
c4baba880e | ||
|
020ac1b509 | ||
|
8424f166cc | ||
|
a6a8c0e845 | ||
|
1d39ff720e | ||
|
f93c9c0c5c | ||
|
b5dfcd05cb | ||
|
8733cb89c7 | ||
|
8f5fdc1f9a | ||
|
ec7067c55e | ||
|
bf3b7b2c62 | ||
|
b3ad79e2c5 | ||
|
7fe6a18f03 | ||
|
d6dc4b667b | ||
|
59c11404e6 |
460
BUILD.gn
460
BUILD.gn
@@ -98,7 +98,6 @@ import("//build/config/features.gni")
|
||||
import("//build/config/locales.gni")
|
||||
import("//build/config/sanitizers/sanitizers.gni")
|
||||
import("//build/config/ui.gni")
|
||||
import("//cef/cef_repack_locales.gni")
|
||||
import("//chrome/common/features.gni")
|
||||
import("//content/public/app/mac_helpers.gni")
|
||||
import("//extensions/buildflags/buildflags.gni")
|
||||
@@ -462,6 +461,8 @@ static_library("libcef_static") {
|
||||
"libcef/browser/chrome/chrome_browser_main_extra_parts_cef.h",
|
||||
"libcef/browser/chrome/chrome_content_browser_client_cef.cc",
|
||||
"libcef/browser/chrome/chrome_content_browser_client_cef.h",
|
||||
"libcef/browser/chrome/chrome_context_menu_handler.cc",
|
||||
"libcef/browser/chrome/chrome_context_menu_handler.h",
|
||||
"libcef/browser/chrome_crash_reporter_client_stub.cc",
|
||||
"libcef/browser/context.cc",
|
||||
"libcef/browser/context.h",
|
||||
@@ -638,6 +639,8 @@ static_library("libcef_static") {
|
||||
"libcef/browser/scheme_impl.cc",
|
||||
"libcef/browser/server_impl.cc",
|
||||
"libcef/browser/server_impl.h",
|
||||
"libcef/browser/simple_menu_model_impl.cc",
|
||||
"libcef/browser/simple_menu_model_impl.h",
|
||||
"libcef/browser/speech_recognition_manager_delegate.cc",
|
||||
"libcef/browser/speech_recognition_manager_delegate.h",
|
||||
"libcef/browser/ssl_host_state_delegate.cc",
|
||||
@@ -717,6 +720,8 @@ static_library("libcef_static") {
|
||||
"libcef/common/net/upload_data.h",
|
||||
"libcef/common/net/upload_element.cc",
|
||||
"libcef/common/net/upload_element.h",
|
||||
"libcef/common/net/url_util.cc",
|
||||
"libcef/common/net/url_util.h",
|
||||
"libcef/common/net_service/net_service_util.cc",
|
||||
"libcef/common/net_service/net_service_util.h",
|
||||
"libcef/common/parser_impl.cc",
|
||||
@@ -1058,13 +1063,17 @@ static_library("libcef_static") {
|
||||
}
|
||||
|
||||
if (toolkit_views) {
|
||||
deps += [
|
||||
"//ui/views",
|
||||
]
|
||||
}
|
||||
|
||||
if (use_aura) {
|
||||
sources += [
|
||||
"libcef/browser/chrome/views/browser_platform_delegate_chrome_views.cc",
|
||||
"libcef/browser/chrome/views/browser_platform_delegate_chrome_views.h",
|
||||
"libcef/browser/chrome/views/chrome_browser_frame.cc",
|
||||
"libcef/browser/chrome/views/chrome_browser_frame.h",
|
||||
"libcef/browser/chrome/views/chrome_browser_view.cc",
|
||||
"libcef/browser/chrome/views/chrome_browser_view.h",
|
||||
"libcef/browser/chrome/views/toolbar_view_impl.cc",
|
||||
"libcef/browser/chrome/views/toolbar_view_impl.h",
|
||||
"libcef/browser/chrome/views/toolbar_view_view.cc",
|
||||
"libcef/browser/chrome/views/toolbar_view_view.h",
|
||||
"libcef/browser/native/window_delegate_view.cc",
|
||||
"libcef/browser/native/window_delegate_view.h",
|
||||
"libcef/browser/views/basic_label_button_impl.cc",
|
||||
@@ -1125,84 +1134,106 @@ static_library("libcef_static") {
|
||||
|
||||
# Part of //ui/views:test_support which is testingonly.
|
||||
"//ui/views/test/desktop_test_views_delegate.h",
|
||||
"//ui/views/test/desktop_test_views_delegate_aura.cc",
|
||||
"//ui/views/test/test_views_delegate.h",
|
||||
"//ui/views/test/test_views_delegate_aura.cc",
|
||||
|
||||
# Support for UI input events.
|
||||
# Part of //ui/base:test_support which is testingonly.
|
||||
"//ui/base/test/ui_controls.h",
|
||||
"//ui/base/test/ui_controls_aura.cc",
|
||||
"//ui/aura/test/ui_controls_factory_aura.h",
|
||||
]
|
||||
|
||||
if (is_linux && !use_x11) {
|
||||
sources += [
|
||||
"//ui/aura/test/ui_controls_factory_ozone.cc",
|
||||
"//ui/events/test/events_test_utils.cc"
|
||||
]
|
||||
}
|
||||
|
||||
deps += [
|
||||
"//ui/aura",
|
||||
"//ui/events",
|
||||
"//ui/strings",
|
||||
"//ui/wm",
|
||||
"//ui/wm/public",
|
||||
"//ui/views",
|
||||
"//ui/views/controls/webview",
|
||||
]
|
||||
|
||||
if (toolkit_views) {
|
||||
deps += [
|
||||
"//ui/views/controls/webview",
|
||||
]
|
||||
}
|
||||
|
||||
if (is_win) {
|
||||
sources += [
|
||||
# Support for UI input events.
|
||||
# Part of //base/test:test_config which is testingonly.
|
||||
"//base/test/test_switches.cc",
|
||||
"//base/test/test_switches.h",
|
||||
"//base/test/test_timeouts.cc",
|
||||
"//base/test/test_timeouts.h",
|
||||
# Part of //ui/aura:test_support which is testingonly.
|
||||
"//ui/aura/test/ui_controls_factory_aurawin.cc",
|
||||
# Part of //ui/base:test_support which is testingonly.
|
||||
"//ui/base/test/ui_controls_internal_win.cc",
|
||||
"//ui/base/test/ui_controls_internal_win.h",
|
||||
]
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
sources += [
|
||||
# Support for UI input events.
|
||||
# Part of //ui/aura:test_support which is testingonly.
|
||||
"//ui/aura/test/aura_test_utils.cc",
|
||||
"//ui/aura/test/aura_test_utils.h",
|
||||
# Part of //ui/events:test_support which is testingonly.
|
||||
"//ui/events/test/x11_event_waiter.cc",
|
||||
"//ui/events/test/x11_event_waiter.h",
|
||||
]
|
||||
|
||||
if (use_x11) {
|
||||
sources += [
|
||||
# Support for UI input events.
|
||||
# Part of //ui/base/x:test_support which is testingonly.
|
||||
"//ui/base/x/test/x11_ui_controls_test_helper.cc",
|
||||
"//ui/base/x/test/x11_ui_controls_test_helper.h",
|
||||
# Part of //ui/aura:test_support which is testingonly.
|
||||
"//ui/aura/test/x11_event_sender.h",
|
||||
# Part of //ui/views:test_support which is testingonly.
|
||||
"//ui/views/test/ui_controls_factory_desktop_aurax11.cc",
|
||||
"//ui/views/test/ui_controls_factory_desktop_aurax11.h",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if (is_win || is_linux) {
|
||||
if (use_aura) {
|
||||
sources += [
|
||||
"libcef/browser/native/browser_platform_delegate_native_aura.cc",
|
||||
"libcef/browser/native/browser_platform_delegate_native_aura.h",
|
||||
"libcef/browser/views/view_util_aura.cc",
|
||||
|
||||
# Part of //ui/views:test_support which is testingonly.
|
||||
"//ui/views/test/desktop_test_views_delegate_aura.cc",
|
||||
"//ui/views/test/test_views_delegate_aura.cc",
|
||||
|
||||
# Support for UI input events.
|
||||
# Part of //ui/base:test_support which is testingonly.
|
||||
"//ui/base/test/ui_controls_aura.cc",
|
||||
"//ui/aura/test/ui_controls_factory_aura.h",
|
||||
]
|
||||
|
||||
deps += [
|
||||
"//ui/aura",
|
||||
"//ui/wm",
|
||||
"//ui/wm/public",
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
sources += [
|
||||
# Support for UI input events.
|
||||
# Part of //base/test:test_config which is testingonly.
|
||||
"//base/test/test_switches.cc",
|
||||
"//base/test/test_switches.h",
|
||||
"//base/test/test_timeouts.cc",
|
||||
"//base/test/test_timeouts.h",
|
||||
# Part of //ui/aura:test_support which is testingonly.
|
||||
"//ui/aura/test/ui_controls_factory_aurawin.cc",
|
||||
# Part of //ui/base:test_support which is testingonly.
|
||||
"//ui/base/test/ui_controls_internal_win.cc",
|
||||
"//ui/base/test/ui_controls_internal_win.h",
|
||||
]
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
sources += [
|
||||
# Support for UI input events.
|
||||
# Part of //ui/aura:test_support which is testingonly.
|
||||
"//ui/aura/test/aura_test_utils.cc",
|
||||
"//ui/aura/test/aura_test_utils.h",
|
||||
# Part of //ui/events:test_support which is testingonly.
|
||||
"//ui/events/test/x11_event_waiter.cc",
|
||||
"//ui/events/test/x11_event_waiter.h",
|
||||
]
|
||||
|
||||
if (use_x11) {
|
||||
sources += [
|
||||
# Support for UI input events.
|
||||
# Part of //ui/base/x:test_support which is testingonly.
|
||||
"//ui/base/x/test/x11_ui_controls_test_helper.cc",
|
||||
"//ui/base/x/test/x11_ui_controls_test_helper.h",
|
||||
# Part of //ui/aura:test_support which is testingonly.
|
||||
"//ui/aura/test/x11_event_sender.h",
|
||||
# Part of //ui/views:test_support which is testingonly.
|
||||
"//ui/views/test/ui_controls_factory_desktop_aurax11.cc",
|
||||
"//ui/views/test/ui_controls_factory_desktop_aurax11.h",
|
||||
]
|
||||
} else {
|
||||
sources += [
|
||||
# Support for UI input events.
|
||||
# Part of //ui/base:test_support which is testingonly.
|
||||
"//ui/aura/test/ui_controls_factory_ozone.cc",
|
||||
# Part of //ui//events:test_support which is testingonly.
|
||||
"//ui/events/test/events_test_utils.cc"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_mac) {
|
||||
sources += [
|
||||
"libcef/browser/views/view_util_mac.mm",
|
||||
|
||||
# Part of //ui/views:test_support which is testingonly.
|
||||
"//ui/views/test/desktop_test_views_delegate_mac.mm",
|
||||
"//ui/views/test/test_views_delegate_mac.mm",
|
||||
|
||||
# Support for UI input events.
|
||||
# Part of //ui/base:test_support which is testingonly.
|
||||
"//ui/base/test/ui_controls_mac.mm",
|
||||
# Part of //ui//events:test_support which is testingonly.
|
||||
"//ui/events/test/cocoa_test_event_utils.mm",
|
||||
]
|
||||
}
|
||||
} else {
|
||||
@@ -1281,121 +1312,8 @@ if (is_mac) {
|
||||
# Resource grit/pack targets.
|
||||
#
|
||||
|
||||
# Helper for generating scaled resource packs.
|
||||
template("cef_pak_scaled") {
|
||||
percent = invoker.percent
|
||||
|
||||
repack("pak_${target_name}") {
|
||||
# Each input pak file should also have a deps line for completeness.
|
||||
# Add associated .h files in the make_pack_header("resources") target.
|
||||
sources = [
|
||||
"$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
|
||||
"$root_gen_dir/components/components_resources_${percent}_percent.pak",
|
||||
"$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak",
|
||||
"$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak",
|
||||
"$root_gen_dir/third_party/blink/public/resources/blink_scaled_resources_${percent}_percent.pak",
|
||||
"$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
|
||||
]
|
||||
|
||||
# Use public_deps so that generated grit headers are discoverable from
|
||||
# the libcef_static target. Grit deps that generate .cc files must be
|
||||
# listed both here and in the libcef_static target.
|
||||
public_deps = [
|
||||
"//chrome/renderer:resources",
|
||||
"//components/resources:components_scaled_resources",
|
||||
"//content/app/resources",
|
||||
"//extensions:extensions_browser_resources",
|
||||
"//third_party/blink/public:scaled_resources",
|
||||
"//ui/resources:ui_resources_grd",
|
||||
]
|
||||
|
||||
deps = [
|
||||
# This repack target generates the blink_scaled_resources_*_percent.pak
|
||||
# file but doesn't expose the public_deps required by make_pack_header.
|
||||
"//third_party/blink/public:scaled_resources_${percent}_percent",
|
||||
]
|
||||
|
||||
if (toolkit_views) {
|
||||
sources += [
|
||||
"$root_gen_dir/ui/views/resources/views_resources_${percent}_percent.pak"
|
||||
]
|
||||
|
||||
public_deps += [
|
||||
"//ui/views/resources:resources_grd"
|
||||
]
|
||||
}
|
||||
|
||||
output = "$root_out_dir/cef_${percent}_percent.pak"
|
||||
}
|
||||
}
|
||||
|
||||
# Generate cef_100_percent.pak.
|
||||
cef_pak_scaled("100_percent") {
|
||||
percent = "100"
|
||||
}
|
||||
|
||||
# Generate cef_200_percent.pak.
|
||||
cef_pak_scaled("200_percent") {
|
||||
percent = "200"
|
||||
}
|
||||
|
||||
# Generate devtools_resources.pak.
|
||||
repack("pak_devtools") {
|
||||
# Each input pak file should also have a deps line for completeness.
|
||||
# Add associated .h files in the make_pack_header("resources") target.
|
||||
sources = [
|
||||
"$root_gen_dir/content/browser/devtools/devtools_resources.pak",
|
||||
"$root_gen_dir/third_party/blink/public/resources/inspector_overlay_resources.pak",
|
||||
]
|
||||
|
||||
# Use public_deps so that generated grit headers are discoverable from
|
||||
# the libcef_static target. Grit deps that generate .cc files must be
|
||||
# listed both here and in the libcef_static target.
|
||||
public_deps = [
|
||||
"//content/browser/devtools:devtools_resources",
|
||||
"//third_party/blink/public:devtools_inspector_resources",
|
||||
]
|
||||
|
||||
output = "$root_out_dir/devtools_resources.pak"
|
||||
}
|
||||
|
||||
# Generate cef_extensions.pak.
|
||||
repack("pak_extensions") {
|
||||
# Each input pak file should also have a deps line for completeness.
|
||||
# Add associated .h files in the make_pack_header("resources") target.
|
||||
sources = [
|
||||
"$root_gen_dir/chrome/component_extension_resources.pak",
|
||||
"$root_gen_dir/chrome/pdf_resources.pak",
|
||||
"$root_gen_dir/content/browser/resources/media/media_internals_resources.pak",
|
||||
"$root_gen_dir/content/browser/webrtc/resources/webrtc_internals_resources.pak",
|
||||
"$root_gen_dir/extensions/extensions_renderer_resources.pak",
|
||||
"$root_gen_dir/extensions/extensions_resources.pak",
|
||||
"$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
|
||||
"$root_gen_dir/ui/resources/webui_generated_resources.pak",
|
||||
"$root_gen_dir/ui/resources/webui_resources.pak",
|
||||
]
|
||||
|
||||
# Use public_deps so that generated grit headers are discoverable from
|
||||
# the libcef_static target. Grit deps that generate .cc files must be
|
||||
# listed both here and in the libcef_static target.
|
||||
public_deps = [
|
||||
"//chrome/browser/resources:component_extension_resources",
|
||||
"//chrome/browser/resources/pdf:pdf_resources",
|
||||
"//content/browser/resources/media:media_internals_resources",
|
||||
"//content/browser/webrtc/resources",
|
||||
"//extensions:extensions_renderer_resources",
|
||||
"//extensions:extensions_resources_grd",
|
||||
"//mojo/public/js:resources",
|
||||
"//ui/resources:webui_generated_resources_grd",
|
||||
"//ui/resources:webui_resources_grd",
|
||||
]
|
||||
|
||||
output = "$root_out_dir/cef_extensions.pak"
|
||||
}
|
||||
|
||||
# Included in locales/*.pak via //chrome/chrome_repack_locales.gni.
|
||||
grit("cef_strings") {
|
||||
visibility = [ ":*" ]
|
||||
|
||||
source = "libcef/resources/cef_strings.grd"
|
||||
outputs = [
|
||||
"grit/cef_strings.h",
|
||||
@@ -1406,22 +1324,8 @@ grit("cef_strings") {
|
||||
}
|
||||
}
|
||||
|
||||
# Generate locales/<locale>.pak.
|
||||
# See cef_repack_locales.gni for the list of input pak files and deps.
|
||||
cef_repack_locales("repack_locales_pack") {
|
||||
visibility = [ ":*" ]
|
||||
|
||||
input_locales = locales
|
||||
|
||||
if (is_mac) {
|
||||
output_locales = locales_as_mac_outputs
|
||||
} else {
|
||||
output_locales = locales
|
||||
}
|
||||
}
|
||||
|
||||
# Included in resources.pak via //chrome/chrome_paks.gni.
|
||||
grit("cef_resources") {
|
||||
visibility = [ ":*" ]
|
||||
source = "libcef/resources/cef_resources.grd"
|
||||
outputs = [
|
||||
"grit/cef_resources.h",
|
||||
@@ -1433,54 +1337,11 @@ grit("cef_resources") {
|
||||
]
|
||||
}
|
||||
|
||||
# Generate cef.pak.
|
||||
repack("pak") {
|
||||
# Each input pak file should also have a deps line for completeness.
|
||||
# Add associated .h files in the make_pack_header("resources") target.
|
||||
sources = [
|
||||
"$root_gen_dir/base/tracing/protos/tracing_proto_resources.pak",
|
||||
"$root_gen_dir/chrome/browser_resources.pak",
|
||||
"$root_gen_dir/chrome/dev_ui_browser_resources.pak",
|
||||
"$root_gen_dir/chrome/net_internals_resources.pak",
|
||||
"$root_gen_dir/chrome/print_preview_resources.pak",
|
||||
"$root_gen_dir/chrome/common_resources.pak",
|
||||
"$root_gen_dir/components/components_resources.pak",
|
||||
"$root_gen_dir/components/dev_ui_components_resources.pak",
|
||||
"$root_gen_dir/cef/cef_resources.pak",
|
||||
"$root_gen_dir/content/browser/tracing/tracing_resources.pak",
|
||||
"$root_gen_dir/content/content_resources.pak",
|
||||
"$root_gen_dir/content/dev_ui_content_resources.pak",
|
||||
"$root_gen_dir/net/net_resources.pak",
|
||||
"$root_gen_dir/third_party/blink/public/resources/blink_resources.pak",
|
||||
]
|
||||
|
||||
# Use public_deps so that generated grit headers are discoverable from
|
||||
# the libcef_static target. Grit deps that generate .cc files must be
|
||||
# listed both here and in the libcef_static target.
|
||||
public_deps = [
|
||||
"//base/tracing/protos:chrome_track_event_resources",
|
||||
"//chrome/browser:dev_ui_browser_resources",
|
||||
"//chrome/browser:resources",
|
||||
"//chrome/browser/resources/net_internals:net_internals_resources",
|
||||
"//chrome/browser/resources/print_preview:print_preview_resources",
|
||||
"//chrome/common:resources",
|
||||
"//components/resources:components_resources",
|
||||
"//components/resources:dev_ui_components_resources",
|
||||
":cef_resources",
|
||||
"//content/browser/tracing:resources",
|
||||
"//content:content_resources",
|
||||
"//content:dev_ui_content_resources",
|
||||
"//net:net_resources",
|
||||
"//third_party/blink/public:resources",
|
||||
]
|
||||
|
||||
output = "$root_out_dir/cef.pak"
|
||||
}
|
||||
|
||||
# Helper for generating pack header files.
|
||||
template("make_pack_header") {
|
||||
assert(defined(invoker.header))
|
||||
assert(defined(invoker.inputs))
|
||||
assert(defined(invoker.deps))
|
||||
|
||||
action("make_pack_header_${target_name}") {
|
||||
script = "tools/make_pack_header.py"
|
||||
@@ -1491,16 +1352,7 @@ template("make_pack_header") {
|
||||
args = rebase_path(outputs, root_build_dir) +
|
||||
rebase_path(inputs, root_build_dir)
|
||||
|
||||
deps = [
|
||||
# List all targets that generate pack files here. The grit targets that
|
||||
# generate |inputs| will be picked up via public_deps.
|
||||
":pak",
|
||||
":pak_100_percent",
|
||||
":pak_200_percent",
|
||||
":pak_devtools",
|
||||
":pak_extensions",
|
||||
":repack_locales_pack",
|
||||
]
|
||||
deps = invoker.deps
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1514,14 +1366,10 @@ make_pack_header("resources") {
|
||||
"$root_gen_dir/chrome/grit/common_resources.h",
|
||||
"$root_gen_dir/chrome/grit/component_extension_resources.h",
|
||||
"$root_gen_dir/chrome/grit/dev_ui_browser_resources.h",
|
||||
"$root_gen_dir/chrome/grit/net_internals_resources.h",
|
||||
"$root_gen_dir/chrome/grit/pdf_resources.h",
|
||||
"$root_gen_dir/chrome/grit/print_preview_resources.h",
|
||||
"$root_gen_dir/chrome/grit/renderer_resources.h",
|
||||
"$root_gen_dir/components/grit/components_resources.h",
|
||||
"$root_gen_dir/components/grit/dev_ui_components_resources.h",
|
||||
"$root_gen_dir/content/browser/devtools/grit/devtools_resources.h",
|
||||
"$root_gen_dir/content/browser/resources/media/grit/media_internals_resources.h",
|
||||
"$root_gen_dir/content/browser/tracing/grit/tracing_resources.h",
|
||||
"$root_gen_dir/content/browser/webrtc/resources/grit/webrtc_internals_resources.h",
|
||||
"$root_gen_dir/content/grit/content_resources.h",
|
||||
@@ -1535,8 +1383,38 @@ make_pack_header("resources") {
|
||||
"$root_gen_dir/ui/resources/grit/ui_resources.h",
|
||||
"$root_gen_dir/ui/resources/grit/webui_generated_resources.h",
|
||||
"$root_gen_dir/ui/resources/grit/webui_resources.h",
|
||||
"$root_gen_dir/ui/views/resources/grit/views_resources.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":cef_resources",
|
||||
"//base/tracing/protos:chrome_track_event_resources",
|
||||
"//chrome/browser:dev_ui_browser_resources",
|
||||
"//chrome/browser:resources",
|
||||
"//chrome/browser/resources:component_extension_resources",
|
||||
"//chrome/common:resources",
|
||||
"//chrome/renderer:resources",
|
||||
"//components/resources:components_resources",
|
||||
"//components/resources:dev_ui_components_resources",
|
||||
"//content/browser/devtools:devtools_resources",
|
||||
"//content/browser/tracing:resources",
|
||||
"//content/browser/webrtc/resources",
|
||||
"//content:content_resources",
|
||||
"//content:dev_ui_content_resources",
|
||||
"//extensions:extensions_browser_resources",
|
||||
"//extensions:extensions_renderer_resources",
|
||||
"//extensions:extensions_resources_grd",
|
||||
"//mojo/public/js:resources",
|
||||
"//net:net_resources",
|
||||
"//third_party/blink/public:resources",
|
||||
"//ui/resources:ui_resources_grd",
|
||||
"//ui/resources:webui_generated_resources_grd",
|
||||
"//ui/resources:webui_resources_grd",
|
||||
]
|
||||
|
||||
if (toolkit_views) {
|
||||
inputs += [ "$root_gen_dir/ui/views/resources/grit/views_resources.h" ]
|
||||
deps += [ "//ui/views/resources:resources_grd" ]
|
||||
}
|
||||
}
|
||||
|
||||
# Generate cef_pack_strings.h.
|
||||
@@ -1556,6 +1434,23 @@ make_pack_header("strings") {
|
||||
"$root_gen_dir/third_party/blink/public/strings/grit/blink_strings.h",
|
||||
"$root_gen_dir/ui/strings/grit/ui_strings.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":cef_strings",
|
||||
"//chrome/app:chromium_strings",
|
||||
"//chrome/app:generated_resources",
|
||||
"//chrome/app/resources:locale_settings",
|
||||
"//chrome/app/resources:platform_locale_settings",
|
||||
"//components/omnibox/resources:omnibox_resources",
|
||||
"//components/strings:components_chromium_strings",
|
||||
"//components/strings:components_locale_settings",
|
||||
"//components/strings:components_strings",
|
||||
"//extensions/strings",
|
||||
"//services/strings",
|
||||
"//third_party/blink/public/strings",
|
||||
"//ui/strings:app_locale_settings",
|
||||
"//ui/strings:ui_strings",
|
||||
]
|
||||
}
|
||||
|
||||
# Generate cef_api_hash.h.
|
||||
@@ -1605,37 +1500,9 @@ if (is_mac) {
|
||||
]
|
||||
}
|
||||
|
||||
bundle_data("cef_framework_locales") {
|
||||
sources = []
|
||||
foreach(locale, locales_as_mac_outputs) {
|
||||
sources += [ "$root_gen_dir/repack/locales/$locale.pak" ]
|
||||
}
|
||||
|
||||
public_deps = [
|
||||
":repack_locales_pack",
|
||||
]
|
||||
|
||||
outputs = [
|
||||
"{{bundle_resources_dir}}/{{source_name_part}}.lproj/locale.pak",
|
||||
]
|
||||
}
|
||||
|
||||
bundle_data("cef_framework_resources") {
|
||||
sources = [
|
||||
"$root_out_dir/cef.pak",
|
||||
"$root_out_dir/cef_100_percent.pak",
|
||||
"$root_out_dir/cef_200_percent.pak",
|
||||
"$root_out_dir/cef_extensions.pak",
|
||||
"$root_out_dir/devtools_resources.pak",
|
||||
]
|
||||
|
||||
public_deps = [
|
||||
":pak",
|
||||
":pak_100_percent",
|
||||
":pak_200_percent",
|
||||
":pak_devtools",
|
||||
":pak_extensions",
|
||||
]
|
||||
sources = []
|
||||
public_deps = []
|
||||
|
||||
if (icu_use_data_file) {
|
||||
sources += [ "$root_out_dir/icudtl.dat" ]
|
||||
@@ -1726,7 +1593,6 @@ if (is_mac) {
|
||||
|
||||
deps = [
|
||||
":cef_framework_angle_library",
|
||||
":cef_framework_locales",
|
||||
":cef_framework_resources",
|
||||
":cef_framework_swiftshader_library",
|
||||
":libcef_static",
|
||||
@@ -1918,6 +1784,7 @@ if (is_mac) {
|
||||
|
||||
public_deps = [ ":libcef_dll_wrapper" ]
|
||||
deps = [
|
||||
":cef_make_headers",
|
||||
":libcef_dll_wrapper",
|
||||
":${app_name}_framework_bundle_data",
|
||||
]
|
||||
@@ -2171,18 +2038,12 @@ if (is_mac) {
|
||||
pkg_config("gtk") {
|
||||
packages = [
|
||||
"gmodule-2.0",
|
||||
"gtk+-2.0",
|
||||
"gtk+-3.0",
|
||||
"gthread-2.0",
|
||||
"gtk+-unix-print-2.0",
|
||||
"gtk+-unix-print-3.0",
|
||||
"xi",
|
||||
]
|
||||
}
|
||||
|
||||
pkg_config("gtkglext") {
|
||||
packages = [
|
||||
"gtkglext-1.0",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
@@ -2263,13 +2124,13 @@ if (is_mac) {
|
||||
]
|
||||
|
||||
libs = [
|
||||
"GL",
|
||||
"X11",
|
||||
]
|
||||
|
||||
if (cef_use_gtk) {
|
||||
configs += [
|
||||
":gtk",
|
||||
":gtkglext",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -2362,8 +2223,7 @@ if (is_mac) {
|
||||
gypi_paths2.shared_sources_browser +
|
||||
gypi_paths2.shared_sources_common +
|
||||
gypi_paths2.shared_sources_renderer +
|
||||
gypi_paths2.ceftests_sources_common +
|
||||
gypi_paths2.ceftests_sources_views
|
||||
gypi_paths2.ceftests_sources_common
|
||||
|
||||
deps = [
|
||||
":libcef",
|
||||
|
@@ -7,6 +7,6 @@
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'refs/tags/89.0.4389.114',
|
||||
'depot_tools_checkout': '1f976d6f30'
|
||||
'chromium_checkout': 'refs/tags/90.0.4430.212',
|
||||
'depot_tools_checkout': '9757ad5883'
|
||||
}
|
||||
|
@@ -44,8 +44,7 @@
|
||||
# work but may not have been tested.
|
||||
# Required packages include:
|
||||
# build-essential
|
||||
# libgtk2.0-dev (required by the cefclient target only)
|
||||
# libgtkglext1-dev (required by the cefclient target only)
|
||||
# libgtk3.0-dev (required by the cefclient target only)
|
||||
#
|
||||
# - MacOS requirements:
|
||||
# Xcode 8 or newer building on MacOS 10.11 (El Capitan) or newer for x86_64.
|
||||
|
@@ -260,6 +260,8 @@
|
||||
'tests/cefclient/browser/root_window_create.cc',
|
||||
'tests/cefclient/browser/root_window_manager.cc',
|
||||
'tests/cefclient/browser/root_window_manager.h',
|
||||
'tests/cefclient/browser/root_window_views.cc',
|
||||
'tests/cefclient/browser/root_window_views.h',
|
||||
'tests/cefclient/browser/scheme_test.cc',
|
||||
'tests/cefclient/browser/scheme_test.h',
|
||||
'tests/cefclient/browser/server_test.cc',
|
||||
@@ -269,10 +271,18 @@
|
||||
'tests/cefclient/browser/test_runner.h',
|
||||
'tests/cefclient/browser/urlrequest_test.cc',
|
||||
'tests/cefclient/browser/urlrequest_test.h',
|
||||
'tests/cefclient/browser/views_menu_bar.cc',
|
||||
'tests/cefclient/browser/views_menu_bar.h',
|
||||
'tests/cefclient/browser/views_style.cc',
|
||||
'tests/cefclient/browser/views_style.h',
|
||||
'tests/cefclient/browser/views_window.cc',
|
||||
'tests/cefclient/browser/views_window.h',
|
||||
'tests/cefclient/browser/window_test.cc',
|
||||
'tests/cefclient/browser/window_test.h',
|
||||
'tests/cefclient/browser/window_test_runner.cc',
|
||||
'tests/cefclient/browser/window_test_runner.h',
|
||||
'tests/cefclient/browser/window_test_runner_views.cc',
|
||||
'tests/cefclient/browser/window_test_runner_views.h',
|
||||
],
|
||||
'cefclient_sources_common': [
|
||||
'tests/cefclient/common/client_app_delegates_common.cc',
|
||||
@@ -345,20 +355,10 @@
|
||||
'tests/cefclient/browser/osr_window_win.cc',
|
||||
'tests/cefclient/browser/osr_window_win.h',
|
||||
'tests/cefclient/browser/resource_util_win_idmap.cc',
|
||||
'tests/cefclient/browser/root_window_views.cc',
|
||||
'tests/cefclient/browser/root_window_views.h',
|
||||
'tests/cefclient/browser/root_window_win.cc',
|
||||
'tests/cefclient/browser/root_window_win.h',
|
||||
'tests/cefclient/browser/temp_window_win.cc',
|
||||
'tests/cefclient/browser/temp_window_win.h',
|
||||
'tests/cefclient/browser/views_menu_bar.cc',
|
||||
'tests/cefclient/browser/views_menu_bar.h',
|
||||
'tests/cefclient/browser/views_style.cc',
|
||||
'tests/cefclient/browser/views_style.h',
|
||||
'tests/cefclient/browser/views_window.cc',
|
||||
'tests/cefclient/browser/views_window.h',
|
||||
'tests/cefclient/browser/window_test_runner_views.cc',
|
||||
'tests/cefclient/browser/window_test_runner_views.h',
|
||||
'tests/cefclient/browser/window_test_runner_win.cc',
|
||||
'tests/cefclient/browser/window_test_runner_win.h',
|
||||
'tests/cefclient/cefclient_win.cc',
|
||||
@@ -411,22 +411,12 @@
|
||||
'tests/cefclient/browser/resource_util_linux.cc',
|
||||
'tests/cefclient/browser/root_window_gtk.cc',
|
||||
'tests/cefclient/browser/root_window_gtk.h',
|
||||
'tests/cefclient/browser/root_window_views.cc',
|
||||
'tests/cefclient/browser/root_window_views.h',
|
||||
'tests/cefclient/browser/temp_window_x11.cc',
|
||||
'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.h',
|
||||
'tests/cefclient/browser/views_style.cc',
|
||||
'tests/cefclient/browser/views_style.h',
|
||||
'tests/cefclient/browser/views_window.cc',
|
||||
'tests/cefclient/browser/views_window.h',
|
||||
'tests/cefclient/browser/window_test_runner_gtk.cc',
|
||||
'tests/cefclient/browser/window_test_runner_gtk.h',
|
||||
'tests/cefclient/browser/window_test_runner_views.cc',
|
||||
'tests/cefclient/browser/window_test_runner_views.h',
|
||||
'tests/cefclient/cefclient_gtk.cc',
|
||||
],
|
||||
'cefsimple_sources_common': [
|
||||
@@ -538,12 +528,6 @@
|
||||
'tests/ceftests/v8_unittest.cc',
|
||||
'tests/ceftests/values_unittest.cc',
|
||||
'tests/ceftests/version_unittest.cc',
|
||||
'tests/ceftests/waitable_event_unittest.cc',
|
||||
'tests/ceftests/webui_unittest.cc',
|
||||
'tests/ceftests/xml_reader_unittest.cc',
|
||||
'tests/ceftests/zip_reader_unittest.cc',
|
||||
],
|
||||
'ceftests_sources_views': [
|
||||
'tests/ceftests/views/button_unittest.cc',
|
||||
'tests/ceftests/views/panel_unittest.cc',
|
||||
'tests/ceftests/views/scroll_view_unittest.cc',
|
||||
@@ -551,6 +535,10 @@
|
||||
'tests/ceftests/views/test_window_delegate.h',
|
||||
'tests/ceftests/views/textfield_unittest.cc',
|
||||
'tests/ceftests/views/window_unittest.cc',
|
||||
'tests/ceftests/waitable_event_unittest.cc',
|
||||
'tests/ceftests/webui_unittest.cc',
|
||||
'tests/ceftests/xml_reader_unittest.cc',
|
||||
'tests/ceftests/zip_reader_unittest.cc',
|
||||
],
|
||||
'ceftests_sources_win': [
|
||||
'tests/ceftests/resource_util_win_idmap.cc',
|
||||
@@ -575,6 +563,7 @@
|
||||
'tests/ceftests/audio_output_unittest.cc',
|
||||
'tests/ceftests/client_app_delegates.cc',
|
||||
'tests/ceftests/cookie_unittest.cc',
|
||||
'tests/ceftests/cors_unittest.cc',
|
||||
'tests/ceftests/dom_unittest.cc',
|
||||
'tests/ceftests/frame_unittest.cc',
|
||||
'tests/ceftests/message_router_unittest.cc',
|
||||
|
@@ -1,136 +0,0 @@
|
||||
# Copyright 2016 The Chromium Embedded Framework Authors. Portions copyright
|
||||
# 2014 the Chromium Authors. All rights reserved. Use of this source code is
|
||||
# governed by a BSD-style license that can be found in the LICENSE file.
|
||||
#
|
||||
# This is a copy of src/chrome/chrome_repack_locales.gni with the necessary
|
||||
# modifications to meet CEF's requirements.
|
||||
|
||||
import("//build/config/chrome_build.gni")
|
||||
import("//build/config/features.gni")
|
||||
import("//build/config/ui.gni")
|
||||
import("//tools/grit/repack.gni")
|
||||
|
||||
# Arguments:
|
||||
#
|
||||
# locale
|
||||
# Internal name of locale. e.g. "pt-BR"
|
||||
#
|
||||
# output
|
||||
# Output file name.
|
||||
#
|
||||
# visibility
|
||||
# Normal meaning.
|
||||
template("_repack_one_locale") {
|
||||
locale = invoker.locale
|
||||
|
||||
repack(target_name) {
|
||||
visibility = invoker.visibility
|
||||
|
||||
# Each input pak file should also have a deps line for completeness.
|
||||
# Add associated .h files in the make_pack_header("strings") target.
|
||||
sources = [
|
||||
"${root_gen_dir}/cef/cef_strings_${locale}.pak",
|
||||
"${root_gen_dir}/chrome/chromium_strings_${locale}.pak",
|
||||
"${root_gen_dir}/chrome/generated_resources_${locale}.pak",
|
||||
"${root_gen_dir}/chrome/locale_settings_${locale}.pak",
|
||||
"${root_gen_dir}/chrome/platform_locale_settings_${locale}.pak",
|
||||
"${root_gen_dir}/components/omnibox/resources/omnibox_resources_${locale}.pak",
|
||||
"${root_gen_dir}/components/strings/components_chromium_strings_${locale}.pak",
|
||||
"${root_gen_dir}/components/strings/components_locale_settings_${locale}.pak",
|
||||
"${root_gen_dir}/components/strings/components_strings_${locale}.pak",
|
||||
"${root_gen_dir}/extensions/strings/extensions_strings_${locale}.pak",
|
||||
"${root_gen_dir}/services/strings/services_strings_${locale}.pak",
|
||||
"${root_gen_dir}/third_party/blink/public/strings/blink_strings_${locale}.pak",
|
||||
"${root_gen_dir}/ui/strings/app_locale_settings_${locale}.pak",
|
||||
"${root_gen_dir}/ui/strings/ui_strings_${locale}.pak",
|
||||
]
|
||||
|
||||
# Use public_deps so that generated grit headers are discoverable from
|
||||
# the libcef_static target. Grit deps that generate .cc files must be
|
||||
# listed both here and in the libcef_static target.
|
||||
public_deps = [
|
||||
":cef_strings",
|
||||
"//chrome/app:chromium_strings",
|
||||
"//chrome/app:generated_resources",
|
||||
"//chrome/app/resources:locale_settings",
|
||||
"//chrome/app/resources:platform_locale_settings",
|
||||
"//components/omnibox/resources:omnibox_resources",
|
||||
"//components/strings:components_chromium_strings",
|
||||
"//components/strings:components_locale_settings",
|
||||
"//components/strings:components_strings",
|
||||
"//extensions/strings",
|
||||
"//services/strings",
|
||||
"//third_party/blink/public/strings",
|
||||
"//ui/strings:app_locale_settings",
|
||||
"//ui/strings:ui_strings",
|
||||
]
|
||||
|
||||
output = invoker.output
|
||||
}
|
||||
}
|
||||
|
||||
# Creates an action to call the repack_locales script.
|
||||
#
|
||||
# The GYP version generates the locales in the "gen" directory and then copies
|
||||
# it to the root build directory. This isn't easy to express in a GN copy
|
||||
# rule since the files on Mac have a complex structure. So we generate the
|
||||
# files into the final place and skip the "gen" directory.
|
||||
#
|
||||
# This template uses GN's looping constructs to avoid the complex call to
|
||||
# chrome/tools/build/repack_locales.py which wraps the repack commands in the
|
||||
# GYP build.
|
||||
#
|
||||
# Arguments
|
||||
#
|
||||
# input_locales
|
||||
# List of locale names to use as inputs.
|
||||
#
|
||||
# output_locales
|
||||
# A list containing the corresponding output names for each of the
|
||||
# input names. Mac uses different names in some cases.
|
||||
#
|
||||
# visibility
|
||||
template("cef_repack_locales") {
|
||||
# This is the name of the group below that will collect all the invidual
|
||||
# locale targets. External targets will depend on this.
|
||||
group_target_name = target_name
|
||||
|
||||
# GN's subscript is too stupid to do invoker.output_locales[foo] so we need
|
||||
# to make a copy and do output_locales[foo].
|
||||
output_locales = invoker.output_locales
|
||||
|
||||
# Collects all targets the loop generates.
|
||||
locale_targets = []
|
||||
|
||||
# This loop iterates over the input locales and also keeps a counter so it
|
||||
# can simultaneously iterate over the output locales (using GN's very
|
||||
# limited looping capabilities).
|
||||
current_index = 0
|
||||
foreach(input_locale, invoker.input_locales) {
|
||||
output_locale = output_locales[current_index]
|
||||
|
||||
# Compute the name of the target for the current file. Save it for the deps.
|
||||
current_name = "${target_name}_${input_locale}"
|
||||
locale_targets += [ ":$current_name" ]
|
||||
|
||||
_repack_one_locale(current_name) {
|
||||
visibility = [ ":$group_target_name" ]
|
||||
locale = input_locale
|
||||
|
||||
# Compute the output name. Mac uses a different location.
|
||||
if (is_mac || is_ios) {
|
||||
output = "${root_gen_dir}/repack/locales/${output_locale}.pak"
|
||||
} else {
|
||||
output = "${root_out_dir}/locales/${output_locale}.pak"
|
||||
}
|
||||
}
|
||||
|
||||
current_index = current_index + 1
|
||||
}
|
||||
|
||||
# The group that external targets depend on which collects all deps.
|
||||
group(group_target_name) {
|
||||
forward_variables_from(invoker, [ "visibility" ])
|
||||
public_deps = locale_targets
|
||||
}
|
||||
}
|
@@ -95,6 +95,7 @@ if(OS_LINUX)
|
||||
-Wno-unused-parameter # Don't warn about unused parameters
|
||||
-Wno-error=comment # Don't warn about code in comments
|
||||
-Wno-comment # Don't warn about code in comments
|
||||
-Wno-deprecated-declarations # Don't warn about using deprecated methods
|
||||
)
|
||||
list(APPEND CEF_C_COMPILER_FLAGS
|
||||
-std=c99 # Use the C99 language standard
|
||||
@@ -228,11 +229,9 @@ if(OS_LINUX)
|
||||
|
||||
# List of CEF resource files.
|
||||
set(CEF_RESOURCE_FILES
|
||||
cef.pak
|
||||
cef_100_percent.pak
|
||||
cef_200_percent.pak
|
||||
cef_extensions.pak
|
||||
devtools_resources.pak
|
||||
chrome_100_percent.pak
|
||||
chrome_200_percent.pak
|
||||
resources.pak
|
||||
icudtl.dat
|
||||
locales
|
||||
)
|
||||
@@ -480,11 +479,9 @@ if(OS_WINDOWS)
|
||||
|
||||
# List of CEF resource files.
|
||||
set(CEF_RESOURCE_FILES
|
||||
cef.pak
|
||||
cef_100_percent.pak
|
||||
cef_200_percent.pak
|
||||
cef_extensions.pak
|
||||
devtools_resources.pak
|
||||
chrome_100_percent.pak
|
||||
chrome_200_percent.pak
|
||||
resources.pak
|
||||
icudtl.dat
|
||||
locales
|
||||
)
|
||||
@@ -494,6 +491,9 @@ if(OS_WINDOWS)
|
||||
PSAPI_VERSION=1 # Required by cef_sandbox.lib
|
||||
CEF_USE_SANDBOX # Used by apps to test if the sandbox is enabled
|
||||
)
|
||||
list(APPEND CEF_COMPILER_DEFINES_DEBUG
|
||||
_HAS_ITERATOR_DEBUGGING=0 # Disable iterator debugging
|
||||
)
|
||||
|
||||
# Libraries required by cef_sandbox.lib.
|
||||
set(CEF_SANDBOX_STANDARD_LIBS
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=f0cd169568e9ea5bcc8bf2aa891691b76c05356d$
|
||||
// $hash=ade537f836add7fe0b5fd94ceba26d678abb3e43$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_PROCESS_HANDLER_CAPI_H_
|
||||
@@ -43,7 +43,6 @@
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_client_capi.h"
|
||||
#include "include/capi/cef_command_line_capi.h"
|
||||
#include "include/capi/cef_print_handler_capi.h"
|
||||
#include "include/capi/cef_values_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -61,25 +60,6 @@ typedef struct _cef_browser_process_handler_t {
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Called on the browser process UI thread to retrieve the list of schemes
|
||||
// that should support cookies. If |include_defaults| is true (1) the default
|
||||
// schemes ("http", "https", "ws" and "wss") will also be supported. Providing
|
||||
// an NULL |schemes| value and setting |include_defaults| to false (0) will
|
||||
// disable all loading and saving of cookies.
|
||||
//
|
||||
// This state will apply to the cef_cookie_manager_t associated with the
|
||||
// global cef_request_context_t. It will also be used as the initial state for
|
||||
// any new cef_request_context_ts created by the client. After creating a new
|
||||
// cef_request_context_t the cef_cookie_manager_t::SetSupportedSchemes
|
||||
// function may be called on the associated cef_cookie_manager_t to futher
|
||||
// override these values.
|
||||
///
|
||||
void(CEF_CALLBACK* get_cookieable_schemes)(
|
||||
struct _cef_browser_process_handler_t* self,
|
||||
cef_string_list_t schemes,
|
||||
int* include_defaults);
|
||||
|
||||
///
|
||||
// Called on the browser process UI thread immediately after the CEF context
|
||||
// has been initialized.
|
||||
@@ -98,13 +78,6 @@ typedef struct _cef_browser_process_handler_t {
|
||||
struct _cef_browser_process_handler_t* self,
|
||||
struct _cef_command_line_t* command_line);
|
||||
|
||||
///
|
||||
// Return the handler for printing on Linux. If a print handler is not
|
||||
// provided then printing will not be supported on the Linux platform.
|
||||
///
|
||||
struct _cef_print_handler_t*(CEF_CALLBACK* get_print_handler)(
|
||||
struct _cef_browser_process_handler_t* self);
|
||||
|
||||
///
|
||||
// Called from any thread when work has been scheduled for the browser process
|
||||
// main (UI) thread. This callback is used in combination with CefSettings.
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=4cfcac55d2a1dee466a2a0753f30fb34a78ef3b2$
|
||||
// $hash=14eca959988209ba8f95037a47192fd50d64f2f1$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_
|
||||
@@ -53,6 +53,7 @@
|
||||
#include "include/capi/cef_keyboard_handler_capi.h"
|
||||
#include "include/capi/cef_life_span_handler_capi.h"
|
||||
#include "include/capi/cef_load_handler_capi.h"
|
||||
#include "include/capi/cef_print_handler_capi.h"
|
||||
#include "include/capi/cef_process_message_capi.h"
|
||||
#include "include/capi/cef_render_handler_capi.h"
|
||||
#include "include/capi/cef_request_handler_capi.h"
|
||||
@@ -146,6 +147,13 @@ typedef struct _cef_client_t {
|
||||
struct _cef_load_handler_t*(CEF_CALLBACK* get_load_handler)(
|
||||
struct _cef_client_t* self);
|
||||
|
||||
///
|
||||
// Return the handler for printing on Linux. If a print handler is not
|
||||
// provided then printing will not be supported on the Linux platform.
|
||||
///
|
||||
struct _cef_print_handler_t*(CEF_CALLBACK* get_print_handler)(
|
||||
struct _cef_client_t* self);
|
||||
|
||||
///
|
||||
// Return the handler for off-screen rendering events.
|
||||
///
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=bd04d49bcd5d269f237c92163b40435d5588209b$
|
||||
// $hash=175779df75a1405fcc5c337a09e6322c556698ba$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_CONTEXT_MENU_HANDLER_CAPI_H_
|
||||
@@ -294,11 +294,6 @@ typedef struct _cef_context_menu_params_t {
|
||||
// items).
|
||||
///
|
||||
int(CEF_CALLBACK* is_custom_menu)(struct _cef_context_menu_params_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if the context menu was invoked from a pepper plugin.
|
||||
///
|
||||
int(CEF_CALLBACK* is_pepper_menu)(struct _cef_context_menu_params_t* self);
|
||||
} cef_context_menu_params_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=20ba58ac3e861344ee738b58433869223c757e24$
|
||||
// $hash=b19ef1c8a781f8d59276357609fe64370bb8a107$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_COOKIE_CAPI_H_
|
||||
@@ -61,21 +61,6 @@ typedef struct _cef_cookie_manager_t {
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Set the schemes supported by this manager. If |include_defaults| is true
|
||||
// (1) the default schemes ("http", "https", "ws" and "wss") will also be
|
||||
// supported. Calling this function with an NULL |schemes| value and
|
||||
// |include_defaults| set to false (0) will disable all loading and saving of
|
||||
// cookies for this manager. If |callback| is non-NULL it will be executed
|
||||
// asnychronously on the UI thread after the change has been applied. Must be
|
||||
// called before any cookies are accessed.
|
||||
///
|
||||
void(CEF_CALLBACK* set_supported_schemes)(
|
||||
struct _cef_cookie_manager_t* self,
|
||||
cef_string_list_t schemes,
|
||||
int include_defaults,
|
||||
struct _cef_completion_callback_t* callback);
|
||||
|
||||
///
|
||||
// Visit all cookies on the UI thread. The returned cookies are ordered by
|
||||
// longest path, then by earliest creation date. Returns false (0) if cookies
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=3767c7759578cd4abc1c2ecef504e7ed60775abb$
|
||||
// $hash=79e4e38c732c0cfeef495c8a9726e105054012bb$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_MEDIA_ROUTER_CAPI_H_
|
||||
@@ -41,6 +41,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_callback_capi.h"
|
||||
#include "include/capi/cef_registration_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -110,11 +111,14 @@ typedef struct _cef_media_router_t {
|
||||
} cef_media_router_t;
|
||||
|
||||
///
|
||||
// Returns the MediaRouter object associated with the global request context.
|
||||
// Equivalent to calling cef_request_context_t::cef_request_context_get_global_c
|
||||
// ontext()->get_media_router().
|
||||
// Returns the MediaRouter object associated with the global request context. If
|
||||
// |callback| is non-NULL it will be executed asnychronously on the UI thread
|
||||
// after the manager's storage has been initialized. Equivalent to calling cef_r
|
||||
// equest_context_t::cef_request_context_get_global_context()->get_media_router(
|
||||
// ).
|
||||
///
|
||||
CEF_EXPORT cef_media_router_t* cef_media_router_get_global();
|
||||
CEF_EXPORT cef_media_router_t* cef_media_router_get_global(
|
||||
struct _cef_completion_callback_t* callback);
|
||||
|
||||
///
|
||||
// Implemented by the client to observe MediaRouter events and registered via
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=54ed1e16c5c1d133bcd097350c5f5871228efd4f$
|
||||
// $hash=84fc58b3898f25476d9cdd260553390ba5e0b30b$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_PRINT_HANDLER_CAPI_H_
|
||||
@@ -148,6 +148,7 @@ typedef struct _cef_print_handler_t {
|
||||
///
|
||||
cef_size_t(CEF_CALLBACK* get_pdf_paper_size)(
|
||||
struct _cef_print_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
int device_units_per_inch);
|
||||
} cef_print_handler_t;
|
||||
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=d5079b6a5146ccd2085c3bbf948925c009d329ed$
|
||||
// $hash=2e42334fc22050e207e5a0af6fe290a592e4105f$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_CAPI_H_
|
||||
@@ -132,7 +132,7 @@ typedef struct _cef_request_context_t {
|
||||
|
||||
///
|
||||
// Returns the cookie manager for this object. If |callback| is non-NULL it
|
||||
// will be executed asnychronously on the IO thread after the manager's
|
||||
// will be executed asnychronously on the UI thread after the manager's
|
||||
// storage has been initialized.
|
||||
///
|
||||
struct _cef_cookie_manager_t*(CEF_CALLBACK* get_cookie_manager)(
|
||||
@@ -356,10 +356,13 @@ typedef struct _cef_request_context_t {
|
||||
const cef_string_t* extension_id);
|
||||
|
||||
///
|
||||
// Returns the MediaRouter object associated with this context.
|
||||
// Returns the MediaRouter object associated with this context. If |callback|
|
||||
// is non-NULL it will be executed asnychronously on the UI thread after the
|
||||
// manager's context has been initialized.
|
||||
///
|
||||
struct _cef_media_router_t*(CEF_CALLBACK* get_media_router)(
|
||||
struct _cef_request_context_t* self);
|
||||
struct _cef_request_context_t* self,
|
||||
struct _cef_completion_callback_t* callback);
|
||||
} cef_request_context_t;
|
||||
|
||||
///
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=0fbd582ed5d0231550840ebf3eed2e488ac546d4$
|
||||
// $hash=3e4eb9ed3a0cb28ae0459a50f20c8405c7722437$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_BROWSER_VIEW_CAPI_H_
|
||||
@@ -65,6 +65,17 @@ typedef struct _cef_browser_view_t {
|
||||
struct _cef_browser_t*(CEF_CALLBACK* get_browser)(
|
||||
struct _cef_browser_view_t* self);
|
||||
|
||||
///
|
||||
// Returns the Chrome toolbar associated with this BrowserView. Only supported
|
||||
// when using the Chrome runtime. The cef_browser_view_delegate_t::
|
||||
// get_chrome_toolbar_type() function must return a value other than
|
||||
// CEF_CTT_NONE and the toolbar will not be available until after this
|
||||
// BrowserView is added to a cef_window_t and
|
||||
// cef_view_delegate_t::on_window_changed() has been called.
|
||||
///
|
||||
struct _cef_view_t*(CEF_CALLBACK* get_chrome_toolbar)(
|
||||
struct _cef_browser_view_t* self);
|
||||
|
||||
///
|
||||
// Sets whether accelerators registered with cef_window_t::SetAccelerator are
|
||||
// triggered before or after the event is sent to the cef_browser_t. If
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=37bbfadf761b3a1996276885d593d27d3fed5f8d$
|
||||
// $hash=220a126af3682f716f10b9019e8d1461702aa7c9$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_BROWSER_VIEW_DELEGATE_CAPI_H_
|
||||
@@ -112,6 +112,14 @@ typedef struct _cef_browser_view_delegate_t {
|
||||
struct _cef_browser_view_t* browser_view,
|
||||
struct _cef_browser_view_t* popup_browser_view,
|
||||
int is_devtools);
|
||||
|
||||
///
|
||||
// Returns the Chrome toolbar type that will be available via
|
||||
// cef_browser_view_t::get_chrome_toolbar(). See that function for related
|
||||
// documentation.
|
||||
///
|
||||
cef_chrome_toolbar_type_t(CEF_CALLBACK* get_chrome_toolbar_type)(
|
||||
struct _cef_browser_view_delegate_t* self);
|
||||
} cef_browser_view_delegate_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=8bd92dd03af4f5cf8c359c45a2d6d013565c2ead$
|
||||
// $hash=a060cb3c53317d758e7f6b4a275288cd08f086e7$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_VIEW_DELEGATE_CAPI_H_
|
||||
@@ -114,6 +114,13 @@ typedef struct _cef_view_delegate_t {
|
||||
int added,
|
||||
struct _cef_view_t* child);
|
||||
|
||||
///
|
||||
// Called when |view| is added or removed from the cef_window_t.
|
||||
///
|
||||
void(CEF_CALLBACK* on_window_changed)(struct _cef_view_delegate_t* self,
|
||||
struct _cef_view_t* view,
|
||||
int added);
|
||||
|
||||
///
|
||||
// Called when |view| gains focus.
|
||||
///
|
||||
|
@@ -42,13 +42,13 @@
|
||||
// way that may cause binary incompatibility with other builds. The universal
|
||||
// hash value will change if any platform is affected whereas the platform hash
|
||||
// values will change only if that particular platform is affected.
|
||||
#define CEF_API_HASH_UNIVERSAL "89715b43c948313782d2546131f510eab1975844"
|
||||
#define CEF_API_HASH_UNIVERSAL "d026196d35d8894a836ab3a3d033b84195cdb835"
|
||||
#if defined(OS_WIN)
|
||||
#define CEF_API_HASH_PLATFORM "80648a2c5a87db1581fdb994b7154ed77d74a3c5"
|
||||
#define CEF_API_HASH_PLATFORM "4150bd26e7bf639a9b1f3e5860af8c76eeae8570"
|
||||
#elif defined(OS_MAC)
|
||||
#define CEF_API_HASH_PLATFORM "3af393a2bf165edd934c5a59f6e6fce8a4bb579c"
|
||||
#define CEF_API_HASH_PLATFORM "5cc32f88bd134410eff86b21095138b339d572f2"
|
||||
#elif defined(OS_LINUX)
|
||||
#define CEF_API_HASH_PLATFORM "8049cab9a43c1d554ccdd4dd3d5e38ecebce42af"
|
||||
#define CEF_API_HASH_PLATFORM "b227b3fdd6142a9d8ff0f2252a71425f15960800"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -41,7 +41,6 @@
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_client.h"
|
||||
#include "include/cef_command_line.h"
|
||||
#include "include/cef_print_handler.h"
|
||||
#include "include/cef_values.h"
|
||||
|
||||
///
|
||||
@@ -51,23 +50,6 @@
|
||||
/*--cef(source=client,no_debugct_check)--*/
|
||||
class CefBrowserProcessHandler : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Called on the browser process UI thread to retrieve the list of schemes
|
||||
// that should support cookies. If |include_defaults| is true the default
|
||||
// schemes ("http", "https", "ws" and "wss") will also be supported. Providing
|
||||
// an empty |schemes| value and setting |include_defaults| to false will
|
||||
// disable all loading and saving of cookies.
|
||||
//
|
||||
// This state will apply to the CefCookieManager associated with the global
|
||||
// CefRequestContext. It will also be used as the initial state for any new
|
||||
// CefRequestContexts created by the client. After creating a new
|
||||
// CefRequestContext the CefCookieManager::SetSupportedSchemes method may be
|
||||
// called on the associated CefCookieManager to futher override these values.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void GetCookieableSchemes(std::vector<CefString>& schemes,
|
||||
bool& include_defaults) {}
|
||||
|
||||
///
|
||||
// Called on the browser process UI thread immediately after the CEF context
|
||||
// has been initialized.
|
||||
@@ -86,13 +68,6 @@ class CefBrowserProcessHandler : public virtual CefBaseRefCounted {
|
||||
virtual void OnBeforeChildProcessLaunch(
|
||||
CefRefPtr<CefCommandLine> command_line) {}
|
||||
|
||||
///
|
||||
// Return the handler for printing on Linux. If a print handler is not
|
||||
// provided then printing will not be supported on the Linux platform.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefPrintHandler> GetPrintHandler() { return nullptr; }
|
||||
|
||||
///
|
||||
// Called from any thread when work has been scheduled for the browser process
|
||||
// main (UI) thread. This callback is used in combination with CefSettings.
|
||||
|
@@ -51,6 +51,7 @@
|
||||
#include "include/cef_keyboard_handler.h"
|
||||
#include "include/cef_life_span_handler.h"
|
||||
#include "include/cef_load_handler.h"
|
||||
#include "include/cef_print_handler.h"
|
||||
#include "include/cef_process_message.h"
|
||||
#include "include/cef_render_handler.h"
|
||||
#include "include/cef_request_handler.h"
|
||||
@@ -139,6 +140,13 @@ class CefClient : public virtual CefBaseRefCounted {
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefLoadHandler> GetLoadHandler() { return nullptr; }
|
||||
|
||||
///
|
||||
// Return the handler for printing on Linux. If a print handler is not
|
||||
// provided then printing will not be supported on the Linux platform.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefPrintHandler> GetPrintHandler() { return nullptr; }
|
||||
|
||||
///
|
||||
// Return the handler for off-screen rendering events.
|
||||
///
|
||||
|
@@ -281,12 +281,6 @@ class CefContextMenuParams : public virtual CefBaseRefCounted {
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsCustomMenu() = 0;
|
||||
|
||||
///
|
||||
// Returns true if the context menu was invoked from a pepper plugin.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsPepperMenu() = 0;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_CONTEXT_MENU_HANDLER_H_
|
||||
|
@@ -64,21 +64,6 @@ class CefCookieManager : public virtual CefBaseRefCounted {
|
||||
static CefRefPtr<CefCookieManager> GetGlobalManager(
|
||||
CefRefPtr<CefCompletionCallback> callback);
|
||||
|
||||
///
|
||||
// Set the schemes supported by this manager. If |include_defaults| is true
|
||||
// the default schemes ("http", "https", "ws" and "wss") will also be
|
||||
// supported. Calling this method with an empty |schemes| value and
|
||||
// |include_defaults| set to false will disable all loading and saving of
|
||||
// cookies for this manager. If |callback| is non-NULL it will be executed
|
||||
// asnychronously on the UI thread after the change has been applied. Must be
|
||||
// called before any cookies are accessed.
|
||||
///
|
||||
/*--cef(optional_param=callback)--*/
|
||||
virtual void SetSupportedSchemes(
|
||||
const std::vector<CefString>& schemes,
|
||||
bool include_defaults,
|
||||
CefRefPtr<CefCompletionCallback> callback) = 0;
|
||||
|
||||
///
|
||||
// Visit all cookies on the UI thread. The returned cookies are ordered by
|
||||
// longest path, then by earliest creation date. Returns false if cookies
|
||||
|
@@ -40,6 +40,7 @@
|
||||
|
||||
#include <vector>
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_callback.h"
|
||||
#include "include/cef_registration.h"
|
||||
|
||||
class CefMediaObserver;
|
||||
@@ -59,11 +60,13 @@ class CefMediaRouter : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Returns the MediaRouter object associated with the global request context.
|
||||
// Equivalent to calling
|
||||
// CefRequestContext::GetGlobalContext()->GetMediaRouter().
|
||||
// If |callback| is non-NULL it will be executed asnychronously on the UI
|
||||
// thread after the manager's storage has been initialized. Equivalent to
|
||||
// calling CefRequestContext::GetGlobalContext()->GetMediaRouter().
|
||||
///
|
||||
/*--cef()--*/
|
||||
static CefRefPtr<CefMediaRouter> GetGlobalMediaRouter();
|
||||
/*--cef(optional_param=callback)--*/
|
||||
static CefRefPtr<CefMediaRouter> GetGlobalMediaRouter(
|
||||
CefRefPtr<CefCompletionCallback> callback);
|
||||
|
||||
///
|
||||
// Add an observer for MediaRouter events. The observer will remain registered
|
||||
|
@@ -133,7 +133,8 @@ class CefPrintHandler : public virtual CefBaseRefCounted {
|
||||
// CefBrowserHost::PrintToPDF().
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefSize GetPdfPaperSize(int device_units_per_inch) {
|
||||
virtual CefSize GetPdfPaperSize(CefRefPtr<CefBrowser> browser,
|
||||
int device_units_per_inch) {
|
||||
return CefSize();
|
||||
}
|
||||
};
|
||||
|
@@ -146,7 +146,7 @@ class CefRequestContext : public virtual CefBaseRefCounted {
|
||||
|
||||
///
|
||||
// Returns the cookie manager for this object. If |callback| is non-NULL it
|
||||
// will be executed asnychronously on the IO thread after the manager's
|
||||
// will be executed asnychronously on the UI thread after the manager's
|
||||
// storage has been initialized.
|
||||
///
|
||||
/*--cef(optional_param=callback)--*/
|
||||
@@ -364,10 +364,13 @@ class CefRequestContext : public virtual CefBaseRefCounted {
|
||||
const CefString& extension_id) = 0;
|
||||
|
||||
///
|
||||
// Returns the MediaRouter object associated with this context.
|
||||
// Returns the MediaRouter object associated with this context. If |callback|
|
||||
// is non-NULL it will be executed asnychronously on the UI thread after the
|
||||
// manager's context has been initialized.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefMediaRouter> GetMediaRouter() = 0;
|
||||
/*--cef(optional_param=callback)--*/
|
||||
virtual CefRefPtr<CefMediaRouter> GetMediaRouter(
|
||||
CefRefPtr<CefCompletionCallback> callback) = 0;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_REQUEST_CONTEXT_H_
|
||||
|
@@ -242,7 +242,9 @@ typedef struct _cef_settings_t {
|
||||
// in-memory caches are used for storage and no data is persisted to disk.
|
||||
// HTML5 databases such as localStorage will only persist across sessions if a
|
||||
// cache path is specified. Can be overridden for individual CefRequestContext
|
||||
// instances via the CefRequestContextSettings.cache_path value.
|
||||
// instances via the CefRequestContextSettings.cache_path value. When using
|
||||
// the Chrome runtime the "default" profile will be used if |cache_path| and
|
||||
// |root_cache_path| have the same value.
|
||||
///
|
||||
cef_string_t cache_path;
|
||||
|
||||
@@ -264,7 +266,8 @@ typedef struct _cef_settings_t {
|
||||
// directory on Linux, "~/Library/Application Support/CEF/User Data" directory
|
||||
// on Mac OS X, "Local Settings\Application Data\CEF\User Data" directory
|
||||
// under the user profile directory on Windows). If this value is non-empty
|
||||
// then it must be an absolute path.
|
||||
// then it must be an absolute path. When using the Chrome runtime this value
|
||||
// will be ignored in favor of the |root_cache_path| value.
|
||||
///
|
||||
cef_string_t user_data_path;
|
||||
|
||||
@@ -301,9 +304,9 @@ typedef struct _cef_settings_t {
|
||||
// Value that will be inserted as the product portion of the default
|
||||
// User-Agent string. If empty the Chromium product version will be used. If
|
||||
// |userAgent| is specified this value will be ignored. Also configurable
|
||||
// using the "product-version" command-line switch.
|
||||
// using the "user-agent-product" command-line switch.
|
||||
///
|
||||
cef_string_t product_version;
|
||||
cef_string_t user_agent_product;
|
||||
|
||||
///
|
||||
// The locale string that will be passed to WebKit. If empty the default
|
||||
@@ -342,10 +345,10 @@ typedef struct _cef_settings_t {
|
||||
|
||||
///
|
||||
// The fully qualified path for the resources directory. If this value is
|
||||
// empty the cef.pak and/or devtools_resources.pak files must be located in
|
||||
// the module directory on Windows/Linux or the app bundle Resources directory
|
||||
// on Mac OS X. If this value is non-empty then it must be an absolute path.
|
||||
// Also configurable using the "resources-dir-path" command-line switch.
|
||||
// empty the *.pak files must be located in the module directory on
|
||||
// Windows/Linux or the app bundle Resources directory on Mac OS X. If this
|
||||
// value is non-empty then it must be an absolute path. Also configurable
|
||||
// using the "resources-dir-path" command-line switch.
|
||||
///
|
||||
cef_string_t resources_dir_path;
|
||||
|
||||
@@ -419,6 +422,20 @@ typedef struct _cef_settings_t {
|
||||
///
|
||||
cef_string_t accept_language_list;
|
||||
|
||||
///
|
||||
// Comma delimited list of schemes supported by the associated
|
||||
// CefCookieManager. If |cookieable_schemes_exclude_defaults| is false (0) the
|
||||
// default schemes ("http", "https", "ws" and "wss") will also be supported.
|
||||
// Specifying a |cookieable_schemes_list| value and setting
|
||||
// |cookieable_schemes_exclude_defaults| to true (1) will disable all loading
|
||||
// and saving of cookies for this manager. Can be overridden
|
||||
// for individual CefRequestContext instances via the
|
||||
// CefRequestContextSettings.cookieable_schemes_list and
|
||||
// CefRequestContextSettings.cookieable_schemes_exclude_defaults values.
|
||||
///
|
||||
cef_string_t cookieable_schemes_list;
|
||||
int cookieable_schemes_exclude_defaults;
|
||||
|
||||
///
|
||||
// GUID string used for identifying the application. This is passed to the
|
||||
// system AV function for scanning downloaded files. By default, the GUID
|
||||
@@ -487,6 +504,18 @@ typedef struct _cef_request_context_settings_t {
|
||||
// ignored if |cache_path| matches the CefSettings.cache_path value.
|
||||
///
|
||||
cef_string_t accept_language_list;
|
||||
|
||||
///
|
||||
// Comma delimited list of schemes supported by the associated
|
||||
// CefCookieManager. If |cookieable_schemes_exclude_defaults| is false (0) the
|
||||
// default schemes ("http", "https", "ws" and "wss") will also be supported.
|
||||
// Specifying a |cookieable_schemes_list| value and setting
|
||||
// |cookieable_schemes_exclude_defaults| to true (1) will disable all loading
|
||||
// and saving of cookies for this manager. These values will be ignored if
|
||||
// |cache_path| matches the CefSettings.cache_path value.
|
||||
///
|
||||
cef_string_t cookieable_schemes_list;
|
||||
int cookieable_schemes_exclude_defaults;
|
||||
} cef_request_context_settings_t;
|
||||
|
||||
///
|
||||
@@ -585,14 +614,6 @@ typedef struct _cef_browser_settings_t {
|
||||
///
|
||||
cef_state_t file_access_from_file_urls;
|
||||
|
||||
///
|
||||
// Controls whether web security restrictions (same-origin policy) will be
|
||||
// enforced. Disabling this setting is not recommend as it will allow risky
|
||||
// security behavior such as cross-site scripting (XSS). Also configurable
|
||||
// using the "disable-web-security" command-line switch.
|
||||
///
|
||||
cef_state_t web_security;
|
||||
|
||||
///
|
||||
// Controls whether image URLs will be loaded from the network. A cached image
|
||||
// will still be rendered if requested. Also configurable using the
|
||||
@@ -659,7 +680,7 @@ typedef struct _cef_browser_settings_t {
|
||||
///
|
||||
// Comma delimited ordered list of language codes without any whitespace that
|
||||
// will be used in the "Accept-Language" HTTP header. May be set globally
|
||||
// using the CefBrowserSettings.accept_language_list value. If both values are
|
||||
// using the CefSettings.accept_language_list value. If both values are
|
||||
// empty then "en-US,en" will be used.
|
||||
///
|
||||
cef_string_t accept_language_list;
|
||||
@@ -3193,6 +3214,15 @@ typedef enum {
|
||||
CEF_TFC_SELECT_ALL,
|
||||
} cef_text_field_commands_t;
|
||||
|
||||
///
|
||||
// Supported Chrome toolbar types.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_CTT_NONE = 1,
|
||||
CEF_CTT_NORMAL,
|
||||
CEF_CTT_LOCATION,
|
||||
} cef_chrome_toolbar_type_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -548,13 +548,14 @@ struct CefSettingsTraits {
|
||||
cef_string_clear(&s->root_cache_path);
|
||||
cef_string_clear(&s->user_data_path);
|
||||
cef_string_clear(&s->user_agent);
|
||||
cef_string_clear(&s->product_version);
|
||||
cef_string_clear(&s->user_agent_product);
|
||||
cef_string_clear(&s->locale);
|
||||
cef_string_clear(&s->log_file);
|
||||
cef_string_clear(&s->javascript_flags);
|
||||
cef_string_clear(&s->resources_dir_path);
|
||||
cef_string_clear(&s->locales_dir_path);
|
||||
cef_string_clear(&s->accept_language_list);
|
||||
cef_string_clear(&s->cookieable_schemes_list);
|
||||
cef_string_clear(&s->application_client_id_for_file_scanning);
|
||||
}
|
||||
|
||||
@@ -586,8 +587,8 @@ struct CefSettingsTraits {
|
||||
|
||||
cef_string_set(src->user_agent.str, src->user_agent.length,
|
||||
&target->user_agent, copy);
|
||||
cef_string_set(src->product_version.str, src->product_version.length,
|
||||
&target->product_version, copy);
|
||||
cef_string_set(src->user_agent_product.str, src->user_agent_product.length,
|
||||
&target->user_agent_product, copy);
|
||||
cef_string_set(src->locale.str, src->locale.length, &target->locale, copy);
|
||||
|
||||
cef_string_set(src->log_file.str, src->log_file.length, &target->log_file,
|
||||
@@ -609,6 +610,13 @@ struct CefSettingsTraits {
|
||||
cef_string_set(src->accept_language_list.str,
|
||||
src->accept_language_list.length,
|
||||
&target->accept_language_list, copy);
|
||||
|
||||
cef_string_set(src->cookieable_schemes_list.str,
|
||||
src->cookieable_schemes_list.length,
|
||||
&target->cookieable_schemes_list, copy);
|
||||
target->cookieable_schemes_exclude_defaults =
|
||||
src->cookieable_schemes_exclude_defaults;
|
||||
|
||||
cef_string_set(src->application_client_id_for_file_scanning.str,
|
||||
src->application_client_id_for_file_scanning.length,
|
||||
&target->application_client_id_for_file_scanning, copy);
|
||||
@@ -628,6 +636,7 @@ struct CefRequestContextSettingsTraits {
|
||||
static inline void clear(struct_type* s) {
|
||||
cef_string_clear(&s->cache_path);
|
||||
cef_string_clear(&s->accept_language_list);
|
||||
cef_string_clear(&s->cookieable_schemes_list);
|
||||
}
|
||||
|
||||
static inline void set(const struct_type* src,
|
||||
@@ -641,6 +650,12 @@ struct CefRequestContextSettingsTraits {
|
||||
cef_string_set(src->accept_language_list.str,
|
||||
src->accept_language_list.length,
|
||||
&target->accept_language_list, copy);
|
||||
|
||||
cef_string_set(src->cookieable_schemes_list.str,
|
||||
src->cookieable_schemes_list.length,
|
||||
&target->cookieable_schemes_list, copy);
|
||||
target->cookieable_schemes_exclude_defaults =
|
||||
src->cookieable_schemes_exclude_defaults;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -705,7 +720,6 @@ struct CefBrowserSettingsTraits {
|
||||
target->universal_access_from_file_urls =
|
||||
src->universal_access_from_file_urls;
|
||||
target->file_access_from_file_urls = src->file_access_from_file_urls;
|
||||
target->web_security = src->web_security;
|
||||
target->image_loading = src->image_loading;
|
||||
target->image_shrink_standalone_to_fit =
|
||||
src->image_shrink_standalone_to_fit;
|
||||
|
@@ -80,6 +80,17 @@ class CefBrowserView : public CefView {
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefBrowser> GetBrowser() = 0;
|
||||
|
||||
///
|
||||
// Returns the Chrome toolbar associated with this BrowserView. Only supported
|
||||
// when using the Chrome runtime. The CefBrowserViewDelegate::
|
||||
// GetChromeToolbarType() method must return a value other than
|
||||
// CEF_CTT_NONE and the toolbar will not be available until after this
|
||||
// BrowserView is added to a CefWindow and CefViewDelegate::OnWindowChanged()
|
||||
// has been called.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefView> GetChromeToolbar() = 0;
|
||||
|
||||
///
|
||||
// Sets whether accelerators registered with CefWindow::SetAccelerator are
|
||||
// triggered before or after the event is sent to the CefBrowser. If
|
||||
|
@@ -52,6 +52,8 @@ class CefBrowserView;
|
||||
/*--cef(source=client)--*/
|
||||
class CefBrowserViewDelegate : public CefViewDelegate {
|
||||
public:
|
||||
typedef cef_chrome_toolbar_type_t ChromeToolbarType;
|
||||
|
||||
///
|
||||
// Called when |browser| associated with |browser_view| is created. This
|
||||
// method will be called after CefLifeSpanHandler::OnAfterCreated() is called
|
||||
@@ -104,6 +106,14 @@ class CefBrowserViewDelegate : public CefViewDelegate {
|
||||
bool is_devtools) {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
// Returns the Chrome toolbar type that will be available via
|
||||
// CefBrowserView::GetChromeToolbar(). See that method for related
|
||||
// documentation.
|
||||
///
|
||||
/*--cef(default_retval=CEF_CTT_NONE)--*/
|
||||
virtual ChromeToolbarType GetChromeToolbarType() { return CEF_CTT_NONE; }
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_VIEWS_CEF_BROWSER_VIEW_DELEGATE_H_
|
||||
|
@@ -105,6 +105,12 @@ class CefViewDelegate : public virtual CefBaseRefCounted {
|
||||
bool added,
|
||||
CefRefPtr<CefView> child) {}
|
||||
|
||||
///
|
||||
// Called when |view| is added or removed from the CefWindow.
|
||||
///
|
||||
/*--cef(optional_param=window)--*/
|
||||
virtual void OnWindowChanged(CefRefPtr<CefView> view, bool added) {}
|
||||
|
||||
///
|
||||
// Called when |view| gains focus.
|
||||
///
|
||||
|
@@ -113,6 +113,18 @@ AlloyBrowserContext::~AlloyBrowserContext() {
|
||||
}
|
||||
}
|
||||
|
||||
bool AlloyBrowserContext::IsInitialized() const {
|
||||
CEF_REQUIRE_UIT();
|
||||
return !!key_;
|
||||
}
|
||||
|
||||
void AlloyBrowserContext::StoreOrTriggerInitCallback(
|
||||
base::OnceClosure callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
// Initialization is always synchronous.
|
||||
std::move(callback).Run();
|
||||
}
|
||||
|
||||
void AlloyBrowserContext::Initialize() {
|
||||
CefBrowserContext::Initialize();
|
||||
|
||||
@@ -298,6 +310,7 @@ AlloyBrowserContext::GetClientHintsControllerDelegate() {
|
||||
}
|
||||
|
||||
void AlloyBrowserContext::SetCorsOriginAccessListForOrigin(
|
||||
TargetBrowserContexts target_mode,
|
||||
const url::Origin& source_origin,
|
||||
std::vector<network::mojom::CorsOriginPatternPtr> allow_patterns,
|
||||
std::vector<network::mojom::CorsOriginPatternPtr> block_patterns,
|
||||
@@ -437,6 +450,11 @@ AlloyBrowserContext::GetProfilePolicyConnector() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool AlloyBrowserContext::IsNewProfile() const {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
|
||||
void AlloyBrowserContext::RebuildTable(
|
||||
const scoped_refptr<URLEnumerator>& enumerator) {
|
||||
// Called when visited links will not or cannot be loaded from disk.
|
||||
|
@@ -42,6 +42,8 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
|
||||
// CefBrowserContext overrides.
|
||||
content::BrowserContext* AsBrowserContext() override { return this; }
|
||||
Profile* AsProfile() override { return this; }
|
||||
bool IsInitialized() const override;
|
||||
void StoreOrTriggerInitCallback(base::OnceClosure callback) override;
|
||||
void Initialize() override;
|
||||
void Shutdown() override;
|
||||
void RemoveCefRequestContext(CefRequestContextImpl* context) override;
|
||||
@@ -59,6 +61,7 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
|
||||
content::ClientHintsControllerDelegate* GetClientHintsControllerDelegate()
|
||||
override;
|
||||
void SetCorsOriginAccessListForOrigin(
|
||||
TargetBrowserContexts target_mode,
|
||||
const url::Origin& source_origin,
|
||||
std::vector<network::mojom::CorsOriginPatternPtr> allow_patterns,
|
||||
std::vector<network::mojom::CorsOriginPatternPtr> block_patterns,
|
||||
@@ -94,6 +97,7 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
|
||||
policy::ProfilePolicyConnector* GetProfilePolicyConnector() override;
|
||||
const policy::ProfilePolicyConnector* GetProfilePolicyConnector()
|
||||
const override;
|
||||
bool IsNewProfile() const override;
|
||||
|
||||
// Values checked in ProfileNetworkContextService::CreateNetworkContextParams
|
||||
// when creating the NetworkContext.
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include "libcef/common/cef_messages.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
#include "libcef/common/drag_data_impl.h"
|
||||
#include "libcef/common/net/url_util.h"
|
||||
#include "libcef/common/request_impl.h"
|
||||
#include "libcef/common/values_impl.h"
|
||||
#include "libcef/features/runtime_checks.h"
|
||||
@@ -175,12 +176,13 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::Create(
|
||||
if (!browser)
|
||||
return nullptr;
|
||||
|
||||
GURL url = url_util::MakeGURL(create_params.url, /*fixup=*/true);
|
||||
|
||||
if (create_params.extension) {
|
||||
platform_delegate_ptr->CreateExtensionHost(
|
||||
create_params.extension, create_params.url,
|
||||
create_params.extension_host_type);
|
||||
} else if (!create_params.url.is_empty()) {
|
||||
content::OpenURLParams params(create_params.url, content::Referrer(),
|
||||
create_params.extension, url, create_params.extension_host_type);
|
||||
} else if (!url.is_empty()) {
|
||||
content::OpenURLParams params(url, content::Referrer(),
|
||||
WindowOpenDisposition::CURRENT_TAB,
|
||||
CefFrameHostImpl::kPageTransitionExplicit,
|
||||
/*is_renderer_initiated=*/false);
|
||||
@@ -378,7 +380,7 @@ void AlloyBrowserHostImpl::SetFocusInternal(bool focus) {
|
||||
}
|
||||
|
||||
CefWindowHandle AlloyBrowserHostImpl::GetWindowHandle() {
|
||||
if (IsViewsHosted() && CEF_CURRENTLY_ON_UIT()) {
|
||||
if (is_views_hosted_ && CEF_CURRENTLY_ON_UIT()) {
|
||||
// Always return the most up-to-date window handle for a views-hosted
|
||||
// browser since it may change if the view is re-parented.
|
||||
if (platform_delegate_)
|
||||
@@ -391,10 +393,6 @@ CefWindowHandle AlloyBrowserHostImpl::GetOpenerWindowHandle() {
|
||||
return opener_;
|
||||
}
|
||||
|
||||
bool AlloyBrowserHostImpl::HasView() {
|
||||
return IsViewsHosted();
|
||||
}
|
||||
|
||||
double AlloyBrowserHostImpl::GetZoomLevel() {
|
||||
// Verify that this method is being called on the UI thread.
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
@@ -532,82 +530,6 @@ bool AlloyBrowserHostImpl::HasDevTools() {
|
||||
return devtools_manager_->HasDevTools();
|
||||
}
|
||||
|
||||
bool AlloyBrowserHostImpl::SendDevToolsMessage(const void* message,
|
||||
size_t message_size) {
|
||||
if (!message || message_size == 0)
|
||||
return false;
|
||||
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
std::string message_str(static_cast<const char*>(message), message_size);
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(
|
||||
[](CefRefPtr<AlloyBrowserHostImpl> self, std::string message_str) {
|
||||
self->SendDevToolsMessage(message_str.data(), message_str.size());
|
||||
},
|
||||
CefRefPtr<AlloyBrowserHostImpl>(this), std::move(message_str)));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!EnsureDevToolsManager())
|
||||
return false;
|
||||
return devtools_manager_->SendDevToolsMessage(message, message_size);
|
||||
}
|
||||
|
||||
int AlloyBrowserHostImpl::ExecuteDevToolsMethod(
|
||||
int message_id,
|
||||
const CefString& method,
|
||||
CefRefPtr<CefDictionaryValue> params) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(
|
||||
base::IgnoreResult(&AlloyBrowserHostImpl::ExecuteDevToolsMethod),
|
||||
this, message_id, method, params));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!EnsureDevToolsManager())
|
||||
return 0;
|
||||
return devtools_manager_->ExecuteDevToolsMethod(message_id, method, params);
|
||||
}
|
||||
|
||||
CefRefPtr<CefRegistration> AlloyBrowserHostImpl::AddDevToolsMessageObserver(
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer) {
|
||||
if (!observer)
|
||||
return nullptr;
|
||||
auto registration = CefDevToolsManager::CreateRegistration(observer);
|
||||
InitializeDevToolsRegistrationOnUIThread(registration);
|
||||
return registration.get();
|
||||
}
|
||||
|
||||
bool AlloyBrowserHostImpl::EnsureDevToolsManager() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!web_contents())
|
||||
return false;
|
||||
|
||||
if (!devtools_manager_) {
|
||||
devtools_manager_.reset(new CefDevToolsManager(this));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::InitializeDevToolsRegistrationOnUIThread(
|
||||
CefRefPtr<CefRegistration> registration) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(
|
||||
&AlloyBrowserHostImpl::InitializeDevToolsRegistrationOnUIThread,
|
||||
this, registration));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!EnsureDevToolsManager())
|
||||
return;
|
||||
devtools_manager_->InitializeRegistrationOnUIThread(registration);
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::SetAccessibilityState(
|
||||
cef_state_t accessibility_state) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
@@ -803,10 +725,6 @@ bool AlloyBrowserHostImpl::IsWindowless() const {
|
||||
return is_windowless_;
|
||||
}
|
||||
|
||||
bool AlloyBrowserHostImpl::IsViewsHosted() const {
|
||||
return is_views_hosted_;
|
||||
}
|
||||
|
||||
bool AlloyBrowserHostImpl::IsPictureInPictureSupported() const {
|
||||
// Not currently supported with OSR.
|
||||
return !IsWindowless();
|
||||
@@ -865,27 +783,9 @@ void AlloyBrowserHostImpl::DestroyBrowser() {
|
||||
recently_audible_timer_.Stop();
|
||||
audio_capturer_.reset(nullptr);
|
||||
|
||||
devtools_manager_.reset(nullptr);
|
||||
|
||||
CefBrowserHostBase::DestroyBrowser();
|
||||
}
|
||||
|
||||
#if defined(USE_AURA)
|
||||
views::Widget* AlloyBrowserHostImpl::GetWindowWidget() const {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!platform_delegate_)
|
||||
return nullptr;
|
||||
return platform_delegate_->GetWindowWidget();
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowserView> AlloyBrowserHostImpl::GetBrowserView() const {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (IsViewsHosted() && platform_delegate_)
|
||||
return platform_delegate_->GetBrowserView();
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
void AlloyBrowserHostImpl::CancelContextMenu() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (menu_manager_)
|
||||
@@ -912,12 +812,6 @@ bool AlloyBrowserHostImpl::MaybeAllowNavigation(
|
||||
return true;
|
||||
}
|
||||
|
||||
SkColor AlloyBrowserHostImpl::GetBackgroundColor() const {
|
||||
// Don't use |platform_delegate_| because it's not thread-safe.
|
||||
return CefContext::Get()->GetBackgroundColor(
|
||||
&settings_, is_windowless_ ? STATE_ENABLED : STATE_DISABLED);
|
||||
}
|
||||
|
||||
extensions::ExtensionHost* AlloyBrowserHostImpl::GetExtensionHost() const {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(platform_delegate_);
|
||||
@@ -1275,6 +1169,11 @@ void AlloyBrowserHostImpl::CloseContents(content::WebContents* source) {
|
||||
// destroyed.
|
||||
CefRefPtr<AlloyBrowserHostImpl> browser(this);
|
||||
|
||||
if (source) {
|
||||
// Try to fast shutdown the associated process.
|
||||
source->GetMainFrame()->GetProcess()->FastShutdownIfPossible(1, false);
|
||||
}
|
||||
|
||||
// No window exists. Destroy the browser immediately. Don't call other
|
||||
// browser methods after calling DestroyBrowser().
|
||||
DestroyBrowser();
|
||||
@@ -1573,11 +1472,13 @@ void AlloyBrowserHostImpl::ExitPictureInPicture() {
|
||||
// content::WebContentsObserver methods.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void AlloyBrowserHostImpl::RenderViewCreated(
|
||||
content::RenderViewHost* render_view_host) {
|
||||
new CefWidgetHostInterceptor(this, render_view_host);
|
||||
|
||||
platform_delegate_->RenderViewCreated(render_view_host);
|
||||
void AlloyBrowserHostImpl::RenderFrameCreated(
|
||||
content::RenderFrameHost* render_frame_host) {
|
||||
if (render_frame_host->GetParent() == nullptr) {
|
||||
auto render_view_host = render_frame_host->GetRenderViewHost();
|
||||
new CefWidgetHostInterceptor(this, render_view_host);
|
||||
platform_delegate_->RenderViewCreated(render_view_host);
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::RenderViewReady() {
|
||||
@@ -1684,11 +1585,10 @@ AlloyBrowserHostImpl::AlloyBrowserHostImpl(
|
||||
content::WebContentsObserver(web_contents),
|
||||
opener_(kNullWindowHandle),
|
||||
is_windowless_(platform_delegate_->IsWindowless()),
|
||||
is_views_hosted_(platform_delegate_->IsViewsHosted()),
|
||||
extension_(extension) {
|
||||
contents_delegate_->ObserveWebContents(web_contents);
|
||||
|
||||
if (opener.get() && !platform_delegate_->IsViewsHosted()) {
|
||||
if (opener.get() && !is_views_hosted_) {
|
||||
// GetOpenerWindowHandle() only returns a value for non-views-hosted
|
||||
// popup browsers.
|
||||
opener_ = opener->GetWindowHandle();
|
||||
@@ -1697,8 +1597,8 @@ AlloyBrowserHostImpl::AlloyBrowserHostImpl(
|
||||
// Associate the platform delegate with this browser.
|
||||
platform_delegate_->BrowserCreated(this);
|
||||
|
||||
// Make sure RenderViewCreated is called at least one time.
|
||||
RenderViewCreated(web_contents->GetRenderViewHost());
|
||||
// Make sure RenderFrameCreated is called at least one time.
|
||||
RenderFrameCreated(web_contents->GetMainFrame());
|
||||
}
|
||||
|
||||
bool AlloyBrowserHostImpl::CreateHostWindow() {
|
||||
@@ -1707,7 +1607,7 @@ bool AlloyBrowserHostImpl::CreateHostWindow() {
|
||||
bool success = true;
|
||||
if (!IsWindowless())
|
||||
success = platform_delegate_->CreateHostWindow();
|
||||
if (success && !IsViewsHosted())
|
||||
if (success && !is_views_hosted_)
|
||||
host_window_handle_ = platform_delegate_->GetHostWindowHandle();
|
||||
return success;
|
||||
}
|
||||
|
@@ -31,7 +31,6 @@
|
||||
|
||||
class CefAudioCapturer;
|
||||
class CefBrowserInfo;
|
||||
class CefDevToolsManager;
|
||||
class SiteInstance;
|
||||
|
||||
// CefBrowser implementation for the alloy runtime. Method calls are delegated
|
||||
@@ -88,7 +87,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
void SetFocus(bool focus) override;
|
||||
CefWindowHandle GetWindowHandle() override;
|
||||
CefWindowHandle GetOpenerWindowHandle() override;
|
||||
bool HasView() override;
|
||||
double GetZoomLevel() override;
|
||||
void SetZoomLevel(double zoomLevel) override;
|
||||
void RunFileDialog(FileDialogMode mode,
|
||||
@@ -113,12 +111,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
const CefPoint& inspect_element_at) override;
|
||||
void CloseDevTools() override;
|
||||
bool HasDevTools() override;
|
||||
bool SendDevToolsMessage(const void* message, size_t message_size) override;
|
||||
int ExecuteDevToolsMethod(int message_id,
|
||||
const CefString& method,
|
||||
CefRefPtr<CefDictionaryValue> params) override;
|
||||
CefRefPtr<CefRegistration> AddDevToolsMessageObserver(
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer) override;
|
||||
bool IsWindowRenderingDisabled() override;
|
||||
void WasResized() override;
|
||||
void WasHidden(bool hidden) override;
|
||||
@@ -159,16 +151,13 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
bool IsBackgroundHost() override;
|
||||
|
||||
// Returns true if windowless rendering is enabled.
|
||||
bool IsWindowless() const;
|
||||
|
||||
// Returns true if this browser is views-hosted.
|
||||
bool IsViewsHosted() const;
|
||||
bool IsWindowless() const override;
|
||||
|
||||
// Returns true if this browser supports picture-in-picture.
|
||||
bool IsPictureInPictureSupported() const;
|
||||
|
||||
// Called when the OS window hosting the browser is destroyed.
|
||||
void WindowDestroyed();
|
||||
void WindowDestroyed() override;
|
||||
|
||||
// Destroy the browser members. This method should only be called after the
|
||||
// native browser window is not longer processing messages.
|
||||
@@ -177,16 +166,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
// Cancel display of the context menu, if any.
|
||||
void CancelContextMenu();
|
||||
|
||||
#if defined(USE_AURA)
|
||||
// Returns the Widget owner for the browser window. Only used with windowed
|
||||
// rendering.
|
||||
views::Widget* GetWindowWidget() const;
|
||||
|
||||
// Returns the BrowserView associated with this browser. Only used with views-
|
||||
// based browsers.
|
||||
CefRefPtr<CefBrowserView> GetBrowserView() const;
|
||||
#endif
|
||||
|
||||
bool MaybeAllowNavigation(content::RenderFrameHost* opener,
|
||||
bool is_guest_view,
|
||||
const content::OpenURLParams& params) override;
|
||||
@@ -203,9 +182,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
content::RenderWidgetHostImpl* source_rwh);
|
||||
void UpdateDragCursor(ui::mojom::DragOperation operation);
|
||||
|
||||
// Thread safe accessors.
|
||||
SkColor GetBackgroundColor() const;
|
||||
|
||||
// Accessors that must be called on the UI thread.
|
||||
extensions::ExtensionHost* GetExtensionHost() const;
|
||||
|
||||
@@ -320,7 +296,7 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
|
||||
// content::WebContentsObserver methods.
|
||||
using content::WebContentsObserver::BeforeUnloadFired;
|
||||
void RenderViewCreated(content::RenderViewHost* render_view_host) override;
|
||||
void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
|
||||
void RenderViewReady() override;
|
||||
void DidFinishNavigation(
|
||||
content::NavigationHandle* navigation_handle) override;
|
||||
@@ -366,15 +342,10 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
void StartAudioCapturer();
|
||||
void OnRecentlyAudibleTimerFired();
|
||||
|
||||
bool EnsureDevToolsManager();
|
||||
void InitializeDevToolsRegistrationOnUIThread(
|
||||
CefRefPtr<CefRegistration> registration);
|
||||
|
||||
void SetFocusInternal(bool focus);
|
||||
|
||||
CefWindowHandle opener_;
|
||||
const bool is_windowless_;
|
||||
const bool is_views_hosted_;
|
||||
CefWindowHandle host_window_handle_ = kNullWindowHandle;
|
||||
CefRefPtr<CefExtension> extension_;
|
||||
bool is_background_host_ = false;
|
||||
@@ -396,9 +367,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
// Used for creating and managing context menus.
|
||||
std::unique_ptr<CefMenuManager> menu_manager_;
|
||||
|
||||
// Used for creating and managing DevTools instances.
|
||||
std::unique_ptr<CefDevToolsManager> devtools_manager_;
|
||||
|
||||
// Used for capturing audio for CefAudioHandler.
|
||||
std::unique_ptr<CefAudioCapturer> audio_capturer_;
|
||||
|
||||
|
@@ -52,7 +52,6 @@
|
||||
#include "chrome/browser/chrome_browser_main_win.h"
|
||||
#include "chrome/browser/win/parental_controls.h"
|
||||
#include "components/os_crypt/os_crypt.h"
|
||||
#include "ui/base/cursor/cursor_loader_win.h"
|
||||
#endif
|
||||
#endif // defined(USE_AURA)
|
||||
|
||||
@@ -97,11 +96,6 @@ void AlloyBrowserMainParts::ToolkitInitialized() {
|
||||
CHECK(aura::Env::GetInstance());
|
||||
|
||||
wm_state_.reset(new wm::WMState);
|
||||
|
||||
#if defined(OS_WIN)
|
||||
ui::CursorLoaderWin::SetCursorResourceModule(
|
||||
CefAppManager::Get()->GetResourceDllName());
|
||||
#endif
|
||||
#endif // defined(USE_AURA)
|
||||
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
|
@@ -51,7 +51,6 @@
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "cef/grit/cef_resources.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/browser/chrome_content_browser_client.h"
|
||||
#include "chrome/browser/content_settings/cookie_settings_factory.h"
|
||||
#include "chrome/browser/net/profile_network_context_service.h"
|
||||
#include "chrome/browser/net/profile_network_context_service_factory.h"
|
||||
@@ -74,6 +73,8 @@
|
||||
#include "chrome/grit/generated_resources.h"
|
||||
#include "chrome/services/printing/printing_service.h"
|
||||
#include "components/content_settings/core/browser/cookie_settings.h"
|
||||
#include "components/embedder_support/switches.h"
|
||||
#include "components/embedder_support/user_agent_utils.h"
|
||||
#include "components/spellcheck/common/spellcheck.mojom.h"
|
||||
#include "components/version_info/version_info.h"
|
||||
#include "content/browser/plugin_service_impl.h"
|
||||
@@ -694,9 +695,9 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
switches::kLocalesDirPath,
|
||||
switches::kLogFile,
|
||||
switches::kLogSeverity,
|
||||
switches::kProductVersion,
|
||||
switches::kResourcesDirPath,
|
||||
switches::kUserAgent,
|
||||
embedder_support::kUserAgent,
|
||||
switches::kUserAgentProductAndVersion,
|
||||
};
|
||||
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
|
||||
base::size(kSwitchNames));
|
||||
@@ -950,8 +951,10 @@ bool AlloyContentBrowserClient::CanCreateWindow(
|
||||
}
|
||||
|
||||
void AlloyContentBrowserClient::OverrideWebkitPrefs(
|
||||
content::RenderViewHost* rvh,
|
||||
content::WebContents* web_contents,
|
||||
blink::web_pref::WebPreferences* prefs) {
|
||||
auto rvh = web_contents->GetRenderViewHost();
|
||||
|
||||
// Using RVH instead of RFH here because rvh->GetMainFrame() may be nullptr
|
||||
// when this method is called.
|
||||
renderer_prefs::PopulateWebPreferences(rvh, *prefs);
|
||||
@@ -1009,7 +1012,7 @@ AlloyContentBrowserClient::CreateURLLoaderThrottles(
|
||||
|
||||
// Used to substitute View ID for PDF contents when using the PDF plugin.
|
||||
result.push_back(std::make_unique<PluginResponseInterceptorURLLoaderThrottle>(
|
||||
request.resource_type, frame_tree_node_id));
|
||||
request.destination, frame_tree_node_id));
|
||||
|
||||
Profile* profile = Profile::FromBrowserContext(browser_context);
|
||||
|
||||
@@ -1035,13 +1038,6 @@ void AlloyContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
|
||||
}
|
||||
#endif // defined(OS_LINUX)
|
||||
|
||||
#if defined(OS_WIN)
|
||||
bool AlloyContentBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy,
|
||||
RendererSpawnFlags flags) {
|
||||
return true;
|
||||
}
|
||||
#endif // defined(OS_WIN)
|
||||
|
||||
void AlloyContentBrowserClient::ExposeInterfacesToRenderer(
|
||||
service_manager::BinderRegistry* registry,
|
||||
blink::AssociatedInterfaceRegistry* associated_registry,
|
||||
@@ -1191,7 +1187,8 @@ void AlloyContentBrowserClient::ConfigureNetworkContextParams(
|
||||
bool in_memory,
|
||||
const base::FilePath& relative_partition_path,
|
||||
network::mojom::NetworkContextParams* network_context_params,
|
||||
network::mojom::CertVerifierCreationParams* cert_verifier_creation_params) {
|
||||
cert_verifier::mojom::CertVerifierCreationParams*
|
||||
cert_verifier_creation_params) {
|
||||
// This method may be called during shutdown when using multi-threaded
|
||||
// message loop mode. In that case exit early to avoid crashes.
|
||||
if (!SystemNetworkContextManager::GetInstance()) {
|
||||
@@ -1325,8 +1322,7 @@ AlloyContentBrowserClient::GetSandboxedStorageServiceDataDirectory() {
|
||||
}
|
||||
|
||||
std::string AlloyContentBrowserClient::GetProduct() {
|
||||
// Match the logic in chrome_content_browser_client.cc GetProduct().
|
||||
return ::GetProduct();
|
||||
return embedder_support::GetProduct();
|
||||
}
|
||||
|
||||
std::string AlloyContentBrowserClient::GetChromeProduct() {
|
||||
@@ -1334,8 +1330,7 @@ std::string AlloyContentBrowserClient::GetChromeProduct() {
|
||||
}
|
||||
|
||||
std::string AlloyContentBrowserClient::GetUserAgent() {
|
||||
// Match the logic in chrome_content_browser_client.cc GetUserAgent().
|
||||
return ::GetUserAgent();
|
||||
return embedder_support::GetUserAgent();
|
||||
}
|
||||
|
||||
blink::UserAgentMetadata AlloyContentBrowserClient::GetUserAgentMetadata() {
|
||||
|
@@ -101,7 +101,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||
bool user_gesture,
|
||||
bool opener_suppressed,
|
||||
bool* no_javascript_access) override;
|
||||
void OverrideWebkitPrefs(content::RenderViewHost* rvh,
|
||||
void OverrideWebkitPrefs(content::WebContents* web_contents,
|
||||
blink::web_pref::WebPreferences* prefs) override;
|
||||
bool OverrideWebPreferencesAfterNavigation(
|
||||
content::WebContents* web_contents,
|
||||
@@ -128,11 +128,6 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||
content::PosixFileDescriptorInfo* mappings) override;
|
||||
#endif
|
||||
|
||||
#if defined(OS_WIN)
|
||||
bool PreSpawnRenderer(sandbox::TargetPolicy* policy,
|
||||
RendererSpawnFlags flags) override;
|
||||
#endif
|
||||
|
||||
void ExposeInterfacesToRenderer(
|
||||
service_manager::BinderRegistry* registry,
|
||||
blink::AssociatedInterfaceRegistry* associated_registry,
|
||||
@@ -177,8 +172,8 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||
bool in_memory,
|
||||
const base::FilePath& relative_partition_path,
|
||||
network::mojom::NetworkContextParams* network_context_params,
|
||||
network::mojom::CertVerifierCreationParams* cert_verifier_creation_params)
|
||||
override;
|
||||
cert_verifier::mojom::CertVerifierCreationParams*
|
||||
cert_verifier_creation_params) override;
|
||||
std::vector<base::FilePath> GetNetworkContextsParentDirectory() override;
|
||||
bool HandleExternalProtocol(
|
||||
const GURL& url,
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include "libcef/browser/extensions/extension_web_contents_observer.h"
|
||||
#include "libcef/browser/printing/print_view_manager.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
#include "libcef/common/net/url_util.h"
|
||||
#include "libcef/features/runtime_checks.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
@@ -58,12 +59,13 @@ content::WebContents* CefBrowserPlatformDelegateAlloy::CreateWebContents(
|
||||
}
|
||||
|
||||
scoped_refptr<content::SiteInstance> site_instance;
|
||||
if (extensions::ExtensionsEnabled() && !create_params.url.is_empty()) {
|
||||
if (extensions::ExtensionsEnabled() && !create_params.url.empty()) {
|
||||
GURL gurl = url_util::MakeGURL(create_params.url, /*fixup=*/true);
|
||||
if (!create_params.extension) {
|
||||
// We might be loading an extension app view where the extension URL is
|
||||
// provided by the client.
|
||||
create_params.extension =
|
||||
extensions::GetExtensionForUrl(browser_context, create_params.url);
|
||||
extensions::GetExtensionForUrl(browser_context, gurl);
|
||||
}
|
||||
if (create_params.extension) {
|
||||
if (create_params.extension_host_type == extensions::VIEW_TYPE_INVALID) {
|
||||
@@ -79,7 +81,7 @@ content::WebContents* CefBrowserPlatformDelegateAlloy::CreateWebContents(
|
||||
// ExtensionProtocolHandler::MaybeCreateJob will return false resulting in
|
||||
// ERR_BLOCKED_BY_CLIENT).
|
||||
site_instance = extensions::ProcessManager::Get(browser_context)
|
||||
->GetSiteInstanceForURL(create_params.url);
|
||||
->GetSiteInstanceForURL(gurl);
|
||||
DCHECK(site_instance);
|
||||
}
|
||||
}
|
||||
@@ -206,7 +208,7 @@ void CefBrowserPlatformDelegateAlloy::CreateExtensionHost(
|
||||
extension_host_ = new extensions::CefExtensionViewHost(
|
||||
alloy_browser, extension, web_contents_, url, host_type);
|
||||
// Trigger load of the extension URL.
|
||||
extension_host_->CreateRenderViewSoon();
|
||||
extension_host_->CreateRendererSoon();
|
||||
} else if (host_type == extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
|
||||
is_background_host_ = true;
|
||||
alloy_browser->is_background_host_ = true;
|
||||
|
@@ -128,11 +128,6 @@ metrics::MetricsService* ChromeBrowserProcessAlloy::metrics_service() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
rappor::RapporServiceImpl* ChromeBrowserProcessAlloy::rappor_service() {
|
||||
// Called from PluginInfoHostImpl::ReportMetrics.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SystemNetworkContextManager*
|
||||
ChromeBrowserProcessAlloy::system_network_context_manager() {
|
||||
DCHECK(SystemNetworkContextManager::GetInstance());
|
||||
|
@@ -44,7 +44,6 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
|
||||
metrics_services_manager::MetricsServicesManager* GetMetricsServicesManager()
|
||||
override;
|
||||
metrics::MetricsService* metrics_service() override;
|
||||
rappor::RapporServiceImpl* rappor_service() override;
|
||||
SystemNetworkContextManager* system_network_context_manager() override;
|
||||
network::NetworkQualityTracker* network_quality_tracker() override;
|
||||
WatchDogThread* watchdog_thread() override;
|
||||
|
@@ -109,10 +109,6 @@ bool ChromeProfileAlloy::IsChild() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ChromeProfileAlloy::IsLegacySupervised() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
ExtensionSpecialStoragePolicy*
|
||||
ChromeProfileAlloy::GetExtensionSpecialStoragePolicy() {
|
||||
NOTREACHED();
|
||||
|
@@ -37,7 +37,6 @@ class ChromeProfileAlloy : public Profile {
|
||||
const Profile* GetOriginalProfile() const override;
|
||||
bool IsSupervised() const override;
|
||||
bool IsChild() const override;
|
||||
bool IsLegacySupervised() const override;
|
||||
ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy() override;
|
||||
PrefService* GetOffTheRecordPrefs() override;
|
||||
bool IsSameOrParent(Profile* profile) override;
|
||||
|
@@ -41,9 +41,7 @@ void CefBrowserContentsDelegate::ObserveWebContents(
|
||||
content::Source<content::NavigationController>(
|
||||
&new_contents->GetController()));
|
||||
|
||||
// Make sure RenderViewCreated is called at least one time.
|
||||
RenderViewCreated(new_contents->GetRenderViewHost());
|
||||
|
||||
// Make sure RenderFrameCreated is called at least one time.
|
||||
// Create the frame representation before OnAfterCreated is called for a new
|
||||
// browser. Additionally, RenderFrameCreated is otherwise not called at all
|
||||
// for new popup browsers.
|
||||
@@ -70,9 +68,12 @@ content::WebContents* CefBrowserContentsDelegate::OpenURLFromTab(
|
||||
|
||||
if (auto c = client()) {
|
||||
if (auto handler = c->GetRequestHandler()) {
|
||||
// May return nullptr for omnibox navigations.
|
||||
auto frame = browser()->GetFrame(params.frame_tree_node_id);
|
||||
if (!frame)
|
||||
frame = browser()->GetMainFrame();
|
||||
cancel = handler->OnOpenURLFromTab(
|
||||
browser(), browser()->GetFrame(params.frame_tree_node_id),
|
||||
params.url.spec(),
|
||||
browser(), frame, params.url.spec(),
|
||||
static_cast<cef_window_open_disposition_t>(params.disposition),
|
||||
params.user_gesture);
|
||||
}
|
||||
@@ -107,6 +108,7 @@ void CefBrowserContentsDelegate::LoadingStateChanged(
|
||||
|
||||
if (auto c = client()) {
|
||||
if (auto handler = c->GetLoadHandler()) {
|
||||
auto navigation_lock = browser_info_->CreateNavigationLock();
|
||||
handler->OnLoadingStateChange(browser(), is_loading, can_go_back,
|
||||
can_go_forward);
|
||||
}
|
||||
@@ -229,6 +231,18 @@ bool CefBrowserContentsDelegate::HandleKeyboardEvent(
|
||||
void CefBrowserContentsDelegate::RenderFrameCreated(
|
||||
content::RenderFrameHost* render_frame_host) {
|
||||
browser_info_->MaybeCreateFrame(render_frame_host, false /* is_guest_view */);
|
||||
|
||||
if (render_frame_host->GetParent() == nullptr) {
|
||||
// May be already registered if the renderer crashed previously.
|
||||
auto render_view_host = render_frame_host->GetRenderViewHost();
|
||||
if (!registrar_->IsRegistered(
|
||||
this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
|
||||
content::Source<content::RenderViewHost>(render_view_host))) {
|
||||
registrar_->Add(
|
||||
this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
|
||||
content::Source<content::RenderViewHost>(render_view_host));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserContentsDelegate::RenderFrameHostChanged(
|
||||
@@ -249,17 +263,6 @@ void CefBrowserContentsDelegate::RenderFrameDeleted(
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserContentsDelegate::RenderViewCreated(
|
||||
content::RenderViewHost* render_view_host) {
|
||||
// May be already registered if the renderer crashed previously.
|
||||
if (!registrar_->IsRegistered(
|
||||
this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
|
||||
content::Source<content::RenderViewHost>(render_view_host))) {
|
||||
registrar_->Add(this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
|
||||
content::Source<content::RenderViewHost>(render_view_host));
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserContentsDelegate::RenderViewDeleted(
|
||||
content::RenderViewHost* render_view_host) {
|
||||
if (registrar_->IsRegistered(
|
||||
@@ -508,6 +511,7 @@ void CefBrowserContentsDelegate::OnLoadEnd(CefRefPtr<CefFrame> frame,
|
||||
int http_status_code) {
|
||||
if (auto c = client()) {
|
||||
if (auto handler = c->GetLoadHandler()) {
|
||||
auto navigation_lock = browser_info_->CreateNavigationLock();
|
||||
handler->OnLoadEnd(browser(), frame, http_status_code);
|
||||
}
|
||||
}
|
||||
@@ -566,6 +570,7 @@ void CefBrowserContentsDelegate::OnLoadStart(
|
||||
ui::PageTransition transition_type) {
|
||||
if (auto c = client()) {
|
||||
if (auto handler = c->GetLoadHandler()) {
|
||||
auto navigation_lock = browser_info_->CreateNavigationLock();
|
||||
// On the handler that loading has started.
|
||||
handler->OnLoadStart(browser(), frame,
|
||||
static_cast<cef_transition_type_t>(transition_type));
|
||||
|
@@ -108,7 +108,6 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
|
||||
void RenderFrameHostChanged(content::RenderFrameHost* old_host,
|
||||
content::RenderFrameHost* new_host) override;
|
||||
void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
|
||||
void RenderViewCreated(content::RenderViewHost* render_view_host) override;
|
||||
void RenderViewDeleted(content::RenderViewHost* render_view_host) override;
|
||||
void RenderViewReady() override;
|
||||
void RenderProcessGone(base::TerminationStatus status) override;
|
||||
|
@@ -7,16 +7,20 @@
|
||||
#include <map>
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/iothread_state.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/media_router/media_router_manager.h"
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
#include "libcef/features/runtime.h"
|
||||
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/lazy_instance.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/no_destructor.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/browser_task_traits.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
@@ -141,6 +145,28 @@ CefBrowserContext* GetSelf(base::WeakPtr<CefBrowserContext> self) {
|
||||
return self.get();
|
||||
}
|
||||
|
||||
CefBrowserContext::CookieableSchemes MakeSupportedSchemes(
|
||||
const CefString& schemes_list,
|
||||
bool include_defaults) {
|
||||
std::vector<std::string> all_schemes;
|
||||
if (!schemes_list.empty()) {
|
||||
all_schemes =
|
||||
base::SplitString(schemes_list.ToString(), std::string(","),
|
||||
base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
|
||||
}
|
||||
|
||||
if (include_defaults) {
|
||||
// Add default schemes that should always support cookies.
|
||||
// This list should match CookieMonster::kDefaultCookieableSchemes.
|
||||
all_schemes.push_back("http");
|
||||
all_schemes.push_back("https");
|
||||
all_schemes.push_back("ws");
|
||||
all_schemes.push_back("wss");
|
||||
}
|
||||
|
||||
return base::make_optional(all_schemes);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefBrowserContext::CefBrowserContext(const CefRequestContextSettings& settings)
|
||||
@@ -154,13 +180,6 @@ CefBrowserContext::~CefBrowserContext() {
|
||||
#if DCHECK_IS_ON()
|
||||
DCHECK(is_shutdown_);
|
||||
#endif
|
||||
|
||||
if (iothread_state_) {
|
||||
// Destruction of the CefIOThreadState will trigger destruction of all
|
||||
// associated network requests.
|
||||
content::BrowserThread::DeleteSoon(content::BrowserThread::IO, FROM_HERE,
|
||||
iothread_state_.release());
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserContext::Initialize() {
|
||||
@@ -169,7 +188,14 @@ void CefBrowserContext::Initialize() {
|
||||
if (!cache_path_.empty())
|
||||
g_manager.Get().SetImplPath(this, cache_path_);
|
||||
|
||||
iothread_state_ = std::make_unique<CefIOThreadState>();
|
||||
iothread_state_ = base::MakeRefCounted<CefIOThreadState>();
|
||||
|
||||
if (settings_.cookieable_schemes_list.length > 0 ||
|
||||
settings_.cookieable_schemes_exclude_defaults) {
|
||||
cookieable_schemes_ =
|
||||
MakeSupportedSchemes(CefString(&settings_.cookieable_schemes_list),
|
||||
!settings_.cookieable_schemes_exclude_defaults);
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserContext::Shutdown() {
|
||||
@@ -229,6 +255,25 @@ CefBrowserContext* CefBrowserContext::FromBrowserContext(
|
||||
return g_manager.Get().GetImplFromBrowserContext(context);
|
||||
}
|
||||
|
||||
// static
|
||||
CefBrowserContext* CefBrowserContext::FromProfile(const Profile* profile) {
|
||||
auto* cef_context = FromBrowserContext(profile);
|
||||
if (cef_context)
|
||||
return cef_context;
|
||||
|
||||
if (cef::IsChromeRuntimeEnabled()) {
|
||||
auto* original_profile = profile->GetOriginalProfile();
|
||||
if (original_profile != profile) {
|
||||
// With the Chrome runtime if the user launches an incognito window via
|
||||
// the UI we might be associated with the original Profile instead of the
|
||||
// (current) incognito profile.
|
||||
return FromBrowserContext(original_profile);
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// static
|
||||
std::vector<CefBrowserContext*> CefBrowserContext::GetAll() {
|
||||
return g_manager.Get().GetAllImpl();
|
||||
@@ -254,15 +299,10 @@ void CefBrowserContext::OnRenderFrameCreated(
|
||||
handler_map_.AddHandler(render_process_id, render_frame_id,
|
||||
frame_tree_node_id, handler);
|
||||
|
||||
if (iothread_state_) {
|
||||
// Using base::Unretained() is safe because both this callback and
|
||||
// possible deletion of |iothread_state_| will execute on the IO thread,
|
||||
// and this callback will be executed first.
|
||||
CEF_POST_TASK(CEF_IOT, base::Bind(&CefIOThreadState::AddHandler,
|
||||
base::Unretained(iothread_state_.get()),
|
||||
render_process_id, render_frame_id,
|
||||
frame_tree_node_id, handler));
|
||||
}
|
||||
CEF_POST_TASK(CEF_IOT,
|
||||
base::Bind(&CefIOThreadState::AddHandler, iothread_state_,
|
||||
render_process_id, render_frame_id,
|
||||
frame_tree_node_id, handler));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,15 +332,9 @@ void CefBrowserContext::OnRenderFrameDeleted(
|
||||
handler_map_.RemoveHandler(render_process_id, render_frame_id,
|
||||
frame_tree_node_id);
|
||||
|
||||
if (iothread_state_) {
|
||||
// Using base::Unretained() is safe because both this callback and
|
||||
// possible deletion of |iothread_state_| will execute on the IO thread,
|
||||
// and this callback will be executed first.
|
||||
CEF_POST_TASK(CEF_IOT, base::Bind(&CefIOThreadState::RemoveHandler,
|
||||
base::Unretained(iothread_state_.get()),
|
||||
render_process_id, render_frame_id,
|
||||
frame_tree_node_id));
|
||||
}
|
||||
CEF_POST_TASK(CEF_IOT, base::Bind(&CefIOThreadState::RemoveHandler,
|
||||
iothread_state_, render_process_id,
|
||||
render_frame_id, frame_tree_node_id));
|
||||
}
|
||||
|
||||
if (is_main_frame) {
|
||||
@@ -404,26 +438,15 @@ void CefBrowserContext::RegisterSchemeHandlerFactory(
|
||||
const CefString& scheme_name,
|
||||
const CefString& domain_name,
|
||||
CefRefPtr<CefSchemeHandlerFactory> factory) {
|
||||
if (iothread_state_) {
|
||||
// Using base::Unretained() is safe because both this callback and possible
|
||||
// deletion of |iothread_state_| will execute on the IO thread, and this
|
||||
// callback will be executed first.
|
||||
CEF_POST_TASK(CEF_IOT,
|
||||
base::Bind(&CefIOThreadState::RegisterSchemeHandlerFactory,
|
||||
base::Unretained(iothread_state_.get()),
|
||||
scheme_name, domain_name, factory));
|
||||
}
|
||||
CEF_POST_TASK(CEF_IOT,
|
||||
base::Bind(&CefIOThreadState::RegisterSchemeHandlerFactory,
|
||||
iothread_state_, scheme_name, domain_name, factory));
|
||||
}
|
||||
|
||||
void CefBrowserContext::ClearSchemeHandlerFactories() {
|
||||
if (iothread_state_) {
|
||||
// Using base::Unretained() is safe because both this callback and possible
|
||||
// deletion of |iothread_state_| will execute on the IO thread, and this
|
||||
// callback will be executed first.
|
||||
CEF_POST_TASK(CEF_IOT,
|
||||
base::Bind(&CefIOThreadState::ClearSchemeHandlerFactories,
|
||||
base::Unretained(iothread_state_.get())));
|
||||
}
|
||||
CEF_POST_TASK(CEF_IOT,
|
||||
base::Bind(&CefIOThreadState::ClearSchemeHandlerFactories,
|
||||
iothread_state_));
|
||||
}
|
||||
|
||||
void CefBrowserContext::LoadExtension(
|
||||
@@ -477,5 +500,24 @@ CefBrowserContext::CookieableSchemes CefBrowserContext::GetCookieableSchemes()
|
||||
if (cookieable_schemes_)
|
||||
return cookieable_schemes_;
|
||||
|
||||
return CefCookieManagerImpl::GetGlobalCookieableSchemes();
|
||||
return GetGlobalCookieableSchemes();
|
||||
}
|
||||
|
||||
// static
|
||||
CefBrowserContext::CookieableSchemes
|
||||
CefBrowserContext::GetGlobalCookieableSchemes() {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
static base::NoDestructor<CookieableSchemes> schemes(
|
||||
[]() -> CookieableSchemes {
|
||||
const auto& settings = CefContext::Get()->settings();
|
||||
if (settings.cookieable_schemes_list.length > 0 ||
|
||||
settings.cookieable_schemes_exclude_defaults) {
|
||||
return MakeSupportedSchemes(
|
||||
CefString(&settings.cookieable_schemes_list),
|
||||
!settings.cookieable_schemes_exclude_defaults);
|
||||
}
|
||||
return base::nullopt;
|
||||
}());
|
||||
return *schemes;
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "include/cef_request_context_handler.h"
|
||||
#include "libcef/browser/iothread_state.h"
|
||||
#include "libcef/browser/request_context_handler_map.h"
|
||||
|
||||
#include "base/callback.h"
|
||||
@@ -80,7 +81,6 @@ class BrowserContext;
|
||||
|
||||
class CefMediaRouterManager;
|
||||
class CefRequestContextImpl;
|
||||
class CefIOThreadState;
|
||||
class Profile;
|
||||
|
||||
// Main entry point for configuring behavior on a per-RequestContext basis. The
|
||||
@@ -103,6 +103,7 @@ class CefBrowserContext {
|
||||
// Returns the underlying CefBrowserContext if any.
|
||||
static CefBrowserContext* FromBrowserContext(
|
||||
const content::BrowserContext* context);
|
||||
static CefBrowserContext* FromProfile(const Profile* profile);
|
||||
|
||||
// Returns all existing CefBrowserContext.
|
||||
static std::vector<CefBrowserContext*> GetAll();
|
||||
@@ -111,6 +112,13 @@ class CefBrowserContext {
|
||||
virtual content::BrowserContext* AsBrowserContext() = 0;
|
||||
virtual Profile* AsProfile() = 0;
|
||||
|
||||
// Returns true if the context is fully initialized.
|
||||
virtual bool IsInitialized() const = 0;
|
||||
|
||||
// If the context is fully initialized execute |callback|, otherwise
|
||||
// store it until the context is fully initialized.
|
||||
virtual void StoreOrTriggerInitCallback(base::OnceClosure callback) = 0;
|
||||
|
||||
// Called from CefRequestContextImpl to track associated objects. This
|
||||
// object will delete itself when the count reaches zero.
|
||||
void AddCefRequestContext(CefRequestContextImpl* context);
|
||||
@@ -197,17 +205,15 @@ class CefBrowserContext {
|
||||
// Returns the schemes associated with this context specifically, or the
|
||||
// global configuration if unset.
|
||||
CookieableSchemes GetCookieableSchemes() const;
|
||||
|
||||
// Set the schemes associated with this context specifically.
|
||||
void set_cookieable_schemes(const CookieableSchemes& schemes) {
|
||||
cookieable_schemes_ = schemes;
|
||||
}
|
||||
static CookieableSchemes GetGlobalCookieableSchemes();
|
||||
|
||||
// These accessors are safe to call from any thread because the values don't
|
||||
// change during this object's lifespan.
|
||||
const CefRequestContextSettings& settings() const { return settings_; }
|
||||
base::FilePath cache_path() const { return cache_path_; }
|
||||
CefIOThreadState* iothread_state() const { return iothread_state_.get(); }
|
||||
scoped_refptr<CefIOThreadState> iothread_state() const {
|
||||
return iothread_state_;
|
||||
}
|
||||
|
||||
// Used to hold a WeakPtr reference to this this object. The Getter returns
|
||||
// nullptr if this object has already been destroyed.
|
||||
@@ -230,7 +236,7 @@ class CefBrowserContext {
|
||||
base::FilePath cache_path_;
|
||||
|
||||
private:
|
||||
std::unique_ptr<CefIOThreadState> iothread_state_;
|
||||
scoped_refptr<CefIOThreadState> iothread_state_;
|
||||
CookieableSchemes cookieable_schemes_;
|
||||
std::unique_ptr<CefMediaRouterManager> media_router_manager_;
|
||||
|
||||
|
@@ -6,16 +6,17 @@
|
||||
|
||||
#include "libcef/browser/browser_info_manager.h"
|
||||
#include "libcef/browser/browser_platform_delegate.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/image_impl.h"
|
||||
#include "libcef/browser/navigation_entry_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/net/url_util.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "chrome/browser/spellchecker/spellcheck_factory.h"
|
||||
#include "chrome/browser/spellchecker/spellcheck_service.h"
|
||||
#include "components/favicon/core/favicon_url.h"
|
||||
#include "components/spellcheck/common/spellcheck_features.h"
|
||||
#include "components/url_formatter/url_fixer.h"
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/download_manager.h"
|
||||
#include "content/public/browser/download_request_utils.h"
|
||||
@@ -163,7 +164,8 @@ CefBrowserHostBase::CefBrowserHostBase(
|
||||
client_(client),
|
||||
platform_delegate_(std::move(platform_delegate)),
|
||||
browser_info_(browser_info),
|
||||
request_context_(request_context) {
|
||||
request_context_(request_context),
|
||||
is_views_hosted_(platform_delegate_->IsViewsHosted()) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(!browser_info_->browser().get());
|
||||
browser_info_->SetBrowser(this);
|
||||
@@ -184,6 +186,8 @@ void CefBrowserHostBase::InitializeBrowser() {
|
||||
void CefBrowserHostBase::DestroyBrowser() {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
devtools_manager_.reset(nullptr);
|
||||
|
||||
platform_delegate_.reset(nullptr);
|
||||
|
||||
contents_delegate_->RemoveObserver(this);
|
||||
@@ -205,6 +209,10 @@ CefRefPtr<CefRequestContext> CefBrowserHostBase::GetRequestContext() {
|
||||
return request_context_;
|
||||
}
|
||||
|
||||
bool CefBrowserHostBase::HasView() {
|
||||
return is_views_hosted_;
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::StartDownload(const CefString& url) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
@@ -284,6 +292,54 @@ void CefBrowserHostBase::DownloadImage(
|
||||
max_image_size, callback));
|
||||
}
|
||||
|
||||
bool CefBrowserHostBase::SendDevToolsMessage(const void* message,
|
||||
size_t message_size) {
|
||||
if (!message || message_size == 0)
|
||||
return false;
|
||||
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
std::string message_str(static_cast<const char*>(message), message_size);
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(
|
||||
[](CefRefPtr<CefBrowserHostBase> self, std::string message_str) {
|
||||
self->SendDevToolsMessage(message_str.data(), message_str.size());
|
||||
},
|
||||
CefRefPtr<CefBrowserHostBase>(this), std::move(message_str)));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!EnsureDevToolsManager())
|
||||
return false;
|
||||
return devtools_manager_->SendDevToolsMessage(message, message_size);
|
||||
}
|
||||
|
||||
int CefBrowserHostBase::ExecuteDevToolsMethod(
|
||||
int message_id,
|
||||
const CefString& method,
|
||||
CefRefPtr<CefDictionaryValue> params) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT, base::BindOnce(base::IgnoreResult(
|
||||
&CefBrowserHostBase::ExecuteDevToolsMethod),
|
||||
this, message_id, method, params));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!EnsureDevToolsManager())
|
||||
return 0;
|
||||
return devtools_manager_->ExecuteDevToolsMethod(message_id, method, params);
|
||||
}
|
||||
|
||||
CefRefPtr<CefRegistration> CefBrowserHostBase::AddDevToolsMessageObserver(
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer) {
|
||||
if (!observer)
|
||||
return nullptr;
|
||||
auto registration = CefDevToolsManager::CreateRegistration(observer);
|
||||
InitializeDevToolsRegistrationOnUIThread(registration);
|
||||
return registration.get();
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::GetNavigationEntries(
|
||||
CefRefPtr<CefNavigationEntryVisitor> visitor,
|
||||
bool current_only) {
|
||||
@@ -706,16 +762,9 @@ bool CefBrowserHostBase::Navigate(const content::OpenURLParams& params) {
|
||||
CEF_REQUIRE_UIT();
|
||||
auto web_contents = GetWebContents();
|
||||
if (web_contents) {
|
||||
// Fix common problems with user-typed text. Among other things, this:
|
||||
// - Converts absolute file paths to "file://" URLs.
|
||||
// - Normalizes "about:" and "chrome:" to "chrome://" URLs.
|
||||
// - Adds the "http://" scheme if none was specified.
|
||||
GURL gurl = url_formatter::FixupURL(params.url.possibly_invalid_spec(),
|
||||
std::string());
|
||||
if (!gurl.is_valid()) {
|
||||
LOG(ERROR) << "Invalid URL: " << params.url.possibly_invalid_spec();
|
||||
GURL gurl = params.url;
|
||||
if (!url_util::FixupGURL(gurl))
|
||||
return false;
|
||||
}
|
||||
|
||||
web_contents->GetController().LoadURL(
|
||||
gurl, params.referrer, params.transition, params.extra_headers);
|
||||
@@ -778,6 +827,16 @@ int CefBrowserHostBase::browser_id() const {
|
||||
return browser_info_->browser_id();
|
||||
}
|
||||
|
||||
SkColor CefBrowserHostBase::GetBackgroundColor() const {
|
||||
// Don't use |platform_delegate_| because it's not thread-safe.
|
||||
return CefContext::Get()->GetBackgroundColor(
|
||||
&settings_, IsWindowless() ? STATE_ENABLED : STATE_DISABLED);
|
||||
}
|
||||
|
||||
bool CefBrowserHostBase::IsWindowless() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
content::WebContents* CefBrowserHostBase::GetWebContents() const {
|
||||
CEF_REQUIRE_UIT();
|
||||
return contents_delegate_->web_contents();
|
||||
@@ -790,3 +849,46 @@ content::BrowserContext* CefBrowserHostBase::GetBrowserContext() const {
|
||||
return web_contents->GetBrowserContext();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
views::Widget* CefBrowserHostBase::GetWindowWidget() const {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!platform_delegate_)
|
||||
return nullptr;
|
||||
return platform_delegate_->GetWindowWidget();
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowserView> CefBrowserHostBase::GetBrowserView() const {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (is_views_hosted_ && platform_delegate_)
|
||||
return platform_delegate_->GetBrowserView();
|
||||
return nullptr;
|
||||
}
|
||||
#endif // defined(TOOLKIT_VIEWS)
|
||||
|
||||
bool CefBrowserHostBase::EnsureDevToolsManager() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!contents_delegate_->web_contents())
|
||||
return false;
|
||||
|
||||
if (!devtools_manager_) {
|
||||
devtools_manager_.reset(new CefDevToolsManager(this));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::InitializeDevToolsRegistrationOnUIThread(
|
||||
CefRefPtr<CefRegistration> registration) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(
|
||||
&CefBrowserHostBase::InitializeDevToolsRegistrationOnUIThread, this,
|
||||
registration));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!EnsureDevToolsManager())
|
||||
return;
|
||||
devtools_manager_->InitializeRegistrationOnUIThread(registration);
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include "libcef/browser/browser_contents_delegate.h"
|
||||
#include "libcef/browser/browser_info.h"
|
||||
#include "libcef/browser/browser_platform_delegate.h"
|
||||
#include "libcef/browser/devtools/devtools_manager.h"
|
||||
#include "libcef/browser/frame_host_impl.h"
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
|
||||
@@ -38,6 +39,9 @@ struct CefBrowserCreateParams {
|
||||
settings = that.settings;
|
||||
request_context = that.request_context;
|
||||
extra_info = that.extra_info;
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
browser_view = that.browser_view;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -45,11 +49,15 @@ struct CefBrowserCreateParams {
|
||||
// views-hosted browser. Currently used with the alloy runtime only.
|
||||
std::unique_ptr<CefWindowInfo> window_info;
|
||||
|
||||
#if defined(USE_AURA)
|
||||
// The BrowserView that will own a views-hosted browser. Will be nullptr for
|
||||
// popup browsers (the BrowserView will be created later in that case).
|
||||
// Currently used with the alloy runtime only.
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
// The BrowserView that will own a Views-hosted browser. Will be nullptr for
|
||||
// popup browsers.
|
||||
CefRefPtr<CefBrowserView> browser_view;
|
||||
|
||||
// True if this browser is a popup and has a Views-hosted opener, in which
|
||||
// case the BrowserView for this browser will be created later (from
|
||||
// PopupWebContentsCreated).
|
||||
bool popup_with_views_hosted_opener = false;
|
||||
#endif
|
||||
|
||||
// Client implementation. May be nullptr.
|
||||
@@ -57,7 +65,7 @@ struct CefBrowserCreateParams {
|
||||
|
||||
// Initial URL to load. May be empty. If this is a valid extension URL then
|
||||
// the browser will be created as an app view extension host.
|
||||
GURL url;
|
||||
CefString url;
|
||||
|
||||
// Browser settings.
|
||||
CefBrowserSettings settings;
|
||||
@@ -100,6 +108,11 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
virtual ~Observer() {}
|
||||
};
|
||||
|
||||
// Create a new CefBrowserHost instance of the current runtime type with
|
||||
// owned WebContents.
|
||||
static CefRefPtr<CefBrowserHostBase> Create(
|
||||
CefBrowserCreateParams& create_params);
|
||||
|
||||
// Returns the browser associated with the specified RenderViewHost.
|
||||
static CefRefPtr<CefBrowserHostBase> GetBrowserForHost(
|
||||
const content::RenderViewHost* host);
|
||||
@@ -127,6 +140,10 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
// Called on the UI thread after the associated WebContents is created.
|
||||
virtual void InitializeBrowser();
|
||||
|
||||
// Called on the UI thread when the OS window hosting the browser is
|
||||
// destroyed.
|
||||
virtual void WindowDestroyed() = 0;
|
||||
|
||||
// Called on the UI thread after the associated WebContents is destroyed.
|
||||
// Also called from CefBrowserInfoManager::DestroyAllBrowsers if the browser
|
||||
// was not properly shut down.
|
||||
@@ -136,6 +153,7 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
CefRefPtr<CefBrowser> GetBrowser() override;
|
||||
CefRefPtr<CefClient> GetClient() override;
|
||||
CefRefPtr<CefRequestContext> GetRequestContext() override;
|
||||
bool HasView() override;
|
||||
void StartDownload(const CefString& url) override;
|
||||
void DownloadImage(const CefString& image_url,
|
||||
bool is_favicon,
|
||||
@@ -153,6 +171,12 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
void SendMouseWheelEvent(const CefMouseEvent& event,
|
||||
int deltaX,
|
||||
int deltaY) override;
|
||||
bool SendDevToolsMessage(const void* message, size_t message_size) override;
|
||||
int ExecuteDevToolsMethod(int message_id,
|
||||
const CefString& method,
|
||||
CefRefPtr<CefDictionaryValue> params) override;
|
||||
CefRefPtr<CefRegistration> AddDevToolsMessageObserver(
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer) override;
|
||||
void GetNavigationEntries(CefRefPtr<CefNavigationEntryVisitor> visitor,
|
||||
bool current_only) override;
|
||||
CefRefPtr<CefNavigationEntry> GetVisibleNavigationEntry() override;
|
||||
@@ -221,6 +245,11 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
CefRefPtr<CefRequestContextImpl> request_context() const {
|
||||
return request_context_;
|
||||
}
|
||||
bool is_views_hosted() const { return is_views_hosted_; }
|
||||
SkColor GetBackgroundColor() const;
|
||||
|
||||
// Returns true if windowless rendering is enabled.
|
||||
virtual bool IsWindowless() const;
|
||||
|
||||
// Accessors that must be called on the UI thread.
|
||||
content::WebContents* GetWebContents() const;
|
||||
@@ -232,7 +261,21 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
return contents_delegate_.get();
|
||||
}
|
||||
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
// Returns the Widget owner for the browser window. Only used with windowed
|
||||
// rendering.
|
||||
views::Widget* GetWindowWidget() const;
|
||||
|
||||
// Returns the BrowserView associated with this browser. Only used with Views-
|
||||
// based browsers.
|
||||
CefRefPtr<CefBrowserView> GetBrowserView() const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
bool EnsureDevToolsManager();
|
||||
void InitializeDevToolsRegistrationOnUIThread(
|
||||
CefRefPtr<CefRegistration> registration);
|
||||
|
||||
// Called from LoadMainFrameURL to perform the actual navigation.
|
||||
virtual bool Navigate(const content::OpenURLParams& params);
|
||||
|
||||
@@ -242,6 +285,7 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate_;
|
||||
scoped_refptr<CefBrowserInfo> browser_info_;
|
||||
CefRefPtr<CefRequestContextImpl> request_context_;
|
||||
const bool is_views_hosted_;
|
||||
|
||||
// Only accessed on the UI thread.
|
||||
std::unique_ptr<CefBrowserContentsDelegate> contents_delegate_;
|
||||
@@ -260,6 +304,9 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
bool is_fullscreen_ = false;
|
||||
CefRefPtr<CefFrameHostImpl> focused_frame_;
|
||||
|
||||
// Used for creating and managing DevTools instances.
|
||||
std::unique_ptr<CefDevToolsManager> devtools_manager_;
|
||||
|
||||
private:
|
||||
IMPLEMENT_REFCOUNTING(CefBrowserHostBase);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserHostBase);
|
||||
|
@@ -27,6 +27,11 @@ class CreateBrowserHelper {
|
||||
extra_info_(extra_info),
|
||||
request_context_(request_context) {}
|
||||
|
||||
void Run() {
|
||||
CefBrowserHost::CreateBrowserSync(window_info_, client_, url_, settings_,
|
||||
extra_info_, request_context_);
|
||||
}
|
||||
|
||||
CefWindowInfo window_info_;
|
||||
CefRefPtr<CefClient> client_;
|
||||
CefString url_;
|
||||
@@ -71,19 +76,25 @@ bool CefBrowserHost::CreateBrowser(
|
||||
"reduced performance or runtime errors.";
|
||||
}
|
||||
|
||||
// Create the browser on the UI thread.
|
||||
CreateBrowserHelper* helper = new CreateBrowserHelper(
|
||||
if (!request_context) {
|
||||
request_context = CefRequestContext::GetGlobalContext();
|
||||
}
|
||||
|
||||
auto helper = std::make_unique<CreateBrowserHelper>(
|
||||
windowInfo, client, url, settings, extra_info, request_context);
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(
|
||||
[](CreateBrowserHelper* helper) {
|
||||
CefBrowserHost::CreateBrowserSync(
|
||||
helper->window_info_, helper->client_,
|
||||
helper->url_, helper->settings_,
|
||||
helper->extra_info_,
|
||||
helper->request_context_);
|
||||
delete helper;
|
||||
},
|
||||
helper));
|
||||
|
||||
auto request_context_impl =
|
||||
static_cast<CefRequestContextImpl*>(request_context.get());
|
||||
|
||||
// Wait for the browser context to be initialized before creating the browser.
|
||||
request_context_impl->ExecuteWhenBrowserContextInitialized(base::BindOnce(
|
||||
[](std::unique_ptr<CreateBrowserHelper> helper) {
|
||||
// Always execute asynchronously to avoid potential issues if we're
|
||||
// being called synchronously during app initialization.
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CreateBrowserHelper::Run,
|
||||
std::move(helper)));
|
||||
},
|
||||
std::move(helper)));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -108,9 +119,14 @@ CefRefPtr<CefBrowser> CefBrowserHost::CreateBrowserSync(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Verify that this method is being called on the UI thread.
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
NOTREACHED() << "called on invalid thread";
|
||||
if (!request_context) {
|
||||
request_context = CefRequestContext::GetGlobalContext();
|
||||
}
|
||||
|
||||
// Verify that the browser context is valid.
|
||||
auto request_context_impl =
|
||||
static_cast<CefRequestContextImpl*>(request_context.get());
|
||||
if (!request_context_impl->VerifyBrowserContext()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -124,16 +140,17 @@ CefRefPtr<CefBrowser> CefBrowserHost::CreateBrowserSync(
|
||||
CefBrowserCreateParams create_params;
|
||||
create_params.window_info.reset(new CefWindowInfo(windowInfo));
|
||||
create_params.client = client;
|
||||
create_params.url = GURL(url.ToString());
|
||||
if (!url.empty() && !create_params.url.is_valid() &&
|
||||
!create_params.url.has_scheme()) {
|
||||
std::string new_url = std::string("http://") + url.ToString();
|
||||
create_params.url = GURL(new_url);
|
||||
}
|
||||
create_params.url = url;
|
||||
create_params.settings = settings;
|
||||
create_params.extra_info = extra_info;
|
||||
create_params.request_context = request_context;
|
||||
|
||||
return CefBrowserHostBase::Create(create_params);
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<CefBrowserHostBase> CefBrowserHostBase::Create(
|
||||
CefBrowserCreateParams& create_params) {
|
||||
if (cef::IsChromeRuntimeEnabled()) {
|
||||
auto browser = ChromeBrowserHostImpl::Create(create_params);
|
||||
return browser.get();
|
||||
|
@@ -181,8 +181,11 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
||||
if (allow) {
|
||||
CefBrowserCreateParams create_params;
|
||||
|
||||
if (!browser->HasView())
|
||||
if (browser->HasView()) {
|
||||
create_params.popup_with_views_hosted_opener = true;
|
||||
} else {
|
||||
create_params.window_info = std::move(window_info);
|
||||
}
|
||||
|
||||
create_params.settings = pending_popup->settings;
|
||||
create_params.client = pending_popup->client;
|
||||
@@ -422,6 +425,8 @@ void CefBrowserInfoManager::RenderProcessHostDestroyed(
|
||||
content::RenderProcessHost* host) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
host->RemoveObserver(this);
|
||||
|
||||
const int render_process_id = host->GetID();
|
||||
DCHECK_GT(render_process_id, 0);
|
||||
|
||||
|
@@ -112,7 +112,7 @@ CefWindowHandle CefBrowserPlatformDelegate::GetHostWindowHandle() const {
|
||||
return kNullWindowHandle;
|
||||
}
|
||||
|
||||
#if defined(USE_AURA)
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
views::Widget* CefBrowserPlatformDelegate::GetWindowWidget() const {
|
||||
NOTREACHED();
|
||||
return nullptr;
|
||||
@@ -122,7 +122,7 @@ CefRefPtr<CefBrowserView> CefBrowserPlatformDelegate::GetBrowserView() const {
|
||||
NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
#endif // defined(TOOLKIT_VIEWS)
|
||||
|
||||
void CefBrowserPlatformDelegate::PopupWebContentsCreated(
|
||||
const CefBrowserSettings& settings,
|
||||
|
@@ -57,7 +57,7 @@ class Size;
|
||||
class Vector2d;
|
||||
} // namespace gfx
|
||||
|
||||
#if defined(USE_AURA)
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
namespace views {
|
||||
class Widget;
|
||||
}
|
||||
@@ -168,7 +168,7 @@ class CefBrowserPlatformDelegate {
|
||||
// the client, which may be NULL. May be called on multiple threads.
|
||||
virtual CefWindowHandle GetHostWindowHandle() const;
|
||||
|
||||
#if defined(USE_AURA)
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
// Returns the Widget owner for the browser window. Only used with windowed
|
||||
// rendering.
|
||||
virtual views::Widget* GetWindowWidget() const;
|
||||
|
@@ -29,7 +29,8 @@
|
||||
#error A delegate implementation is not available for your platform.
|
||||
#endif
|
||||
|
||||
#if defined(USE_AURA)
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
#include "libcef/browser/chrome/views/browser_platform_delegate_chrome_views.h"
|
||||
#include "libcef/browser/views/browser_platform_delegate_views.h"
|
||||
#endif
|
||||
|
||||
@@ -82,6 +83,14 @@ std::unique_ptr<CefBrowserPlatformDelegate> CefBrowserPlatformDelegate::Create(
|
||||
// CefWindowInfo is not used in this case.
|
||||
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate =
|
||||
CreateNativeDelegate(CefWindowInfo(), background_color);
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
if (create_params.browser_view ||
|
||||
create_params.popup_with_views_hosted_opener) {
|
||||
return std::make_unique<CefBrowserPlatformDelegateChromeViews>(
|
||||
std::move(native_delegate),
|
||||
static_cast<CefBrowserViewImpl*>(create_params.browser_view.get()));
|
||||
}
|
||||
#endif
|
||||
return std::make_unique<CefBrowserPlatformDelegateChrome>(
|
||||
std::move(native_delegate));
|
||||
}
|
||||
@@ -113,7 +122,7 @@ std::unique_ptr<CefBrowserPlatformDelegate> CefBrowserPlatformDelegate::Create(
|
||||
return std::make_unique<CefBrowserPlatformDelegateBackground>(
|
||||
std::move(native_delegate));
|
||||
}
|
||||
#if defined(USE_AURA)
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
else {
|
||||
// CefWindowInfo is not used in this case.
|
||||
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate =
|
||||
@@ -122,7 +131,7 @@ std::unique_ptr<CefBrowserPlatformDelegate> CefBrowserPlatformDelegate::Create(
|
||||
std::move(native_delegate),
|
||||
static_cast<CefBrowserViewImpl*>(create_params.browser_view.get()));
|
||||
}
|
||||
#endif // defined(USE_AURA)
|
||||
#endif // defined(TOOLKIT_VIEWS)
|
||||
|
||||
NOTREACHED();
|
||||
return nullptr;
|
||||
|
@@ -86,6 +86,11 @@ void CefBrowserPlatformDelegateChrome::ViewText(const std::string& text) {
|
||||
native_delegate_->ViewText(text);
|
||||
}
|
||||
|
||||
CefEventHandle CefBrowserPlatformDelegateChrome::GetEventHandle(
|
||||
const content::NativeWebKeyboardEvent& event) const {
|
||||
return native_delegate_->GetEventHandle(event);
|
||||
}
|
||||
|
||||
CefWindowHandle CefBrowserPlatformDelegateChrome::GetParentWindowHandle()
|
||||
const {
|
||||
return GetHostWindowHandle();
|
||||
|
@@ -36,6 +36,8 @@ class CefBrowserPlatformDelegateChrome
|
||||
int deltaY) override;
|
||||
gfx::Point GetScreenPoint(const gfx::Point& view) const override;
|
||||
void ViewText(const std::string& text) override;
|
||||
CefEventHandle GetEventHandle(
|
||||
const content::NativeWebKeyboardEvent& event) const override;
|
||||
|
||||
// CefBrowserPlatformDelegateNative::WindowlessHandler methods:
|
||||
CefWindowHandle GetParentWindowHandle() const override;
|
||||
@@ -43,7 +45,7 @@ class CefBrowserPlatformDelegateChrome
|
||||
|
||||
void set_chrome_browser(Browser* browser);
|
||||
|
||||
private:
|
||||
protected:
|
||||
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate_;
|
||||
|
||||
Browser* chrome_browser_ = nullptr;
|
||||
|
@@ -4,13 +4,14 @@
|
||||
|
||||
#include "libcef/browser/chrome/chrome_browser_context.h"
|
||||
|
||||
#include "libcef/browser/prefs/browser_prefs.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "chrome/browser/profiles/profile_manager.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/browser/profiles/off_the_record_profile_impl.h"
|
||||
|
||||
ChromeBrowserContext::ChromeBrowserContext(
|
||||
const CefRequestContextSettings& settings)
|
||||
: CefBrowserContext(settings) {}
|
||||
: CefBrowserContext(settings), weak_ptr_factory_(this) {}
|
||||
|
||||
ChromeBrowserContext::~ChromeBrowserContext() = default;
|
||||
|
||||
@@ -22,19 +23,108 @@ Profile* ChromeBrowserContext::AsProfile() {
|
||||
return profile_;
|
||||
}
|
||||
|
||||
void ChromeBrowserContext::Initialize() {
|
||||
bool ChromeBrowserContext::IsInitialized() const {
|
||||
CEF_REQUIRE_UIT();
|
||||
return !!profile_;
|
||||
}
|
||||
|
||||
void ChromeBrowserContext::StoreOrTriggerInitCallback(
|
||||
base::OnceClosure callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (IsInitialized()) {
|
||||
std::move(callback).Run();
|
||||
} else {
|
||||
init_callbacks_.emplace_back(std::move(callback));
|
||||
}
|
||||
}
|
||||
|
||||
void ChromeBrowserContext::InitializeAsync(base::OnceClosure initialized_cb) {
|
||||
init_callbacks_.emplace_back(std::move(initialized_cb));
|
||||
|
||||
CefBrowserContext::Initialize();
|
||||
|
||||
// TODO(chrome-runtime): ProfileManager can create new profiles relative to
|
||||
// the user-data-dir, but it should be done asynchronously.
|
||||
// The global ProfileManager instance can be retrieved via
|
||||
// |g_browser_process->profile_manager()|.
|
||||
profile_ = ProfileManager::GetLastUsedProfileAllowedByPolicy();
|
||||
if (!cache_path_.empty()) {
|
||||
auto* profile_manager = g_browser_process->profile_manager();
|
||||
const auto& user_data_dir = profile_manager->user_data_dir();
|
||||
|
||||
browser_prefs::SetLanguagePrefs(profile_);
|
||||
if (cache_path_ == user_data_dir) {
|
||||
// Use the default disk-based profile.
|
||||
auto profile = profile_manager->GetPrimaryUserProfile();
|
||||
ProfileCreated(profile, Profile::CreateStatus::CREATE_STATUS_INITIALIZED);
|
||||
return;
|
||||
} else if (cache_path_.DirName() == user_data_dir) {
|
||||
// Create or load a specific disk-based profile. May continue
|
||||
// synchronously or asynchronously.
|
||||
profile_manager->CreateProfileAsync(
|
||||
cache_path_,
|
||||
base::Bind(&ChromeBrowserContext::ProfileCreated,
|
||||
weak_ptr_factory_.GetWeakPtr()),
|
||||
/*name=*/base::string16(), /*icon_url=*/std::string());
|
||||
return;
|
||||
} else {
|
||||
// All profile directories must be relative to |user_data_dir|.
|
||||
LOG(ERROR) << "Cannot create profile at path "
|
||||
<< cache_path_.AsUTF8Unsafe();
|
||||
}
|
||||
}
|
||||
|
||||
// Default to creating a new/unique OffTheRecord profile.
|
||||
ProfileCreated(nullptr, Profile::CreateStatus::CREATE_STATUS_CANCELED);
|
||||
}
|
||||
|
||||
void ChromeBrowserContext::Shutdown() {
|
||||
CefBrowserContext::Shutdown();
|
||||
// |g_browser_process| may be nullptr during shutdown.
|
||||
if (should_destroy_ && g_browser_process) {
|
||||
g_browser_process->profile_manager()
|
||||
->GetPrimaryUserProfile()
|
||||
->DestroyOffTheRecordProfile(profile_);
|
||||
}
|
||||
profile_ = nullptr;
|
||||
}
|
||||
|
||||
void ChromeBrowserContext::ProfileCreated(Profile* profile,
|
||||
Profile::CreateStatus status) {
|
||||
Profile* parent_profile = nullptr;
|
||||
OffTheRecordProfileImpl* otr_profile = nullptr;
|
||||
|
||||
if (status != Profile::CreateStatus::CREATE_STATUS_CREATED &&
|
||||
status != Profile::CreateStatus::CREATE_STATUS_INITIALIZED) {
|
||||
CHECK(!profile);
|
||||
CHECK(!profile_);
|
||||
|
||||
// Creation of a disk-based profile failed for some reason. Create a
|
||||
// new/unique OffTheRecord profile instead.
|
||||
const auto& profile_id = Profile::OTRProfileID::CreateUniqueForCEF();
|
||||
parent_profile =
|
||||
g_browser_process->profile_manager()->GetPrimaryUserProfile();
|
||||
profile_ = parent_profile->GetOffTheRecordProfile(profile_id);
|
||||
otr_profile = static_cast<OffTheRecordProfileImpl*>(profile_);
|
||||
status = Profile::CreateStatus::CREATE_STATUS_INITIALIZED;
|
||||
should_destroy_ = true;
|
||||
} else if (profile && !profile_) {
|
||||
// May be CREATE_STATUS_CREATED or CREATE_STATUS_INITIALIZED since
|
||||
// *CREATED isn't always sent for a disk-based profile that already
|
||||
// exists.
|
||||
profile_ = profile;
|
||||
}
|
||||
|
||||
if (status == Profile::CreateStatus::CREATE_STATUS_INITIALIZED) {
|
||||
CHECK(profile_);
|
||||
|
||||
// Must set |profile_| before Init() calls
|
||||
// ChromeContentBrowserClientCef::ConfigureNetworkContextParams so that
|
||||
// CefBrowserContext::FromBrowserContext can find us.
|
||||
if (otr_profile) {
|
||||
otr_profile->Init();
|
||||
parent_profile->NotifyOffTheRecordProfileCreated(otr_profile);
|
||||
}
|
||||
|
||||
if (!init_callbacks_.empty()) {
|
||||
for (auto& callback : init_callbacks_) {
|
||||
std::move(callback).Run();
|
||||
}
|
||||
init_callbacks_.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -8,22 +8,36 @@
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "chrome/browser/profiles/profile_manager.h"
|
||||
|
||||
// See CefBrowserContext documentation for usage. Only accessed on the UI thread
|
||||
// unless otherwise indicated.
|
||||
class ChromeBrowserContext : public CefBrowserContext {
|
||||
public:
|
||||
explicit ChromeBrowserContext(const CefRequestContextSettings& settings);
|
||||
|
||||
void InitializeAsync(base::OnceClosure initialized_cb);
|
||||
|
||||
// CefBrowserContext overrides.
|
||||
content::BrowserContext* AsBrowserContext() override;
|
||||
Profile* AsProfile() override;
|
||||
void Initialize() override;
|
||||
bool IsInitialized() const override;
|
||||
void StoreOrTriggerInitCallback(base::OnceClosure callback) override;
|
||||
void Shutdown() override;
|
||||
|
||||
private:
|
||||
~ChromeBrowserContext() override;
|
||||
|
||||
void ProfileCreated(Profile* profile, Profile::CreateStatus status);
|
||||
|
||||
base::OnceClosure initialized_cb_;
|
||||
Profile* profile_ = nullptr;
|
||||
bool should_destroy_ = false;
|
||||
|
||||
std::vector<base::OnceClosure> init_callbacks_;
|
||||
|
||||
base::WeakPtrFactory<ChromeBrowserContext> weak_ptr_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserContext);
|
||||
};
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/ui/browser.h"
|
||||
#include "chrome/browser/ui/browser_tabstrip.h"
|
||||
#include "content/public/browser/keyboard_event_processing_result.h"
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
|
||||
@@ -65,7 +66,7 @@ void ChromeBrowserDelegate::SetAsDelegate(content::WebContents* web_contents,
|
||||
create_params_.request_context);
|
||||
|
||||
CreateBrowser(web_contents, create_params_.settings, create_params_.client,
|
||||
std::move(platform_delegate), browser_info,
|
||||
std::move(platform_delegate), browser_info, /*opener=*/nullptr,
|
||||
request_context_impl);
|
||||
}
|
||||
|
||||
@@ -103,7 +104,28 @@ void ChromeBrowserDelegate::WebContentsCreated(
|
||||
// We don't officially own |new_contents| until AddNewContents() is called.
|
||||
// However, we need to install observers/delegates here.
|
||||
CreateBrowser(new_contents, settings, client, std::move(platform_delegate),
|
||||
browser_info, request_context_impl);
|
||||
browser_info, opener, request_context_impl);
|
||||
}
|
||||
|
||||
void ChromeBrowserDelegate::AddNewContents(
|
||||
content::WebContents* source_contents,
|
||||
std::unique_ptr<content::WebContents> new_contents,
|
||||
const GURL& target_url,
|
||||
WindowOpenDisposition disposition,
|
||||
const gfx::Rect& initial_rect,
|
||||
bool user_gesture,
|
||||
bool* was_blocked) {
|
||||
auto new_browser =
|
||||
ChromeBrowserHostImpl::GetBrowserForContents(new_contents.get());
|
||||
if (new_browser) {
|
||||
// Create a new Browser and give it ownership of the WebContents.
|
||||
new_browser->AddNewContents(std::move(new_contents));
|
||||
return;
|
||||
}
|
||||
|
||||
// Fall back to default behavior from Browser::AddNewContents.
|
||||
chrome::AddWebContents(browser_, source_contents, std::move(new_contents),
|
||||
target_url, disposition, initial_rect);
|
||||
}
|
||||
|
||||
content::WebContents* ChromeBrowserDelegate::OpenURLFromTab(
|
||||
@@ -195,6 +217,7 @@ void ChromeBrowserDelegate::CreateBrowser(
|
||||
CefRefPtr<CefClient> client,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate,
|
||||
scoped_refptr<CefBrowserInfo> browser_info,
|
||||
CefRefPtr<ChromeBrowserHostImpl> opener,
|
||||
CefRefPtr<CefRequestContextImpl> request_context_impl) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(web_contents);
|
||||
@@ -202,6 +225,9 @@ void ChromeBrowserDelegate::CreateBrowser(
|
||||
DCHECK(browser_info);
|
||||
DCHECK(request_context_impl);
|
||||
|
||||
// If |opener| is non-nullptr it must be a popup window.
|
||||
DCHECK(!opener.get() || browser_info->is_popup());
|
||||
|
||||
if (!client) {
|
||||
if (auto app = CefAppManager::Get()->GetApplication()) {
|
||||
if (auto bph = app->GetBrowserProcessHandler()) {
|
||||
@@ -226,7 +252,12 @@ void ChromeBrowserDelegate::CreateBrowser(
|
||||
CefRefPtr<ChromeBrowserHostImpl> browser_host =
|
||||
new ChromeBrowserHostImpl(settings, client, std::move(platform_delegate),
|
||||
browser_info, request_context_impl);
|
||||
browser_host->Attach(browser_, web_contents);
|
||||
browser_host->Attach(web_contents, opener);
|
||||
|
||||
// The Chrome browser for a popup won't be created until AddNewContents().
|
||||
if (!opener) {
|
||||
browser_host->SetBrowser(browser_);
|
||||
}
|
||||
}
|
||||
|
||||
CefBrowserContentsDelegate* ChromeBrowserDelegate::GetDelegateForWebContents(
|
||||
@@ -252,6 +283,11 @@ std::unique_ptr<BrowserDelegate> BrowserDelegate::Create(
|
||||
cef_params.get());
|
||||
if (params) {
|
||||
create_params = params->create_params_;
|
||||
|
||||
// Clear these values so they're not persisted to additional Browsers.
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
params->create_params_.browser_view = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
return std::make_unique<ChromeBrowserDelegate>(browser, create_params);
|
||||
|
@@ -55,6 +55,13 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
|
||||
const std::string& frame_name,
|
||||
const GURL& target_url,
|
||||
content::WebContents* new_contents) override;
|
||||
void AddNewContents(content::WebContents* source_contents,
|
||||
std::unique_ptr<content::WebContents> new_contents,
|
||||
const GURL& target_url,
|
||||
WindowOpenDisposition disposition,
|
||||
const gfx::Rect& initial_rect,
|
||||
bool user_gesture,
|
||||
bool* was_blocked) override;
|
||||
content::WebContents* OpenURLFromTab(
|
||||
content::WebContents* source,
|
||||
const content::OpenURLParams& params) override;
|
||||
@@ -88,6 +95,7 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
|
||||
CefRefPtr<CefClient> client,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate,
|
||||
scoped_refptr<CefBrowserInfo> browser_info,
|
||||
CefRefPtr<ChromeBrowserHostImpl> opener,
|
||||
CefRefPtr<CefRequestContextImpl> request_context_impl);
|
||||
|
||||
CefBrowserContentsDelegate* GetDelegateForWebContents(
|
||||
|
@@ -7,6 +7,8 @@
|
||||
#include "libcef/browser/browser_platform_delegate.h"
|
||||
#include "libcef/browser/chrome/browser_platform_delegate_chrome.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/browser/views/browser_view_impl.h"
|
||||
#include "libcef/common/net/url_util.h"
|
||||
#include "libcef/features/runtime_checks.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
@@ -20,32 +22,18 @@
|
||||
#include "chrome/browser/ui/browser_window.h"
|
||||
#include "chrome/browser/ui/tabs/tab_strip_model.h"
|
||||
#include "chrome/common/pref_names.h"
|
||||
#include "url/url_constants.h"
|
||||
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
#include "libcef/browser/chrome/views/chrome_browser_frame.h"
|
||||
#include "libcef/browser/chrome/views/chrome_browser_view.h"
|
||||
#endif
|
||||
|
||||
// static
|
||||
CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserHostImpl::Create(
|
||||
const CefBrowserCreateParams& params) {
|
||||
// Get or create the request context and profile.
|
||||
CefRefPtr<CefRequestContextImpl> request_context_impl =
|
||||
CefRequestContextImpl::GetOrCreateForRequestContext(
|
||||
params.request_context);
|
||||
CHECK(request_context_impl);
|
||||
auto cef_browser_context = request_context_impl->GetBrowserContext();
|
||||
CHECK(cef_browser_context);
|
||||
auto profile = cef_browser_context->AsProfile();
|
||||
auto browser = CreateBrowser(params);
|
||||
|
||||
Browser::CreateParams chrome_params =
|
||||
Browser::CreateParams(profile, /*user_gesture=*/false);
|
||||
|
||||
// Pass |params| to cef::BrowserDelegate::Create from the Browser constructor.
|
||||
chrome_params.cef_params = base::MakeRefCounted<DelegateCreateParams>(params);
|
||||
|
||||
// Create the Browser. This will indirectly create the ChomeBrowserDelegate.
|
||||
// The same params will be used to create a new Browser if the tab is dragged
|
||||
// out of the existing Browser.
|
||||
auto browser = Browser::Create(chrome_params);
|
||||
|
||||
GURL url = params.url;
|
||||
GURL url = url_util::MakeGURL(params.url, /*fixup=*/true);
|
||||
if (url.is_empty()) {
|
||||
// Chrome will navigate to kChromeUINewTabURL by default. We want to keep
|
||||
// the current CEF behavior of not navigating at all. Use a special URL that
|
||||
@@ -56,7 +44,8 @@ CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserHostImpl::Create(
|
||||
// Add a new tab. This will indirectly create a new tab WebContents and
|
||||
// call ChromeBrowserDelegate::OnWebContentsCreated to create the associated
|
||||
// ChromeBrowserHostImpl.
|
||||
chrome::AddTabAt(browser, url, /*idx=*/-1, /*foreground=*/true);
|
||||
chrome::AddTabAt(browser, url, /*index=*/TabStripModel::kNoTab,
|
||||
/*foreground=*/true);
|
||||
|
||||
// The new tab WebContents.
|
||||
auto web_contents = browser->tab_strip_model()->GetActiveWebContents();
|
||||
@@ -117,6 +106,34 @@ CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserHostImpl::GetBrowserForFrameRoute(
|
||||
|
||||
ChromeBrowserHostImpl::~ChromeBrowserHostImpl() = default;
|
||||
|
||||
void ChromeBrowserHostImpl::AddNewContents(
|
||||
std::unique_ptr<content::WebContents> contents) {
|
||||
DCHECK(contents);
|
||||
DCHECK(!browser_);
|
||||
|
||||
// We should already be associated with the WebContents.
|
||||
DCHECK_EQ(GetWebContents(), contents.get());
|
||||
|
||||
CefBrowserCreateParams params;
|
||||
params.request_context = request_context();
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
params.browser_view = GetBrowserView();
|
||||
#endif
|
||||
|
||||
// Create the new Browser representation.
|
||||
auto browser = CreateBrowser(params);
|
||||
|
||||
// Add the WebContents to the Browser.
|
||||
browser->tab_strip_model()->AddWebContents(
|
||||
std::move(contents), /*index=*/TabStripModel::kNoTab,
|
||||
ui::PageTransition::PAGE_TRANSITION_AUTO_TOPLEVEL,
|
||||
TabStripModel::ADD_ACTIVE);
|
||||
|
||||
SetBrowser(browser);
|
||||
|
||||
browser->window()->Show();
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::OnWebContentsDestroyed(
|
||||
content::WebContents* web_contents) {
|
||||
platform_delegate_->WebContentsDestroyed(web_contents);
|
||||
@@ -148,8 +165,9 @@ void ChromeBrowserHostImpl::CloseBrowser(bool force_close) {
|
||||
}
|
||||
|
||||
bool ChromeBrowserHostImpl::TryCloseBrowser() {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
// TODO(chrome): Handle the case where the browser may not close immediately.
|
||||
CloseBrowser(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::SetFocus(bool focus) {
|
||||
@@ -168,11 +186,6 @@ CefWindowHandle ChromeBrowserHostImpl::GetOpenerWindowHandle() {
|
||||
return kNullWindowHandle;
|
||||
}
|
||||
|
||||
bool ChromeBrowserHostImpl::HasView() {
|
||||
// TODO(chrome-runtime): Support Views-hosted browsers.
|
||||
return false;
|
||||
}
|
||||
|
||||
double ChromeBrowserHostImpl::GetZoomLevel() {
|
||||
NOTIMPLEMENTED();
|
||||
return 0.0;
|
||||
@@ -245,26 +258,6 @@ bool ChromeBrowserHostImpl::HasDevTools() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ChromeBrowserHostImpl::SendDevToolsMessage(const void* message,
|
||||
size_t message_size) {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
int ChromeBrowserHostImpl::ExecuteDevToolsMethod(
|
||||
int message_id,
|
||||
const CefString& method,
|
||||
CefRefPtr<CefDictionaryValue> params) {
|
||||
NOTIMPLEMENTED();
|
||||
return 0;
|
||||
}
|
||||
|
||||
CefRefPtr<CefRegistration> ChromeBrowserHostImpl::AddDevToolsMessageObserver(
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer) {
|
||||
NOTIMPLEMENTED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool ChromeBrowserHostImpl::IsWindowRenderingDisabled() {
|
||||
return false;
|
||||
}
|
||||
@@ -398,13 +391,17 @@ bool ChromeBrowserHostImpl::Navigate(const content::OpenURLParams& params) {
|
||||
}
|
||||
|
||||
if (browser_) {
|
||||
GURL gurl = params.url;
|
||||
if (!url_util::FixupGURL(gurl))
|
||||
return false;
|
||||
|
||||
// This is generally equivalent to calling Browser::OpenURL, except:
|
||||
// 1. It doesn't trigger a call to CefRequestHandler::OnOpenURLFromTab, and
|
||||
// 2. It navigates in this CefBrowserHost's WebContents instead of
|
||||
// (a) creating a new WebContents, or (b) using the Browser's active
|
||||
// WebContents (which may not be the same), and
|
||||
// 3. There is no risk of triggering chrome's popup blocker.
|
||||
NavigateParams nav_params(browser_, params.url, params.transition);
|
||||
NavigateParams nav_params(browser_, gurl, params.transition);
|
||||
nav_params.FillNavigateParamsFromOpenURLParams(params);
|
||||
|
||||
// Always navigate in the current tab.
|
||||
@@ -432,17 +429,113 @@ ChromeBrowserHostImpl::ChromeBrowserHostImpl(
|
||||
browser_info,
|
||||
request_context) {}
|
||||
|
||||
void ChromeBrowserHostImpl::Attach(Browser* browser,
|
||||
content::WebContents* web_contents) {
|
||||
DCHECK(browser);
|
||||
// static
|
||||
Browser* ChromeBrowserHostImpl::CreateBrowser(
|
||||
const CefBrowserCreateParams& params) {
|
||||
// Get or create the request context and profile.
|
||||
CefRefPtr<CefRequestContextImpl> request_context_impl =
|
||||
CefRequestContextImpl::GetOrCreateForRequestContext(
|
||||
params.request_context);
|
||||
CHECK(request_context_impl);
|
||||
auto cef_browser_context = request_context_impl->GetBrowserContext();
|
||||
CHECK(cef_browser_context);
|
||||
auto profile = cef_browser_context->AsProfile();
|
||||
CHECK(profile);
|
||||
|
||||
Browser::CreateParams chrome_params =
|
||||
Browser::CreateParams(profile, /*user_gesture=*/false);
|
||||
|
||||
// Pass |params| to cef::BrowserDelegate::Create from the Browser constructor.
|
||||
chrome_params.cef_params = base::MakeRefCounted<DelegateCreateParams>(params);
|
||||
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
// Configure Browser creation to use the existing Views-based
|
||||
// Widget/BrowserFrame (ChromeBrowserFrame) and BrowserView/BrowserWindow
|
||||
// (ChromeBrowserView). See views/chrome_browser_frame.h for related
|
||||
// documentation.
|
||||
ChromeBrowserView* chrome_browser_view = nullptr;
|
||||
if (params.browser_view) {
|
||||
// Don't show most controls.
|
||||
chrome_params.type = Browser::TYPE_POPUP;
|
||||
// Don't show title bar or address.
|
||||
chrome_params.trusted_source = true;
|
||||
|
||||
auto view_impl =
|
||||
static_cast<CefBrowserViewImpl*>(params.browser_view.get());
|
||||
|
||||
chrome_browser_view =
|
||||
static_cast<ChromeBrowserView*>(view_impl->root_view());
|
||||
chrome_params.window = chrome_browser_view;
|
||||
|
||||
auto chrome_widget =
|
||||
static_cast<ChromeBrowserFrame*>(chrome_browser_view->GetWidget());
|
||||
chrome_browser_view->set_frame(chrome_widget);
|
||||
}
|
||||
#endif // defined(TOOLKIT_VIEWS)
|
||||
|
||||
// Create the Browser. This will indirectly create the ChomeBrowserDelegate.
|
||||
// The same params will be used to create a new Browser if the tab is dragged
|
||||
// out of the existing Browser. The returned Browser is owned by the
|
||||
// associated BrowserView.
|
||||
auto browser = Browser::Create(chrome_params);
|
||||
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
if (chrome_browser_view) {
|
||||
// Initialize the BrowserFrame and BrowserView and create the controls that
|
||||
// require access to the Browser.
|
||||
chrome_browser_view->InitBrowser(base::WrapUnique(browser),
|
||||
params.browser_view);
|
||||
}
|
||||
#endif
|
||||
|
||||
return browser;
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::Attach(content::WebContents* web_contents,
|
||||
CefRefPtr<ChromeBrowserHostImpl> opener) {
|
||||
DCHECK(web_contents);
|
||||
|
||||
if (opener) {
|
||||
// Give the opener browser's platform delegate an opportunity to modify the
|
||||
// new browser's platform delegate.
|
||||
opener->platform_delegate_->PopupWebContentsCreated(
|
||||
settings_, client_, web_contents, platform_delegate_.get(),
|
||||
/*is_devtools_popup=*/false);
|
||||
}
|
||||
|
||||
platform_delegate_->WebContentsCreated(web_contents,
|
||||
/*own_web_contents=*/false);
|
||||
|
||||
SetBrowser(browser);
|
||||
contents_delegate_->ObserveWebContents(web_contents);
|
||||
|
||||
// Associate the platform delegate with this browser.
|
||||
platform_delegate_->BrowserCreated(this);
|
||||
|
||||
// Associate the base class with the WebContents.
|
||||
InitializeBrowser();
|
||||
|
||||
// Notify that the browser has been created. These must be delivered in the
|
||||
// expected order.
|
||||
|
||||
// 1. Notify the browser's LifeSpanHandler. This must always be the first
|
||||
// notification for the browser.
|
||||
{
|
||||
// The WebContents won't be added to the Browser's TabStripModel until later
|
||||
// in the current call stack. Block navigation until that time.
|
||||
auto navigation_lock = browser_info_->CreateNavigationLock();
|
||||
OnAfterCreated();
|
||||
}
|
||||
|
||||
// 2. Notify the platform delegate. With Views this will result in a call to
|
||||
// CefBrowserViewDelegate::OnBrowserCreated().
|
||||
platform_delegate_->NotifyBrowserCreated();
|
||||
|
||||
if (opener && opener->platform_delegate_) {
|
||||
// 3. Notify the opener browser's platform delegate. With Views this will
|
||||
// result in a call to CefBrowserViewDelegate::OnPopupBrowserViewCreated().
|
||||
opener->platform_delegate_->PopupBrowserCreated(
|
||||
this,
|
||||
/*is_devtools_popup=*/false);
|
||||
}
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::SetBrowser(Browser* browser) {
|
||||
@@ -452,19 +545,17 @@ void ChromeBrowserHostImpl::SetBrowser(Browser* browser) {
|
||||
->set_chrome_browser(browser);
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::InitializeBrowser() {
|
||||
void ChromeBrowserHostImpl::WindowDestroyed() {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(browser_);
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
if (browser_ && is_views_hosted_) {
|
||||
auto chrome_browser_view =
|
||||
static_cast<ChromeBrowserView*>(browser_->window());
|
||||
chrome_browser_view->Destroyed();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Associate the platform delegate with this browser.
|
||||
platform_delegate_->BrowserCreated(this);
|
||||
|
||||
CefBrowserHostBase::InitializeBrowser();
|
||||
|
||||
// The WebContents won't be added to the Browser's TabStripModel until later
|
||||
// in the current call stack. Block navigation until that time.
|
||||
auto navigation_lock = browser_info_->CreateNavigationLock();
|
||||
OnAfterCreated();
|
||||
platform_delegate_->CloseHostWindow();
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::DestroyBrowser() {
|
||||
@@ -486,6 +577,8 @@ void ChromeBrowserHostImpl::DoCloseBrowser(bool force_close) {
|
||||
// Like chrome::CloseTab() but specifying the WebContents.
|
||||
const int tab_index = GetCurrentTabIndex();
|
||||
if (tab_index != TabStripModel::kNoTab) {
|
||||
// TODO(chrome): Handle the case where this method returns false,
|
||||
// indicating that the contents were not closed immediately.
|
||||
browser_->tab_strip_model()->CloseWebContentsAt(
|
||||
tab_index, TabStripModel::CLOSE_CREATE_HISTORICAL_TAB |
|
||||
TabStripModel::CLOSE_USER_GESTURE);
|
||||
|
@@ -66,7 +66,6 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
|
||||
void SetFocus(bool focus) override;
|
||||
CefWindowHandle GetWindowHandle() override;
|
||||
CefWindowHandle GetOpenerWindowHandle() override;
|
||||
bool HasView() override;
|
||||
double GetZoomLevel() override;
|
||||
void SetZoomLevel(double zoomLevel) override;
|
||||
void RunFileDialog(FileDialogMode mode,
|
||||
@@ -91,12 +90,6 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
|
||||
const CefPoint& inspect_element_at) override;
|
||||
void CloseDevTools() override;
|
||||
bool HasDevTools() override;
|
||||
bool SendDevToolsMessage(const void* message, size_t message_size) override;
|
||||
int ExecuteDevToolsMethod(int message_id,
|
||||
const CefString& method,
|
||||
CefRefPtr<CefDictionaryValue> params) override;
|
||||
CefRefPtr<CefRegistration> AddDevToolsMessageObserver(
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer) override;
|
||||
bool IsWindowRenderingDisabled() override;
|
||||
void WasResized() override;
|
||||
void WasHidden(bool hidden) override;
|
||||
@@ -149,17 +142,25 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
|
||||
scoped_refptr<CefBrowserInfo> browser_info,
|
||||
CefRefPtr<CefRequestContextImpl> request_context);
|
||||
|
||||
// Called from ChromeBrowserDelegate::SetAsDelegate when this object is first
|
||||
// created. Must be called on the UI thread.
|
||||
void Attach(Browser* browser, content::WebContents* web_contents);
|
||||
// Create a new Browser without initializing the WebContents.
|
||||
static Browser* CreateBrowser(const CefBrowserCreateParams& params);
|
||||
|
||||
// Called from ChromeBrowserDelegate::SetAsDelegate when this object changes
|
||||
// Browser ownership (e.g. dragging between windows). The old Browser will be
|
||||
// cleared before the new Browser is added. Must be called on the UI thread.
|
||||
// Called from ChromeBrowserDelegate::CreateBrowser when this object is first
|
||||
// created. Must be called on the UI thread.
|
||||
void Attach(content::WebContents* web_contents,
|
||||
CefRefPtr<ChromeBrowserHostImpl> opener);
|
||||
|
||||
// Called from ChromeBrowserDelegate::AddNewContents to take ownership of a
|
||||
// popup WebContents.
|
||||
void AddNewContents(std::unique_ptr<content::WebContents> contents);
|
||||
|
||||
// Called when this object changes Browser ownership (e.g. initially created,
|
||||
// dragging between windows, etc). The old Browser, if any, will be cleared
|
||||
// before the new Browser is added. Must be called on the UI thread.
|
||||
void SetBrowser(Browser* browser);
|
||||
|
||||
// CefBrowserHostBase methods:
|
||||
void InitializeBrowser() override;
|
||||
void WindowDestroyed() override;
|
||||
void DestroyBrowser() override;
|
||||
|
||||
void DoCloseBrowser(bool force_close);
|
||||
|
@@ -4,7 +4,9 @@
|
||||
|
||||
#include "libcef/browser/chrome/chrome_browser_main_extra_parts_cef.h"
|
||||
|
||||
#include "libcef/browser/chrome/chrome_context_menu_handler.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/net/chrome_scheme_handler.h"
|
||||
|
||||
#include "base/task/post_task.h"
|
||||
|
||||
@@ -31,4 +33,7 @@ void ChromeBrowserMainExtraPartsCef::PreMainMessageLoopRun() {
|
||||
user_blocking_task_runner_ = base::CreateSingleThreadTaskRunner(
|
||||
{base::ThreadPool(), base::TaskPriority::USER_BLOCKING,
|
||||
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
||||
|
||||
scheme::RegisterWebUIControllerFactory();
|
||||
context_menu::RegisterMenuCreatedCallback();
|
||||
}
|
||||
|
@@ -7,12 +7,17 @@
|
||||
|
||||
#include "libcef/browser/browser_info_manager.h"
|
||||
#include "libcef/browser/browser_message_filter.h"
|
||||
#include "libcef/browser/chrome/chrome_browser_host_impl.h"
|
||||
#include "libcef/browser/chrome/chrome_browser_main_extra_parts_cef.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/net/chrome_scheme_handler.h"
|
||||
#include "libcef/browser/net/throttle_handler.h"
|
||||
#include "libcef/browser/net_service/cookie_manager_impl.h"
|
||||
#include "libcef/browser/net_service/login_delegate.h"
|
||||
#include "libcef/browser/net_service/proxy_url_loader_factory.h"
|
||||
#include "libcef/browser/net_service/resource_request_handler_wrapper.h"
|
||||
#include "libcef/browser/prefs/browser_prefs.h"
|
||||
#include "libcef/browser/prefs/renderer_prefs.h"
|
||||
#include "libcef/common/app_manager.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
#include "libcef/common/command_line_impl.h"
|
||||
@@ -24,7 +29,11 @@
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "content/public/browser/navigation_throttle.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/render_widget_host.h"
|
||||
#include "content/public/browser/render_widget_host_view.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "third_party/blink/public/common/web_preferences/web_preferences.h"
|
||||
#include "third_party/blink/public/mojom/loader/resource_load_info.mojom-shared.h"
|
||||
|
||||
namespace {
|
||||
@@ -81,6 +90,16 @@ void ChromeContentBrowserClientCef::AppendExtraCommandLineSwitches(
|
||||
|
||||
const base::CommandLine* browser_cmd = base::CommandLine::ForCurrentProcess();
|
||||
|
||||
{
|
||||
// Propagate the following switches to all command lines (along with any
|
||||
// associated values) if present in the browser command line.
|
||||
static const char* const kSwitchNames[] = {
|
||||
switches::kUserAgentProductAndVersion,
|
||||
};
|
||||
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
|
||||
base::size(kSwitchNames));
|
||||
}
|
||||
|
||||
const std::string& process_type =
|
||||
command_line->GetSwitchValueASCII(switches::kProcessType);
|
||||
if (process_type == switches::kRendererProcess) {
|
||||
@@ -147,6 +166,33 @@ bool ChromeContentBrowserClientCef::CanCreateWindow(
|
||||
user_gesture, opener_suppressed, no_javascript_access);
|
||||
}
|
||||
|
||||
void ChromeContentBrowserClientCef::OverrideWebkitPrefs(
|
||||
content::WebContents* web_contents,
|
||||
blink::web_pref::WebPreferences* prefs) {
|
||||
renderer_prefs::SetDefaultPrefs(*prefs);
|
||||
|
||||
ChromeContentBrowserClient::OverrideWebkitPrefs(web_contents, prefs);
|
||||
|
||||
auto browser = ChromeBrowserHostImpl::GetBrowserForContents(web_contents);
|
||||
if (browser) {
|
||||
renderer_prefs::SetCefPrefs(browser->settings(), *prefs);
|
||||
|
||||
// Set the background color for the WebView.
|
||||
prefs->base_background_color = browser->GetBackgroundColor();
|
||||
} else {
|
||||
// We don't know for sure that the browser will be windowless but assume
|
||||
// that the global windowless state is likely to be accurate.
|
||||
prefs->base_background_color =
|
||||
CefContext::Get()->GetBackgroundColor(nullptr, STATE_DEFAULT);
|
||||
}
|
||||
|
||||
auto rvh = web_contents->GetRenderViewHost();
|
||||
if (rvh->GetWidget()->GetView()) {
|
||||
rvh->GetWidget()->GetView()->SetBackgroundColor(
|
||||
prefs->base_background_color);
|
||||
}
|
||||
}
|
||||
|
||||
bool ChromeContentBrowserClientCef::WillCreateURLLoaderFactory(
|
||||
content::BrowserContext* browser_context,
|
||||
content::RenderFrameHost* frame,
|
||||
@@ -170,6 +216,13 @@ bool ChromeContentBrowserClientCef::WillCreateURLLoaderFactory(
|
||||
return use_proxy;
|
||||
}
|
||||
|
||||
// Don't intercept requests for Profiles that were not created by CEF.
|
||||
// For example, the User Manager profile created via
|
||||
// profiles::CreateSystemProfileForUserManager.
|
||||
auto profile = Profile::FromBrowserContext(browser_context);
|
||||
if (!CefBrowserContext::FromProfile(profile))
|
||||
return false;
|
||||
|
||||
auto request_handler = net_service::CreateInterceptedRequestHandler(
|
||||
browser_context, frame, render_process_id,
|
||||
type == URLLoaderFactoryType::kNavigation,
|
||||
@@ -241,7 +294,8 @@ void ChromeContentBrowserClientCef::ConfigureNetworkContextParams(
|
||||
bool in_memory,
|
||||
const base::FilePath& relative_partition_path,
|
||||
network::mojom::NetworkContextParams* network_context_params,
|
||||
network::mojom::CertVerifierCreationParams* cert_verifier_creation_params) {
|
||||
cert_verifier::mojom::CertVerifierCreationParams*
|
||||
cert_verifier_creation_params) {
|
||||
ChromeContentBrowserClient::ConfigureNetworkContextParams(
|
||||
context, in_memory, relative_partition_path, network_context_params,
|
||||
cert_verifier_creation_params);
|
||||
@@ -249,7 +303,18 @@ void ChromeContentBrowserClientCef::ConfigureNetworkContextParams(
|
||||
auto cef_context = CefBrowserContext::FromBrowserContext(context);
|
||||
network_context_params->cookieable_schemes =
|
||||
cef_context ? cef_context->GetCookieableSchemes()
|
||||
: CefCookieManagerImpl::GetGlobalCookieableSchemes();
|
||||
: CefBrowserContext::GetGlobalCookieableSchemes();
|
||||
|
||||
// Prefer the CEF settings configuration, if specified, instead of the
|
||||
// kAcceptLanguages preference which is controlled by the
|
||||
// chrome://settings/languages configuration.
|
||||
const std::string& accept_language_list =
|
||||
browser_prefs::GetAcceptLanguageList(cef_context, /*browser=*/nullptr,
|
||||
/*expand=*/true);
|
||||
if (!accept_language_list.empty() &&
|
||||
accept_language_list != network_context_params->accept_language) {
|
||||
network_context_params->accept_language = accept_language_list;
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<content::LoginDelegate>
|
||||
@@ -276,6 +341,18 @@ ChromeContentBrowserClientCef::CreateLoginDelegate(
|
||||
response_headers, first_auth_attempt, std::move(auth_required_callback));
|
||||
}
|
||||
|
||||
void ChromeContentBrowserClientCef::BrowserURLHandlerCreated(
|
||||
content::BrowserURLHandler* handler) {
|
||||
// Register the Chrome handlers first for proper URL rewriting.
|
||||
ChromeContentBrowserClient::BrowserURLHandlerCreated(handler);
|
||||
scheme::BrowserURLHandlerCreated(handler);
|
||||
}
|
||||
|
||||
bool ChromeContentBrowserClientCef::IsWebUIAllowedToMakeNetworkRequests(
|
||||
const url::Origin& origin) {
|
||||
return scheme::IsWebUIAllowedToMakeNetworkRequests(origin);
|
||||
}
|
||||
|
||||
CefRefPtr<CefRequestContextImpl>
|
||||
ChromeContentBrowserClientCef::request_context() const {
|
||||
return browser_main_parts_->request_context();
|
||||
|
@@ -40,6 +40,8 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
|
||||
bool user_gesture,
|
||||
bool opener_suppressed,
|
||||
bool* no_javascript_access) override;
|
||||
void OverrideWebkitPrefs(content::WebContents* web_contents,
|
||||
blink::web_pref::WebPreferences* prefs) override;
|
||||
bool WillCreateURLLoaderFactory(
|
||||
content::BrowserContext* browser_context,
|
||||
content::RenderFrameHost* frame,
|
||||
@@ -80,8 +82,8 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
|
||||
bool in_memory,
|
||||
const base::FilePath& relative_partition_path,
|
||||
network::mojom::NetworkContextParams* network_context_params,
|
||||
network::mojom::CertVerifierCreationParams* cert_verifier_creation_params)
|
||||
override;
|
||||
cert_verifier::mojom::CertVerifierCreationParams*
|
||||
cert_verifier_creation_params) override;
|
||||
std::unique_ptr<content::LoginDelegate> CreateLoginDelegate(
|
||||
const net::AuthChallengeInfo& auth_info,
|
||||
content::WebContents* web_contents,
|
||||
@@ -91,6 +93,8 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
|
||||
scoped_refptr<net::HttpResponseHeaders> response_headers,
|
||||
bool first_auth_attempt,
|
||||
LoginAuthRequiredCallback auth_required_callback) override;
|
||||
void BrowserURLHandlerCreated(content::BrowserURLHandler* handler) override;
|
||||
bool IsWebUIAllowedToMakeNetworkRequests(const url::Origin& origin) override;
|
||||
|
||||
CefRefPtr<CefRequestContextImpl> request_context() const;
|
||||
|
||||
|
207
libcef/browser/chrome/chrome_context_menu_handler.cc
Normal file
207
libcef/browser/chrome/chrome_context_menu_handler.cc
Normal file
@@ -0,0 +1,207 @@
|
||||
// Copyright (c) 2021 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that can
|
||||
// be found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/chrome/chrome_context_menu_handler.h"
|
||||
|
||||
#include "libcef/browser/browser_host_base.h"
|
||||
#include "libcef/browser/context_menu_params_impl.h"
|
||||
#include "libcef/browser/simple_menu_model_impl.h"
|
||||
|
||||
#include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
|
||||
|
||||
namespace context_menu {
|
||||
|
||||
namespace {
|
||||
|
||||
// Lifespan is controlled by RenderViewContextMenu.
|
||||
class CefContextMenuObserver : public RenderViewContextMenuObserver,
|
||||
public CefSimpleMenuModelImpl::StateDelegate {
|
||||
public:
|
||||
CefContextMenuObserver(RenderViewContextMenu* context_menu,
|
||||
CefRefPtr<CefBrowserHostBase> browser,
|
||||
CefRefPtr<CefContextMenuHandler> handler)
|
||||
: context_menu_(context_menu), browser_(browser), handler_(handler) {}
|
||||
|
||||
// RenderViewContextMenuObserver methods:
|
||||
|
||||
void InitMenu(const content::ContextMenuParams& params) override {
|
||||
params_ = new CefContextMenuParamsImpl(
|
||||
const_cast<content::ContextMenuParams*>(&context_menu_->params()));
|
||||
model_ = new CefSimpleMenuModelImpl(
|
||||
const_cast<ui::SimpleMenuModel*>(&context_menu_->menu_model()),
|
||||
context_menu_, this, /*is_owned=*/false, /*is_popup=*/false);
|
||||
|
||||
handler_->OnBeforeContextMenu(browser_, GetFrame(), params_, model_);
|
||||
}
|
||||
|
||||
bool IsCommandIdSupported(int command_id) override {
|
||||
// Always claim support for the reserved user ID range.
|
||||
if (command_id >= MENU_ID_USER_FIRST && command_id <= MENU_ID_USER_LAST)
|
||||
return true;
|
||||
|
||||
// Also claim support in specific cases where an ItemInfo exists.
|
||||
return GetItemInfo(command_id) != nullptr;
|
||||
}
|
||||
|
||||
// Only called if IsCommandIdSupported() returns true.
|
||||
bool IsCommandIdEnabled(int command_id) override {
|
||||
// Always return true to use the SimpleMenuModel state.
|
||||
return true;
|
||||
}
|
||||
|
||||
// Only called if IsCommandIdSupported() returns true.
|
||||
bool IsCommandIdChecked(int command_id) override {
|
||||
auto* info = GetItemInfo(command_id);
|
||||
return info ? info->checked : false;
|
||||
}
|
||||
|
||||
// Only called if IsCommandIdSupported() returns true.
|
||||
bool GetAccelerator(int command_id, ui::Accelerator* accel) override {
|
||||
auto* info = GetItemInfo(command_id);
|
||||
if (info && info->accel) {
|
||||
*accel = *info->accel;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CommandWillBeExecuted(int command_id) override {
|
||||
if (handler_->OnContextMenuCommand(browser_, GetFrame(), params_,
|
||||
command_id, EVENTFLAG_NONE)) {
|
||||
// Create an ItemInfo so that we get the ExecuteCommand() callback
|
||||
// instead of the default handler.
|
||||
GetOrCreateItemInfo(command_id);
|
||||
}
|
||||
}
|
||||
|
||||
// Only called if IsCommandIdSupported() returns true.
|
||||
void ExecuteCommand(int command_id) override {
|
||||
auto* info = GetItemInfo(command_id);
|
||||
if (info) {
|
||||
// In case it was added in CommandWillBeExecuted().
|
||||
MaybeDeleteItemInfo(command_id, info);
|
||||
}
|
||||
}
|
||||
|
||||
void OnMenuClosed() override {
|
||||
handler_->OnContextMenuDismissed(browser_, GetFrame());
|
||||
model_->Detach();
|
||||
|
||||
// Clear stored state because this object won't be deleted until a new
|
||||
// context menu is created or the associated browser is destroyed.
|
||||
browser_ = nullptr;
|
||||
handler_ = nullptr;
|
||||
params_ = nullptr;
|
||||
model_ = nullptr;
|
||||
iteminfomap_.clear();
|
||||
}
|
||||
|
||||
// CefSimpleMenuModelImpl::StateDelegate methods:
|
||||
|
||||
void SetChecked(int command_id, bool checked) override {
|
||||
// No-op if already at the default state.
|
||||
if (!checked && !GetItemInfo(command_id))
|
||||
return;
|
||||
|
||||
auto* info = GetOrCreateItemInfo(command_id);
|
||||
info->checked = checked;
|
||||
if (!checked)
|
||||
MaybeDeleteItemInfo(command_id, info);
|
||||
}
|
||||
|
||||
void SetAccelerator(int command_id,
|
||||
base::Optional<ui::Accelerator> accel) override {
|
||||
// No-op if already at the default state.
|
||||
if (!accel && !GetItemInfo(command_id))
|
||||
return;
|
||||
|
||||
auto* info = GetOrCreateItemInfo(command_id);
|
||||
info->accel = accel;
|
||||
if (!accel)
|
||||
MaybeDeleteItemInfo(command_id, info);
|
||||
}
|
||||
|
||||
private:
|
||||
struct ItemInfo {
|
||||
ItemInfo() {}
|
||||
|
||||
bool checked = false;
|
||||
base::Optional<ui::Accelerator> accel;
|
||||
};
|
||||
|
||||
ItemInfo* GetItemInfo(int command_id) {
|
||||
auto it = iteminfomap_.find(command_id);
|
||||
if (it != iteminfomap_.end()) {
|
||||
return &it->second;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ItemInfo* GetOrCreateItemInfo(int command_id) {
|
||||
if (auto info = GetItemInfo(command_id))
|
||||
return info;
|
||||
|
||||
auto result = iteminfomap_.insert(std::make_pair(command_id, ItemInfo()));
|
||||
return &result.first->second;
|
||||
}
|
||||
|
||||
void MaybeDeleteItemInfo(int command_id, ItemInfo* info) {
|
||||
// Remove if all info has reverted to the default state.
|
||||
if (!info->checked && !info->accel) {
|
||||
auto it = iteminfomap_.find(command_id);
|
||||
iteminfomap_.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrame> GetFrame() const {
|
||||
CefRefPtr<CefFrame> frame;
|
||||
|
||||
// May return nullptr if the frame is destroyed while the menu is pending.
|
||||
auto* rfh = context_menu_->GetRenderFrameHost();
|
||||
if (rfh) {
|
||||
frame = browser_->GetFrameForHost(rfh);
|
||||
}
|
||||
if (!frame) {
|
||||
frame = browser_->GetMainFrame();
|
||||
}
|
||||
return frame;
|
||||
}
|
||||
|
||||
RenderViewContextMenu* const context_menu_;
|
||||
CefRefPtr<CefBrowserHostBase> browser_;
|
||||
CefRefPtr<CefContextMenuHandler> handler_;
|
||||
CefRefPtr<CefContextMenuParams> params_;
|
||||
CefRefPtr<CefSimpleMenuModelImpl> model_;
|
||||
|
||||
// Map of command_id to ItemInfo.
|
||||
using ItemInfoMap = std::map<int, ItemInfo>;
|
||||
ItemInfoMap iteminfomap_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefContextMenuObserver);
|
||||
};
|
||||
|
||||
std::unique_ptr<RenderViewContextMenuObserver> MenuCreatedCallback(
|
||||
RenderViewContextMenu* context_menu) {
|
||||
auto browser = CefBrowserHostBase::GetBrowserForContents(
|
||||
context_menu->source_web_contents());
|
||||
if (browser) {
|
||||
if (auto client = browser->GetClient()) {
|
||||
if (auto handler = client->GetContextMenuHandler()) {
|
||||
return std::make_unique<CefContextMenuObserver>(context_menu, browser,
|
||||
handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void RegisterMenuCreatedCallback() {
|
||||
RenderViewContextMenu::RegisterMenuCreatedCallback(
|
||||
base::BindRepeating(&MenuCreatedCallback));
|
||||
}
|
||||
|
||||
} // namespace context_menu
|
16
libcef/browser/chrome/chrome_context_menu_handler.h
Normal file
16
libcef/browser/chrome/chrome_context_menu_handler.h
Normal file
@@ -0,0 +1,16 @@
|
||||
// Copyright (c) 2021 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that can
|
||||
// be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_CHROME_CHROME_CONTEXT_MENU_HANDLER_H_
|
||||
#define CEF_LIBCEF_BROWSER_CHROME_CHROME_CONTEXT_MENU_HANDLER_H_
|
||||
#pragma once
|
||||
|
||||
namespace context_menu {
|
||||
|
||||
// Register the context menu created callback.
|
||||
void RegisterMenuCreatedCallback();
|
||||
|
||||
} // namespace context_menu
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_CONTEXT_MENU_HANDLER_H_
|
@@ -0,0 +1,153 @@
|
||||
// Copyright 2021 The Chromium Embedded Framework Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/chrome/views/browser_platform_delegate_chrome_views.h"
|
||||
|
||||
#include "include/views/cef_window.h"
|
||||
|
||||
#include "chrome/browser/ui/browser.h"
|
||||
#include "ui/views/widget/widget.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// Default popup window delegate implementation.
|
||||
class PopupWindowDelegate : public CefWindowDelegate {
|
||||
public:
|
||||
explicit PopupWindowDelegate(CefRefPtr<CefBrowserView> browser_view)
|
||||
: browser_view_(browser_view) {}
|
||||
|
||||
void OnWindowCreated(CefRefPtr<CefWindow> window) override {
|
||||
window->AddChildView(browser_view_);
|
||||
window->Show();
|
||||
browser_view_->RequestFocus();
|
||||
}
|
||||
|
||||
void OnWindowDestroyed(CefRefPtr<CefWindow> window) override {
|
||||
browser_view_ = nullptr;
|
||||
}
|
||||
|
||||
bool CanClose(CefRefPtr<CefWindow> window) override {
|
||||
CefRefPtr<CefBrowser> browser = browser_view_->GetBrowser();
|
||||
if (browser)
|
||||
return browser->GetHost()->TryCloseBrowser();
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
CefRefPtr<CefBrowserView> browser_view_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(PopupWindowDelegate);
|
||||
DISALLOW_COPY_AND_ASSIGN(PopupWindowDelegate);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
CefBrowserPlatformDelegateChromeViews::CefBrowserPlatformDelegateChromeViews(
|
||||
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate,
|
||||
CefRefPtr<CefBrowserViewImpl> browser_view)
|
||||
: CefBrowserPlatformDelegateChrome(std::move(native_delegate)) {
|
||||
if (browser_view)
|
||||
SetBrowserView(browser_view);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateChromeViews::SetBrowserView(
|
||||
CefRefPtr<CefBrowserViewImpl> browser_view) {
|
||||
DCHECK(!browser_view_);
|
||||
DCHECK(browser_view);
|
||||
browser_view_ = browser_view;
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateChromeViews::WebContentsCreated(
|
||||
content::WebContents* web_contents,
|
||||
bool owned) {
|
||||
CefBrowserPlatformDelegateChrome::WebContentsCreated(web_contents, owned);
|
||||
browser_view_->WebContentsCreated(web_contents);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateChromeViews::BrowserCreated(
|
||||
CefBrowserHostBase* browser) {
|
||||
CefBrowserPlatformDelegateChrome::BrowserCreated(browser);
|
||||
browser_view_->BrowserCreated(browser, base::RepeatingClosure());
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateChromeViews::NotifyBrowserCreated() {
|
||||
if (browser_view_->delegate())
|
||||
browser_view_->delegate()->OnBrowserCreated(browser_view_, browser_);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateChromeViews::NotifyBrowserDestroyed() {
|
||||
if (browser_view_->delegate())
|
||||
browser_view_->delegate()->OnBrowserDestroyed(browser_view_, browser_);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateChromeViews::BrowserDestroyed(
|
||||
CefBrowserHostBase* browser) {
|
||||
CefBrowserPlatformDelegateChrome::BrowserDestroyed(browser);
|
||||
browser_view_->BrowserDestroyed(browser);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateChromeViews::CloseHostWindow() {
|
||||
views::Widget* widget = GetWindowWidget();
|
||||
if (widget && !widget->IsClosed())
|
||||
widget->Close();
|
||||
}
|
||||
|
||||
views::Widget* CefBrowserPlatformDelegateChromeViews::GetWindowWidget() const {
|
||||
if (browser_view_->root_view())
|
||||
return browser_view_->root_view()->GetWidget();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowserView>
|
||||
CefBrowserPlatformDelegateChromeViews::GetBrowserView() const {
|
||||
return browser_view_.get();
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateChromeViews::PopupWebContentsCreated(
|
||||
const CefBrowserSettings& settings,
|
||||
CefRefPtr<CefClient> client,
|
||||
content::WebContents* new_web_contents,
|
||||
CefBrowserPlatformDelegate* new_platform_delegate,
|
||||
bool is_devtools) {
|
||||
DCHECK(new_platform_delegate->IsViewsHosted());
|
||||
auto* new_platform_delegate_impl =
|
||||
static_cast<CefBrowserPlatformDelegateChromeViews*>(
|
||||
new_platform_delegate);
|
||||
|
||||
CefRefPtr<CefBrowserViewDelegate> new_delegate;
|
||||
if (browser_view_->delegate()) {
|
||||
new_delegate = browser_view_->delegate()->GetDelegateForPopupBrowserView(
|
||||
browser_view_.get(), settings, client, is_devtools);
|
||||
}
|
||||
|
||||
// Create a new BrowserView for the popup.
|
||||
CefRefPtr<CefBrowserViewImpl> new_browser_view =
|
||||
CefBrowserViewImpl::CreateForPopup(settings, new_delegate);
|
||||
|
||||
// Associate the PlatformDelegate with the new BrowserView.
|
||||
new_platform_delegate_impl->SetBrowserView(new_browser_view);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateChromeViews::PopupBrowserCreated(
|
||||
CefBrowserHostBase* new_browser,
|
||||
bool is_devtools) {
|
||||
CefRefPtr<CefBrowserView> new_browser_view =
|
||||
CefBrowserView::GetForBrowser(new_browser);
|
||||
DCHECK(new_browser_view);
|
||||
|
||||
bool popup_handled = false;
|
||||
if (browser_view_->delegate()) {
|
||||
popup_handled = browser_view_->delegate()->OnPopupBrowserViewCreated(
|
||||
browser_view_.get(), new_browser_view.get(), is_devtools);
|
||||
}
|
||||
|
||||
if (!popup_handled) {
|
||||
CefWindow::CreateTopLevelWindow(
|
||||
new PopupWindowDelegate(new_browser_view.get()));
|
||||
}
|
||||
}
|
||||
|
||||
bool CefBrowserPlatformDelegateChromeViews::IsViewsHosted() const {
|
||||
return true;
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
// Copyright 2021 The Chromium Embedded Framework Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_CHROME_VIEWS_BROWSER_PLATFORM_DELEGATE_CHROME_VIEWS_H_
|
||||
#define CEF_LIBCEF_BROWSER_CHROME_VIEWS_BROWSER_PLATFORM_DELEGATE_CHROME_VIEWS_H_
|
||||
|
||||
#include "libcef/browser/chrome/browser_platform_delegate_chrome.h"
|
||||
#include "libcef/browser/views/browser_view_impl.h"
|
||||
|
||||
// Implementation of Chrome-based browser functionality.
|
||||
class CefBrowserPlatformDelegateChromeViews
|
||||
: public CefBrowserPlatformDelegateChrome {
|
||||
public:
|
||||
explicit CefBrowserPlatformDelegateChromeViews(
|
||||
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate,
|
||||
CefRefPtr<CefBrowserViewImpl> browser_view);
|
||||
|
||||
// CefBrowserPlatformDelegate overrides.
|
||||
void WebContentsCreated(content::WebContents* web_contents,
|
||||
bool owned) override;
|
||||
void BrowserCreated(CefBrowserHostBase* browser) override;
|
||||
void NotifyBrowserCreated() override;
|
||||
void NotifyBrowserDestroyed() override;
|
||||
void BrowserDestroyed(CefBrowserHostBase* browser) override;
|
||||
void CloseHostWindow() override;
|
||||
views::Widget* GetWindowWidget() const override;
|
||||
CefRefPtr<CefBrowserView> GetBrowserView() const override;
|
||||
void PopupWebContentsCreated(
|
||||
const CefBrowserSettings& settings,
|
||||
CefRefPtr<CefClient> client,
|
||||
content::WebContents* new_web_contents,
|
||||
CefBrowserPlatformDelegate* new_platform_delegate,
|
||||
bool is_devtools) override;
|
||||
void PopupBrowserCreated(CefBrowserHostBase* new_browser,
|
||||
bool is_devtools) override;
|
||||
bool IsViewsHosted() const override;
|
||||
|
||||
private:
|
||||
void SetBrowserView(CefRefPtr<CefBrowserViewImpl> browser_view);
|
||||
|
||||
CefRefPtr<CefBrowserViewImpl> browser_view_;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_CHROME_VIEWS_BROWSER_PLATFORM_DELEGATE_CHROME_VIEWS_H_
|
35
libcef/browser/chrome/views/chrome_browser_frame.cc
Normal file
35
libcef/browser/chrome/views/chrome_browser_frame.cc
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright 2021 The Chromium Embedded Framework Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be found
|
||||
// in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/chrome/views/chrome_browser_frame.h"
|
||||
|
||||
#include "chrome/browser/themes/theme_service.h"
|
||||
#include "chrome/browser/ui/browser.h"
|
||||
#include "chrome/browser/ui/views/frame/browser_view.h"
|
||||
|
||||
void ChromeBrowserFrame::Init(BrowserView* browser_view,
|
||||
std::unique_ptr<Browser> browser) {
|
||||
DCHECK(browser_view);
|
||||
|
||||
DCHECK(!browser_);
|
||||
browser_ = browser.get();
|
||||
DCHECK(browser_);
|
||||
|
||||
// Initialize BrowserFrame state.
|
||||
InitBrowserView(browser_view);
|
||||
|
||||
// Initialize BrowserView state.
|
||||
browser_view->InitBrowser(std::move(browser));
|
||||
}
|
||||
|
||||
views::internal::RootView* ChromeBrowserFrame::CreateRootView() {
|
||||
// Bypass the BrowserFrame implementation.
|
||||
return views::Widget::CreateRootView();
|
||||
}
|
||||
|
||||
std::unique_ptr<views::NonClientFrameView>
|
||||
ChromeBrowserFrame::CreateNonClientFrameView() {
|
||||
// Bypass the BrowserFrame implementation.
|
||||
return views::Widget::CreateNonClientFrameView();
|
||||
}
|
109
libcef/browser/chrome/views/chrome_browser_frame.h
Normal file
109
libcef/browser/chrome/views/chrome_browser_frame.h
Normal file
@@ -0,0 +1,109 @@
|
||||
// Copyright 2021 The Chromium Embedded Framework Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be found
|
||||
// in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_CHROME_VIEWS_CHROME_BROWSER_FRAME_H_
|
||||
#define CEF_LIBCEF_BROWSER_CHROME_VIEWS_CHROME_BROWSER_FRAME_H_
|
||||
#pragma once
|
||||
|
||||
#include "chrome/browser/ui/browser.h"
|
||||
#include "chrome/browser/ui/views/frame/browser_frame.h"
|
||||
|
||||
// An overview of the Chrome Browser object model is provided below. Object
|
||||
// creation normally begins with a call to Browser::Create(CreateParams) which
|
||||
// then creates the necessary Browser view, window and frame objects. CEF has
|
||||
// modified the default object creation model are described below to better
|
||||
// integrate with the existing CEF Views APIs.
|
||||
//
|
||||
// OVERVIEW
|
||||
//
|
||||
// Browser and BrowserWindow are the primary Chrome objects. Browser provides
|
||||
// the concrete state and mutation methods while BrowserWindow is an interface
|
||||
// implemented by the platform-specific "view" of the Browser window.
|
||||
//
|
||||
// Browser:
|
||||
// - Creates a BrowserView (aka BrowserWindow) and BrowserFrame (aka Widget) via
|
||||
// a call to BrowserWindow::CreateBrowserWindow() in the Browser constructor.
|
||||
// - An existing BrowserWindow can alternately be specified via the
|
||||
// Browser::CreateParams::window parameter.
|
||||
// - Owned by the BrowserView after creation.
|
||||
//
|
||||
// The Chrome Views implementation uses BrowserView to represent the browser
|
||||
// client area and BrowserFrame (plus helpers) to represent the non-client
|
||||
// window frame.
|
||||
//
|
||||
// BrowserView:
|
||||
// - Extends BrowserWindow, views::ClientView, views::WidgetDelegate.
|
||||
// - Owns the Browser.
|
||||
// - References the BrowserFrame.
|
||||
// - Passed to Widget::Init() via Widget::InitParams::delegate to receive
|
||||
// WidgetDelegate callbacks.
|
||||
// - Extended by CEF as ChromeBrowserView.
|
||||
// BrowserFrame:
|
||||
// - Extends Widget (aka views::internal::NativeWidgetDelegate).
|
||||
// - References the BrowserView.
|
||||
// - Creates/owns a DesktopBrowserFrameAura (aka NativeBrowserFrame) via
|
||||
// BrowserFrame::InitBrowserFrame().
|
||||
// - Extended by CEF as ChromeBrowserFrame.
|
||||
//
|
||||
// Chrome custom window/frame handling is implemented using platform-specific
|
||||
// objects.
|
||||
//
|
||||
// DesktopBrowserFrameAura:
|
||||
// - Extends NativeBrowserFrame, DesktopNativeWidgetAura.
|
||||
// - Acts as a helper for BrowserFrame.
|
||||
// - Creates/references a BrowserDesktopWindowTreeHostWin via
|
||||
// DesktopBrowserFrameAura::InitNativeWidget().
|
||||
// BrowserDesktopWindowTreeHostWin (for Windows):
|
||||
// - Extends DesktopWindowTreeHost.
|
||||
// - References DesktopBrowserFrameAura, BrowserView, BrowserFrame.
|
||||
// - Passed to Widget::Init() via Widget::InitParams::desktop_window_tree_host.
|
||||
//
|
||||
// CEF MODIFICATIONS
|
||||
//
|
||||
// The CEF Views integration uses an alternative approach of creating the
|
||||
// ChromeBrowserFrame in CefWindowView::CreateWidget() and the
|
||||
// ChromeBrowserView in CefBrowserViewImpl::CreateRootView().
|
||||
// The object associations described above are then configured via
|
||||
// ChromeBrowserView::AddedToWidget() and ChromeBrowserHostImpl::Create()
|
||||
// after the BrowserView is added to the Widget. The Chromium code has been
|
||||
// patched to allow later initialization of the Browser, BrowserFrame and
|
||||
// BrowserView members to support this model.
|
||||
//
|
||||
// CEF does not use Chrome's NativeBrowserFrame (aka DesktopBrowserFrameAura),
|
||||
// BrowserNonClientFrameView or BrowserRootView objects (all normally created by
|
||||
// BrowserFrame during Widget initialization). Consequently
|
||||
// |BrowserFrame::native_browser_frame_| and |BrowserFrame::browser_frame_view_|
|
||||
// (sometimes retrieved via BrowserFrame::GetFrameView) will be nullptr and the
|
||||
// Chromium code has been patched to add the necessary null checks.
|
||||
//
|
||||
// CEF does not pass ChromeBrowserView as the WidgetDelegate when the Widget is
|
||||
// initialized in CefWindowView::CreateWidget(). Some of the WidgetDelegate
|
||||
// callbacks may need to be routed from CefWindowView to ChromeBrowserView in
|
||||
// the future.
|
||||
//
|
||||
// See the chrome_runtime_views.patch file for the complete set of related
|
||||
// modifications.
|
||||
|
||||
class BrowserView;
|
||||
|
||||
// Widget for a Views-hosted Chrome browser. Created in
|
||||
// CefWindowView::CreateWidget() when the Chrome runtime is enabled.
|
||||
class ChromeBrowserFrame : public BrowserFrame {
|
||||
public:
|
||||
ChromeBrowserFrame() {}
|
||||
ChromeBrowserFrame(const ChromeBrowserFrame&) = delete;
|
||||
ChromeBrowserFrame& operator=(const ChromeBrowserFrame&) = delete;
|
||||
|
||||
void Init(BrowserView* browser_view, std::unique_ptr<Browser> browser);
|
||||
|
||||
// views::Widget methods:
|
||||
views::internal::RootView* CreateRootView() override;
|
||||
std::unique_ptr<views::NonClientFrameView> CreateNonClientFrameView()
|
||||
override;
|
||||
|
||||
private:
|
||||
Browser* browser_ = nullptr;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_CHROME_VIEWS_CHROME_BROWSER_FRAME_H_
|
98
libcef/browser/chrome/views/chrome_browser_view.cc
Normal file
98
libcef/browser/chrome/views/chrome_browser_view.cc
Normal file
@@ -0,0 +1,98 @@
|
||||
// Copyright 2021 The Chromium Embedded Framework Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be found
|
||||
// in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/chrome/views/chrome_browser_view.h"
|
||||
|
||||
#include "libcef/browser/chrome/views/chrome_browser_frame.h"
|
||||
#include "libcef/browser/views/browser_view_impl.h"
|
||||
|
||||
ChromeBrowserView::ChromeBrowserView(CefBrowserViewDelegate* cef_delegate,
|
||||
Delegate* browser_view_delegate)
|
||||
: ParentClass(cef_delegate), browser_view_delegate_(browser_view_delegate) {
|
||||
DCHECK(browser_view_delegate_);
|
||||
}
|
||||
|
||||
void ChromeBrowserView::InitBrowser(std::unique_ptr<Browser> browser,
|
||||
CefRefPtr<CefBrowserView> browser_view) {
|
||||
DCHECK(!browser_);
|
||||
DCHECK(!web_view_);
|
||||
|
||||
browser_ = browser.get();
|
||||
DCHECK(browser_);
|
||||
|
||||
// Initialize the BrowserFrame and BrowserView.
|
||||
auto chrome_widget = static_cast<ChromeBrowserFrame*>(GetWidget());
|
||||
chrome_widget->Init(this, std::move(browser));
|
||||
|
||||
// Retrieve the views::WebView that was created by the above initializations.
|
||||
auto view_impl = static_cast<CefBrowserViewImpl*>(browser_view.get());
|
||||
web_view_ = view_impl->web_view();
|
||||
DCHECK(web_view_);
|
||||
|
||||
ParentClass::AddedToWidget();
|
||||
}
|
||||
|
||||
void ChromeBrowserView::Destroyed() {
|
||||
DCHECK(!destroyed_);
|
||||
destroyed_ = true;
|
||||
browser_ = nullptr;
|
||||
web_view_ = nullptr;
|
||||
}
|
||||
|
||||
void ChromeBrowserView::ViewHierarchyChanged(
|
||||
const views::ViewHierarchyChangedDetails& details) {
|
||||
ParentClass::ViewHierarchyChanged(details);
|
||||
if (details.is_add && details.child == this) {
|
||||
gfx::Size size = GetPreferredSize();
|
||||
if (size.IsEmpty()) {
|
||||
// No size was provided for this View. Size it to the parent by default
|
||||
// or, depending on the Layout, the browser may be initially 0x0 size and
|
||||
// will not display until the parent is next resized (resulting in a call
|
||||
// to WebView::OnBoundsChanged). For example, this can happen when adding
|
||||
// this View to a CefWindow with FillLayout and then calling
|
||||
// CefWindow::Show() without first resizing the CefWindow.
|
||||
size = details.parent->GetPreferredSize();
|
||||
if (!size.IsEmpty())
|
||||
SetSize(size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ChromeBrowserView::AddedToWidget() {
|
||||
// Results in a call to InitBrowser which calls ParentClass::AddedToWidget.
|
||||
browser_view_delegate_->OnBrowserViewAdded();
|
||||
}
|
||||
|
||||
void ChromeBrowserView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
|
||||
ParentClass::OnBoundsChanged(previous_bounds);
|
||||
browser_view_delegate_->OnBoundsChanged();
|
||||
}
|
||||
|
||||
ToolbarView* ChromeBrowserView::OverrideCreateToolbar(
|
||||
Browser* browser,
|
||||
BrowserView* browser_view) {
|
||||
if (cef_delegate()) {
|
||||
auto toolbar_type = cef_delegate()->GetChromeToolbarType();
|
||||
base::Optional<ToolbarView::DisplayMode> display_mode;
|
||||
switch (toolbar_type) {
|
||||
case CEF_CTT_NORMAL:
|
||||
display_mode = ToolbarView::DisplayMode::NORMAL;
|
||||
break;
|
||||
case CEF_CTT_LOCATION:
|
||||
display_mode = ToolbarView::DisplayMode::LOCATION;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (display_mode) {
|
||||
cef_toolbar_ = CefToolbarViewImpl::Create(nullptr, browser, browser_view,
|
||||
display_mode);
|
||||
// Ownership will be taken by BrowserView.
|
||||
view_util::PassOwnership(cef_toolbar_).release();
|
||||
return cef_toolbar_->root_view();
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
66
libcef/browser/chrome/views/chrome_browser_view.h
Normal file
66
libcef/browser/chrome/views/chrome_browser_view.h
Normal file
@@ -0,0 +1,66 @@
|
||||
// Copyright 2021 The Chromium Embedded Framework Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be found
|
||||
// in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_CHROME_VIEWS_CHROME_BROWSER_VIEW_H_
|
||||
#define CEF_LIBCEF_BROWSER_CHROME_VIEWS_CHROME_BROWSER_VIEW_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/views/cef_browser_view.h"
|
||||
#include "include/views/cef_browser_view_delegate.h"
|
||||
#include "libcef/browser/chrome/views/toolbar_view_impl.h"
|
||||
#include "libcef/browser/views/browser_view_view.h"
|
||||
#include "libcef/browser/views/view_view.h"
|
||||
|
||||
#include "chrome/browser/ui/browser.h"
|
||||
#include "chrome/browser/ui/views/frame/browser_view.h"
|
||||
|
||||
namespace views {
|
||||
class WebView;
|
||||
} // namespace views
|
||||
|
||||
// A variant of CefBrowserViewView that extends BrowserView instead of
|
||||
// views::WebView. See chrome_browser_frame.h for related documentation.
|
||||
class ChromeBrowserView
|
||||
: public CefViewView<BrowserView, CefBrowserViewDelegate> {
|
||||
public:
|
||||
using ParentClass = CefViewView<BrowserView, CefBrowserViewDelegate>;
|
||||
using Delegate = CefBrowserViewView::Delegate;
|
||||
|
||||
// |cef_delegate| may be nullptr.
|
||||
// |browser_view_delegate| must be non-nullptr.
|
||||
ChromeBrowserView(CefBrowserViewDelegate* cef_delegate,
|
||||
Delegate* browser_view_delegate);
|
||||
|
||||
// Called by ChromeBrowserHostImpl.
|
||||
void InitBrowser(std::unique_ptr<Browser> browser,
|
||||
CefRefPtr<CefBrowserView> browser_view);
|
||||
void Destroyed();
|
||||
|
||||
// View methods:
|
||||
void ViewHierarchyChanged(
|
||||
const views::ViewHierarchyChangedDetails& details) override;
|
||||
void AddedToWidget() override;
|
||||
void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
|
||||
|
||||
// BrowserView methods:
|
||||
ToolbarView* OverrideCreateToolbar(Browser* browser,
|
||||
BrowserView* browser_view) override;
|
||||
|
||||
CefRefPtr<CefToolbarViewImpl> cef_toolbar() const { return cef_toolbar_; }
|
||||
|
||||
private:
|
||||
// Not owned by this object.
|
||||
Delegate* browser_view_delegate_;
|
||||
|
||||
Browser* browser_ = nullptr;
|
||||
views::WebView* web_view_ = nullptr;
|
||||
|
||||
bool destroyed_ = false;
|
||||
|
||||
CefRefPtr<CefToolbarViewImpl> cef_toolbar_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserView);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_CHROME_VIEWS_CHROME_BROWSER_VIEW_H_
|
40
libcef/browser/chrome/views/toolbar_view_impl.cc
Normal file
40
libcef/browser/chrome/views/toolbar_view_impl.cc
Normal file
@@ -0,0 +1,40 @@
|
||||
// Copyright 2021 The Chromium Embedded Framework Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be found
|
||||
// in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/chrome/views/toolbar_view_impl.h"
|
||||
|
||||
// static
|
||||
CefRefPtr<CefToolbarViewImpl> CefToolbarViewImpl::Create(
|
||||
CefRefPtr<CefViewDelegate> delegate,
|
||||
Browser* browser,
|
||||
BrowserView* browser_view,
|
||||
base::Optional<ToolbarView::DisplayMode> display_mode) {
|
||||
CEF_REQUIRE_UIT_RETURN(nullptr);
|
||||
CefRefPtr<CefToolbarViewImpl> view =
|
||||
new CefToolbarViewImpl(delegate, browser, browser_view, display_mode);
|
||||
view->Initialize();
|
||||
return view;
|
||||
}
|
||||
|
||||
// static
|
||||
const char* const CefToolbarViewImpl::kTypeString = "ToolbarView";
|
||||
|
||||
CefToolbarViewImpl::CefToolbarViewImpl(
|
||||
CefRefPtr<CefViewDelegate> delegate,
|
||||
Browser* browser,
|
||||
BrowserView* browser_view,
|
||||
base::Optional<ToolbarView::DisplayMode> display_mode)
|
||||
: ParentClass(delegate),
|
||||
browser_(browser),
|
||||
browser_view_(browser_view),
|
||||
display_mode_(display_mode) {}
|
||||
|
||||
CefToolbarViewView* CefToolbarViewImpl::CreateRootView() {
|
||||
return new CefToolbarViewView(delegate(), browser_, browser_view_,
|
||||
display_mode_);
|
||||
}
|
||||
|
||||
void CefToolbarViewImpl::InitializeRootView() {
|
||||
static_cast<CefToolbarViewView*>(root_view())->Initialize();
|
||||
}
|
55
libcef/browser/chrome/views/toolbar_view_impl.h
Normal file
55
libcef/browser/chrome/views/toolbar_view_impl.h
Normal file
@@ -0,0 +1,55 @@
|
||||
// Copyright 2021 The Chromium Embedded Framework Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be found
|
||||
// in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_CHROME_VIEWS_TOOLBAR_VIEW_IMPL_H_
|
||||
#define CEF_LIBCEF_BROWSER_CHROME_VIEWS_TOOLBAR_VIEW_IMPL_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/views/cef_view_delegate.h"
|
||||
|
||||
#include "libcef/browser/chrome/views/toolbar_view_view.h"
|
||||
#include "libcef/browser/views/view_impl.h"
|
||||
|
||||
class Browser;
|
||||
class BrowserView;
|
||||
|
||||
class CefToolbarViewImpl
|
||||
: public CefViewImpl<CefToolbarViewView, CefView, CefViewDelegate> {
|
||||
public:
|
||||
typedef CefViewImpl<CefToolbarViewView, CefView, CefViewDelegate> ParentClass;
|
||||
|
||||
// Create a new CefToolbarViewImpl instance. |delegate| may be nullptr.
|
||||
static CefRefPtr<CefToolbarViewImpl> Create(
|
||||
CefRefPtr<CefViewDelegate> delegate,
|
||||
Browser* browser,
|
||||
BrowserView* browser_view,
|
||||
base::Optional<ToolbarView::DisplayMode> display_mode);
|
||||
|
||||
static const char* const kTypeString;
|
||||
|
||||
// CefViewAdapter methods:
|
||||
std::string GetDebugType() override { return kTypeString; }
|
||||
|
||||
private:
|
||||
// Create a new implementation object.
|
||||
// Always call Initialize() after creation.
|
||||
// |delegate| may be nullptr.
|
||||
CefToolbarViewImpl(CefRefPtr<CefViewDelegate> delegate,
|
||||
Browser* browser,
|
||||
BrowserView* browser_view,
|
||||
base::Optional<ToolbarView::DisplayMode> display_mode);
|
||||
|
||||
// CefViewImpl methods:
|
||||
CefToolbarViewView* CreateRootView() override;
|
||||
void InitializeRootView() override;
|
||||
|
||||
Browser* const browser_;
|
||||
BrowserView* const browser_view_;
|
||||
base::Optional<ToolbarView::DisplayMode> const display_mode_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefToolbarViewImpl);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefToolbarViewImpl);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_VIEWS_SCROLL_VIEW_IMPL_H_
|
11
libcef/browser/chrome/views/toolbar_view_view.cc
Normal file
11
libcef/browser/chrome/views/toolbar_view_view.cc
Normal file
@@ -0,0 +1,11 @@
|
||||
// Copyright 2021 The Chromium Embedded Framework Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be found
|
||||
// in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/chrome/views/toolbar_view_view.h"
|
||||
|
||||
CefToolbarViewView::CefToolbarViewView(CefViewDelegate* cef_delegate,
|
||||
Browser* browser,
|
||||
BrowserView* browser_view,
|
||||
base::Optional<DisplayMode> display_mode)
|
||||
: ParentClass(cef_delegate, browser, browser_view, display_mode) {}
|
27
libcef/browser/chrome/views/toolbar_view_view.h
Normal file
27
libcef/browser/chrome/views/toolbar_view_view.h
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright 2021 The Chromium Embedded Framework Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be found
|
||||
// in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_CHROME_VIEWS_TOOLBAR_VIEW_VIEW_H_
|
||||
#define CEF_LIBCEF_BROWSER_CHROME_VIEWS_TOOLBAR_VIEW_VIEW_H_
|
||||
#pragma once
|
||||
|
||||
#include "libcef/browser/views/view_view.h"
|
||||
|
||||
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
|
||||
|
||||
class CefToolbarViewView : public CefViewView<ToolbarView, CefViewDelegate> {
|
||||
public:
|
||||
typedef CefViewView<ToolbarView, CefViewDelegate> ParentClass;
|
||||
|
||||
// |cef_delegate| may be nullptr.
|
||||
explicit CefToolbarViewView(CefViewDelegate* cef_delegate,
|
||||
Browser* browser,
|
||||
BrowserView* browser_view,
|
||||
base::Optional<DisplayMode> display_mode);
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(CefToolbarViewView);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_CHROME_VIEWS_TOOLBAR_VIEW_VIEW_H_
|
@@ -5,6 +5,7 @@
|
||||
#include "libcef/browser/context.h"
|
||||
|
||||
#include "libcef/browser/browser_info_manager.h"
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/browser/trace_subscriber.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
@@ -434,8 +435,11 @@ void CefContext::PopulateGlobalRequestContextSettings(
|
||||
settings->ignore_certificate_errors =
|
||||
settings_.ignore_certificate_errors ||
|
||||
command_line->HasSwitch(switches::kIgnoreCertificateErrors);
|
||||
CefString(&settings->accept_language_list) =
|
||||
CefString(&settings_.accept_language_list);
|
||||
|
||||
CefString(&settings->cookieable_schemes_list) =
|
||||
CefString(&settings_.cookieable_schemes_list);
|
||||
settings->cookieable_schemes_exclude_defaults =
|
||||
settings_.cookieable_schemes_exclude_defaults;
|
||||
}
|
||||
|
||||
void CefContext::NormalizeRequestContextSettings(
|
||||
@@ -443,12 +447,6 @@ void CefContext::NormalizeRequestContextSettings(
|
||||
// The |root_cache_path| value was already normalized in Initialize.
|
||||
const base::FilePath& root_cache_path = CefString(&settings_.root_cache_path);
|
||||
NormalizeCachePathAndSet(settings->cache_path, root_cache_path);
|
||||
|
||||
if (settings->accept_language_list.length == 0) {
|
||||
// Use the global language list setting.
|
||||
CefString(&settings->accept_language_list) =
|
||||
CefString(&settings_.accept_language_list);
|
||||
}
|
||||
}
|
||||
|
||||
void CefContext::AddObserver(Observer* observer) {
|
||||
@@ -469,12 +467,19 @@ bool CefContext::HasObserver(Observer* observer) const {
|
||||
void CefContext::OnContextInitialized() {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
// Notify the handler.
|
||||
if (application_) {
|
||||
CefRefPtr<CefBrowserProcessHandler> handler =
|
||||
application_->GetBrowserProcessHandler();
|
||||
if (handler)
|
||||
handler->OnContextInitialized();
|
||||
// Notify the handler after the global browser context has initialized.
|
||||
CefRefPtr<CefRequestContext> request_context =
|
||||
CefRequestContext::GetGlobalContext();
|
||||
auto impl = static_cast<CefRequestContextImpl*>(request_context.get());
|
||||
impl->ExecuteWhenBrowserContextInitialized(base::BindOnce(
|
||||
[](CefRefPtr<CefApp> app) {
|
||||
CefRefPtr<CefBrowserProcessHandler> handler =
|
||||
app->GetBrowserProcessHandler();
|
||||
if (handler)
|
||||
handler->OnContextInitialized();
|
||||
},
|
||||
application_));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -5,6 +5,7 @@
|
||||
#include "libcef/browser/context_menu_params_impl.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "third_party/blink/public/mojom/context_menu/context_menu.mojom.h"
|
||||
|
||||
CefContextMenuParamsImpl::CefContextMenuParamsImpl(
|
||||
content::ContextMenuParams* value)
|
||||
@@ -146,8 +147,3 @@ bool CefContextMenuParamsImpl::IsCustomMenu() {
|
||||
CEF_VALUE_VERIFY_RETURN(false, false);
|
||||
return !const_value().custom_items.empty();
|
||||
}
|
||||
|
||||
bool CefContextMenuParamsImpl::IsPepperMenu() {
|
||||
CEF_VALUE_VERIFY_RETURN(false, false);
|
||||
return const_value().custom_context.is_pepper_menu;
|
||||
}
|
||||
|
@@ -38,7 +38,6 @@ class CefContextMenuParamsImpl
|
||||
bool IsSpellCheckEnabled() override;
|
||||
EditStateFlags GetEditStateFlags() override;
|
||||
bool IsCustomMenu() override;
|
||||
bool IsPepperMenu() override;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefContextMenuParamsImpl);
|
||||
};
|
||||
|
@@ -251,7 +251,7 @@ CefDevToolsFrontend* CefDevToolsFrontend::Show(
|
||||
}
|
||||
|
||||
CefBrowserCreateParams create_params;
|
||||
if (!inspected_browser->IsViewsHosted())
|
||||
if (!inspected_browser->is_views_hosted())
|
||||
create_params.window_info.reset(new CefWindowInfo(windowInfo));
|
||||
create_params.client = client;
|
||||
create_params.settings = new_settings;
|
||||
@@ -533,6 +533,11 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
void CefDevToolsFrontend::DispatchProtocolMessage(
|
||||
content::DevToolsAgentHost* agent_host,
|
||||
base::span<const uint8_t> message) {
|
||||
if (!frontend_browser_->GetWebContents() ||
|
||||
frontend_browser_->GetWebContents()->IsBeingDestroyed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
base::StringPiece str_message(reinterpret_cast<const char*>(message.data()),
|
||||
message.size());
|
||||
if (ProtocolLoggingEnabled()) {
|
||||
|
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "libcef/browser/devtools/devtools_controller.h"
|
||||
#include "libcef/browser/devtools/devtools_frontend.h"
|
||||
#include "libcef/features/runtime.h"
|
||||
|
||||
#include "content/public/browser/web_contents.h"
|
||||
|
||||
@@ -31,7 +32,7 @@ class CefDevToolsRegistrationImpl : public CefRegistration,
|
||||
controller_->RemoveObserver(this);
|
||||
}
|
||||
|
||||
void Initialize(AlloyBrowserHostImpl* browser,
|
||||
void Initialize(CefBrowserHostBase* browser,
|
||||
base::WeakPtr<CefDevToolsController> controller) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(browser && controller);
|
||||
@@ -83,7 +84,7 @@ class CefDevToolsRegistrationImpl : public CefRegistration,
|
||||
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer_;
|
||||
|
||||
AlloyBrowserHostImpl* browser_ = nullptr;
|
||||
CefBrowserHostBase* browser_ = nullptr;
|
||||
base::WeakPtr<CefDevToolsController> controller_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefDevToolsRegistrationImpl);
|
||||
@@ -92,7 +93,7 @@ class CefDevToolsRegistrationImpl : public CefRegistration,
|
||||
|
||||
} // namespace
|
||||
|
||||
CefDevToolsManager::CefDevToolsManager(AlloyBrowserHostImpl* inspected_browser)
|
||||
CefDevToolsManager::CefDevToolsManager(CefBrowserHostBase* inspected_browser)
|
||||
: inspected_browser_(inspected_browser), weak_ptr_factory_(this) {
|
||||
CEF_REQUIRE_UIT();
|
||||
}
|
||||
@@ -115,10 +116,15 @@ void CefDevToolsManager::ShowDevTools(const CefWindowInfo& windowInfo,
|
||||
return;
|
||||
}
|
||||
|
||||
devtools_frontend_ = CefDevToolsFrontend::Show(
|
||||
inspected_browser_, windowInfo, client, settings, inspect_element_at,
|
||||
base::BindOnce(&CefDevToolsManager::OnFrontEndDestroyed,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
if (cef::IsChromeRuntimeEnabled()) {
|
||||
NOTIMPLEMENTED();
|
||||
} else {
|
||||
auto alloy_browser = static_cast<AlloyBrowserHostImpl*>(inspected_browser_);
|
||||
devtools_frontend_ = CefDevToolsFrontend::Show(
|
||||
alloy_browser, windowInfo, client, settings, inspect_element_at,
|
||||
base::BindOnce(&CefDevToolsManager::OnFrontEndDestroyed,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
}
|
||||
}
|
||||
|
||||
void CefDevToolsManager::CloseDevTools() {
|
||||
@@ -193,8 +199,8 @@ void CefDevToolsManager::OnFrontEndDestroyed() {
|
||||
|
||||
bool CefDevToolsManager::EnsureController() {
|
||||
if (!devtools_controller_) {
|
||||
devtools_controller_.reset(
|
||||
new CefDevToolsController(inspected_browser_->web_contents()));
|
||||
devtools_controller_.reset(new CefDevToolsController(
|
||||
inspected_browser_->contents_delegate()->web_contents()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
|
||||
class AlloyBrowserHostImpl;
|
||||
class CefBrowserHostBase;
|
||||
class CefDevToolsController;
|
||||
class CefDevToolsFrontend;
|
||||
|
||||
@@ -23,7 +23,7 @@ class WebContents;
|
||||
class CefDevToolsManager {
|
||||
public:
|
||||
// |inspected_browser| will outlive this object.
|
||||
explicit CefDevToolsManager(AlloyBrowserHostImpl* inspected_browser);
|
||||
explicit CefDevToolsManager(CefBrowserHostBase* inspected_browser);
|
||||
~CefDevToolsManager();
|
||||
|
||||
// See CefBrowserHost methods of the same name for documentation.
|
||||
@@ -52,7 +52,7 @@ class CefDevToolsManager {
|
||||
|
||||
bool EnsureController();
|
||||
|
||||
AlloyBrowserHostImpl* const inspected_browser_;
|
||||
CefBrowserHostBase* const inspected_browser_;
|
||||
|
||||
// CefDevToolsFrontend will delete itself when the frontend WebContents is
|
||||
// destroyed.
|
||||
|
@@ -65,15 +65,15 @@ CefComponentExtensionResourceManager::GetTemplateReplacementsForExtension(
|
||||
}
|
||||
|
||||
void CefComponentExtensionResourceManager::AddComponentResourceEntries(
|
||||
const GritResourceMap* entries,
|
||||
const webui::ResourcePath* entries,
|
||||
size_t size) {
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
base::FilePath resource_path =
|
||||
base::FilePath().AppendASCII(entries[i].name);
|
||||
base::FilePath().AppendASCII(entries[i].path);
|
||||
resource_path = resource_path.NormalizePathSeparators();
|
||||
|
||||
DCHECK(!base::Contains(path_to_resource_info_, resource_path));
|
||||
path_to_resource_info_[resource_path] = entries[i].value;
|
||||
path_to_resource_info_[resource_path] = entries[i].id;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -11,7 +11,9 @@
|
||||
#include "base/macros.h"
|
||||
#include "extensions/browser/component_extension_resource_manager.h"
|
||||
|
||||
struct GritResourceMap;
|
||||
namespace webui {
|
||||
struct ResourcePath;
|
||||
}
|
||||
|
||||
namespace extensions {
|
||||
|
||||
@@ -29,7 +31,8 @@ class CefComponentExtensionResourceManager
|
||||
const std::string& extension_id) const override;
|
||||
|
||||
private:
|
||||
void AddComponentResourceEntries(const GritResourceMap* entries, size_t size);
|
||||
void AddComponentResourceEntries(const webui::ResourcePath* entries,
|
||||
size_t size);
|
||||
|
||||
// A map from a resource path to the resource ID. Used by
|
||||
// IsComponentExtensionResource.
|
||||
|
@@ -366,7 +366,7 @@ base::DictionaryValue* CefExtensionFunctionDetails::OpenTab(
|
||||
return nullptr;
|
||||
|
||||
CefBrowserCreateParams create_params;
|
||||
create_params.url = url;
|
||||
create_params.url = url.spec();
|
||||
create_params.request_context = request_context;
|
||||
create_params.window_info.reset(new CefWindowInfo);
|
||||
|
||||
@@ -381,14 +381,14 @@ base::DictionaryValue* CefExtensionFunctionDetails::OpenTab(
|
||||
CefRefPtr<CefExtensionHandler> handler = cef_extension->GetHandler();
|
||||
if (handler.get() &&
|
||||
handler->OnBeforeBrowser(cef_extension, sender_browser.get(),
|
||||
active_browser.get(), index, url.spec(), active,
|
||||
*create_params.window_info, create_params.client,
|
||||
create_params.settings)) {
|
||||
active_browser.get(), index, create_params.url,
|
||||
active, *create_params.window_info,
|
||||
create_params.client, create_params.settings)) {
|
||||
// Cancel the browser creation.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (active_browser->IsViewsHosted()) {
|
||||
if (active_browser->is_views_hosted()) {
|
||||
// The new browser will also be Views hosted.
|
||||
create_params.window_info.reset();
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@ CefExtensionHostDelegate::~CefExtensionHostDelegate() {}
|
||||
void CefExtensionHostDelegate::OnExtensionHostCreated(
|
||||
content::WebContents* web_contents) {}
|
||||
|
||||
void CefExtensionHostDelegate::OnRenderViewCreatedForBackgroundPage(
|
||||
void CefExtensionHostDelegate::OnMainFrameCreatedForBackgroundPage(
|
||||
ExtensionHost* host) {}
|
||||
|
||||
content::JavaScriptDialogManager*
|
||||
|
@@ -19,7 +19,7 @@ class CefExtensionHostDelegate : public ExtensionHostDelegate {
|
||||
|
||||
// ExtensionHostDelegate implementation.
|
||||
void OnExtensionHostCreated(content::WebContents* web_contents) override;
|
||||
void OnRenderViewCreatedForBackgroundPage(ExtensionHost* host) override;
|
||||
void OnMainFrameCreatedForBackgroundPage(ExtensionHost* host) override;
|
||||
content::JavaScriptDialogManager* GetJavaScriptDialogManager() override;
|
||||
void CreateTab(std::unique_ptr<content::WebContents> web_contents,
|
||||
const std::string& extension_id,
|
||||
|
@@ -407,7 +407,7 @@ ServiceWorkerManager* CefExtensionSystem::service_worker_manager() {
|
||||
return service_worker_manager_.get();
|
||||
}
|
||||
|
||||
SharedUserScriptManager* CefExtensionSystem::shared_user_script_manager() {
|
||||
UserScriptManager* CefExtensionSystem::user_script_manager() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -576,12 +576,12 @@ const Extension* CefExtensionSystem::LoadExtension(
|
||||
// Insert first so that callbacks can retrieve the loaded extension.
|
||||
extension_map_.insert(std::make_pair(extension->id(), cef_extension));
|
||||
|
||||
cef_extension->OnExtensionLoaded();
|
||||
|
||||
// This may trigger additional callbacks.
|
||||
registry_->AddEnabled(extension.get());
|
||||
NotifyExtensionLoaded(extension.get());
|
||||
|
||||
cef_extension->OnExtensionLoaded();
|
||||
|
||||
return extension.get();
|
||||
}
|
||||
|
||||
|
@@ -87,7 +87,7 @@ class CefExtensionSystem : public ExtensionSystem {
|
||||
RuntimeData* runtime_data() override;
|
||||
ManagementPolicy* management_policy() override;
|
||||
ServiceWorkerManager* service_worker_manager() override;
|
||||
SharedUserScriptManager* shared_user_script_manager() override;
|
||||
UserScriptManager* user_script_manager() override;
|
||||
StateStore* state_store() override;
|
||||
StateStore* rules_store() override;
|
||||
scoped_refptr<ValueStoreFactory> store_factory() override;
|
||||
|
@@ -251,13 +251,13 @@ bool CefExtensionsBrowserClient::CreateBackgroundExtensionHost(
|
||||
}
|
||||
|
||||
CefBrowserCreateParams create_params;
|
||||
create_params.url = url;
|
||||
create_params.url = url.spec();
|
||||
create_params.request_context = request_context;
|
||||
|
||||
CefRefPtr<CefExtensionHandler> handler = cef_extension->GetHandler();
|
||||
if (handler.get() && handler->OnBeforeBackgroundBrowser(
|
||||
cef_extension, url.spec(), create_params.client,
|
||||
create_params.settings)) {
|
||||
cef_extension, create_params.url,
|
||||
create_params.client, create_params.settings)) {
|
||||
// Cancel the background host creation.
|
||||
return true;
|
||||
}
|
||||
|
@@ -12,12 +12,12 @@
|
||||
#include "libcef/browser/navigate_params.h"
|
||||
#include "libcef/browser/net_service/browser_urlrequest_impl.h"
|
||||
#include "libcef/common/cef_messages.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
#include "libcef/common/net/url_util.h"
|
||||
#include "libcef/common/process_message_impl.h"
|
||||
#include "libcef/common/request_impl.h"
|
||||
#include "libcef/common/task_runner_impl.h"
|
||||
|
||||
#include "components/url_formatter/url_fixer.h"
|
||||
#include "content/browser/renderer_host/frame_tree_node.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
@@ -310,16 +310,9 @@ void CefFrameHostImpl::NotifyMoveOrResizeStarted() {
|
||||
void CefFrameHostImpl::Navigate(const CefNavigateParams& params) {
|
||||
CefMsg_LoadRequest_Params request;
|
||||
|
||||
// Fix common problems with user-typed text. Among other things, this:
|
||||
// - Converts absolute file paths to "file://" URLs.
|
||||
// - Normalizes "about:" and "chrome:" to "chrome://" URLs.
|
||||
// - Adds the "http://" scheme if none was specified.
|
||||
request.url = url_formatter::FixupURL(params.url.possibly_invalid_spec(),
|
||||
std::string());
|
||||
if (!request.url.is_valid()) {
|
||||
LOG(ERROR) << "Invalid URL: " << params.url.possibly_invalid_spec();
|
||||
request.url = params.url;
|
||||
if (!url_util::FixupGURL(request.url))
|
||||
return;
|
||||
}
|
||||
|
||||
request.method = params.method;
|
||||
request.referrer = params.referrer.url;
|
||||
@@ -347,16 +340,8 @@ void CefFrameHostImpl::LoadURLWithExtras(const std::string& url,
|
||||
if (frame_id < CefFrameHostImpl::kMainFrameId)
|
||||
return;
|
||||
|
||||
// Any necessary fixup of the URL will occur in
|
||||
// [CefBrowserHostBase|CefFrameHostImpl]::Navigate().
|
||||
GURL gurl(url);
|
||||
if (!url.empty() && !gurl.is_valid() && !gurl.has_scheme()) {
|
||||
std::string fixed_scheme(url::kHttpScheme);
|
||||
fixed_scheme.append(url::kStandardSchemeSeparator);
|
||||
std::string new_url = url;
|
||||
new_url.insert(0, fixed_scheme);
|
||||
gurl = GURL(new_url);
|
||||
}
|
||||
// Any necessary fixup will occur in Navigate.
|
||||
GURL gurl = url_util::MakeGURL(url, /*fixup=*/false);
|
||||
|
||||
if (frame_id == CefFrameHostImpl::kMainFrameId) {
|
||||
// Load via the browser using NavigationController.
|
||||
|
@@ -23,7 +23,9 @@ CefIOThreadState::CefIOThreadState() {
|
||||
base::Unretained(this)));
|
||||
}
|
||||
|
||||
CefIOThreadState::~CefIOThreadState() {}
|
||||
CefIOThreadState::~CefIOThreadState() {
|
||||
CEF_REQUIRE_IOT();
|
||||
}
|
||||
|
||||
void CefIOThreadState::AddHandler(int render_process_id,
|
||||
int render_frame_id,
|
||||
|
@@ -12,15 +12,18 @@
|
||||
|
||||
#include "libcef/browser/request_context_handler_map.h"
|
||||
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
|
||||
class GURL;
|
||||
|
||||
// Stores state that will be accessed on the IO thread. Life span is controlled
|
||||
// by CefBrowserContext. Created on the UI thread but accessed and destroyed on
|
||||
// the IO thread. See browser_context.h for an object relationship diagram.
|
||||
class CefIOThreadState {
|
||||
class CefIOThreadState : public base::RefCountedThreadSafe<
|
||||
CefIOThreadState,
|
||||
content::BrowserThread::DeleteOnIOThread> {
|
||||
public:
|
||||
CefIOThreadState();
|
||||
virtual ~CefIOThreadState();
|
||||
|
||||
// See comments in CefRequestContextHandlerMap.
|
||||
void AddHandler(int render_process_id,
|
||||
@@ -44,6 +47,12 @@ class CefIOThreadState {
|
||||
CefRefPtr<CefSchemeHandlerFactory> GetSchemeHandlerFactory(const GURL& url);
|
||||
|
||||
private:
|
||||
friend struct content::BrowserThread::DeleteOnThread<
|
||||
content::BrowserThread::IO>;
|
||||
friend class base::DeleteHelper<CefIOThreadState>;
|
||||
|
||||
~CefIOThreadState();
|
||||
|
||||
void InitOnIOThread();
|
||||
|
||||
// Map IDs to CefRequestContextHandler objects.
|
||||
|
@@ -144,11 +144,27 @@ CefMediaRouterImpl::CefMediaRouterImpl() {
|
||||
}
|
||||
|
||||
void CefMediaRouterImpl::Initialize(
|
||||
const CefBrowserContext::Getter& browser_context_getter) {
|
||||
const CefBrowserContext::Getter& browser_context_getter,
|
||||
CefRefPtr<CefCompletionCallback> callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(!initialized_);
|
||||
DCHECK(!browser_context_getter.is_null());
|
||||
DCHECK(browser_context_getter_.is_null());
|
||||
browser_context_getter_ = browser_context_getter;
|
||||
|
||||
initialized_ = true;
|
||||
if (!init_callbacks_.empty()) {
|
||||
for (auto& callback : init_callbacks_) {
|
||||
std::move(callback).Run();
|
||||
}
|
||||
init_callbacks_.clear();
|
||||
}
|
||||
|
||||
if (callback) {
|
||||
// Execute client callback asynchronously for consistency.
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefCompletionCallback::OnComplete,
|
||||
callback.get()));
|
||||
}
|
||||
}
|
||||
|
||||
CefRefPtr<CefRegistration> CefMediaRouterImpl::AddObserver(
|
||||
@@ -157,7 +173,8 @@ CefRefPtr<CefRegistration> CefMediaRouterImpl::AddObserver(
|
||||
return nullptr;
|
||||
CefRefPtr<CefRegistrationImpl> registration =
|
||||
new CefRegistrationImpl(observer);
|
||||
InitializeRegistrationOnUIThread(registration);
|
||||
StoreOrTriggerInitCallback(base::BindOnce(
|
||||
&CefMediaRouterImpl::InitializeRegistrationInternal, this, registration));
|
||||
return registration.get();
|
||||
}
|
||||
|
||||
@@ -181,11 +198,32 @@ CefRefPtr<CefMediaSource> CefMediaRouterImpl::GetSource(const CefString& urn) {
|
||||
}
|
||||
|
||||
void CefMediaRouterImpl::NotifyCurrentSinks() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT, base::BindOnce(&CefMediaRouterImpl::NotifyCurrentSinks, this));
|
||||
return;
|
||||
}
|
||||
StoreOrTriggerInitCallback(
|
||||
base::BindOnce(&CefMediaRouterImpl::NotifyCurrentSinksInternal, this));
|
||||
}
|
||||
|
||||
void CefMediaRouterImpl::CreateRoute(
|
||||
CefRefPtr<CefMediaSource> source,
|
||||
CefRefPtr<CefMediaSink> sink,
|
||||
CefRefPtr<CefMediaRouteCreateCallback> callback) {
|
||||
StoreOrTriggerInitCallback(base::BindOnce(
|
||||
&CefMediaRouterImpl::CreateRouteInternal, this, source, sink, callback));
|
||||
}
|
||||
|
||||
void CefMediaRouterImpl::NotifyCurrentRoutes() {
|
||||
StoreOrTriggerInitCallback(
|
||||
base::BindOnce(&CefMediaRouterImpl::NotifyCurrentRoutesInternal, this));
|
||||
}
|
||||
|
||||
void CefMediaRouterImpl::InitializeRegistrationInternal(
|
||||
CefRefPtr<CefRegistrationImpl> registration) {
|
||||
DCHECK(ValidContext());
|
||||
|
||||
registration->Initialize(browser_context_getter_);
|
||||
}
|
||||
|
||||
void CefMediaRouterImpl::NotifyCurrentSinksInternal() {
|
||||
DCHECK(ValidContext());
|
||||
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context)
|
||||
@@ -194,21 +232,17 @@ void CefMediaRouterImpl::NotifyCurrentSinks() {
|
||||
browser_context->GetMediaRouterManager()->NotifyCurrentSinks();
|
||||
}
|
||||
|
||||
void CefMediaRouterImpl::CreateRoute(
|
||||
void CefMediaRouterImpl::CreateRouteInternal(
|
||||
CefRefPtr<CefMediaSource> source,
|
||||
CefRefPtr<CefMediaSink> sink,
|
||||
CefRefPtr<CefMediaRouteCreateCallback> callback) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefMediaRouterImpl::CreateRoute,
|
||||
this, source, sink, callback));
|
||||
return;
|
||||
}
|
||||
DCHECK(ValidContext());
|
||||
|
||||
std::string error;
|
||||
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context) {
|
||||
error = "Context has already been destroyed";
|
||||
error = "Context is not valid";
|
||||
} else if (!source) {
|
||||
error = "Source is empty or invalid";
|
||||
} else if (!sink) {
|
||||
@@ -234,12 +268,8 @@ void CefMediaRouterImpl::CreateRoute(
|
||||
base::BindOnce(&CefMediaRouterImpl::CreateRouteCallback, this, callback));
|
||||
}
|
||||
|
||||
void CefMediaRouterImpl::NotifyCurrentRoutes() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(
|
||||
&CefMediaRouterImpl::NotifyCurrentRoutes, this));
|
||||
return;
|
||||
}
|
||||
void CefMediaRouterImpl::NotifyCurrentRoutesInternal() {
|
||||
DCHECK(ValidContext());
|
||||
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context)
|
||||
@@ -248,22 +278,10 @@ void CefMediaRouterImpl::NotifyCurrentRoutes() {
|
||||
browser_context->GetMediaRouterManager()->NotifyCurrentRoutes();
|
||||
}
|
||||
|
||||
void CefMediaRouterImpl::InitializeRegistrationOnUIThread(
|
||||
CefRefPtr<CefRegistrationImpl> registration) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefMediaRouterImpl::InitializeRegistrationOnUIThread,
|
||||
this, registration));
|
||||
return;
|
||||
}
|
||||
registration->Initialize(browser_context_getter_);
|
||||
}
|
||||
|
||||
void CefMediaRouterImpl::CreateRouteCallback(
|
||||
CefRefPtr<CefMediaRouteCreateCallback> callback,
|
||||
const media_router::RouteRequestResult& result) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(ValidContext());
|
||||
|
||||
if (result.result_code() != media_router::RouteRequestResult::OK) {
|
||||
LOG(WARNING) << "Media route creation failed: " << result.error() << " ("
|
||||
@@ -284,7 +302,30 @@ void CefMediaRouterImpl::CreateRouteCallback(
|
||||
result.error(), route);
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<CefMediaRouter> CefMediaRouter::GetGlobalMediaRouter() {
|
||||
return CefRequestContext::GetGlobalContext()->GetMediaRouter();
|
||||
void CefMediaRouterImpl::StoreOrTriggerInitCallback(
|
||||
base::OnceClosure callback) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT, base::BindOnce(&CefMediaRouterImpl::StoreOrTriggerInitCallback,
|
||||
this, std::move(callback)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (initialized_) {
|
||||
std::move(callback).Run();
|
||||
} else {
|
||||
init_callbacks_.emplace_back(std::move(callback));
|
||||
}
|
||||
}
|
||||
|
||||
bool CefMediaRouterImpl::ValidContext() const {
|
||||
return CEF_CURRENTLY_ON_UIT() && initialized_;
|
||||
}
|
||||
|
||||
// CefMediaRouter methods ------------------------------------------------------
|
||||
|
||||
// static
|
||||
CefRefPtr<CefMediaRouter> CefMediaRouter::GetGlobalMediaRouter(
|
||||
CefRefPtr<CefCompletionCallback> callback) {
|
||||
return CefRequestContext::GetGlobalContext()->GetMediaRouter(callback);
|
||||
}
|
||||
|
@@ -20,7 +20,8 @@ class CefMediaRouterImpl : public CefMediaRouter {
|
||||
|
||||
// Called on the UI thread after object creation and before any other object
|
||||
// methods are executed on the UI thread.
|
||||
void Initialize(const CefBrowserContext::Getter& browser_context_getter);
|
||||
void Initialize(const CefBrowserContext::Getter& browser_context_getter,
|
||||
CefRefPtr<CefCompletionCallback> callback);
|
||||
|
||||
// CefMediaRouter methods.
|
||||
CefRefPtr<CefRegistration> AddObserver(
|
||||
@@ -33,15 +34,29 @@ class CefMediaRouterImpl : public CefMediaRouter {
|
||||
void NotifyCurrentRoutes() override;
|
||||
|
||||
private:
|
||||
void InitializeRegistrationOnUIThread(
|
||||
void InitializeRegistrationInternal(
|
||||
CefRefPtr<CefRegistrationImpl> registration);
|
||||
void NotifyCurrentSinksInternal();
|
||||
void CreateRouteInternal(CefRefPtr<CefMediaSource> source,
|
||||
CefRefPtr<CefMediaSink> sink,
|
||||
CefRefPtr<CefMediaRouteCreateCallback> callback);
|
||||
void NotifyCurrentRoutesInternal();
|
||||
|
||||
void CreateRouteCallback(CefRefPtr<CefMediaRouteCreateCallback> callback,
|
||||
const media_router::RouteRequestResult& result);
|
||||
|
||||
// If the context is fully initialized execute |callback|, otherwise
|
||||
// store it until the context is fully initialized.
|
||||
void StoreOrTriggerInitCallback(base::OnceClosure callback);
|
||||
|
||||
bool ValidContext() const;
|
||||
|
||||
// Only accessed on the UI thread. Will be non-null after Initialize().
|
||||
CefBrowserContext::Getter browser_context_getter_;
|
||||
|
||||
bool initialized_ = false;
|
||||
std::vector<base::OnceClosure> init_callbacks_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefMediaRouterImpl);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefMediaRouterImpl);
|
||||
};
|
||||
|
@@ -263,7 +263,7 @@ void CefMenuManager::MenuClosed(CefRefPtr<CefMenuModelImpl> source) {
|
||||
|
||||
// Notify the host after closing the context menu.
|
||||
web_contents()->SetShowingContextMenu(false);
|
||||
web_contents()->NotifyContextMenuClosed(params_.custom_context);
|
||||
web_contents()->NotifyContextMenuClosed(params_.link_followed);
|
||||
}
|
||||
|
||||
bool CefMenuManager::FormatLabel(CefRefPtr<CefMenuModelImpl> source,
|
||||
@@ -287,11 +287,11 @@ void CefMenuManager::CreateDefaultModel() {
|
||||
if (!params_.custom_items.empty()) {
|
||||
// Custom menu items originating from the renderer process. For example,
|
||||
// plugin placeholder menu items.
|
||||
for (size_t i = 0; i < params_.custom_items.size(); ++i) {
|
||||
content::MenuItem menu_item = params_.custom_items[i];
|
||||
menu_item.action += MENU_ID_CUSTOM_FIRST;
|
||||
DCHECK_LE(static_cast<int>(menu_item.action), MENU_ID_CUSTOM_LAST);
|
||||
model_->AddMenuItem(menu_item);
|
||||
for (auto& item : params_.custom_items) {
|
||||
auto new_item = item->Clone();
|
||||
new_item->action += MENU_ID_CUSTOM_FIRST;
|
||||
DCHECK_LE(static_cast<int>(new_item->action), MENU_ID_CUSTOM_LAST);
|
||||
model_->AddMenuItem(*new_item);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -375,7 +375,7 @@ void CefMenuManager::ExecuteDefaultCommand(int command_id) {
|
||||
if (IsCustomContextMenuCommand(command_id)) {
|
||||
if (web_contents()) {
|
||||
web_contents()->ExecuteCustomContextMenuCommand(
|
||||
command_id - MENU_ID_CUSTOM_FIRST, params_.custom_context);
|
||||
command_id - MENU_ID_CUSTOM_FIRST, params_.link_followed);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -465,7 +465,7 @@ bool CefMenuManager::IsCustomContextMenuCommand(int command_id) {
|
||||
// Verify that the specific command ID was passed from the renderer process.
|
||||
if (!params_.custom_items.empty()) {
|
||||
for (size_t i = 0; i < params_.custom_items.size(); ++i) {
|
||||
if (static_cast<int>(params_.custom_items[i].action) == command_id)
|
||||
if (static_cast<int>(params_.custom_items[i]->action) == command_id)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/logging.h"
|
||||
#include "content/public/common/menu_item.h"
|
||||
#include "third_party/blink/public/mojom/context_menu/context_menu.mojom.h"
|
||||
#include "ui/base/accelerators/accelerator.h"
|
||||
#include "ui/base/models/image_model.h"
|
||||
#include "ui/gfx/geometry/point.h"
|
||||
@@ -927,37 +927,40 @@ bool CefMenuModelImpl::VerifyRefCount() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefMenuModelImpl::AddMenuItem(const content::MenuItem& menu_item) {
|
||||
void CefMenuModelImpl::AddMenuItem(
|
||||
const blink::mojom::CustomContextMenuItem& menu_item) {
|
||||
const int command_id = static_cast<int>(menu_item.action);
|
||||
|
||||
switch (menu_item.type) {
|
||||
case content::MenuItem::OPTION:
|
||||
case blink::mojom::CustomContextMenuItemType::kOption:
|
||||
AddItem(command_id, menu_item.label);
|
||||
break;
|
||||
case content::MenuItem::CHECKABLE_OPTION:
|
||||
case blink::mojom::CustomContextMenuItemType::kCheckableOption:
|
||||
AddCheckItem(command_id, menu_item.label);
|
||||
break;
|
||||
case content::MenuItem::GROUP:
|
||||
case blink::mojom::CustomContextMenuItemType::kGroup:
|
||||
AddRadioItem(command_id, menu_item.label, 0);
|
||||
break;
|
||||
case content::MenuItem::SEPARATOR:
|
||||
case blink::mojom::CustomContextMenuItemType::kSeparator:
|
||||
AddSeparator();
|
||||
break;
|
||||
case content::MenuItem::SUBMENU: {
|
||||
case blink::mojom::CustomContextMenuItemType::kSubMenu: {
|
||||
CefRefPtr<CefMenuModelImpl> sub_menu = static_cast<CefMenuModelImpl*>(
|
||||
AddSubMenu(command_id, menu_item.label).get());
|
||||
for (size_t i = 0; i < menu_item.submenu.size(); ++i)
|
||||
sub_menu->AddMenuItem(menu_item.submenu[i]);
|
||||
sub_menu->AddMenuItem(*menu_item.submenu[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!menu_item.enabled && menu_item.type != content::MenuItem::SEPARATOR)
|
||||
if (!menu_item.enabled &&
|
||||
menu_item.type != blink::mojom::CustomContextMenuItemType::kSeparator)
|
||||
SetEnabled(command_id, false);
|
||||
|
||||
if (menu_item.checked &&
|
||||
(menu_item.type == content::MenuItem::CHECKABLE_OPTION ||
|
||||
menu_item.type == content::MenuItem::GROUP)) {
|
||||
(menu_item.type ==
|
||||
blink::mojom::CustomContextMenuItemType::kCheckableOption ||
|
||||
menu_item.type == blink::mojom::CustomContextMenuItemType::kGroup)) {
|
||||
SetChecked(command_id, true);
|
||||
}
|
||||
}
|
||||
|
@@ -13,13 +13,10 @@
|
||||
#include "include/cef_menu_model_delegate.h"
|
||||
|
||||
#include "base/threading/platform_thread.h"
|
||||
#include "third_party/blink/public/mojom/context_menu/context_menu.mojom-forward.h"
|
||||
#include "ui/base/models/menu_model.h"
|
||||
#include "ui/gfx/font_list.h"
|
||||
|
||||
namespace content {
|
||||
struct MenuItem;
|
||||
}
|
||||
|
||||
class CefMenuModelImpl : public CefMenuModel {
|
||||
public:
|
||||
class Delegate {
|
||||
@@ -176,7 +173,7 @@ class CefMenuModelImpl : public CefMenuModel {
|
||||
bool VerifyRefCount();
|
||||
|
||||
// Helper for adding custom menu items originating from the renderer process.
|
||||
void AddMenuItem(const content::MenuItem& menu_item);
|
||||
void AddMenuItem(const blink::mojom::CustomContextMenuItem& menu_item);
|
||||
|
||||
ui::MenuModel* model() const { return model_.get(); }
|
||||
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#include "libcef/browser/browser_host_base.h"
|
||||
|
||||
#include "content/common/cursors/webcursor.h"
|
||||
#include "ui/base/cursor/cursor_factory.h"
|
||||
#include "ui/base/cursor/mojom/cursor_type.mojom.h"
|
||||
|
||||
namespace cursor_util {
|
||||
@@ -34,19 +35,24 @@ bool OnCursorChange(CefBrowserHostBase* browser, const ui::Cursor& ui_cursor) {
|
||||
bool handled = false;
|
||||
|
||||
#if defined(USE_AURA)
|
||||
content::WebCursor web_cursor(ui_cursor);
|
||||
|
||||
CefCursorHandle platform_cursor;
|
||||
ui::PlatformCursor image_cursor = nullptr;
|
||||
|
||||
if (ui_cursor.type() == ui::mojom::CursorType::kCustom) {
|
||||
// |web_cursor| owns the resulting |platform_cursor|.
|
||||
platform_cursor =
|
||||
cursor_util::ToCursorHandle(web_cursor.GetPlatformCursor(ui_cursor));
|
||||
image_cursor = ui::CursorFactory::GetInstance()->CreateImageCursor(
|
||||
ui::mojom::CursorType::kCustom, ui_cursor.custom_bitmap(),
|
||||
ui_cursor.custom_hotspot());
|
||||
platform_cursor = cursor_util::ToCursorHandle(image_cursor);
|
||||
} else {
|
||||
platform_cursor = cursor_util::GetPlatformCursor(ui_cursor.type());
|
||||
}
|
||||
|
||||
handled = handler->OnCursorChange(browser, platform_cursor, cursor_type,
|
||||
custom_cursor_info);
|
||||
|
||||
if (image_cursor) {
|
||||
ui::CursorFactory::GetInstance()->UnrefImageCursor(image_cursor);
|
||||
}
|
||||
#elif defined(OS_MAC)
|
||||
// |web_cursor| owns the resulting |native_cursor|.
|
||||
content::WebCursor web_cursor(ui_cursor);
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include "libcef/common/app_manager.h"
|
||||
|
||||
#include "ui/base/cursor/mojom/cursor_type.mojom.h"
|
||||
#include "ui/base/cursor/win/win_cursor.h"
|
||||
#include "ui/resources/grit/ui_unscaled_resources.h"
|
||||
|
||||
namespace cursor_util {
|
||||
@@ -152,7 +153,7 @@ cef_cursor_handle_t GetPlatformCursor(ui::mojom::CursorType type) {
|
||||
}
|
||||
|
||||
cef_cursor_handle_t ToCursorHandle(ui::PlatformCursor cursor) {
|
||||
return cursor;
|
||||
return static_cast<ui::WinCursor*>(cursor)->hcursor();
|
||||
}
|
||||
|
||||
} // namespace cursor_util
|
||||
|
@@ -304,7 +304,7 @@ class CefNativeMenuWin::MenuHostWindow {
|
||||
DCHECK(type != ui::MenuModel::TYPE_CHECK);
|
||||
std::unique_ptr<SkCanvas> canvas = skia::CreatePlatformCanvas(
|
||||
skia_icon.width(), skia_icon.height(), false);
|
||||
canvas->drawBitmap(*skia_icon.bitmap(), 0, 0);
|
||||
canvas->drawImage(skia_icon.bitmap()->asImage(), 0, 0);
|
||||
DrawToNativeContext(
|
||||
canvas.get(), dc, draw_item_struct->rcItem.left + kItemLeftMargin,
|
||||
draw_item_struct->rcItem.top +
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user