mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
69 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
fe551e4054 | ||
|
20e2617051 | ||
|
89c902b54d | ||
|
099901c122 | ||
|
28ba5c8f73 | ||
|
622afbdebc | ||
|
147b5f5532 | ||
|
4bd7c35c62 | ||
|
d4b095e68b | ||
|
23f5569e69 | ||
|
ad0b71aa5f | ||
|
7a2ffe562f | ||
|
4a28bcd532 | ||
|
7f52c30723 | ||
|
c56de64d6b | ||
|
b72460bbe3 | ||
|
f984bb3127 | ||
|
30e2decbac | ||
|
6872dadd74 | ||
|
4dd314dec3 | ||
|
07bc800f00 | ||
|
f3ed6619da | ||
|
62a9f00bd3 | ||
|
eabdf3a2ca | ||
|
1f85a7752b | ||
|
4767130954 | ||
|
582e0a0ab7 | ||
|
e63e6b110b | ||
|
a7bbd8a62b | ||
|
f158c34a21 | ||
|
659c037c84 | ||
|
4d1c5ebdd2 | ||
|
6516b569a9 | ||
|
cbc5710801 | ||
|
23be17f693 | ||
|
41b64e428c | ||
|
a74fa88812 | ||
|
dc1f934865 | ||
|
2b40cab3fe | ||
|
d4a2f72d10 | ||
|
0cbc0a757e | ||
|
6dad2c45ee | ||
|
28599ae1a5 | ||
|
0cee138670 | ||
|
1eba937874 | ||
|
5782fdca16 | ||
|
0a10fd4506 | ||
|
84117f2d1b | ||
|
db807e804a | ||
|
7a56371b84 | ||
|
b3f5d7dd59 | ||
|
4a44e16a09 | ||
|
6f6072b857 | ||
|
0fa40110e3 | ||
|
92f67ee847 | ||
|
cf4457bbb3 | ||
|
25c1947f1d | ||
|
955097ea77 | ||
|
cfdec92624 | ||
|
b4ab321a79 | ||
|
2ecf6f1070 | ||
|
f435c3af9e | ||
|
ee090039c7 | ||
|
17d2d13030 | ||
|
240b869db5 | ||
|
eaf581e544 | ||
|
ad71ec9fdf | ||
|
39dbdf8ddb | ||
|
a94e113410 |
50
BUILD.gn
50
BUILD.gn
@@ -535,6 +535,7 @@ static_library("libcef_static") {
|
||||
"libcef/browser/file_dialog_manager.h",
|
||||
"libcef/browser/frame_host_impl.cc",
|
||||
"libcef/browser/frame_host_impl.h",
|
||||
"libcef/browser/frame_service_base.h",
|
||||
"libcef/browser/image_impl.cc",
|
||||
"libcef/browser/image_impl.h",
|
||||
"libcef/browser/iothread_state.cc",
|
||||
@@ -705,6 +706,7 @@ static_library("libcef_static") {
|
||||
"libcef/common/file_util_impl.cc",
|
||||
"libcef/common/frame_util.cc",
|
||||
"libcef/common/frame_util.h",
|
||||
"libcef/common/i18n_util_impl.cc",
|
||||
"libcef/common/json_impl.cc",
|
||||
"libcef/common/main_runner_delegate.h",
|
||||
"libcef/common/main_runner_handler.h",
|
||||
@@ -802,9 +804,6 @@ static_library("libcef_static") {
|
||||
configs += [
|
||||
"libcef/features:config",
|
||||
"//build/config:precompiled_headers",
|
||||
|
||||
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
|
||||
"//build/config/compiler:no_size_t_to_int_warning",
|
||||
]
|
||||
|
||||
public_configs = [
|
||||
@@ -1058,6 +1057,8 @@ static_library("libcef_static") {
|
||||
"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/chrome_views_util.cc",
|
||||
"libcef/browser/chrome/views/chrome_views_util.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",
|
||||
@@ -1099,6 +1100,8 @@ static_library("libcef_static") {
|
||||
"libcef/browser/views/menu_button_view.h",
|
||||
"libcef/browser/views/menu_runner_views.cc",
|
||||
"libcef/browser/views/menu_runner_views.h",
|
||||
"libcef/browser/views/overlay_view_host.cc",
|
||||
"libcef/browser/views/overlay_view_host.h",
|
||||
"libcef/browser/views/panel_impl.h",
|
||||
"libcef/browser/views/panel_view.h",
|
||||
"libcef/browser/views/scroll_view_impl.cc",
|
||||
@@ -1183,6 +1186,21 @@ static_library("libcef_static") {
|
||||
# Part of //ui/events:test_support which is testingonly.
|
||||
"//ui/events/test/x11_event_waiter.cc",
|
||||
"//ui/events/test/x11_event_waiter.h",
|
||||
# Part of //ui/ozone::ui_test_support which is testingonly.
|
||||
"//ui/ozone/common/test/stub_ozone_ui_controls_test_helper.cc",
|
||||
"//ui/ozone/common/test/stub_ozone_ui_controls_test_helper.h",
|
||||
"//ui/ozone/public/ozone_ui_controls_test_helper.cc",
|
||||
"//ui/ozone/public/ozone_ui_controls_test_helper.h",
|
||||
"$root_gen_dir/ui/ozone/test_constructor_list.cc",
|
||||
# Part of //ui/views:test_support which is testingonly.
|
||||
"//ui/views/test/test_desktop_screen_ozone.cc",
|
||||
"//ui/views/test/test_desktop_screen_ozone.h",
|
||||
"//ui/views/test/ui_controls_factory_desktop_aura_ozone.cc",
|
||||
"//ui/views/test/ui_controls_factory_desktop_aura_ozone.h",
|
||||
]
|
||||
|
||||
deps += [
|
||||
"//ui/ozone:generate_test_support_constructor_list",
|
||||
]
|
||||
|
||||
if (use_x11) {
|
||||
@@ -1193,9 +1211,9 @@ static_library("libcef_static") {
|
||||
"//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",
|
||||
# Part of //ui/ozone/platform/x11:test_support which is testingonly.
|
||||
"//ui/ozone/platform/x11/x11_ozone_ui_controls_test_helper.cc",
|
||||
"//ui/ozone/platform/x11/x11_ozone_ui_controls_test_helper.h",
|
||||
]
|
||||
} else {
|
||||
sources += [
|
||||
@@ -1237,6 +1255,16 @@ static_library("libcef_static") {
|
||||
# libcef_dll_wrapper static targets.
|
||||
#
|
||||
|
||||
# Configuration that will be applied to all targets that build autogen files.
|
||||
config("libcef_autogen_config") {
|
||||
if (is_clang) {
|
||||
cflags = [
|
||||
# Disable clang warnings related to CEF's translation layer templates.
|
||||
"-Wno-undefined-var-template",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
# Configuration that will be applied to all targets that depend on
|
||||
# libcef_dll_wrapper.
|
||||
config("libcef_dll_wrapper_config") {
|
||||
@@ -1247,6 +1275,8 @@ config("libcef_dll_wrapper_config") {
|
||||
# They will be copied to the include/ directory in the binary distribution.
|
||||
"$root_out_dir/includes",
|
||||
]
|
||||
|
||||
configs = [ ":libcef_autogen_config" ]
|
||||
}
|
||||
|
||||
# libcef_dll_wrapper target.
|
||||
@@ -1586,6 +1616,10 @@ if (is_mac) {
|
||||
":libcef_static",
|
||||
]
|
||||
|
||||
configs += [
|
||||
":libcef_autogen_config",
|
||||
]
|
||||
|
||||
# We don't link the framework so just use the path from the main executable.
|
||||
ldflags = [
|
||||
"-Wl,-install_name,@executable_path/../Frameworks/$output_name.framework/$output_name",
|
||||
@@ -1621,6 +1655,10 @@ if (is_mac) {
|
||||
":libcef_static",
|
||||
]
|
||||
|
||||
configs += [
|
||||
":libcef_autogen_config",
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
sources += includes_win + [
|
||||
"libcef_dll/libcef_dll.rc",
|
||||
|
@@ -7,6 +7,6 @@
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'refs/tags/93.0.4577.82',
|
||||
'depot_tools_checkout': '45d2afa080'
|
||||
'chromium_checkout': 'refs/tags/96.0.4664.110',
|
||||
'depot_tools_checkout': 'e023d44820'
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@
|
||||
# distribution include:
|
||||
#
|
||||
# Linux: Ninja, GCC 7.5.0+, Unix Makefiles
|
||||
# MacOS: Ninja, Xcode 12.2 to 12.5
|
||||
# MacOS: Ninja, Xcode 12.2 to 13.0
|
||||
# Windows: Ninja, Visual Studio 2019+
|
||||
#
|
||||
# Ninja is a cross-platform open-source tool for running fast builds using
|
||||
@@ -36,7 +36,7 @@
|
||||
#
|
||||
# The below requirements must be met to build this CEF binary distribution.
|
||||
#
|
||||
# - CMake version 2.8.12.1 or newer.
|
||||
# - CMake version 3.19 or newer.
|
||||
#
|
||||
# - Linux requirements:
|
||||
# Currently supported distributions include Debian 10 (Buster), Ubuntu 18
|
||||
@@ -48,7 +48,7 @@
|
||||
# libgtk3.0-dev (required by the cefclient target only)
|
||||
#
|
||||
# - MacOS requirements:
|
||||
# Xcode 12.2 to 12.5 building on MacOS 10.15.4 (Catalina) or newer. Only
|
||||
# Xcode 12.2 to 13.0 building on MacOS 10.15.4 (Catalina) or newer. Only
|
||||
# 64-bit builds are supported. The Xcode command-line tools must also be
|
||||
# installed. Newer Xcode versions may not have been been tested and are not
|
||||
# recommended.
|
||||
@@ -132,7 +132,8 @@
|
||||
# Global setup.
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.12.1)
|
||||
# For VS2019 and Xcode 12+ support.
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
# Only generate Debug and Release configuration types.
|
||||
set(CMAKE_CONFIGURATION_TYPES Debug Release)
|
||||
|
@@ -8,7 +8,7 @@
|
||||
# by hand. See the translator.README.txt file in the tools directory for
|
||||
# more information.
|
||||
#
|
||||
# $hash=f6950d026a9c92fbb58da3fe0cbcf0050c12ecf0$
|
||||
# $hash=42b9ae0a0ee20489699d69dcdbcbf8ad3265f821$
|
||||
#
|
||||
|
||||
{
|
||||
@@ -41,6 +41,7 @@
|
||||
'include/cef_focus_handler.h',
|
||||
'include/cef_frame.h',
|
||||
'include/cef_frame_handler.h',
|
||||
'include/cef_i18n_util.h',
|
||||
'include/cef_image.h',
|
||||
'include/cef_jsdialog_handler.h',
|
||||
'include/cef_keyboard_handler.h',
|
||||
@@ -61,7 +62,6 @@
|
||||
'include/cef_render_handler.h',
|
||||
'include/cef_render_process_handler.h',
|
||||
'include/cef_request.h',
|
||||
'include/cef_request_callback.h',
|
||||
'include/cef_request_context.h',
|
||||
'include/cef_request_context_handler.h',
|
||||
'include/cef_request_handler.h',
|
||||
@@ -101,6 +101,7 @@
|
||||
'include/views/cef_layout.h',
|
||||
'include/views/cef_menu_button.h',
|
||||
'include/views/cef_menu_button_delegate.h',
|
||||
'include/views/cef_overlay_controller.h',
|
||||
'include/views/cef_panel.h',
|
||||
'include/views/cef_panel_delegate.h',
|
||||
'include/views/cef_scroll_view.h',
|
||||
@@ -139,6 +140,7 @@
|
||||
'include/capi/cef_focus_handler_capi.h',
|
||||
'include/capi/cef_frame_capi.h',
|
||||
'include/capi/cef_frame_handler_capi.h',
|
||||
'include/capi/cef_i18n_util_capi.h',
|
||||
'include/capi/cef_image_capi.h',
|
||||
'include/capi/cef_jsdialog_handler_capi.h',
|
||||
'include/capi/cef_keyboard_handler_capi.h',
|
||||
@@ -159,7 +161,6 @@
|
||||
'include/capi/cef_render_handler_capi.h',
|
||||
'include/capi/cef_render_process_handler_capi.h',
|
||||
'include/capi/cef_request_capi.h',
|
||||
'include/capi/cef_request_callback_capi.h',
|
||||
'include/capi/cef_request_context_capi.h',
|
||||
'include/capi/cef_request_context_handler_capi.h',
|
||||
'include/capi/cef_request_handler_capi.h',
|
||||
@@ -199,6 +200,7 @@
|
||||
'include/capi/views/cef_layout_capi.h',
|
||||
'include/capi/views/cef_menu_button_capi.h',
|
||||
'include/capi/views/cef_menu_button_delegate_capi.h',
|
||||
'include/capi/views/cef_overlay_controller_capi.h',
|
||||
'include/capi/views/cef_panel_capi.h',
|
||||
'include/capi/views/cef_panel_delegate_capi.h',
|
||||
'include/capi/views/cef_scroll_view_capi.h',
|
||||
@@ -352,6 +354,8 @@
|
||||
'libcef_dll/cpptoc/navigation_entry_cpptoc.h',
|
||||
'libcef_dll/ctocpp/navigation_entry_visitor_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/navigation_entry_visitor_ctocpp.h',
|
||||
'libcef_dll/cpptoc/views/overlay_controller_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/views/overlay_controller_cpptoc.h',
|
||||
'libcef_dll/cpptoc/views/panel_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/views/panel_cpptoc.h',
|
||||
'libcef_dll/ctocpp/views/panel_delegate_ctocpp.cc',
|
||||
@@ -382,8 +386,6 @@
|
||||
'libcef_dll/ctocpp/render_process_handler_ctocpp.h',
|
||||
'libcef_dll/cpptoc/request_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/request_cpptoc.h',
|
||||
'libcef_dll/cpptoc/request_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/request_callback_cpptoc.h',
|
||||
'libcef_dll/cpptoc/request_context_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/request_context_cpptoc.h',
|
||||
'libcef_dll/ctocpp/request_context_handler_ctocpp.cc',
|
||||
@@ -662,6 +664,8 @@
|
||||
'libcef_dll/ctocpp/navigation_entry_ctocpp.h',
|
||||
'libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.h',
|
||||
'libcef_dll/ctocpp/views/overlay_controller_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/views/overlay_controller_ctocpp.h',
|
||||
'libcef_dll/ctocpp/views/panel_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/views/panel_ctocpp.h',
|
||||
'libcef_dll/cpptoc/views/panel_delegate_cpptoc.cc',
|
||||
@@ -692,8 +696,6 @@
|
||||
'libcef_dll/cpptoc/render_process_handler_cpptoc.h',
|
||||
'libcef_dll/ctocpp/request_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/request_ctocpp.h',
|
||||
'libcef_dll/ctocpp/request_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/request_callback_ctocpp.h',
|
||||
'libcef_dll/ctocpp/request_context_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/request_context_ctocpp.h',
|
||||
'libcef_dll/cpptoc/request_context_handler_cpptoc.cc',
|
||||
|
@@ -56,6 +56,7 @@
|
||||
'include/internal/cef_time.h',
|
||||
'include/internal/cef_trace_event_internal.h',
|
||||
'include/internal/cef_types.h',
|
||||
'include/internal/cef_types_geometry.h',
|
||||
],
|
||||
'includes_capi': [
|
||||
'include/capi/cef_base_capi.h',
|
||||
@@ -265,6 +266,8 @@
|
||||
'tests/cefclient/browser/urlrequest_test.h',
|
||||
'tests/cefclient/browser/views_menu_bar.cc',
|
||||
'tests/cefclient/browser/views_menu_bar.h',
|
||||
'tests/cefclient/browser/views_overlay_controls.cc',
|
||||
'tests/cefclient/browser/views_overlay_controls.h',
|
||||
'tests/cefclient/browser/views_style.cc',
|
||||
'tests/cefclient/browser/views_style.h',
|
||||
'tests/cefclient/browser/views_window.cc',
|
||||
|
@@ -222,8 +222,11 @@ if(OS_LINUX)
|
||||
libcef.so
|
||||
libEGL.so
|
||||
libGLESv2.so
|
||||
libvk_swiftshader.so
|
||||
libvulkan.so.1
|
||||
snapshot_blob.bin
|
||||
v8_context_snapshot.bin
|
||||
vk_swiftshader_icd.json
|
||||
swiftshader
|
||||
)
|
||||
|
||||
@@ -470,6 +473,9 @@ if(OS_WINDOWS)
|
||||
libGLESv2.dll
|
||||
snapshot_blob.bin
|
||||
v8_context_snapshot.bin
|
||||
vk_swiftshader.dll
|
||||
vk_swiftshader_icd.json
|
||||
vulkan-1.dll
|
||||
swiftshader
|
||||
)
|
||||
|
||||
|
@@ -54,9 +54,6 @@
|
||||
// auto cb = base::BindOnce(&C::F, instance);
|
||||
// std::move(cb).Run(); // Identical to instance->F()
|
||||
//
|
||||
// base::Bind is currently a type alias for base::BindRepeating(). In the
|
||||
// future, we expect to flip this to default to base::BindOnce().
|
||||
//
|
||||
// See //docs/callback.md for the full documentation.
|
||||
//
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -126,17 +123,6 @@ BindRepeating(Functor&& functor, Args&&... args) {
|
||||
std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
// Unannotated Bind.
|
||||
// TODO(tzik): Deprecate this and migrate to OnceCallback and
|
||||
// RepeatingCallback, once they get ready.
|
||||
template <typename Functor, typename... Args>
|
||||
inline Callback<internal::MakeUnboundRunType<Functor, Args...>> Bind(
|
||||
Functor&& functor,
|
||||
Args&&... args) {
|
||||
return base::BindRepeating(std::forward<Functor>(functor),
|
||||
std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
// Special cases for binding to a base::Callback without extra bound arguments.
|
||||
// We CHECK() the validity of callback to guard against null pointers
|
||||
// accidentally ending up in posted tasks, causing hard-to-debug crashes.
|
||||
@@ -159,12 +145,6 @@ RepeatingCallback<Signature> BindRepeating(
|
||||
return callback;
|
||||
}
|
||||
|
||||
template <typename Signature>
|
||||
Callback<Signature> Bind(Callback<Signature> callback) {
|
||||
CHECK(callback);
|
||||
return callback;
|
||||
}
|
||||
|
||||
// Unretained() allows binding a non-refcounted class, and to disable
|
||||
// refcounting on arguments that are refcounted objects.
|
||||
//
|
||||
|
@@ -60,9 +60,6 @@
|
||||
// will be a no-op. Note that |IsCancelled()| and |is_null()| are distinct:
|
||||
// simply cancelling a callback will not also make it null.
|
||||
//
|
||||
// base::Callback is currently a type alias for base::RepeatingCallback. In the
|
||||
// future, we expect to flip this to default to base::OnceCallback.
|
||||
//
|
||||
// See https://chromium.googlesource.com/chromium/src/+/HEAD/docs/callback.md
|
||||
// for the full documentation.
|
||||
|
||||
@@ -115,7 +112,7 @@ class OnceCallback<R(Args...)> : public internal::CallbackBase {
|
||||
return *this;
|
||||
}
|
||||
|
||||
R Run(Args... args) const & {
|
||||
R Run(Args... args) const& {
|
||||
static_assert(!sizeof(*this),
|
||||
"OnceCallback::Run() may only be invoked on a non-const "
|
||||
"rvalue, i.e. std::move(callback).Run().");
|
||||
@@ -195,7 +192,7 @@ class RepeatingCallback<R(Args...)> : public internal::CallbackBaseCopyable {
|
||||
return !operator==(other);
|
||||
}
|
||||
|
||||
R Run(Args... args) const & {
|
||||
R Run(Args... args) const& {
|
||||
PolymorphicInvoke f =
|
||||
reinterpret_cast<PolymorphicInvoke>(this->polymorphic_invoke());
|
||||
return f(this->bind_state_.get(), std::forward<Args>(args)...);
|
||||
|
@@ -48,15 +48,11 @@ class OnceCallback;
|
||||
template <typename Signature>
|
||||
class RepeatingCallback;
|
||||
|
||||
template <typename Signature>
|
||||
using Callback = RepeatingCallback<Signature>;
|
||||
|
||||
// Syntactic sugar to make OnceClosure<void()> and RepeatingClosure<void()>
|
||||
// easier to declare since they will be used in a lot of APIs with delayed
|
||||
// execution.
|
||||
using OnceClosure = OnceCallback<void()>;
|
||||
using RepeatingClosure = RepeatingCallback<void()>;
|
||||
using Closure = Callback<void()>;
|
||||
|
||||
} // namespace base
|
||||
|
||||
|
@@ -83,10 +83,10 @@
|
||||
|
||||
#include "include/base/cef_bind.h"
|
||||
#include "include/base/cef_callback.h"
|
||||
#include "include/base/internal/cef_callback_internal.h"
|
||||
#include "include/base/cef_logging.h"
|
||||
#include "include/base/cef_compiler_specific.h"
|
||||
#include "include/base/cef_logging.h"
|
||||
#include "include/base/cef_weak_ptr.h"
|
||||
#include "include/base/internal/cef_callback_internal.h"
|
||||
|
||||
namespace base {
|
||||
namespace internal {
|
||||
@@ -113,9 +113,7 @@ class CancelableCallbackImpl {
|
||||
}
|
||||
|
||||
// Returns true if the wrapped callback has been cancelled.
|
||||
bool IsCancelled() const {
|
||||
return callback_.is_null();
|
||||
}
|
||||
bool IsCancelled() const { return callback_.is_null(); }
|
||||
|
||||
// Sets |callback| as the closure that may be cancelled. |callback| may not
|
||||
// be null. Outstanding and any previously wrapped callbacks are cancelled.
|
||||
@@ -180,10 +178,6 @@ using CancelableRepeatingCallback =
|
||||
internal::CancelableCallbackImpl<RepeatingCallback<Signature>>;
|
||||
using CancelableRepeatingClosure = CancelableRepeatingCallback<void()>;
|
||||
|
||||
template <typename Signature>
|
||||
using CancelableCallback = CancelableRepeatingCallback<Signature>;
|
||||
using CancelableClosure = CancelableCallback<void()>;
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
@@ -203,19 +203,19 @@ const LogSeverity LOG_DFATAL = LOG_FATAL;
|
||||
// by LOG() and LOG_IF, etc. Since these are used all over our code, it's
|
||||
// better to have compact code for these operations.
|
||||
#define COMPACT_GOOGLE_LOG_EX_INFO(ClassName, ...) \
|
||||
cef::logging::ClassName(__FILE__, __LINE__, cef::logging::LOG_INFO, \
|
||||
::cef::logging::ClassName(__FILE__, __LINE__, ::cef::logging::LOG_INFO, \
|
||||
##__VA_ARGS__)
|
||||
#define COMPACT_GOOGLE_LOG_EX_WARNING(ClassName, ...) \
|
||||
cef::logging::ClassName(__FILE__, __LINE__, cef::logging::LOG_WARNING, \
|
||||
::cef::logging::ClassName(__FILE__, __LINE__, ::cef::logging::LOG_WARNING, \
|
||||
##__VA_ARGS__)
|
||||
#define COMPACT_GOOGLE_LOG_EX_ERROR(ClassName, ...) \
|
||||
cef::logging::ClassName(__FILE__, __LINE__, cef::logging::LOG_ERROR, \
|
||||
::cef::logging::ClassName(__FILE__, __LINE__, ::cef::logging::LOG_ERROR, \
|
||||
##__VA_ARGS__)
|
||||
#define COMPACT_GOOGLE_LOG_EX_FATAL(ClassName, ...) \
|
||||
cef::logging::ClassName(__FILE__, __LINE__, cef::logging::LOG_FATAL, \
|
||||
::cef::logging::ClassName(__FILE__, __LINE__, ::cef::logging::LOG_FATAL, \
|
||||
##__VA_ARGS__)
|
||||
#define COMPACT_GOOGLE_LOG_EX_DFATAL(ClassName, ...) \
|
||||
cef::logging::ClassName(__FILE__, __LINE__, cef::logging::LOG_DFATAL, \
|
||||
::cef::logging::ClassName(__FILE__, __LINE__, ::cef::logging::LOG_DFATAL, \
|
||||
##__VA_ARGS__)
|
||||
|
||||
#define COMPACT_GOOGLE_LOG_INFO COMPACT_GOOGLE_LOG_EX_INFO(LogMessage)
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=6e192c6e8a59c37e98e458578a287dd36b8ed90f$
|
||||
// $hash=b83b96e2b90124bba8084e2df7f66cc6749df872$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_
|
||||
@@ -681,12 +681,6 @@ typedef struct _cef_browser_host_t {
|
||||
void(CEF_CALLBACK* send_touch_event)(struct _cef_browser_host_t* self,
|
||||
const struct _cef_touch_event_t* event);
|
||||
|
||||
///
|
||||
// Send a focus event to the browser.
|
||||
///
|
||||
void(CEF_CALLBACK* send_focus_event)(struct _cef_browser_host_t* self,
|
||||
int setFocus);
|
||||
|
||||
///
|
||||
// Send a capture lost event to the browser.
|
||||
///
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=5af5bf1e877dd53f21f751d332a9e2166817324c$
|
||||
// $hash=3ecebd6b30bb8fb837e062eacd021c1a1ff3620a$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_COMMAND_LINE_CAPI_H_
|
||||
@@ -53,8 +53,9 @@ extern "C" {
|
||||
// optionally have a value specified using the '=' delimiter (e.g.
|
||||
// "-switch=value"). An argument of "--" will terminate switch parsing with all
|
||||
// subsequent tokens, regardless of prefix, being interpreted as non-switch
|
||||
// arguments. Switch names are considered case-insensitive. This structure can
|
||||
// be used before cef_initialize() is called.
|
||||
// arguments. Switch names should be lowercase ASCII and will be converted to
|
||||
// such if necessary. Switch values will retain the original case and UTF8
|
||||
// encoding. This structure can be used before cef_initialize() is called.
|
||||
///
|
||||
typedef struct _cef_command_line_t {
|
||||
///
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=503984bf98aa52ff67ce52f26a560bbb1d4439bc$
|
||||
// $hash=f6be5f7509ee3ccfe16f226470897223cc131014$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_FRAME_HANDLER_CAPI_H_
|
||||
@@ -147,11 +147,14 @@ typedef struct _cef_frame_handler_t {
|
||||
|
||||
///
|
||||
// Called when a frame can begin routing commands to/from the associated
|
||||
// renderer process. Any commands that were queued have now been dispatched.
|
||||
// renderer process. |reattached| will be true (1) if the frame was re-
|
||||
// attached after exiting the BackForwardCache. Any commands that were queued
|
||||
// have now been dispatched.
|
||||
///
|
||||
void(CEF_CALLBACK* on_frame_attached)(struct _cef_frame_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame);
|
||||
struct _cef_frame_t* frame,
|
||||
int reattached);
|
||||
|
||||
///
|
||||
// Called when a frame loses its connection to the renderer process and will
|
||||
|
@@ -33,11 +33,11 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=273af5bd01c6ab5d4df8efb2af2b4e2da9c21760$
|
||||
// $hash=bf890f7b8e8edd423d71ad5a4d5bd43d81f1eb01$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CALLBACK_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_REQUEST_CALLBACK_CAPI_H_
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_I18N_UTIL_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_I18N_UTIL_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
@@ -47,28 +47,12 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
// Callback structure used for asynchronous continuation of url requests.
|
||||
// Returns true (1) if the application text direction is right-to-left.
|
||||
///
|
||||
typedef struct _cef_request_callback_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Continue the url request. If |allow| is true (1) the request will be
|
||||
// continued. Otherwise, the request will be canceled.
|
||||
///
|
||||
void(CEF_CALLBACK* cont)(struct _cef_request_callback_t* self, int allow);
|
||||
|
||||
///
|
||||
// Cancel the url request.
|
||||
///
|
||||
void(CEF_CALLBACK* cancel)(struct _cef_request_callback_t* self);
|
||||
} cef_request_callback_t;
|
||||
CEF_EXPORT int cef_is_rtl();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_REQUEST_CALLBACK_CAPI_H_
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_I18N_UTIL_CAPI_H_
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=1d8b3f540a8305ce1738c5fe7c716434062c67b0$
|
||||
// $hash=83ff671e8a4db001029be8a02a414333fe4354af$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_
|
||||
@@ -43,8 +43,8 @@
|
||||
#include "include/capi/cef_auth_callback_capi.h"
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_browser_capi.h"
|
||||
#include "include/capi/cef_callback_capi.h"
|
||||
#include "include/capi/cef_frame_capi.h"
|
||||
#include "include/capi/cef_request_callback_capi.h"
|
||||
#include "include/capi/cef_request_capi.h"
|
||||
#include "include/capi/cef_resource_request_handler_capi.h"
|
||||
#include "include/capi/cef_ssl_info_capi.h"
|
||||
@@ -180,31 +180,30 @@ typedef struct _cef_request_handler_t {
|
||||
// size via the webkitStorageInfo.requestQuota function. |origin_url| is the
|
||||
// origin of the page making the request. |new_size| is the requested quota
|
||||
// size in bytes. Return true (1) to continue the request and call
|
||||
// cef_request_callback_t::cont() either in this function or at a later time
|
||||
// to grant or deny the request. Return false (0) to cancel the request
|
||||
// cef_callback_t functions either in this function or at a later time to
|
||||
// grant or deny the request. Return false (0) to cancel the request
|
||||
// immediately.
|
||||
///
|
||||
int(CEF_CALLBACK* on_quota_request)(struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_string_t* origin_url,
|
||||
int64 new_size,
|
||||
struct _cef_request_callback_t* callback);
|
||||
struct _cef_callback_t* callback);
|
||||
|
||||
///
|
||||
// Called on the UI thread to handle requests for URLs with an invalid SSL
|
||||
// certificate. Return true (1) and call cef_request_callback_t::cont() either
|
||||
// in this function or at a later time to continue or cancel the request.
|
||||
// Return false (0) to cancel the request immediately. If
|
||||
// certificate. Return true (1) and call cef_callback_t functions either in
|
||||
// this function or at a later time to continue or cancel the request. Return
|
||||
// false (0) to cancel the request immediately. If
|
||||
// CefSettings.ignore_certificate_errors is set all invalid certificates will
|
||||
// be accepted without calling this function.
|
||||
///
|
||||
int(CEF_CALLBACK* on_certificate_error)(
|
||||
struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_errorcode_t cert_error,
|
||||
const cef_string_t* request_url,
|
||||
struct _cef_sslinfo_t* ssl_info,
|
||||
struct _cef_request_callback_t* callback);
|
||||
int(CEF_CALLBACK* on_certificate_error)(struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_errorcode_t cert_error,
|
||||
const cef_string_t* request_url,
|
||||
struct _cef_sslinfo_t* ssl_info,
|
||||
struct _cef_callback_t* callback);
|
||||
|
||||
///
|
||||
// Called on the UI thread when a client certificate is being requested for
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=aec52d0efc8407495fe1fc4821616673da7ed17a$
|
||||
// $hash=7276396521b8b61cf856050244f558baa3a52e04$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_RESOURCE_REQUEST_HANDLER_CAPI_H_
|
||||
@@ -42,8 +42,8 @@
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_browser_capi.h"
|
||||
#include "include/capi/cef_callback_capi.h"
|
||||
#include "include/capi/cef_frame_capi.h"
|
||||
#include "include/capi/cef_request_callback_capi.h"
|
||||
#include "include/capi/cef_request_capi.h"
|
||||
#include "include/capi/cef_resource_handler_capi.h"
|
||||
#include "include/capi/cef_response_capi.h"
|
||||
@@ -87,8 +87,8 @@ typedef struct _cef_resource_request_handler_t {
|
||||
// or change the resource load optionally modify |request|. Modification of
|
||||
// the request URL will be treated as a redirect. Return RV_CONTINUE to
|
||||
// continue the request immediately. Return RV_CONTINUE_ASYNC and call
|
||||
// cef_request_callback_t:: cont() at a later time to continue or cancel the
|
||||
// request asynchronously. Return RV_CANCEL to cancel the request immediately.
|
||||
// cef_callback_t functions at a later time to continue or cancel the request
|
||||
// asynchronously. Return RV_CANCEL to cancel the request immediately.
|
||||
//
|
||||
///
|
||||
cef_return_value_t(CEF_CALLBACK* on_before_resource_load)(
|
||||
@@ -96,7 +96,7 @@ typedef struct _cef_resource_request_handler_t {
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request,
|
||||
struct _cef_request_callback_t* callback);
|
||||
struct _cef_callback_t* callback);
|
||||
|
||||
///
|
||||
// Called on the IO thread before a resource is loaded. The |browser| and
|
||||
|
216
include/capi/views/cef_overlay_controller_capi.h
Normal file
216
include/capi/views/cef_overlay_controller_capi.h
Normal file
@@ -0,0 +1,216 @@
|
||||
// Copyright (c) 2021 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool and should not edited
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=60a15cb1c2e77544c20a3aafef1db736f07a5fb8$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_OVERLAY_CONTROLLER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_VIEWS_CEF_OVERLAY_CONTROLLER_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _cef_view_t;
|
||||
struct _cef_window_t;
|
||||
|
||||
///
|
||||
// Controller for an overlay that contains a contents View added via
|
||||
// cef_window_t::AddOverlayView. Methods exposed by this controller should be
|
||||
// called in preference to functions of the same name exposed by the contents
|
||||
// View unless otherwise indicated. Methods must be called on the browser
|
||||
// process UI thread unless otherwise indicated.
|
||||
///
|
||||
typedef struct _cef_overlay_controller_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Returns true (1) if this object is valid.
|
||||
///
|
||||
int(CEF_CALLBACK* is_valid)(struct _cef_overlay_controller_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if this object is the same as |that| object.
|
||||
///
|
||||
int(CEF_CALLBACK* is_same)(struct _cef_overlay_controller_t* self,
|
||||
struct _cef_overlay_controller_t* that);
|
||||
|
||||
///
|
||||
// Returns the contents View for this overlay.
|
||||
///
|
||||
struct _cef_view_t*(CEF_CALLBACK* get_contents_view)(
|
||||
struct _cef_overlay_controller_t* self);
|
||||
|
||||
///
|
||||
// Returns the top-level Window hosting this overlay. Use this function
|
||||
// instead of calling get_window() on the contents View.
|
||||
///
|
||||
struct _cef_window_t*(CEF_CALLBACK* get_window)(
|
||||
struct _cef_overlay_controller_t* self);
|
||||
|
||||
///
|
||||
// Returns the docking mode for this overlay.
|
||||
///
|
||||
cef_docking_mode_t(CEF_CALLBACK* get_docking_mode)(
|
||||
struct _cef_overlay_controller_t* self);
|
||||
|
||||
///
|
||||
// Destroy this overlay.
|
||||
///
|
||||
void(CEF_CALLBACK* destroy)(struct _cef_overlay_controller_t* self);
|
||||
|
||||
///
|
||||
// Sets the bounds (size and position) of this overlay. This will set the
|
||||
// bounds of the contents View to match and trigger a re-layout if necessary.
|
||||
// |bounds| is in parent coordinates and any insets configured on this overlay
|
||||
// will be ignored. Use this function only for overlays created with a docking
|
||||
// mode value of CEF_DOCKING_MODE_CUSTOM. With other docking modes modify the
|
||||
// insets of this overlay and/or layout of the contents View and call
|
||||
// size_to_preferred_size() instead to calculate the new size and re-position
|
||||
// the overlay if necessary.
|
||||
///
|
||||
void(CEF_CALLBACK* set_bounds)(struct _cef_overlay_controller_t* self,
|
||||
const cef_rect_t* bounds);
|
||||
|
||||
///
|
||||
// Returns the bounds (size and position) of this overlay in parent
|
||||
// coordinates.
|
||||
///
|
||||
cef_rect_t(CEF_CALLBACK* get_bounds)(struct _cef_overlay_controller_t* self);
|
||||
|
||||
///
|
||||
// Returns the bounds (size and position) of this overlay in DIP screen
|
||||
// coordinates.
|
||||
///
|
||||
cef_rect_t(CEF_CALLBACK* get_bounds_in_screen)(
|
||||
struct _cef_overlay_controller_t* self);
|
||||
|
||||
///
|
||||
// Sets the size of this overlay without changing the position. This will set
|
||||
// the size of the contents View to match and trigger a re-layout if
|
||||
// necessary. |size| is in parent coordinates and any insets configured on
|
||||
// this overlay will be ignored. Use this function only for overlays created
|
||||
// with a docking mode value of CEF_DOCKING_MODE_CUSTOM. With other docking
|
||||
// modes modify the insets of this overlay and/or layout of the contents View
|
||||
// and call size_to_preferred_size() instead to calculate the new size and re-
|
||||
// position the overlay if necessary.
|
||||
///
|
||||
void(CEF_CALLBACK* set_size)(struct _cef_overlay_controller_t* self,
|
||||
const cef_size_t* size);
|
||||
|
||||
///
|
||||
// Returns the size of this overlay in parent coordinates.
|
||||
///
|
||||
cef_size_t(CEF_CALLBACK* get_size)(struct _cef_overlay_controller_t* self);
|
||||
|
||||
///
|
||||
// Sets the position of this overlay without changing the size. |position| is
|
||||
// in parent coordinates and any insets configured on this overlay will be
|
||||
// ignored. Use this function only for overlays created with a docking mode
|
||||
// value of CEF_DOCKING_MODE_CUSTOM. With other docking modes modify the
|
||||
// insets of this overlay and/or layout of the contents View and call
|
||||
// size_to_preferred_size() instead to calculate the new size and re-position
|
||||
// the overlay if necessary.
|
||||
///
|
||||
void(CEF_CALLBACK* set_position)(struct _cef_overlay_controller_t* self,
|
||||
const cef_point_t* position);
|
||||
|
||||
///
|
||||
// Returns the position of this overlay in parent coordinates.
|
||||
///
|
||||
cef_point_t(CEF_CALLBACK* get_position)(
|
||||
struct _cef_overlay_controller_t* self);
|
||||
|
||||
///
|
||||
// Sets the insets for this overlay. |insets| is in parent coordinates. Use
|
||||
// this function only for overlays created with a docking mode value other
|
||||
// than CEF_DOCKING_MODE_CUSTOM.
|
||||
///
|
||||
void(CEF_CALLBACK* set_insets)(struct _cef_overlay_controller_t* self,
|
||||
const cef_insets_t* insets);
|
||||
|
||||
///
|
||||
// Returns the insets for this overlay in parent coordinates.
|
||||
///
|
||||
cef_insets_t(CEF_CALLBACK* get_insets)(
|
||||
struct _cef_overlay_controller_t* self);
|
||||
|
||||
///
|
||||
// Size this overlay to its preferred size and trigger a re-layout if
|
||||
// necessary. The position of overlays created with a docking mode value of
|
||||
// CEF_DOCKING_MODE_CUSTOM will not be modified by calling this function. With
|
||||
// other docking modes this function may re-position the overlay if necessary
|
||||
// to accommodate the new size and any insets configured on the contents View.
|
||||
///
|
||||
void(CEF_CALLBACK* size_to_preferred_size)(
|
||||
struct _cef_overlay_controller_t* self);
|
||||
|
||||
///
|
||||
// Sets whether this overlay is visible. Overlays are hidden by default. If
|
||||
// this overlay is hidden then it and any child Views will not be drawn and,
|
||||
// if any of those Views currently have focus, then focus will also be
|
||||
// cleared. Painting is scheduled as needed.
|
||||
///
|
||||
void(CEF_CALLBACK* set_visible)(struct _cef_overlay_controller_t* self,
|
||||
int visible);
|
||||
|
||||
///
|
||||
// Returns whether this overlay is visible. A View may be visible but still
|
||||
// not drawn in a Window if any parent Views are hidden. Call is_drawn() to
|
||||
// determine whether this overlay and all parent Views are visible and will be
|
||||
// drawn.
|
||||
///
|
||||
int(CEF_CALLBACK* is_visible)(struct _cef_overlay_controller_t* self);
|
||||
|
||||
///
|
||||
// Returns whether this overlay is visible and drawn in a Window. A View is
|
||||
// drawn if it and all parent Views are visible. To determine if the
|
||||
// containing Window is visible to the user on-screen call is_visible() on the
|
||||
// Window.
|
||||
///
|
||||
int(CEF_CALLBACK* is_drawn)(struct _cef_overlay_controller_t* self);
|
||||
} cef_overlay_controller_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_VIEWS_CEF_OVERLAY_CONTROLLER_CAPI_H_
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=9881a00ef237b6972f14c071544387fc90fe18f1$
|
||||
// $hash=84b29a8dcdadffae5466ac16e7aafd80471a0abd$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_VIEW_CAPI_H_
|
||||
@@ -220,6 +220,19 @@ typedef struct _cef_view_t {
|
||||
///
|
||||
cef_point_t(CEF_CALLBACK* get_position)(struct _cef_view_t* self);
|
||||
|
||||
///
|
||||
// Sets the insets for this View. |insets| is in parent coordinates, or DIP
|
||||
// screen coordinates if there is no parent.
|
||||
///
|
||||
void(CEF_CALLBACK* set_insets)(struct _cef_view_t* self,
|
||||
const cef_insets_t* insets);
|
||||
|
||||
///
|
||||
// Returns the insets for this View in parent coordinates, or DIP screen
|
||||
// coordinates if there is no parent.
|
||||
///
|
||||
cef_insets_t(CEF_CALLBACK* get_insets)(struct _cef_view_t* self);
|
||||
|
||||
///
|
||||
// Returns the size this View would like to be if enough space is available.
|
||||
// Size is in parent coordinates, or DIP screen coordinates if there is no
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=a060cb3c53317d758e7f6b4a275288cd08f086e7$
|
||||
// $hash=c8707f30655dc83c5f329d1dc22b14e9e06f4e76$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_VIEW_DELEGATE_CAPI_H_
|
||||
@@ -121,6 +121,13 @@ typedef struct _cef_view_delegate_t {
|
||||
struct _cef_view_t* view,
|
||||
int added);
|
||||
|
||||
///
|
||||
// Called when the layout of |view| has changed.
|
||||
///
|
||||
void(CEF_CALLBACK* on_layout_changed)(struct _cef_view_delegate_t* self,
|
||||
struct _cef_view_t* view,
|
||||
const cef_rect_t* new_bounds);
|
||||
|
||||
///
|
||||
// Called when |view| gains focus.
|
||||
///
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=15f88e3521ca96947fe8b1f91f251eb3405fb293$
|
||||
// $hash=0f5dad3572a20ee7395cb861b5c970cff382b61c$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_CAPI_H_
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "include/capi/cef_image_capi.h"
|
||||
#include "include/capi/cef_menu_model_capi.h"
|
||||
#include "include/capi/views/cef_display_capi.h"
|
||||
#include "include/capi/views/cef_overlay_controller_capi.h"
|
||||
#include "include/capi/views/cef_panel_capi.h"
|
||||
#include "include/capi/views/cef_window_delegate_capi.h"
|
||||
|
||||
@@ -197,6 +198,40 @@ typedef struct _cef_window_t {
|
||||
struct _cef_image_t*(CEF_CALLBACK* get_window_app_icon)(
|
||||
struct _cef_window_t* self);
|
||||
|
||||
///
|
||||
// Add a View that will be overlayed on the Window contents with absolute
|
||||
// positioning and high z-order. Positioning is controlled by |docking_mode|
|
||||
// as described below. The returned cef_overlay_controller_t object is used to
|
||||
// control the overlay. Overlays are hidden by default.
|
||||
//
|
||||
// With CEF_DOCKING_MODE_CUSTOM:
|
||||
// 1. The overlay is initially hidden, sized to |view|'s preferred size, and
|
||||
// positioned in the top-left corner.
|
||||
// 2. Optionally change the overlay position and/or size by calling
|
||||
// CefOverlayController methods.
|
||||
// 3. Call CefOverlayController::SetVisible(true) to show the overlay.
|
||||
// 4. The overlay will be automatically re-sized if |view|'s layout changes.
|
||||
// Optionally change the overlay position and/or size when
|
||||
// OnLayoutChanged is called on the Window's delegate to indicate a
|
||||
// change in Window bounds.
|
||||
//
|
||||
// With other docking modes:
|
||||
// 1. The overlay is initially hidden, sized to |view|'s preferred size, and
|
||||
// positioned based on |docking_mode|.
|
||||
// 2. Call CefOverlayController::SetVisible(true) to show the overlay.
|
||||
// 3. The overlay will be automatically re-sized if |view|'s layout changes
|
||||
// and re-positioned as appropriate when the Window resizes.
|
||||
//
|
||||
// Overlays created by this function will receive a higher z-order then any
|
||||
// child Views added previously. It is therefore recommended to call this
|
||||
// function last after all other child Views have been added so that the
|
||||
// overlay displays as the top-most child of the Window.
|
||||
///
|
||||
struct _cef_overlay_controller_t*(CEF_CALLBACK* add_overlay_view)(
|
||||
struct _cef_window_t* self,
|
||||
struct _cef_view_t* view,
|
||||
cef_docking_mode_t docking_mode);
|
||||
|
||||
///
|
||||
// Show a menu with contents |menu_model|. |screen_point| specifies the menu
|
||||
// position in screen coordinates. |anchor_position| specifies how the menu
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=b43e6106fde84f3bab4dd566efab23a50adaf94d$
|
||||
// $hash=839098c445b1d3203bc482fc5d1555e1f9b87646$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_DELEGATE_CAPI_H_
|
||||
@@ -99,6 +99,13 @@ typedef struct _cef_window_delegate_t {
|
||||
struct _cef_window_delegate_t* self,
|
||||
struct _cef_window_t* window);
|
||||
|
||||
///
|
||||
// Return the initial show state for |window|.
|
||||
///
|
||||
cef_show_state_t(CEF_CALLBACK* get_initial_show_state)(
|
||||
struct _cef_window_delegate_t* self,
|
||||
struct _cef_window_t* window);
|
||||
|
||||
///
|
||||
// Return true (1) if |window| should be created without a frame or title bar.
|
||||
// The window will be resizable if can_resize() returns true (1). Use
|
||||
|
@@ -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 "5625e3ce80d2bbf5b5a39f8655d96c215f7685ee"
|
||||
#define CEF_API_HASH_UNIVERSAL "21ac25aebdb49a8e8088c6fbee802b04fd07b501"
|
||||
#if defined(OS_WIN)
|
||||
#define CEF_API_HASH_PLATFORM "c20e4ffc24e6267b61774f49237d0f30a581f370"
|
||||
#define CEF_API_HASH_PLATFORM "1d81ccb5ba2f6d658abde2faeb490c8f7f6a60fe"
|
||||
#elif defined(OS_MAC)
|
||||
#define CEF_API_HASH_PLATFORM "65731bc654ec6e1dbd48d6ff2336c4c8573f7d35"
|
||||
#define CEF_API_HASH_PLATFORM "d6bd1ab64a160962ee0306625da5dd2a0cae8b31"
|
||||
#elif defined(OS_LINUX)
|
||||
#define CEF_API_HASH_PLATFORM "4e35b9cc9735c63ac9f16fbbb49a4b8e2307f23a"
|
||||
#define CEF_API_HASH_PLATFORM "0b5227787444955a548b7544b2cdcda95a354506"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -708,12 +708,6 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
|
||||
/*--cef()--*/
|
||||
virtual void SendTouchEvent(const CefTouchEvent& event) = 0;
|
||||
|
||||
///
|
||||
// Send a focus event to the browser.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SendFocusEvent(bool setFocus) = 0;
|
||||
|
||||
///
|
||||
// Send a capture lost event to the browser.
|
||||
///
|
||||
|
@@ -49,8 +49,9 @@
|
||||
// optionally have a value specified using the '=' delimiter (e.g.
|
||||
// "-switch=value"). An argument of "--" will terminate switch parsing with all
|
||||
// subsequent tokens, regardless of prefix, being interpreted as non-switch
|
||||
// arguments. Switch names are considered case-insensitive. This class can be
|
||||
// used before CefInitialize() is called.
|
||||
// arguments. Switch names should be lowercase ASCII and will be converted to
|
||||
// such if necessary. Switch values will retain the original case and UTF8
|
||||
// encoding. This class can be used before CefInitialize() is called.
|
||||
///
|
||||
/*--cef(source=library,no_debugct_check)--*/
|
||||
class CefCommandLine : public virtual CefBaseRefCounted {
|
||||
|
@@ -132,11 +132,14 @@ class CefFrameHandler : public virtual CefBaseRefCounted {
|
||||
|
||||
///
|
||||
// Called when a frame can begin routing commands to/from the associated
|
||||
// renderer process. Any commands that were queued have now been dispatched.
|
||||
// renderer process. |reattached| will be true if the frame was re-attached
|
||||
// after exiting the BackForwardCache. Any commands that were queued have now
|
||||
// been dispatched.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnFrameAttached(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame) {}
|
||||
CefRefPtr<CefFrame> frame,
|
||||
bool reattached) {}
|
||||
|
||||
///
|
||||
// Called when a frame loses its connection to the renderer process and will
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2021 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
@@ -34,30 +34,16 @@
|
||||
// tools directory for more information.
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CEF_REQUEST_CALLBACK_H_
|
||||
#define CEF_INCLUDE_CEF_REQUEST_CALLBACK_H_
|
||||
#ifndef CEF_INCLUDE_CEF_I18N_UTIL_H_
|
||||
#define CEF_INCLUDE_CEF_I18N_UTIL_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
|
||||
///
|
||||
// Callback interface used for asynchronous continuation of url requests.
|
||||
// Returns true if the application text direction is right-to-left.
|
||||
///
|
||||
/*--cef(source=library)--*/
|
||||
class CefRequestCallback : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Continue the url request. If |allow| is true the request will be continued.
|
||||
// Otherwise, the request will be canceled.
|
||||
///
|
||||
/*--cef(capi_name=cont)--*/
|
||||
virtual void Continue(bool allow) = 0;
|
||||
/*--cef()--*/
|
||||
bool CefIsRTL();
|
||||
|
||||
///
|
||||
// Cancel the url request.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void Cancel() = 0;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_REQUEST_CALLBACK_H_
|
||||
#endif // CEF_INCLUDE_CEF_I18N_UTIL_H_
|
@@ -43,9 +43,9 @@
|
||||
#include "include/cef_auth_callback.h"
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_callback.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/cef_request.h"
|
||||
#include "include/cef_request_callback.h"
|
||||
#include "include/cef_resource_request_handler.h"
|
||||
#include "include/cef_ssl_info.h"
|
||||
#include "include/cef_x509_certificate.h"
|
||||
@@ -176,32 +176,32 @@ class CefRequestHandler : public virtual CefBaseRefCounted {
|
||||
// Called on the IO thread when JavaScript requests a specific storage quota
|
||||
// size via the webkitStorageInfo.requestQuota function. |origin_url| is the
|
||||
// origin of the page making the request. |new_size| is the requested quota
|
||||
// size in bytes. Return true to continue the request and call
|
||||
// CefRequestCallback::Continue() either in this method or at a later time to
|
||||
// grant or deny the request. Return false to cancel the request immediately.
|
||||
// size in bytes. Return true to continue the request and call CefCallback
|
||||
// methods either in this method or at a later time to grant or deny the
|
||||
// request. Return false to cancel the request immediately.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool OnQuotaRequest(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& origin_url,
|
||||
int64 new_size,
|
||||
CefRefPtr<CefRequestCallback> callback) {
|
||||
CefRefPtr<CefCallback> callback) {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the UI thread to handle requests for URLs with an invalid
|
||||
// SSL certificate. Return true and call CefRequestCallback::Continue() either
|
||||
// in this method or at a later time to continue or cancel the request. Return
|
||||
// false to cancel the request immediately. If
|
||||
// CefSettings.ignore_certificate_errors is set all invalid certificates will
|
||||
// be accepted without calling this method.
|
||||
// SSL certificate. Return true and call CefCallback methods either in this
|
||||
// method or at a later time to continue or cancel the request. Return false
|
||||
// to cancel the request immediately. If CefSettings.ignore_certificate_errors
|
||||
// is set all invalid certificates will be accepted without calling this
|
||||
// method.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool OnCertificateError(CefRefPtr<CefBrowser> browser,
|
||||
cef_errorcode_t cert_error,
|
||||
const CefString& request_url,
|
||||
CefRefPtr<CefSSLInfo> ssl_info,
|
||||
CefRefPtr<CefRequestCallback> callback) {
|
||||
CefRefPtr<CefCallback> callback) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -40,9 +40,9 @@
|
||||
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_callback.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/cef_request.h"
|
||||
#include "include/cef_request_callback.h"
|
||||
#include "include/cef_resource_handler.h"
|
||||
#include "include/cef_response.h"
|
||||
#include "include/cef_response_filter.h"
|
||||
@@ -81,18 +81,17 @@ class CefResourceRequestHandler : public virtual CefBaseRefCounted {
|
||||
// requests originating from service workers or CefURLRequest. To redirect or
|
||||
// change the resource load optionally modify |request|. Modification of the
|
||||
// request URL will be treated as a redirect. Return RV_CONTINUE to continue
|
||||
// the request immediately. Return RV_CONTINUE_ASYNC and call
|
||||
// CefRequestCallback:: Continue() at a later time to continue or cancel the
|
||||
// request asynchronously. Return RV_CANCEL to cancel the request immediately.
|
||||
// the request immediately. Return RV_CONTINUE_ASYNC and call CefCallback
|
||||
// methods at a later time to continue or cancel the request asynchronously.
|
||||
// Return RV_CANCEL to cancel the request immediately.
|
||||
//
|
||||
///
|
||||
/*--cef(optional_param=browser,optional_param=frame,
|
||||
default_retval=RV_CONTINUE)--*/
|
||||
virtual ReturnValue OnBeforeResourceLoad(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefRequestCallback> callback) {
|
||||
virtual ReturnValue OnBeforeResourceLoad(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefCallback> callback) {
|
||||
return RV_CONTINUE;
|
||||
}
|
||||
|
||||
|
@@ -81,10 +81,7 @@ struct CefWindowInfoTraits {
|
||||
bool copy) {
|
||||
cef_string_set(src->window_name.str, src->window_name.length,
|
||||
&target->window_name, copy);
|
||||
target->x = src->x;
|
||||
target->y = src->y;
|
||||
target->width = src->width;
|
||||
target->height = src->height;
|
||||
target->bounds = src->bounds;
|
||||
target->parent_window = src->parent_window;
|
||||
target->windowless_rendering_enabled = src->windowless_rendering_enabled;
|
||||
target->shared_texture_enabled = src->shared_texture_enabled;
|
||||
@@ -105,12 +102,9 @@ class CefWindowInfo : public CefStructBase<CefWindowInfoTraits> {
|
||||
///
|
||||
// Create the browser as a child window.
|
||||
///
|
||||
void SetAsChild(CefWindowHandle parent, const CefRect& windowRect) {
|
||||
void SetAsChild(CefWindowHandle parent, const CefRect& bounds) {
|
||||
parent_window = parent;
|
||||
x = windowRect.x;
|
||||
y = windowRect.y;
|
||||
width = windowRect.width;
|
||||
height = windowRect.height;
|
||||
this->bounds = bounds;
|
||||
}
|
||||
|
||||
///
|
||||
|
@@ -81,10 +81,7 @@ struct CefWindowInfoTraits {
|
||||
bool copy) {
|
||||
cef_string_set(src->window_name.str, src->window_name.length,
|
||||
&target->window_name, copy);
|
||||
target->x = src->x;
|
||||
target->y = src->y;
|
||||
target->width = src->width;
|
||||
target->height = src->height;
|
||||
target->bounds = src->bounds;
|
||||
target->hidden = src->hidden;
|
||||
target->parent_view = src->parent_view;
|
||||
target->windowless_rendering_enabled = src->windowless_rendering_enabled;
|
||||
@@ -106,12 +103,9 @@ class CefWindowInfo : public CefStructBase<CefWindowInfoTraits> {
|
||||
///
|
||||
// Create the browser as a child view.
|
||||
///
|
||||
void SetAsChild(CefWindowHandle parent, int x, int y, int width, int height) {
|
||||
void SetAsChild(CefWindowHandle parent, const CefRect& bounds) {
|
||||
parent_view = parent;
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->width = width;
|
||||
this->height = height;
|
||||
this->bounds = bounds;
|
||||
hidden = false;
|
||||
}
|
||||
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#include "include/internal/cef_string.h"
|
||||
#include "include/internal/cef_string_list.h"
|
||||
#include "include/internal/cef_time.h"
|
||||
#include "include/internal/cef_types_geometry.h"
|
||||
|
||||
// Bring in platform-specific definitions.
|
||||
#if defined(OS_WIN)
|
||||
@@ -389,17 +390,6 @@ typedef struct _cef_settings_t {
|
||||
///
|
||||
int uncaught_exception_stack_size;
|
||||
|
||||
///
|
||||
// Set to true (1) to ignore errors related to invalid SSL certificates.
|
||||
// Enabling this setting can lead to potential security vulnerabilities like
|
||||
// "man in the middle" attacks. Applications that load content from the
|
||||
// internet should not enable this setting. Also configurable using the
|
||||
// "ignore-certificate-errors" command-line switch. Can be overridden for
|
||||
// individual CefRequestContext instances via the
|
||||
// CefRequestContextSettings.ignore_certificate_errors value.
|
||||
///
|
||||
int ignore_certificate_errors;
|
||||
|
||||
///
|
||||
// Background color used for the browser before a document is loaded and when
|
||||
// no document color is specified. The alpha component must be either fully
|
||||
@@ -485,16 +475,6 @@ typedef struct _cef_request_context_settings_t {
|
||||
///
|
||||
int persist_user_preferences;
|
||||
|
||||
///
|
||||
// Set to true (1) to ignore errors related to invalid SSL certificates.
|
||||
// Enabling this setting can lead to potential security vulnerabilities like
|
||||
// "man in the middle" attacks. Applications that load content from the
|
||||
// internet should not enable this setting. Can be set globally using the
|
||||
// CefSettings.ignore_certificate_errors value. This value will be ignored if
|
||||
// |cache_path| matches the CefSettings.cache_path value.
|
||||
///
|
||||
int ignore_certificate_errors;
|
||||
|
||||
///
|
||||
// Comma delimited ordered list of language codes without any whitespace that
|
||||
// will be used in the "Accept-Language" HTTP header. Can be set globally
|
||||
@@ -602,18 +582,6 @@ typedef struct _cef_browser_settings_t {
|
||||
///
|
||||
cef_state_t plugins;
|
||||
|
||||
///
|
||||
// Controls whether file URLs will have access to all URLs. Also configurable
|
||||
// using the "allow-universal-access-from-files" command-line switch.
|
||||
///
|
||||
cef_state_t universal_access_from_file_urls;
|
||||
|
||||
///
|
||||
// Controls whether file URLs will have access to other file URLs. Also
|
||||
// configurable using the "allow-access-from-files" command-line switch.
|
||||
///
|
||||
cef_state_t file_access_from_file_urls;
|
||||
|
||||
///
|
||||
// Controls whether image URLs will be loaded from the network. A cached image
|
||||
// will still be rendered if requested. Also configurable using the
|
||||
@@ -652,12 +620,6 @@ typedef struct _cef_browser_settings_t {
|
||||
///
|
||||
cef_state_t databases;
|
||||
|
||||
///
|
||||
// Controls whether the application cache can be used. Also configurable using
|
||||
// the "disable-application-cache" command-line switch.
|
||||
///
|
||||
cef_state_t application_cache;
|
||||
|
||||
///
|
||||
// Controls whether WebGL can be used. Note that WebGL requires hardware
|
||||
// support and may not work on all systems even when enabled. Also
|
||||
@@ -1159,6 +1121,16 @@ typedef enum {
|
||||
// A resource that a plugin requested.
|
||||
///
|
||||
RT_PLUGIN_RESOURCE,
|
||||
|
||||
///
|
||||
// A main-frame service worker navigation preload request.
|
||||
///
|
||||
RT_NAVIGATION_PRELOAD_MAIN_FRAME = 19,
|
||||
|
||||
///
|
||||
// A sub-frame service worker navigation preload request.
|
||||
///
|
||||
RT_NAVIGATION_PRELOAD_SUB_FRAME,
|
||||
} cef_resource_type_t;
|
||||
|
||||
///
|
||||
@@ -1362,51 +1334,6 @@ typedef enum {
|
||||
UR_FAILED,
|
||||
} cef_urlrequest_status_t;
|
||||
|
||||
///
|
||||
// Structure representing a point.
|
||||
///
|
||||
typedef struct _cef_point_t {
|
||||
int x;
|
||||
int y;
|
||||
} cef_point_t;
|
||||
|
||||
///
|
||||
// Structure representing a rectangle.
|
||||
///
|
||||
typedef struct _cef_rect_t {
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
} cef_rect_t;
|
||||
|
||||
///
|
||||
// Structure representing a size.
|
||||
///
|
||||
typedef struct _cef_size_t {
|
||||
int width;
|
||||
int height;
|
||||
} cef_size_t;
|
||||
|
||||
///
|
||||
// Structure representing a range.
|
||||
///
|
||||
typedef struct _cef_range_t {
|
||||
int from;
|
||||
int to;
|
||||
} cef_range_t;
|
||||
|
||||
///
|
||||
// Structure representing insets.
|
||||
///
|
||||
typedef struct _cef_insets_t {
|
||||
int top;
|
||||
int left;
|
||||
int bottom;
|
||||
int right;
|
||||
} cef_insets_t;
|
||||
|
||||
///
|
||||
// Structure representing a draggable region.
|
||||
///
|
||||
typedef struct _cef_draggable_region_t {
|
||||
@@ -2948,6 +2875,14 @@ typedef enum {
|
||||
CEF_SCHEME_OPTION_FETCH_ENABLED = 1 << 6,
|
||||
} cef_scheme_options_t;
|
||||
|
||||
///
|
||||
// Structure representing a range.
|
||||
///
|
||||
typedef struct _cef_range_t {
|
||||
int from;
|
||||
int to;
|
||||
} cef_range_t;
|
||||
|
||||
///
|
||||
// Composition underline style.
|
||||
///
|
||||
@@ -3198,6 +3133,27 @@ typedef enum {
|
||||
CEF_CTT_LOCATION,
|
||||
} cef_chrome_toolbar_type_t;
|
||||
|
||||
///
|
||||
// Docking modes supported by CefWindow::AddOverlay.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_DOCKING_MODE_TOP_LEFT = 1,
|
||||
CEF_DOCKING_MODE_TOP_RIGHT,
|
||||
CEF_DOCKING_MODE_BOTTOM_LEFT,
|
||||
CEF_DOCKING_MODE_BOTTOM_RIGHT,
|
||||
CEF_DOCKING_MODE_CUSTOM,
|
||||
} cef_docking_mode_t;
|
||||
|
||||
///
|
||||
// Show states supported by CefWindowDelegate::GetInitialShowState.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_SHOW_STATE_NORMAL = 1,
|
||||
CEF_SHOW_STATE_MINIMIZED,
|
||||
CEF_SHOW_STATE_MAXIMIZED,
|
||||
CEF_SHOW_STATE_FULLSCREEN,
|
||||
} cef_show_state_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
78
include/internal/cef_types_geometry.h
Normal file
78
include/internal/cef_types_geometry.h
Normal file
@@ -0,0 +1,78 @@
|
||||
// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef CEF_INCLUDE_INTERNAL_CEF_TYPES_GEOMETRY_H_
|
||||
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_GEOMETRY_H_
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
// Structure representing a point.
|
||||
///
|
||||
typedef struct _cef_point_t {
|
||||
int x;
|
||||
int y;
|
||||
} cef_point_t;
|
||||
|
||||
///
|
||||
// Structure representing a rectangle.
|
||||
///
|
||||
typedef struct _cef_rect_t {
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
} cef_rect_t;
|
||||
|
||||
///
|
||||
// Structure representing a size.
|
||||
///
|
||||
typedef struct _cef_size_t {
|
||||
int width;
|
||||
int height;
|
||||
} cef_size_t;
|
||||
|
||||
///
|
||||
// Structure representing insets.
|
||||
///
|
||||
typedef struct _cef_insets_t {
|
||||
int top;
|
||||
int left;
|
||||
int bottom;
|
||||
int right;
|
||||
} cef_insets_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_GEOMETRY_H_
|
@@ -43,6 +43,7 @@ typedef struct _XDisplay XDisplay;
|
||||
|
||||
#include "include/internal/cef_export.h"
|
||||
#include "include/internal/cef_string.h"
|
||||
#include "include/internal/cef_types_geometry.h"
|
||||
|
||||
// Handle types.
|
||||
#if defined(CEF_X11)
|
||||
@@ -93,10 +94,10 @@ typedef struct _cef_window_info_t {
|
||||
///
|
||||
cef_string_t window_name;
|
||||
|
||||
unsigned int x;
|
||||
unsigned int y;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
///
|
||||
// Initial window bounds.
|
||||
///
|
||||
cef_rect_t bounds;
|
||||
|
||||
///
|
||||
// Pointer for the parent window.
|
||||
|
@@ -35,6 +35,7 @@
|
||||
|
||||
#if defined(OS_MAC)
|
||||
#include "include/internal/cef_string.h"
|
||||
#include "include/internal/cef_types_geometry.h"
|
||||
|
||||
// Handle types.
|
||||
// Actually NSCursor*
|
||||
@@ -85,10 +86,11 @@ typedef struct _cef_main_args_t {
|
||||
///
|
||||
typedef struct _cef_window_info_t {
|
||||
cef_string_t window_name;
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
|
||||
///
|
||||
// Initial window bounds.
|
||||
///
|
||||
cef_rect_t bounds;
|
||||
|
||||
///
|
||||
// Set to true (1) to create the view initially hidden.
|
||||
|
@@ -35,7 +35,9 @@
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <windows.h>
|
||||
|
||||
#include "include/internal/cef_string.h"
|
||||
#include "include/internal/cef_types_geometry.h"
|
||||
|
||||
// Handle types.
|
||||
#define cef_cursor_handle_t HCURSOR
|
||||
@@ -53,7 +55,9 @@ extern "C" {
|
||||
///
|
||||
// Structure representing CefExecuteProcess arguments.
|
||||
///
|
||||
typedef struct _cef_main_args_t { HINSTANCE instance; } cef_main_args_t;
|
||||
typedef struct _cef_main_args_t {
|
||||
HINSTANCE instance;
|
||||
} cef_main_args_t;
|
||||
|
||||
///
|
||||
// Structure representing window information.
|
||||
@@ -63,10 +67,7 @@ typedef struct _cef_window_info_t {
|
||||
DWORD ex_style;
|
||||
cef_string_t window_name;
|
||||
DWORD style;
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
cef_rect_t bounds;
|
||||
cef_window_handle_t parent_window;
|
||||
HMENU menu;
|
||||
|
||||
|
@@ -594,7 +594,6 @@ struct CefSettingsTraits {
|
||||
target->pack_loading_disabled = src->pack_loading_disabled;
|
||||
target->remote_debugging_port = src->remote_debugging_port;
|
||||
target->uncaught_exception_stack_size = src->uncaught_exception_stack_size;
|
||||
target->ignore_certificate_errors = src->ignore_certificate_errors;
|
||||
target->background_color = src->background_color;
|
||||
|
||||
cef_string_set(src->accept_language_list.str,
|
||||
@@ -636,7 +635,6 @@ struct CefRequestContextSettingsTraits {
|
||||
&target->cache_path, copy);
|
||||
target->persist_session_cookies = src->persist_session_cookies;
|
||||
target->persist_user_preferences = src->persist_user_preferences;
|
||||
target->ignore_certificate_errors = src->ignore_certificate_errors;
|
||||
cef_string_set(src->accept_language_list.str,
|
||||
src->accept_language_list.length,
|
||||
&target->accept_language_list, copy);
|
||||
@@ -707,9 +705,6 @@ struct CefBrowserSettingsTraits {
|
||||
target->javascript_access_clipboard = src->javascript_access_clipboard;
|
||||
target->javascript_dom_paste = src->javascript_dom_paste;
|
||||
target->plugins = src->plugins;
|
||||
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->image_loading = src->image_loading;
|
||||
target->image_shrink_standalone_to_fit =
|
||||
src->image_shrink_standalone_to_fit;
|
||||
@@ -717,7 +712,6 @@ struct CefBrowserSettingsTraits {
|
||||
target->tab_to_links = src->tab_to_links;
|
||||
target->local_storage = src->local_storage;
|
||||
target->databases = src->databases;
|
||||
target->application_cache = src->application_cache;
|
||||
target->webgl = src->webgl;
|
||||
|
||||
target->background_color = src->background_color;
|
||||
|
@@ -81,10 +81,7 @@ struct CefWindowInfoTraits {
|
||||
cef_string_set(src->window_name.str, src->window_name.length,
|
||||
&target->window_name, copy);
|
||||
target->style = src->style;
|
||||
target->x = src->x;
|
||||
target->y = src->y;
|
||||
target->width = src->width;
|
||||
target->height = src->height;
|
||||
target->bounds = src->bounds;
|
||||
target->parent_window = src->parent_window;
|
||||
target->menu = src->menu;
|
||||
target->windowless_rendering_enabled = src->windowless_rendering_enabled;
|
||||
@@ -108,14 +105,11 @@ class CefWindowInfo : public CefStructBase<CefWindowInfoTraits> {
|
||||
///
|
||||
// Create the browser as a child window.
|
||||
///
|
||||
void SetAsChild(CefWindowHandle parent, RECT windowRect) {
|
||||
void SetAsChild(CefWindowHandle parent, const CefRect& windowBounds) {
|
||||
style =
|
||||
WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_TABSTOP | WS_VISIBLE;
|
||||
parent_window = parent;
|
||||
x = windowRect.left;
|
||||
y = windowRect.top;
|
||||
width = windowRect.right - windowRect.left;
|
||||
height = windowRect.bottom - windowRect.top;
|
||||
bounds = windowBounds;
|
||||
}
|
||||
|
||||
///
|
||||
@@ -125,10 +119,10 @@ class CefWindowInfo : public CefStructBase<CefWindowInfoTraits> {
|
||||
style =
|
||||
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE;
|
||||
parent_window = parent;
|
||||
x = CW_USEDEFAULT;
|
||||
y = CW_USEDEFAULT;
|
||||
width = CW_USEDEFAULT;
|
||||
height = CW_USEDEFAULT;
|
||||
bounds.x = CW_USEDEFAULT;
|
||||
bounds.y = CW_USEDEFAULT;
|
||||
bounds.width = CW_USEDEFAULT;
|
||||
bounds.height = CW_USEDEFAULT;
|
||||
|
||||
cef_string_copy(windowName.c_str(), windowName.length(), &window_name);
|
||||
}
|
||||
|
209
include/views/cef_overlay_controller.h
Normal file
209
include/views/cef_overlay_controller.h
Normal file
@@ -0,0 +1,209 @@
|
||||
// Copyright (c) 2021 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// The contents of this file must follow a specific format in order to
|
||||
// support the CEF translator tool. See the translator.README.txt file in the
|
||||
// tools directory for more information.
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_VIEWS_CEF_OVERLAY_CONTROLLER_H_
|
||||
#define CEF_INCLUDE_VIEWS_CEF_OVERLAY_CONTROLLER_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
|
||||
class CefView;
|
||||
class CefWindow;
|
||||
|
||||
///
|
||||
// Controller for an overlay that contains a contents View added via
|
||||
// CefWindow::AddOverlayView. Methods exposed by this controller should be
|
||||
// called in preference to methods of the same name exposed by the contents View
|
||||
// unless otherwise indicated. Methods must be called on the browser process UI
|
||||
// thread unless otherwise indicated.
|
||||
///
|
||||
/*--cef(source=library)--*/
|
||||
class CefOverlayController : public CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Returns true if this object is valid.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsValid() = 0;
|
||||
|
||||
///
|
||||
// Returns true if this object is the same as |that| object.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsSame(CefRefPtr<CefOverlayController> that) = 0;
|
||||
|
||||
///
|
||||
// Returns the contents View for this overlay.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefView> GetContentsView() = 0;
|
||||
|
||||
///
|
||||
// Returns the top-level Window hosting this overlay. Use this method instead
|
||||
// of calling GetWindow() on the contents View.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefWindow> GetWindow() = 0;
|
||||
|
||||
///
|
||||
// Returns the docking mode for this overlay.
|
||||
///
|
||||
/*--cef(default_retval=CEF_DOCKING_MODE_TOP_LEFT)--*/
|
||||
virtual cef_docking_mode_t GetDockingMode() = 0;
|
||||
|
||||
///
|
||||
// Destroy this overlay.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void Destroy() = 0;
|
||||
|
||||
///
|
||||
// Sets the bounds (size and position) of this overlay. This will set the
|
||||
// bounds of the contents View to match and trigger a re-layout if necessary.
|
||||
// |bounds| is in parent coordinates and any insets configured on this overlay
|
||||
// will be ignored. Use this method only for overlays created with a docking
|
||||
// mode value of CEF_DOCKING_MODE_CUSTOM. With other docking modes modify the
|
||||
// insets of this overlay and/or layout of the contents View and call
|
||||
// SizeToPreferredSize() instead to calculate the new size and re-position the
|
||||
// overlay if necessary.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SetBounds(const CefRect& bounds) = 0;
|
||||
|
||||
///
|
||||
// Returns the bounds (size and position) of this overlay in parent
|
||||
// coordinates.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRect GetBounds() = 0;
|
||||
|
||||
///
|
||||
// Returns the bounds (size and position) of this overlay in DIP screen
|
||||
// coordinates.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRect GetBoundsInScreen() = 0;
|
||||
|
||||
///
|
||||
// Sets the size of this overlay without changing the position. This will set
|
||||
// the size of the contents View to match and trigger a re-layout if
|
||||
// necessary. |size| is in parent coordinates and any insets configured on
|
||||
// this overlay will be ignored. Use this method only for overlays created
|
||||
// with a docking mode value of CEF_DOCKING_MODE_CUSTOM. With other docking
|
||||
// modes modify the insets of this overlay and/or layout of the contents View
|
||||
// and call SizeToPreferredSize() instead to calculate the new size and
|
||||
// re-position the overlay if necessary.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SetSize(const CefSize& size) = 0;
|
||||
|
||||
///
|
||||
// Returns the size of this overlay in parent coordinates.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefSize GetSize() = 0;
|
||||
|
||||
///
|
||||
// Sets the position of this overlay without changing the size. |position| is
|
||||
// in parent coordinates and any insets configured on this overlay will
|
||||
// be ignored. Use this method only for overlays created with a docking mode
|
||||
// value of CEF_DOCKING_MODE_CUSTOM. With other docking modes modify the
|
||||
// insets of this overlay and/or layout of the contents View and call
|
||||
// SizeToPreferredSize() instead to calculate the new size and re-position the
|
||||
// overlay if necessary.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SetPosition(const CefPoint& position) = 0;
|
||||
|
||||
///
|
||||
// Returns the position of this overlay in parent coordinates.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefPoint GetPosition() = 0;
|
||||
|
||||
///
|
||||
// Sets the insets for this overlay. |insets| is in parent coordinates. Use
|
||||
// this method only for overlays created with a docking mode value other than
|
||||
// CEF_DOCKING_MODE_CUSTOM.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SetInsets(const CefInsets& insets) = 0;
|
||||
|
||||
///
|
||||
// Returns the insets for this overlay in parent coordinates.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefInsets GetInsets() = 0;
|
||||
|
||||
///
|
||||
// Size this overlay to its preferred size and trigger a re-layout if
|
||||
// necessary. The position of overlays created with a docking mode value of
|
||||
// CEF_DOCKING_MODE_CUSTOM will not be modified by calling this method. With
|
||||
// other docking modes this method may re-position the overlay if necessary to
|
||||
// accommodate the new size and any insets configured on the contents View.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SizeToPreferredSize() = 0;
|
||||
|
||||
///
|
||||
// Sets whether this overlay is visible. Overlays are hidden by default. If
|
||||
// this overlay is hidden then it and any child Views will not be drawn and,
|
||||
// if any of those Views currently have focus, then focus will also be
|
||||
// cleared. Painting is scheduled as needed.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SetVisible(bool visible) = 0;
|
||||
|
||||
///
|
||||
// Returns whether this overlay is visible. A View may be visible but still
|
||||
// not drawn in a Window if any parent Views are hidden. Call IsDrawn() to
|
||||
// determine whether this overlay and all parent Views are visible and will be
|
||||
// drawn.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsVisible() = 0;
|
||||
|
||||
///
|
||||
// Returns whether this overlay is visible and drawn in a Window. A View is
|
||||
// drawn if it and all parent Views are visible. To determine if the
|
||||
// containing Window is visible to the user on-screen call IsVisible() on the
|
||||
// Window.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsDrawn() = 0;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_VIEWS_CEF_OVERLAY_CONTROLLER_H_
|
@@ -222,6 +222,20 @@ class CefView : public CefBaseRefCounted {
|
||||
/*--cef()--*/
|
||||
virtual CefPoint GetPosition() = 0;
|
||||
|
||||
///
|
||||
// Sets the insets for this View. |insets| is in parent coordinates, or DIP
|
||||
// screen coordinates if there is no parent.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SetInsets(const CefInsets& insets) = 0;
|
||||
|
||||
///
|
||||
// Returns the insets for this View in parent coordinates, or DIP screen
|
||||
// coordinates if there is no parent.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefInsets GetInsets() = 0;
|
||||
|
||||
///
|
||||
// Returns the size this View would like to be if enough space is available.
|
||||
// Size is in parent coordinates, or DIP screen coordinates if there is no
|
||||
|
@@ -108,9 +108,16 @@ class CefViewDelegate : public virtual CefBaseRefCounted {
|
||||
///
|
||||
// Called when |view| is added or removed from the CefWindow.
|
||||
///
|
||||
/*--cef(optional_param=window)--*/
|
||||
/*--cef()--*/
|
||||
virtual void OnWindowChanged(CefRefPtr<CefView> view, bool added) {}
|
||||
|
||||
///
|
||||
// Called when the layout of |view| has changed.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnLayoutChanged(CefRefPtr<CefView> view,
|
||||
const CefRect& new_bounds) {}
|
||||
|
||||
///
|
||||
// Called when |view| gains focus.
|
||||
///
|
||||
|
@@ -41,6 +41,7 @@
|
||||
#include "include/cef_image.h"
|
||||
#include "include/cef_menu_model.h"
|
||||
#include "include/views/cef_display.h"
|
||||
#include "include/views/cef_overlay_controller.h"
|
||||
#include "include/views/cef_panel.h"
|
||||
#include "include/views/cef_window_delegate.h"
|
||||
|
||||
@@ -211,6 +212,40 @@ class CefWindow : public CefPanel {
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefImage> GetWindowAppIcon() = 0;
|
||||
|
||||
///
|
||||
// Add a View that will be overlayed on the Window contents with absolute
|
||||
// positioning and high z-order. Positioning is controlled by |docking_mode|
|
||||
// as described below. The returned CefOverlayController object is used to
|
||||
// control the overlay. Overlays are hidden by default.
|
||||
//
|
||||
// With CEF_DOCKING_MODE_CUSTOM:
|
||||
// 1. The overlay is initially hidden, sized to |view|'s preferred size, and
|
||||
// positioned in the top-left corner.
|
||||
// 2. Optionally change the overlay position and/or size by calling
|
||||
// CefOverlayController methods.
|
||||
// 3. Call CefOverlayController::SetVisible(true) to show the overlay.
|
||||
// 4. The overlay will be automatically re-sized if |view|'s layout changes.
|
||||
// Optionally change the overlay position and/or size when
|
||||
// OnLayoutChanged is called on the Window's delegate to indicate a
|
||||
// change in Window bounds.
|
||||
//
|
||||
// With other docking modes:
|
||||
// 1. The overlay is initially hidden, sized to |view|'s preferred size, and
|
||||
// positioned based on |docking_mode|.
|
||||
// 2. Call CefOverlayController::SetVisible(true) to show the overlay.
|
||||
// 3. The overlay will be automatically re-sized if |view|'s layout changes
|
||||
// and re-positioned as appropriate when the Window resizes.
|
||||
//
|
||||
// Overlays created by this method will receive a higher z-order then any
|
||||
// child Views added previously. It is therefore recommended to call this
|
||||
// method last after all other child Views have been added so that the overlay
|
||||
// displays as the top-most child of the Window.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefOverlayController> AddOverlayView(
|
||||
CefRefPtr<CefView> view,
|
||||
cef_docking_mode_t docking_mode) = 0;
|
||||
|
||||
///
|
||||
// Show a menu with contents |menu_model|. |screen_point| specifies the menu
|
||||
// position in screen coordinates. |anchor_position| specifies how the menu
|
||||
|
@@ -91,6 +91,14 @@ class CefWindowDelegate : public CefPanelDelegate {
|
||||
return CefRect();
|
||||
}
|
||||
|
||||
///
|
||||
// Return the initial show state for |window|.
|
||||
///
|
||||
/*--cef(default_retval=CEF_SHOW_STATE_NORMAL)--*/
|
||||
virtual cef_show_state_t GetInitialShowState(CefRefPtr<CefWindow> window) {
|
||||
return CEF_SHOW_STATE_NORMAL;
|
||||
}
|
||||
|
||||
///
|
||||
// Return true if |window| should be created without a frame or title bar. The
|
||||
// window will be resizable if CanResize() returns true. Use
|
||||
|
@@ -292,11 +292,10 @@ class CefResourceManager
|
||||
// Called from CefRequestHandler::OnBeforeResourceLoad on the browser process
|
||||
// IO thread.
|
||||
///
|
||||
cef_return_value_t OnBeforeResourceLoad(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefRequestCallback> callback);
|
||||
cef_return_value_t OnBeforeResourceLoad(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefCallback> callback);
|
||||
|
||||
///
|
||||
// Called from CefRequestHandler::GetResourceHandler on the browser process
|
||||
@@ -327,7 +326,7 @@ class CefResourceManager
|
||||
base::WeakPtr<CefResourceManager> manager_;
|
||||
|
||||
// Callback to execute once request handling is complete.
|
||||
CefRefPtr<CefRequestCallback> callback_;
|
||||
CefRefPtr<CefCallback> callback_;
|
||||
|
||||
// Position of the currently associated ProviderEntry in the |providers_|
|
||||
// list.
|
||||
|
@@ -348,7 +348,8 @@ AlloyBrowserContext::GetDownloadManagerDelegate() {
|
||||
}
|
||||
|
||||
content::BrowserPluginGuestManager* AlloyBrowserContext::GetGuestManager() {
|
||||
DCHECK(extensions::ExtensionsEnabled());
|
||||
if (!extensions::ExtensionsEnabled())
|
||||
return nullptr;
|
||||
return guest_view::GuestViewManager::FromBrowserContext(this);
|
||||
}
|
||||
|
||||
@@ -356,6 +357,11 @@ storage::SpecialStoragePolicy* AlloyBrowserContext::GetSpecialStoragePolicy() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
content::PlatformNotificationService*
|
||||
AlloyBrowserContext::GetPlatformNotificationService() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
content::PushMessagingService* AlloyBrowserContext::GetPushMessagingService() {
|
||||
return nullptr;
|
||||
}
|
||||
|
@@ -67,6 +67,8 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
|
||||
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
|
||||
content::BrowserPluginGuestManager* GetGuestManager() override;
|
||||
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
|
||||
content::PlatformNotificationService* GetPlatformNotificationService()
|
||||
override;
|
||||
content::PushMessagingService* GetPushMessagingService() override;
|
||||
content::StorageNotificationService* GetStorageNotificationService() override;
|
||||
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
|
||||
@@ -94,7 +96,7 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
|
||||
|
||||
// Values checked in ProfileNetworkContextService::CreateNetworkContextParams
|
||||
// when creating the NetworkContext.
|
||||
bool ShouldRestoreOldSessionCookies() const override {
|
||||
bool ShouldRestoreOldSessionCookies() override {
|
||||
return ShouldPersistSessionCookies();
|
||||
}
|
||||
bool ShouldPersistSessionCookies() const override {
|
||||
|
@@ -51,7 +51,7 @@
|
||||
#include "extensions/common/constants.h"
|
||||
#include "extensions/common/extension.h"
|
||||
#include "net/base/net_errors.h"
|
||||
#include "third_party/blink/public/mojom/page/widget.mojom-test-utils.h"
|
||||
#include "third_party/blink/public/mojom/widget/platform_widget.mojom-test-utils.h"
|
||||
#include "ui/events/base_event_utils.h"
|
||||
|
||||
using content::KeyboardEventProcessingResult;
|
||||
@@ -126,8 +126,7 @@ class CefWidgetHostInterceptor
|
||||
DISALLOW_COPY_AND_ASSIGN(CefWidgetHostInterceptor);
|
||||
};
|
||||
|
||||
static constexpr base::TimeDelta kRecentlyAudibleTimeout =
|
||||
base::TimeDelta::FromSeconds(2);
|
||||
static constexpr base::TimeDelta kRecentlyAudibleTimeout = base::Seconds(2);
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -365,7 +364,7 @@ void AlloyBrowserHostImpl::SetFocusInternal(bool focus) {
|
||||
if (focus)
|
||||
OnSetFocus(FOCUS_SOURCE_SYSTEM);
|
||||
else if (platform_delegate_)
|
||||
platform_delegate_->SendFocusEvent(false);
|
||||
platform_delegate_->SetFocus(false);
|
||||
}
|
||||
|
||||
CefWindowHandle AlloyBrowserHostImpl::GetWindowHandle() {
|
||||
@@ -653,10 +652,6 @@ void AlloyBrowserHostImpl::SendTouchEvent(const CefTouchEvent& event) {
|
||||
platform_delegate_->SendTouchEvent(event);
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::SendFocusEvent(bool setFocus) {
|
||||
SetFocus(setFocus);
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::SendCaptureLostEvent() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
@@ -818,7 +813,7 @@ void AlloyBrowserHostImpl::OnSetFocus(cef_focus_source_t source) {
|
||||
return;
|
||||
|
||||
if (platform_delegate_)
|
||||
platform_delegate_->SendFocusEvent(true);
|
||||
platform_delegate_->SetFocus(true);
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::RunFileChooser(
|
||||
@@ -1316,9 +1311,9 @@ void AlloyBrowserHostImpl::WebContentsCreated(
|
||||
std::move(platform_delegate), /*cef_extension=*/nullptr);
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::DidNavigateMainFramePostCommit(
|
||||
void AlloyBrowserHostImpl::DidNavigatePrimaryMainFramePostCommit(
|
||||
content::WebContents* web_contents) {
|
||||
contents_delegate_->DidNavigateMainFramePostCommit(web_contents);
|
||||
contents_delegate_->DidNavigatePrimaryMainFramePostCommit(web_contents);
|
||||
}
|
||||
|
||||
content::JavaScriptDialogManager*
|
||||
@@ -1463,6 +1458,14 @@ void AlloyBrowserHostImpl::ExitPictureInPicture() {
|
||||
PictureInPictureWindowManager::GetInstance()->ExitPictureInPicture();
|
||||
}
|
||||
|
||||
bool AlloyBrowserHostImpl::IsBackForwardCacheSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AlloyBrowserHostImpl::IsPrerender2Supported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// content::WebContentsObserver methods.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
@@ -113,7 +113,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
void Invalidate(PaintElementType type) override;
|
||||
void SendExternalBeginFrame() override;
|
||||
void SendTouchEvent(const CefTouchEvent& event) override;
|
||||
void SendFocusEvent(bool setFocus) override;
|
||||
void SendCaptureLostEvent() override;
|
||||
void NotifyMoveOrResizeStarted() override;
|
||||
int GetWindowlessFrameRate() override;
|
||||
@@ -251,7 +250,7 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
const std::string& frame_name,
|
||||
const GURL& target_url,
|
||||
content::WebContents* new_contents) override;
|
||||
void DidNavigateMainFramePostCommit(
|
||||
void DidNavigatePrimaryMainFramePostCommit(
|
||||
content::WebContents* web_contents) override;
|
||||
content::JavaScriptDialogManager* GetJavaScriptDialogManager(
|
||||
content::WebContents* source) override;
|
||||
@@ -289,6 +288,8 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
const viz::SurfaceId& surface_id,
|
||||
const gfx::Size& natural_size) override;
|
||||
void ExitPictureInPicture() override;
|
||||
bool IsBackForwardCacheSupported() override;
|
||||
bool IsPrerender2Supported() override;
|
||||
|
||||
// content::WebContentsObserver methods.
|
||||
using content::WebContentsObserver::BeforeUnloadFired;
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include "libcef/browser/net_service/resource_request_handler_wrapper.h"
|
||||
#include "libcef/browser/plugins/plugin_service_filter.h"
|
||||
#include "libcef/browser/prefs/renderer_prefs.h"
|
||||
#include "libcef/browser/printing/print_view_manager.h"
|
||||
#include "libcef/browser/speech_recognition_manager_delegate.h"
|
||||
#include "libcef/browser/ssl_info_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
@@ -76,6 +77,7 @@
|
||||
#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/pdf/browser/pdf_web_contents_helper.h"
|
||||
#include "components/spellcheck/common/spellcheck.mojom.h"
|
||||
#include "components/version_info/version_info.h"
|
||||
#include "content/browser/plugin_service_impl.h"
|
||||
@@ -103,6 +105,7 @@
|
||||
#include "extensions/browser/extension_message_filter.h"
|
||||
#include "extensions/browser/extension_protocols.h"
|
||||
#include "extensions/browser/extension_registry.h"
|
||||
#include "extensions/browser/extension_web_contents_observer.h"
|
||||
#include "extensions/browser/extensions_browser_client.h"
|
||||
#include "extensions/browser/guest_view/extensions_guest_view_message_filter.h"
|
||||
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
|
||||
@@ -115,12 +118,14 @@
|
||||
#include "mojo/public/cpp/bindings/self_owned_associated_receiver.h"
|
||||
#include "net/base/auth.h"
|
||||
#include "net/ssl/ssl_cert_request_info.h"
|
||||
#include "net/ssl/ssl_private_key.h"
|
||||
#include "ppapi/host/ppapi_host.h"
|
||||
#include "sandbox/policy/switches.h"
|
||||
#include "services/network/public/cpp/network_switches.h"
|
||||
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
|
||||
#include "services/service_manager/public/mojom/connector.mojom.h"
|
||||
#include "storage/browser/quota/quota_settings.h"
|
||||
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
|
||||
#include "third_party/blink/public/common/web_preferences/web_preferences.h"
|
||||
#include "third_party/blink/public/mojom/prerender/prerender.mojom.h"
|
||||
#include "third_party/blink/public/web/web_window_features.h"
|
||||
@@ -157,7 +162,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
class CefQuotaCallbackImpl : public CefRequestCallback {
|
||||
class CefQuotaCallbackImpl : public CefCallback {
|
||||
public:
|
||||
using CallbackType = content::QuotaPermissionContext::PermissionCallback;
|
||||
|
||||
@@ -176,22 +181,24 @@ class CefQuotaCallbackImpl : public CefRequestCallback {
|
||||
}
|
||||
}
|
||||
|
||||
void Continue(bool allow) override {
|
||||
void Continue() override { ContinueNow(true); }
|
||||
|
||||
void Cancel() override { ContinueNow(false); }
|
||||
|
||||
CallbackType Disconnect() WARN_UNUSED_RESULT { return std::move(callback_); }
|
||||
|
||||
private:
|
||||
void ContinueNow(bool allow) {
|
||||
if (CEF_CURRENTLY_ON_IOT()) {
|
||||
if (!callback_.is_null()) {
|
||||
RunNow(std::move(callback_), allow);
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_IOT, base::BindOnce(&CefQuotaCallbackImpl::Continue,
|
||||
CEF_POST_TASK(CEF_IOT, base::BindOnce(&CefQuotaCallbackImpl::ContinueNow,
|
||||
this, allow));
|
||||
}
|
||||
}
|
||||
|
||||
void Cancel() override { Continue(false); }
|
||||
|
||||
CallbackType Disconnect() WARN_UNUSED_RESULT { return std::move(callback_); }
|
||||
|
||||
private:
|
||||
static void RunNow(CallbackType callback, bool allow) {
|
||||
CEF_REQUIRE_IOT();
|
||||
std::move(callback).Run(
|
||||
@@ -206,7 +213,7 @@ class CefQuotaCallbackImpl : public CefRequestCallback {
|
||||
DISALLOW_COPY_AND_ASSIGN(CefQuotaCallbackImpl);
|
||||
};
|
||||
|
||||
class CefAllowCertificateErrorCallbackImpl : public CefRequestCallback {
|
||||
class CefAllowCertificateErrorCallbackImpl : public CefCallback {
|
||||
public:
|
||||
typedef base::OnceCallback<void(content::CertificateRequestResultType)>
|
||||
CallbackType;
|
||||
@@ -228,7 +235,14 @@ class CefAllowCertificateErrorCallbackImpl : public CefRequestCallback {
|
||||
}
|
||||
}
|
||||
|
||||
void Continue(bool allow) override {
|
||||
void Continue() override { ContinueNow(true); }
|
||||
|
||||
void Cancel() override { ContinueNow(false); }
|
||||
|
||||
CallbackType Disconnect() WARN_UNUSED_RESULT { return std::move(callback_); }
|
||||
|
||||
private:
|
||||
void ContinueNow(bool allow) {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (!callback_.is_null()) {
|
||||
RunNow(std::move(callback_), allow);
|
||||
@@ -236,16 +250,11 @@ class CefAllowCertificateErrorCallbackImpl : public CefRequestCallback {
|
||||
} else {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefAllowCertificateErrorCallbackImpl::Continue, this,
|
||||
allow));
|
||||
base::BindOnce(&CefAllowCertificateErrorCallbackImpl::ContinueNow,
|
||||
this, allow));
|
||||
}
|
||||
}
|
||||
|
||||
void Cancel() override { Continue(false); }
|
||||
|
||||
CallbackType Disconnect() WARN_UNUSED_RESULT { return std::move(callback_); }
|
||||
|
||||
private:
|
||||
static void RunNow(CallbackType callback, bool allow) {
|
||||
CEF_REQUIRE_UIT();
|
||||
std::move(callback).Run(
|
||||
@@ -941,10 +950,6 @@ void AlloyContentBrowserClient::OverrideWebkitPrefs(
|
||||
renderer_prefs::PopulateWebPreferences(rvh, *prefs, base_background_color);
|
||||
|
||||
web_contents->SetPageBaseBackgroundColor(base_background_color);
|
||||
|
||||
if (rvh->GetWidget()->GetView()) {
|
||||
rvh->GetWidget()->GetView()->SetBackgroundColor(base_background_color);
|
||||
}
|
||||
}
|
||||
|
||||
bool AlloyContentBrowserClient::OverrideWebPreferencesAfterNavigation(
|
||||
@@ -975,6 +980,35 @@ AlloyContentBrowserClient::CreateDevToolsManagerDelegate() {
|
||||
return std::make_unique<CefDevToolsManagerDelegate>();
|
||||
}
|
||||
|
||||
bool AlloyContentBrowserClient::BindAssociatedReceiverFromFrame(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const std::string& interface_name,
|
||||
mojo::ScopedInterfaceEndpointHandle* handle) {
|
||||
if (interface_name == extensions::mojom::LocalFrameHost::Name_) {
|
||||
extensions::ExtensionWebContentsObserver::BindLocalFrameHost(
|
||||
mojo::PendingAssociatedReceiver<extensions::mojom::LocalFrameHost>(
|
||||
std::move(*handle)),
|
||||
render_frame_host);
|
||||
return true;
|
||||
}
|
||||
if (interface_name == printing::mojom::PrintManagerHost::Name_) {
|
||||
printing::CefPrintViewManager::BindPrintManagerHost(
|
||||
mojo::PendingAssociatedReceiver<printing::mojom::PrintManagerHost>(
|
||||
std::move(*handle)),
|
||||
render_frame_host);
|
||||
return true;
|
||||
}
|
||||
if (interface_name == pdf::mojom::PdfService::Name_) {
|
||||
pdf::PDFWebContentsHelper::BindPdfService(
|
||||
mojo::PendingAssociatedReceiver<pdf::mojom::PdfService>(
|
||||
std::move(*handle)),
|
||||
render_frame_host);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<content::NavigationThrottle>>
|
||||
AlloyContentBrowserClient::CreateThrottlesForNavigation(
|
||||
content::NavigationHandle* navigation_handle) {
|
||||
@@ -1172,7 +1206,7 @@ void AlloyContentBrowserClient::OnNetworkServiceCreated(
|
||||
network_service);
|
||||
}
|
||||
|
||||
void AlloyContentBrowserClient::ConfigureNetworkContextParams(
|
||||
bool AlloyContentBrowserClient::ConfigureNetworkContextParams(
|
||||
content::BrowserContext* context,
|
||||
bool in_memory,
|
||||
const base::FilePath& relative_partition_path,
|
||||
@@ -1182,10 +1216,9 @@ void AlloyContentBrowserClient::ConfigureNetworkContextParams(
|
||||
// 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()) {
|
||||
// This must match the value expected in
|
||||
// Cancel NetworkContext creation in
|
||||
// StoragePartitionImpl::InitNetworkContext.
|
||||
network_context_params->context_name = "magic_shutting_down";
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
auto cef_context = CefBrowserContext::FromBrowserContext(context);
|
||||
@@ -1209,6 +1242,8 @@ void AlloyContentBrowserClient::ConfigureNetworkContextParams(
|
||||
// TODO(cef): Remove this and add required NetworkIsolationKeys,
|
||||
// this is currently not the case and this was not required pre M84.
|
||||
network_context_params->require_network_isolation_key = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// The sandbox may block read/write access from the NetworkService to
|
||||
@@ -1237,6 +1272,7 @@ bool AlloyContentBrowserClient::HandleExternalProtocol(
|
||||
int frame_tree_node_id,
|
||||
content::NavigationUIData* navigation_data,
|
||||
bool is_main_frame,
|
||||
network::mojom::WebSandboxFlags sandbox_flags,
|
||||
ui::PageTransition page_transition,
|
||||
bool has_user_gesture,
|
||||
const absl::optional<url::Origin>& initiating_origin,
|
||||
@@ -1249,6 +1285,7 @@ bool AlloyContentBrowserClient::HandleExternalProtocol(
|
||||
content::WebContents::Getter web_contents_getter,
|
||||
int frame_tree_node_id,
|
||||
content::NavigationUIData* navigation_data,
|
||||
network::mojom::WebSandboxFlags sandbox_flags,
|
||||
const network::ResourceRequest& resource_request,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
|
||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver =
|
||||
@@ -1325,6 +1362,10 @@ std::string AlloyContentBrowserClient::GetUserAgent() {
|
||||
return embedder_support::GetUserAgent();
|
||||
}
|
||||
|
||||
std::string AlloyContentBrowserClient::GetReducedUserAgent() {
|
||||
return embedder_support::GetReducedUserAgent();
|
||||
}
|
||||
|
||||
blink::UserAgentMetadata AlloyContentBrowserClient::GetUserAgentMetadata() {
|
||||
blink::UserAgentMetadata metadata;
|
||||
|
||||
@@ -1353,7 +1394,7 @@ AlloyContentBrowserClient::GetPluginMimeTypesWithExternalHandlers(
|
||||
bool AlloyContentBrowserClient::ArePersistentMediaDeviceIDsAllowed(
|
||||
content::BrowserContext* browser_context,
|
||||
const GURL& url,
|
||||
const GURL& site_for_cookies,
|
||||
const net::SiteForCookies& site_for_cookies,
|
||||
const absl::optional<url::Origin>& top_frame_origin) {
|
||||
// Persistent MediaDevice IDs are allowed if cookies are allowed.
|
||||
return CookieSettingsFactory::GetForProfile(
|
||||
|
@@ -111,6 +111,10 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||
void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
|
||||
std::unique_ptr<content::DevToolsManagerDelegate>
|
||||
CreateDevToolsManagerDelegate() override;
|
||||
bool BindAssociatedReceiverFromFrame(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const std::string& interface_name,
|
||||
mojo::ScopedInterfaceEndpointHandle* handle) override;
|
||||
std::vector<std::unique_ptr<content::NavigationThrottle>>
|
||||
CreateThrottlesForNavigation(
|
||||
content::NavigationHandle* navigation_handle) override;
|
||||
@@ -168,7 +172,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||
network::mojom::URLLoaderFactoryOverridePtr* factory_override) override;
|
||||
void OnNetworkServiceCreated(
|
||||
network::mojom::NetworkService* network_service) override;
|
||||
void ConfigureNetworkContextParams(
|
||||
bool ConfigureNetworkContextParams(
|
||||
content::BrowserContext* context,
|
||||
bool in_memory,
|
||||
const base::FilePath& relative_partition_path,
|
||||
@@ -183,6 +187,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||
int frame_tree_node_id,
|
||||
content::NavigationUIData* navigation_data,
|
||||
bool is_main_frame,
|
||||
network::mojom::WebSandboxFlags sandbox_flags,
|
||||
ui::PageTransition page_transition,
|
||||
bool has_user_gesture,
|
||||
const absl::optional<url::Origin>& initiating_origin,
|
||||
@@ -192,6 +197,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||
content::WebContents::Getter web_contents_getter,
|
||||
int frame_tree_node_id,
|
||||
content::NavigationUIData* navigation_data,
|
||||
network::mojom::WebSandboxFlags sandbox_flags,
|
||||
const network::ResourceRequest& request,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
|
||||
override;
|
||||
@@ -204,13 +210,14 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||
std::string GetProduct() override;
|
||||
std::string GetChromeProduct() override;
|
||||
std::string GetUserAgent() override;
|
||||
std::string GetReducedUserAgent() override;
|
||||
blink::UserAgentMetadata GetUserAgentMetadata() override;
|
||||
base::flat_set<std::string> GetPluginMimeTypesWithExternalHandlers(
|
||||
content::BrowserContext* browser_context) override;
|
||||
bool ArePersistentMediaDeviceIDsAllowed(
|
||||
content::BrowserContext* browser_context,
|
||||
const GURL& scope,
|
||||
const GURL& site_for_cookies,
|
||||
const net::SiteForCookies& site_for_cookies,
|
||||
const absl::optional<url::Origin>& top_frame_origin) override;
|
||||
bool ShouldAllowPluginCreation(
|
||||
const url::Origin& embedder_origin,
|
||||
|
@@ -103,10 +103,9 @@ void ChromeBrowserProcessAlloy::CleanupOnUIThread() {
|
||||
|
||||
local_state_.reset();
|
||||
browser_policy_connector_.reset();
|
||||
|
||||
background_printing_manager_.reset();
|
||||
|
||||
field_trial_list_.reset();
|
||||
component_updater_.reset();
|
||||
|
||||
shutdown_ = true;
|
||||
}
|
||||
@@ -396,3 +395,9 @@ ChromeBrowserProcessAlloy::serial_policy_allowed_ports() {
|
||||
NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
breadcrumbs::BreadcrumbPersistentStorageManager*
|
||||
ChromeBrowserProcessAlloy::GetBreadcrumbPersistentStorageManager() {
|
||||
NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
|
@@ -99,6 +99,8 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
|
||||
override;
|
||||
BuildState* GetBuildState() override;
|
||||
SerialPolicyAllowedPorts* serial_policy_allowed_ports() override;
|
||||
breadcrumbs::BreadcrumbPersistentStorageManager*
|
||||
GetBreadcrumbPersistentStorageManager() override;
|
||||
|
||||
private:
|
||||
bool initialized_;
|
||||
|
@@ -153,15 +153,6 @@ bool ChromeProfileAlloy::WasCreatedByVersionOrLater(
|
||||
return false;
|
||||
}
|
||||
|
||||
void ChromeProfileAlloy::SetExitType(ExitType exit_type) {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
Profile::ExitType ChromeProfileAlloy::GetLastSessionExitType() const {
|
||||
NOTREACHED();
|
||||
return EXIT_NORMAL;
|
||||
}
|
||||
|
||||
base::Time ChromeProfileAlloy::GetCreationTime() const {
|
||||
NOTREACHED();
|
||||
return base::Time();
|
||||
@@ -171,7 +162,7 @@ void ChromeProfileAlloy::SetCreationTimeForTesting(base::Time creation_time) {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
void ChromeProfileAlloy::RecordMainFrameNavigation() {
|
||||
void ChromeProfileAlloy::RecordPrimaryMainFrameNavigation() {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
|
@@ -44,11 +44,9 @@ class ChromeProfileAlloy : public Profile {
|
||||
void set_last_selected_directory(const base::FilePath& path) override;
|
||||
GURL GetHomePage() override;
|
||||
bool WasCreatedByVersionOrLater(const std::string& version) override;
|
||||
void SetExitType(ExitType exit_type) override;
|
||||
ExitType GetLastSessionExitType() const override;
|
||||
base::Time GetCreationTime() const override;
|
||||
void SetCreationTimeForTesting(base::Time creation_time) override;
|
||||
void RecordMainFrameNavigation() override;
|
||||
void RecordPrimaryMainFrameNavigation() override;
|
||||
bool IsSignedIn() override;
|
||||
|
||||
private:
|
||||
|
@@ -18,6 +18,8 @@
|
||||
#include "content/public/browser/notification_source.h"
|
||||
#include "content/public/browser/notification_types.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 "third_party/blink/public/mojom/favicon/favicon_url.mojom.h"
|
||||
#include "third_party/blink/public/mojom/input/focus_type.mojom-blink.h"
|
||||
|
||||
@@ -45,11 +47,11 @@ void CefBrowserContentsDelegate::ObserveWebContents(
|
||||
content::Source<content::NavigationController>(
|
||||
&new_contents->GetController()));
|
||||
|
||||
// Make sure RenderFrameCreated is called at least one time.
|
||||
// Make sure MaybeCreateFrame 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.
|
||||
RenderFrameCreated(new_contents->GetMainFrame());
|
||||
// browser.
|
||||
browser_info_->MaybeCreateFrame(new_contents->GetMainFrame(),
|
||||
false /* is_guest_view */);
|
||||
} else {
|
||||
registrar_.reset();
|
||||
}
|
||||
@@ -161,7 +163,7 @@ bool CefBrowserContentsDelegate::DidAddMessageToConsole(
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefBrowserContentsDelegate::DidNavigateMainFramePostCommit(
|
||||
void CefBrowserContentsDelegate::DidNavigatePrimaryMainFramePostCommit(
|
||||
content::WebContents* web_contents) {
|
||||
has_document_ = false;
|
||||
OnStateChanged(State::kDocument);
|
||||
@@ -235,6 +237,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) {
|
||||
auto render_view_host = render_frame_host->GetRenderViewHost();
|
||||
auto base_background_color = platform_delegate()->GetBackgroundColor();
|
||||
if (browser_info_ && browser_info_->is_popup()) {
|
||||
// force reset page base background color because popup window won't get
|
||||
// the page base background from web_contents at the creation time
|
||||
web_contents()->SetPageBaseBackgroundColor(SkColor());
|
||||
web_contents()->SetPageBaseBackgroundColor(base_background_color);
|
||||
}
|
||||
render_view_host->GetWidget()->GetView()->SetBackgroundColor(
|
||||
base_background_color);
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserContentsDelegate::RenderFrameHostChanged(
|
||||
@@ -365,6 +379,10 @@ void CefBrowserContentsDelegate::DidFinishNavigation(
|
||||
(error_code == net::OK ? navigation_handle->GetURL() : GURL());
|
||||
|
||||
auto browser_info = browser_info_;
|
||||
if (!browser_info->browser()) {
|
||||
// Ignore notifications when the browser is closing.
|
||||
return;
|
||||
}
|
||||
|
||||
// May return NULL when starting a new navigation if the previous navigation
|
||||
// caused the renderer process to crash during load.
|
||||
|
@@ -91,7 +91,7 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
|
||||
const std::u16string& message,
|
||||
int32_t line_no,
|
||||
const std::u16string& source_id) override;
|
||||
void DidNavigateMainFramePostCommit(
|
||||
void DidNavigatePrimaryMainFramePostCommit(
|
||||
content::WebContents* web_contents) override;
|
||||
void EnterFullscreenModeForTab(
|
||||
content::RenderFrameHost* requesting_frame,
|
||||
|
@@ -16,7 +16,7 @@
|
||||
CefBrowserFrame::CefBrowserFrame(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
mojo::PendingReceiver<cef::mojom::BrowserFrame> receiver)
|
||||
: DocumentServiceBase(render_frame_host, std::move(receiver)) {}
|
||||
: FrameServiceBase(render_frame_host, std::move(receiver)) {}
|
||||
|
||||
CefBrowserFrame::~CefBrowserFrame() = default;
|
||||
|
||||
|
@@ -7,18 +7,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "libcef/browser/frame_host_impl.h"
|
||||
#include "libcef/browser/frame_service_base.h"
|
||||
|
||||
#include "cef/libcef/common/mojom/cef.mojom.h"
|
||||
#include "content/public/browser/document_service_base.h"
|
||||
#include "mojo/public/cpp/bindings/binder_map.h"
|
||||
|
||||
// Implementation of the BrowserFrame mojo interface.
|
||||
// This is implemented separately from CefFrameHostImpl to better manage the
|
||||
// association with the RenderFrameHost (which may be speculative, etc.), and so
|
||||
// that messages are always routed to the most appropriate CefFrameHostImpl
|
||||
// instance. Lifespan is tied to the RFH via DocumentServiceBase.
|
||||
// instance. Lifespan is tied to the RFH via FrameServiceBase.
|
||||
class CefBrowserFrame
|
||||
: public content::DocumentServiceBase<cef::mojom::BrowserFrame> {
|
||||
: public content::FrameServiceBase<cef::mojom::BrowserFrame> {
|
||||
public:
|
||||
CefBrowserFrame(content::RenderFrameHost* render_frame_host,
|
||||
mojo::PendingReceiver<cef::mojom::BrowserFrame> receiver);
|
||||
@@ -39,7 +39,7 @@ class CefBrowserFrame
|
||||
absl::optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions)
|
||||
override;
|
||||
|
||||
// DocumentServiceBase methods:
|
||||
// FrameServiceBase methods:
|
||||
bool ShouldCloseOnFinishNavigation() const override { return false; }
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> GetFrameHost(
|
||||
|
@@ -247,7 +247,7 @@ void CefBrowserHostBase::DownloadImage(
|
||||
return;
|
||||
|
||||
web_contents->DownloadImage(
|
||||
gurl, is_favicon, max_image_size,
|
||||
gurl, is_favicon, gfx::Size(max_image_size, max_image_size),
|
||||
max_image_size * gfx::ImageSkia::GetMaxSupportedScale(), bypass_cache,
|
||||
base::BindOnce(
|
||||
[](uint32 max_image_size,
|
||||
@@ -798,6 +798,7 @@ void CefBrowserHostBase::OnBeforeClose() {
|
||||
handler->OnBeforeClose(this);
|
||||
}
|
||||
}
|
||||
browser_info_->SetClosing();
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::OnBrowserDestroyed() {
|
||||
|
@@ -41,7 +41,9 @@ CefBrowserInfo::~CefBrowserInfo() {
|
||||
|
||||
CefRefPtr<CefBrowserHostBase> CefBrowserInfo::browser() const {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
return browser_;
|
||||
if (!is_closing_)
|
||||
return browser_;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CefBrowserInfo::SetBrowser(CefRefPtr<CefBrowserHostBase> browser) {
|
||||
@@ -71,6 +73,12 @@ void CefBrowserInfo::SetBrowser(CefRefPtr<CefBrowserHostBase> browser) {
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserInfo::SetClosing() {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
DCHECK(!is_closing_);
|
||||
is_closing_ = true;
|
||||
}
|
||||
|
||||
void CefBrowserInfo::MaybeCreateFrame(content::RenderFrameHost* host,
|
||||
bool is_guest_view) {
|
||||
CEF_REQUIRE_UIT();
|
||||
@@ -155,7 +163,26 @@ void CefBrowserInfo::FrameHostStateChanged(
|
||||
content::RenderFrameHost::LifecycleState new_state) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
// We currently only care about BackForwardCache state changes.
|
||||
if ((old_state == content::RenderFrameHost::LifecycleState::kPrerendering ||
|
||||
old_state ==
|
||||
content::RenderFrameHost::LifecycleState::kInBackForwardCache) &&
|
||||
new_state == content::RenderFrameHost::LifecycleState::kActive) {
|
||||
if (auto frame = GetFrameForHost(host)) {
|
||||
// Update the associated RFH, which may have changed.
|
||||
frame->MaybeReAttach(this, host);
|
||||
|
||||
if (frame->IsMain()) {
|
||||
// Update the main frame object.
|
||||
NotificationStateLock lock_scope(this);
|
||||
SetMainFrame(browser_, frame);
|
||||
}
|
||||
|
||||
// Update draggable regions.
|
||||
frame->MaybeSendDidStopLoading();
|
||||
}
|
||||
}
|
||||
|
||||
// Update BackForwardCache state.
|
||||
bool added_to_bfcache =
|
||||
new_state ==
|
||||
content::RenderFrameHost::LifecycleState::kInBackForwardCache;
|
||||
@@ -209,7 +236,7 @@ void CefBrowserInfo::RemoveFrame(content::RenderFrameHost* host) {
|
||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetMainFrame() {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
// Early exit if called post-destruction.
|
||||
if (!browser_)
|
||||
if (!browser_ || is_closing_)
|
||||
return nullptr;
|
||||
|
||||
CHECK(main_frame_);
|
||||
@@ -345,6 +372,26 @@ void CefBrowserInfo::MaybeExecuteFrameNotification(
|
||||
std::move(pending_action).Run(frame_handler);
|
||||
}
|
||||
|
||||
void CefBrowserInfo::MaybeNotifyDraggableRegionsChanged(
|
||||
CefRefPtr<CefBrowserHostBase> browser,
|
||||
CefRefPtr<CefFrameHostImpl> frame,
|
||||
std::vector<CefDraggableRegion> draggable_regions) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(frame->IsMain());
|
||||
|
||||
if (draggable_regions == draggable_regions_)
|
||||
return;
|
||||
|
||||
draggable_regions_ = std::move(draggable_regions);
|
||||
|
||||
if (auto client = browser->GetClient()) {
|
||||
if (auto handler = client->GetDragHandler()) {
|
||||
handler->OnDraggableRegionsChanged(browser.get(), frame,
|
||||
draggable_regions_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Passing in |browser| here because |browser_| may already be cleared.
|
||||
void CefBrowserInfo::SetMainFrame(CefRefPtr<CefBrowserHostBase> browser,
|
||||
CefRefPtr<CefFrameHostImpl> frame) {
|
||||
@@ -352,6 +399,12 @@ void CefBrowserInfo::SetMainFrame(CefRefPtr<CefBrowserHostBase> browser,
|
||||
DCHECK(browser);
|
||||
DCHECK(!frame || frame->IsMain());
|
||||
|
||||
if (frame && main_frame_ &&
|
||||
frame->GetIdentifier() == main_frame_->GetIdentifier()) {
|
||||
// Nothing to do.
|
||||
return;
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> old_frame;
|
||||
if (main_frame_) {
|
||||
old_frame = main_frame_;
|
||||
|
@@ -52,6 +52,13 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
// (to set) and DestroyBrowser (to clear).
|
||||
void SetBrowser(CefRefPtr<CefBrowserHostBase> browser);
|
||||
|
||||
// Called after OnBeforeClose and before SetBrowser(nullptr). This will cause
|
||||
// browser() and GetMainFrame() to return nullptr as expected by
|
||||
// CefFrameHandler callbacks. Note that this differs from calling
|
||||
// SetBrowser(nullptr) because the WebContents has not yet been destroyed and
|
||||
// further frame-related callbacks are expected.
|
||||
void SetClosing();
|
||||
|
||||
// Ensure that a frame record exists for |host|. Called for the main frame
|
||||
// when the RenderView is created, or for a sub-frame when the associated
|
||||
// RenderFrame is created in the renderer process.
|
||||
@@ -147,6 +154,11 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
// executed immediately.
|
||||
void MaybeExecuteFrameNotification(FrameNotifyOnceAction pending_action);
|
||||
|
||||
void MaybeNotifyDraggableRegionsChanged(
|
||||
CefRefPtr<CefBrowserHostBase> browser,
|
||||
CefRefPtr<CefFrameHostImpl> frame,
|
||||
std::vector<CefDraggableRegion> draggable_regions);
|
||||
|
||||
private:
|
||||
friend class base::RefCountedThreadSafe<CefBrowserInfo>;
|
||||
|
||||
@@ -234,6 +246,12 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
// The current main frame.
|
||||
CefRefPtr<CefFrameHostImpl> main_frame_;
|
||||
|
||||
// True if the browser is currently closing.
|
||||
bool is_closing_ = false;
|
||||
|
||||
// Only accessed on the UI thread.
|
||||
std::vector<CefDraggableRegion> draggable_regions_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserInfo);
|
||||
};
|
||||
|
||||
|
@@ -157,13 +157,13 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
||||
#if (defined(OS_WIN) || defined(OS_MAC))
|
||||
// Default to the size from the popup features.
|
||||
if (cef_features.xSet)
|
||||
window_info->x = cef_features.x;
|
||||
window_info->bounds.x = cef_features.x;
|
||||
if (cef_features.ySet)
|
||||
window_info->y = cef_features.y;
|
||||
window_info->bounds.y = cef_features.y;
|
||||
if (cef_features.widthSet)
|
||||
window_info->width = cef_features.width;
|
||||
window_info->bounds.width = cef_features.width;
|
||||
if (cef_features.heightSet)
|
||||
window_info->height = cef_features.height;
|
||||
window_info->bounds.height = cef_features.height;
|
||||
#endif
|
||||
|
||||
allow = !handler->OnBeforePopup(
|
||||
|
@@ -172,7 +172,7 @@ void CefBrowserPlatformDelegate::SendTouchEvent(const CefTouchEvent& event) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::SendFocusEvent(bool setFocus) {
|
||||
void CefBrowserPlatformDelegate::SetFocus(bool setFocus) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#include "base/callback_forward.h"
|
||||
#include "extensions/common/mojom/view_type.mojom-forward.h"
|
||||
#include "third_party/blink/public/common/page/drag_operation.h"
|
||||
#include "third_party/blink/public/mojom/page/drag.mojom-forward.h"
|
||||
#include "third_party/blink/public/mojom/drag/drag.mojom-forward.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-forward.h"
|
||||
#include "ui/base/window_open_disposition.h"
|
||||
@@ -225,7 +225,7 @@ class CefBrowserPlatformDelegate {
|
||||
|
||||
// Send focus event. The browser's WebContents may be NULL when this method is
|
||||
// called.
|
||||
virtual void SendFocusEvent(bool setFocus);
|
||||
virtual void SetFocus(bool setFocus);
|
||||
|
||||
// Send capture lost event.
|
||||
virtual void SendCaptureLostEvent();
|
||||
|
@@ -74,7 +74,7 @@ void ChromeBrowserContext::InitializeAsync(base::OnceClosure initialized_cb) {
|
||||
}
|
||||
|
||||
// Default to creating a new/unique OffTheRecord profile.
|
||||
ProfileCreated(nullptr, Profile::CreateStatus::CREATE_STATUS_CANCELED);
|
||||
ProfileCreated(nullptr, Profile::CreateStatus::CREATE_STATUS_LOCAL_FAIL);
|
||||
}
|
||||
|
||||
void ChromeBrowserContext::Shutdown() {
|
||||
|
@@ -170,10 +170,10 @@ bool ChromeBrowserDelegate::DidAddMessageToConsole(
|
||||
return false;
|
||||
}
|
||||
|
||||
void ChromeBrowserDelegate::DidNavigateMainFramePostCommit(
|
||||
void ChromeBrowserDelegate::DidNavigatePrimaryMainFramePostCommit(
|
||||
content::WebContents* web_contents) {
|
||||
if (auto delegate = GetDelegateForWebContents(web_contents)) {
|
||||
delegate->DidNavigateMainFramePostCommit(web_contents);
|
||||
delegate->DidNavigatePrimaryMainFramePostCommit(web_contents);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -73,7 +73,7 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
|
||||
const std::u16string& message,
|
||||
int32_t line_no,
|
||||
const std::u16string& source_id) override;
|
||||
void DidNavigateMainFramePostCommit(
|
||||
void DidNavigatePrimaryMainFramePostCommit(
|
||||
content::WebContents* web_contents) override;
|
||||
void EnterFullscreenModeForTab(
|
||||
content::RenderFrameHost* requesting_frame,
|
||||
|
@@ -56,8 +56,6 @@ CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserHostImpl::Create(
|
||||
ChromeBrowserHostImpl::GetBrowserForContents(web_contents);
|
||||
CHECK(browser_host);
|
||||
|
||||
browser->window()->Show();
|
||||
|
||||
return browser_host;
|
||||
}
|
||||
|
||||
@@ -275,10 +273,6 @@ void ChromeBrowserHostImpl::SendTouchEvent(const CefTouchEvent& event) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::SendFocusEvent(bool setFocus) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::SendCaptureLostEvent() {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
@@ -93,7 +93,6 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
|
||||
void Invalidate(PaintElementType type) override;
|
||||
void SendExternalBeginFrame() override;
|
||||
void SendTouchEvent(const CefTouchEvent& event) override;
|
||||
void SendFocusEvent(bool setFocus) override;
|
||||
void SendCaptureLostEvent() override;
|
||||
void NotifyMoveOrResizeStarted() override;
|
||||
int GetWindowlessFrameRate() override;
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#include "base/command_line.h"
|
||||
#include "base/path_service.h"
|
||||
#include "chrome/browser/chrome_browser_main.h"
|
||||
#include "chrome/browser/net/system_network_context_manager.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "content/public/browser/navigation_throttle.h"
|
||||
@@ -44,6 +45,7 @@ void HandleExternalProtocolHelper(
|
||||
content::WebContents::Getter web_contents_getter,
|
||||
int frame_tree_node_id,
|
||||
content::NavigationUIData* navigation_data,
|
||||
network::mojom::WebSandboxFlags sandbox_flags,
|
||||
const network::ResourceRequest& resource_request) {
|
||||
// Match the logic of the original call in
|
||||
// NavigationURLLoaderImpl::PrepareForNonInterceptedRequest.
|
||||
@@ -53,6 +55,7 @@ void HandleExternalProtocolHelper(
|
||||
navigation_data,
|
||||
resource_request.resource_type ==
|
||||
static_cast<int>(blink::mojom::ResourceType::kMainFrame),
|
||||
sandbox_flags,
|
||||
static_cast<ui::PageTransition>(resource_request.transition_type),
|
||||
resource_request.has_user_gesture, resource_request.request_initiator,
|
||||
nullptr);
|
||||
@@ -188,11 +191,6 @@ void ChromeContentBrowserClientCef::OverrideWebkitPrefs(
|
||||
}
|
||||
|
||||
web_contents->SetPageBaseBackgroundColor(base_background_color);
|
||||
|
||||
auto rvh = web_contents->GetRenderViewHost();
|
||||
if (rvh->GetWidget()->GetView()) {
|
||||
rvh->GetWidget()->GetView()->SetBackgroundColor(base_background_color);
|
||||
}
|
||||
}
|
||||
|
||||
bool ChromeContentBrowserClientCef::WillCreateURLLoaderFactory(
|
||||
@@ -243,6 +241,7 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
|
||||
int frame_tree_node_id,
|
||||
content::NavigationUIData* navigation_data,
|
||||
bool is_main_frame,
|
||||
network::mojom::WebSandboxFlags sandbox_flags,
|
||||
ui::PageTransition page_transition,
|
||||
bool has_user_gesture,
|
||||
const absl::optional<url::Origin>& initiating_origin,
|
||||
@@ -259,14 +258,15 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
|
||||
// handling.
|
||||
return ChromeContentBrowserClient::HandleExternalProtocol(
|
||||
url, web_contents_getter, child_id, frame_tree_node_id, navigation_data,
|
||||
is_main_frame, page_transition, has_user_gesture, initiating_origin,
|
||||
nullptr);
|
||||
is_main_frame, sandbox_flags, page_transition, has_user_gesture,
|
||||
initiating_origin, nullptr);
|
||||
}
|
||||
|
||||
bool ChromeContentBrowserClientCef::HandleExternalProtocol(
|
||||
content::WebContents::Getter web_contents_getter,
|
||||
int frame_tree_node_id,
|
||||
content::NavigationUIData* navigation_data,
|
||||
network::mojom::WebSandboxFlags sandbox_flags,
|
||||
const network::ResourceRequest& resource_request,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
|
||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver =
|
||||
@@ -277,7 +277,7 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
|
||||
web_contents_getter, frame_tree_node_id, resource_request,
|
||||
base::BindRepeating(HandleExternalProtocolHelper, base::Unretained(this),
|
||||
web_contents_getter, frame_tree_node_id,
|
||||
navigation_data, resource_request));
|
||||
navigation_data, sandbox_flags, resource_request));
|
||||
|
||||
net_service::ProxyURLLoaderFactory::CreateProxy(
|
||||
web_contents_getter, std::move(receiver), std::move(request_handler));
|
||||
@@ -293,13 +293,21 @@ ChromeContentBrowserClientCef::CreateThrottlesForNavigation(
|
||||
return throttles;
|
||||
}
|
||||
|
||||
void ChromeContentBrowserClientCef::ConfigureNetworkContextParams(
|
||||
bool ChromeContentBrowserClientCef::ConfigureNetworkContextParams(
|
||||
content::BrowserContext* context,
|
||||
bool in_memory,
|
||||
const base::FilePath& relative_partition_path,
|
||||
network::mojom::NetworkContextParams* network_context_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()) {
|
||||
// Cancel NetworkContext creation in
|
||||
// StoragePartitionImpl::InitNetworkContext.
|
||||
return false;
|
||||
}
|
||||
|
||||
ChromeContentBrowserClient::ConfigureNetworkContextParams(
|
||||
context, in_memory, relative_partition_path, network_context_params,
|
||||
cert_verifier_creation_params);
|
||||
@@ -319,6 +327,8 @@ void ChromeContentBrowserClientCef::ConfigureNetworkContextParams(
|
||||
accept_language_list != network_context_params->accept_language) {
|
||||
network_context_params->accept_language = accept_language_list;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::unique_ptr<content::LoginDelegate>
|
||||
|
@@ -63,6 +63,7 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
|
||||
int frame_tree_node_id,
|
||||
content::NavigationUIData* navigation_data,
|
||||
bool is_main_frame,
|
||||
network::mojom::WebSandboxFlags sandbox_flags,
|
||||
ui::PageTransition page_transition,
|
||||
bool has_user_gesture,
|
||||
const absl::optional<url::Origin>& initiating_origin,
|
||||
@@ -72,13 +73,14 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
|
||||
content::WebContents::Getter web_contents_getter,
|
||||
int frame_tree_node_id,
|
||||
content::NavigationUIData* navigation_data,
|
||||
network::mojom::WebSandboxFlags sandbox_flags,
|
||||
const network::ResourceRequest& request,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
|
||||
override;
|
||||
std::vector<std::unique_ptr<content::NavigationThrottle>>
|
||||
CreateThrottlesForNavigation(
|
||||
content::NavigationHandle* navigation_handle) override;
|
||||
void ConfigureNetworkContextParams(
|
||||
bool ConfigureNetworkContextParams(
|
||||
content::BrowserContext* context,
|
||||
bool in_memory,
|
||||
const base::FilePath& relative_partition_path,
|
||||
|
15
libcef/browser/chrome/views/chrome_views_util.cc
Normal file
15
libcef/browser/chrome/views/chrome_views_util.cc
Normal file
@@ -0,0 +1,15 @@
|
||||
// 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_views_util.h"
|
||||
|
||||
#include "libcef/browser/views/view_util.h"
|
||||
|
||||
namespace cef {
|
||||
|
||||
bool IsCefView(views::View* view) {
|
||||
return view_util::GetFor(view, /*find_known_parent=*/false) != nullptr;
|
||||
}
|
||||
|
||||
} // namespace cef
|
20
libcef/browser/chrome/views/chrome_views_util.h
Normal file
20
libcef/browser/chrome/views/chrome_views_util.h
Normal file
@@ -0,0 +1,20 @@
|
||||
// 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_VIEWS_H_
|
||||
#define CEF_LIBCEF_BROWSER_CHROME_VIEWS_CHROME_VIEWS_H_
|
||||
#pragma once
|
||||
|
||||
namespace views {
|
||||
class View;
|
||||
}
|
||||
|
||||
namespace cef {
|
||||
|
||||
// Returns true if |view| is a CefView.
|
||||
bool IsCefView(views::View* view);
|
||||
|
||||
} // namespace cef
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_CHROME_VIEWS_CHROME_VIEWS_H_
|
@@ -434,9 +434,6 @@ void CefContext::PopulateGlobalRequestContextSettings(
|
||||
settings->persist_user_preferences =
|
||||
settings_.persist_user_preferences ||
|
||||
command_line->HasSwitch(switches::kPersistUserPreferences);
|
||||
settings->ignore_certificate_errors =
|
||||
settings_.ignore_certificate_errors ||
|
||||
command_line->HasSwitch(switches::kIgnoreCertificateErrors);
|
||||
|
||||
CefString(&settings->cookieable_schemes_list) =
|
||||
CefString(&settings_.cookieable_schemes_list);
|
||||
|
@@ -11,13 +11,13 @@
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/json/json_writer.h"
|
||||
#include "base/json/values_util.h"
|
||||
#include "base/lazy_instance.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/task/post_task.h"
|
||||
#include "base/task/thread_pool.h"
|
||||
#include "base/threading/sequenced_task_runner_handle.h"
|
||||
#include "base/util/values/values_util.h"
|
||||
#include "base/values.h"
|
||||
#include "chrome/common/pref_names.h"
|
||||
#include "components/prefs/scoped_user_pref_update.h"
|
||||
@@ -83,7 +83,7 @@ void CefDevToolsFileManager::Save(const std::string& url,
|
||||
|
||||
const base::Value* path_value;
|
||||
if (file_map->Get(base::MD5String(url), &path_value)) {
|
||||
absl::optional<base::FilePath> path = util::ValueToFilePath(*path_value);
|
||||
absl::optional<base::FilePath> path = base::ValueToFilePath(*path_value);
|
||||
if (path)
|
||||
initial_path = std::move(*path);
|
||||
}
|
||||
@@ -145,7 +145,7 @@ void CefDevToolsFileManager::SaveAsFileSelected(const std::string& url,
|
||||
|
||||
DictionaryPrefUpdate update(prefs_, prefs::kDevToolsEditedFiles);
|
||||
base::DictionaryValue* files_map = update.Get();
|
||||
files_map->SetKey(base::MD5String(url), util::FilePathToValue(path));
|
||||
files_map->SetKey(base::MD5String(url), base::FilePathToValue(path));
|
||||
std::string file_system_path = path.AsUTF8Unsafe();
|
||||
std::move(callback).Run(file_system_path);
|
||||
file_task_runner_->PostTask(FROM_HERE,
|
||||
|
@@ -66,17 +66,22 @@
|
||||
|
||||
namespace {
|
||||
|
||||
// This constant should be in sync with the constant in
|
||||
// chrome/browser/devtools/devtools_ui_bindings.cc.
|
||||
constexpr size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4;
|
||||
|
||||
constexpr int kMaxLogLineLength = 1024;
|
||||
|
||||
static std::string GetFrontendURL() {
|
||||
return base::StringPrintf("%s://%s/devtools_app.html",
|
||||
content::kChromeDevToolsScheme,
|
||||
scheme::kChromeDevToolsHost);
|
||||
}
|
||||
|
||||
std::unique_ptr<base::DictionaryValue> BuildObjectForResponse(
|
||||
const net::HttpResponseHeaders* rh,
|
||||
bool success,
|
||||
int net_error) {
|
||||
auto response = std::make_unique<base::DictionaryValue>();
|
||||
base::DictionaryValue BuildObjectForResponse(const net::HttpResponseHeaders* rh,
|
||||
bool success,
|
||||
int net_error) {
|
||||
base::DictionaryValue response;
|
||||
int responseCode = 200;
|
||||
if (rh) {
|
||||
responseCode = rh->response_code();
|
||||
@@ -84,9 +89,9 @@ std::unique_ptr<base::DictionaryValue> BuildObjectForResponse(
|
||||
// In case of no headers, assume file:// URL and failed to load
|
||||
responseCode = 404;
|
||||
}
|
||||
response->SetInteger("statusCode", responseCode);
|
||||
response->SetInteger("netError", net_error);
|
||||
response->SetString("netErrorName", net::ErrorToString(net_error));
|
||||
response.SetInteger("statusCode", responseCode);
|
||||
response.SetInteger("netError", net_error);
|
||||
response.SetString("netErrorName", net::ErrorToString(net_error));
|
||||
|
||||
auto headers = std::make_unique<base::DictionaryValue>();
|
||||
size_t iterator = 0;
|
||||
@@ -97,12 +102,10 @@ std::unique_ptr<base::DictionaryValue> BuildObjectForResponse(
|
||||
while (rh && rh->EnumerateHeaderLines(&iterator, &name, &value))
|
||||
headers->SetString(name, value);
|
||||
|
||||
response->Set("headers", std::move(headers));
|
||||
response.Set("headers", std::move(headers));
|
||||
return response;
|
||||
}
|
||||
|
||||
const int kMaxLogLineLength = 1024;
|
||||
|
||||
void WriteTimestamp(std::stringstream& stream) {
|
||||
#if defined(OS_WIN)
|
||||
SYSTEMTIME local_time;
|
||||
@@ -206,15 +209,16 @@ class CefDevToolsFrontend::NetworkResourceLoader
|
||||
base::Value id(stream_id_);
|
||||
base::Value encodedValue(encoded);
|
||||
|
||||
bindings_->CallClientFunction("DevToolsAPI.streamWrite", &id, &chunkValue,
|
||||
&encodedValue);
|
||||
bindings_->CallClientFunction("DevToolsAPI", "streamWrite", std::move(id),
|
||||
std::move(chunkValue),
|
||||
std::move(encodedValue));
|
||||
std::move(resume).Run();
|
||||
}
|
||||
|
||||
void OnComplete(bool success) override {
|
||||
auto response = BuildObjectForResponse(response_headers_.get(), success,
|
||||
loader_->NetError());
|
||||
bindings_->SendMessageAck(request_id_, response.get());
|
||||
bindings_->SendMessageAck(request_id_, std::move(response));
|
||||
|
||||
bindings_->loaders_.erase(bindings_->loaders_.find(this));
|
||||
}
|
||||
@@ -230,10 +234,6 @@ class CefDevToolsFrontend::NetworkResourceLoader
|
||||
DISALLOW_COPY_AND_ASSIGN(NetworkResourceLoader);
|
||||
};
|
||||
|
||||
// This constant should be in sync with
|
||||
// the constant at devtools_ui_bindings.cc.
|
||||
const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4;
|
||||
|
||||
// static
|
||||
CefDevToolsFrontend* CefDevToolsFrontend::Show(
|
||||
AlloyBrowserHostImpl* inspected_browser,
|
||||
@@ -368,44 +368,53 @@ void CefDevToolsFrontend::WebContentsDestroyed() {
|
||||
|
||||
void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
base::Value message) {
|
||||
std::string method;
|
||||
base::ListValue* params = nullptr;
|
||||
base::DictionaryValue* dict = nullptr;
|
||||
if (!message.GetAsDictionary(&dict) || !dict->GetString("method", &method)) {
|
||||
if (!message.is_dict())
|
||||
return;
|
||||
const std::string* method = message.FindStringKey("method");
|
||||
if (!method)
|
||||
return;
|
||||
}
|
||||
int request_id = 0;
|
||||
dict->GetInteger("id", &request_id);
|
||||
dict->GetList("params", ¶ms);
|
||||
|
||||
if (method == "dispatchProtocolMessage" && params && params->GetSize() == 1) {
|
||||
std::string protocol_message;
|
||||
if (!agent_host_ || !params->GetString(0, &protocol_message))
|
||||
int request_id = message.FindIntKey("id").value_or(0);
|
||||
base::Value* params_value = message.FindListKey("params");
|
||||
|
||||
// Since we've received message by value, we can take the list.
|
||||
base::Value::ListStorage params;
|
||||
if (params_value) {
|
||||
params = std::move(*params_value).TakeList();
|
||||
}
|
||||
|
||||
if (*method == "dispatchProtocolMessage") {
|
||||
if (params.size() < 1)
|
||||
return;
|
||||
const std::string* protocol_message = params[0].GetIfString();
|
||||
if (!agent_host_ || !protocol_message)
|
||||
return;
|
||||
if (ProtocolLoggingEnabled()) {
|
||||
LogProtocolMessage(ProtocolMessageType::METHOD, protocol_message);
|
||||
LogProtocolMessage(ProtocolMessageType::METHOD, *protocol_message);
|
||||
}
|
||||
agent_host_->DispatchProtocolMessage(
|
||||
this, base::as_bytes(base::make_span(protocol_message)));
|
||||
} else if (method == "loadCompleted") {
|
||||
this, base::as_bytes(base::make_span(*protocol_message)));
|
||||
} else if (*method == "loadCompleted") {
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
||||
u"DevToolsAPI.setUseSoftMenu(true);", base::NullCallback());
|
||||
} else if (method == "loadNetworkResource" && params->GetSize() == 3) {
|
||||
} else if (*method == "loadNetworkResource") {
|
||||
if (params.size() < 3)
|
||||
return;
|
||||
|
||||
// TODO(pfeldman): handle some of the embedder messages in content.
|
||||
std::string url;
|
||||
std::string headers;
|
||||
int stream_id;
|
||||
if (!params->GetString(0, &url) || !params->GetString(1, &headers) ||
|
||||
!params->GetInteger(2, &stream_id)) {
|
||||
const std::string* url = params[0].GetIfString();
|
||||
const std::string* headers = params[1].GetIfString();
|
||||
absl::optional<const int> stream_id = params[2].GetIfInt();
|
||||
if (!url || !headers || !stream_id.has_value()) {
|
||||
return;
|
||||
}
|
||||
|
||||
GURL gurl(url);
|
||||
GURL gurl(*url);
|
||||
if (!gurl.is_valid()) {
|
||||
base::DictionaryValue response;
|
||||
response.SetInteger("statusCode", 404);
|
||||
response.SetBoolean("urlValid", false);
|
||||
SendMessageAck(request_id, &response);
|
||||
SendMessageAck(request_id, std::move(response));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -442,7 +451,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
// implementation. We really need to pass proper first party origin from
|
||||
// the front-end.
|
||||
resource_request->site_for_cookies = net::SiteForCookies::FromUrl(gurl);
|
||||
resource_request->headers.AddHeadersFromString(headers);
|
||||
resource_request->headers.AddHeadersFromString(*headers);
|
||||
|
||||
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory;
|
||||
if (gurl.SchemeIsFile()) {
|
||||
@@ -456,7 +465,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
} else if (content::HasWebUIScheme(gurl)) {
|
||||
base::DictionaryValue response;
|
||||
response.SetInteger("statusCode", 403);
|
||||
SendMessageAck(request_id, &response);
|
||||
SendMessageAck(request_id, std::move(response));
|
||||
return;
|
||||
} else {
|
||||
auto* partition =
|
||||
@@ -467,64 +476,72 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
auto simple_url_loader = network::SimpleURLLoader::Create(
|
||||
std::move(resource_request), traffic_annotation);
|
||||
auto resource_loader = std::make_unique<NetworkResourceLoader>(
|
||||
stream_id, this, std::move(simple_url_loader), url_loader_factory.get(),
|
||||
request_id);
|
||||
*stream_id, this, std::move(simple_url_loader),
|
||||
url_loader_factory.get(), request_id);
|
||||
loaders_.insert(std::move(resource_loader));
|
||||
return;
|
||||
} else if (method == "getPreferences") {
|
||||
SendMessageAck(request_id,
|
||||
GetPrefs()->GetDictionary(prefs::kDevToolsPreferences));
|
||||
} else if (*method == "getPreferences") {
|
||||
SendMessageAck(
|
||||
request_id,
|
||||
GetPrefs()->GetDictionary(prefs::kDevToolsPreferences)->Clone());
|
||||
return;
|
||||
} else if (method == "setPreference") {
|
||||
std::string name;
|
||||
std::string value;
|
||||
if (!params->GetString(0, &name) || !params->GetString(1, &value)) {
|
||||
} else if (*method == "setPreference") {
|
||||
if (params.size() < 2)
|
||||
return;
|
||||
}
|
||||
const std::string* name = params[0].GetIfString();
|
||||
|
||||
// We're just setting params[1] as a value anyways, so just make sure it's
|
||||
// the type we want, but don't worry about getting it.
|
||||
if (!name || !params[1].is_string())
|
||||
return;
|
||||
|
||||
DictionaryPrefUpdate update(GetPrefs(), prefs::kDevToolsPreferences);
|
||||
update.Get()->SetKey(name, base::Value(value));
|
||||
} else if (method == "removePreference") {
|
||||
std::string name;
|
||||
if (!params->GetString(0, &name))
|
||||
update.Get()->SetKey(*name, std::move(params[1]));
|
||||
} else if (*method == "removePreference") {
|
||||
const std::string* name = params[0].GetIfString();
|
||||
if (!name)
|
||||
return;
|
||||
DictionaryPrefUpdate update(GetPrefs(), prefs::kDevToolsPreferences);
|
||||
update.Get()->RemoveWithoutPathExpansion(name, nullptr);
|
||||
} else if (method == "requestFileSystems") {
|
||||
update.Get()->RemoveKey(*name);
|
||||
} else if (*method == "requestFileSystems") {
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
||||
u"DevToolsAPI.fileSystemsLoaded([]);", base::NullCallback());
|
||||
} else if (method == "reattach") {
|
||||
} else if (*method == "reattach") {
|
||||
if (!agent_host_)
|
||||
return;
|
||||
agent_host_->DetachClient(this);
|
||||
agent_host_->AttachClient(this);
|
||||
} else if (method == "registerExtensionsAPI") {
|
||||
std::string origin;
|
||||
std::string script;
|
||||
if (!params->GetString(0, &origin) || !params->GetString(1, &script))
|
||||
} else if (*method == "registerExtensionsAPI") {
|
||||
if (params.size() < 2)
|
||||
return;
|
||||
extensions_api_[origin + "/"] = script;
|
||||
} else if (method == "save" && params->GetSize() == 3) {
|
||||
std::string url;
|
||||
std::string content;
|
||||
bool save_as;
|
||||
if (!params->GetString(0, &url) || !params->GetString(1, &content) ||
|
||||
!params->GetBoolean(2, &save_as)) {
|
||||
const std::string* origin = params[0].GetIfString();
|
||||
const std::string* script = params[1].GetIfString();
|
||||
if (!origin || !script)
|
||||
return;
|
||||
}
|
||||
file_manager_.SaveToFile(url, content, save_as);
|
||||
} else if (method == "append" && params->GetSize() == 2) {
|
||||
std::string url;
|
||||
std::string content;
|
||||
if (!params->GetString(0, &url) || !params->GetString(1, &content)) {
|
||||
extensions_api_[*origin + "/"] = *script;
|
||||
} else if (*method == "save") {
|
||||
if (params.size() < 3)
|
||||
return;
|
||||
}
|
||||
file_manager_.AppendToFile(url, content);
|
||||
const std::string* url = params[0].GetIfString();
|
||||
const std::string* content = params[1].GetIfString();
|
||||
absl::optional<bool> save_as = params[2].GetIfBool();
|
||||
if (!url || !content || !save_as.has_value())
|
||||
return;
|
||||
file_manager_.SaveToFile(*url, *content, *save_as);
|
||||
} else if (*method == "append") {
|
||||
if (params.size() < 2)
|
||||
return;
|
||||
const std::string* url = params[0].GetIfString();
|
||||
const std::string* content = params[1].GetIfString();
|
||||
if (!url || !content)
|
||||
return;
|
||||
file_manager_.AppendToFile(*url, *content);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (request_id)
|
||||
SendMessageAck(request_id, nullptr);
|
||||
SendMessageAck(request_id, base::Value());
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::DispatchProtocolMessage(
|
||||
@@ -545,57 +562,54 @@ void CefDevToolsFrontend::DispatchProtocolMessage(
|
||||
: ProtocolMessageType::RESULT,
|
||||
str_message);
|
||||
}
|
||||
if (str_message.length() < kMaxMessageChunkSize) {
|
||||
std::string param;
|
||||
base::EscapeJSONString(str_message, true, ¶m);
|
||||
std::string code = "DevToolsAPI.dispatchMessage(" + param + ");";
|
||||
std::u16string javascript = base::UTF8ToUTF16(code);
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
||||
javascript, base::NullCallback());
|
||||
return;
|
||||
}
|
||||
|
||||
size_t total_size = str_message.length();
|
||||
for (size_t pos = 0; pos < str_message.length();
|
||||
pos += kMaxMessageChunkSize) {
|
||||
std::string param;
|
||||
base::EscapeJSONString(str_message.substr(pos, kMaxMessageChunkSize), true,
|
||||
¶m);
|
||||
std::string code = "DevToolsAPI.dispatchMessageChunk(" + param + "," +
|
||||
std::to_string(pos ? 0 : total_size) + ");";
|
||||
std::u16string javascript = base::UTF8ToUTF16(code);
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
||||
javascript, base::NullCallback());
|
||||
if (str_message.length() < kMaxMessageChunkSize) {
|
||||
CallClientFunction("DevToolsAPI", "dispatchMessage",
|
||||
base::Value(std::string(str_message)));
|
||||
} else {
|
||||
size_t total_size = str_message.length();
|
||||
for (size_t pos = 0; pos < str_message.length();
|
||||
pos += kMaxMessageChunkSize) {
|
||||
base::StringPiece str_message_chunk =
|
||||
str_message.substr(pos, kMaxMessageChunkSize);
|
||||
|
||||
CallClientFunction(
|
||||
"DevToolsAPI", "dispatchMessageChunk",
|
||||
base::Value(std::string(str_message_chunk)),
|
||||
base::Value(base::NumberToString(pos ? 0 : total_size)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::CallClientFunction(const std::string& function_name,
|
||||
const base::Value* arg1,
|
||||
const base::Value* arg2,
|
||||
const base::Value* arg3) {
|
||||
std::string javascript = function_name + "(";
|
||||
if (arg1) {
|
||||
std::string json;
|
||||
base::JSONWriter::Write(*arg1, &json);
|
||||
javascript.append(json);
|
||||
if (arg2) {
|
||||
base::JSONWriter::Write(*arg2, &json);
|
||||
javascript.append(", ").append(json);
|
||||
if (arg3) {
|
||||
base::JSONWriter::Write(*arg3, &json);
|
||||
javascript.append(", ").append(json);
|
||||
void CefDevToolsFrontend::CallClientFunction(
|
||||
const std::string& object_name,
|
||||
const std::string& method_name,
|
||||
base::Value arg1,
|
||||
base::Value arg2,
|
||||
base::Value arg3,
|
||||
base::OnceCallback<void(base::Value)> cb) {
|
||||
std::string javascript;
|
||||
|
||||
web_contents()->GetMainFrame()->AllowInjectingJavaScript();
|
||||
|
||||
base::Value arguments(base::Value::Type::LIST);
|
||||
if (!arg1.is_none()) {
|
||||
arguments.Append(std::move(arg1));
|
||||
if (!arg2.is_none()) {
|
||||
arguments.Append(std::move(arg2));
|
||||
if (!arg3.is_none()) {
|
||||
arguments.Append(std::move(arg3));
|
||||
}
|
||||
}
|
||||
}
|
||||
javascript.append(");");
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
||||
base::UTF8ToUTF16(javascript), base::NullCallback());
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScriptMethod(
|
||||
base::ASCIIToUTF16(object_name), base::ASCIIToUTF16(method_name),
|
||||
std::move(arguments), std::move(cb));
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::SendMessageAck(int request_id,
|
||||
const base::Value* arg) {
|
||||
base::Value id_value(request_id);
|
||||
CallClientFunction("DevToolsAPI.embedderMessageAck", &id_value, arg, nullptr);
|
||||
void CefDevToolsFrontend::SendMessageAck(int request_id, base::Value arg) {
|
||||
CallClientFunction("DevToolsAPI", "embedderMessageAck",
|
||||
base::Value(request_id), std::move(arg));
|
||||
}
|
||||
|
||||
bool CefDevToolsFrontend::ProtocolLoggingEnabled() const {
|
||||
|
@@ -54,10 +54,13 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
|
||||
void InspectElementAt(int x, int y);
|
||||
void Close();
|
||||
|
||||
void CallClientFunction(const std::string& function_name,
|
||||
const base::Value* arg1,
|
||||
const base::Value* arg2,
|
||||
const base::Value* arg3);
|
||||
void CallClientFunction(
|
||||
const std::string& object_name,
|
||||
const std::string& method_name,
|
||||
const base::Value arg1 = {},
|
||||
const base::Value arg2 = {},
|
||||
const base::Value arg3 = {},
|
||||
base::OnceCallback<void(base::Value)> cb = base::NullCallback());
|
||||
|
||||
private:
|
||||
CefDevToolsFrontend(AlloyBrowserHostImpl* frontend_browser,
|
||||
@@ -80,7 +83,7 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
|
||||
content::RenderFrameHost* render_frame_host) override;
|
||||
void WebContentsDestroyed() override;
|
||||
|
||||
void SendMessageAck(int request_id, const base::Value* arg1);
|
||||
void SendMessageAck(int request_id, base::Value arg);
|
||||
|
||||
bool ProtocolLoggingEnabled() const;
|
||||
void LogProtocolMessage(ProtocolMessageType type,
|
||||
|
@@ -8,11 +8,13 @@
|
||||
#include <stddef.h>
|
||||
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
|
||||
#include "components/value_store/value_store_factory.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "extensions/browser/api/storage/backend_task_runner.h"
|
||||
#include "extensions/browser/api/storage/value_store_util.h"
|
||||
#include "extensions/browser/api/storage/weak_unlimited_settings_storage.h"
|
||||
#include "extensions/browser/value_store/value_store_factory.h"
|
||||
#include "extensions/common/api/storage.h"
|
||||
#include "extensions/common/extension.h"
|
||||
#include "extensions/common/permissions/permissions_data.h"
|
||||
@@ -37,8 +39,8 @@ SettingsStorageQuotaEnforcer::Limits GetLocalQuotaLimits() {
|
||||
} // namespace
|
||||
|
||||
SyncValueStoreCache::SyncValueStoreCache(
|
||||
const scoped_refptr<ValueStoreFactory>& factory)
|
||||
: storage_factory_(factory), quota_(GetLocalQuotaLimits()) {
|
||||
scoped_refptr<value_store::ValueStoreFactory> factory)
|
||||
: storage_factory_(std::move(factory)), quota_(GetLocalQuotaLimits()) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
}
|
||||
|
||||
@@ -51,7 +53,7 @@ void SyncValueStoreCache::RunWithValueStoreForExtension(
|
||||
scoped_refptr<const Extension> extension) {
|
||||
DCHECK(IsOnBackendSequence());
|
||||
|
||||
ValueStore* storage = GetStorage(extension.get());
|
||||
value_store::ValueStore* storage = GetStorage(extension.get());
|
||||
|
||||
// A neat way to implement unlimited storage; if the extension has the
|
||||
// unlimited storage permission, force through all calls to Set().
|
||||
@@ -67,29 +69,34 @@ void SyncValueStoreCache::RunWithValueStoreForExtension(
|
||||
void SyncValueStoreCache::DeleteStorageSoon(const std::string& extension_id) {
|
||||
DCHECK(IsOnBackendSequence());
|
||||
storage_map_.erase(extension_id);
|
||||
storage_factory_->DeleteSettings(settings_namespace::SYNC,
|
||||
ValueStoreFactory::ModelType::APP,
|
||||
extension_id);
|
||||
storage_factory_->DeleteSettings(settings_namespace::SYNC,
|
||||
ValueStoreFactory::ModelType::EXTENSION,
|
||||
extension_id);
|
||||
|
||||
value_store_util::DeleteValueStore(settings_namespace::SYNC,
|
||||
value_store_util::ModelType::APP,
|
||||
extension_id, storage_factory_);
|
||||
|
||||
value_store_util::DeleteValueStore(settings_namespace::SYNC,
|
||||
value_store_util::ModelType::EXTENSION,
|
||||
extension_id, storage_factory_);
|
||||
}
|
||||
|
||||
ValueStore* SyncValueStoreCache::GetStorage(const Extension* extension) {
|
||||
StorageMap::iterator iter = storage_map_.find(extension->id());
|
||||
value_store::ValueStore* SyncValueStoreCache::GetStorage(
|
||||
const Extension* extension) {
|
||||
auto iter = storage_map_.find(extension->id());
|
||||
if (iter != storage_map_.end())
|
||||
return iter->second.get();
|
||||
|
||||
ValueStoreFactory::ModelType model_type =
|
||||
extension->is_app() ? ValueStoreFactory::ModelType::APP
|
||||
: ValueStoreFactory::ModelType::EXTENSION;
|
||||
std::unique_ptr<ValueStore> store = storage_factory_->CreateSettingsStore(
|
||||
settings_namespace::SYNC, model_type, extension->id());
|
||||
value_store_util::ModelType model_type =
|
||||
extension->is_app() ? value_store_util::ModelType::APP
|
||||
: value_store_util::ModelType::EXTENSION;
|
||||
std::unique_ptr<value_store::ValueStore> store =
|
||||
value_store_util::CreateSettingsStore(settings_namespace::LOCAL,
|
||||
model_type, extension->id(),
|
||||
storage_factory_);
|
||||
std::unique_ptr<SettingsStorageQuotaEnforcer> storage(
|
||||
new SettingsStorageQuotaEnforcer(quota_, std::move(store)));
|
||||
DCHECK(storage.get());
|
||||
|
||||
ValueStore* storage_ptr = storage.get();
|
||||
value_store::ValueStore* storage_ptr = storage.get();
|
||||
storage_map_[extension->id()] = std::move(storage);
|
||||
return storage_ptr;
|
||||
}
|
||||
|
@@ -14,10 +14,11 @@
|
||||
#include "extensions/browser/api/storage/settings_storage_quota_enforcer.h"
|
||||
#include "extensions/browser/api/storage/value_store_cache.h"
|
||||
|
||||
namespace extensions {
|
||||
|
||||
namespace value_store {
|
||||
class ValueStoreFactory;
|
||||
}
|
||||
|
||||
namespace extensions {
|
||||
namespace cef {
|
||||
|
||||
// Based on LocalValueStoreCache
|
||||
@@ -25,7 +26,8 @@ namespace cef {
|
||||
// another for extensions. Each backend takes care of persistence.
|
||||
class SyncValueStoreCache : public ValueStoreCache {
|
||||
public:
|
||||
explicit SyncValueStoreCache(const scoped_refptr<ValueStoreFactory>& factory);
|
||||
explicit SyncValueStoreCache(
|
||||
scoped_refptr<value_store::ValueStoreFactory> factory);
|
||||
~SyncValueStoreCache() override;
|
||||
|
||||
// ValueStoreCache implementation:
|
||||
@@ -35,12 +37,13 @@ class SyncValueStoreCache : public ValueStoreCache {
|
||||
void DeleteStorageSoon(const std::string& extension_id) override;
|
||||
|
||||
private:
|
||||
using StorageMap = std::map<std::string, std::unique_ptr<ValueStore>>;
|
||||
using StorageMap =
|
||||
std::map<std::string, std::unique_ptr<value_store::ValueStore>>;
|
||||
|
||||
ValueStore* GetStorage(const Extension* extension);
|
||||
value_store::ValueStore* GetStorage(const Extension* extension);
|
||||
|
||||
// The Factory to use for creating new ValueStores.
|
||||
const scoped_refptr<ValueStoreFactory> storage_factory_;
|
||||
const scoped_refptr<value_store::ValueStoreFactory> storage_factory_;
|
||||
|
||||
// Quota limits (see SettingsStorageQuotaEnforcer).
|
||||
const SettingsStorageQuotaEnforcer::Limits quota_;
|
||||
@@ -50,6 +53,7 @@ class SyncValueStoreCache : public ValueStoreCache {
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(SyncValueStoreCache);
|
||||
};
|
||||
|
||||
} // namespace cef
|
||||
} // namespace extensions
|
||||
|
||||
|
@@ -78,7 +78,7 @@ TabsCreateFunction::TabsCreateFunction() : cef_details_(this) {}
|
||||
|
||||
ExtensionFunction::ResponseAction TabsCreateFunction::Run() {
|
||||
std::unique_ptr<tabs::Create::Params> params(
|
||||
tabs::Create::Params::Create(*args_));
|
||||
tabs::Create::Params::Create(args()));
|
||||
EXTENSION_FUNCTION_VALIDATE(params.get());
|
||||
|
||||
CefExtensionFunctionDetails::OpenTabParams options;
|
||||
@@ -119,7 +119,7 @@ content::WebContents* BaseAPIFunction::GetWebContents(int tab_id) {
|
||||
|
||||
ExtensionFunction::ResponseAction TabsUpdateFunction::Run() {
|
||||
std::unique_ptr<tabs::Update::Params> params(
|
||||
tabs::Update::Params::Create(*args_));
|
||||
tabs::Update::Params::Create(args()));
|
||||
EXTENSION_FUNCTION_VALIDATE(params.get());
|
||||
|
||||
tab_id_ = params->tab_id ? *params->tab_id : -1;
|
||||
@@ -256,17 +256,26 @@ ExecuteCodeFunction::InitResult ExecuteCodeInTabFunction::Init() {
|
||||
if (init_result_)
|
||||
return init_result_.value();
|
||||
|
||||
// |tab_id| is optional so it's ok if it's not there.
|
||||
int tab_id = -1;
|
||||
if (args_->GetInteger(0, &tab_id) && tab_id < 0)
|
||||
if (args().size() < 2)
|
||||
return set_init_result(VALIDATION_FAILURE);
|
||||
|
||||
const auto& tab_id_value = args()[0];
|
||||
// |tab_id| is optional so it's ok if it's not there.
|
||||
int tab_id = -1;
|
||||
if (tab_id_value.is_int()) {
|
||||
// But if it is present, it needs to be non-negative.
|
||||
tab_id = tab_id_value.GetInt();
|
||||
if (tab_id < 0) {
|
||||
return set_init_result(VALIDATION_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
// |details| are not optional.
|
||||
base::DictionaryValue* details_value = nullptr;
|
||||
if (!args_->GetDictionary(1, &details_value))
|
||||
const base::Value& details_value = args()[1];
|
||||
if (!details_value.is_dict())
|
||||
return set_init_result(VALIDATION_FAILURE);
|
||||
std::unique_ptr<InjectDetails> details(new InjectDetails());
|
||||
if (!InjectDetails::Populate(*details_value, details.get()))
|
||||
if (!InjectDetails::Populate(details_value, details.get()))
|
||||
return set_init_result(VALIDATION_FAILURE);
|
||||
|
||||
// Find a browser that we can access, or fail with error.
|
||||
@@ -404,7 +413,7 @@ bool TabsRemoveCSSFunction::ShouldRemoveCSS() const {
|
||||
|
||||
ExtensionFunction::ResponseAction TabsSetZoomFunction::Run() {
|
||||
std::unique_ptr<tabs::SetZoom::Params> params(
|
||||
tabs::SetZoom::Params::Create(*args_));
|
||||
tabs::SetZoom::Params::Create(args()));
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
int tab_id = params->tab_id ? *params->tab_id : -1;
|
||||
@@ -434,7 +443,7 @@ ExtensionFunction::ResponseAction TabsSetZoomFunction::Run() {
|
||||
|
||||
ExtensionFunction::ResponseAction TabsGetZoomFunction::Run() {
|
||||
std::unique_ptr<tabs::GetZoom::Params> params(
|
||||
tabs::GetZoom::Params::Create(*args_));
|
||||
tabs::GetZoom::Params::Create(args()));
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
int tab_id = params->tab_id ? *params->tab_id : -1;
|
||||
@@ -453,7 +462,7 @@ ExtensionFunction::ResponseAction TabsSetZoomSettingsFunction::Run() {
|
||||
using api::tabs::ZoomSettings;
|
||||
|
||||
std::unique_ptr<tabs::SetZoomSettings::Params> params(
|
||||
tabs::SetZoomSettings::Params::Create(*args_));
|
||||
tabs::SetZoomSettings::Params::Create(args()));
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
int tab_id = params->tab_id ? *params->tab_id : -1;
|
||||
@@ -502,7 +511,7 @@ ExtensionFunction::ResponseAction TabsSetZoomSettingsFunction::Run() {
|
||||
|
||||
ExtensionFunction::ResponseAction TabsGetZoomSettingsFunction::Run() {
|
||||
std::unique_ptr<tabs::GetZoomSettings::Params> params(
|
||||
tabs::GetZoomSettings::Params::Create(*args_));
|
||||
tabs::GetZoomSettings::Params::Create(args()));
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
int tab_id = params->tab_id ? *params->tab_id : -1;
|
||||
|
@@ -77,7 +77,7 @@ void CefBrowserPlatformDelegateBackground::SendTouchEvent(
|
||||
// Nothing to do here.
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateBackground::SendFocusEvent(bool setFocus) {
|
||||
void CefBrowserPlatformDelegateBackground::SetFocus(bool setFocus) {
|
||||
// Nothing to do here.
|
||||
}
|
||||
|
||||
|
@@ -33,7 +33,7 @@ class CefBrowserPlatformDelegateBackground
|
||||
int deltaX,
|
||||
int deltaY) override;
|
||||
void SendTouchEvent(const CefTouchEvent& event) override;
|
||||
void SendFocusEvent(bool setFocus) override;
|
||||
void SetFocus(bool setFocus) override;
|
||||
gfx::Point GetScreenPoint(const gfx::Point& view) const override;
|
||||
void ViewText(const std::string& text) override;
|
||||
bool HandleKeyboardEvent(
|
||||
|
@@ -41,7 +41,6 @@
|
||||
#include "extensions/browser/null_app_sorting.h"
|
||||
#include "extensions/browser/quota_service.h"
|
||||
#include "extensions/browser/renderer_startup_helper.h"
|
||||
#include "extensions/browser/runtime_data.h"
|
||||
#include "extensions/browser/service_worker_manager.h"
|
||||
#include "extensions/browser/state_store.h"
|
||||
#include "extensions/browser/unloaded_extension_reason.h"
|
||||
@@ -387,7 +386,6 @@ void CefExtensionSystem::Shutdown() {
|
||||
void CefExtensionSystem::InitForRegularProfile(bool extensions_enabled) {
|
||||
DCHECK(!initialized_);
|
||||
service_worker_manager_.reset(new ServiceWorkerManager(browser_context_));
|
||||
runtime_data_.reset(new RuntimeData(registry_));
|
||||
quota_service_.reset(new QuotaService);
|
||||
app_sorting_.reset(new NullAppSorting);
|
||||
}
|
||||
@@ -396,10 +394,6 @@ ExtensionService* CefExtensionSystem::extension_service() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RuntimeData* CefExtensionSystem::runtime_data() {
|
||||
return runtime_data_.get();
|
||||
}
|
||||
|
||||
ManagementPolicy* CefExtensionSystem::management_policy() {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -420,7 +414,12 @@ StateStore* CefExtensionSystem::rules_store() {
|
||||
return rules_store_.get();
|
||||
}
|
||||
|
||||
scoped_refptr<ValueStoreFactory> CefExtensionSystem::store_factory() {
|
||||
StateStore* CefExtensionSystem::dynamic_user_scripts_store() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
scoped_refptr<value_store::ValueStoreFactory>
|
||||
CefExtensionSystem::store_factory() {
|
||||
return store_factory_;
|
||||
}
|
||||
|
||||
@@ -518,18 +517,19 @@ CefExtensionSystem::ComponentExtensionInfo::ComponentExtensionInfo(
|
||||
}
|
||||
|
||||
void CefExtensionSystem::InitPrefs() {
|
||||
store_factory_ = new CefValueStoreFactory(browser_context_->GetPath());
|
||||
store_factory_ =
|
||||
new value_store::CefValueStoreFactory(browser_context_->GetPath());
|
||||
|
||||
Profile* profile = Profile::FromBrowserContext(browser_context_);
|
||||
|
||||
// Two state stores. The latter, which contains declarative rules, must be
|
||||
// loaded immediately so that the rules are ready before we issue network
|
||||
// requests.
|
||||
state_store_.reset(new StateStore(
|
||||
profile, store_factory_, ValueStoreFrontend::BackendType::STATE, true));
|
||||
state_store_ = std::make_unique<StateStore>(
|
||||
profile, store_factory_, StateStore::BackendType::STATE, true);
|
||||
|
||||
rules_store_.reset(new StateStore(
|
||||
profile, store_factory_, ValueStoreFrontend::BackendType::RULES, false));
|
||||
rules_store_ = std::make_unique<StateStore>(
|
||||
profile, store_factory_, StateStore::BackendType::RULES, false);
|
||||
}
|
||||
|
||||
// Implementation based on ComponentLoader::CreateExtension.
|
||||
|
@@ -84,13 +84,13 @@ class CefExtensionSystem : public ExtensionSystem {
|
||||
// ExtensionSystem implementation:
|
||||
void InitForRegularProfile(bool extensions_enabled) override;
|
||||
ExtensionService* extension_service() override;
|
||||
RuntimeData* runtime_data() override;
|
||||
ManagementPolicy* management_policy() override;
|
||||
ServiceWorkerManager* service_worker_manager() override;
|
||||
UserScriptManager* user_script_manager() override;
|
||||
StateStore* state_store() override;
|
||||
StateStore* rules_store() override;
|
||||
scoped_refptr<ValueStoreFactory> store_factory() override;
|
||||
StateStore* dynamic_user_scripts_store() override;
|
||||
scoped_refptr<value_store::ValueStoreFactory> store_factory() override;
|
||||
InfoMap* info_map() override;
|
||||
QuotaService* quota_service() override;
|
||||
AppSorting* app_sorting() override;
|
||||
@@ -170,13 +170,12 @@ class CefExtensionSystem : public ExtensionSystem {
|
||||
scoped_refptr<InfoMap> info_map_;
|
||||
|
||||
std::unique_ptr<ServiceWorkerManager> service_worker_manager_;
|
||||
std::unique_ptr<RuntimeData> runtime_data_;
|
||||
std::unique_ptr<QuotaService> quota_service_;
|
||||
std::unique_ptr<AppSorting> app_sorting_;
|
||||
|
||||
std::unique_ptr<StateStore> state_store_;
|
||||
std::unique_ptr<StateStore> rules_store_;
|
||||
scoped_refptr<ValueStoreFactory> store_factory_;
|
||||
scoped_refptr<value_store::ValueStoreFactory> store_factory_;
|
||||
|
||||
// Signaled when the extension system has completed its startup tasks.
|
||||
base::OneShotEvent ready_;
|
||||
|
@@ -9,9 +9,8 @@
|
||||
|
||||
#include "content/public/browser/notification_source.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "extensions/browser/extension_system.h"
|
||||
#include "extensions/browser/notification_types.h"
|
||||
#include "extensions/browser/runtime_data.h"
|
||||
#include "extensions/browser/process_util.h"
|
||||
#include "third_party/blink/public/common/input/web_gesture_event.h"
|
||||
|
||||
using content::NativeWebKeyboardEvent;
|
||||
@@ -44,9 +43,9 @@ void CefExtensionViewHost::OnDidStopFirstLoad() {
|
||||
}
|
||||
|
||||
void CefExtensionViewHost::LoadInitialURL() {
|
||||
if (!ExtensionSystem::Get(browser_context())
|
||||
->runtime_data()
|
||||
->IsBackgroundPageReady(extension())) {
|
||||
if (process_util::GetPersistentBackgroundPageState(*extension(),
|
||||
browser_context()) ==
|
||||
process_util::PersistentBackgroundPageState::kNotReady) {
|
||||
// Make sure the background page loads before any others.
|
||||
registrar_.Add(this,
|
||||
extensions::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY,
|
||||
@@ -86,9 +85,9 @@ void CefExtensionViewHost::Observe(
|
||||
const content::NotificationSource& source,
|
||||
const content::NotificationDetails& details) {
|
||||
DCHECK_EQ(type, extensions::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY);
|
||||
DCHECK(ExtensionSystem::Get(browser_context())
|
||||
->runtime_data()
|
||||
->IsBackgroundPageReady(extension()));
|
||||
DCHECK_EQ(process_util::PersistentBackgroundPageState::kReady,
|
||||
process_util::GetPersistentBackgroundPageState(*extension(),
|
||||
browser_context()));
|
||||
LoadInitialURL();
|
||||
}
|
||||
|
||||
|
@@ -52,6 +52,6 @@ void CefExtensionWebContentsObserver::RenderFrameCreated(
|
||||
}
|
||||
}
|
||||
|
||||
WEB_CONTENTS_USER_DATA_KEY_IMPL(CefExtensionWebContentsObserver)
|
||||
WEB_CONTENTS_USER_DATA_KEY_IMPL(CefExtensionWebContentsObserver);
|
||||
|
||||
} // namespace extensions
|
||||
|
@@ -65,7 +65,7 @@ void CefExtensionsAPIClient::AttachWebContentsHelpers(
|
||||
|
||||
void CefExtensionsAPIClient::AddAdditionalValueStoreCaches(
|
||||
content::BrowserContext* context,
|
||||
const scoped_refptr<ValueStoreFactory>& factory,
|
||||
const scoped_refptr<value_store::ValueStoreFactory>& factory,
|
||||
const scoped_refptr<base::ObserverListThreadSafe<SettingsObserver>>&
|
||||
observers,
|
||||
std::map<settings_namespace::Namespace, ValueStoreCache*>* caches) {
|
||||
|
@@ -6,6 +6,7 @@
|
||||
#ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSIONS_API_CLIENT_H_
|
||||
#define CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSIONS_API_CLIENT_H_
|
||||
|
||||
#include "components/value_store/value_store_factory.h"
|
||||
#include "extensions/browser/api/extensions_api_client.h"
|
||||
|
||||
namespace extensions {
|
||||
@@ -31,7 +32,7 @@ class CefExtensionsAPIClient : public ExtensionsAPIClient {
|
||||
// to |caches|. By default adds nothing.
|
||||
void AddAdditionalValueStoreCaches(
|
||||
content::BrowserContext* context,
|
||||
const scoped_refptr<ValueStoreFactory>& factory,
|
||||
const scoped_refptr<value_store::ValueStoreFactory>& factory,
|
||||
const scoped_refptr<base::ObserverListThreadSafe<SettingsObserver>>&
|
||||
observers,
|
||||
std::map<settings_namespace::Namespace, ValueStoreCache*>* caches)
|
||||
|
@@ -5,12 +5,14 @@
|
||||
|
||||
#include "libcef/browser/extensions/value_store/cef_value_store.h"
|
||||
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
#include <utility>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/notreached.h"
|
||||
|
||||
namespace value_store {
|
||||
|
||||
namespace {
|
||||
|
||||
const char kGenericErrorMessage[] = "CefValueStore configured to error";
|
||||
@@ -23,9 +25,8 @@ ValueStore::Status CreateStatusCopy(const ValueStore::Status& status) {
|
||||
|
||||
} // namespace
|
||||
|
||||
CefValueStore::CefValueStore() : read_count_(0), write_count_(0) {}
|
||||
|
||||
CefValueStore::~CefValueStore() {}
|
||||
CefValueStore::CefValueStore() = default;
|
||||
CefValueStore::~CefValueStore() = default;
|
||||
|
||||
void CefValueStore::set_status_code(StatusCode status_code) {
|
||||
status_ = ValueStore::Status(status_code, kGenericErrorMessage);
|
||||
@@ -33,19 +34,19 @@ void CefValueStore::set_status_code(StatusCode status_code) {
|
||||
|
||||
size_t CefValueStore::GetBytesInUse(const std::string& key) {
|
||||
// Let SettingsStorageQuotaEnforcer implement this.
|
||||
NOTREACHED();
|
||||
NOTREACHED() << "Not implemented";
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t CefValueStore::GetBytesInUse(const std::vector<std::string>& keys) {
|
||||
// Let SettingsStorageQuotaEnforcer implement this.
|
||||
NOTREACHED();
|
||||
NOTREACHED() << "Not implemented";
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t CefValueStore::GetBytesInUse() {
|
||||
// Let SettingsStorageQuotaEnforcer implement this.
|
||||
NOTREACHED();
|
||||
NOTREACHED() << "Not implemented";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -80,7 +81,7 @@ ValueStore::WriteResult CefValueStore::Set(WriteOptions options,
|
||||
const std::string& key,
|
||||
const base::Value& value) {
|
||||
base::DictionaryValue settings;
|
||||
settings.SetWithoutPathExpansion(key, value.CreateDeepCopy());
|
||||
settings.SetKey(key, value.Clone());
|
||||
return Set(options, settings);
|
||||
}
|
||||
|
||||
@@ -134,4 +135,6 @@ ValueStore::WriteResult CefValueStore::Clear() {
|
||||
keys.push_back(it.key());
|
||||
}
|
||||
return Remove(keys);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace value_store
|
||||
|
@@ -13,27 +13,31 @@
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/macros.h"
|
||||
#include "extensions/browser/value_store/value_store.h"
|
||||
#include "components/value_store/value_store.h"
|
||||
|
||||
// Implementation Based on TestingValueStore
|
||||
// ValueStore with an in-memory storage but the ability to
|
||||
// optionally fail all operations.
|
||||
namespace value_store {
|
||||
|
||||
// Implementation Based on TestingValueStore.
|
||||
// ValueStore with an in-memory storage but the ability to optionally fail all
|
||||
// operations.
|
||||
class CefValueStore : public ValueStore {
|
||||
public:
|
||||
CefValueStore();
|
||||
~CefValueStore() override;
|
||||
CefValueStore(const CefValueStore&) = delete;
|
||||
CefValueStore& operator=(const CefValueStore&) = delete;
|
||||
|
||||
// Sets the error code for requests. If OK, errors won't be thrown.
|
||||
// Defaults to OK.
|
||||
void set_status_code(StatusCode status_code);
|
||||
|
||||
// Accessors for the number of reads/writes done by this value store. Each
|
||||
// Get* operation (except for the BytesInUse ones) counts as one read, and
|
||||
// each Set*/Remove/Clear operation counts as one write. This is useful in
|
||||
// tests seeking to assert that some number of reads/writes to their
|
||||
// underlying value store have (or have not) happened.
|
||||
int read_count() const { return read_count_; }
|
||||
int write_count() const { return write_count_; }
|
||||
|
||||
// Sets the error code for requests. If OK, errors won't be thrown.
|
||||
// Defaults to OK.
|
||||
void set_status_code(StatusCode status_code);
|
||||
int read_count() { return read_count_; }
|
||||
int write_count() { return write_count_; }
|
||||
|
||||
// ValueStore implementation.
|
||||
size_t GetBytesInUse(const std::string& key) override;
|
||||
@@ -53,11 +57,11 @@ class CefValueStore : public ValueStore {
|
||||
|
||||
private:
|
||||
base::DictionaryValue storage_;
|
||||
int read_count_;
|
||||
int write_count_;
|
||||
int read_count_ = 0;
|
||||
int write_count_ = 0;
|
||||
ValueStore::Status status_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefValueStore);
|
||||
};
|
||||
|
||||
} // namespace value_store
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_VALUE_STORE_CEF_VALUE_STORE_H_
|
||||
|
@@ -5,187 +5,70 @@
|
||||
|
||||
#include "libcef/browser/extensions/value_store/cef_value_store_factory.h"
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "extensions/browser/value_store/leveldb_value_store.h"
|
||||
#include "libcef/browser/extensions/value_store/cef_value_store.h"
|
||||
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "components/value_store/leveldb_value_store.h"
|
||||
|
||||
namespace {
|
||||
|
||||
const char kUMAClientName[] = "Cef";
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace extensions {
|
||||
|
||||
using SettingsNamespace = settings_namespace::Namespace;
|
||||
|
||||
CefValueStoreFactory::StorageHelper::StorageHelper() = default;
|
||||
|
||||
CefValueStoreFactory::StorageHelper::~StorageHelper() = default;
|
||||
|
||||
std::set<ExtensionId> CefValueStoreFactory::StorageHelper::GetKnownExtensionIDs(
|
||||
ModelType model_type) const {
|
||||
std::set<ExtensionId> ids;
|
||||
switch (model_type) {
|
||||
case ValueStoreFactory::ModelType::APP:
|
||||
for (const auto& key : app_stores_)
|
||||
ids.insert(key.first);
|
||||
break;
|
||||
case ValueStoreFactory::ModelType::EXTENSION:
|
||||
for (const auto& key : extension_stores_)
|
||||
ids.insert(key.first);
|
||||
break;
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
void CefValueStoreFactory::StorageHelper::Reset() {
|
||||
app_stores_.clear();
|
||||
extension_stores_.clear();
|
||||
}
|
||||
|
||||
ValueStore* CefValueStoreFactory::StorageHelper::AddValueStore(
|
||||
const ExtensionId& extension_id,
|
||||
ValueStore* value_store,
|
||||
ModelType model_type) {
|
||||
if (model_type == ValueStoreFactory::ModelType::APP) {
|
||||
DCHECK(app_stores_.find(extension_id) == app_stores_.end());
|
||||
app_stores_[extension_id] = value_store;
|
||||
} else {
|
||||
DCHECK(extension_stores_.find(extension_id) == extension_stores_.end());
|
||||
extension_stores_[extension_id] = value_store;
|
||||
}
|
||||
return value_store;
|
||||
}
|
||||
|
||||
void CefValueStoreFactory::StorageHelper::DeleteSettings(
|
||||
const ExtensionId& extension_id,
|
||||
ModelType model_type) {
|
||||
switch (model_type) {
|
||||
case ValueStoreFactory::ModelType::APP:
|
||||
app_stores_.erase(extension_id);
|
||||
break;
|
||||
case ValueStoreFactory::ModelType::EXTENSION:
|
||||
extension_stores_.erase(extension_id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool CefValueStoreFactory::StorageHelper::HasSettings(
|
||||
const ExtensionId& extension_id,
|
||||
ModelType model_type) const {
|
||||
switch (model_type) {
|
||||
case ValueStoreFactory::ModelType::APP:
|
||||
return app_stores_.find(extension_id) != app_stores_.end();
|
||||
case ValueStoreFactory::ModelType::EXTENSION:
|
||||
return extension_stores_.find(extension_id) != extension_stores_.end();
|
||||
}
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
|
||||
ValueStore* CefValueStoreFactory::StorageHelper::GetExisting(
|
||||
const ExtensionId& extension_id) const {
|
||||
auto it = app_stores_.find(extension_id);
|
||||
if (it != app_stores_.end())
|
||||
return it->second;
|
||||
it = extension_stores_.find(extension_id);
|
||||
if (it != extension_stores_.end())
|
||||
return it->second;
|
||||
return nullptr;
|
||||
}
|
||||
namespace value_store {
|
||||
|
||||
CefValueStoreFactory::CefValueStoreFactory() = default;
|
||||
|
||||
CefValueStoreFactory::CefValueStoreFactory(const base::FilePath& db_path)
|
||||
: db_path_(db_path) {}
|
||||
|
||||
CefValueStoreFactory::~CefValueStoreFactory() {}
|
||||
CefValueStoreFactory::~CefValueStoreFactory() = default;
|
||||
|
||||
std::unique_ptr<ValueStore> CefValueStoreFactory::CreateRulesStore() {
|
||||
if (db_path_.empty())
|
||||
last_created_store_ = new CefValueStore();
|
||||
else
|
||||
last_created_store_ = new LeveldbValueStore(kUMAClientName, db_path_);
|
||||
return base::WrapUnique(last_created_store_);
|
||||
}
|
||||
|
||||
std::unique_ptr<ValueStore> CefValueStoreFactory::CreateStateStore() {
|
||||
return CreateRulesStore();
|
||||
}
|
||||
|
||||
CefValueStoreFactory::StorageHelper& CefValueStoreFactory::GetStorageHelper(
|
||||
SettingsNamespace settings_namespace) {
|
||||
switch (settings_namespace) {
|
||||
case settings_namespace::LOCAL:
|
||||
return local_helper_;
|
||||
case settings_namespace::SYNC:
|
||||
return sync_helper_;
|
||||
case settings_namespace::MANAGED:
|
||||
return managed_helper_;
|
||||
case settings_namespace::INVALID:
|
||||
break;
|
||||
}
|
||||
NOTREACHED();
|
||||
return local_helper_;
|
||||
}
|
||||
|
||||
std::unique_ptr<ValueStore> CefValueStoreFactory::CreateSettingsStore(
|
||||
SettingsNamespace settings_namespace,
|
||||
ModelType model_type,
|
||||
const ExtensionId& extension_id) {
|
||||
std::unique_ptr<ValueStore> settings_store(CreateRulesStore());
|
||||
// Note: This factory is purposely keeping the raw pointers to each ValueStore
|
||||
// created. Tests using CefValueStoreFactory must be careful to keep
|
||||
// those ValueStore's alive for the duration of their test.
|
||||
GetStorageHelper(settings_namespace)
|
||||
.AddValueStore(extension_id, settings_store.get(), model_type);
|
||||
return settings_store;
|
||||
std::unique_ptr<ValueStore> CefValueStoreFactory::CreateValueStore(
|
||||
const base::FilePath& directory,
|
||||
const std::string& uma_client_name) {
|
||||
std::unique_ptr<ValueStore> value_store(CreateStore());
|
||||
// This factory is purposely keeping the raw pointers to each ValueStore
|
||||
// created. Cefs using CefValueStoreFactory must be careful to keep
|
||||
// those ValueStore's alive for the duration of their test.
|
||||
value_store_map_[directory] = value_store.get();
|
||||
return value_store;
|
||||
}
|
||||
|
||||
ValueStore* CefValueStoreFactory::LastCreatedStore() const {
|
||||
return last_created_store_;
|
||||
}
|
||||
|
||||
void CefValueStoreFactory::DeleteSettings(SettingsNamespace settings_namespace,
|
||||
ModelType model_type,
|
||||
const ExtensionId& extension_id) {
|
||||
GetStorageHelper(settings_namespace).DeleteSettings(extension_id, model_type);
|
||||
void CefValueStoreFactory::DeleteValueStore(const base::FilePath& directory) {
|
||||
value_store_map_.erase(directory);
|
||||
}
|
||||
|
||||
bool CefValueStoreFactory::HasSettings(SettingsNamespace settings_namespace,
|
||||
ModelType model_type,
|
||||
const ExtensionId& extension_id) {
|
||||
return GetStorageHelper(settings_namespace)
|
||||
.HasSettings(extension_id, model_type);
|
||||
}
|
||||
|
||||
std::set<ExtensionId> CefValueStoreFactory::GetKnownExtensionIDs(
|
||||
SettingsNamespace settings_namespace,
|
||||
ModelType model_type) const {
|
||||
return const_cast<CefValueStoreFactory*>(this)
|
||||
->GetStorageHelper(settings_namespace)
|
||||
.GetKnownExtensionIDs(model_type);
|
||||
bool CefValueStoreFactory::HasValueStore(const base::FilePath& directory) {
|
||||
return base::Contains(value_store_map_, directory);
|
||||
}
|
||||
|
||||
ValueStore* CefValueStoreFactory::GetExisting(
|
||||
const ExtensionId& extension_id) const {
|
||||
ValueStore* existing_store = local_helper_.GetExisting(extension_id);
|
||||
if (existing_store)
|
||||
return existing_store;
|
||||
existing_store = sync_helper_.GetExisting(extension_id);
|
||||
if (existing_store)
|
||||
return existing_store;
|
||||
existing_store = managed_helper_.GetExisting(extension_id);
|
||||
DCHECK(existing_store != nullptr);
|
||||
return existing_store;
|
||||
const base::FilePath& directory) const {
|
||||
auto it = value_store_map_.find(directory);
|
||||
DCHECK(it != value_store_map_.end());
|
||||
return it->second;
|
||||
}
|
||||
|
||||
void CefValueStoreFactory::Reset() {
|
||||
last_created_store_ = nullptr;
|
||||
local_helper_.Reset();
|
||||
sync_helper_.Reset();
|
||||
managed_helper_.Reset();
|
||||
value_store_map_.clear();
|
||||
}
|
||||
|
||||
} // namespace extensions
|
||||
std::unique_ptr<ValueStore> CefValueStoreFactory::CreateStore() {
|
||||
std::unique_ptr<ValueStore> store;
|
||||
if (db_path_.empty())
|
||||
store = std::make_unique<CefValueStore>();
|
||||
else
|
||||
store = std::make_unique<LeveldbValueStore>(kUMAClientName, db_path_);
|
||||
last_created_store_ = store.get();
|
||||
return store;
|
||||
}
|
||||
|
||||
} // namespace value_store
|
||||
|
@@ -8,90 +8,54 @@
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
#include "extensions/browser/value_store/value_store_factory.h"
|
||||
#include "extensions/common/extension_id.h"
|
||||
#include "components/value_store/value_store_factory.h"
|
||||
|
||||
namespace value_store {
|
||||
|
||||
class ValueStore;
|
||||
|
||||
namespace extensions {
|
||||
|
||||
// Will either open a database on disk (if path provided) returning a
|
||||
// |LeveldbValueStore|. Otherwise a new |CefValueStore| instance will be
|
||||
// returned.
|
||||
// Based on TestValueStoreFactory. Will either open a database on disk (if path
|
||||
// provided) returning a |LeveldbValueStore|. Otherwise a new |CefingValueStore|
|
||||
// instance will be returned.
|
||||
class CefValueStoreFactory : public ValueStoreFactory {
|
||||
public:
|
||||
CefValueStoreFactory();
|
||||
explicit CefValueStoreFactory(const base::FilePath& db_path);
|
||||
CefValueStoreFactory(const CefValueStoreFactory&) = delete;
|
||||
CefValueStoreFactory& operator=(const CefValueStoreFactory&) = delete;
|
||||
|
||||
// ValueStoreFactory
|
||||
std::unique_ptr<ValueStore> CreateRulesStore() override;
|
||||
std::unique_ptr<ValueStore> CreateStateStore() override;
|
||||
std::unique_ptr<ValueStore> CreateSettingsStore(
|
||||
settings_namespace::Namespace settings_namespace,
|
||||
ModelType model_type,
|
||||
const ExtensionId& extension_id) override;
|
||||
void DeleteSettings(settings_namespace::Namespace settings_namespace,
|
||||
ModelType model_type,
|
||||
const ExtensionId& extension_id) override;
|
||||
bool HasSettings(settings_namespace::Namespace settings_namespace,
|
||||
ModelType model_type,
|
||||
const ExtensionId& extension_id) override;
|
||||
std::set<ExtensionId> GetKnownExtensionIDs(
|
||||
settings_namespace::Namespace settings_namespace,
|
||||
ModelType model_type) const override;
|
||||
std::unique_ptr<ValueStore> CreateValueStore(
|
||||
const base::FilePath& directory,
|
||||
const std::string& uma_client_name) override;
|
||||
void DeleteValueStore(const base::FilePath& directory) override;
|
||||
bool HasValueStore(const base::FilePath& directory) override;
|
||||
|
||||
// Return the last created |ValueStore|. Use with caution as this may return
|
||||
// a dangling pointer since the creator now owns the ValueStore which can be
|
||||
// deleted at any time.
|
||||
ValueStore* LastCreatedStore() const;
|
||||
// Return a previously created |ValueStore| for an extension.
|
||||
ValueStore* GetExisting(const ExtensionId& extension_id) const;
|
||||
// Return the previously created |ValueStore| in the given directory.
|
||||
ValueStore* GetExisting(const base::FilePath& directory) const;
|
||||
// Reset this class (as if just created).
|
||||
void Reset();
|
||||
|
||||
private:
|
||||
// Manages a collection of |ValueStore|'s created for an app/extension.
|
||||
// One of these exists for each setting type.
|
||||
class StorageHelper {
|
||||
public:
|
||||
StorageHelper();
|
||||
~StorageHelper();
|
||||
std::set<ExtensionId> GetKnownExtensionIDs(ModelType model_type) const;
|
||||
ValueStore* AddValueStore(const ExtensionId& extension_id,
|
||||
ValueStore* value_store,
|
||||
ModelType model_type);
|
||||
void DeleteSettings(const ExtensionId& extension_id, ModelType model_type);
|
||||
bool HasSettings(const ExtensionId& extension_id,
|
||||
ModelType model_type) const;
|
||||
void Reset();
|
||||
ValueStore* GetExisting(const ExtensionId& extension_id) const;
|
||||
|
||||
private:
|
||||
std::map<ExtensionId, ValueStore*> app_stores_;
|
||||
std::map<ExtensionId, ValueStore*> extension_stores_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(StorageHelper);
|
||||
};
|
||||
|
||||
StorageHelper& GetStorageHelper(
|
||||
settings_namespace::Namespace settings_namespace);
|
||||
|
||||
~CefValueStoreFactory() override;
|
||||
|
||||
std::unique_ptr<ValueStore> CreateStore();
|
||||
|
||||
base::FilePath db_path_;
|
||||
ValueStore* last_created_store_ = nullptr;
|
||||
|
||||
// None of these value stores are owned by this factory, so care must be
|
||||
// taken when calling GetExisting.
|
||||
StorageHelper local_helper_;
|
||||
StorageHelper sync_helper_;
|
||||
StorageHelper managed_helper_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefValueStoreFactory);
|
||||
// A mapping from directories to their ValueStore. None of these value
|
||||
// stores are owned by this factory, so care must be taken when calling
|
||||
// GetExisting.
|
||||
std::map<base::FilePath, ValueStore*> value_store_map_;
|
||||
};
|
||||
|
||||
} // namespace extensions
|
||||
} // namespace value_store
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_VALUE_STORE_CEF_VALUE_STORE_FACTORY_H_
|
||||
|
@@ -460,6 +460,36 @@ bool CefFrameHostImpl::Detach() {
|
||||
return first_detach;
|
||||
}
|
||||
|
||||
void CefFrameHostImpl::MaybeReAttach(
|
||||
scoped_refptr<CefBrowserInfo> browser_info,
|
||||
content::RenderFrameHost* render_frame_host) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (is_attached_ && render_frame_host_ == render_frame_host) {
|
||||
// Nothing to do here.
|
||||
return;
|
||||
}
|
||||
|
||||
// We expect that Detach() was called previously.
|
||||
CHECK(!is_temporary());
|
||||
CHECK(!is_attached_);
|
||||
CHECK(!render_frame_host_);
|
||||
|
||||
// The RFH may change but the GlobalId should remain the same.
|
||||
CHECK_EQ(frame_id_,
|
||||
frame_util::MakeFrameId(render_frame_host->GetGlobalId()));
|
||||
|
||||
{
|
||||
base::AutoLock lock_scope(state_lock_);
|
||||
browser_info_ = browser_info;
|
||||
}
|
||||
|
||||
render_frame_host_ = render_frame_host;
|
||||
RefreshAttributes();
|
||||
|
||||
// Restore the RenderFrame connection.
|
||||
FrameAttachedInternal(/*reattached=*/true);
|
||||
}
|
||||
|
||||
// kMainFrameId must be -1 to align with renderer expectations.
|
||||
const int64_t CefFrameHostImpl::kMainFrameId = -1;
|
||||
const int64_t CefFrameHostImpl::kFocusedFrameId = -2;
|
||||
@@ -552,6 +582,10 @@ void CefFrameHostImpl::SendMessage(const std::string& name,
|
||||
}
|
||||
|
||||
void CefFrameHostImpl::FrameAttached() {
|
||||
FrameAttachedInternal(/*reattached=*/false);
|
||||
}
|
||||
|
||||
void CefFrameHostImpl::FrameAttachedInternal(bool reattached) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
auto browser_info = GetBrowserInfo();
|
||||
@@ -573,13 +607,13 @@ void CefFrameHostImpl::FrameAttached() {
|
||||
}
|
||||
|
||||
browser_info->MaybeExecuteFrameNotification(base::BindOnce(
|
||||
[](CefRefPtr<CefFrameHostImpl> self,
|
||||
[](CefRefPtr<CefFrameHostImpl> self, bool reattached,
|
||||
CefRefPtr<CefFrameHandler> handler) {
|
||||
if (auto browser = self->GetBrowserHostBase()) {
|
||||
handler->OnFrameAttached(browser, self);
|
||||
handler->OnFrameAttached(browser, self, reattached);
|
||||
}
|
||||
},
|
||||
CefRefPtr<CefFrameHostImpl>(this)));
|
||||
CefRefPtr<CefFrameHostImpl>(this), reattached));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -596,13 +630,6 @@ void CefFrameHostImpl::UpdateDraggableRegions(
|
||||
if (!browser)
|
||||
return;
|
||||
|
||||
CefRefPtr<CefDragHandler> handler;
|
||||
auto client = browser->GetClient();
|
||||
if (client)
|
||||
handler = client->GetDragHandler();
|
||||
if (!handler)
|
||||
return;
|
||||
|
||||
std::vector<CefDraggableRegion> draggable_regions;
|
||||
if (regions) {
|
||||
draggable_regions.reserve(regions->size());
|
||||
@@ -615,7 +642,10 @@ void CefFrameHostImpl::UpdateDraggableRegions(
|
||||
}
|
||||
}
|
||||
|
||||
handler->OnDraggableRegionsChanged(browser.get(), this, draggable_regions);
|
||||
// Delegate to BrowserInfo so that current state is maintained with
|
||||
// cross-origin navigation.
|
||||
browser_info_->MaybeNotifyDraggableRegionsChanged(
|
||||
browser, this, std::move(draggable_regions));
|
||||
}
|
||||
|
||||
void CefExecuteJavaScriptWithUserGestureForTests(CefRefPtr<CefFrame> frame,
|
||||
|
@@ -119,6 +119,12 @@ class CefFrameHostImpl : public CefFrame, public cef::mojom::BrowserFrame {
|
||||
// if this was the first call to Detach() for the frame.
|
||||
bool Detach();
|
||||
|
||||
// A frame has swapped to active status from prerendering or the back-forward
|
||||
// cache. We may need to re-attach if the RFH has changed. See
|
||||
// https://crbug.com/1179502#c8 for additional background.
|
||||
void MaybeReAttach(scoped_refptr<CefBrowserInfo> browser_info,
|
||||
content::RenderFrameHost* render_frame_host);
|
||||
|
||||
// cef::mojom::BrowserFrame methods forwarded from CefBrowserFrame.
|
||||
void SendMessage(const std::string& name, base::Value arguments) override;
|
||||
void FrameAttached() override;
|
||||
@@ -153,6 +159,8 @@ class CefFrameHostImpl : public CefFrame, public cef::mojom::BrowserFrame {
|
||||
void SendToRenderFrame(const std::string& function_name,
|
||||
RenderFrameAction action);
|
||||
|
||||
void FrameAttachedInternal(bool reattached);
|
||||
|
||||
const bool is_main_frame_;
|
||||
|
||||
// The following members may be read/modified from any thread. All access must
|
||||
|
125
libcef/browser/frame_service_base.h
Normal file
125
libcef/browser/frame_service_base.h
Normal file
@@ -0,0 +1,125 @@
|
||||
// Copyright 2017 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_FRAME_SERVICE_BASE_H_
|
||||
#define CEF_LIBCEF_BROWSER_FRAME_SERVICE_BASE_H_
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/threading/thread_checker.h"
|
||||
#include "content/public/browser/navigation_handle.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/browser/web_contents_observer.h"
|
||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||
#include "mojo/public/cpp/bindings/receiver.h"
|
||||
#include "url/origin.h"
|
||||
|
||||
namespace content {
|
||||
|
||||
// Base class for mojo interface implementations tied to a document's lifetime.
|
||||
// The service will be destroyed when any of the following happens:
|
||||
// 1. mojo interface connection error happened,
|
||||
// 2. the RenderFrameHost was deleted, or
|
||||
// 3. navigation was committed on the RenderFrameHost (not same document) and
|
||||
// ShouldCloseOnFinishNavigation() returns true.
|
||||
//
|
||||
// WARNING: To avoid race conditions, subclasses MUST only get the origin via
|
||||
// origin() instead of from |render_frame_host| passed in the constructor.
|
||||
// See https://crbug.com/769189 for an example of such a race.
|
||||
//
|
||||
// Based on the old implementation of DocumentServiceBase that existed prior to
|
||||
// https://crrev.com/2809effa24. CEF requires the old implementation to support
|
||||
// bindings that outlive navigation.
|
||||
template <typename Interface>
|
||||
class FrameServiceBase : public Interface, public WebContentsObserver {
|
||||
public:
|
||||
FrameServiceBase(RenderFrameHost* render_frame_host,
|
||||
mojo::PendingReceiver<Interface> pending_receiver)
|
||||
: WebContentsObserver(
|
||||
WebContents::FromRenderFrameHost(render_frame_host)),
|
||||
render_frame_host_(render_frame_host),
|
||||
origin_(render_frame_host_->GetLastCommittedOrigin()),
|
||||
receiver_(this, std::move(pending_receiver)) {
|
||||
// |this| owns |receiver_|, so unretained is safe.
|
||||
receiver_.set_disconnect_handler(
|
||||
base::BindOnce(&FrameServiceBase::Close, base::Unretained(this)));
|
||||
}
|
||||
|
||||
protected:
|
||||
// Make the destructor private since |this| can only be deleted by Close().
|
||||
virtual ~FrameServiceBase() = default;
|
||||
|
||||
// All subclasses should use this function to obtain the origin instead of
|
||||
// trying to get it from the RenderFrameHost pointer directly.
|
||||
const url::Origin& origin() const { return origin_; }
|
||||
|
||||
// Returns the RenderFrameHost held by this object.
|
||||
RenderFrameHost* render_frame_host() const { return render_frame_host_; }
|
||||
|
||||
// Subclasses can use this to check thread safety.
|
||||
// For example: DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
|
||||
THREAD_CHECKER(thread_checker_);
|
||||
|
||||
private:
|
||||
// Disallow calling web_contents() directly from the subclasses to ensure that
|
||||
// tab-level state doesn't get queried or updated when the RenderFrameHost is
|
||||
// not active.
|
||||
// Use WebContents::From(render_frame_host()) instead, but please keep in mind
|
||||
// that the render_frame_host() might not be active. See
|
||||
// RenderFrameHost::IsActive() for details.
|
||||
using WebContentsObserver::web_contents;
|
||||
|
||||
// WebContentsObserver implementation.
|
||||
void RenderFrameDeleted(RenderFrameHost* render_frame_host) final {
|
||||
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
|
||||
|
||||
if (render_frame_host == render_frame_host_) {
|
||||
DVLOG(1) << __func__ << ": RenderFrame destroyed.";
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
void DidFinishNavigation(NavigationHandle* navigation_handle) final {
|
||||
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
|
||||
if (!ShouldCloseOnFinishNavigation())
|
||||
return;
|
||||
|
||||
if (!navigation_handle->HasCommitted() ||
|
||||
navigation_handle->IsSameDocument() ||
|
||||
navigation_handle->IsPageActivation()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (navigation_handle->GetRenderFrameHost() == render_frame_host_) {
|
||||
// FrameServiceBase is destroyed either when RenderFrameHost is
|
||||
// destroyed (covered by RenderFrameDeleted) or when a new document
|
||||
// commits in the same RenderFrameHost (covered by DidFinishNavigation).
|
||||
// Only committed non-same-document non-bfcache non-prerendering
|
||||
// activation navigations replace a document in existing RenderFrameHost.
|
||||
DVLOG(1) << __func__ << ": Close connection on navigation.";
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
// Used for CEF bindings that outlive navigation.
|
||||
virtual bool ShouldCloseOnFinishNavigation() const { return true; }
|
||||
|
||||
// Stops observing WebContents and delete |this|.
|
||||
void Close() {
|
||||
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
|
||||
DVLOG(1) << __func__;
|
||||
delete this;
|
||||
}
|
||||
|
||||
RenderFrameHost* const render_frame_host_ = nullptr;
|
||||
const url::Origin origin_;
|
||||
mojo::Receiver<Interface> receiver_;
|
||||
};
|
||||
|
||||
} // namespace content
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_FRAME_SERVICE_BASE_H_
|
@@ -184,7 +184,7 @@ void CefMediaRouterManager::CreateRoute(
|
||||
source_id, sink_id, origin, nullptr /* web_contents */,
|
||||
base::BindOnce(&CefMediaRouterManager::OnCreateRoute,
|
||||
weak_ptr_factory_.GetWeakPtr(), std::move(callback)),
|
||||
base::TimeDelta::FromMilliseconds(kTimeoutMs), false /* incognito */);
|
||||
base::Milliseconds(kTimeoutMs), false /* incognito */);
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::SendRouteMessage(
|
||||
|
@@ -48,13 +48,13 @@ void CefBrowserPlatformDelegateNativeLinux::BrowserDestroyed(
|
||||
bool CefBrowserPlatformDelegateNativeLinux::CreateHostWindow() {
|
||||
DCHECK(!window_widget_);
|
||||
|
||||
if (window_info_.width == 0)
|
||||
window_info_.width = 800;
|
||||
if (window_info_.height == 0)
|
||||
window_info_.height = 600;
|
||||
if (window_info_.bounds.width == 0)
|
||||
window_info_.bounds.width = 800;
|
||||
if (window_info_.bounds.height == 0)
|
||||
window_info_.bounds.height = 600;
|
||||
|
||||
gfx::Rect rect(window_info_.x, window_info_.y, window_info_.width,
|
||||
window_info_.height);
|
||||
gfx::Rect rect(window_info_.bounds.x, window_info_.bounds.y,
|
||||
window_info_.bounds.width, window_info_.bounds.height);
|
||||
|
||||
#if defined(USE_X11)
|
||||
DCHECK(!window_x11_);
|
||||
@@ -133,7 +133,7 @@ views::Widget* CefBrowserPlatformDelegateNativeLinux::GetWindowWidget() const {
|
||||
return window_widget_;
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateNativeLinux::SendFocusEvent(bool setFocus) {
|
||||
void CefBrowserPlatformDelegateNativeLinux::SetFocus(bool setFocus) {
|
||||
if (!setFocus)
|
||||
return;
|
||||
|
||||
@@ -205,8 +205,9 @@ gfx::Point CefBrowserPlatformDelegateNativeLinux::GetScreenPoint(
|
||||
const gfx::Rect& bounds_in_screen = window_x11_->GetBoundsInScreen();
|
||||
return gfx::Point(bounds_in_screen.x() + view.x(),
|
||||
bounds_in_screen.y() + view.y());
|
||||
#endif // defined(USE_X11)
|
||||
#else // !defined(USE_X11)
|
||||
return gfx::Point();
|
||||
#endif
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateNativeLinux::ViewText(const std::string& text) {
|
||||
|
@@ -24,7 +24,7 @@ class CefBrowserPlatformDelegateNativeLinux
|
||||
void CloseHostWindow() override;
|
||||
CefWindowHandle GetHostWindowHandle() const override;
|
||||
views::Widget* GetWindowWidget() const override;
|
||||
void SendFocusEvent(bool setFocus) override;
|
||||
void SetFocus(bool setFocus) override;
|
||||
void NotifyMoveOrResizeStarted() override;
|
||||
void SizeTo(int width, int height) override;
|
||||
gfx::Point GetScreenPoint(const gfx::Point& view) const override;
|
||||
|
@@ -33,7 +33,7 @@ class CefBrowserPlatformDelegateNativeMac
|
||||
int deltaX,
|
||||
int deltaY) override;
|
||||
void SendTouchEvent(const CefTouchEvent& event) override;
|
||||
void SendFocusEvent(bool setFocus) override;
|
||||
void SetFocus(bool setFocus) override;
|
||||
gfx::Point GetScreenPoint(const gfx::Point& view) const override;
|
||||
void ViewText(const std::string& text) override;
|
||||
bool HandleKeyboardEvent(
|
||||
|
@@ -166,18 +166,18 @@ bool CefBrowserPlatformDelegateNativeMac::CreateHostWindow() {
|
||||
|
||||
NSView* parentView =
|
||||
CAST_CEF_WINDOW_HANDLE_TO_NSVIEW(window_info_.parent_view);
|
||||
NSRect contentRect = {{static_cast<CGFloat>(window_info_.x),
|
||||
static_cast<CGFloat>(window_info_.y)},
|
||||
{static_cast<CGFloat>(window_info_.width),
|
||||
static_cast<CGFloat>(window_info_.height)}};
|
||||
NSRect contentRect = {{static_cast<CGFloat>(window_info_.bounds.x),
|
||||
static_cast<CGFloat>(window_info_.bounds.y)},
|
||||
{static_cast<CGFloat>(window_info_.bounds.width),
|
||||
static_cast<CGFloat>(window_info_.bounds.height)}};
|
||||
if (parentView == nil) {
|
||||
// Create a new window.
|
||||
NSRect screen_rect = [[NSScreen mainScreen] visibleFrame];
|
||||
NSRect window_rect = {
|
||||
{static_cast<CGFloat>(window_info_.x),
|
||||
screen_rect.size.height - static_cast<CGFloat>(window_info_.y)},
|
||||
{static_cast<CGFloat>(window_info_.width),
|
||||
static_cast<CGFloat>(window_info_.height)}};
|
||||
{static_cast<CGFloat>(window_info_.bounds.x),
|
||||
screen_rect.size.height - static_cast<CGFloat>(window_info_.bounds.y)},
|
||||
{static_cast<CGFloat>(window_info_.bounds.width),
|
||||
static_cast<CGFloat>(window_info_.bounds.height)}};
|
||||
if (window_rect.size.width == 0)
|
||||
window_rect.size.width = 750;
|
||||
if (window_rect.size.height == 0)
|
||||
@@ -310,7 +310,7 @@ void CefBrowserPlatformDelegateNativeMac::SendTouchEvent(
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateNativeMac::SendFocusEvent(bool setFocus) {
|
||||
void CefBrowserPlatformDelegateNativeMac::SetFocus(bool setFocus) {
|
||||
auto view = GetHostView();
|
||||
if (view) {
|
||||
view->SetActive(setFocus);
|
||||
@@ -559,7 +559,7 @@ void CefBrowserPlatformDelegateNativeMac::TranslateWebMouseEvent(
|
||||
|
||||
// timestamp
|
||||
result.SetTimeStamp(base::TimeTicks() +
|
||||
base::TimeDelta::FromSeconds(currentEventTimestamp()));
|
||||
base::Seconds(currentEventTimestamp()));
|
||||
|
||||
result.pointer_type = blink::WebPointerProperties::PointerType::kMouse;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user