mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
74 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
7f37a0a130 | ||
|
cd24143111 | ||
|
ead5caf25a | ||
|
c6dbc58c5f | ||
|
00188c7052 | ||
|
b472a8d9ea | ||
|
847fd4fd63 | ||
|
0a87d5f25f | ||
|
13f506f92a | ||
|
4c165056e1 | ||
|
461fa1fe83 | ||
|
bf8b64d70e | ||
|
004ef913a2 | ||
|
9df58650e1 | ||
|
a4f7e361be | ||
|
52427ce97f | ||
|
01f9a30b1d | ||
|
fd089efa24 | ||
|
3f956461bb | ||
|
4f87de9f52 | ||
|
532ce6b99c | ||
|
633c181700 | ||
|
7ed3a545e9 | ||
|
17f0192053 | ||
|
f7ae4ed0da | ||
|
0fb03e7aa1 | ||
|
7f3c21b64a | ||
|
339ce47575 | ||
|
7d09642925 | ||
|
fad6aec5d0 | ||
|
96bd993d99 | ||
|
8e9d736cda | ||
|
6a76bdb040 | ||
|
cf5b322efc | ||
|
7139f01103 | ||
|
0d12959a50 | ||
|
10c01ff43e | ||
|
66b5dc3d55 | ||
|
f12ad6b634 | ||
|
5bf4d4febd | ||
|
448a112352 | ||
|
9229cdd0eb | ||
|
9e22c975fa | ||
|
6301e06c8a | ||
|
123324f5f9 | ||
|
eb3325a9ae | ||
|
2d48a07bec | ||
|
669e8673ce | ||
|
b03c54bfbe | ||
|
35830c88e5 | ||
|
3c3045a5cb | ||
|
b25374c8e7 | ||
|
4f28c5ffff | ||
|
12043b16e7 | ||
|
d9ebd4c50f | ||
|
f6f2c9a0ca | ||
|
21310e4374 | ||
|
08ff72fa20 | ||
|
12cc069b69 | ||
|
cd27cbc802 | ||
|
a9f0fa9dfe | ||
|
240ba800ed | ||
|
84e2286995 | ||
|
58413e16b1 | ||
|
58e2e4b23d | ||
|
77dc8157d0 | ||
|
8426da0de6 | ||
|
66484d799e | ||
|
dcf533cc3c | ||
|
67708d07f2 | ||
|
d1d4f7a3ef | ||
|
46e8152b6d | ||
|
1f4f8f4af7 | ||
|
f24f885eeb |
69
BUILD.gn
69
BUILD.gn
@@ -112,6 +112,7 @@ import("//third_party/widevine/cdm/widevine.gni")
|
||||
import("//tools/grit/repack.gni")
|
||||
import("//tools/grit/grit_rule.gni")
|
||||
import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
|
||||
import("//ui/gl/features.gni")
|
||||
import("//v8/gni/v8.gni")
|
||||
if (is_clang) {
|
||||
import("//build/config/clang/clang.gni")
|
||||
@@ -402,6 +403,8 @@ static_library("libcef_static") {
|
||||
"libcef/browser/net/chrome_scheme_handler.h",
|
||||
"libcef/browser/net/cookie_store_proxy.cc",
|
||||
"libcef/browser/net/cookie_store_proxy.h",
|
||||
"libcef/browser/net/cookie_store_source.cc",
|
||||
"libcef/browser/net/cookie_store_source.h",
|
||||
"libcef/browser/net/crlset_file_util_impl.cc",
|
||||
"libcef/browser/net/devtools_scheme_handler.cc",
|
||||
"libcef/browser/net/devtools_scheme_handler.h",
|
||||
@@ -657,6 +660,7 @@ static_library("libcef_static") {
|
||||
"//chrome/services/printing:lib",
|
||||
"//chrome/utility",
|
||||
"//components/cdm/renderer",
|
||||
"//components/certificate_transparency",
|
||||
"//components/content_settings/core/browser",
|
||||
"//components/content_settings/core/common",
|
||||
"//components/crx_file",
|
||||
@@ -673,11 +677,10 @@ static_library("libcef_static") {
|
||||
"//components/printing/browser",
|
||||
"//components/printing/common",
|
||||
"//components/printing/renderer",
|
||||
"//components/printing/service:pdf_compositor_manifest",
|
||||
"//components/printing/service/public/cpp:factory",
|
||||
"//components/printing/service/public/interfaces",
|
||||
"//components/services/pdf_compositor:pdf_compositor_manifest",
|
||||
"//components/services/pdf_compositor/public/cpp:utils",
|
||||
"//components/services/pdf_compositor/public/interfaces",
|
||||
"//components/proxy_config",
|
||||
"//components/ssl_config",
|
||||
"//components/update_client",
|
||||
"//components/url_formatter",
|
||||
"//components/user_prefs",
|
||||
@@ -706,8 +709,7 @@ static_library("libcef_static") {
|
||||
"//media",
|
||||
"//media/blink",
|
||||
"//net",
|
||||
"//net:net_browser_services",
|
||||
"//net:net_utility_services",
|
||||
"//net/dns:mojo_client",
|
||||
"//net:net_with_v8",
|
||||
"//pdf",
|
||||
"//ppapi/buildflags",
|
||||
@@ -777,6 +779,8 @@ static_library("libcef_static") {
|
||||
|
||||
libs = [
|
||||
"comctl32.lib",
|
||||
# For D3D11_DECODER_PROFILE_H264_VLD_NOFGT.
|
||||
"dxguid.lib",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1386,11 +1390,58 @@ if (is_mac) {
|
||||
]
|
||||
}
|
||||
|
||||
if (use_egl) {
|
||||
# Add the ANGLE .dylibs in the MODULE_DIR of the Framework app bundle.
|
||||
bundle_data("cef_framework_angle_binaries") {
|
||||
sources = [
|
||||
"$root_out_dir/egl_intermediates/libEGL.dylib",
|
||||
"$root_out_dir/egl_intermediates/libGLESv2.dylib",
|
||||
]
|
||||
outputs = [
|
||||
"{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
|
||||
]
|
||||
public_deps = [
|
||||
"//ui/gl:angle_library_copy",
|
||||
]
|
||||
}
|
||||
|
||||
# Add the SwiftShader .dylibs in the MODULE_DIR of the Framework app bundle.
|
||||
bundle_data("cef_framework_swiftshader_binaries") {
|
||||
sources = [
|
||||
"$root_out_dir/egl_intermediates/libswiftshader_libEGL.dylib",
|
||||
"$root_out_dir/egl_intermediates/libswiftshader_libGLESv2.dylib",
|
||||
]
|
||||
outputs = [
|
||||
"{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
|
||||
]
|
||||
public_deps = [
|
||||
"//ui/gl:swiftshader_library_copy",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
group("cef_framework_angle_library") {
|
||||
if (use_egl) {
|
||||
deps = [
|
||||
":cef_framework_angle_binaries",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
group("cef_framework_swiftshader_library") {
|
||||
if (use_egl) {
|
||||
deps = [
|
||||
":cef_framework_swiftshader_binaries",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
mac_framework_bundle("cef_framework") {
|
||||
output_name = cef_framework_name
|
||||
|
||||
framework_version = "A"
|
||||
framework_contents = [
|
||||
"Libraries",
|
||||
"Resources",
|
||||
]
|
||||
|
||||
@@ -1407,8 +1458,10 @@ if (is_mac) {
|
||||
# - crash_report_sender.app
|
||||
|
||||
deps = [
|
||||
":cef_framework_angle_library",
|
||||
":cef_framework_locales",
|
||||
":cef_framework_resources",
|
||||
":cef_framework_swiftshader_library",
|
||||
":libcef_static",
|
||||
]
|
||||
|
||||
@@ -1450,7 +1503,6 @@ if (is_mac) {
|
||||
|
||||
deps = [
|
||||
":libcef_static",
|
||||
"//build/config:exe_and_shlib_deps",
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
@@ -1845,7 +1897,6 @@ if (is_mac) {
|
||||
deps = [
|
||||
":libcef",
|
||||
":libcef_dll_wrapper",
|
||||
"//build/config:exe_and_shlib_deps",
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
@@ -1919,7 +1970,6 @@ if (is_mac) {
|
||||
deps = [
|
||||
":libcef",
|
||||
":libcef_dll_wrapper",
|
||||
"//build/config:exe_and_shlib_deps",
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
@@ -1988,7 +2038,6 @@ if (is_mac) {
|
||||
deps = [
|
||||
":libcef",
|
||||
":libcef_dll_wrapper",
|
||||
"//build/config:exe_and_shlib_deps",
|
||||
"//testing/gtest",
|
||||
]
|
||||
|
||||
|
@@ -7,5 +7,5 @@
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'refs/tags/67.0.3396.79',
|
||||
'chromium_checkout': 'refs/tags/69.0.3497.100',
|
||||
}
|
||||
|
73
CHROMIUM_UPDATE.txt
Normal file
73
CHROMIUM_UPDATE.txt
Normal file
@@ -0,0 +1,73 @@
|
||||
# The Chromium Embedded Framework (CEF) project is built on top of the Chromium
|
||||
# project source tree. When updating Chromium to a new version certain files and
|
||||
# patterns should be observed for changes. If changes are detected then the CEF
|
||||
# source code or patch files will likely need to be updated.
|
||||
#
|
||||
# Add `--log-chromium-changes` to the automate-git.py command-line to output
|
||||
# the following files in the <download-dir>:
|
||||
#
|
||||
# * chromium_update_changes.diff
|
||||
# Files in the chromium/src directory that have changed. See the 'files'
|
||||
# section below.
|
||||
#
|
||||
# * chromium_update_patterns.txt
|
||||
# Files in the chromium/src directory that contain invalid/unexpected
|
||||
# patterns. See the 'patterns' section below. Failure of this step is
|
||||
# considered a fatal error during update.
|
||||
#
|
||||
# * chromium_update_patches.txt
|
||||
# Output from attempting to update existing Chromium patch files using the
|
||||
# patch_updater.py tool. Failure of this step is considered a fatal error
|
||||
# during update.
|
||||
#
|
||||
# For complete update instructions see:
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/ChromiumUpdate.md
|
||||
|
||||
{
|
||||
# Files in the chromium/src directory that should be evaluated for changes.
|
||||
# Similar changes may need to be applied to the CEF source code.
|
||||
'files': [
|
||||
'chrome/browser/browser_process.h',
|
||||
'chrome/browser/extensions/api/tabs/tabs_api.*',
|
||||
'chrome/browser/extensions/chrome_component_extension_resource_manager.*',
|
||||
'chrome/browser/extensions/chrome_extension_web_contents_observer.*',
|
||||
'chrome/browser/extensions/component_loader.*',
|
||||
'chrome/browser/extensions/extension_service.*',
|
||||
'chrome/browser/printing/print_view_manager*',
|
||||
'chrome/browser/printing/printing_message_filter*',
|
||||
'chrome/browser/profiles/profile.h',
|
||||
'chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.*',
|
||||
'chrome/common/extensions/api/*_features.json',
|
||||
'chrome/renderer/chrome_content_renderer_client.*',
|
||||
'chrome/renderer/extensions/chrome_extensions_renderer_client.*',
|
||||
'content/browser/renderer_host/render_widget_host_view_base.*',
|
||||
'content/public/browser/content_browser_client.*',
|
||||
'content/public/browser/render_widget_host_view.h',
|
||||
'content/public/browser/storage_partition.h',
|
||||
'content/public/browser/web_contents_delegate.h',
|
||||
'content/public/common/content_features.cc',
|
||||
'content/shell/BUILD.gn',
|
||||
'content/shell/app/*',
|
||||
'content/shell/browser/shell_*',
|
||||
'content/shell/browser/renderer_host/shell_*',
|
||||
'content/shell/common/shell_*',
|
||||
'content/shell/gpu/shell_*',
|
||||
'content/shell/renderer/shell_*',
|
||||
'content/shell/utility/shell_*',
|
||||
'extensions/shell/*',
|
||||
'net/cookies/cookie_store.h',
|
||||
],
|
||||
# Patterns that should not be found in the chromium/src directory after
|
||||
# applying patch files.
|
||||
'patterns': [
|
||||
{
|
||||
# New instances of this static_cast are added to the Chromium sources with
|
||||
# some regularity. If unfixed they will result in runtime crashes.
|
||||
'pattern': 'static_cast<StoragePartitionImpl\*>(',
|
||||
'exclude_matches': '^(.+?)test(.+?):',
|
||||
'message': 'New instances in non-test files should be converted to ' +\
|
||||
'call StoragePartition methods.' +\
|
||||
'\nSee storage_partition_1973.patch.',
|
||||
},
|
||||
],
|
||||
}
|
@@ -26,7 +26,6 @@
|
||||
'include/base/cef_string16.h',
|
||||
'include/base/cef_template_util.h',
|
||||
'include/base/cef_thread_checker.h',
|
||||
'include/base/cef_thread_collision_warner.h',
|
||||
'include/base/cef_trace_event.h',
|
||||
'include/base/cef_tuple.h',
|
||||
'include/base/cef_weak_ptr.h',
|
||||
@@ -115,7 +114,6 @@
|
||||
'libcef_dll/base/cef_ref_counted.cc',
|
||||
'libcef_dll/base/cef_string16.cc',
|
||||
'libcef_dll/base/cef_thread_checker_impl.cc',
|
||||
'libcef_dll/base/cef_thread_collision_warner.cc',
|
||||
'libcef_dll/base/cef_weak_ptr.cc',
|
||||
],
|
||||
'libcef_dll_wrapper_sources_common': [
|
||||
@@ -370,6 +368,8 @@
|
||||
'tests/cefclient/browser/dialog_handler_gtk.cc',
|
||||
'tests/cefclient/browser/dialog_handler_gtk.h',
|
||||
'tests/cefclient/browser/main_context_impl_posix.cc',
|
||||
'tests/cefclient/browser/main_message_loop_multithreaded_gtk.cc',
|
||||
'tests/cefclient/browser/main_message_loop_multithreaded_gtk.h',
|
||||
'tests/cefclient/browser/print_handler_gtk.cc',
|
||||
'tests/cefclient/browser/print_handler_gtk.h',
|
||||
'tests/cefclient/browser/resource_util_linux.cc',
|
||||
@@ -379,6 +379,8 @@
|
||||
'tests/cefclient/browser/root_window_views.h',
|
||||
'tests/cefclient/browser/temp_window_x11.cc',
|
||||
'tests/cefclient/browser/temp_window_x11.h',
|
||||
'tests/cefclient/browser/util_gtk.cc',
|
||||
'tests/cefclient/browser/util_gtk.h',
|
||||
'tests/cefclient/browser/views_menu_bar.cc',
|
||||
'tests/cefclient/browser/views_menu_bar.h',
|
||||
'tests/cefclient/browser/views_style.cc',
|
||||
|
@@ -346,6 +346,7 @@ if(OS_WINDOWS)
|
||||
1912 # VS2017 version 15.5
|
||||
1913 # VS2017 version 15.6
|
||||
1914 # VS2017 version 15.7
|
||||
1915 # VS2017 version 15.8
|
||||
)
|
||||
list(FIND supported_msvc_versions ${MSVC_VERSION} _index)
|
||||
if (${_index} EQUAL -1)
|
||||
|
@@ -162,6 +162,16 @@
|
||||
#define ALLOW_UNUSED_LOCAL(x) false ? (void)x : (void)0
|
||||
#endif
|
||||
|
||||
// Sanitizers annotations.
|
||||
#if defined(__has_attribute)
|
||||
#if __has_attribute(no_sanitize)
|
||||
#define NO_SANITIZE(what) __attribute__((no_sanitize(what)))
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(NO_SANITIZE)
|
||||
#define NO_SANITIZE(what)
|
||||
#endif
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
// Annotate a virtual method indicating it must be overriding a virtual method
|
||||
|
@@ -51,7 +51,7 @@
|
||||
#include "include/base/cef_atomic_ref_count.h"
|
||||
#include "include/base/cef_build.h"
|
||||
#include "include/base/cef_logging.h"
|
||||
#include "include/base/cef_thread_collision_warner.h"
|
||||
#include "include/base/cef_macros.h"
|
||||
|
||||
namespace base {
|
||||
|
||||
@@ -78,10 +78,6 @@ class RefCountedBase {
|
||||
}
|
||||
|
||||
void AddRef() const {
|
||||
// TODO(maruel): Add back once it doesn't assert 500 times/sec.
|
||||
// Current thread books the critical section "AddRelease"
|
||||
// without release it.
|
||||
// DFAKE_SCOPED_LOCK_THREAD_LOCKED(add_release_);
|
||||
#if DCHECK_IS_ON()
|
||||
DCHECK(!in_dtor_);
|
||||
#endif
|
||||
@@ -90,10 +86,6 @@ class RefCountedBase {
|
||||
|
||||
// Returns true if the object should self-delete.
|
||||
bool Release() const {
|
||||
// TODO(maruel): Add back once it doesn't assert 500 times/sec.
|
||||
// Current thread books the critical section "AddRelease"
|
||||
// without release it.
|
||||
// DFAKE_SCOPED_LOCK_THREAD_LOCKED(add_release_);
|
||||
#if DCHECK_IS_ON()
|
||||
DCHECK(!in_dtor_);
|
||||
#endif
|
||||
@@ -112,8 +104,6 @@ class RefCountedBase {
|
||||
mutable bool in_dtor_;
|
||||
#endif
|
||||
|
||||
DFAKE_MUTEX(add_release_);
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(RefCountedBase);
|
||||
};
|
||||
|
||||
|
@@ -86,6 +86,7 @@ typedef std::char_traits<wchar_t> string16_char_traits;
|
||||
|
||||
#include "include/base/cef_macros.h"
|
||||
|
||||
namespace cef {
|
||||
namespace base {
|
||||
|
||||
typedef uint16_t char16;
|
||||
@@ -156,7 +157,15 @@ struct string16_char_traits {
|
||||
static int_type eof() { return static_cast<int_type>(EOF); }
|
||||
};
|
||||
|
||||
typedef std::basic_string<char16, base::string16_char_traits> string16;
|
||||
typedef std::basic_string<char16, string16_char_traits> string16;
|
||||
|
||||
} // namespace base
|
||||
} // namespace cef
|
||||
|
||||
namespace base {
|
||||
|
||||
typedef cef::base::char16 char16;
|
||||
typedef cef::base::string16 string16;
|
||||
|
||||
extern std::ostream& operator<<(std::ostream& out, const string16& str);
|
||||
|
||||
@@ -204,8 +213,8 @@ extern void PrintTo(const string16& str, std::ostream* out);
|
||||
//
|
||||
// TODO(mark): File this bug with Apple and update this note with a bug number.
|
||||
|
||||
extern template class std::basic_string<base::char16,
|
||||
base::string16_char_traits>;
|
||||
extern template class std::basic_string<cef::base::char16,
|
||||
cef::base::string16_char_traits>;
|
||||
|
||||
#endif // WCHAR_T_IS_UTF32
|
||||
|
||||
|
@@ -1,276 +0,0 @@
|
||||
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012
|
||||
// Google Inc. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_CEF_THREAD_COLLISION_WARNER_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_THREAD_COLLISION_WARNER_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(BASE_THREADING_THREAD_COLLISION_WARNER_H_)
|
||||
// Do nothing if the Chromium header has already been included.
|
||||
// This can happen in cases where Chromium code is used directly by the
|
||||
// client application. When using Chromium code directly always include
|
||||
// the Chromium header first to avoid type conflicts.
|
||||
#elif defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/threading/thread_collision_warner.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "include/base/cef_atomicops.h"
|
||||
#include "include/base/cef_basictypes.h"
|
||||
#include "include/base/cef_build.h"
|
||||
#include "include/base/cef_logging.h"
|
||||
#include "include/base/cef_macros.h"
|
||||
|
||||
// A helper class alongside macros to be used to verify assumptions about thread
|
||||
// safety of a class.
|
||||
//
|
||||
// Example: Queue implementation non thread-safe but still usable if clients
|
||||
// are synchronized somehow.
|
||||
//
|
||||
// In this case the macro DFAKE_SCOPED_LOCK has to be
|
||||
// used, it checks that if a thread is inside the push/pop then
|
||||
// noone else is still inside the pop/push
|
||||
//
|
||||
// class NonThreadSafeQueue {
|
||||
// public:
|
||||
// ...
|
||||
// void push(int) { DFAKE_SCOPED_LOCK(push_pop_); ... }
|
||||
// int pop() { DFAKE_SCOPED_LOCK(push_pop_); ... }
|
||||
// ...
|
||||
// private:
|
||||
// DFAKE_MUTEX(push_pop_);
|
||||
// };
|
||||
//
|
||||
//
|
||||
// Example: Queue implementation non thread-safe but still usable if clients
|
||||
// are synchronized somehow, it calls a method to "protect" from
|
||||
// a "protected" method
|
||||
//
|
||||
// In this case the macro DFAKE_SCOPED_RECURSIVE_LOCK
|
||||
// has to be used, it checks that if a thread is inside the push/pop
|
||||
// then noone else is still inside the pop/push
|
||||
//
|
||||
// class NonThreadSafeQueue {
|
||||
// public:
|
||||
// void push(int) {
|
||||
// DFAKE_SCOPED_LOCK(push_pop_);
|
||||
// ...
|
||||
// }
|
||||
// int pop() {
|
||||
// DFAKE_SCOPED_RECURSIVE_LOCK(push_pop_);
|
||||
// bar();
|
||||
// ...
|
||||
// }
|
||||
// void bar() { DFAKE_SCOPED_RECURSIVE_LOCK(push_pop_); ... }
|
||||
// ...
|
||||
// private:
|
||||
// DFAKE_MUTEX(push_pop_);
|
||||
// };
|
||||
//
|
||||
//
|
||||
// Example: Queue implementation not usable even if clients are synchronized,
|
||||
// so only one thread in the class life cycle can use the two members
|
||||
// push/pop.
|
||||
//
|
||||
// In this case the macro DFAKE_SCOPED_LOCK_THREAD_LOCKED pins the
|
||||
// specified
|
||||
// critical section the first time a thread enters push or pop, from
|
||||
// that time on only that thread is allowed to execute push or pop.
|
||||
//
|
||||
// class NonThreadSafeQueue {
|
||||
// public:
|
||||
// ...
|
||||
// void push(int) { DFAKE_SCOPED_LOCK_THREAD_LOCKED(push_pop_); ... }
|
||||
// int pop() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(push_pop_); ... }
|
||||
// ...
|
||||
// private:
|
||||
// DFAKE_MUTEX(push_pop_);
|
||||
// };
|
||||
//
|
||||
//
|
||||
// Example: Class that has to be contructed/destroyed on same thread, it has
|
||||
// a "shareable" method (with external synchronization) and a not
|
||||
// shareable method (even with external synchronization).
|
||||
//
|
||||
// In this case 3 Critical sections have to be defined
|
||||
//
|
||||
// class ExoticClass {
|
||||
// public:
|
||||
// ExoticClass() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(ctor_dtor_); ... }
|
||||
// ~ExoticClass() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(ctor_dtor_); ... }
|
||||
//
|
||||
// void Shareable() { DFAKE_SCOPED_LOCK(shareable_section_); ... }
|
||||
// void NotShareable() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(ctor_dtor_); ... }
|
||||
// ...
|
||||
// private:
|
||||
// DFAKE_MUTEX(ctor_dtor_);
|
||||
// DFAKE_MUTEX(shareable_section_);
|
||||
// };
|
||||
|
||||
#if DCHECK_IS_ON()
|
||||
|
||||
// Defines a class member that acts like a mutex. It is used only as a
|
||||
// verification tool.
|
||||
#define DFAKE_MUTEX(obj) mutable base::ThreadCollisionWarner obj
|
||||
// Asserts the call is never called simultaneously in two threads. Used at
|
||||
// member function scope.
|
||||
#define DFAKE_SCOPED_LOCK(obj) \
|
||||
base::ThreadCollisionWarner::ScopedCheck s_check_##obj(&obj)
|
||||
// Asserts the call is never called simultaneously in two threads. Used at
|
||||
// member function scope. Same as DFAKE_SCOPED_LOCK but allows recursive locks.
|
||||
#define DFAKE_SCOPED_RECURSIVE_LOCK(obj) \
|
||||
base::ThreadCollisionWarner::ScopedRecursiveCheck sr_check_##obj(&obj)
|
||||
// Asserts the code is always executed in the same thread.
|
||||
#define DFAKE_SCOPED_LOCK_THREAD_LOCKED(obj) \
|
||||
base::ThreadCollisionWarner::Check check_##obj(&obj)
|
||||
|
||||
#else
|
||||
|
||||
#define DFAKE_MUTEX(obj) typedef void InternalFakeMutexType##obj
|
||||
#define DFAKE_SCOPED_LOCK(obj) ((void)0)
|
||||
#define DFAKE_SCOPED_RECURSIVE_LOCK(obj) ((void)0)
|
||||
#define DFAKE_SCOPED_LOCK_THREAD_LOCKED(obj) ((void)0)
|
||||
|
||||
#endif
|
||||
|
||||
namespace base {
|
||||
|
||||
// The class ThreadCollisionWarner uses an Asserter to notify the collision
|
||||
// AsserterBase is the interfaces and DCheckAsserter is the default asserter
|
||||
// used. During the unit tests is used another class that doesn't "DCHECK"
|
||||
// in case of collision (check thread_collision_warner_unittests.cc)
|
||||
struct AsserterBase {
|
||||
virtual ~AsserterBase() {}
|
||||
virtual void warn() = 0;
|
||||
};
|
||||
|
||||
struct DCheckAsserter : public AsserterBase {
|
||||
virtual ~DCheckAsserter() {}
|
||||
virtual void warn() OVERRIDE;
|
||||
};
|
||||
|
||||
class ThreadCollisionWarner {
|
||||
public:
|
||||
// The parameter asserter is there only for test purpose
|
||||
explicit ThreadCollisionWarner(AsserterBase* asserter = new DCheckAsserter())
|
||||
: valid_thread_id_(0), counter_(0), asserter_(asserter) {}
|
||||
|
||||
~ThreadCollisionWarner() { delete asserter_; }
|
||||
|
||||
// This class is meant to be used through the macro
|
||||
// DFAKE_SCOPED_LOCK_THREAD_LOCKED
|
||||
// it doesn't leave the critical section, as opposed to ScopedCheck,
|
||||
// because the critical section being pinned is allowed to be used only
|
||||
// from one thread
|
||||
class Check {
|
||||
public:
|
||||
explicit Check(ThreadCollisionWarner* warner) : warner_(warner) {
|
||||
warner_->EnterSelf();
|
||||
}
|
||||
|
||||
~Check() {}
|
||||
|
||||
private:
|
||||
ThreadCollisionWarner* warner_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(Check);
|
||||
};
|
||||
|
||||
// This class is meant to be used through the macro
|
||||
// DFAKE_SCOPED_LOCK
|
||||
class ScopedCheck {
|
||||
public:
|
||||
explicit ScopedCheck(ThreadCollisionWarner* warner) : warner_(warner) {
|
||||
warner_->Enter();
|
||||
}
|
||||
|
||||
~ScopedCheck() { warner_->Leave(); }
|
||||
|
||||
private:
|
||||
ThreadCollisionWarner* warner_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ScopedCheck);
|
||||
};
|
||||
|
||||
// This class is meant to be used through the macro
|
||||
// DFAKE_SCOPED_RECURSIVE_LOCK
|
||||
class ScopedRecursiveCheck {
|
||||
public:
|
||||
explicit ScopedRecursiveCheck(ThreadCollisionWarner* warner)
|
||||
: warner_(warner) {
|
||||
warner_->EnterSelf();
|
||||
}
|
||||
|
||||
~ScopedRecursiveCheck() { warner_->Leave(); }
|
||||
|
||||
private:
|
||||
ThreadCollisionWarner* warner_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ScopedRecursiveCheck);
|
||||
};
|
||||
|
||||
private:
|
||||
// This method stores the current thread identifier and does a DCHECK
|
||||
// if a another thread has already done it, it is safe if same thread
|
||||
// calls this multiple time (recursion allowed).
|
||||
void EnterSelf();
|
||||
|
||||
// Same as EnterSelf but recursion is not allowed.
|
||||
void Enter();
|
||||
|
||||
// Removes the thread_id stored in order to allow other threads to
|
||||
// call EnterSelf or Enter.
|
||||
void Leave();
|
||||
|
||||
// This stores the thread id that is inside the critical section, if the
|
||||
// value is 0 then no thread is inside.
|
||||
volatile subtle::Atomic32 valid_thread_id_;
|
||||
|
||||
// Counter to trace how many time a critical section was "pinned"
|
||||
// (when allowed) in order to unpin it when counter_ reaches 0.
|
||||
volatile subtle::Atomic32 counter_;
|
||||
|
||||
// Here only for class unit tests purpose, during the test I need to not
|
||||
// DCHECK but notify the collision with something else.
|
||||
AsserterBase* asserter_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ThreadCollisionWarner);
|
||||
};
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_THREAD_COLLISION_WARNER_H_
|
@@ -151,14 +151,6 @@ typedef struct _cef_settings_t {
|
||||
///
|
||||
size_t size;
|
||||
|
||||
///
|
||||
// Set to true (1) to use a single process for the browser and renderer. This
|
||||
// run mode is not officially supported by Chromium and is less stable than
|
||||
// the multi-process default. Also configurable using the "single-process"
|
||||
// command-line switch.
|
||||
///
|
||||
int single_process;
|
||||
|
||||
///
|
||||
// Set to true (1) to disable the sandbox for sub-processes. See
|
||||
// cef_sandbox_win.h for requirements to enable the sandbox on Windows. Also
|
||||
@@ -189,7 +181,7 @@ typedef struct _cef_settings_t {
|
||||
// Set to true (1) to have the browser process message loop run in a separate
|
||||
// thread. If false (0) than the CefDoMessageLoopWork() function must be
|
||||
// called from your application message loop. This option is only supported on
|
||||
// Windows.
|
||||
// Windows and Linux.
|
||||
///
|
||||
int multi_threaded_message_loop;
|
||||
|
||||
|
@@ -539,7 +539,6 @@ struct CefSettingsTraits {
|
||||
static inline void set(const struct_type* src,
|
||||
struct_type* target,
|
||||
bool copy) {
|
||||
target->single_process = src->single_process;
|
||||
target->no_sandbox = src->no_sandbox;
|
||||
cef_string_set(src->browser_subprocess_path.str,
|
||||
src->browser_subprocess_path.length,
|
||||
|
@@ -130,6 +130,12 @@ ChromeZoomLevelPrefs* CefBrowserContext::GetZoomLevelPrefs() {
|
||||
GetStoragePartition(this, NULL)->GetZoomLevelDelegate());
|
||||
}
|
||||
|
||||
scoped_refptr<network::SharedURLLoaderFactory>
|
||||
CefBrowserContext::GetURLLoaderFactory() {
|
||||
return GetDefaultStoragePartition(this)
|
||||
->GetURLLoaderFactoryForBrowserProcess();
|
||||
}
|
||||
|
||||
void CefBrowserContext::OnRenderFrameDeleted(int render_process_id,
|
||||
int render_frame_id,
|
||||
bool is_main_frame,
|
||||
|
@@ -146,6 +146,7 @@ class CefBrowserContext : public ChromeProfileStub {
|
||||
|
||||
// Profile methods.
|
||||
ChromeZoomLevelPrefs* GetZoomLevelPrefs() override;
|
||||
scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory() override;
|
||||
|
||||
// Returns a RequestContext associated with this object. If this object is a
|
||||
// *Proxy then it will return the single associated proxy RequestContext. If
|
||||
|
@@ -418,7 +418,8 @@ CefBrowserContextImpl::GetSSLHostStateDelegate() {
|
||||
return ssl_host_state_delegate_.get();
|
||||
}
|
||||
|
||||
content::PermissionManager* CefBrowserContextImpl::GetPermissionManager() {
|
||||
content::PermissionControllerDelegate*
|
||||
CefBrowserContextImpl::GetPermissionControllerDelegate() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@@ -67,7 +67,8 @@ class CefBrowserContextImpl : public CefBrowserContext,
|
||||
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
|
||||
content::PushMessagingService* GetPushMessagingService() override;
|
||||
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
|
||||
content::PermissionManager* GetPermissionManager() override;
|
||||
content::PermissionControllerDelegate* GetPermissionControllerDelegate()
|
||||
override;
|
||||
content::BackgroundFetchDelegate* GetBackgroundFetchDelegate() override;
|
||||
content::BackgroundSyncController* GetBackgroundSyncController() override;
|
||||
content::BrowsingDataRemoverDelegate* GetBrowsingDataRemoverDelegate()
|
||||
|
@@ -153,8 +153,9 @@ CefBrowserContextProxy::GetSSLHostStateDelegate() {
|
||||
return parent_->GetSSLHostStateDelegate();
|
||||
}
|
||||
|
||||
content::PermissionManager* CefBrowserContextProxy::GetPermissionManager() {
|
||||
return parent_->GetPermissionManager();
|
||||
content::PermissionControllerDelegate*
|
||||
CefBrowserContextProxy::GetPermissionControllerDelegate() {
|
||||
return parent_->GetPermissionControllerDelegate();
|
||||
}
|
||||
|
||||
content::BackgroundFetchDelegate*
|
||||
|
@@ -42,7 +42,8 @@ class CefBrowserContextProxy : public CefBrowserContext {
|
||||
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
|
||||
content::PushMessagingService* GetPushMessagingService() override;
|
||||
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
|
||||
content::PermissionManager* GetPermissionManager() override;
|
||||
content::PermissionControllerDelegate* GetPermissionControllerDelegate()
|
||||
override;
|
||||
content::BackgroundFetchDelegate* GetBackgroundFetchDelegate() override;
|
||||
content::BackgroundSyncController* GetBackgroundSyncController() override;
|
||||
content::BrowsingDataRemoverDelegate* GetBrowsingDataRemoverDelegate()
|
||||
|
@@ -224,10 +224,17 @@ bool CefBrowserHost::CreateBrowser(
|
||||
return false;
|
||||
}
|
||||
|
||||
if (windowInfo.windowless_rendering_enabled &&
|
||||
!CefContext::Get()->settings().windowless_rendering_enabled) {
|
||||
LOG(ERROR) << "Creating a windowless browser without setting "
|
||||
"CefSettings.windowless_rendering_enabled may result in "
|
||||
"reduced performance or runtime errors.";
|
||||
}
|
||||
|
||||
// Create the browser on the UI thread.
|
||||
CreateBrowserHelper* helper = new CreateBrowserHelper(
|
||||
windowInfo, client, url, settings, request_context);
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(CreateBrowserWithHelper, helper));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(CreateBrowserWithHelper, helper));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -268,6 +275,11 @@ CefRefPtr<CefBrowser> CefBrowserHost::CreateBrowserSync(
|
||||
create_params.window_info.reset(new CefWindowInfo(windowInfo));
|
||||
create_params.client = client;
|
||||
create_params.url = GURL(url.ToString());
|
||||
if (!url.empty() && !create_params.url.is_valid() &&
|
||||
!create_params.url.has_scheme()) {
|
||||
std::string new_url = std::string("http://") + url.ToString();
|
||||
create_params.url = GURL(new_url);
|
||||
}
|
||||
create_params.settings = settings;
|
||||
create_params.request_context = request_context;
|
||||
|
||||
@@ -352,13 +364,13 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::Create(
|
||||
&wc_create_params.view, &wc_create_params.delegate_view);
|
||||
}
|
||||
|
||||
content::WebContents* web_contents =
|
||||
std::unique_ptr<content::WebContents> web_contents =
|
||||
content::WebContents::Create(wc_create_params);
|
||||
DCHECK(web_contents);
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser = CefBrowserHostImpl::CreateInternal(
|
||||
create_params.settings, create_params.client, web_contents, info,
|
||||
create_params.devtools_opener, is_devtools_popup,
|
||||
CefRefPtr<CefBrowserHostImpl> browser = CreateInternal(
|
||||
create_params.settings, create_params.client, web_contents.release(),
|
||||
true, info, create_params.devtools_opener, is_devtools_popup,
|
||||
create_params.request_context, std::move(platform_delegate),
|
||||
cef_extension);
|
||||
if (!browser)
|
||||
@@ -366,7 +378,7 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::Create(
|
||||
|
||||
if (create_params.extension) {
|
||||
browser->CreateExtensionHost(create_params.extension, browser_context,
|
||||
web_contents, create_params.url,
|
||||
browser->web_contents(), create_params.url,
|
||||
create_params.extension_host_type);
|
||||
} else if (!create_params.url.is_empty()) {
|
||||
browser->LoadURL(CefFrameHostImpl::kMainFrameId, create_params.url.spec(),
|
||||
@@ -382,6 +394,7 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::CreateInternal(
|
||||
const CefBrowserSettings& settings,
|
||||
CefRefPtr<CefClient> client,
|
||||
content::WebContents* web_contents,
|
||||
bool own_web_contents,
|
||||
scoped_refptr<CefBrowserInfo> browser_info,
|
||||
CefRefPtr<CefBrowserHostImpl> opener,
|
||||
bool is_devtools_popup,
|
||||
@@ -415,6 +428,8 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::CreateInternal(
|
||||
CefRefPtr<CefBrowserHostImpl> browser = new CefBrowserHostImpl(
|
||||
settings, client, web_contents, browser_info, opener, request_context,
|
||||
std::move(platform_delegate), extension);
|
||||
if (own_web_contents)
|
||||
browser->set_owned_web_contents(web_contents);
|
||||
if (!browser->CreateHostWindow())
|
||||
return nullptr;
|
||||
|
||||
@@ -612,8 +627,8 @@ void CefBrowserHostImpl::CloseBrowser(bool force_close) {
|
||||
CloseContents(contents);
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::CloseBrowser, this,
|
||||
force_close));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::CloseBrowser,
|
||||
this, force_close));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -641,7 +656,7 @@ bool CefBrowserHostImpl::TryCloseBrowser() {
|
||||
void CefBrowserHostImpl::SetFocus(bool focus) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::SetFocus, this, focus));
|
||||
base::BindOnce(&CefBrowserHostImpl::SetFocus, this, focus));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -695,8 +710,8 @@ void CefBrowserHostImpl::SetZoomLevel(double zoomLevel) {
|
||||
if (web_contents())
|
||||
content::HostZoomMap::SetZoomLevel(web_contents(), zoomLevel);
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::SetZoomLevel, this,
|
||||
zoomLevel));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::SetZoomLevel,
|
||||
this, zoomLevel));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -709,9 +724,9 @@ void CefBrowserHostImpl::RunFileDialog(
|
||||
CefRefPtr<CefRunFileDialogCallback> callback) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::RunFileDialog, this, mode,
|
||||
title, default_file_path, accept_filters,
|
||||
selected_accept_filter, callback));
|
||||
base::BindOnce(&CefBrowserHostImpl::RunFileDialog, this, mode,
|
||||
title, default_file_path, accept_filters,
|
||||
selected_accept_filter, callback));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -723,8 +738,8 @@ void CefBrowserHostImpl::RunFileDialog(
|
||||
|
||||
void CefBrowserHostImpl::StartDownload(const CefString& url) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::StartDownload, this, url));
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT, base::BindOnce(&CefBrowserHostImpl::StartDownload, this, url));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -758,9 +773,10 @@ void CefBrowserHostImpl::DownloadImage(
|
||||
bool bypass_cache,
|
||||
CefRefPtr<CefDownloadImageCallback> callback) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::DownloadImage, this,
|
||||
image_url, is_favicon, max_image_size,
|
||||
bypass_cache, callback));
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostImpl::DownloadImage, this, image_url,
|
||||
is_favicon, max_image_size, bypass_cache, callback));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -776,7 +792,7 @@ void CefBrowserHostImpl::DownloadImage(
|
||||
|
||||
web_contents()->DownloadImage(
|
||||
gurl, is_favicon, max_image_size * gfx::ImageSkia::GetMaxSupportedScale(),
|
||||
bypass_cache, base::Bind(OnDownloadImage, max_image_size, callback));
|
||||
bypass_cache, base::BindOnce(OnDownloadImage, max_image_size, callback));
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::Print() {
|
||||
@@ -787,7 +803,7 @@ void CefBrowserHostImpl::Print() {
|
||||
printing::CefPrintViewManager::FromWebContents(actionable_contents)
|
||||
->PrintNow(actionable_contents->GetRenderViewHost()->GetMainFrame());
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::Print, this));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::Print, this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -808,8 +824,8 @@ void CefBrowserHostImpl::PrintToPDF(const CefString& path,
|
||||
->PrintToPDF(actionable_contents->GetMainFrame(), base::FilePath(path),
|
||||
settings, pdf_callback);
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::PrintToPDF, this,
|
||||
path, settings, callback));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::PrintToPDF, this,
|
||||
path, settings, callback));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -819,7 +835,7 @@ void CefBrowserHostImpl::Find(int identifier,
|
||||
bool matchCase,
|
||||
bool findNext) {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (!web_contents_)
|
||||
if (!web_contents())
|
||||
return;
|
||||
|
||||
// Every find request must have a unique ID and these IDs must strictly
|
||||
@@ -837,14 +853,14 @@ void CefBrowserHostImpl::Find(int identifier,
|
||||
web_contents()->Find(identifier, searchText, options);
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::Find, this, identifier,
|
||||
searchText, forward, matchCase, findNext));
|
||||
base::BindOnce(&CefBrowserHostImpl::Find, this, identifier,
|
||||
searchText, forward, matchCase, findNext));
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::StopFinding(bool clearSelection) {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (!web_contents_)
|
||||
if (!web_contents())
|
||||
return;
|
||||
|
||||
content::StopFindAction action =
|
||||
@@ -852,8 +868,8 @@ void CefBrowserHostImpl::StopFinding(bool clearSelection) {
|
||||
: content::STOP_FIND_ACTION_KEEP_SELECTION;
|
||||
web_contents()->StopFinding(action);
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::StopFinding, this,
|
||||
clearSelection));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::StopFinding,
|
||||
this, clearSelection));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -862,7 +878,7 @@ void CefBrowserHostImpl::ShowDevTools(const CefWindowInfo& windowInfo,
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at) {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (!web_contents_)
|
||||
if (!web_contents())
|
||||
return;
|
||||
|
||||
if (devtools_frontend_) {
|
||||
@@ -881,7 +897,7 @@ void CefBrowserHostImpl::ShowDevTools(const CefWindowInfo& windowInfo,
|
||||
} else {
|
||||
ShowDevToolsHelper* helper = new ShowDevToolsHelper(
|
||||
this, windowInfo, client, settings, inspect_element_at);
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(ShowDevToolsWithHelper, helper));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(ShowDevToolsWithHelper, helper));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -892,7 +908,7 @@ void CefBrowserHostImpl::CloseDevTools() {
|
||||
devtools_frontend_->Close();
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::CloseDevTools, this));
|
||||
base::BindOnce(&CefBrowserHostImpl::CloseDevTools, this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -913,8 +929,9 @@ void CefBrowserHostImpl::GetNavigationEntries(
|
||||
return;
|
||||
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::GetNavigationEntries,
|
||||
this, visitor, current_only));
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT, base::BindOnce(&CefBrowserHostImpl::GetNavigationEntries, this,
|
||||
visitor, current_only));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -970,8 +987,8 @@ void CefBrowserHostImpl::SetAccessibilityState(
|
||||
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::SetAccessibilityState, this,
|
||||
accessibility_state));
|
||||
base::BindOnce(&CefBrowserHostImpl::SetAccessibilityState,
|
||||
this, accessibility_state));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -994,8 +1011,9 @@ void CefBrowserHostImpl::SetAutoResizeEnabled(bool enabled,
|
||||
const CefSize& min_size,
|
||||
const CefSize& max_size) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::SetAutoResizeEnabled,
|
||||
this, enabled, min_size, max_size));
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT, base::BindOnce(&CefBrowserHostImpl::SetAutoResizeEnabled, this,
|
||||
enabled, min_size, max_size));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1036,8 +1054,9 @@ bool CefBrowserHostImpl::IsWindowRenderingDisabled() {
|
||||
|
||||
void CefBrowserHostImpl::ReplaceMisspelling(const CefString& word) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::ReplaceMisspelling,
|
||||
this, word));
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostImpl::ReplaceMisspelling, this, word));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1047,8 +1066,9 @@ void CefBrowserHostImpl::ReplaceMisspelling(const CefString& word) {
|
||||
|
||||
void CefBrowserHostImpl::AddWordToDictionary(const CefString& word) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::AddWordToDictionary,
|
||||
this, word));
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostImpl::AddWordToDictionary, this, word));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1070,14 +1090,15 @@ void CefBrowserHostImpl::AddWordToDictionary(const CefString& word) {
|
||||
|
||||
void CefBrowserHostImpl::WasResized() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::WasResized, this));
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostImpl::WasResized, this));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!web_contents() || !platform_delegate_)
|
||||
return;
|
||||
|
||||
platform_delegate_->WasResized();
|
||||
platform_delegate_->SynchronizeVisualProperties();
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::WasHidden(bool hidden) {
|
||||
@@ -1088,7 +1109,7 @@ void CefBrowserHostImpl::WasHidden(bool hidden) {
|
||||
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHost::WasHidden, this, hidden));
|
||||
base::BindOnce(&CefBrowserHost::WasHidden, this, hidden));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1107,7 +1128,7 @@ void CefBrowserHostImpl::NotifyScreenInfoChanged() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::NotifyScreenInfoChanged, this));
|
||||
base::BindOnce(&CefBrowserHostImpl::NotifyScreenInfoChanged, this));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1125,7 +1146,7 @@ void CefBrowserHostImpl::Invalidate(PaintElementType type) {
|
||||
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::Invalidate, this, type));
|
||||
base::BindOnce(&CefBrowserHostImpl::Invalidate, this, type));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1137,17 +1158,17 @@ void CefBrowserHostImpl::Invalidate(PaintElementType type) {
|
||||
|
||||
void CefBrowserHostImpl::SendKeyEvent(const CefKeyEvent& event) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::SendKeyEvent, this, event));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::SendKeyEvent,
|
||||
this, event));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!web_contents() || !platform_delegate_)
|
||||
return;
|
||||
|
||||
content::NativeWebKeyboardEvent web_event(
|
||||
blink::WebInputEvent::kUndefined, blink::WebInputEvent::kNoModifiers,
|
||||
ui::EventTimeStampToSeconds(ui::EventTimeForNow()));
|
||||
content::NativeWebKeyboardEvent web_event(blink::WebInputEvent::kUndefined,
|
||||
blink::WebInputEvent::kNoModifiers,
|
||||
ui::EventTimeForNow());
|
||||
platform_delegate_->TranslateKeyEvent(web_event, event);
|
||||
platform_delegate_->SendKeyEvent(web_event);
|
||||
}
|
||||
@@ -1157,8 +1178,9 @@ void CefBrowserHostImpl::SendMouseClickEvent(const CefMouseEvent& event,
|
||||
bool mouseUp,
|
||||
int clickCount) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::SendMouseClickEvent,
|
||||
this, event, type, mouseUp, clickCount));
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostImpl::SendMouseClickEvent, this,
|
||||
event, type, mouseUp, clickCount));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1174,8 +1196,9 @@ void CefBrowserHostImpl::SendMouseClickEvent(const CefMouseEvent& event,
|
||||
void CefBrowserHostImpl::SendMouseMoveEvent(const CefMouseEvent& event,
|
||||
bool mouseLeave) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::SendMouseMoveEvent,
|
||||
this, event, mouseLeave));
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostImpl::SendMouseMoveEvent, this,
|
||||
event, mouseLeave));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1191,8 +1214,9 @@ void CefBrowserHostImpl::SendMouseWheelEvent(const CefMouseEvent& event,
|
||||
int deltaX,
|
||||
int deltaY) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::SendMouseWheelEvent,
|
||||
this, event, deltaX, deltaY));
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostImpl::SendMouseWheelEvent, this,
|
||||
event, deltaX, deltaY));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1210,8 +1234,9 @@ void CefBrowserHostImpl::SendFocusEvent(bool setFocus) {
|
||||
|
||||
void CefBrowserHostImpl::SendCaptureLostEvent() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::SendCaptureLostEvent, this));
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostImpl::SendCaptureLostEvent, this));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1226,7 +1251,7 @@ void CefBrowserHostImpl::NotifyMoveOrResizeStarted() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::NotifyMoveOrResizeStarted, this));
|
||||
base::BindOnce(&CefBrowserHostImpl::NotifyMoveOrResizeStarted, this));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1250,8 +1275,8 @@ int CefBrowserHostImpl::GetWindowlessFrameRate() {
|
||||
void CefBrowserHostImpl::SetWindowlessFrameRate(int frame_rate) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::SetWindowlessFrameRate, this,
|
||||
frame_rate));
|
||||
base::BindOnce(&CefBrowserHostImpl::SetWindowlessFrameRate,
|
||||
this, frame_rate));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1275,16 +1300,17 @@ bool CefBrowserHostImpl::CanGoBack() {
|
||||
|
||||
void CefBrowserHostImpl::GoBack() {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (frame_destruction_pending_) {
|
||||
// Try again after frame destruction has completed.
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::GoBack, this));
|
||||
if (navigation_locked()) {
|
||||
// Try again after the lock has been released.
|
||||
set_pending_navigation_action(
|
||||
base::BindOnce(&CefBrowserHostImpl::GoBack, this));
|
||||
return;
|
||||
}
|
||||
|
||||
if (web_contents_.get() && web_contents_->GetController().CanGoBack())
|
||||
web_contents_->GetController().GoBack();
|
||||
if (web_contents() && web_contents()->GetController().CanGoBack())
|
||||
web_contents()->GetController().GoBack();
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::GoBack, this));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::GoBack, this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1295,16 +1321,18 @@ bool CefBrowserHostImpl::CanGoForward() {
|
||||
|
||||
void CefBrowserHostImpl::GoForward() {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (frame_destruction_pending_) {
|
||||
// Try again after frame destruction has completed.
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::GoForward, this));
|
||||
if (navigation_locked()) {
|
||||
// Try again after the lock has been released.
|
||||
set_pending_navigation_action(
|
||||
base::BindOnce(&CefBrowserHostImpl::GoForward, this));
|
||||
return;
|
||||
}
|
||||
|
||||
if (web_contents_.get() && web_contents_->GetController().CanGoForward())
|
||||
web_contents_->GetController().GoForward();
|
||||
if (web_contents() && web_contents()->GetController().CanGoForward())
|
||||
web_contents()->GetController().GoForward();
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::GoForward, this));
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostImpl::GoForward, this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1315,50 +1343,52 @@ bool CefBrowserHostImpl::IsLoading() {
|
||||
|
||||
void CefBrowserHostImpl::Reload() {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (frame_destruction_pending_) {
|
||||
// Try again after frame destruction has completed.
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::Reload, this));
|
||||
if (navigation_locked()) {
|
||||
// Try again after the lock has been released.
|
||||
set_pending_navigation_action(
|
||||
base::BindOnce(&CefBrowserHostImpl::Reload, this));
|
||||
return;
|
||||
}
|
||||
|
||||
if (web_contents_.get())
|
||||
web_contents_->GetController().Reload(content::ReloadType::NORMAL, true);
|
||||
if (web_contents())
|
||||
web_contents()->GetController().Reload(content::ReloadType::NORMAL, true);
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::Reload, this));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::Reload, this));
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::ReloadIgnoreCache() {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (frame_destruction_pending_) {
|
||||
// Try again after frame destruction has completed.
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::ReloadIgnoreCache, this));
|
||||
if (navigation_locked()) {
|
||||
// Try again after the lock has been released.
|
||||
set_pending_navigation_action(
|
||||
base::BindOnce(&CefBrowserHostImpl::ReloadIgnoreCache, this));
|
||||
return;
|
||||
}
|
||||
|
||||
if (web_contents_.get()) {
|
||||
web_contents_->GetController().Reload(
|
||||
if (web_contents()) {
|
||||
web_contents()->GetController().Reload(
|
||||
content::ReloadType::BYPASSING_CACHE, true);
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::ReloadIgnoreCache, this));
|
||||
base::BindOnce(&CefBrowserHostImpl::ReloadIgnoreCache, this));
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::StopLoad() {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (frame_destruction_pending_) {
|
||||
// Try again after frame destruction has completed.
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::StopLoad, this));
|
||||
if (navigation_locked()) {
|
||||
// Try again after the lock has been released.
|
||||
set_pending_navigation_action(
|
||||
base::BindOnce(&CefBrowserHostImpl::StopLoad, this));
|
||||
return;
|
||||
}
|
||||
|
||||
if (web_contents_.get())
|
||||
web_contents_->Stop();
|
||||
if (web_contents())
|
||||
web_contents()->Stop();
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::StopLoad, this));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::StopLoad, this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1544,7 +1574,8 @@ void CefBrowserHostImpl::DestroyBrowser() {
|
||||
registrar_.reset(NULL);
|
||||
response_manager_.reset(NULL);
|
||||
content::WebContentsObserver::Observe(NULL);
|
||||
web_contents_.reset(NULL);
|
||||
if (owned_web_contents_)
|
||||
owned_web_contents_.reset(NULL);
|
||||
|
||||
// Delete objects created by the platform delegate that may be referenced by
|
||||
// the WebContents.
|
||||
@@ -1646,15 +1677,15 @@ void CefBrowserHostImpl::LoadURL(int64 frame_id,
|
||||
if (frame_id == CefFrameHostImpl::kMainFrameId) {
|
||||
// Go through the navigation controller.
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (frame_destruction_pending_) {
|
||||
// Try again after frame destruction has completed.
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::LoadURL, this, frame_id,
|
||||
url, referrer, transition, extra_headers));
|
||||
if (navigation_locked()) {
|
||||
// Try again after the lock has been released.
|
||||
set_pending_navigation_action(
|
||||
base::BindOnce(&CefBrowserHostImpl::LoadURL, this, frame_id, url,
|
||||
referrer, transition, extra_headers));
|
||||
return;
|
||||
}
|
||||
|
||||
if (web_contents_.get()) {
|
||||
if (web_contents()) {
|
||||
GURL gurl = GURL(url);
|
||||
|
||||
if (!gurl.is_valid() && !gurl.has_scheme()) {
|
||||
@@ -1669,14 +1700,14 @@ void CefBrowserHostImpl::LoadURL(int64 frame_id,
|
||||
return;
|
||||
}
|
||||
|
||||
web_contents_->GetController().LoadURL(gurl, referrer, transition,
|
||||
extra_headers);
|
||||
web_contents()->GetController().LoadURL(gurl, referrer, transition,
|
||||
extra_headers);
|
||||
OnSetFocus(FOCUS_SOURCE_NAVIGATION);
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT, base::Bind(&CefBrowserHostImpl::LoadURL, this, frame_id, url,
|
||||
referrer, transition, extra_headers));
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostImpl::LoadURL, this, frame_id,
|
||||
url, referrer, transition, extra_headers));
|
||||
}
|
||||
} else {
|
||||
CefNavigateParams params(GURL(url), transition);
|
||||
@@ -1735,8 +1766,9 @@ void CefBrowserHostImpl::SendCommand(
|
||||
|
||||
Send(new CefMsg_Request(MSG_ROUTING_NONE, params));
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::SendCommand, this,
|
||||
frame_id, command, responseHandler));
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostImpl::SendCommand, this,
|
||||
frame_id, command, responseHandler));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1776,9 +1808,10 @@ void CefBrowserHostImpl::SendCode(
|
||||
|
||||
Send(new CefMsg_Request(MSG_ROUTING_NONE, params));
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::SendCode, this,
|
||||
frame_id, is_javascript, code, script_url,
|
||||
script_start_line, responseHandler));
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostImpl::SendCode, this, frame_id,
|
||||
is_javascript, code, script_url,
|
||||
script_start_line, responseHandler));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1790,7 +1823,7 @@ void CefBrowserHostImpl::ExecuteJavaScriptWithUserGestureForTests(
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::Bind(
|
||||
base::BindOnce(
|
||||
&CefBrowserHostImpl::ExecuteJavaScriptWithUserGestureForTests, this,
|
||||
frame_id, javascript));
|
||||
return;
|
||||
@@ -1814,7 +1847,7 @@ void CefBrowserHostImpl::ExecuteJavaScriptWithUserGestureForTests(
|
||||
void CefBrowserHostImpl::ViewText(const std::string& text) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::ViewText, this, text));
|
||||
base::BindOnce(&CefBrowserHostImpl::ViewText, this, text));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1837,7 +1870,7 @@ void CefBrowserHostImpl::HandleExternalProtocol(const GURL& url) {
|
||||
} else {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::HandleExternalProtocol, this, url));
|
||||
base::BindOnce(&CefBrowserHostImpl::HandleExternalProtocol, this, url));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1853,8 +1886,8 @@ int CefBrowserHostImpl::browser_id() const {
|
||||
|
||||
content::BrowserContext* CefBrowserHostImpl::GetBrowserContext() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (web_contents_)
|
||||
return web_contents_->GetBrowserContext();
|
||||
if (web_contents())
|
||||
return web_contents()->GetBrowserContext();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -1879,8 +1912,8 @@ void CefBrowserHostImpl::OnSetFocus(cef_focus_source_t source) {
|
||||
if (platform_delegate_)
|
||||
platform_delegate_->SendFocusEvent(true);
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::OnSetFocus, this, source));
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT, base::BindOnce(&CefBrowserHostImpl::OnSetFocus, this, source));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1899,7 +1932,8 @@ bool CefBrowserHostImpl::EmbedsFullscreenWidget() const {
|
||||
|
||||
void CefBrowserHostImpl::EnterFullscreenModeForTab(
|
||||
content::WebContents* web_contents,
|
||||
const GURL& origin) {
|
||||
const GURL& origin,
|
||||
const blink::WebFullscreenOptions& options) {
|
||||
OnFullscreenModeChange(true);
|
||||
}
|
||||
|
||||
@@ -1947,9 +1981,10 @@ void CefBrowserHostImpl::ImeSetComposition(
|
||||
}
|
||||
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::ImeSetComposition, this, text,
|
||||
underlines, replacement_range, selection_range));
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostImpl::ImeSetComposition, this, text,
|
||||
underlines, replacement_range, selection_range));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1970,8 +2005,8 @@ void CefBrowserHostImpl::ImeCommitText(const CefString& text,
|
||||
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::ImeCommitText, this, text,
|
||||
replacement_range, relative_cursor_pos));
|
||||
base::BindOnce(&CefBrowserHostImpl::ImeCommitText, this, text,
|
||||
replacement_range, relative_cursor_pos));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1990,8 +2025,8 @@ void CefBrowserHostImpl::ImeFinishComposingText(bool keep_selection) {
|
||||
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::ImeFinishComposingText, this,
|
||||
keep_selection));
|
||||
base::BindOnce(&CefBrowserHostImpl::ImeFinishComposingText,
|
||||
this, keep_selection));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2008,8 +2043,9 @@ void CefBrowserHostImpl::ImeCancelComposition() {
|
||||
}
|
||||
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::ImeCancelComposition, this));
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostImpl::ImeCancelComposition, this));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2029,8 +2065,9 @@ void CefBrowserHostImpl::DragTargetDragEnter(
|
||||
}
|
||||
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::DragTargetDragEnter,
|
||||
this, drag_data, event, allowed_ops));
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostImpl::DragTargetDragEnter, this,
|
||||
drag_data, event, allowed_ops));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2054,8 +2091,9 @@ void CefBrowserHostImpl::DragTargetDragOver(
|
||||
}
|
||||
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::DragTargetDragOver,
|
||||
this, event, allowed_ops));
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostImpl::DragTargetDragOver, this,
|
||||
event, allowed_ops));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2072,8 +2110,8 @@ void CefBrowserHostImpl::DragTargetDragLeave() {
|
||||
}
|
||||
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::DragTargetDragLeave, this));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(
|
||||
&CefBrowserHostImpl::DragTargetDragLeave, this));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2090,8 +2128,8 @@ void CefBrowserHostImpl::DragTargetDrop(const CefMouseEvent& event) {
|
||||
}
|
||||
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::DragTargetDrop, this, event));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::DragTargetDrop,
|
||||
this, event));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2110,7 +2148,7 @@ void CefBrowserHostImpl::DragSourceSystemDragEnded() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::DragSourceSystemDragEnded, this));
|
||||
base::BindOnce(&CefBrowserHostImpl::DragSourceSystemDragEnded, this));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2130,8 +2168,9 @@ void CefBrowserHostImpl::DragSourceEndedAt(
|
||||
}
|
||||
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::DragSourceEndedAt,
|
||||
this, x, y, op));
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostImpl::DragSourceEndedAt, this, x, y, op));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2181,15 +2220,25 @@ bool CefBrowserHostImpl::ShouldTransferNavigation(
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::AddNewContents(content::WebContents* source,
|
||||
content::WebContents* new_contents,
|
||||
WindowOpenDisposition disposition,
|
||||
const gfx::Rect& initial_rect,
|
||||
bool user_gesture,
|
||||
bool* was_blocked) {
|
||||
void CefBrowserHostImpl::AddNewContents(
|
||||
content::WebContents* source,
|
||||
std::unique_ptr<content::WebContents> new_contents,
|
||||
WindowOpenDisposition disposition,
|
||||
const gfx::Rect& initial_rect,
|
||||
bool user_gesture,
|
||||
bool* was_blocked) {
|
||||
CefRefPtr<CefBrowserHostImpl> owner =
|
||||
GetBrowserForContents(new_contents.get());
|
||||
if (owner) {
|
||||
// Taking ownership of |new_contents|.
|
||||
owner->set_owned_web_contents(new_contents.release());
|
||||
return;
|
||||
}
|
||||
|
||||
if (extension_host_) {
|
||||
extension_host_->AddNewContents(source, new_contents, disposition,
|
||||
initial_rect, user_gesture, was_blocked);
|
||||
extension_host_->AddNewContents(source, std::move(new_contents),
|
||||
disposition, initial_rect, user_gesture,
|
||||
was_blocked);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2469,10 +2518,12 @@ void CefBrowserHostImpl::WebContentsCreated(
|
||||
static_cast<CefBrowserContext*>(new_contents->GetBrowserContext());
|
||||
DCHECK(browser_context);
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser = CefBrowserHostImpl::CreateInternal(
|
||||
settings, client, new_contents, info, opener, false,
|
||||
browser_context->GetCefRequestContext(), std::move(platform_delegate),
|
||||
nullptr);
|
||||
// We don't officially own |new_contents| until AddNewContents() is called.
|
||||
// However, we need to install observers/delegates here.
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
CreateInternal(settings, client, new_contents, false, info, opener, false,
|
||||
browser_context->GetCefRequestContext(),
|
||||
std::move(platform_delegate), nullptr);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::DidNavigateMainFramePostCommit(
|
||||
@@ -2535,7 +2586,7 @@ void CefBrowserHostImpl::ResizeDueToAutoResize(content::WebContents* source,
|
||||
void CefBrowserHostImpl::RequestMediaAccessPermission(
|
||||
content::WebContents* web_contents,
|
||||
const content::MediaStreamRequest& request,
|
||||
const content::MediaResponseCallback& callback) {
|
||||
content::MediaResponseCallback callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
content::MediaStreamDevices devices;
|
||||
@@ -2544,8 +2595,8 @@ void CefBrowserHostImpl::RequestMediaAccessPermission(
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
if (!command_line->HasSwitch(switches::kEnableMediaStream)) {
|
||||
// Cancel the request.
|
||||
callback.Run(devices, content::MEDIA_DEVICE_PERMISSION_DENIED,
|
||||
std::unique_ptr<content::MediaStreamUI>());
|
||||
std::move(callback).Run(devices, content::MEDIA_DEVICE_PERMISSION_DENIED,
|
||||
std::unique_ptr<content::MediaStreamUI>());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2582,8 +2633,8 @@ void CefBrowserHostImpl::RequestMediaAccessPermission(
|
||||
}
|
||||
}
|
||||
|
||||
callback.Run(devices, content::MEDIA_DEVICE_OK,
|
||||
std::unique_ptr<content::MediaStreamUI>());
|
||||
std::move(callback).Run(devices, content::MEDIA_DEVICE_OK,
|
||||
std::unique_ptr<content::MediaStreamUI>());
|
||||
}
|
||||
|
||||
bool CefBrowserHostImpl::CheckMediaAccessPermission(
|
||||
@@ -2735,9 +2786,8 @@ void CefBrowserHostImpl::RenderProcessGone(base::TerminationStatus status) {
|
||||
if (client_.get()) {
|
||||
CefRefPtr<CefRequestHandler> handler = client_->GetRequestHandler();
|
||||
if (handler.get()) {
|
||||
frame_destruction_pending_ = true;
|
||||
std::unique_ptr<NavigationLock> navigation_lock = CreateNavigationLock();
|
||||
handler->OnRenderProcessTerminated(this, ts);
|
||||
frame_destruction_pending_ = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2883,13 +2933,13 @@ bool CefBrowserHostImpl::OnMessageReceived(
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::AccessibilityEventReceived(
|
||||
const std::vector<content::AXEventNotificationDetails>& eventData) {
|
||||
const content::AXEventNotificationDetails& content_event_bundle) {
|
||||
// Only needed in windowless mode.
|
||||
if (IsWindowless()) {
|
||||
if (!web_contents() || !platform_delegate_)
|
||||
return;
|
||||
|
||||
platform_delegate_->AccessibilityEventReceived(eventData);
|
||||
platform_delegate_->AccessibilityEventReceived(content_event_bundle);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2928,6 +2978,38 @@ bool CefBrowserHostImpl::HasObserver(Observer* observer) const {
|
||||
return observers_.HasObserver(observer);
|
||||
}
|
||||
|
||||
CefBrowserHostImpl::NavigationLock::NavigationLock(
|
||||
CefRefPtr<CefBrowserHostImpl> browser)
|
||||
: browser_(browser) {
|
||||
CEF_REQUIRE_UIT();
|
||||
browser_->navigation_lock_count_++;
|
||||
}
|
||||
|
||||
CefBrowserHostImpl::NavigationLock::~NavigationLock() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (--browser_->navigation_lock_count_ == 0) {
|
||||
if (!browser_->pending_navigation_action_.is_null()) {
|
||||
CEF_POST_TASK(CEF_UIT, std::move(browser_->pending_navigation_action_));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<CefBrowserHostImpl::NavigationLock>
|
||||
CefBrowserHostImpl::CreateNavigationLock() {
|
||||
return base::WrapUnique(new NavigationLock(this));
|
||||
}
|
||||
|
||||
bool CefBrowserHostImpl::navigation_locked() const {
|
||||
CEF_REQUIRE_UIT();
|
||||
return navigation_lock_count_ > 0;
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::set_pending_navigation_action(
|
||||
base::OnceClosure action) {
|
||||
CEF_REQUIRE_UIT();
|
||||
pending_navigation_action_ = std::move(action);
|
||||
}
|
||||
|
||||
// content::WebContentsObserver::OnMessageReceived() message handlers.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -3101,7 +3183,6 @@ CefBrowserHostImpl::CefBrowserHostImpl(
|
||||
main_frame_id_(CefFrameHostImpl::kInvalidFrameId),
|
||||
focused_frame_id_(CefFrameHostImpl::kInvalidFrameId),
|
||||
destruction_state_(DESTRUCTION_STATE_NONE),
|
||||
frame_destruction_pending_(false),
|
||||
window_destroyed_(false),
|
||||
is_in_onsetfocus_(false),
|
||||
focus_on_editable_field_(false),
|
||||
@@ -3117,7 +3198,6 @@ CefBrowserHostImpl::CefBrowserHostImpl(
|
||||
DCHECK(!browser_info_->browser().get());
|
||||
browser_info_->set_browser(this);
|
||||
|
||||
web_contents_.reset(web_contents);
|
||||
web_contents->SetDelegate(this);
|
||||
|
||||
// Associate the WebContents with this browser object.
|
||||
@@ -3136,15 +3216,15 @@ CefBrowserHostImpl::CefBrowserHostImpl(
|
||||
|
||||
response_manager_.reset(new CefResponseManager);
|
||||
|
||||
PrefsTabHelper::CreateForWebContents(web_contents_.get());
|
||||
printing::CefPrintViewManager::CreateForWebContents(web_contents_.get());
|
||||
PrefsTabHelper::CreateForWebContents(web_contents);
|
||||
printing::CefPrintViewManager::CreateForWebContents(web_contents);
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
extensions::CefExtensionWebContentsObserver::CreateForWebContents(
|
||||
web_contents_.get());
|
||||
web_contents);
|
||||
|
||||
// Used by the tabs extension API.
|
||||
zoom::ZoomController::CreateForWebContents(web_contents_.get());
|
||||
zoom::ZoomController::CreateForWebContents(web_contents);
|
||||
}
|
||||
|
||||
// Make sure RenderViewCreated is called at least one time.
|
||||
@@ -3154,6 +3234,15 @@ CefBrowserHostImpl::CefBrowserHostImpl(
|
||||
platform_delegate_->BrowserCreated(this);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::set_owned_web_contents(
|
||||
content::WebContents* owned_contents) {
|
||||
// Should not currently own a WebContents.
|
||||
CHECK(!owned_web_contents_);
|
||||
// Should already be associated with |owned_contents|.
|
||||
CHECK(web_contents() == owned_contents);
|
||||
owned_web_contents_.reset(owned_contents);
|
||||
}
|
||||
|
||||
bool CefBrowserHostImpl::CreateHostWindow() {
|
||||
// |host_window_handle_| will not change after initial host creation for
|
||||
// non-views-hosted browsers.
|
||||
@@ -3458,12 +3547,11 @@ void CefBrowserHostImpl::OnLoadError(CefRefPtr<CefFrame> frame,
|
||||
if (client_.get()) {
|
||||
CefRefPtr<CefLoadHandler> handler = client_->GetLoadHandler();
|
||||
if (handler.get()) {
|
||||
frame_destruction_pending_ = true;
|
||||
std::unique_ptr<NavigationLock> navigation_lock = CreateNavigationLock();
|
||||
// Notify the handler that loading has failed.
|
||||
handler->OnLoadError(this, frame,
|
||||
static_cast<cef_errorcode_t>(error_code),
|
||||
net::ErrorToShortString(error_code), url.spec());
|
||||
frame_destruction_pending_ = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3529,9 +3617,9 @@ void CefBrowserHostImpl::ConfigureAutoResize() {
|
||||
|
||||
bool CefBrowserHostImpl::Send(IPC::Message* message) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT, base::Bind(base::IgnoreResult(&CefBrowserHostImpl::Send), this,
|
||||
message));
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(base::IgnoreResult(&CefBrowserHostImpl::Send),
|
||||
this, message));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -400,7 +400,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
const content::OpenURLParams& params) override;
|
||||
bool ShouldTransferNavigation(bool is_main_frame_navigation) override;
|
||||
void AddNewContents(content::WebContents* source,
|
||||
content::WebContents* new_contents,
|
||||
std::unique_ptr<content::WebContents> new_contents,
|
||||
WindowOpenDisposition disposition,
|
||||
const gfx::Rect& initial_rect,
|
||||
bool user_gesture,
|
||||
@@ -452,8 +452,10 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
void RunFileChooser(content::RenderFrameHost* render_frame_host,
|
||||
const content::FileChooserParams& params) override;
|
||||
bool EmbedsFullscreenWidget() const override;
|
||||
void EnterFullscreenModeForTab(content::WebContents* web_contents,
|
||||
const GURL& origin) override;
|
||||
void EnterFullscreenModeForTab(
|
||||
content::WebContents* web_contents,
|
||||
const GURL& origin,
|
||||
const blink::WebFullscreenOptions& options) override;
|
||||
void ExitFullscreenModeForTab(content::WebContents* web_contents) override;
|
||||
bool IsFullscreenForTabOrPending(
|
||||
const content::WebContents* web_contents) const override;
|
||||
@@ -472,7 +474,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
void RequestMediaAccessPermission(
|
||||
content::WebContents* web_contents,
|
||||
const content::MediaStreamRequest& request,
|
||||
const content::MediaResponseCallback& callback) override;
|
||||
content::MediaResponseCallback callback) override;
|
||||
bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host,
|
||||
const GURL& security_origin,
|
||||
content::MediaStreamType type) override;
|
||||
@@ -504,8 +506,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
bool OnMessageReceived(const IPC::Message& message,
|
||||
content::RenderFrameHost* render_frame_host) override;
|
||||
void AccessibilityEventReceived(
|
||||
const std::vector<content::AXEventNotificationDetails>& eventData)
|
||||
override;
|
||||
const content::AXEventNotificationDetails& content_event_bundle) override;
|
||||
void AccessibilityLocationChangesReceived(
|
||||
const std::vector<content::AXLocationChangeNotificationDetails>& locData)
|
||||
override;
|
||||
@@ -520,6 +521,20 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
void RemoveObserver(Observer* observer);
|
||||
bool HasObserver(Observer* observer) const;
|
||||
|
||||
class NavigationLock final {
|
||||
private:
|
||||
friend class CefBrowserHostImpl;
|
||||
friend std::unique_ptr<NavigationLock>::deleter_type;
|
||||
|
||||
explicit NavigationLock(CefRefPtr<CefBrowserHostImpl> browser);
|
||||
~NavigationLock();
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser_;
|
||||
};
|
||||
|
||||
// Block navigation-related events on NavigationLock life span.
|
||||
std::unique_ptr<NavigationLock> CreateNavigationLock();
|
||||
|
||||
private:
|
||||
class DevToolsWebContentsObserver;
|
||||
|
||||
@@ -527,6 +542,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
const CefBrowserSettings& settings,
|
||||
CefRefPtr<CefClient> client,
|
||||
content::WebContents* web_contents,
|
||||
bool own_web_contents,
|
||||
scoped_refptr<CefBrowserInfo> browser_info,
|
||||
CefRefPtr<CefBrowserHostImpl> opener,
|
||||
bool is_devtools_popup,
|
||||
@@ -564,6 +580,8 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate,
|
||||
CefRefPtr<CefExtension> extension);
|
||||
|
||||
void set_owned_web_contents(content::WebContents* owned_contents);
|
||||
|
||||
// Give the platform delegate an opportunity to create the host window.
|
||||
bool CreateHostWindow();
|
||||
|
||||
@@ -576,6 +594,11 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
void DestroyExtensionHost();
|
||||
void OnExtensionHostDeleted();
|
||||
|
||||
// Returns true if navigation actions are currently locked.
|
||||
bool navigation_locked() const;
|
||||
// Action to be executed once the navigation lock is released.
|
||||
void set_pending_navigation_action(base::OnceClosure action);
|
||||
|
||||
// Update or create a frame object. |frame_id| (renderer routing id) will be
|
||||
// >= 0 if the frame currently exists in the renderer process. |frame_id| will
|
||||
// be < 0 for the main frame if it has not yet navigated for the first time,
|
||||
@@ -635,7 +658,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
|
||||
CefBrowserSettings settings_;
|
||||
CefRefPtr<CefClient> client_;
|
||||
std::unique_ptr<content::WebContents> web_contents_;
|
||||
scoped_refptr<CefBrowserInfo> browser_info_;
|
||||
CefWindowHandle opener_;
|
||||
CefRefPtr<CefRequestContext> request_context_;
|
||||
@@ -644,6 +666,12 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
const bool is_views_hosted_;
|
||||
CefWindowHandle host_window_handle_;
|
||||
|
||||
// Non-nullptr if this object owns the WebContents. Will be nullptr for popup
|
||||
// browsers between the calls to WebContentsCreated() and AddNewContents(),
|
||||
// and may never be set if the parent browser is destroyed during popup
|
||||
// creation.
|
||||
std::unique_ptr<content::WebContents> owned_web_contents_;
|
||||
|
||||
// Volatile state information. All access must be protected by the state lock.
|
||||
base::Lock state_lock_;
|
||||
bool is_loading_;
|
||||
@@ -677,9 +705,11 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
// thread.
|
||||
DestructionState destruction_state_;
|
||||
|
||||
// True if frame destruction is currently pending. Navigation should not occur
|
||||
// while this flag is true.
|
||||
bool frame_destruction_pending_;
|
||||
// Navigation will not occur while |navigation_lock_count_| > 0.
|
||||
// |pending_navigation_action_| will be executed when the lock is released.
|
||||
// Only accessed on the UI thread.
|
||||
int navigation_lock_count_ = 0;
|
||||
base::OnceClosure pending_navigation_action_;
|
||||
|
||||
// True if the OS window hosting the browser has been destroyed. Only accessed
|
||||
// on the UI thread.
|
||||
|
@@ -10,7 +10,6 @@
|
||||
|
||||
#include "libcef/browser/browser_context_impl.h"
|
||||
#include "libcef/browser/browser_context_keyed_service_factories.h"
|
||||
#include "libcef/browser/browser_message_loop.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/devtools_manager_delegate.h"
|
||||
@@ -30,10 +29,11 @@
|
||||
#include "chrome/browser/chrome_browser_main_extra_parts.h"
|
||||
#include "chrome/browser/plugins/plugin_finder.h"
|
||||
#include "content/public/browser/gpu_data_manager.h"
|
||||
#include "content/public/common/result_codes.h"
|
||||
#include "extensions/browser/extension_system.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "net/base/net_module.h"
|
||||
#include "services/service_manager/embedder/result_codes.h"
|
||||
#include "ui/base/material_design/material_design_controller.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
|
||||
#if defined(USE_AURA)
|
||||
@@ -80,7 +80,7 @@ int CefBrowserMainParts::PreEarlyInitialization() {
|
||||
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
|
||||
chrome_extra_parts_[i]->PreEarlyInitialization();
|
||||
|
||||
return content::RESULT_CODE_NORMAL_EXIT;
|
||||
return service_manager::RESULT_CODE_NORMAL_EXIT;
|
||||
}
|
||||
|
||||
void CefBrowserMainParts::PostEarlyInitialization() {
|
||||
@@ -107,11 +107,6 @@ void CefBrowserMainParts::ToolkitInitialized() {
|
||||
}
|
||||
|
||||
void CefBrowserMainParts::PreMainMessageLoopStart() {
|
||||
if (!base::MessageLoop::current()) {
|
||||
// Create the browser message loop.
|
||||
message_loop_.reset(new CefBrowserMessageLoop());
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
|
||||
chrome_extra_parts_[i]->PreMainMessageLoopStart();
|
||||
}
|
||||
@@ -156,6 +151,8 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
|
||||
display::Screen::SetScreenInstance(views::CreateDesktopScreen());
|
||||
#endif
|
||||
|
||||
ui::MaterialDesignController::Initialize();
|
||||
|
||||
// CEF's profile is a BrowserContext.
|
||||
PreProfileInit();
|
||||
|
||||
|
@@ -16,11 +16,6 @@
|
||||
#include "content/public/browser/browser_main_parts.h"
|
||||
#include "net/url_request/url_request_context_getter.h"
|
||||
|
||||
namespace base {
|
||||
class MessageLoop;
|
||||
class Thread;
|
||||
} // namespace base
|
||||
|
||||
namespace content {
|
||||
struct MainFunctionParams;
|
||||
}
|
||||
@@ -54,7 +49,7 @@ class CefBrowserMainParts : public content::BrowserMainParts {
|
||||
void PostMainMessageLoopStart() override;
|
||||
int PreCreateThreads() override;
|
||||
void ServiceManagerConnectionStarted(
|
||||
content::ServiceManagerConnection* connection);
|
||||
content::ServiceManagerConnection* connection) override;
|
||||
void PreMainMessageLoopRun() override;
|
||||
void PostMainMessageLoopRun() override;
|
||||
void PostDestroyThreads() override;
|
||||
@@ -89,7 +84,6 @@ class CefBrowserMainParts : public content::BrowserMainParts {
|
||||
|
||||
CefRefPtr<CefRequestContextImpl> global_request_context_;
|
||||
CefDevToolsDelegate* devtools_delegate_; // Deletes itself.
|
||||
std::unique_ptr<base::MessageLoop> message_loop_;
|
||||
|
||||
std::unique_ptr<extensions::ExtensionsClient> extensions_client_;
|
||||
std::unique_ptr<extensions::ExtensionsBrowserClient>
|
||||
|
@@ -7,7 +7,6 @@
|
||||
#include "libcef/common/content_client.h"
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/run_loop.h"
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#include "base/mac/scoped_nsautorelease_pool.h"
|
||||
@@ -103,20 +102,3 @@ CefBrowserMessageLoop::CefBrowserMessageLoop()
|
||||
}
|
||||
|
||||
CefBrowserMessageLoop::~CefBrowserMessageLoop() {}
|
||||
|
||||
// static
|
||||
CefBrowserMessageLoop* CefBrowserMessageLoop::current() {
|
||||
base::MessageLoop* loop = base::MessageLoop::current();
|
||||
DCHECK(loop->IsType(base::MessageLoop::TYPE_UI));
|
||||
return static_cast<CefBrowserMessageLoop*>(loop);
|
||||
}
|
||||
|
||||
void CefBrowserMessageLoop::DoMessageLoopIteration() {
|
||||
base::RunLoop run_loop;
|
||||
run_loop.RunUntilIdle();
|
||||
}
|
||||
|
||||
void CefBrowserMessageLoop::RunMessageLoop() {
|
||||
base::RunLoop run_loop;
|
||||
run_loop.Run();
|
||||
}
|
||||
|
@@ -17,15 +17,6 @@ class CefBrowserMessageLoop : public base::MessageLoopForUI {
|
||||
CefBrowserMessageLoop();
|
||||
~CefBrowserMessageLoop() override;
|
||||
|
||||
// Returns the CefBrowserMessageLoop of the current thread.
|
||||
static CefBrowserMessageLoop* current();
|
||||
|
||||
// Do a single interation of the UI message loop.
|
||||
void DoMessageLoopIteration();
|
||||
|
||||
// Run the UI message loop.
|
||||
void RunMessageLoop();
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserMessageLoop);
|
||||
};
|
||||
|
@@ -196,7 +196,7 @@ void CefBrowserPlatformDelegate::DragSourceSystemDragEnded() {
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::AccessibilityEventReceived(
|
||||
const std::vector<content::AXEventNotificationDetails>& eventData) {
|
||||
const content::AXEventNotificationDetails& eventData) {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
|
@@ -22,14 +22,14 @@ namespace blink {
|
||||
class WebMouseEvent;
|
||||
class WebMouseWheelEvent;
|
||||
class WebInputEvent;
|
||||
}
|
||||
} // namespace blink
|
||||
|
||||
namespace content {
|
||||
struct NativeWebKeyboardEvent;
|
||||
class RenderViewHost;
|
||||
class RenderViewHostDelegateView;
|
||||
class WebContentsView;
|
||||
}
|
||||
} // namespace content
|
||||
|
||||
#if defined(USE_AURA)
|
||||
namespace views {
|
||||
@@ -140,7 +140,7 @@ class CefBrowserPlatformDelegate {
|
||||
virtual SkColor GetBackgroundColor() const = 0;
|
||||
|
||||
// Notify the window that it was resized.
|
||||
virtual void WasResized() = 0;
|
||||
virtual void SynchronizeVisualProperties() = 0;
|
||||
|
||||
// Send input events.
|
||||
virtual void SendKeyEvent(const content::NativeWebKeyboardEvent& event) = 0;
|
||||
@@ -262,7 +262,7 @@ class CefBrowserPlatformDelegate {
|
||||
virtual void DragSourceEndedAt(int x, int y, cef_drag_operations_mask_t op);
|
||||
virtual void DragSourceSystemDragEnded();
|
||||
virtual void AccessibilityEventReceived(
|
||||
const std::vector<content::AXEventNotificationDetails>& eventData);
|
||||
const content::AXEventNotificationDetails& eventData);
|
||||
virtual void AccessibilityLocationChangesReceived(
|
||||
const std::vector<content::AXLocationChangeNotificationDetails>& locData);
|
||||
|
||||
|
@@ -20,7 +20,6 @@
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/common/url_fetcher.h"
|
||||
#include "net/base/io_buffer.h"
|
||||
#include "net/base/net_errors.h"
|
||||
#include "net/http/http_response_headers.h"
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#include "components/net_log/chrome_net_log.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "services/network/public/cpp/network_switches.h"
|
||||
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||
|
||||
ChromeBrowserProcessStub::ChromeBrowserProcessStub()
|
||||
: initialized_(false),
|
||||
@@ -116,6 +117,12 @@ ChromeBrowserProcessStub::network_connection_tracker() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
network::NetworkQualityTracker*
|
||||
ChromeBrowserProcessStub::network_quality_tracker() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
WatchDogThread* ChromeBrowserProcessStub::watchdog_thread() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
@@ -138,6 +145,12 @@ ChromeBrowserProcessStub::system_request_context() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
scoped_refptr<network::SharedURLLoaderFactory>
|
||||
ChromeBrowserProcessStub::shared_url_loader_factory() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
variations::VariationsService* ChromeBrowserProcessStub::variations_service() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
@@ -258,7 +271,6 @@ StatusTray* ChromeBrowserProcessStub::status_tray() {
|
||||
|
||||
safe_browsing::SafeBrowsingService*
|
||||
ChromeBrowserProcessStub::safe_browsing_service() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -318,12 +330,10 @@ ChromeBrowserProcessStub::media_file_system_registry() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_WEBRTC)
|
||||
WebRtcLogUploader* ChromeBrowserProcessStub::webrtc_log_uploader() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
network_time::NetworkTimeTracker*
|
||||
ChromeBrowserProcessStub::network_time_tracker() {
|
||||
@@ -347,12 +357,6 @@ resource_coordinator::TabManager* ChromeBrowserProcessStub::GetTabManager() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
physical_web::PhysicalWebDataSource*
|
||||
ChromeBrowserProcessStub::GetPhysicalWebDataSource() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
prefs::InProcessPrefServiceFactory*
|
||||
ChromeBrowserProcessStub::pref_service_factory() const {
|
||||
NOTREACHED();
|
||||
|
@@ -50,10 +50,13 @@ class ChromeBrowserProcessStub : public BrowserProcess,
|
||||
IOThread* io_thread() override;
|
||||
SystemNetworkContextManager* system_network_context_manager() override;
|
||||
content::NetworkConnectionTracker* network_connection_tracker() override;
|
||||
network::NetworkQualityTracker* network_quality_tracker() override;
|
||||
WatchDogThread* watchdog_thread() override;
|
||||
ProfileManager* profile_manager() override;
|
||||
PrefService* local_state() override;
|
||||
net::URLRequestContextGetter* system_request_context() override;
|
||||
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory()
|
||||
override;
|
||||
variations::VariationsService* variations_service() override;
|
||||
BrowserProcessPlatformPart* platform_part() override;
|
||||
extensions::EventRouterForwarder* extension_event_router_forwarder() override;
|
||||
@@ -96,15 +99,12 @@ class ChromeBrowserProcessStub : public BrowserProcess,
|
||||
component_updater::SupervisedUserWhitelistInstaller*
|
||||
supervised_user_whitelist_installer() override;
|
||||
MediaFileSystemRegistry* media_file_system_registry() override;
|
||||
#if BUILDFLAG(ENABLE_WEBRTC)
|
||||
WebRtcLogUploader* webrtc_log_uploader() override;
|
||||
#endif
|
||||
network_time::NetworkTimeTracker* network_time_tracker() override;
|
||||
gcm::GCMDriver* gcm_driver() override;
|
||||
shell_integration::DefaultWebClientState CachedDefaultWebClientState()
|
||||
override;
|
||||
resource_coordinator::TabManager* GetTabManager() override;
|
||||
physical_web::PhysicalWebDataSource* GetPhysicalWebDataSource() override;
|
||||
prefs::InProcessPrefServiceFactory* pref_service_factory() const override;
|
||||
|
||||
// BrowserContextIncognitoHelper implementation.
|
||||
|
@@ -75,11 +75,6 @@ ChromeProfileStub::GetRequestContextForExtensions() {
|
||||
return GetRequestContext();
|
||||
}
|
||||
|
||||
net::SSLConfigService* ChromeProfileStub::GetSSLConfigService() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool ChromeProfileStub::IsSameProfile(Profile* profile) {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
|
@@ -34,7 +34,6 @@ class ChromeProfileStub : public Profile {
|
||||
ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy() override;
|
||||
PrefService* GetOffTheRecordPrefs() override;
|
||||
net::URLRequestContextGetter* GetRequestContextForExtensions() override;
|
||||
net::SSLConfigService* GetSSLConfigService() override;
|
||||
bool IsSameProfile(Profile* profile) override;
|
||||
base::Time GetStartTime() const override;
|
||||
base::FilePath last_selected_directory() override;
|
||||
|
@@ -53,7 +53,7 @@
|
||||
#include "chrome/services/printing/public/mojom/constants.mojom.h"
|
||||
#include "components/navigation_interception/intercept_navigation_throttle.h"
|
||||
#include "components/navigation_interception/navigation_params.h"
|
||||
#include "components/printing/service/public/interfaces/pdf_compositor.mojom.h"
|
||||
#include "components/services/pdf_compositor/public/interfaces/pdf_compositor.mojom.h"
|
||||
#include "content/browser/frame_host/navigation_handle_impl.h"
|
||||
#include "content/browser/frame_host/render_frame_host_impl.h"
|
||||
#include "content/browser/plugin_service_impl.h"
|
||||
@@ -82,12 +82,15 @@
|
||||
#include "extensions/browser/extension_registry.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"
|
||||
#include "extensions/browser/io_thread_extension_message_filter.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "extensions/common/switches.h"
|
||||
#include "net/ssl/ssl_cert_request_info.h"
|
||||
#include "ppapi/host/ppapi_host.h"
|
||||
#include "services/service_manager/embedder/switches.h"
|
||||
#include "services/service_manager/public/mojom/connector.mojom.h"
|
||||
#include "services/service_manager/sandbox/switches.h"
|
||||
#include "storage/browser/quota/quota_settings.h"
|
||||
#include "third_party/blink/public/web/web_window_features.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
@@ -336,7 +339,7 @@ class CefQuotaPermissionContext : public content::QuotaPermissionContext {
|
||||
breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost(
|
||||
const std::string& process_type) {
|
||||
base::FilePath dumps_path;
|
||||
PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path);
|
||||
base::PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path);
|
||||
{
|
||||
ANNOTATE_SCOPED_MEMORY_LEAK;
|
||||
// Uploads will only occur if a non-empty crash URL is specified in
|
||||
@@ -428,6 +431,11 @@ bool NavigationOnUIThread(
|
||||
request->Set(params, is_main_frame);
|
||||
request->SetReadOnly(true);
|
||||
|
||||
// Initiating a new navigation in OnBeforeBrowse will delete the
|
||||
// InterceptNavigationThrottle that currently owns this callback,
|
||||
// resulting in a crash. Use the lock to prevent that.
|
||||
std::unique_ptr<CefBrowserHostImpl::NavigationLock> navigation_lock =
|
||||
browser->CreateNavigationLock();
|
||||
ignore_navigation = handler->OnBeforeBrowse(
|
||||
browser.get(), frame, request.get(), params.has_user_gesture(),
|
||||
params.is_redirect());
|
||||
@@ -597,7 +605,8 @@ void CefContentBrowserClient::SiteInstanceDeleting(
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::RegisterInProcessServices(
|
||||
StaticServiceMap* services) {
|
||||
StaticServiceMap* services,
|
||||
content::ServiceManagerConnection* connection) {
|
||||
{
|
||||
// For spell checking.
|
||||
service_manager::EmbeddedServiceInfo info;
|
||||
@@ -609,11 +618,12 @@ void CefContentBrowserClient::RegisterInProcessServices(
|
||||
void CefContentBrowserClient::RegisterOutOfProcessServices(
|
||||
OutOfProcessServiceMap* services) {
|
||||
(*services)[printing::mojom::kServiceName] =
|
||||
base::ASCIIToUTF16("PDF Compositor Service");
|
||||
base::BindRepeating(&base::ASCIIToUTF16, "PDF Compositor Service");
|
||||
(*services)[printing::mojom::kChromePrintingServiceName] =
|
||||
base::ASCIIToUTF16("Printing Service");
|
||||
base::BindRepeating(&base::ASCIIToUTF16, "Printing Service");
|
||||
(*services)[proxy_resolver::mojom::kProxyResolverServiceName] =
|
||||
l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME);
|
||||
base::BindRepeating(&l10n_util::GetStringUTF16,
|
||||
IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME);
|
||||
}
|
||||
|
||||
std::unique_ptr<base::Value> CefContentBrowserClient::GetServiceManifestOverlay(
|
||||
@@ -720,7 +730,7 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
}
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
if (process_type == switches::kZygoteProcess) {
|
||||
if (process_type == service_manager::switches::kZygoteProcess) {
|
||||
// Propagate the following switches to the zygote command line (along with
|
||||
// any associated values) if present in the browser command line.
|
||||
static const char* const kSwitchNames[] = {
|
||||
@@ -730,7 +740,7 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
arraysize(kSwitchNames));
|
||||
|
||||
#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
if (!browser_cmd->HasSwitch(switches::kNoSandbox)) {
|
||||
if (!browser_cmd->HasSwitch(service_manager::switches::kNoSandbox)) {
|
||||
// Pass the Widevine CDM path to the Zygote process. See comments in
|
||||
// CefWidevineLoader::AddContentDecryptionModules.
|
||||
const base::FilePath& cdm_path = CefWidevineLoader::GetInstance()->path();
|
||||
@@ -986,7 +996,7 @@ void CefContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
|
||||
content::PosixFileDescriptorInfo* mappings) {
|
||||
int crash_signal_fd = GetCrashSignalFD(command_line);
|
||||
if (crash_signal_fd >= 0) {
|
||||
mappings->Share(kCrashDumpSignal, crash_signal_fd);
|
||||
mappings->Share(service_manager::kCrashDumpSignal, crash_signal_fd);
|
||||
}
|
||||
}
|
||||
#endif // defined(OS_LINUX)
|
||||
@@ -998,7 +1008,7 @@ const wchar_t* CefContentBrowserClient::GetResourceDllName() {
|
||||
if (file_path[0] == 0) {
|
||||
// Retrieve the module path (usually libcef.dll).
|
||||
base::FilePath module;
|
||||
PathService::Get(base::FILE_MODULE, &module);
|
||||
base::PathService::Get(base::FILE_MODULE, &module);
|
||||
const std::wstring wstr = module.value();
|
||||
size_t count = std::min(static_cast<size_t>(MAX_PATH), wstr.size());
|
||||
wcsncpy(file_path, wstr.c_str(), count);
|
||||
@@ -1033,37 +1043,35 @@ CefContentBrowserClient::CreateClientCertStore(
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::RegisterNonNetworkNavigationURLLoaderFactories(
|
||||
content::RenderFrameHost* frame_host,
|
||||
int frame_tree_node_id,
|
||||
NonNetworkURLLoaderFactoryMap* factories) {
|
||||
if (!extensions::ExtensionsEnabled())
|
||||
return;
|
||||
|
||||
content::BrowserContext* browser_context =
|
||||
frame_host->GetProcess()->GetBrowserContext();
|
||||
content::WebContents* web_contents =
|
||||
content::WebContents::FromFrameTreeNodeId(frame_tree_node_id);
|
||||
factories->emplace(
|
||||
extensions::kExtensionScheme,
|
||||
extensions::CreateExtensionNavigationURLLoaderFactory(
|
||||
frame_host,
|
||||
extensions::ExtensionSystem::Get(browser_context)->info_map()));
|
||||
web_contents->GetBrowserContext(),
|
||||
!!extensions::WebViewGuest::FromWebContents(web_contents)));
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories(
|
||||
content::RenderFrameHost* frame_host,
|
||||
const GURL& frame_url,
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
NonNetworkURLLoaderFactoryMap* factories) {
|
||||
if (!extensions::ExtensionsEnabled())
|
||||
return;
|
||||
|
||||
content::BrowserContext* browser_context =
|
||||
frame_host->GetProcess()->GetBrowserContext();
|
||||
auto factory = extensions::MaybeCreateExtensionSubresourceURLLoaderFactory(
|
||||
frame_host, frame_url,
|
||||
extensions::ExtensionSystem::Get(browser_context)->info_map());
|
||||
auto factory = extensions::CreateExtensionURLLoaderFactory(render_process_id,
|
||||
render_frame_id);
|
||||
if (factory)
|
||||
factories->emplace(extensions::kExtensionScheme, std::move(factory));
|
||||
}
|
||||
|
||||
bool CefContentBrowserClient::WillCreateURLLoaderFactory(
|
||||
content::BrowserContext* browser_context,
|
||||
content::RenderFrameHost* frame,
|
||||
bool is_navigation,
|
||||
network::mojom::URLLoaderFactoryRequest* factory_request) {
|
||||
@@ -1072,7 +1080,7 @@ bool CefContentBrowserClient::WillCreateURLLoaderFactory(
|
||||
|
||||
auto* web_request_api =
|
||||
extensions::BrowserContextKeyedAPIFactory<extensions::WebRequestAPI>::Get(
|
||||
frame->GetProcess()->GetBrowserContext());
|
||||
browser_context);
|
||||
return web_request_api->MaybeProxyURLLoaderFactory(frame, is_navigation,
|
||||
factory_request);
|
||||
}
|
||||
|
@@ -51,7 +51,9 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
bool IsHandledURL(const GURL& url) override;
|
||||
void SiteInstanceGotProcess(content::SiteInstance* site_instance) override;
|
||||
void SiteInstanceDeleting(content::SiteInstance* site_instance) override;
|
||||
void RegisterInProcessServices(StaticServiceMap* services) override;
|
||||
void RegisterInProcessServices(
|
||||
StaticServiceMap* services,
|
||||
content::ServiceManagerConnection* connection) override;
|
||||
void RegisterOutOfProcessServices(OutOfProcessServiceMap* services) override;
|
||||
std::unique_ptr<base::Value> GetServiceManifestOverlay(
|
||||
base::StringPiece name) override;
|
||||
@@ -129,13 +131,14 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
content::ResourceContext* resource_context) override;
|
||||
|
||||
void RegisterNonNetworkNavigationURLLoaderFactories(
|
||||
content::RenderFrameHost* frame_host,
|
||||
int frame_tree_node_id,
|
||||
NonNetworkURLLoaderFactoryMap* factories) override;
|
||||
void RegisterNonNetworkSubresourceURLLoaderFactories(
|
||||
content::RenderFrameHost* frame_host,
|
||||
const GURL& frame_url,
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
NonNetworkURLLoaderFactoryMap* factories) override;
|
||||
bool WillCreateURLLoaderFactory(
|
||||
content::BrowserContext* browser_context,
|
||||
content::RenderFrameHost* frame,
|
||||
bool is_navigation,
|
||||
network::mojom::URLLoaderFactoryRequest* factory_request) override;
|
||||
|
@@ -7,7 +7,6 @@
|
||||
#include "libcef/browser/browser_info.h"
|
||||
#include "libcef/browser/browser_info_manager.h"
|
||||
#include "libcef/browser/browser_main.h"
|
||||
#include "libcef/browser/browser_message_loop.h"
|
||||
#include "libcef/browser/chrome_browser_process_stub.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/browser/trace_subscriber.h"
|
||||
@@ -21,6 +20,7 @@
|
||||
#include "base/command_line.h"
|
||||
#include "base/debug/debugger.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/run_loop.h"
|
||||
#include "base/synchronization/waitable_event.h"
|
||||
#include "components/network_session_configurator/common/network_switches.h"
|
||||
#include "content/app/content_service_manager_main_delegate.h"
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "services/service_manager/embedder/main.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
#include "ui/base/ui_base_switches.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
@@ -271,7 +272,8 @@ void CefDoMessageLoopWork() {
|
||||
return;
|
||||
}
|
||||
|
||||
CefBrowserMessageLoop::current()->DoMessageLoopIteration();
|
||||
base::RunLoop run_loop;
|
||||
run_loop.RunUntilIdle();
|
||||
}
|
||||
|
||||
void CefRunMessageLoop() {
|
||||
@@ -287,7 +289,8 @@ void CefRunMessageLoop() {
|
||||
return;
|
||||
}
|
||||
|
||||
CefBrowserMessageLoop::current()->RunMessageLoop();
|
||||
base::RunLoop run_loop;
|
||||
run_loop.Run();
|
||||
}
|
||||
|
||||
void CefQuitMessageLoop() {
|
||||
@@ -341,7 +344,7 @@ bool CefContext::Initialize(const CefMainArgs& args,
|
||||
init_thread_id_ = base::PlatformThread::CurrentId();
|
||||
settings_ = settings;
|
||||
|
||||
#if !defined(OS_WIN)
|
||||
#if !(defined(OS_WIN) || defined(OS_LINUX))
|
||||
if (settings.multi_threaded_message_loop) {
|
||||
NOTIMPLEMENTED() << "multi_threaded_message_loop is not supported.";
|
||||
return false;
|
||||
@@ -524,6 +527,8 @@ void CefContext::FinishShutdownOnUIThread(
|
||||
|
||||
static_cast<ChromeBrowserProcessStub*>(g_browser_process)->Shutdown();
|
||||
|
||||
ui::ResourceBundle::GetSharedInstance().CleanupOnUIThread();
|
||||
|
||||
if (uithread_shutdown_event)
|
||||
uithread_shutdown_event->Signal();
|
||||
}
|
||||
|
@@ -10,19 +10,18 @@
|
||||
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/net/cookie_store_source.h"
|
||||
#include "libcef/browser/net/network_delegate.h"
|
||||
#include "libcef/common/task_runner_impl.h"
|
||||
#include "libcef/common/time_util.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/format_macros.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "content/browser/storage_partition_impl.h"
|
||||
#include "net/cookies/cookie_util.h"
|
||||
#include "net/cookies/parsed_cookie.h"
|
||||
#include "net/extras/sqlite/sqlite_persistent_cookie_store.h"
|
||||
#include "net/url_request/url_request_context.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
@@ -162,7 +161,7 @@ void CefCookieManagerImpl::GetCookieStore(
|
||||
return;
|
||||
}
|
||||
|
||||
DCHECK(is_blocking_ || cookie_store_.get());
|
||||
DCHECK(is_blocking_ || cookie_source_);
|
||||
|
||||
// Binding ref-counted |this| to CookieStoreGetter may result in
|
||||
// heap-use-after-free if (a) the CookieStoreGetter contains the last
|
||||
@@ -185,8 +184,8 @@ void CefCookieManagerImpl::GetCookieStore(
|
||||
|
||||
net::CookieStore* CefCookieManagerImpl::GetExistingCookieStore() {
|
||||
CEF_REQUIRE_IOT();
|
||||
if (cookie_store_.get()) {
|
||||
return cookie_store_.get();
|
||||
if (cookie_source_) {
|
||||
return cookie_source_->GetCookieStore();
|
||||
} else if (request_context_impl_.get()) {
|
||||
net::CookieStore* cookie_store =
|
||||
request_context_impl_->GetExistingCookieStore();
|
||||
@@ -287,44 +286,13 @@ bool CefCookieManagerImpl::SetStoragePath(
|
||||
if (!path.empty())
|
||||
new_path = base::FilePath(path);
|
||||
|
||||
if (cookie_store_.get() &&
|
||||
((storage_path_.empty() && path.empty()) || storage_path_ == new_path)) {
|
||||
// The path has not changed so don't do anything.
|
||||
RunAsyncCompletionOnIOThread(callback);
|
||||
return true;
|
||||
if (!cookie_source_) {
|
||||
cookie_source_.reset(new CefCookieStoreOwnerSource());
|
||||
}
|
||||
|
||||
scoped_refptr<net::SQLitePersistentCookieStore> persistent_store;
|
||||
if (!new_path.empty()) {
|
||||
// TODO(cef): Move directory creation to the blocking pool instead of
|
||||
// allowing file IO on this thread.
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
if (base::DirectoryExists(new_path) || base::CreateDirectory(new_path)) {
|
||||
const base::FilePath& cookie_path = new_path.AppendASCII("Cookies");
|
||||
persistent_store = new net::SQLitePersistentCookieStore(
|
||||
cookie_path, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
|
||||
// Intentionally using the background task runner exposed by CEF to
|
||||
// facilitate unit test expectations. This task runner MUST be
|
||||
// configured with BLOCK_SHUTDOWN.
|
||||
CefContentBrowserClient::Get()->background_task_runner(),
|
||||
persist_session_cookies, NULL);
|
||||
} else {
|
||||
NOTREACHED() << "The cookie storage directory could not be created";
|
||||
storage_path_.clear();
|
||||
}
|
||||
}
|
||||
|
||||
// Set the new cookie store that will be used for all new requests. The old
|
||||
// cookie store, if any, will be automatically flushed and closed when no
|
||||
// longer referenced.
|
||||
cookie_store_.reset(new net::CookieMonster(persistent_store.get(), NULL));
|
||||
if (persistent_store.get() && persist_session_cookies)
|
||||
cookie_store_->SetPersistSessionCookies(true);
|
||||
storage_path_ = new_path;
|
||||
|
||||
// Restore the previously supported schemes.
|
||||
SetSupportedSchemesInternal(supported_schemes_, callback);
|
||||
cookie_source_->SetCookieStoragePath(new_path, persist_session_cookies);
|
||||
|
||||
RunAsyncCompletionOnIOThread(callback);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -502,10 +470,9 @@ void CefCookieManagerImpl::SetSupportedSchemesInternal(
|
||||
return;
|
||||
}
|
||||
|
||||
DCHECK(is_blocking_ || cookie_store_.get());
|
||||
if (cookie_store_) {
|
||||
supported_schemes_ = schemes;
|
||||
SetCookieMonsterSchemes(cookie_store_.get(), supported_schemes_);
|
||||
DCHECK(is_blocking_ || cookie_source_);
|
||||
if (cookie_source_) {
|
||||
cookie_source_->SetCookieSupportedSchemes(schemes);
|
||||
}
|
||||
|
||||
RunAsyncCompletionOnIOThread(callback);
|
||||
@@ -609,10 +576,10 @@ void CefCookieManagerImpl::DeleteCookiesInternal(
|
||||
base::Bind(DeleteCookiesCallbackImpl, callback));
|
||||
} else if (cookie_name.empty()) {
|
||||
// Delete all matching host cookies.
|
||||
cookie_store->DeleteAllCreatedBetweenWithPredicateAsync(
|
||||
base::Time(), base::Time::Max(),
|
||||
content::StoragePartitionImpl::CreatePredicateForHostCookies(url),
|
||||
base::Bind(DeleteCookiesCallbackImpl, callback));
|
||||
net::CookieDeletionInfo delete_info;
|
||||
delete_info.host = url.host();
|
||||
cookie_store->DeleteAllMatchingInfoAsync(
|
||||
delete_info, base::Bind(DeleteCookiesCallbackImpl, callback));
|
||||
} else {
|
||||
// Delete all matching host and domain cookies.
|
||||
cookie_store->DeleteCookieAsync(
|
||||
|
@@ -15,6 +15,8 @@
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "net/cookies/cookie_monster.h"
|
||||
|
||||
class CefCookieStoreOwnerSource;
|
||||
|
||||
// Implementation of the CefCookieManager interface.
|
||||
class CefCookieManagerImpl : public CefCookieManager {
|
||||
public:
|
||||
@@ -122,9 +124,7 @@ class CefCookieManagerImpl : public CefCookieManager {
|
||||
scoped_refptr<CefURLRequestContextGetterImpl> request_context_impl_;
|
||||
|
||||
// Used for cookie monsters owned by this object.
|
||||
base::FilePath storage_path_;
|
||||
std::vector<std::string> supported_schemes_;
|
||||
std::unique_ptr<net::CookieMonster> cookie_store_;
|
||||
std::unique_ptr<CefCookieStoreOwnerSource> cookie_source_;
|
||||
|
||||
// Must be the last member.
|
||||
base::WeakPtrFactory<CefCookieManagerImpl> weak_ptr_factory_;
|
||||
|
@@ -299,9 +299,9 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
setting:
|
||||
"It's not possible to disable this feature from settings."
|
||||
chrome_policy {
|
||||
DeveloperToolsDisabled {
|
||||
DeveloperToolsAvailability {
|
||||
policy_options {mode: MANDATORY}
|
||||
DeveloperToolsDisabled: true
|
||||
DeveloperToolsAvailability: 2
|
||||
}
|
||||
}
|
||||
})");
|
||||
|
@@ -90,7 +90,7 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
}
|
||||
|
||||
if (suggested_path.empty()) {
|
||||
if (PathService::Get(base::DIR_TEMP, &suggested_path)) {
|
||||
if (base::PathService::Get(base::DIR_TEMP, &suggested_path)) {
|
||||
// Use the temp directory.
|
||||
suggested_path = suggested_path.Append(suggested_name);
|
||||
} else {
|
||||
|
@@ -180,8 +180,8 @@ bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage(std::string* error) {
|
||||
|
||||
// NOTE: This can give the wrong answer due to race conditions, but it is OK,
|
||||
// we check again in the renderer.
|
||||
if (!extension()->permissions_data()->CanAccessPage(
|
||||
extension(), effective_document_url, execute_tab_id_, error)) {
|
||||
if (!extension()->permissions_data()->CanAccessPage(effective_document_url,
|
||||
execute_tab_id_, error)) {
|
||||
if (is_about_url &&
|
||||
extension()->permissions_data()->active_permissions().HasAPIPermission(
|
||||
APIPermission::kTab)) {
|
||||
@@ -289,7 +289,7 @@ bool TabsSetZoomFunction::RunAsync() {
|
||||
return false;
|
||||
|
||||
GURL url(web_contents->GetVisibleURL());
|
||||
if (extensions::PermissionsData::IsRestrictedUrl(url, extension(), &error_))
|
||||
if (extension()->permissions_data()->IsRestrictedUrl(url, &error_))
|
||||
return false;
|
||||
|
||||
zoom::ZoomController* zoom_controller =
|
||||
@@ -341,7 +341,7 @@ bool TabsSetZoomSettingsFunction::RunAsync() {
|
||||
return false;
|
||||
|
||||
GURL url(web_contents->GetVisibleURL());
|
||||
if (PermissionsData::IsRestrictedUrl(url, extension(), &error_))
|
||||
if (extension()->permissions_data()->IsRestrictedUrl(url, &error_))
|
||||
return false;
|
||||
|
||||
// "per-origin" scope is only available in "automatic" mode.
|
||||
|
@@ -39,7 +39,7 @@ SkColor CefBrowserPlatformDelegateBackground::GetBackgroundColor() const {
|
||||
return native_delegate_->GetBackgroundColor();
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateBackground::WasResized() {
|
||||
void CefBrowserPlatformDelegateBackground::SynchronizeVisualProperties() {
|
||||
// Nothing to do here.
|
||||
}
|
||||
|
||||
|
@@ -22,7 +22,7 @@ class CefBrowserPlatformDelegateBackground
|
||||
void CloseHostWindow() override;
|
||||
CefWindowHandle GetHostWindowHandle() const override;
|
||||
SkColor GetBackgroundColor() const override;
|
||||
void WasResized() override;
|
||||
void SynchronizeVisualProperties() override;
|
||||
void SendKeyEvent(const content::NativeWebKeyboardEvent& event) override;
|
||||
void SendMouseEvent(const blink::WebMouseEvent& event) override;
|
||||
void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event) override;
|
||||
|
@@ -3,13 +3,15 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
// APIs must also be registered in
|
||||
// libcef/common/extensions/api/_*_features.json files. See
|
||||
// libcef/common/extensions/api/_*_features.json files and possibly
|
||||
// CefExtensionsDispatcherDelegate::PopulateSourceMap. See
|
||||
// libcef/common/extensions/api/README.txt for additional details.
|
||||
|
||||
#include "libcef/browser/extensions/chrome_api_registration.h"
|
||||
|
||||
#include "libcef/browser/extensions/api/tabs/tabs_api.h"
|
||||
|
||||
#include "chrome/browser/extensions/api/content_settings/content_settings_api.h"
|
||||
#include "chrome/browser/extensions/api/resources_private/resources_private_api.h"
|
||||
#include "chrome/browser/extensions/api/streams_private/streams_private_api.h"
|
||||
#include "extensions/browser/api/alarms/alarms_api.h"
|
||||
@@ -37,6 +39,12 @@ const char* const kSupportedAPIs[] = {
|
||||
EXTENSION_FUNCTION_NAME(AlarmsGetAllFunction),
|
||||
EXTENSION_FUNCTION_NAME(AlarmsClearFunction),
|
||||
EXTENSION_FUNCTION_NAME(AlarmsClearAllFunction),
|
||||
"contentSettings",
|
||||
EXTENSION_FUNCTION_NAME(ContentSettingsContentSettingClearFunction),
|
||||
EXTENSION_FUNCTION_NAME(ContentSettingsContentSettingGetFunction),
|
||||
EXTENSION_FUNCTION_NAME(ContentSettingsContentSettingSetFunction),
|
||||
EXTENSION_FUNCTION_NAME(
|
||||
ContentSettingsContentSettingGetResourceIdentifiersFunction),
|
||||
"storage",
|
||||
EXTENSION_FUNCTION_NAME(StorageStorageAreaGetFunction),
|
||||
EXTENSION_FUNCTION_NAME(StorageStorageAreaSetFunction),
|
||||
@@ -75,6 +83,11 @@ void ChromeFunctionRegistry::RegisterAll(ExtensionFunctionRegistry* registry) {
|
||||
registry->RegisterFunction<AlarmsGetAllFunction>();
|
||||
registry->RegisterFunction<AlarmsClearFunction>();
|
||||
registry->RegisterFunction<AlarmsClearAllFunction>();
|
||||
registry->RegisterFunction<ContentSettingsContentSettingClearFunction>();
|
||||
registry->RegisterFunction<ContentSettingsContentSettingGetFunction>();
|
||||
registry->RegisterFunction<ContentSettingsContentSettingSetFunction>();
|
||||
registry->RegisterFunction<
|
||||
ContentSettingsContentSettingGetResourceIdentifiersFunction>();
|
||||
registry->RegisterFunction<StorageStorageAreaGetFunction>();
|
||||
registry->RegisterFunction<StorageStorageAreaSetFunction>();
|
||||
registry->RegisterFunction<StorageStorageAreaRemoveFunction>();
|
||||
|
@@ -25,7 +25,7 @@ bool CefComponentExtensionResourceManager::IsComponentExtensionResource(
|
||||
base::FilePath directory_path = extension_path;
|
||||
base::FilePath resources_dir;
|
||||
base::FilePath relative_path;
|
||||
if (!PathService::Get(chrome::DIR_RESOURCES, &resources_dir) ||
|
||||
if (!base::PathService::Get(chrome::DIR_RESOURCES, &resources_dir) ||
|
||||
!resources_dir.AppendRelativePath(directory_path, &relative_path)) {
|
||||
return false;
|
||||
}
|
||||
|
@@ -160,8 +160,9 @@ CefRefPtr<CefBrowserHostImpl> CefExtensionFunctionDetails::GetCurrentBrowser()
|
||||
CefRefPtr<CefExtensionHandler> handler = GetCefExtension()->GetHandler();
|
||||
if (handler) {
|
||||
// Give the handler an opportunity to specify a different browser.
|
||||
CefRefPtr<CefBrowser> active_browser = handler->GetActiveBrowser(
|
||||
GetCefExtension(), browser.get(), function_->include_incognito());
|
||||
CefRefPtr<CefBrowser> active_browser =
|
||||
handler->GetActiveBrowser(GetCefExtension(), browser.get(),
|
||||
function_->include_incognito_information());
|
||||
if (active_browser && active_browser != browser) {
|
||||
CefRefPtr<CefBrowserHostImpl> active_browser_impl =
|
||||
static_cast<CefBrowserHostImpl*>(active_browser.get());
|
||||
@@ -200,8 +201,9 @@ bool CefExtensionFunctionDetails::CanAccessBrowser(
|
||||
if (browser && browser->client()) {
|
||||
CefRefPtr<CefExtensionHandler> handler = GetCefExtension()->GetHandler();
|
||||
if (handler) {
|
||||
return handler->CanAccessBrowser(GetCefExtension(), browser.get(),
|
||||
function_->include_incognito(), target);
|
||||
return handler->CanAccessBrowser(
|
||||
GetCefExtension(), browser.get(),
|
||||
function_->include_incognito_information(), target);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -425,7 +427,7 @@ std::unique_ptr<api::tabs::Tab> CefExtensionFunctionDetails::CreateTabObject(
|
||||
tab_object->selected = true;
|
||||
tab_object->highlighted = true;
|
||||
tab_object->pinned = false;
|
||||
tab_object->audible = std::make_unique<bool>(contents->WasRecentlyAudible());
|
||||
// TODO(extensions): Use RecentlyAudibleHelper to populate |audible|.
|
||||
tab_object->discarded = false;
|
||||
tab_object->auto_discardable = false;
|
||||
tab_object->muted_info = CreateMutedInfo(contents);
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#include "libcef/browser/extensions/extensions_browser_client.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
|
||||
namespace extensions {
|
||||
|
||||
@@ -28,11 +29,12 @@ CefExtensionHostDelegate::GetJavaScriptDialogManager() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CefExtensionHostDelegate::CreateTab(content::WebContents* web_contents,
|
||||
const std::string& extension_id,
|
||||
WindowOpenDisposition disposition,
|
||||
const gfx::Rect& initial_rect,
|
||||
bool user_gesture) {
|
||||
void CefExtensionHostDelegate::CreateTab(
|
||||
std::unique_ptr<content::WebContents> web_contents,
|
||||
const std::string& extension_id,
|
||||
WindowOpenDisposition disposition,
|
||||
const gfx::Rect& initial_rect,
|
||||
bool user_gesture) {
|
||||
// TODO(cef): Add support for extensions opening popup windows.
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
@@ -40,7 +42,7 @@ void CefExtensionHostDelegate::CreateTab(content::WebContents* web_contents,
|
||||
void CefExtensionHostDelegate::ProcessMediaAccessRequest(
|
||||
content::WebContents* web_contents,
|
||||
const content::MediaStreamRequest& request,
|
||||
const content::MediaResponseCallback& callback,
|
||||
content::MediaResponseCallback callback,
|
||||
const Extension* extension) {
|
||||
// Never routed here from CefBrowserHostImpl.
|
||||
NOTREACHED();
|
||||
|
@@ -21,14 +21,14 @@ class CefExtensionHostDelegate : public ExtensionHostDelegate {
|
||||
void OnExtensionHostCreated(content::WebContents* web_contents) override;
|
||||
void OnRenderViewCreatedForBackgroundPage(ExtensionHost* host) override;
|
||||
content::JavaScriptDialogManager* GetJavaScriptDialogManager() override;
|
||||
void CreateTab(content::WebContents* web_contents,
|
||||
void CreateTab(std::unique_ptr<content::WebContents> web_contents,
|
||||
const std::string& extension_id,
|
||||
WindowOpenDisposition disposition,
|
||||
const gfx::Rect& initial_rect,
|
||||
bool user_gesture) override;
|
||||
void ProcessMediaAccessRequest(content::WebContents* web_contents,
|
||||
const content::MediaStreamRequest& request,
|
||||
const content::MediaResponseCallback& callback,
|
||||
content::MediaResponseCallback callback,
|
||||
const Extension* extension) override;
|
||||
bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host,
|
||||
const GURL& security_origin,
|
||||
|
@@ -456,6 +456,7 @@ void CefExtensionSystem::InstallUpdate(
|
||||
const std::string& extension_id,
|
||||
const std::string& public_key,
|
||||
const base::FilePath& temp_dir,
|
||||
bool install_immediately,
|
||||
InstallUpdateCallback install_update_callback) {
|
||||
NOTREACHED();
|
||||
base::DeleteFile(temp_dir, true /* recursive */);
|
||||
@@ -476,7 +477,7 @@ CefExtensionSystem::ComponentExtensionInfo::ComponentExtensionInfo(
|
||||
if (!root_directory.IsAbsolute()) {
|
||||
// This path structure is required by
|
||||
// url_request_util::MaybeCreateURLRequestResourceBundleJob.
|
||||
CHECK(PathService::Get(chrome::DIR_RESOURCES, &root_directory));
|
||||
CHECK(base::PathService::Get(chrome::DIR_RESOURCES, &root_directory));
|
||||
root_directory = root_directory.Append(directory);
|
||||
}
|
||||
}
|
||||
|
@@ -114,6 +114,7 @@ class CefExtensionSystem : public ExtensionSystem {
|
||||
void InstallUpdate(const std::string& extension_id,
|
||||
const std::string& public_key,
|
||||
const base::FilePath& temp_dir,
|
||||
bool install_immediately,
|
||||
InstallUpdateCallback install_update_callback) override;
|
||||
bool FinishDelayedInstallationIfReady(const std::string& extension_id,
|
||||
bool install_immediately) override;
|
||||
|
@@ -46,7 +46,7 @@ void CefExtensionWebContentsObserver::RenderFrameCreated(
|
||||
// are allowed to use chrome://resources/ URLs.
|
||||
if ((extension->is_extension() || extension->is_platform_app()) &&
|
||||
Manifest::IsComponentLocation(extension->location())) {
|
||||
policy->GrantOrigin(
|
||||
policy->GrantRequestOrigin(
|
||||
process_id, url::Origin::Create(GURL(content::kChromeUIResourcesURL)));
|
||||
}
|
||||
}
|
||||
|
@@ -254,6 +254,10 @@ bool CefExtensionsBrowserClient::DidVersionUpdate(BrowserContext* context) {
|
||||
|
||||
void CefExtensionsBrowserClient::PermitExternalProtocolHandler() {}
|
||||
|
||||
bool CefExtensionsBrowserClient::IsInDemoMode() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CefExtensionsBrowserClient::IsRunningInForcedAppMode() {
|
||||
return false;
|
||||
}
|
||||
|
@@ -84,6 +84,7 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
|
||||
ExtensionHost** host) override;
|
||||
bool DidVersionUpdate(content::BrowserContext* context) override;
|
||||
void PermitExternalProtocolHandler() override;
|
||||
bool IsInDemoMode() override;
|
||||
bool IsRunningInForcedAppMode() override;
|
||||
bool IsAppModeForcedForApp(const ExtensionId& extension_id) override;
|
||||
bool IsLoggedInAsPublicAccount() override;
|
||||
|
@@ -20,10 +20,10 @@ SkColor CefBrowserPlatformDelegateNative::GetBackgroundColor() const {
|
||||
return background_color_;
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateNative::WasResized() {
|
||||
void CefBrowserPlatformDelegateNative::SynchronizeVisualProperties() {
|
||||
content::RenderViewHost* host = browser_->web_contents()->GetRenderViewHost();
|
||||
if (host)
|
||||
host->GetWidget()->WasResized();
|
||||
host->GetWidget()->SynchronizeVisualProperties();
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateNative::SendKeyEvent(
|
||||
|
@@ -26,7 +26,7 @@ class CefBrowserPlatformDelegateNative : public CefBrowserPlatformDelegate {
|
||||
|
||||
// CefBrowserPlatformDelegate methods:
|
||||
SkColor GetBackgroundColor() const override;
|
||||
void WasResized() override;
|
||||
void SynchronizeVisualProperties() override;
|
||||
void SendKeyEvent(const content::NativeWebKeyboardEvent& event) override;
|
||||
void SendMouseEvent(const blink::WebMouseEvent& event) override;
|
||||
void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event) override;
|
||||
|
@@ -383,7 +383,8 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateMouseEvent(
|
||||
TranslateModifiers(mouse_event.modifiers));
|
||||
|
||||
// timestamp
|
||||
result.SetTimeStampSeconds(GetSystemUptime());
|
||||
result.SetTimeStamp(base::TimeTicks() +
|
||||
base::TimeDelta::FromSeconds(GetSystemUptime()));
|
||||
|
||||
result.pointer_type = blink::WebPointerProperties::PointerType::kMouse;
|
||||
}
|
||||
|
@@ -99,6 +99,7 @@
|
||||
}
|
||||
|
||||
- (void)cleanup:(id)window {
|
||||
[window_ setDelegate:nil];
|
||||
[self release];
|
||||
}
|
||||
|
||||
@@ -468,7 +469,8 @@ void CefBrowserPlatformDelegateNativeMac::TranslateMouseEvent(
|
||||
TranslateModifiers(mouse_event.modifiers));
|
||||
|
||||
// timestamp - Mac OSX specific
|
||||
result.SetTimeStampSeconds(currentEventTimestamp());
|
||||
result.SetTimeStamp(base::TimeTicks() +
|
||||
base::TimeDelta::FromSeconds(currentEventTimestamp()));
|
||||
|
||||
result.pointer_type = blink::WebPointerProperties::PointerType::kMouse;
|
||||
}
|
||||
|
@@ -557,7 +557,8 @@ void CefBrowserPlatformDelegateNativeWin::TranslateMouseEvent(
|
||||
TranslateModifiers(mouse_event.modifiers));
|
||||
|
||||
// timestamp
|
||||
result.SetTimeStampSeconds(GetMessageTime() / 1000.0);
|
||||
result.SetTimeStamp(base::TimeTicks() +
|
||||
base::TimeDelta::FromMilliseconds(GetMessageTime()));
|
||||
|
||||
result.pointer_type = blink::WebPointerProperties::PointerType::kMouse;
|
||||
}
|
||||
|
@@ -121,7 +121,7 @@ void CefJavaScriptDialogRunnerWin::Run(
|
||||
HMODULE hModule = NULL;
|
||||
|
||||
// Try to load the dialog from the DLL.
|
||||
if (PathService::Get(base::DIR_MODULE, &file_path)) {
|
||||
if (base::PathService::Get(base::DIR_MODULE, &file_path)) {
|
||||
file_path = file_path.Append(L"libcef.dll");
|
||||
hModule = ::GetModuleHandle(file_path.value().c_str());
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include "base/compiler_specific.h"
|
||||
#import "base/mac/scoped_sending_event.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/message_loop/message_loop_current.h"
|
||||
#import "ui/base/cocoa/menu_controller.h"
|
||||
#include "ui/gfx/geometry/point.h"
|
||||
|
||||
@@ -33,8 +34,7 @@ bool CefMenuRunnerMac::RunContextMenu(
|
||||
menu_controller_);
|
||||
|
||||
// Make sure events can be pumped while the menu is up.
|
||||
base::MessageLoop::ScopedNestableTaskAllower allow(
|
||||
base::MessageLoop::current());
|
||||
base::MessageLoopCurrent::ScopedNestableTaskAllower allow;
|
||||
|
||||
// One of the events that could be pumped is |window.close()|.
|
||||
// User-initiated event-tracking loops protect against this by
|
||||
|
@@ -8,6 +8,7 @@
|
||||
#include "libcef/browser/native/menu_2.h"
|
||||
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/message_loop/message_loop_current.h"
|
||||
#include "ui/gfx/geometry/point.h"
|
||||
|
||||
CefMenuRunnerWin::CefMenuRunnerWin() {}
|
||||
@@ -21,8 +22,7 @@ bool CefMenuRunnerWin::RunContextMenu(
|
||||
menu_->Rebuild(NULL);
|
||||
|
||||
// Make sure events can be pumped while the menu is up.
|
||||
base::MessageLoop::ScopedNestableTaskAllower allow(
|
||||
base::MessageLoop::current());
|
||||
base::MessageLoopCurrent::ScopedNestableTaskAllower allow;
|
||||
|
||||
const gfx::Point& screen_point =
|
||||
browser->GetScreenPoint(gfx::Point(params.x, params.y));
|
||||
|
@@ -104,6 +104,7 @@ CefWindowX11::CefWindowX11(CefRefPtr<CefBrowserHostImpl> browser,
|
||||
InputOutput,
|
||||
CopyFromParent, // visual
|
||||
CWBackPixmap | CWOverrideRedirect, &swa);
|
||||
CHECK(xwindow_);
|
||||
|
||||
if (ui::PlatformEventSource::GetInstance())
|
||||
ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
|
||||
|
@@ -36,6 +36,7 @@
|
||||
#include "content/browser/frame_host/debug_urls.h"
|
||||
#include "content/browser/webui/content_web_ui_controller_factory.h"
|
||||
#include "content/public/browser/browser_url_handler.h"
|
||||
#include "content/public/browser/web_ui_controller.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "content/public/common/url_utils.h"
|
||||
#include "content/public/common/user_agent.h"
|
||||
@@ -211,24 +212,20 @@ class CefWebUIControllerFactory : public content::WebUIControllerFactory {
|
||||
return false;
|
||||
}
|
||||
|
||||
content::WebUIController* CreateWebUIControllerForURL(
|
||||
std::unique_ptr<content::WebUIController> CreateWebUIControllerForURL(
|
||||
content::WebUI* web_ui,
|
||||
const GURL& url) const override {
|
||||
content::WebUIController* controller = nullptr;
|
||||
std::unique_ptr<content::WebUIController> controller;
|
||||
if (!AllowWebUIForURL(url))
|
||||
return controller;
|
||||
|
||||
controller = content::ContentWebUIControllerFactory::GetInstance()
|
||||
->CreateWebUIControllerForURL(web_ui, url);
|
||||
if (controller != nullptr)
|
||||
if (controller.get())
|
||||
return controller;
|
||||
|
||||
controller = ChromeWebUIControllerFactory::GetInstance()
|
||||
->CreateWebUIControllerForURL(web_ui, url);
|
||||
if (controller != nullptr)
|
||||
return controller;
|
||||
|
||||
return nullptr;
|
||||
return ChromeWebUIControllerFactory::GetInstance()
|
||||
->CreateWebUIControllerForURL(web_ui, url);
|
||||
}
|
||||
|
||||
content::WebUI::TypeID GetWebUIType(content::BrowserContext* browser_context,
|
||||
@@ -437,7 +434,7 @@ std::string GetCommandLine() {
|
||||
|
||||
std::string GetModulePath() {
|
||||
base::FilePath path;
|
||||
if (PathService::Get(base::FILE_MODULE, &path))
|
||||
if (base::PathService::Get(base::FILE_MODULE, &path))
|
||||
return CefString(path.value());
|
||||
return std::string();
|
||||
}
|
||||
|
@@ -4,12 +4,12 @@
|
||||
|
||||
#include "libcef/browser/net/cookie_store_proxy.h"
|
||||
|
||||
#include "libcef/browser/cookie_manager_impl.h"
|
||||
#include "libcef/browser/net/url_request_context_impl.h"
|
||||
#include "include/cef_request_context.h"
|
||||
#include "libcef/browser/net/cookie_store_source.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "net/url_request/url_request_context.h"
|
||||
#include "net/cookies/cookie_change_dispatcher.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -44,12 +44,10 @@ class NullCookieChangeDispatcher : public net::CookieChangeDispatcher {
|
||||
} // namespace
|
||||
|
||||
CefCookieStoreProxy::CefCookieStoreProxy(
|
||||
CefURLRequestContextImpl* parent,
|
||||
CefRefPtr<CefRequestContextHandler> handler)
|
||||
: parent_(parent), handler_(handler) {
|
||||
std::unique_ptr<CefCookieStoreSource> source)
|
||||
: source_(std::move(source)) {
|
||||
CEF_REQUIRE_IOT();
|
||||
DCHECK(parent_);
|
||||
DCHECK(handler_.get());
|
||||
DCHECK(source_);
|
||||
}
|
||||
|
||||
CefCookieStoreProxy::~CefCookieStoreProxy() {
|
||||
@@ -129,28 +127,24 @@ void CefCookieStoreProxy::DeleteCanonicalCookieAsync(
|
||||
}
|
||||
}
|
||||
|
||||
void CefCookieStoreProxy::DeleteAllCreatedBetweenAsync(
|
||||
const base::Time& delete_begin,
|
||||
const base::Time& delete_end,
|
||||
void CefCookieStoreProxy::DeleteAllCreatedInTimeRangeAsync(
|
||||
const net::CookieDeletionInfo::TimeRange& creation_range,
|
||||
DeleteCallback callback) {
|
||||
net::CookieStore* cookie_store = GetCookieStore();
|
||||
if (cookie_store) {
|
||||
cookie_store->DeleteAllCreatedBetweenAsync(delete_begin, delete_end,
|
||||
std::move(callback));
|
||||
cookie_store->DeleteAllCreatedInTimeRangeAsync(creation_range,
|
||||
std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run(0);
|
||||
}
|
||||
}
|
||||
|
||||
void CefCookieStoreProxy::DeleteAllCreatedBetweenWithPredicateAsync(
|
||||
const base::Time& delete_begin,
|
||||
const base::Time& delete_end,
|
||||
const CookiePredicate& predicate,
|
||||
void CefCookieStoreProxy::DeleteAllMatchingInfoAsync(
|
||||
net::CookieDeletionInfo delete_info,
|
||||
DeleteCallback callback) {
|
||||
net::CookieStore* cookie_store = GetCookieStore();
|
||||
if (cookie_store) {
|
||||
cookie_store->DeleteAllCreatedBetweenWithPredicateAsync(
|
||||
delete_begin, delete_end, predicate, std::move(callback));
|
||||
cookie_store->DeleteAllMatchingInfoAsync(delete_info, std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run(0);
|
||||
}
|
||||
@@ -193,24 +187,5 @@ bool CefCookieStoreProxy::IsEphemeral() {
|
||||
|
||||
net::CookieStore* CefCookieStoreProxy::GetCookieStore() {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
CefRefPtr<CefCookieManager> manager = handler_->GetCookieManager();
|
||||
if (manager.get()) {
|
||||
// Use the cookie store provided by the manager. May be nullptr if the
|
||||
// cookie manager is blocking.
|
||||
return reinterpret_cast<CefCookieManagerImpl*>(manager.get())
|
||||
->GetExistingCookieStore();
|
||||
}
|
||||
|
||||
DCHECK(parent_);
|
||||
if (parent_) {
|
||||
// Use the cookie store from the parent.
|
||||
net::CookieStore* cookie_store = parent_->cookie_store();
|
||||
DCHECK(cookie_store);
|
||||
if (!cookie_store)
|
||||
LOG(ERROR) << "Cookie store does not exist";
|
||||
return cookie_store;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return source_->GetCookieStore();
|
||||
}
|
||||
|
@@ -6,19 +6,15 @@
|
||||
#define CEF_LIBCEF_BROWSER_COOKIE_STORE_PROXY_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_request_context_handler.h"
|
||||
|
||||
#include "net/cookies/cookie_store.h"
|
||||
|
||||
class CefURLRequestContextImpl;
|
||||
class CefCookieStoreSource;
|
||||
|
||||
// Proxies cookie requests to the CefRequestContextHandler or global cookie
|
||||
// store. Life span is controlled by CefURLRequestContextProxy. Only accessed on
|
||||
// the IO thread. See browser_context.h for an object relationship diagram.
|
||||
// Proxies cookie requests to a CefCookieStoreSource (see comments on the
|
||||
// implementation classes for details). Only accessed on the IO thread.
|
||||
class CefCookieStoreProxy : public net::CookieStore {
|
||||
public:
|
||||
CefCookieStoreProxy(CefURLRequestContextImpl* parent,
|
||||
CefRefPtr<CefRequestContextHandler> handler);
|
||||
explicit CefCookieStoreProxy(std::unique_ptr<CefCookieStoreSource> source);
|
||||
~CefCookieStoreProxy() override;
|
||||
|
||||
// net::CookieStore methods.
|
||||
@@ -39,14 +35,11 @@ class CefCookieStoreProxy : public net::CookieStore {
|
||||
base::OnceClosure callback) override;
|
||||
void DeleteCanonicalCookieAsync(const net::CanonicalCookie& cookie,
|
||||
DeleteCallback callback) override;
|
||||
void DeleteAllCreatedBetweenAsync(const base::Time& delete_begin,
|
||||
const base::Time& delete_end,
|
||||
DeleteCallback callback) override;
|
||||
void DeleteAllCreatedBetweenWithPredicateAsync(
|
||||
const base::Time& delete_begin,
|
||||
const base::Time& delete_end,
|
||||
const CookiePredicate& predicate,
|
||||
void DeleteAllCreatedInTimeRangeAsync(
|
||||
const net::CookieDeletionInfo::TimeRange& creation_range,
|
||||
DeleteCallback callback) override;
|
||||
void DeleteAllMatchingInfoAsync(net::CookieDeletionInfo delete_info,
|
||||
DeleteCallback callback) override;
|
||||
void DeleteSessionCookiesAsync(DeleteCallback callback) override;
|
||||
void FlushStore(base::OnceClosure callback) override;
|
||||
net::CookieChangeDispatcher& GetChangeDispatcher() override;
|
||||
@@ -55,11 +48,7 @@ class CefCookieStoreProxy : public net::CookieStore {
|
||||
private:
|
||||
net::CookieStore* GetCookieStore();
|
||||
|
||||
// The |parent_| pointer is kept alive by CefURLRequestContextGetterProxy
|
||||
// which has a ref to the owning CefURLRequestContextGetterImpl.
|
||||
CefURLRequestContextImpl* parent_;
|
||||
CefRefPtr<CefRequestContextHandler> handler_;
|
||||
|
||||
std::unique_ptr<CefCookieStoreSource> const source_;
|
||||
std::unique_ptr<net::CookieChangeDispatcher> null_dispatcher_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefCookieStoreProxy);
|
||||
|
110
libcef/browser/net/cookie_store_source.cc
Normal file
110
libcef/browser/net/cookie_store_source.cc
Normal file
@@ -0,0 +1,110 @@
|
||||
// Copyright (c) 2018 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that can
|
||||
// be found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/net/cookie_store_source.h"
|
||||
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/cookie_manager_impl.h"
|
||||
#include "libcef/browser/net/url_request_context_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "net/extras/sqlite/sqlite_persistent_cookie_store.h"
|
||||
|
||||
CefCookieStoreHandlerSource::CefCookieStoreHandlerSource(
|
||||
CefURLRequestContextImpl* parent,
|
||||
CefRefPtr<CefRequestContextHandler> handler)
|
||||
: parent_(parent), handler_(handler) {
|
||||
DCHECK(parent_);
|
||||
DCHECK(handler_);
|
||||
}
|
||||
|
||||
net::CookieStore* CefCookieStoreHandlerSource::GetCookieStore() {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
CefRefPtr<CefCookieManager> manager = handler_->GetCookieManager();
|
||||
if (manager) {
|
||||
// Use the cookie store provided by the manager. May be nullptr if the
|
||||
// cookie manager is blocking.
|
||||
return reinterpret_cast<CefCookieManagerImpl*>(manager.get())
|
||||
->GetExistingCookieStore();
|
||||
}
|
||||
|
||||
DCHECK(parent_);
|
||||
if (parent_) {
|
||||
// Use the cookie store from the parent.
|
||||
net::CookieStore* cookie_store = parent_->cookie_store();
|
||||
DCHECK(cookie_store);
|
||||
if (!cookie_store)
|
||||
LOG(ERROR) << "Cookie store does not exist";
|
||||
return cookie_store;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CefCookieStoreOwnerSource::CefCookieStoreOwnerSource() {}
|
||||
|
||||
void CefCookieStoreOwnerSource::SetCookieStoragePath(
|
||||
const base::FilePath& path,
|
||||
bool persist_session_cookies) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
if (cookie_store_ && ((path_.empty() && path.empty()) || path_ == path)) {
|
||||
// The path has not changed so don't do anything.
|
||||
return;
|
||||
}
|
||||
|
||||
scoped_refptr<net::SQLitePersistentCookieStore> persistent_store;
|
||||
if (!path.empty()) {
|
||||
// TODO(cef): Move directory creation to the blocking pool instead of
|
||||
// allowing file IO on this thread.
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
if (base::DirectoryExists(path) || base::CreateDirectory(path)) {
|
||||
const base::FilePath& cookie_path = path.AppendASCII("Cookies");
|
||||
persistent_store = new net::SQLitePersistentCookieStore(
|
||||
cookie_path,
|
||||
content::BrowserThread::GetTaskRunnerForThread(
|
||||
content::BrowserThread::IO),
|
||||
// Intentionally using the background task runner exposed by CEF to
|
||||
// facilitate unit test expectations. This task runner MUST be
|
||||
// configured with BLOCK_SHUTDOWN.
|
||||
CefContentBrowserClient::Get()->background_task_runner(),
|
||||
persist_session_cookies, NULL);
|
||||
} else {
|
||||
NOTREACHED() << "The cookie storage directory could not be created";
|
||||
}
|
||||
}
|
||||
|
||||
// Set the new cookie store that will be used for all new requests. The old
|
||||
// cookie store, if any, will be automatically flushed and closed when no
|
||||
// longer referenced.
|
||||
std::unique_ptr<net::CookieMonster> cookie_monster(
|
||||
new net::CookieMonster(persistent_store.get(), nullptr));
|
||||
if (persistent_store.get() && persist_session_cookies)
|
||||
cookie_monster->SetPersistSessionCookies(true);
|
||||
path_ = path;
|
||||
|
||||
// Restore the previously supported schemes.
|
||||
CefCookieManagerImpl::SetCookieMonsterSchemes(cookie_monster.get(),
|
||||
supported_schemes_);
|
||||
|
||||
cookie_store_ = std::move(cookie_monster);
|
||||
}
|
||||
|
||||
void CefCookieStoreOwnerSource::SetCookieSupportedSchemes(
|
||||
const std::vector<std::string>& schemes) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
supported_schemes_ = schemes;
|
||||
CefCookieManagerImpl::SetCookieMonsterSchemes(
|
||||
static_cast<net::CookieMonster*>(cookie_store_.get()),
|
||||
supported_schemes_);
|
||||
}
|
||||
|
||||
net::CookieStore* CefCookieStoreOwnerSource::GetCookieStore() {
|
||||
CEF_REQUIRE_IOT();
|
||||
return cookie_store_.get();
|
||||
}
|
73
libcef/browser/net/cookie_store_source.h
Normal file
73
libcef/browser/net/cookie_store_source.h
Normal file
@@ -0,0 +1,73 @@
|
||||
// Copyright (c) 2018 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that can
|
||||
// be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_COOKIE_STORE_SOURCE_H_
|
||||
#define CEF_LIBCEF_BROWSER_COOKIE_STORE_SOURCE_H_
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "include/cef_request_context_handler.h"
|
||||
|
||||
#include "base/macros.h"
|
||||
|
||||
namespace base {
|
||||
class FilePath;
|
||||
}
|
||||
|
||||
namespace net {
|
||||
class CookieStore;
|
||||
}
|
||||
|
||||
class CefURLRequestContextImpl;
|
||||
|
||||
// Abstract base class for CookieStore sources. Only accessed on the IO thread.
|
||||
class CefCookieStoreSource {
|
||||
public:
|
||||
virtual net::CookieStore* GetCookieStore() = 0;
|
||||
virtual ~CefCookieStoreSource() {}
|
||||
};
|
||||
|
||||
// Sources a cookie store that is created/owned by a CefCookieManager or the
|
||||
// parent context. Life span is controlled by CefURLRequestContextProxy. See
|
||||
// browser_context.h for an object relationship diagram.
|
||||
class CefCookieStoreHandlerSource : public CefCookieStoreSource {
|
||||
public:
|
||||
CefCookieStoreHandlerSource(CefURLRequestContextImpl* parent,
|
||||
CefRefPtr<CefRequestContextHandler> handler);
|
||||
|
||||
net::CookieStore* GetCookieStore() override;
|
||||
|
||||
private:
|
||||
// The |parent_| pointer is kept alive by CefURLRequestContextGetterProxy
|
||||
// which has a ref to the owning CefURLRequestContextGetterImpl.
|
||||
CefURLRequestContextImpl* parent_;
|
||||
CefRefPtr<CefRequestContextHandler> handler_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefCookieStoreHandlerSource);
|
||||
};
|
||||
|
||||
// Sources a cookie store that is created/owned by this object. Life span is
|
||||
// controlled by the owning URLRequestContext.
|
||||
class CefCookieStoreOwnerSource : public CefCookieStoreSource {
|
||||
public:
|
||||
CefCookieStoreOwnerSource();
|
||||
|
||||
void SetCookieStoragePath(const base::FilePath& path,
|
||||
bool persist_session_cookies);
|
||||
void SetCookieSupportedSchemes(const std::vector<std::string>& schemes);
|
||||
|
||||
net::CookieStore* GetCookieStore() override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<net::CookieStore> cookie_store_;
|
||||
base::FilePath path_;
|
||||
std::vector<std::string> supported_schemes_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefCookieStoreOwnerSource);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_COOKIE_STORE_SOURCE_H_
|
@@ -32,18 +32,18 @@ namespace {
|
||||
|
||||
class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
|
||||
public:
|
||||
typedef net::CompletionCallback CallbackType;
|
||||
typedef net::CompletionOnceCallback CallbackType;
|
||||
|
||||
CefBeforeResourceLoadCallbackImpl(CefRefPtr<CefRequestImpl> cef_request,
|
||||
GURL* new_url,
|
||||
net::URLRequest* url_request,
|
||||
bool force_google_safesearch,
|
||||
const CallbackType& callback)
|
||||
CallbackType callback)
|
||||
: cef_request_(cef_request),
|
||||
new_url_(new_url),
|
||||
url_request_(url_request),
|
||||
force_google_safesearch_(force_google_safesearch),
|
||||
callback_(callback) {
|
||||
callback_(std::move(callback)) {
|
||||
DCHECK(new_url);
|
||||
DCHECK(url_request_);
|
||||
|
||||
@@ -56,13 +56,14 @@ class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
|
||||
if (!callback_.is_null()) {
|
||||
// The callback is still pending. Cancel it now.
|
||||
if (CEF_CURRENTLY_ON_IOT()) {
|
||||
RunNow(cef_request_, new_url_, url_request_, callback_,
|
||||
RunNow(cef_request_, new_url_, url_request_, std::move(callback_),
|
||||
force_google_safesearch_, false);
|
||||
} else {
|
||||
CEF_POST_TASK(
|
||||
CEF_IOT, base::Bind(&CefBeforeResourceLoadCallbackImpl::RunNow,
|
||||
cef_request_, new_url_, url_request_, callback_,
|
||||
force_google_safesearch_, false));
|
||||
CEF_POST_TASK(CEF_IOT,
|
||||
base::Bind(&CefBeforeResourceLoadCallbackImpl::RunNow,
|
||||
cef_request_, new_url_, url_request_,
|
||||
base::Passed(std::move(callback_)),
|
||||
force_google_safesearch_, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,12 +80,13 @@ class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
|
||||
void ContinueNow(bool allow) {
|
||||
CEF_REQUIRE_IOT();
|
||||
if (!callback_.is_null()) {
|
||||
RunNow(cef_request_, new_url_, url_request_, callback_,
|
||||
RunNow(cef_request_, new_url_, url_request_, std::move(callback_),
|
||||
force_google_safesearch_, allow);
|
||||
Disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void Disconnect() {
|
||||
CEF_REQUIRE_IOT();
|
||||
cef_request_ = nullptr;
|
||||
@@ -93,7 +95,6 @@ class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
|
||||
callback_.Reset();
|
||||
}
|
||||
|
||||
private:
|
||||
// Used to disconnect the callback when the associated URLRequest is
|
||||
// destroyed.
|
||||
class Disconnector : public base::SupportsUserData::Data {
|
||||
@@ -114,7 +115,7 @@ class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
|
||||
static void RunNow(CefRefPtr<CefRequestImpl> cef_request,
|
||||
GURL* new_url,
|
||||
net::URLRequest* request,
|
||||
const CallbackType& callback,
|
||||
CallbackType callback,
|
||||
bool force_google_safesearch,
|
||||
bool allow) {
|
||||
CEF_REQUIRE_IOT();
|
||||
@@ -144,7 +145,7 @@ class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
|
||||
if (force_google_safesearch && allow && new_url->is_empty())
|
||||
safe_search_util::ForceGoogleSafeSearch(request, new_url);
|
||||
|
||||
callback.Run(allow ? net::OK : net::ERR_ABORTED);
|
||||
std::move(callback).Run(allow ? net::OK : net::ERR_ABORTED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,17 +169,18 @@ int CefBeforeResourceLoadCallbackImpl::kLocatorKey = 0;
|
||||
|
||||
class CefAuthCallbackImpl : public CefAuthCallback {
|
||||
public:
|
||||
CefAuthCallbackImpl(const net::NetworkDelegate::AuthCallback& callback,
|
||||
net::AuthCredentials* credentials)
|
||||
: callback_(callback), credentials_(credentials) {}
|
||||
typedef net::NetworkDelegate::AuthCallback CallbackType;
|
||||
|
||||
CefAuthCallbackImpl(CallbackType callback, net::AuthCredentials* credentials)
|
||||
: callback_(std::move(callback)), credentials_(credentials) {}
|
||||
~CefAuthCallbackImpl() override {
|
||||
if (!callback_.is_null()) {
|
||||
// The auth callback is still pending. Cancel it now.
|
||||
if (CEF_CURRENTLY_ON_IOT()) {
|
||||
CancelNow(callback_);
|
||||
CancelNow(std::move(callback_));
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_IOT,
|
||||
base::Bind(&CefAuthCallbackImpl::CancelNow, callback_));
|
||||
CEF_POST_TASK(CEF_IOT, base::Bind(&CefAuthCallbackImpl::CancelNow,
|
||||
base::Passed(std::move(callback_))));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -187,8 +189,8 @@ class CefAuthCallbackImpl : public CefAuthCallback {
|
||||
if (CEF_CURRENTLY_ON_IOT()) {
|
||||
if (!callback_.is_null()) {
|
||||
credentials_->Set(username, password);
|
||||
callback_.Run(net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_SET_AUTH);
|
||||
callback_.Reset();
|
||||
std::move(callback_).Run(
|
||||
net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_SET_AUTH);
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_IOT, base::Bind(&CefAuthCallbackImpl::Continue, this,
|
||||
@@ -199,23 +201,23 @@ class CefAuthCallbackImpl : public CefAuthCallback {
|
||||
void Cancel() override {
|
||||
if (CEF_CURRENTLY_ON_IOT()) {
|
||||
if (!callback_.is_null()) {
|
||||
CancelNow(callback_);
|
||||
callback_.Reset();
|
||||
CancelNow(std::move(callback_));
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_IOT, base::Bind(&CefAuthCallbackImpl::Cancel, this));
|
||||
}
|
||||
}
|
||||
|
||||
void Disconnect() { callback_.Reset(); }
|
||||
CallbackType Disconnect() WARN_UNUSED_RESULT { return std::move(callback_); }
|
||||
|
||||
private:
|
||||
static void CancelNow(const net::NetworkDelegate::AuthCallback& callback) {
|
||||
static void CancelNow(CallbackType callback) {
|
||||
CEF_REQUIRE_IOT();
|
||||
callback.Run(net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION);
|
||||
std::move(callback).Run(
|
||||
net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION);
|
||||
}
|
||||
|
||||
net::NetworkDelegate::AuthCallback callback_;
|
||||
CallbackType callback_;
|
||||
net::AuthCredentials* credentials_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefAuthCallbackImpl);
|
||||
@@ -277,10 +279,9 @@ std::unique_ptr<net::SourceStream> CefNetworkDelegate::CreateSourceStream(
|
||||
return upstream;
|
||||
}
|
||||
|
||||
int CefNetworkDelegate::OnBeforeURLRequest(
|
||||
net::URLRequest* request,
|
||||
const net::CompletionCallback& callback,
|
||||
GURL* new_url) {
|
||||
int CefNetworkDelegate::OnBeforeURLRequest(net::URLRequest* request,
|
||||
net::CompletionOnceCallback callback,
|
||||
GURL* new_url) {
|
||||
if (net_util::IsInternalRequest(request))
|
||||
return net::OK;
|
||||
|
||||
@@ -312,7 +313,7 @@ int CefNetworkDelegate::OnBeforeURLRequest(
|
||||
CefRefPtr<CefBeforeResourceLoadCallbackImpl> callbackImpl(
|
||||
new CefBeforeResourceLoadCallbackImpl(requestPtr, new_url, request,
|
||||
force_google_safesearch,
|
||||
callback));
|
||||
std::move(callback)));
|
||||
|
||||
// Give the client an opportunity to evaluate the request.
|
||||
cef_return_value_t retval = handler->OnBeforeResourceLoad(
|
||||
@@ -338,7 +339,9 @@ int CefNetworkDelegate::OnBeforeURLRequest(
|
||||
return net::OK;
|
||||
}
|
||||
|
||||
void CefNetworkDelegate::OnCompleted(net::URLRequest* request, bool started) {
|
||||
void CefNetworkDelegate::OnCompleted(net::URLRequest* request,
|
||||
bool started,
|
||||
int net_error) {
|
||||
if (net_util::IsInternalRequest(request))
|
||||
return;
|
||||
|
||||
@@ -391,7 +394,7 @@ void CefNetworkDelegate::OnCompleted(net::URLRequest* request, bool started) {
|
||||
net::NetworkDelegate::AuthRequiredResponse CefNetworkDelegate::OnAuthRequired(
|
||||
net::URLRequest* request,
|
||||
const net::AuthChallengeInfo& auth_info,
|
||||
const AuthCallback& callback,
|
||||
AuthCallback callback,
|
||||
net::AuthCredentials* credentials) {
|
||||
if (net_util::IsInternalRequest(request))
|
||||
return AUTH_REQUIRED_RESPONSE_NO_ACTION;
|
||||
@@ -406,14 +409,14 @@ net::NetworkDelegate::AuthRequiredResponse CefNetworkDelegate::OnAuthRequired(
|
||||
CefRefPtr<CefFrame> frame = browser->GetFrameForRequest(request);
|
||||
|
||||
CefRefPtr<CefAuthCallbackImpl> callbackPtr(
|
||||
new CefAuthCallbackImpl(callback, credentials));
|
||||
new CefAuthCallbackImpl(std::move(callback), credentials));
|
||||
if (handler->GetAuthCredentials(
|
||||
browser.get(), frame, auth_info.is_proxy,
|
||||
auth_info.challenger.host(), auth_info.challenger.port(),
|
||||
auth_info.realm, auth_info.scheme, callbackPtr.get())) {
|
||||
return AUTH_REQUIRED_RESPONSE_IO_PENDING;
|
||||
} else {
|
||||
callbackPtr->Disconnect();
|
||||
callback = callbackPtr->Disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -426,14 +429,14 @@ net::NetworkDelegate::AuthRequiredResponse CefNetworkDelegate::OnAuthRequired(
|
||||
CefRefPtr<CefURLRequestClient> client = user_data->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefAuthCallbackImpl> callbackPtr(
|
||||
new CefAuthCallbackImpl(callback, credentials));
|
||||
new CefAuthCallbackImpl(std::move(callback), credentials));
|
||||
if (client->GetAuthCredentials(
|
||||
auth_info.is_proxy, auth_info.challenger.host(),
|
||||
auth_info.challenger.port(), auth_info.realm, auth_info.scheme,
|
||||
callbackPtr.get())) {
|
||||
return AUTH_REQUIRED_RESPONSE_IO_PENDING;
|
||||
} else {
|
||||
callbackPtr->Disconnect();
|
||||
callback = callbackPtr->Disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -30,14 +30,16 @@ class CefNetworkDelegate : public net::NetworkDelegateImpl {
|
||||
net::URLRequest* request,
|
||||
std::unique_ptr<net::SourceStream> upstream) override;
|
||||
int OnBeforeURLRequest(net::URLRequest* request,
|
||||
const net::CompletionCallback& callback,
|
||||
net::CompletionOnceCallback callback,
|
||||
GURL* new_url) override;
|
||||
AuthRequiredResponse OnAuthRequired(
|
||||
net::URLRequest* request,
|
||||
const net::AuthChallengeInfo& auth_info,
|
||||
const AuthCallback& callback,
|
||||
AuthCallback callback,
|
||||
net::AuthCredentials* credentials) override;
|
||||
void OnCompleted(net::URLRequest* request, bool started) override;
|
||||
void OnCompleted(net::URLRequest* request,
|
||||
bool started,
|
||||
int net_error) override;
|
||||
bool OnCanGetCookies(const net::URLRequest& request,
|
||||
const net::CookieList& cookie_list) override;
|
||||
bool OnCanSetCookie(const net::URLRequest& request,
|
||||
|
@@ -282,11 +282,14 @@ void CefResourceRequestJob::GetLoadTimingInfo(
|
||||
load_timing_info->receive_headers_end = receive_headers_end_;
|
||||
}
|
||||
|
||||
bool CefResourceRequestJob::IsRedirectResponse(GURL* location,
|
||||
int* http_status_code) {
|
||||
bool CefResourceRequestJob::IsRedirectResponse(
|
||||
GURL* location,
|
||||
int* http_status_code,
|
||||
bool* insecure_scheme_was_upgraded) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
bool redirect = false;
|
||||
*insecure_scheme_was_upgraded = false;
|
||||
|
||||
if (redirect_url_.is_valid()) {
|
||||
// Redirect to the new URL.
|
||||
|
@@ -38,7 +38,9 @@ class CefResourceRequestJob : public net::URLRequestJob {
|
||||
int ReadRawData(net::IOBuffer* dest, int dest_size) override;
|
||||
void GetResponseInfo(net::HttpResponseInfo* info) override;
|
||||
void GetLoadTimingInfo(net::LoadTimingInfo* load_timing_info) const override;
|
||||
bool IsRedirectResponse(GURL* location, int* http_status_code) override;
|
||||
bool IsRedirectResponse(GURL* location,
|
||||
int* http_status_code,
|
||||
bool* insecure_scheme_was_upgraded) override;
|
||||
bool GetMimeType(std::string* mime_type) const override;
|
||||
bool GetCharset(std::string* charset) override;
|
||||
int GetResponseCode() const override;
|
||||
|
@@ -10,6 +10,8 @@
|
||||
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/cookie_manager_impl.h"
|
||||
#include "libcef/browser/net/cookie_store_proxy.h"
|
||||
#include "libcef/browser/net/cookie_store_source.h"
|
||||
#include "libcef/browser/net/network_delegate.h"
|
||||
#include "libcef/browser/net/scheme_handler.h"
|
||||
#include "libcef/browser/net/url_request_interceptor.h"
|
||||
@@ -18,7 +20,6 @@
|
||||
#include "libcef/common/content_client.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/stl_util.h"
|
||||
@@ -28,6 +29,8 @@
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/common/pref_names.h"
|
||||
#include "components/certificate_transparency/chrome_ct_policy_enforcer.h"
|
||||
#include "components/certificate_transparency/ct_known_logs.h"
|
||||
#include "components/net_log/chrome_net_log.h"
|
||||
#include "components/network_session_configurator/browser/network_session_configurator.h"
|
||||
#include "components/prefs/pref_registry_simple.h"
|
||||
@@ -37,13 +40,10 @@
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "net/cert/cert_verifier.h"
|
||||
#include "net/cert/ct_known_logs.h"
|
||||
#include "net/cert/ct_log_verifier.h"
|
||||
#include "net/cert/ct_policy_enforcer.h"
|
||||
#include "net/cert/multi_log_ct_verifier.h"
|
||||
#include "net/cookies/cookie_monster.h"
|
||||
#include "net/dns/host_resolver.h"
|
||||
#include "net/extras/sqlite/sqlite_persistent_cookie_store.h"
|
||||
#include "net/ftp/ftp_network_layer.h"
|
||||
#include "net/http/http_auth_handler_factory.h"
|
||||
#include "net/http/http_auth_preferences.h"
|
||||
@@ -138,7 +138,7 @@ std::unique_ptr<net::ProxyResolutionService> CreateProxyResolutionService(
|
||||
|
||||
proxy_service = network::CreateProxyResolutionServiceUsingMojoFactory(
|
||||
std::move(proxy_resolver_factory), std::move(proxy_config_service),
|
||||
std::make_unique<net::PacFileFetcherImpl>(context),
|
||||
net::PacFileFetcherImpl::Create(context),
|
||||
std::move(dhcp_pac_file_fetcher), context->host_resolver(), net_log,
|
||||
network_delegate);
|
||||
} else {
|
||||
@@ -155,6 +155,27 @@ std::unique_ptr<net::ProxyResolutionService> CreateProxyResolutionService(
|
||||
return proxy_service;
|
||||
}
|
||||
|
||||
// Based on net::ct::CreateLogVerifiersForKnownLogs which was deleted in
|
||||
// https://crrev.com/24711fe395.
|
||||
std::vector<scoped_refptr<const net::CTLogVerifier>>
|
||||
CreateLogVerifiersForKnownLogs() {
|
||||
std::vector<scoped_refptr<const net::CTLogVerifier>> verifiers;
|
||||
|
||||
for (const auto& log : certificate_transparency::GetKnownLogs()) {
|
||||
scoped_refptr<const net::CTLogVerifier> log_verifier =
|
||||
net::CTLogVerifier::Create(
|
||||
base::StringPiece(log.log_key, log.log_key_length), log.log_name,
|
||||
log.log_dns_domain);
|
||||
// Make sure no null logs enter verifiers. Parsing of all statically
|
||||
// configured logs should always succeed, unless there has been binary or
|
||||
// memory corruption.
|
||||
CHECK(log_verifier);
|
||||
verifiers.push_back(std::move(log_verifier));
|
||||
}
|
||||
|
||||
return verifiers;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl(
|
||||
@@ -304,14 +325,15 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
|
||||
std::move(transport_security_state));
|
||||
|
||||
std::vector<scoped_refptr<const net::CTLogVerifier>> ct_logs(
|
||||
net::ct::CreateLogVerifiersForKnownLogs());
|
||||
CreateLogVerifiersForKnownLogs());
|
||||
std::unique_ptr<net::MultiLogCTVerifier> ct_verifier(
|
||||
new net::MultiLogCTVerifier());
|
||||
ct_verifier->AddLogs(ct_logs);
|
||||
io_state_->storage_->set_cert_transparency_verifier(std::move(ct_verifier));
|
||||
|
||||
std::unique_ptr<net::CTPolicyEnforcer> ct_policy_enforcer(
|
||||
new net::CTPolicyEnforcer);
|
||||
std::unique_ptr<certificate_transparency::ChromeCTPolicyEnforcer>
|
||||
ct_policy_enforcer(
|
||||
new certificate_transparency::ChromeCTPolicyEnforcer);
|
||||
ct_policy_enforcer->set_enforce_net_security_expiration(
|
||||
settings_.enable_net_security_expiration ? true : false);
|
||||
io_state_->storage_->set_ct_policy_enforcer(std::move(ct_policy_enforcer));
|
||||
@@ -328,7 +350,7 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
|
||||
std::move(system_proxy_service));
|
||||
|
||||
io_state_->storage_->set_ssl_config_service(
|
||||
new net::SSLConfigServiceDefaults);
|
||||
std::make_unique<net::SSLConfigServiceDefaults>());
|
||||
|
||||
std::vector<std::string> supported_schemes;
|
||||
supported_schemes.push_back("basic");
|
||||
@@ -336,18 +358,12 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
|
||||
supported_schemes.push_back("ntlm");
|
||||
supported_schemes.push_back("negotiate");
|
||||
|
||||
io_state_->http_auth_preferences_.reset(new net::HttpAuthPreferences(
|
||||
supported_schemes
|
||||
#if defined(OS_POSIX) && !defined(OS_ANDROID)
|
||||
,
|
||||
io_state_->gsapi_library_name_
|
||||
#endif
|
||||
));
|
||||
io_state_->http_auth_preferences_.reset(new net::HttpAuthPreferences());
|
||||
|
||||
io_state_->storage_->set_http_auth_handler_factory(
|
||||
net::HttpAuthHandlerRegistryFactory::Create(
|
||||
io_state_->http_auth_preferences_.get(),
|
||||
io_state_->url_request_context_->host_resolver()));
|
||||
io_state_->url_request_context_->host_resolver(),
|
||||
io_state_->http_auth_preferences_.get(), supported_schemes));
|
||||
io_state_->storage_->set_http_server_properties(
|
||||
base::WrapUnique(new net::HttpServerPropertiesImpl));
|
||||
|
||||
@@ -457,57 +473,21 @@ void CefURLRequestContextGetterImpl::SetCookieStoragePath(
|
||||
const base::FilePath& path,
|
||||
bool persist_session_cookies) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
if (io_state_->url_request_context_->cookie_store() &&
|
||||
((io_state_->cookie_store_path_.empty() && path.empty()) ||
|
||||
io_state_->cookie_store_path_ == path)) {
|
||||
// The path has not changed so don't do anything.
|
||||
return;
|
||||
if (!io_state_->cookie_source_) {
|
||||
// Use a proxy because we can't change the URLRequestContext's CookieStore
|
||||
// during runtime.
|
||||
io_state_->cookie_source_ = new CefCookieStoreOwnerSource();
|
||||
io_state_->storage_->set_cookie_store(std::make_unique<CefCookieStoreProxy>(
|
||||
base::WrapUnique(io_state_->cookie_source_)));
|
||||
}
|
||||
|
||||
scoped_refptr<net::SQLitePersistentCookieStore> persistent_store;
|
||||
if (!path.empty()) {
|
||||
// TODO(cef): Move directory creation to the blocking pool instead of
|
||||
// allowing file IO on this thread.
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
if (base::DirectoryExists(path) || base::CreateDirectory(path)) {
|
||||
const base::FilePath& cookie_path = path.AppendASCII("Cookies");
|
||||
persistent_store = new net::SQLitePersistentCookieStore(
|
||||
cookie_path, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
|
||||
// Intentionally using the background task runner exposed by CEF to
|
||||
// facilitate unit test expectations. This task runner MUST be
|
||||
// configured with BLOCK_SHUTDOWN.
|
||||
CefContentBrowserClient::Get()->background_task_runner(),
|
||||
persist_session_cookies, NULL);
|
||||
} else {
|
||||
NOTREACHED() << "The cookie storage directory could not be created";
|
||||
}
|
||||
}
|
||||
|
||||
// Set the new cookie store that will be used for all new requests. The old
|
||||
// cookie store, if any, will be automatically flushed and closed when no
|
||||
// longer referenced.
|
||||
std::unique_ptr<net::CookieMonster> cookie_monster(
|
||||
new net::CookieMonster(persistent_store.get(), NULL));
|
||||
if (persistent_store.get() && persist_session_cookies)
|
||||
cookie_monster->SetPersistSessionCookies(true);
|
||||
io_state_->cookie_store_path_ = path;
|
||||
|
||||
// Restore the previously supported schemes.
|
||||
CefCookieManagerImpl::SetCookieMonsterSchemes(
|
||||
cookie_monster.get(), io_state_->cookie_supported_schemes_);
|
||||
|
||||
io_state_->storage_->set_cookie_store(std::move(cookie_monster));
|
||||
io_state_->cookie_source_->SetCookieStoragePath(path,
|
||||
persist_session_cookies);
|
||||
}
|
||||
|
||||
void CefURLRequestContextGetterImpl::SetCookieSupportedSchemes(
|
||||
const std::vector<std::string>& schemes) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
io_state_->cookie_supported_schemes_ = schemes;
|
||||
CefCookieManagerImpl::SetCookieMonsterSchemes(
|
||||
static_cast<net::CookieMonster*>(GetExistingCookieStore()),
|
||||
io_state_->cookie_supported_schemes_);
|
||||
io_state_->cookie_source_->SetCookieSupportedSchemes(schemes);
|
||||
}
|
||||
|
||||
void CefURLRequestContextGetterImpl::AddHandler(
|
||||
@@ -524,9 +504,8 @@ void CefURLRequestContextGetterImpl::AddHandler(
|
||||
net::CookieStore* CefURLRequestContextGetterImpl::GetExistingCookieStore()
|
||||
const {
|
||||
CEF_REQUIRE_IOT();
|
||||
if (io_state_->url_request_context_ &&
|
||||
io_state_->url_request_context_->cookie_store()) {
|
||||
return io_state_->url_request_context_->cookie_store();
|
||||
if (io_state_->cookie_source_) {
|
||||
return io_state_->cookie_source_->GetCookieStore();
|
||||
}
|
||||
|
||||
LOG(ERROR) << "Cookie store does not exist";
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "net/url_request/url_request_job_factory.h"
|
||||
|
||||
class CefCookieStoreOwnerSource;
|
||||
class PrefRegistrySimple;
|
||||
class PrefService;
|
||||
|
||||
@@ -113,8 +114,8 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
|
||||
content::ProtocolHandlerMap protocol_handlers_;
|
||||
content::URLRequestInterceptorScopedVector request_interceptors_;
|
||||
|
||||
base::FilePath cookie_store_path_;
|
||||
std::vector<std::string> cookie_supported_schemes_;
|
||||
// Owned by the URLRequestContextStorage.
|
||||
CefCookieStoreOwnerSource* cookie_source_ = nullptr;
|
||||
|
||||
std::vector<CefRefPtr<CefRequestContextHandler>> handler_list_;
|
||||
|
||||
|
@@ -5,6 +5,7 @@
|
||||
#include "libcef/browser/net/url_request_context_proxy.h"
|
||||
|
||||
#include "libcef/browser/net/cookie_store_proxy.h"
|
||||
#include "libcef/browser/net/cookie_store_source.h"
|
||||
#include "libcef/browser/net/url_request_context_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
@@ -16,7 +17,8 @@ CefURLRequestContextProxy::CefURLRequestContextProxy(
|
||||
DCHECK(handler.get());
|
||||
|
||||
// Cookie store that proxies to the browser implementation.
|
||||
cookie_store_proxy_.reset(new CefCookieStoreProxy(parent, handler));
|
||||
cookie_store_proxy_.reset(new CefCookieStoreProxy(
|
||||
std::make_unique<CefCookieStoreHandlerSource>(parent, handler)));
|
||||
set_cookie_store(cookie_store_proxy_.get());
|
||||
|
||||
// All other values refer to the parent request context.
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#include "libcef/browser/osr/web_contents_view_osr.h"
|
||||
#include "libcef/common/drag_data_impl.h"
|
||||
|
||||
#include "base/message_loop/message_loop_current.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_input_event_router.h"
|
||||
#include "content/browser/web_contents/web_contents_impl.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
@@ -72,10 +73,10 @@ SkColor CefBrowserPlatformDelegateOsr::GetBackgroundColor() const {
|
||||
return native_delegate_->GetBackgroundColor();
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateOsr::WasResized() {
|
||||
void CefBrowserPlatformDelegateOsr::SynchronizeVisualProperties() {
|
||||
CefRenderWidgetHostViewOSR* view = GetOSRHostView();
|
||||
if (view)
|
||||
view->WasResized();
|
||||
view->SynchronizeVisualProperties();
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateOsr::SendKeyEvent(
|
||||
@@ -455,8 +456,7 @@ void CefBrowserPlatformDelegateOsr::StartDragging(
|
||||
CefRefPtr<CefDragDataImpl> drag_data(
|
||||
new CefDragDataImpl(drop_data, cef_image, cef_image_pos));
|
||||
drag_data->SetReadOnly(true);
|
||||
base::MessageLoop::ScopedNestableTaskAllower allow(
|
||||
base::MessageLoop::current());
|
||||
base::MessageLoopCurrent::ScopedNestableTaskAllower allow;
|
||||
handled = handler->StartDragging(
|
||||
browser_, drag_data.get(),
|
||||
static_cast<CefRenderHandler::DragOperationsMask>(allowed_ops),
|
||||
@@ -535,7 +535,7 @@ void CefBrowserPlatformDelegateOsr::DragSourceSystemDragEnded() {
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateOsr::AccessibilityEventReceived(
|
||||
const std::vector<content::AXEventNotificationDetails>& eventData) {
|
||||
const content::AXEventNotificationDetails& eventData) {
|
||||
CefRefPtr<CefRenderHandler> handler = browser_->client()->GetRenderHandler();
|
||||
if (handler.get()) {
|
||||
CefRefPtr<CefAccessibilityHandler> acchandler =
|
||||
|
@@ -28,7 +28,7 @@ class CefBrowserPlatformDelegateOsr
|
||||
void BrowserCreated(CefBrowserHostImpl* browser) override;
|
||||
void BrowserDestroyed(CefBrowserHostImpl* browser) override;
|
||||
SkColor GetBackgroundColor() const override;
|
||||
void WasResized() override;
|
||||
void SynchronizeVisualProperties() override;
|
||||
void SendKeyEvent(const content::NativeWebKeyboardEvent& event) override;
|
||||
void SendMouseEvent(const blink::WebMouseEvent& event) override;
|
||||
void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event) override;
|
||||
@@ -90,8 +90,7 @@ class CefBrowserPlatformDelegateOsr
|
||||
void DragSourceEndedAt(int x, int y, cef_drag_operations_mask_t op) override;
|
||||
void DragSourceSystemDragEnded() override;
|
||||
void AccessibilityEventReceived(
|
||||
const std::vector<content::AXEventNotificationDetails>& eventData)
|
||||
override;
|
||||
const content::AXEventNotificationDetails& eventData) override;
|
||||
void AccessibilityLocationChangesReceived(
|
||||
const std::vector<content::AXLocationChangeNotificationDetails>& locData)
|
||||
override;
|
||||
|
@@ -80,6 +80,7 @@ struct PopulateAxNodeAttributes {
|
||||
case ax::mojom::IntAttribute::kScrollY:
|
||||
case ax::mojom::IntAttribute::kScrollYMin:
|
||||
case ax::mojom::IntAttribute::kScrollYMax:
|
||||
case ax::mojom::IntAttribute::kHasPopup:
|
||||
case ax::mojom::IntAttribute::kHierarchicalLevel:
|
||||
case ax::mojom::IntAttribute::kTextSelStart:
|
||||
case ax::mojom::IntAttribute::kTextSelEnd:
|
||||
@@ -169,6 +170,12 @@ struct PopulateAxNodeAttributes {
|
||||
attributes->SetString(ToString(attr.first), ToString(state));
|
||||
}
|
||||
} break;
|
||||
case ax::mojom::IntAttribute::kTextPosition: {
|
||||
auto state = static_cast<ax::mojom::TextPosition>(attr.second);
|
||||
if (ax::mojom::TextPosition::kNone != state) {
|
||||
attributes->SetString(ToString(attr.first), ToString(state));
|
||||
}
|
||||
} break;
|
||||
case ax::mojom::IntAttribute::kTextStyle: {
|
||||
auto text_style = static_cast<ax::mojom::TextStyle>(attr.second);
|
||||
if (text_style == ax::mojom::TextStyle::kNone)
|
||||
@@ -373,24 +380,53 @@ CefRefPtr<CefDictionaryValue> ToCefValue(const ui::AXTreeUpdate& update) {
|
||||
return value;
|
||||
}
|
||||
|
||||
// Converts AXEvent to CefDictionaryValue.
|
||||
CefRefPtr<CefDictionaryValue> ToCefValue(const ui::AXEvent& event) {
|
||||
CefRefPtr<CefDictionaryValue> value = CefDictionaryValue::Create();
|
||||
|
||||
if (event.event_type != ax::mojom::Event::kNone)
|
||||
value->SetString("event_type", ToString(event.event_type));
|
||||
|
||||
if (event.id != -1)
|
||||
value->SetInt("id", event.id);
|
||||
|
||||
if (event.event_from != ax::mojom::EventFrom::kNone)
|
||||
value->SetString("event_from", ToString(event.event_from));
|
||||
|
||||
if (event.action_request_id != -1)
|
||||
value->SetInt("action_request_id", event.action_request_id);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
// Convert AXEventNotificationDetails to CefDictionaryValue.
|
||||
CefRefPtr<CefDictionaryValue> ToCefValue(
|
||||
const content::AXEventNotificationDetails& eventData) {
|
||||
CefRefPtr<CefDictionaryValue> value = CefDictionaryValue::Create();
|
||||
|
||||
if (eventData.id != -1)
|
||||
value->SetInt("id", eventData.id);
|
||||
|
||||
if (eventData.ax_tree_id != -1)
|
||||
value->SetInt("ax_tree_id", eventData.ax_tree_id);
|
||||
|
||||
if (eventData.event_type != ax::mojom::Event::kNone)
|
||||
value->SetString("event_type", ToString(eventData.event_type));
|
||||
if (eventData.updates.size() > 0) {
|
||||
CefRefPtr<CefListValue> updates = CefListValue::Create();
|
||||
updates->SetSize(eventData.updates.size());
|
||||
size_t i = 0;
|
||||
for (const auto& update : eventData.updates) {
|
||||
updates->SetDictionary(i++, ToCefValue(update));
|
||||
}
|
||||
value->SetList("updates", updates);
|
||||
}
|
||||
|
||||
if (eventData.event_from != ax::mojom::EventFrom::kNone)
|
||||
value->SetString("event_from", ToString(eventData.event_from));
|
||||
if (eventData.events.size() > 0) {
|
||||
CefRefPtr<CefListValue> events = CefListValue::Create();
|
||||
events->SetSize(eventData.events.size());
|
||||
size_t i = 0;
|
||||
for (const auto& event : eventData.events) {
|
||||
events->SetDictionary(i++, ToCefValue(event));
|
||||
}
|
||||
value->SetList("events", events);
|
||||
}
|
||||
|
||||
value->SetDictionary("update", ToCefValue(eventData.update));
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -412,7 +448,7 @@ CefRefPtr<CefDictionaryValue> ToCefValue(const ui::AXRelativeBounds& location) {
|
||||
return value;
|
||||
}
|
||||
|
||||
// Convert AXEventNotificationDetails to CefDictionaryValue.
|
||||
// Convert AXLocationChangeNotificationDetails to CefDictionaryValue.
|
||||
CefRefPtr<CefDictionaryValue> ToCefValue(
|
||||
const content::AXLocationChangeNotificationDetails& locData) {
|
||||
CefRefPtr<CefDictionaryValue> value = CefDictionaryValue::Create();
|
||||
@@ -443,9 +479,9 @@ CefRefPtr<CefListValue> ToCefValue(const std::vector<T>& vecData) {
|
||||
namespace osr_accessibility_util {
|
||||
|
||||
CefRefPtr<CefValue> ParseAccessibilityEventData(
|
||||
const std::vector<content::AXEventNotificationDetails>& data) {
|
||||
const content::AXEventNotificationDetails& data) {
|
||||
CefRefPtr<CefValue> value = CefValue::Create();
|
||||
value->SetList(ToCefValue(data));
|
||||
value->SetDictionary(ToCefValue(data));
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,7 @@ namespace osr_accessibility_util {
|
||||
// Convert Accessibility Event and location updates to CefValue, which may be
|
||||
// consumed or serialized with CefJSONWrite.
|
||||
CefRefPtr<CefValue> ParseAccessibilityEventData(
|
||||
const std::vector<content::AXEventNotificationDetails>& data);
|
||||
const content::AXEventNotificationDetails& data);
|
||||
|
||||
CefRefPtr<CefValue> ParseAccessibilityLocationData(
|
||||
const std::vector<content::AXLocationChangeNotificationDetails>& data);
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include "content/browser/bad_message.h"
|
||||
#include "content/browser/compositor/image_transport_factory.h"
|
||||
#include "content/browser/frame_host/render_widget_host_view_guest.h"
|
||||
#include "content/browser/renderer_host/cursor_manager.h"
|
||||
#include "content/browser/renderer_host/dip_util.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_delegate.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||
@@ -223,6 +224,7 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||
is_showing_(!render_widget_host_->is_hidden()),
|
||||
is_destroyed_(false),
|
||||
is_scroll_offset_changed_pending_(false),
|
||||
mouse_wheel_phase_handler_(this),
|
||||
weak_ptr_factory_(this) {
|
||||
DCHECK(render_widget_host_);
|
||||
DCHECK(!render_widget_host_->GetView());
|
||||
@@ -238,16 +240,12 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||
content::RenderViewHost::From(render_widget_host_));
|
||||
}
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
local_surface_id_ = local_surface_id_allocator_.GenerateId();
|
||||
|
||||
// Surface synchronization is not supported with OSR.
|
||||
DCHECK(!features::IsSurfaceSynchronizationEnabled());
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
// Matching the attributes from BrowserCompositorMac.
|
||||
delegated_frame_host_ = std::make_unique<content::DelegatedFrameHost>(
|
||||
AllocateFrameSinkId(is_guest_view_hack), this,
|
||||
features::IsSurfaceSynchronizationEnabled(),
|
||||
base::FeatureList::IsEnabled(features::kVizDisplayCompositor),
|
||||
true /* should_register_frame_sink_id */);
|
||||
|
||||
@@ -279,7 +277,9 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||
#endif
|
||||
|
||||
if (browser_impl_.get())
|
||||
ResizeRootLayer();
|
||||
ResizeRootLayer(false);
|
||||
|
||||
cursor_manager_.reset(new content::CursorManager(this));
|
||||
|
||||
// Do this last because it may result in a call to SetNeedsBeginFrames.
|
||||
render_widget_host_->SetView(this);
|
||||
@@ -329,7 +329,7 @@ void CefRenderWidgetHostViewOSR::InitAsChild(gfx::NativeView parent_view) {
|
||||
// The parent view should not render while the full-screen view exists.
|
||||
parent_host_view_->Hide();
|
||||
|
||||
ResizeRootLayer();
|
||||
ResizeRootLayer(false);
|
||||
Show();
|
||||
}
|
||||
|
||||
@@ -366,14 +366,14 @@ void CefRenderWidgetHostViewOSR::Show() {
|
||||
browser_compositor_->SetRenderWidgetHostIsHidden(false);
|
||||
#else
|
||||
delegated_frame_host_->SetCompositor(compositor_.get());
|
||||
delegated_frame_host_->WasShown(
|
||||
GetLocalSurfaceId(), GetRootLayer()->bounds().size(), ui::LatencyInfo());
|
||||
delegated_frame_host_->WasShown(GetLocalSurfaceId(),
|
||||
GetRootLayer()->bounds().size(), false);
|
||||
#endif
|
||||
|
||||
// Note that |render_widget_host_| will retrieve size parameters from the
|
||||
// DelegatedFrameHost, so it must have WasShown called after.
|
||||
if (render_widget_host_)
|
||||
render_widget_host_->WasShown(ui::LatencyInfo());
|
||||
render_widget_host_->WasShown(false);
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::Hide() {
|
||||
@@ -400,6 +400,11 @@ bool CefRenderWidgetHostViewOSR::IsShowing() {
|
||||
return is_showing_;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::EnsureSurfaceSynchronizedForLayoutTest() {
|
||||
++latest_capture_sequence_number_;
|
||||
SynchronizeVisualProperties();
|
||||
}
|
||||
|
||||
gfx::Rect CefRenderWidgetHostViewOSR::GetViewBounds() const {
|
||||
if (IsPopupWidget())
|
||||
return popup_position_;
|
||||
@@ -428,10 +433,14 @@ void CefRenderWidgetHostViewOSR::SetBackgroundColor(SkColor color) {
|
||||
}
|
||||
}
|
||||
|
||||
SkColor CefRenderWidgetHostViewOSR::background_color() const {
|
||||
base::Optional<SkColor> CefRenderWidgetHostViewOSR::GetBackgroundColor() const {
|
||||
return background_color_;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::UpdateBackgroundColor() {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::LockMouse() {
|
||||
return false;
|
||||
}
|
||||
@@ -446,7 +455,7 @@ void CefRenderWidgetHostViewOSR::TakeFallbackContentFrom(
|
||||
->IsRenderWidgetHostViewGuest());
|
||||
CefRenderWidgetHostViewOSR* view_cef =
|
||||
static_cast<CefRenderWidgetHostViewOSR*>(view);
|
||||
SetBackgroundColor(view_cef->background_color());
|
||||
SetBackgroundColor(view_cef->background_color_);
|
||||
if (GetDelegatedFrameHost() && view_cef->GetDelegatedFrameHost()) {
|
||||
GetDelegatedFrameHost()->TakeFallbackContentFrom(
|
||||
view_cef->GetDelegatedFrameHost());
|
||||
@@ -466,7 +475,7 @@ void CefRenderWidgetHostViewOSR::DidCreateNewRendererCompositorFrameSink(
|
||||
void CefRenderWidgetHostViewOSR::SubmitCompositorFrame(
|
||||
const viz::LocalSurfaceId& local_surface_id,
|
||||
viz::CompositorFrame frame,
|
||||
viz::mojom::HitTestRegionListPtr hit_test_region_list) {
|
||||
base::Optional<viz::HitTestRegionList> hit_test_region_list) {
|
||||
TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::OnSwapCompositorFrame");
|
||||
|
||||
if (frame.metadata.root_scroll_offset != last_scroll_offset_) {
|
||||
@@ -554,7 +563,7 @@ void CefRenderWidgetHostViewOSR::InitAsPopup(
|
||||
if (handler.get())
|
||||
handler->OnPopupSize(browser_impl_.get(), widget_pos);
|
||||
|
||||
ResizeRootLayer();
|
||||
ResizeRootLayer(false);
|
||||
Show();
|
||||
}
|
||||
|
||||
@@ -627,6 +636,10 @@ void CefRenderWidgetHostViewOSR::UpdateCursor(
|
||||
#endif
|
||||
}
|
||||
|
||||
content::CursorManager* CefRenderWidgetHostViewOSR::GetCursorManager() {
|
||||
return cursor_manager_.get();
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SetIsLoading(bool is_loading) {}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::RenderProcessGone(
|
||||
@@ -674,15 +687,15 @@ void CefRenderWidgetHostViewOSR::SetTooltipText(
|
||||
}
|
||||
}
|
||||
|
||||
gfx::Size CefRenderWidgetHostViewOSR::GetRequestedRendererSize() const {
|
||||
return GetDelegatedFrameHost()->GetRequestedRendererSize();
|
||||
}
|
||||
|
||||
gfx::Size CefRenderWidgetHostViewOSR::GetCompositorViewportPixelSize() const {
|
||||
return gfx::ScaleToCeiledSize(GetRequestedRendererSize(),
|
||||
current_device_scale_factor_);
|
||||
}
|
||||
|
||||
uint32_t CefRenderWidgetHostViewOSR::GetCaptureSequenceNumber() const {
|
||||
return latest_capture_sequence_number_;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::CopyFromSurface(
|
||||
const gfx::Rect& src_rect,
|
||||
const gfx::Size& output_size,
|
||||
@@ -725,9 +738,8 @@ void CefRenderWidgetHostViewOSR::GetScreenInfo(
|
||||
*results = ScreenInfoFrom(screen_info);
|
||||
}
|
||||
|
||||
gfx::Vector2d CefRenderWidgetHostViewOSR::GetOffsetFromRootSurface() {
|
||||
return gfx::Vector2d();
|
||||
}
|
||||
void CefRenderWidgetHostViewOSR::TransformPointToRootSurface(
|
||||
gfx::PointF* point) {}
|
||||
|
||||
gfx::Rect CefRenderWidgetHostViewOSR::GetBoundsInRootWindow() {
|
||||
if (!browser_impl_.get())
|
||||
@@ -850,6 +862,17 @@ void CefRenderWidgetHostViewOSR::SelectionChanged(const base::string16& text,
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
const viz::LocalSurfaceId& CefRenderWidgetHostViewOSR::GetLocalSurfaceId()
|
||||
const {
|
||||
return local_surface_id_;
|
||||
}
|
||||
#endif
|
||||
|
||||
const viz::FrameSinkId& CefRenderWidgetHostViewOSR::GetFrameSinkId() const {
|
||||
return GetDelegatedFrameHost()->frame_sink_id();
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SetNeedsBeginFrames(bool enabled) {
|
||||
SetFrameRate();
|
||||
|
||||
@@ -869,7 +892,7 @@ void CefRenderWidgetHostViewOSR::SetWantsAnimateOnlyBeginFrames() {
|
||||
}
|
||||
}
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::TransformPointToLocalCoordSpace(
|
||||
bool CefRenderWidgetHostViewOSR::TransformPointToLocalCoordSpaceLegacy(
|
||||
const gfx::PointF& point,
|
||||
const viz::SurfaceId& original_surface,
|
||||
gfx::PointF* transformed_point) {
|
||||
@@ -877,7 +900,7 @@ bool CefRenderWidgetHostViewOSR::TransformPointToLocalCoordSpace(
|
||||
// is necessary.
|
||||
gfx::PointF point_in_pixels =
|
||||
gfx::ConvertPointToPixel(current_device_scale_factor_, point);
|
||||
if (!GetDelegatedFrameHost()->TransformPointToLocalCoordSpace(
|
||||
if (!GetDelegatedFrameHost()->TransformPointToLocalCoordSpaceLegacy(
|
||||
point_in_pixels, original_surface, transformed_point)) {
|
||||
return false;
|
||||
}
|
||||
@@ -890,7 +913,8 @@ bool CefRenderWidgetHostViewOSR::TransformPointToLocalCoordSpace(
|
||||
bool CefRenderWidgetHostViewOSR::TransformPointToCoordSpaceForView(
|
||||
const gfx::PointF& point,
|
||||
RenderWidgetHostViewBase* target_view,
|
||||
gfx::PointF* transformed_point) {
|
||||
gfx::PointF* transformed_point,
|
||||
viz::EventSource source) {
|
||||
if (target_view == this) {
|
||||
*transformed_point = point;
|
||||
return true;
|
||||
@@ -900,14 +924,16 @@ bool CefRenderWidgetHostViewOSR::TransformPointToCoordSpaceForView(
|
||||
// but it is not necessary here because the final target view is responsible
|
||||
// for converting before computing the final transform.
|
||||
return GetDelegatedFrameHost()->TransformPointToCoordSpaceForView(
|
||||
point, target_view, transformed_point);
|
||||
point, target_view, transformed_point, source);
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::DidNavigate() {
|
||||
// With surface synchronization enabled we need to force synchronization on
|
||||
// first navigation.
|
||||
ResizeRootLayer(true);
|
||||
#if defined(OS_MACOSX)
|
||||
browser_compositor_->DidNavigate();
|
||||
#else
|
||||
ResizeRootLayer();
|
||||
if (delegated_frame_host_)
|
||||
delegated_frame_host_->DidNavigate();
|
||||
#endif
|
||||
@@ -920,7 +946,7 @@ CefRenderWidgetHostViewOSR::CreateSoftwareOutputDevice(
|
||||
DCHECK(!copy_frame_generator_);
|
||||
DCHECK(!software_output_device_);
|
||||
software_output_device_ = new CefSoftwareOutputDeviceOSR(
|
||||
compositor, background_color() == SK_ColorTRANSPARENT,
|
||||
compositor, background_color_ == SK_ColorTRANSPARENT,
|
||||
base::Bind(&CefRenderWidgetHostViewOSR::OnPaint,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
return base::WrapUnique(software_output_device_);
|
||||
@@ -947,22 +973,6 @@ SkColor CefRenderWidgetHostViewOSR::DelegatedFrameHostGetGutterColor() const {
|
||||
return background_color_;
|
||||
}
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::DelegatedFrameCanCreateResizeLock() const {
|
||||
return !render_widget_host_->auto_resize_enabled();
|
||||
}
|
||||
|
||||
std::unique_ptr<content::CompositorResizeLock>
|
||||
CefRenderWidgetHostViewOSR::DelegatedFrameHostCreateResizeLock() {
|
||||
HoldResize();
|
||||
|
||||
const gfx::Size& desired_size = GetRootLayer()->bounds().size();
|
||||
return std::make_unique<content::CompositorResizeLock>(this, desired_size);
|
||||
}
|
||||
|
||||
viz::LocalSurfaceId CefRenderWidgetHostViewOSR::GetLocalSurfaceId() const {
|
||||
return local_surface_id_;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::OnFirstSurfaceActivation(
|
||||
const viz::SurfaceInfo& surface_info) {}
|
||||
|
||||
@@ -972,10 +982,6 @@ void CefRenderWidgetHostViewOSR::OnBeginFrame(base::TimeTicks frame_time) {
|
||||
// See https://codereview.chromium.org/1841083007.
|
||||
}
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::IsAutoResizeEnabled() const {
|
||||
return render_widget_host_->auto_resize_enabled();
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::OnFrameTokenChanged(uint32_t frame_token) {
|
||||
render_widget_host_->DidProcessFrame(frame_token);
|
||||
}
|
||||
@@ -984,39 +990,29 @@ void CefRenderWidgetHostViewOSR::DidReceiveFirstFrameAfterNavigation() {
|
||||
render_widget_host_->DidReceiveFirstFrameAfterNavigation();
|
||||
}
|
||||
|
||||
std::unique_ptr<ui::CompositorLock>
|
||||
CefRenderWidgetHostViewOSR::GetCompositorLock(
|
||||
ui::CompositorLockClient* client) {
|
||||
return GetCompositor()->GetCompositorLock(client);
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::CompositorResizeLockEnded() {
|
||||
ReleaseResize();
|
||||
}
|
||||
|
||||
#endif // !defined(OS_MACOSX)
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::InstallTransparency() {
|
||||
if (background_color() == SK_ColorTRANSPARENT) {
|
||||
SetBackgroundColor(background_color());
|
||||
if (background_color_ == SK_ColorTRANSPARENT) {
|
||||
SetBackgroundColor(background_color_);
|
||||
#if defined(OS_MACOSX)
|
||||
browser_compositor_->SetBackgroundColor(background_color());
|
||||
browser_compositor_->SetBackgroundColor(background_color_);
|
||||
#else
|
||||
compositor_->SetBackgroundColor(background_color());
|
||||
compositor_->SetBackgroundColor(background_color_);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::WasResized() {
|
||||
void CefRenderWidgetHostViewOSR::SynchronizeVisualProperties() {
|
||||
if (hold_resize_) {
|
||||
if (!pending_resize_)
|
||||
pending_resize_ = true;
|
||||
return;
|
||||
}
|
||||
|
||||
ResizeRootLayer();
|
||||
ResizeRootLayer(false);
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::OnScreenInfoChanged() {
|
||||
@@ -1134,21 +1130,32 @@ void CefRenderWidgetHostViewOSR::SendMouseEvent(
|
||||
void CefRenderWidgetHostViewOSR::SendMouseWheelEvent(
|
||||
const blink::WebMouseWheelEvent& event) {
|
||||
TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::SendMouseWheelEvent");
|
||||
|
||||
blink::WebMouseWheelEvent mouse_wheel_event(event);
|
||||
|
||||
mouse_wheel_phase_handler_.SendWheelEndForTouchpadScrollingIfNeeded();
|
||||
mouse_wheel_phase_handler_.AddPhaseIfNeededAndScheduleEndEvent(
|
||||
mouse_wheel_event, false);
|
||||
|
||||
if (!IsPopupWidget()) {
|
||||
if (browser_impl_.get())
|
||||
browser_impl_->CancelContextMenu();
|
||||
|
||||
if (popup_host_view_) {
|
||||
if (popup_host_view_->popup_position_.Contains(
|
||||
event.PositionInWidget().x, event.PositionInWidget().y)) {
|
||||
blink::WebMouseWheelEvent popup_event(event);
|
||||
popup_event.SetPositionInWidget(
|
||||
event.PositionInWidget().x - popup_host_view_->popup_position_.x(),
|
||||
event.PositionInWidget().y - popup_host_view_->popup_position_.y());
|
||||
popup_event.SetPositionInScreen(popup_event.PositionInWidget().x,
|
||||
popup_event.PositionInWidget().y);
|
||||
mouse_wheel_event.PositionInWidget().x,
|
||||
mouse_wheel_event.PositionInWidget().y)) {
|
||||
blink::WebMouseWheelEvent popup_mouse_wheel_event(mouse_wheel_event);
|
||||
popup_mouse_wheel_event.SetPositionInWidget(
|
||||
mouse_wheel_event.PositionInWidget().x -
|
||||
popup_host_view_->popup_position_.x(),
|
||||
mouse_wheel_event.PositionInWidget().y -
|
||||
popup_host_view_->popup_position_.y());
|
||||
popup_mouse_wheel_event.SetPositionInScreen(
|
||||
popup_mouse_wheel_event.PositionInWidget().x,
|
||||
popup_mouse_wheel_event.PositionInWidget().y);
|
||||
|
||||
popup_host_view_->SendMouseWheelEvent(popup_event);
|
||||
popup_host_view_->SendMouseWheelEvent(popup_mouse_wheel_event);
|
||||
return;
|
||||
} else {
|
||||
// Scrolling outside of the popup widget so destroy it.
|
||||
@@ -1167,16 +1174,17 @@ void CefRenderWidgetHostViewOSR::SendMouseWheelEvent(
|
||||
}
|
||||
const gfx::Rect& guest_bounds =
|
||||
guest_host_view->render_widget_host_->GetView()->GetViewBounds();
|
||||
if (guest_bounds.Contains(event.PositionInWidget().x,
|
||||
event.PositionInWidget().y)) {
|
||||
blink::WebMouseWheelEvent guest_event(event);
|
||||
guest_event.SetPositionInWidget(
|
||||
event.PositionInWidget().x - guest_bounds.x(),
|
||||
event.PositionInWidget().y - guest_bounds.y());
|
||||
guest_event.SetPositionInScreen(guest_event.PositionInWidget().x,
|
||||
guest_event.PositionInWidget().y);
|
||||
if (guest_bounds.Contains(mouse_wheel_event.PositionInWidget().x,
|
||||
mouse_wheel_event.PositionInWidget().y)) {
|
||||
blink::WebMouseWheelEvent guest_mouse_wheel_event(mouse_wheel_event);
|
||||
guest_mouse_wheel_event.SetPositionInWidget(
|
||||
mouse_wheel_event.PositionInWidget().x - guest_bounds.x(),
|
||||
mouse_wheel_event.PositionInWidget().y - guest_bounds.y());
|
||||
guest_mouse_wheel_event.SetPositionInScreen(
|
||||
guest_mouse_wheel_event.PositionInWidget().x,
|
||||
guest_mouse_wheel_event.PositionInWidget().y);
|
||||
|
||||
guest_host_view->SendMouseWheelEvent(guest_event);
|
||||
guest_host_view->SendMouseWheelEvent(guest_mouse_wheel_event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1186,7 +1194,7 @@ void CefRenderWidgetHostViewOSR::SendMouseWheelEvent(
|
||||
if (render_widget_host_ && render_widget_host_->GetView()) {
|
||||
// Direct routing requires that mouse events go directly to the View.
|
||||
render_widget_host_->GetView()->ProcessMouseWheelEvent(
|
||||
event, ui::LatencyInfo(ui::SourceEventType::WHEEL));
|
||||
mouse_wheel_event, ui::LatencyInfo(ui::SourceEventType::WHEEL));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1229,8 +1237,10 @@ void CefRenderWidgetHostViewOSR::ReleaseResize() {
|
||||
hold_resize_ = false;
|
||||
if (pending_resize_) {
|
||||
pending_resize_ = false;
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefRenderWidgetHostViewOSR::WasResized,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::Bind(&CefRenderWidgetHostViewOSR::SynchronizeVisualProperties,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1245,7 +1255,8 @@ void CefRenderWidgetHostViewOSR::OnPaint(const gfx::Rect& damage_rect,
|
||||
if (!handler.get())
|
||||
return;
|
||||
|
||||
// Don't execute WasResized while the OnPaint callback is pending.
|
||||
// Don't execute SynchronizeVisualProperties while the OnPaint callback is
|
||||
// pending.
|
||||
HoldResize();
|
||||
|
||||
gfx::Rect rect_in_bitmap(0, 0, bitmap_width, bitmap_height);
|
||||
@@ -1343,7 +1354,7 @@ void CefRenderWidgetHostViewOSR::SetDeviceScaleFactor() {
|
||||
}
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::ResizeRootLayer() {
|
||||
void CefRenderWidgetHostViewOSR::ResizeRootLayer(bool force) {
|
||||
SetFrameRate();
|
||||
|
||||
const float orgScaleFactor = current_device_scale_factor_;
|
||||
@@ -1357,33 +1368,37 @@ void CefRenderWidgetHostViewOSR::ResizeRootLayer() {
|
||||
else
|
||||
size = popup_position_.size();
|
||||
|
||||
if (!scaleFactorDidChange && size == GetRootLayer()->bounds().size())
|
||||
if (!force && !scaleFactorDidChange &&
|
||||
size == GetRootLayer()->bounds().size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
GetRootLayer()->SetBounds(gfx::Rect(size));
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
bool resized = UpdateNSViewAndDisplay();
|
||||
#else
|
||||
const gfx::Size& size_in_pixels =
|
||||
gfx::ConvertSizeToPixel(current_device_scale_factor_, size);
|
||||
|
||||
local_surface_id_ = local_surface_id_allocator_.GenerateId();
|
||||
|
||||
GetRootLayer()->SetBounds(gfx::Rect(size));
|
||||
if (GetCompositor()) {
|
||||
GetCompositor()->SetScaleAndSize(current_device_scale_factor_,
|
||||
size_in_pixels, local_surface_id_);
|
||||
}
|
||||
PlatformResizeCompositorWidget(size_in_pixels);
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
bool resized = UpdateNSViewAndDisplay();
|
||||
#else
|
||||
bool resized = true;
|
||||
GetDelegatedFrameHost()->WasResized(local_surface_id_, size,
|
||||
cc::DeadlinePolicy::UseDefaultDeadline());
|
||||
#endif
|
||||
GetDelegatedFrameHost()->EmbedSurface(
|
||||
local_surface_id_, size, cc::DeadlinePolicy::UseDefaultDeadline());
|
||||
#endif // !defined(OS_MACOSX)
|
||||
|
||||
// Note that |render_widget_host_| will retrieve resize parameters from the
|
||||
// DelegatedFrameHost, so it must have WasResized called after.
|
||||
// DelegatedFrameHost, so it must have SynchronizeVisualProperties called
|
||||
// after.
|
||||
if (resized && render_widget_host_)
|
||||
render_widget_host_->WasResized();
|
||||
render_widget_host_->SynchronizeVisualProperties();
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::OnBeginFrameTimerTick() {
|
||||
@@ -1554,7 +1569,7 @@ viz::FrameSinkId CefRenderWidgetHostViewOSR::AllocateFrameSinkId(
|
||||
|
||||
void CefRenderWidgetHostViewOSR::UpdateBackgroundColorFromRenderer(
|
||||
SkColor color) {
|
||||
if (color == background_color())
|
||||
if (color == background_color_)
|
||||
return;
|
||||
background_color_ = color;
|
||||
|
||||
|
@@ -17,8 +17,8 @@
|
||||
#include "build/build_config.h"
|
||||
#include "components/viz/common/frame_sinks/begin_frame_source.h"
|
||||
#include "components/viz/common/surfaces/parent_local_surface_id_allocator.h"
|
||||
#include "content/browser/renderer_host/compositor_resize_lock.h"
|
||||
#include "content/browser/renderer_host/delegated_frame_host.h"
|
||||
#include "content/browser/renderer_host/input/mouse_wheel_phase_handler.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_view_base.h"
|
||||
#include "ui/compositor/compositor.h"
|
||||
|
||||
@@ -39,6 +39,7 @@ class RenderWidgetHost;
|
||||
class RenderWidgetHostImpl;
|
||||
class RenderWidgetHostViewGuest;
|
||||
class BackingStore;
|
||||
class CursorManager;
|
||||
} // namespace content
|
||||
|
||||
class CefBeginFrameTimer;
|
||||
@@ -87,8 +88,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
public ui::CompositorDelegate
|
||||
#if !defined(OS_MACOSX)
|
||||
,
|
||||
public content::DelegatedFrameHostClient,
|
||||
public content::CompositorResizeLockClient
|
||||
public content::DelegatedFrameHostClient
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
@@ -106,13 +106,16 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
gfx::NativeViewAccessible GetNativeViewAccessible() override;
|
||||
void Focus() override;
|
||||
bool HasFocus() const override;
|
||||
uint32_t GetCaptureSequenceNumber() const override;
|
||||
bool IsSurfaceAvailableForCopy() const override;
|
||||
void Show() override;
|
||||
void Hide() override;
|
||||
bool IsShowing() override;
|
||||
void EnsureSurfaceSynchronizedForLayoutTest() override;
|
||||
gfx::Rect GetViewBounds() const override;
|
||||
void SetBackgroundColor(SkColor color) override;
|
||||
SkColor background_color() const override;
|
||||
base::Optional<SkColor> GetBackgroundColor() const override;
|
||||
void UpdateBackgroundColor() override;
|
||||
bool LockMouse() override;
|
||||
void UnlockMouse() override;
|
||||
void TakeFallbackContentFrom(content::RenderWidgetHostView* view) override;
|
||||
@@ -131,7 +134,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
void SubmitCompositorFrame(
|
||||
const viz::LocalSurfaceId& local_surface_id,
|
||||
viz::CompositorFrame frame,
|
||||
viz::mojom::HitTestRegionListPtr hit_test_region_list) override;
|
||||
base::Optional<viz::HitTestRegionList> hit_test_region_list) override;
|
||||
void ClearCompositorFrame() override;
|
||||
void InitAsPopup(content::RenderWidgetHostView* parent_host_view,
|
||||
const gfx::Rect& pos) override;
|
||||
@@ -145,16 +148,20 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
int error_code) override;
|
||||
void Destroy() override;
|
||||
void SetTooltipText(const base::string16& tooltip_text) override;
|
||||
content::CursorManager* GetCursorManager() override;
|
||||
|
||||
gfx::Size GetRequestedRendererSize() const override;
|
||||
gfx::Size GetCompositorViewportPixelSize() const override;
|
||||
void CopyFromSurface(
|
||||
const gfx::Rect& src_rect,
|
||||
const gfx::Size& output_size,
|
||||
base::OnceCallback<void(const SkBitmap&)> callback) override;
|
||||
void GetScreenInfo(content::ScreenInfo* results) const override;
|
||||
gfx::Vector2d GetOffsetFromRootSurface() override;
|
||||
void TransformPointToRootSurface(gfx::PointF* point) override;
|
||||
gfx::Rect GetBoundsInRootWindow() override;
|
||||
#if defined(OS_MACOSX)
|
||||
viz::ScopedSurfaceIdAllocator DidUpdateVisualProperties(
|
||||
const cc::RenderFrameMetadata& metadata) override;
|
||||
#endif
|
||||
viz::SurfaceId GetCurrentSurfaceId() const override;
|
||||
content::BrowserAccessibilityManager* CreateBrowserAccessibilityManager(
|
||||
content::BrowserAccessibilityDelegate* delegate,
|
||||
@@ -171,19 +178,24 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
void SetNeedsBeginFrames(bool enabled) override;
|
||||
void SetWantsAnimateOnlyBeginFrames() override;
|
||||
|
||||
bool TransformPointToLocalCoordSpace(const gfx::PointF& point,
|
||||
const viz::SurfaceId& original_surface,
|
||||
gfx::PointF* transformed_point) override;
|
||||
bool TransformPointToLocalCoordSpaceLegacy(
|
||||
const gfx::PointF& point,
|
||||
const viz::SurfaceId& original_surface,
|
||||
gfx::PointF* transformed_point) override;
|
||||
bool TransformPointToCoordSpaceForView(
|
||||
const gfx::PointF& point,
|
||||
RenderWidgetHostViewBase* target_view,
|
||||
gfx::PointF* transformed_point) override;
|
||||
gfx::PointF* transformed_point,
|
||||
viz::EventSource source = viz::EventSource::ANY) override;
|
||||
void DidNavigate() override;
|
||||
|
||||
void SelectionChanged(const base::string16& text,
|
||||
size_t offset,
|
||||
const gfx::Range& range) override;
|
||||
|
||||
const viz::LocalSurfaceId& GetLocalSurfaceId() const override;
|
||||
const viz::FrameSinkId& GetFrameSinkId() const override;
|
||||
|
||||
// ui::CompositorDelegate implementation.
|
||||
std::unique_ptr<viz::SoftwareOutputDevice> CreateSoftwareOutputDevice(
|
||||
ui::Compositor* compositor) override;
|
||||
@@ -193,25 +205,15 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
ui::Layer* DelegatedFrameHostGetLayer() const override;
|
||||
bool DelegatedFrameHostIsVisible() const override;
|
||||
SkColor DelegatedFrameHostGetGutterColor() const override;
|
||||
bool DelegatedFrameCanCreateResizeLock() const override;
|
||||
std::unique_ptr<content::CompositorResizeLock>
|
||||
DelegatedFrameHostCreateResizeLock() override;
|
||||
viz::LocalSurfaceId GetLocalSurfaceId() const override;
|
||||
void OnFirstSurfaceActivation(const viz::SurfaceInfo& surface_info) override;
|
||||
void OnBeginFrame(base::TimeTicks frame_time) override;
|
||||
bool IsAutoResizeEnabled() const override;
|
||||
void OnFrameTokenChanged(uint32_t frame_token) override;
|
||||
void DidReceiveFirstFrameAfterNavigation() override;
|
||||
|
||||
// CompositorResizeLockClient implementation.
|
||||
std::unique_ptr<ui::CompositorLock> GetCompositorLock(
|
||||
ui::CompositorLockClient* client) override;
|
||||
void CompositorResizeLockEnded() override;
|
||||
#endif // !defined(OS_MACOSX)
|
||||
|
||||
bool InstallTransparency();
|
||||
|
||||
void WasResized();
|
||||
void SynchronizeVisualProperties();
|
||||
void OnScreenInfoChanged();
|
||||
void Invalidate(CefBrowserHost::PaintElementType type);
|
||||
void SendKeyEvent(const content::NativeWebKeyboardEvent& event);
|
||||
@@ -238,7 +240,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
const CefRange& replacement_range,
|
||||
int relative_cursor_pos);
|
||||
void ImeFinishComposingText(bool keep_selection);
|
||||
void ImeCancelComposition();
|
||||
void ImeCancelComposition() override;
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser_impl() const { return browser_impl_; }
|
||||
void set_browser_impl(CefRefPtr<CefBrowserHostImpl> browser) {
|
||||
@@ -258,14 +260,18 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
}
|
||||
ui::Layer* GetRootLayer() const;
|
||||
|
||||
viz::LocalSurfaceId local_surface_id() const { return local_surface_id_; }
|
||||
#if defined(OS_MACOSX)
|
||||
content::BrowserCompositorMac* browser_compositor() const {
|
||||
return browser_compositor_.get();
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
content::DelegatedFrameHost* GetDelegatedFrameHost() const;
|
||||
|
||||
void SetFrameRate();
|
||||
void SetDeviceScaleFactor();
|
||||
void ResizeRootLayer();
|
||||
void ResizeRootLayer(bool force);
|
||||
|
||||
// Called by CefBeginFrameTimer to send a BeginFrame request.
|
||||
void OnBeginFrameTimerTick();
|
||||
@@ -297,12 +303,18 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
void UpdateBackgroundColorFromRenderer(SkColor color);
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
display::Display GetDisplay();
|
||||
void OnDidUpdateVisualPropertiesComplete(
|
||||
const cc::RenderFrameMetadata& metadata);
|
||||
|
||||
friend class MacHelper;
|
||||
bool UpdateNSViewAndDisplay();
|
||||
#endif // defined(OS_MACOSX)
|
||||
|
||||
void PlatformCreateCompositorWidget(bool is_guest_view_hack);
|
||||
#if !defined(OS_MACOSX)
|
||||
void PlatformResizeCompositorWidget(const gfx::Size& size);
|
||||
#endif
|
||||
void PlatformDestroyCompositorWidget();
|
||||
|
||||
#if defined(USE_AURA)
|
||||
@@ -319,10 +331,9 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
gfx::AcceleratedWidget compositor_widget_;
|
||||
std::unique_ptr<content::DelegatedFrameHost> delegated_frame_host_;
|
||||
std::unique_ptr<ui::Layer> root_layer_;
|
||||
#endif
|
||||
|
||||
viz::LocalSurfaceId local_surface_id_;
|
||||
viz::ParentLocalSurfaceIdAllocator local_surface_id_allocator_;
|
||||
#endif
|
||||
|
||||
#if defined(OS_WIN)
|
||||
std::unique_ptr<gfx::WindowImpl> window_;
|
||||
@@ -336,6 +347,8 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
std::unique_ptr<ui::XScopedCursor> invisible_cursor_;
|
||||
#endif
|
||||
|
||||
std::unique_ptr<content::CursorManager> cursor_manager_;
|
||||
|
||||
// Used to control the VSync rate in subprocesses when BeginFrame scheduling
|
||||
// is enabled.
|
||||
std::unique_ptr<CefBeginFrameTimer> begin_frame_timer_;
|
||||
@@ -375,9 +388,16 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
gfx::Vector2dF last_scroll_offset_;
|
||||
bool is_scroll_offset_changed_pending_;
|
||||
|
||||
content::MouseWheelPhaseHandler mouse_wheel_phase_handler_;
|
||||
|
||||
viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink_ =
|
||||
nullptr;
|
||||
|
||||
// Latest capture sequence number which is incremented when the caller
|
||||
// requests surfaces be synchronized via
|
||||
// EnsureSurfaceSynchronizedForLayoutTest().
|
||||
uint32_t latest_capture_sequence_number_ = 0u;
|
||||
|
||||
base::WeakPtrFactory<CefRenderWidgetHostViewOSR> weak_ptr_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefRenderWidgetHostViewOSR);
|
||||
|
@@ -19,15 +19,6 @@
|
||||
#include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
|
||||
#include "ui/display/screen.h"
|
||||
|
||||
namespace {
|
||||
|
||||
display::Display GetDisplay() {
|
||||
// TODO(cef): Get display info from callbacks.
|
||||
return display::Screen::GetScreen()->GetDisplayNearestView(nullptr);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
class MacHelper : public content::BrowserCompositorMacClient,
|
||||
public ui::AcceleratedWidgetMacNSView {
|
||||
public:
|
||||
@@ -44,7 +35,7 @@ class MacHelper : public content::BrowserCompositorMacClient,
|
||||
view_->render_widget_host()->delegate()->IsFullscreenForCurrentTab()) {
|
||||
return SK_ColorBLACK;
|
||||
}
|
||||
return view_->background_color();
|
||||
return *view_->GetBackgroundColor();
|
||||
}
|
||||
|
||||
void BrowserCompositorMacOnBeginFrame(base::TimeTicks frame_time) override {}
|
||||
@@ -53,30 +44,35 @@ class MacHelper : public content::BrowserCompositorMacClient,
|
||||
view_->render_widget_host()->DidProcessFrame(frame_token);
|
||||
}
|
||||
|
||||
// AcceleratedWidgetMacNSView methods:
|
||||
|
||||
NSView* AcceleratedWidgetGetNSView() const override {
|
||||
// Intentionally return nil so that BrowserCompositorMac::GetViewProperties
|
||||
// uses the layer size instead of the NSView size.
|
||||
return nil;
|
||||
}
|
||||
|
||||
void AcceleratedWidgetGetVSyncParameters(
|
||||
base::TimeTicks* timebase,
|
||||
base::TimeDelta* interval) const override {
|
||||
*timebase = base::TimeTicks();
|
||||
*interval = base::TimeDelta();
|
||||
}
|
||||
|
||||
void AcceleratedWidgetSwapCompleted() override {}
|
||||
|
||||
void DidReceiveFirstFrameAfterNavigation() override {
|
||||
view_->render_widget_host()->DidReceiveFirstFrameAfterNavigation();
|
||||
}
|
||||
|
||||
void DestroyCompositorForShutdown() override {}
|
||||
|
||||
void WasResized() override { view_->render_widget_host()->WasResized(); }
|
||||
bool SynchronizeVisualProperties(
|
||||
const base::Optional<viz::LocalSurfaceId>&
|
||||
child_allocated_local_surface_id) override {
|
||||
auto* browser_compositor = view_->browser_compositor();
|
||||
if (child_allocated_local_surface_id) {
|
||||
browser_compositor->UpdateRendererLocalSurfaceIdFromChild(
|
||||
*child_allocated_local_surface_id);
|
||||
} else {
|
||||
browser_compositor->AllocateNewRendererLocalSurfaceId();
|
||||
}
|
||||
|
||||
if (auto* host = browser_compositor->GetDelegatedFrameHost()) {
|
||||
host->EmbedSurface(browser_compositor->GetRendererLocalSurfaceId(),
|
||||
browser_compositor->GetRendererSize(),
|
||||
cc::DeadlinePolicy::UseDefaultDeadline());
|
||||
}
|
||||
|
||||
return view_->render_widget_host()->SynchronizeVisualProperties();
|
||||
}
|
||||
|
||||
// AcceleratedWidgetMacNSView methods:
|
||||
|
||||
void AcceleratedWidgetCALayerParamsUpdated() override {}
|
||||
|
||||
private:
|
||||
// Guaranteed to outlive this object.
|
||||
@@ -95,6 +91,51 @@ bool CefRenderWidgetHostViewOSR::ShouldContinueToPauseForFrame() {
|
||||
return browser_compositor_->ShouldContinueToPauseForFrame();
|
||||
}
|
||||
|
||||
viz::ScopedSurfaceIdAllocator
|
||||
CefRenderWidgetHostViewOSR::DidUpdateVisualProperties(
|
||||
const cc::RenderFrameMetadata& metadata) {
|
||||
base::OnceCallback<void()> allocation_task = base::BindOnce(
|
||||
base::IgnoreResult(
|
||||
&CefRenderWidgetHostViewOSR::OnDidUpdateVisualPropertiesComplete),
|
||||
weak_ptr_factory_.GetWeakPtr(), metadata);
|
||||
return browser_compositor_->GetScopedRendererSurfaceIdAllocator(
|
||||
std::move(allocation_task));
|
||||
}
|
||||
|
||||
display::Display CefRenderWidgetHostViewOSR::GetDisplay() {
|
||||
content::ScreenInfo screen_info;
|
||||
GetScreenInfo(&screen_info);
|
||||
|
||||
// Start with a reasonable display representation.
|
||||
display::Display display =
|
||||
display::Screen::GetScreen()->GetDisplayNearestView(nullptr);
|
||||
|
||||
// Populate attributes based on |screen_info|.
|
||||
display.set_bounds(screen_info.rect);
|
||||
display.set_work_area(screen_info.available_rect);
|
||||
display.set_device_scale_factor(screen_info.device_scale_factor);
|
||||
display.set_color_space(screen_info.color_space);
|
||||
display.set_color_depth(screen_info.depth);
|
||||
display.set_depth_per_component(screen_info.depth_per_component);
|
||||
display.set_is_monochrome(screen_info.is_monochrome);
|
||||
display.SetRotationAsDegree(screen_info.orientation_angle);
|
||||
|
||||
return display;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::OnDidUpdateVisualPropertiesComplete(
|
||||
const cc::RenderFrameMetadata& metadata) {
|
||||
DCHECK_EQ(current_device_scale_factor_, metadata.device_scale_factor);
|
||||
browser_compositor_->SynchronizeVisualProperties(
|
||||
metadata.device_scale_factor, metadata.viewport_size_in_pixels,
|
||||
metadata.local_surface_id.value_or(viz::LocalSurfaceId()));
|
||||
}
|
||||
|
||||
const viz::LocalSurfaceId& CefRenderWidgetHostViewOSR::GetLocalSurfaceId()
|
||||
const {
|
||||
return browser_compositor_->GetRendererLocalSurfaceId();
|
||||
}
|
||||
|
||||
ui::Compositor* CefRenderWidgetHostViewOSR::GetCompositor() const {
|
||||
return browser_compositor_->GetCompositor();
|
||||
}
|
||||
@@ -130,13 +171,10 @@ void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget(
|
||||
|
||||
mac_helper_ = new MacHelper(this);
|
||||
browser_compositor_.reset(new content::BrowserCompositorMac(
|
||||
mac_helper_, mac_helper_, render_widget_host_->is_hidden(), true,
|
||||
GetDisplay(), AllocateFrameSinkId(is_guest_view_hack)));
|
||||
mac_helper_, mac_helper_, render_widget_host_->is_hidden(), GetDisplay(),
|
||||
AllocateFrameSinkId(is_guest_view_hack)));
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget(
|
||||
const gfx::Size&) {}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() {
|
||||
DCHECK(window_);
|
||||
|
||||
|
@@ -26,10 +26,12 @@ class CefCompositorHostWin : public gfx::WindowImpl {
|
||||
~CefCompositorHostWin() override { DestroyWindow(hwnd()); }
|
||||
|
||||
private:
|
||||
CR_BEGIN_MSG_MAP_EX(CompositorHostWin)
|
||||
CR_BEGIN_MSG_MAP_EX(CefCompositorHostWin)
|
||||
CR_MSG_WM_PAINT(OnPaint)
|
||||
CR_END_MSG_MAP()
|
||||
|
||||
CR_MSG_MAP_CLASS_DECLARATIONS(CefCompositorHostWin)
|
||||
|
||||
void OnPaint(HDC dc) { ValidateRect(hwnd(), NULL); }
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefCompositorHostWin);
|
||||
|
@@ -135,8 +135,11 @@ void CefWebContentsViewOSR::RenderViewCreated(content::RenderViewHost* host) {
|
||||
view->InstallTransparency();
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::RenderViewSwappedIn(content::RenderViewHost* host) {
|
||||
}
|
||||
void CefWebContentsViewOSR::RenderViewReady() {}
|
||||
|
||||
void CefWebContentsViewOSR::RenderViewHostChanged(
|
||||
content::RenderViewHost* old_host,
|
||||
content::RenderViewHost* new_host) {}
|
||||
|
||||
void CefWebContentsViewOSR::SetOverscrollControllerEnabled(bool enabled) {}
|
||||
|
||||
|
@@ -51,7 +51,9 @@ class CefWebContentsViewOSR : public content::WebContentsView,
|
||||
content::RenderWidgetHost* render_widget_host) override;
|
||||
void SetPageTitle(const base::string16& title) override;
|
||||
void RenderViewCreated(content::RenderViewHost* host) override;
|
||||
void RenderViewSwappedIn(content::RenderViewHost* host) override;
|
||||
void RenderViewReady() override;
|
||||
void RenderViewHostChanged(content::RenderViewHost* old_host,
|
||||
content::RenderViewHost* new_host) override;
|
||||
void SetOverscrollControllerEnabled(bool enabled) override;
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
|
@@ -47,7 +47,7 @@ bool CefGetPath(PathKey key, CefString& path) {
|
||||
}
|
||||
|
||||
base::FilePath file_path;
|
||||
if (PathService::Get(pref_key, &file_path)) {
|
||||
if (base::PathService::Get(pref_key, &file_path)) {
|
||||
path = file_path.value();
|
||||
return true;
|
||||
}
|
||||
|
@@ -301,14 +301,12 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
|
||||
prefs::kEnableDoNotTrack, false,
|
||||
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
|
||||
|
||||
#if BUILDFLAG(ENABLE_WEBRTC)
|
||||
// TODO(guoweis): Remove next 2 options at M50.
|
||||
registry->RegisterBooleanPref(prefs::kWebRTCMultipleRoutesEnabled, true);
|
||||
registry->RegisterBooleanPref(prefs::kWebRTCNonProxiedUdpEnabled, true);
|
||||
registry->RegisterStringPref(prefs::kWebRTCIPHandlingPolicy,
|
||||
content::kWebRTCIPHandlingDefault);
|
||||
registry->RegisterStringPref(prefs::kWebRTCUDPPortRange, std::string());
|
||||
#endif
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
registry->RegisterBooleanPref(prefs::kFullscreenAllowed, true);
|
||||
|
@@ -176,8 +176,8 @@ void CefPrintDialogLinux::UseDefaultSettings() {
|
||||
UpdateSettings(&settings, true);
|
||||
}
|
||||
|
||||
bool CefPrintDialogLinux::UpdateSettings(printing::PrintSettings* settings) {
|
||||
return UpdateSettings(settings, false);
|
||||
void CefPrintDialogLinux::UpdateSettings(printing::PrintSettings* settings) {
|
||||
UpdateSettings(settings, false);
|
||||
}
|
||||
|
||||
void CefPrintDialogLinux::ShowDialog(
|
||||
|
@@ -42,7 +42,7 @@ class CefPrintDialogLinux : public printing::PrintDialogGtkInterface,
|
||||
|
||||
// PrintDialogGtkInterface implementation.
|
||||
void UseDefaultSettings() override;
|
||||
bool UpdateSettings(printing::PrintSettings* settings) override;
|
||||
void UpdateSettings(printing::PrintSettings* settings) override;
|
||||
void ShowDialog(
|
||||
gfx::NativeView parent_view,
|
||||
bool has_selection,
|
||||
|
@@ -50,7 +50,6 @@ void FillInDictionaryFromPdfPrintSettings(
|
||||
print_settings.SetBoolean(kSettingCollate, false);
|
||||
print_settings.SetString(kSettingDeviceName, "");
|
||||
print_settings.SetBoolean(kSettingRasterizePdf, false);
|
||||
print_settings.SetBoolean(kSettingGenerateDraftData, false);
|
||||
print_settings.SetBoolean(kSettingPreviewModifiable, false);
|
||||
print_settings.SetInteger(kSettingDpiHorizontal, 0);
|
||||
print_settings.SetInteger(kSettingDpiVertical, 0);
|
||||
@@ -260,7 +259,9 @@ void CefPrintViewManager::OnRequestPrintPreview(
|
||||
}
|
||||
|
||||
void CefPrintViewManager::OnMetafileReadyForPrinting(
|
||||
const PrintHostMsg_DidPreviewDocument_Params& params) {
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const PrintHostMsg_DidPreviewDocument_Params& params,
|
||||
const PrintHostMsg_PreviewIds& ids) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
StopWorker(params.document_cookie);
|
||||
|
||||
|
@@ -14,9 +14,10 @@
|
||||
namespace content {
|
||||
class RenderFrameHost;
|
||||
class RenderProcessHost;
|
||||
}
|
||||
} // namespace content
|
||||
|
||||
struct PrintHostMsg_DidPreviewDocument_Params;
|
||||
struct PrintHostMsg_PreviewIds;
|
||||
struct PrintHostMsg_RequestPrintPreview_Params;
|
||||
|
||||
namespace printing {
|
||||
@@ -52,7 +53,9 @@ class CefPrintViewManager
|
||||
void OnDidShowPrintDialog(content::RenderFrameHost* rfh);
|
||||
void OnRequestPrintPreview(const PrintHostMsg_RequestPrintPreview_Params&);
|
||||
void OnMetafileReadyForPrinting(
|
||||
const PrintHostMsg_DidPreviewDocument_Params&);
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const PrintHostMsg_DidPreviewDocument_Params& params,
|
||||
const PrintHostMsg_PreviewIds& ids);
|
||||
|
||||
void TerminatePdfPrintJob();
|
||||
|
||||
|
@@ -12,7 +12,7 @@
|
||||
#include "base/location.h"
|
||||
#include "base/memory/ref_counted_memory.h"
|
||||
#include "base/memory/shared_memory.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/message_loop/message_loop_current.h"
|
||||
#include "base/run_loop.h"
|
||||
#include "base/single_thread_task_runner.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
@@ -33,8 +33,8 @@
|
||||
#include "components/printing/browser/print_composite_client.h"
|
||||
#include "components/printing/browser/print_manager_utils.h"
|
||||
#include "components/printing/common/print_messages.h"
|
||||
#include "components/printing/service/public/cpp/pdf_service_mojo_types.h"
|
||||
#include "components/printing/service/public/cpp/pdf_service_mojo_utils.h"
|
||||
#include "components/services/pdf_compositor/public/cpp/pdf_service_mojo_types.h"
|
||||
#include "components/services/pdf_compositor/public/cpp/pdf_service_mojo_utils.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/notification_details.h"
|
||||
#include "content/public/browser/notification_service.h"
|
||||
@@ -82,7 +82,7 @@ CefPrintViewManagerBase::CefPrintViewManagerBase(
|
||||
inside_inner_message_loop_(false),
|
||||
queue_(g_browser_process->print_job_manager()->queue()),
|
||||
weak_ptr_factory_(this) {
|
||||
DCHECK(queue_.get());
|
||||
DCHECK(queue_);
|
||||
Profile* profile =
|
||||
Profile::FromBrowserContext(web_contents->GetBrowserContext());
|
||||
printing_enabled_.Init(
|
||||
@@ -96,7 +96,6 @@ CefPrintViewManagerBase::~CefPrintViewManagerBase() {
|
||||
DisconnectFromCurrentPrintJob();
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_BASIC_PRINTING)
|
||||
bool CefPrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) {
|
||||
DisconnectFromCurrentPrintJob();
|
||||
|
||||
@@ -104,49 +103,22 @@ bool CefPrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) {
|
||||
int32_t id = rfh->GetRoutingID();
|
||||
return PrintNowInternal(rfh, std::make_unique<PrintMsg_PrintPages>(id));
|
||||
}
|
||||
#endif
|
||||
|
||||
void CefPrintViewManagerBase::PrintDocument(
|
||||
PrintedDocument* document,
|
||||
const scoped_refptr<base::RefCountedMemory>& print_data,
|
||||
const gfx::Size& page_size,
|
||||
const gfx::Rect& content_area,
|
||||
const gfx::Point& offsets) {
|
||||
#if defined(OS_WIN)
|
||||
if (PrintedDocument::HasDebugDumpPath())
|
||||
document->DebugDumpData(print_data.get(), FILE_PATH_LITERAL(".pdf"));
|
||||
|
||||
const auto& settings = document->settings();
|
||||
if (settings.printer_is_textonly()) {
|
||||
print_job_->StartPdfToTextConversion(print_data, page_size);
|
||||
} else if ((settings.printer_is_ps2() || settings.printer_is_ps3()) &&
|
||||
!base::FeatureList::IsEnabled(
|
||||
features::kDisablePostScriptPrinting)) {
|
||||
print_job_->StartPdfToPostScriptConversion(
|
||||
print_data, content_area, offsets, settings.printer_is_ps2());
|
||||
} else {
|
||||
// TODO(thestig): Figure out why rendering text with GDI results in random
|
||||
// missing characters for some users. https://crbug.com/658606
|
||||
// Update : The missing letters seem to have been caused by the same
|
||||
// problem as https://crbug.com/659604 which was resolved. GDI printing
|
||||
// seems to work with the fix for this bug applied.
|
||||
bool print_text_with_gdi =
|
||||
settings.print_text_with_gdi() && !settings.printer_is_xps() &&
|
||||
base::FeatureList::IsEnabled(features::kGdiTextPrinting);
|
||||
print_job_->StartPdfToEmfConversion(print_data, page_size, content_area,
|
||||
print_text_with_gdi);
|
||||
}
|
||||
// Indicate that the PDF is fully rendered and we no longer need the renderer
|
||||
// and web contents, so the print job does not need to be cancelled if they
|
||||
// die. This is needed on Windows because the PrintedDocument will not be
|
||||
// considered complete until PDF conversion finishes.
|
||||
document->SetConvertingPdf();
|
||||
print_job_->StartConversionToNativeFormat(print_data, page_size, content_area,
|
||||
offsets);
|
||||
#else
|
||||
std::unique_ptr<PdfMetafileSkia> metafile =
|
||||
std::make_unique<PdfMetafileSkia>();
|
||||
CHECK(metafile->InitFromData(print_data->front(), print_data->size()));
|
||||
|
||||
// Update the rendered document. It will send notifications to the listener.
|
||||
PrintedDocument* document = print_job_->document();
|
||||
document->SetDocument(std::move(metafile), page_size, content_area);
|
||||
ShouldQuitFromInnerMessageLoop();
|
||||
#endif
|
||||
@@ -178,50 +150,42 @@ void CefPrintViewManagerBase::OnDidGetPrintedPagesCount(int cookie,
|
||||
OpportunisticallyCreatePrintJob(cookie);
|
||||
}
|
||||
|
||||
PrintedDocument* CefPrintViewManagerBase::GetDocument(int cookie) {
|
||||
bool CefPrintViewManagerBase::PrintJobHasDocument(int cookie) {
|
||||
if (!OpportunisticallyCreatePrintJob(cookie))
|
||||
return nullptr;
|
||||
return false;
|
||||
|
||||
// These checks may fail since we are completely asynchronous. Old spurious
|
||||
// messages can be received if one of the processes is overloaded.
|
||||
PrintedDocument* document = print_job_->document();
|
||||
if (!document || cookie != document->cookie()) {
|
||||
// Out of sync. It may happen since we are completely asynchronous. Old
|
||||
// spurious messages can be received if one of the processes is overloaded.
|
||||
return nullptr;
|
||||
}
|
||||
return document;
|
||||
return document && document->cookie() == cookie;
|
||||
}
|
||||
|
||||
void CefPrintViewManagerBase::OnComposePdfDone(
|
||||
const PrintHostMsg_DidPrintDocument_Params& params,
|
||||
mojom::PdfCompositor::Status status,
|
||||
mojo::ScopedSharedBufferHandle handle) {
|
||||
base::ReadOnlySharedMemoryRegion region) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
if (status != mojom::PdfCompositor::Status::SUCCESS) {
|
||||
DLOG(ERROR) << "Compositing pdf failed with error " << status;
|
||||
return;
|
||||
}
|
||||
|
||||
PrintedDocument* document = print_job_->document();
|
||||
if (!document)
|
||||
if (!print_job_->document())
|
||||
return;
|
||||
|
||||
std::unique_ptr<base::SharedMemory> shared_buf =
|
||||
GetShmFromMojoHandle(std::move(handle));
|
||||
if (!shared_buf)
|
||||
scoped_refptr<base::RefCountedSharedMemoryMapping> data =
|
||||
base::RefCountedSharedMemoryMapping::CreateFromWholeRegion(region);
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
size_t size = shared_buf->mapped_size();
|
||||
auto data = base::MakeRefCounted<base::RefCountedSharedMemory>(
|
||||
std::move(shared_buf), size);
|
||||
PrintDocument(document, data, params.page_size, params.content_area,
|
||||
PrintDocument(data, params.page_size, params.content_area,
|
||||
params.physical_offsets);
|
||||
}
|
||||
|
||||
void CefPrintViewManagerBase::OnDidPrintDocument(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const PrintHostMsg_DidPrintDocument_Params& params) {
|
||||
PrintedDocument* document = GetDocument(params.document_cookie);
|
||||
if (!document)
|
||||
if (!PrintJobHasDocument(params.document_cookie))
|
||||
return;
|
||||
|
||||
const PrintHostMsg_DidPrintContent_Params& content = params.content;
|
||||
@@ -250,7 +214,7 @@ void CefPrintViewManagerBase::OnDidPrintDocument(
|
||||
|
||||
auto data = base::MakeRefCounted<base::RefCountedSharedMemory>(
|
||||
std::move(shared_buf), content.data_size);
|
||||
PrintDocument(document, data, params.page_size, params.content_area,
|
||||
PrintDocument(data, params.page_size, params.content_area,
|
||||
params.physical_offsets);
|
||||
}
|
||||
|
||||
@@ -282,11 +246,11 @@ void CefPrintViewManagerBase::RenderFrameDeleted(
|
||||
PrintManager::PrintingRenderFrameDeleted();
|
||||
ReleasePrinterQuery();
|
||||
|
||||
if (!print_job_.get())
|
||||
if (!print_job_)
|
||||
return;
|
||||
|
||||
scoped_refptr<PrintedDocument> document(print_job_->document());
|
||||
if (document.get()) {
|
||||
if (document) {
|
||||
// If IsComplete() returns false, the document isn't completely rendered.
|
||||
// Since our renderer is gone, there's nothing to do, cancel it. Otherwise,
|
||||
// the print job may finish without problem.
|
||||
@@ -374,7 +338,7 @@ void CefPrintViewManagerBase::OnNotifyPrintJobEvent(
|
||||
}
|
||||
|
||||
bool CefPrintViewManagerBase::RenderAllMissingPagesNow() {
|
||||
if (!print_job_.get() || !print_job_->is_job_pending())
|
||||
if (!print_job_ || !print_job_->is_job_pending())
|
||||
return false;
|
||||
|
||||
// Is the document already complete?
|
||||
@@ -420,8 +384,9 @@ void CefPrintViewManagerBase::ShouldQuitFromInnerMessageLoop() {
|
||||
}
|
||||
}
|
||||
|
||||
bool CefPrintViewManagerBase::CreateNewPrintJob(PrintJobWorkerOwner* job) {
|
||||
bool CefPrintViewManagerBase::CreateNewPrintJob(PrinterQuery* query) {
|
||||
DCHECK(!inside_inner_message_loop_);
|
||||
DCHECK(query);
|
||||
|
||||
// Disconnect the current |print_job_|.
|
||||
DisconnectFromCurrentPrintJob();
|
||||
@@ -432,13 +397,9 @@ bool CefPrintViewManagerBase::CreateNewPrintJob(PrintJobWorkerOwner* job) {
|
||||
return false;
|
||||
}
|
||||
|
||||
DCHECK(!print_job_.get());
|
||||
DCHECK(job);
|
||||
if (!job)
|
||||
return false;
|
||||
|
||||
DCHECK(!print_job_);
|
||||
print_job_ = base::MakeRefCounted<PrintJob>();
|
||||
print_job_->Initialize(job, RenderSourceName(), number_pages_);
|
||||
print_job_->Initialize(query, RenderSourceName(), number_pages_);
|
||||
registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT,
|
||||
content::Source<PrintJob>(print_job_.get()));
|
||||
printing_succeeded_ = false;
|
||||
@@ -451,7 +412,7 @@ void CefPrintViewManagerBase::DisconnectFromCurrentPrintJob() {
|
||||
bool result = RenderAllMissingPagesNow();
|
||||
|
||||
// Verify that assertion.
|
||||
if (print_job_.get() && print_job_->document() &&
|
||||
if (print_job_ && print_job_->document() &&
|
||||
!print_job_->document()->IsComplete()) {
|
||||
DCHECK(!result);
|
||||
// That failed.
|
||||
@@ -463,7 +424,7 @@ void CefPrintViewManagerBase::DisconnectFromCurrentPrintJob() {
|
||||
}
|
||||
|
||||
void CefPrintViewManagerBase::TerminatePrintJob(bool cancel) {
|
||||
if (!print_job_.get())
|
||||
if (!print_job_)
|
||||
return;
|
||||
|
||||
if (cancel) {
|
||||
@@ -486,7 +447,7 @@ void CefPrintViewManagerBase::ReleasePrintJob() {
|
||||
content::RenderFrameHost* rfh = printing_rfh_;
|
||||
printing_rfh_ = nullptr;
|
||||
|
||||
if (!print_job_.get())
|
||||
if (!print_job_)
|
||||
return;
|
||||
|
||||
if (rfh) {
|
||||
@@ -524,8 +485,7 @@ bool CefPrintViewManagerBase::RunInnerMessageLoop() {
|
||||
|
||||
// Need to enable recursive task.
|
||||
{
|
||||
base::MessageLoop::ScopedNestableTaskAllower allow(
|
||||
base::MessageLoop::current());
|
||||
base::MessageLoopCurrent::ScopedNestableTaskAllower allow;
|
||||
run_loop.Run();
|
||||
}
|
||||
|
||||
@@ -540,7 +500,7 @@ bool CefPrintViewManagerBase::RunInnerMessageLoop() {
|
||||
}
|
||||
|
||||
bool CefPrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) {
|
||||
if (print_job_.get())
|
||||
if (print_job_)
|
||||
return true;
|
||||
|
||||
if (!cookie) {
|
||||
@@ -552,7 +512,7 @@ bool CefPrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) {
|
||||
// The job was initiated by a script. Time to get the corresponding worker
|
||||
// thread.
|
||||
scoped_refptr<PrinterQuery> queued_query = queue_->PopPrinterQuery(cookie);
|
||||
if (!queued_query.get()) {
|
||||
if (!queued_query) {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
@@ -596,7 +556,7 @@ void CefPrintViewManagerBase::ReleasePrinterQuery() {
|
||||
|
||||
scoped_refptr<PrinterQuery> printer_query;
|
||||
printer_query = queue_->PopPrinterQuery(cookie);
|
||||
if (!printer_query.get())
|
||||
if (!printer_query)
|
||||
return;
|
||||
BrowserThread::PostTask(
|
||||
BrowserThread::IO, FROM_HERE,
|
||||
|
@@ -8,13 +8,14 @@
|
||||
#include <memory>
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/read_only_shared_memory_region.h"
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/strings/string16.h"
|
||||
#include "build/build_config.h"
|
||||
#include "components/prefs/pref_member.h"
|
||||
#include "components/printing/browser/print_manager.h"
|
||||
#include "components/printing/service/public/interfaces/pdf_compositor.mojom.h"
|
||||
#include "components/services/pdf_compositor/public/interfaces/pdf_compositor.mojom.h"
|
||||
#include "content/public/browser/notification_observer.h"
|
||||
#include "content/public/browser/notification_registrar.h"
|
||||
#include "mojo/public/cpp/system/platform_handle.h"
|
||||
@@ -34,9 +35,7 @@ namespace printing {
|
||||
|
||||
class JobEventDetails;
|
||||
class PrintJob;
|
||||
class PrintJobWorkerOwner;
|
||||
class PrintQueriesQueue;
|
||||
class PrintedDocument;
|
||||
class PrinterQuery;
|
||||
|
||||
// Base class for managing the print commands for a WebContents.
|
||||
@@ -45,12 +44,10 @@ class CefPrintViewManagerBase : public content::NotificationObserver,
|
||||
public:
|
||||
~CefPrintViewManagerBase() override;
|
||||
|
||||
#if BUILDFLAG(ENABLE_BASIC_PRINTING)
|
||||
// Prints the current document immediately. Since the rendering is
|
||||
// asynchronous, the actual printing will not be completed on the return of
|
||||
// this function. Returns false if printing is impossible at the moment.
|
||||
virtual bool PrintNow(content::RenderFrameHost* rfh);
|
||||
#endif // ENABLE_BASIC_PRINTING
|
||||
|
||||
// Whether printing is enabled or not.
|
||||
void UpdatePrintingEnabled();
|
||||
@@ -78,7 +75,7 @@ class CefPrintViewManagerBase : public content::NotificationObserver,
|
||||
// currently a print job, safely disconnect from it. Returns false if it is
|
||||
// impossible to safely disconnect from the current print job or it is
|
||||
// impossible to create a new print job.
|
||||
virtual bool CreateNewPrintJob(PrintJobWorkerOwner* job);
|
||||
virtual bool CreateNewPrintJob(PrinterQuery* query);
|
||||
|
||||
// Manages the low-level talk to the printer.
|
||||
scoped_refptr<PrintJob> print_job_;
|
||||
@@ -102,7 +99,7 @@ class CefPrintViewManagerBase : public content::NotificationObserver,
|
||||
// IPC message handlers for service.
|
||||
void OnComposePdfDone(const PrintHostMsg_DidPrintDocument_Params& params,
|
||||
mojom::PdfCompositor::Status status,
|
||||
mojo::ScopedSharedBufferHandle handle);
|
||||
base::ReadOnlySharedMemoryRegion region);
|
||||
|
||||
// Processes a NOTIFY_PRINT_JOB_EVENT notification.
|
||||
void OnNotifyPrintJobEvent(const JobEventDetails& event_details);
|
||||
@@ -112,14 +109,13 @@ class CefPrintViewManagerBase : public content::NotificationObserver,
|
||||
// been requested to the renderer.
|
||||
bool RenderAllMissingPagesNow();
|
||||
|
||||
// Checks that synchronization is correct and a print query exists for
|
||||
// |cookie|. If so, returns the document associated with the cookie.
|
||||
PrintedDocument* GetDocument(int cookie);
|
||||
// Checks that synchronization is correct with |print_job_| based on |cookie|.
|
||||
bool PrintJobHasDocument(int cookie);
|
||||
|
||||
// Starts printing |document| with the given |print_data|. This method assumes
|
||||
// |print_data| contains valid data.
|
||||
void PrintDocument(PrintedDocument* document,
|
||||
const scoped_refptr<base::RefCountedMemory>& print_data,
|
||||
// Starts printing the |document| in |print_job_| with the given |print_data|.
|
||||
// This method assumes PrintJobHasDocument() has been called, and |print_data|
|
||||
// contains valid data.
|
||||
void PrintDocument(const scoped_refptr<base::RefCountedMemory>& print_data,
|
||||
const gfx::Size& page_size,
|
||||
const gfx::Rect& content_area,
|
||||
const gfx::Point& offsets);
|
||||
@@ -177,7 +173,7 @@ class CefPrintViewManagerBase : public content::NotificationObserver,
|
||||
// Whether printing is enabled.
|
||||
BooleanPrefMember printing_enabled_;
|
||||
|
||||
scoped_refptr<printing::PrintQueriesQueue> queue_;
|
||||
scoped_refptr<PrintQueriesQueue> queue_;
|
||||
|
||||
base::WeakPtrFactory<CefPrintViewManagerBase> weak_ptr_factory_;
|
||||
|
||||
|
@@ -281,9 +281,9 @@ void CefPrintingMessageFilter::OnUpdatePrintSettingsReply(
|
||||
}
|
||||
}
|
||||
|
||||
void CefPrintingMessageFilter::OnCheckForCancel(int32_t preview_ui_id,
|
||||
int preview_request_id,
|
||||
bool* cancel) {
|
||||
void CefPrintingMessageFilter::OnCheckForCancel(
|
||||
const PrintHostMsg_PreviewIds& ids,
|
||||
bool* cancel) {
|
||||
*cancel = false;
|
||||
}
|
||||
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#include "content/public/browser/browser_message_filter.h"
|
||||
#include "printing/buildflags/buildflags.h"
|
||||
|
||||
struct PrintHostMsg_PreviewIds;
|
||||
struct PrintHostMsg_ScriptedPrint_Params;
|
||||
class Profile;
|
||||
|
||||
@@ -74,9 +75,7 @@ class CefPrintingMessageFilter : public content::BrowserMessageFilter {
|
||||
IPC::Message* reply_msg);
|
||||
|
||||
// Check to see if print preview has been cancelled.
|
||||
void OnCheckForCancel(int32_t preview_ui_id,
|
||||
int preview_request_id,
|
||||
bool* cancel);
|
||||
void OnCheckForCancel(const PrintHostMsg_PreviewIds& ids, bool* cancel);
|
||||
|
||||
std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
|
||||
printing_shutdown_notifier_;
|
||||
|
@@ -66,11 +66,6 @@ void CefResourceContext::RemoveUserData(const void* key) {
|
||||
content::ResourceContext::RemoveUserData(key);
|
||||
}
|
||||
|
||||
net::HostResolver* CefResourceContext::GetHostResolver() {
|
||||
CHECK(getter_.get());
|
||||
return getter_->GetHostResolver();
|
||||
}
|
||||
|
||||
net::URLRequestContext* CefResourceContext::GetRequestContext() {
|
||||
CHECK(getter_.get());
|
||||
return getter_->GetURLRequestContext();
|
||||
|
@@ -38,7 +38,6 @@ class CefResourceContext : public content::ResourceContext {
|
||||
void RemoveUserData(const void* key) override;
|
||||
|
||||
// ResourceContext implementation.
|
||||
net::HostResolver* GetHostResolver() override;
|
||||
net::URLRequestContext* GetRequestContext() override;
|
||||
|
||||
std::unique_ptr<net::ClientCertStore> CreateClientCertStore();
|
||||
|
@@ -21,8 +21,6 @@
|
||||
#include "content/public/browser/speech_recognition_manager.h"
|
||||
#include "content/public/browser/speech_recognition_session_context.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/common/speech_recognition_error.h"
|
||||
#include "content/public/common/speech_recognition_result.h"
|
||||
|
||||
using content::BrowserThread;
|
||||
using content::SpeechRecognitionManager;
|
||||
@@ -52,11 +50,11 @@ void CefSpeechRecognitionManagerDelegate::OnAudioEnd(int session_id) {}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnRecognitionResults(
|
||||
int session_id,
|
||||
const content::SpeechRecognitionResults& result) {}
|
||||
const std::vector<blink::mojom::SpeechRecognitionResultPtr>& result) {}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnRecognitionError(
|
||||
int session_id,
|
||||
const content::SpeechRecognitionError& error) {}
|
||||
const blink::mojom::SpeechRecognitionError& error) {}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnAudioLevelsChange(
|
||||
int session_id,
|
||||
|
@@ -31,10 +31,11 @@ class CefSpeechRecognitionManagerDelegate
|
||||
void OnRecognitionEnd(int session_id) override;
|
||||
void OnRecognitionResults(
|
||||
int session_id,
|
||||
const content::SpeechRecognitionResults& result) override;
|
||||
const std::vector<blink::mojom::SpeechRecognitionResultPtr>& result)
|
||||
override;
|
||||
void OnRecognitionError(
|
||||
int session_id,
|
||||
const content::SpeechRecognitionError& error) override;
|
||||
const blink::mojom::SpeechRecognitionError& error) override;
|
||||
void OnAudioLevelsChange(int session_id,
|
||||
float volume,
|
||||
float noise_volume) override;
|
||||
|
@@ -17,8 +17,7 @@ CertPolicy::~CertPolicy() {}
|
||||
// For an allowance, we consider a given |cert| to be a match to a saved
|
||||
// allowed cert if the |error| is an exact match to or subset of the errors
|
||||
// in the saved CertStatus.
|
||||
bool CertPolicy::Check(const net::X509Certificate& cert,
|
||||
net::CertStatus error) const {
|
||||
bool CertPolicy::Check(const net::X509Certificate& cert, int error) const {
|
||||
net::SHA256HashValue fingerprint = cert.CalculateChainFingerprint256();
|
||||
const auto& allowed_iter = allowed_.find(fingerprint);
|
||||
if ((allowed_iter != allowed_.end()) && (allowed_iter->second & error) &&
|
||||
@@ -28,8 +27,7 @@ bool CertPolicy::Check(const net::X509Certificate& cert,
|
||||
return false;
|
||||
}
|
||||
|
||||
void CertPolicy::Allow(const net::X509Certificate& cert,
|
||||
net::CertStatus error) {
|
||||
void CertPolicy::Allow(const net::X509Certificate& cert, int error) {
|
||||
// If this same cert had already been saved with a different error status,
|
||||
// this will replace it with the new error status.
|
||||
net::SHA256HashValue fingerprint = cert.CalculateChainFingerprint256();
|
||||
@@ -59,7 +57,7 @@ bool CefSSLHostStateDelegate::DidHostRunInsecureContent(
|
||||
|
||||
void CefSSLHostStateDelegate::AllowCert(const std::string& host,
|
||||
const net::X509Certificate& cert,
|
||||
net::CertStatus error) {
|
||||
int error) {
|
||||
cert_policy_for_host_[host].Allow(cert, error);
|
||||
}
|
||||
|
||||
@@ -84,7 +82,7 @@ void CefSSLHostStateDelegate::Clear(
|
||||
SSLHostStateDelegate::CertJudgment CefSSLHostStateDelegate::QueryPolicy(
|
||||
const std::string& host,
|
||||
const net::X509Certificate& cert,
|
||||
net::CertStatus error,
|
||||
int error,
|
||||
bool* expired_previous_decision) {
|
||||
return cert_policy_for_host_[host].Check(cert, error)
|
||||
? SSLHostStateDelegate::ALLOWED
|
||||
|
@@ -10,7 +10,6 @@
|
||||
|
||||
#include "content/public/browser/ssl_host_state_delegate.h"
|
||||
#include "net/base/hash_value.h"
|
||||
#include "net/cert/cert_status_flags.h"
|
||||
#include "net/cert/x509_certificate.h"
|
||||
|
||||
// Implementation based on android_webview/browser/aw_ssl_host_state_delegate.h.
|
||||
@@ -25,11 +24,11 @@ class CertPolicy {
|
||||
// Returns true if the user has decided to proceed through the ssl error
|
||||
// before. For a certificate to be allowed, it must not have any
|
||||
// *additional* errors from when it was allowed.
|
||||
bool Check(const net::X509Certificate& cert, net::CertStatus error) const;
|
||||
bool Check(const net::X509Certificate& cert, int error) const;
|
||||
|
||||
// Causes the policy to allow this certificate for a given |error|. And
|
||||
// remember the user's choice.
|
||||
void Allow(const net::X509Certificate& cert, net::CertStatus error);
|
||||
void Allow(const net::X509Certificate& cert, int error);
|
||||
|
||||
// Returns true if and only if there exists a user allow exception for some
|
||||
// certificate.
|
||||
@@ -37,7 +36,7 @@ class CertPolicy {
|
||||
|
||||
private:
|
||||
// The set of fingerprints of allowed certificates.
|
||||
std::map<net::SHA256HashValue, net::CertStatus> allowed_;
|
||||
std::map<net::SHA256HashValue, int> allowed_;
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
@@ -50,13 +49,13 @@ class CefSSLHostStateDelegate : public content::SSLHostStateDelegate {
|
||||
// SSLHostStateDelegate methods:
|
||||
void AllowCert(const std::string& host,
|
||||
const net::X509Certificate& cert,
|
||||
net::CertStatus error) override;
|
||||
int error) override;
|
||||
void Clear(
|
||||
const base::Callback<bool(const std::string&)>& host_filter) override;
|
||||
content::SSLHostStateDelegate::CertJudgment QueryPolicy(
|
||||
const std::string& host,
|
||||
const net::X509Certificate& cert,
|
||||
net::CertStatus error,
|
||||
int error,
|
||||
bool* expired_previous_decision) override;
|
||||
void HostRanInsecureContent(const std::string& host,
|
||||
int child_id,
|
||||
|
@@ -134,12 +134,13 @@ void CefStoragePartitionProxy::ClearData(
|
||||
uint32_t remove_mask,
|
||||
uint32_t quota_storage_remove_mask,
|
||||
const OriginMatcherFunction& origin_matcher,
|
||||
const CookieMatcherFunction& cookie_matcher,
|
||||
network::mojom::CookieDeletionFilterPtr cookie_deletion_filter,
|
||||
const base::Time begin,
|
||||
const base::Time end,
|
||||
base::OnceClosure callback) {
|
||||
parent_->ClearData(remove_mask, quota_storage_remove_mask, origin_matcher,
|
||||
cookie_matcher, begin, end, std::move(callback));
|
||||
std::move(cookie_deletion_filter), begin, end,
|
||||
std::move(callback));
|
||||
}
|
||||
|
||||
void CefStoragePartitionProxy::ClearHttpAndMediaCaches(
|
||||
@@ -192,11 +193,6 @@ CefStoragePartitionProxy::GetBluetoothAllowedDevicesMap() {
|
||||
return parent_->GetBluetoothAllowedDevicesMap();
|
||||
}
|
||||
|
||||
content::BlobURLLoaderFactory*
|
||||
CefStoragePartitionProxy::GetBlobURLLoaderFactory() {
|
||||
return parent_->GetBlobURLLoaderFactory();
|
||||
}
|
||||
|
||||
content::BlobRegistryWrapper* CefStoragePartitionProxy::GetBlobRegistry() {
|
||||
return parent_->GetBlobRegistry();
|
||||
}
|
||||
@@ -206,6 +202,10 @@ CefStoragePartitionProxy::GetPrefetchURLLoaderService() {
|
||||
return parent_->GetPrefetchURLLoaderService();
|
||||
}
|
||||
|
||||
content::CookieStoreContext* CefStoragePartitionProxy::GetCookieStoreContext() {
|
||||
return parent_->GetCookieStoreContext();
|
||||
}
|
||||
|
||||
content::URLLoaderFactoryGetter*
|
||||
CefStoragePartitionProxy::url_loader_factory_getter() {
|
||||
return parent_->url_loader_factory_getter();
|
||||
@@ -217,7 +217,7 @@ content::BrowserContext* CefStoragePartitionProxy::browser_context() const {
|
||||
|
||||
mojo::BindingId CefStoragePartitionProxy::Bind(
|
||||
int process_id,
|
||||
mojo::InterfaceRequest<content::mojom::StoragePartitionService> request) {
|
||||
mojo::InterfaceRequest<blink::mojom::StoragePartitionService> request) {
|
||||
return parent_->Bind(process_id, std::move(request));
|
||||
}
|
||||
|
||||
|
@@ -59,7 +59,7 @@ class CefStoragePartitionProxy : public content::StoragePartition {
|
||||
void ClearData(uint32_t remove_mask,
|
||||
uint32_t quota_storage_remove_mask,
|
||||
const OriginMatcherFunction& origin_matcher,
|
||||
const CookieMatcherFunction& cookie_matcher,
|
||||
network::mojom::CookieDeletionFilterPtr cookie_deletion_filter,
|
||||
const base::Time begin,
|
||||
const base::Time end,
|
||||
base::OnceClosure callback) override;
|
||||
@@ -77,14 +77,14 @@ class CefStoragePartitionProxy : public content::StoragePartition {
|
||||
content::PaymentAppContextImpl* GetPaymentAppContext() override;
|
||||
content::BroadcastChannelProvider* GetBroadcastChannelProvider() override;
|
||||
content::BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap() override;
|
||||
content::BlobURLLoaderFactory* GetBlobURLLoaderFactory() override;
|
||||
content::BlobRegistryWrapper* GetBlobRegistry() override;
|
||||
content::PrefetchURLLoaderService* GetPrefetchURLLoaderService() override;
|
||||
content::CookieStoreContext* GetCookieStoreContext() override;
|
||||
content::URLLoaderFactoryGetter* url_loader_factory_getter() override;
|
||||
content::BrowserContext* browser_context() const override;
|
||||
mojo::BindingId Bind(
|
||||
int process_id,
|
||||
mojo::InterfaceRequest<content::mojom::StoragePartitionService> request)
|
||||
mojo::InterfaceRequest<blink::mojom::StoragePartitionService> request)
|
||||
override;
|
||||
void set_site_for_service_worker(
|
||||
const GURL& site_for_service_worker) override;
|
||||
|
@@ -169,10 +169,10 @@ SkColor CefBrowserPlatformDelegateViews::GetBackgroundColor() const {
|
||||
return native_delegate_->GetBackgroundColor();
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateViews::WasResized() {
|
||||
void CefBrowserPlatformDelegateViews::SynchronizeVisualProperties() {
|
||||
content::RenderViewHost* host = browser_->web_contents()->GetRenderViewHost();
|
||||
if (host)
|
||||
host->GetWidget()->WasResized();
|
||||
host->GetWidget()->SynchronizeVisualProperties();
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateViews::SendKeyEvent(
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user