mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
67 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
dc18c542a2 | ||
|
6792e13230 | ||
|
7c09f21d73 | ||
|
87c88072bb | ||
|
398e3c3a2a | ||
|
1a97a28b0f | ||
|
8746aab738 | ||
|
778aa851a9 | ||
|
c4d256c286 | ||
|
4a5500fcb9 | ||
|
3d7ef76b75 | ||
|
8251119be4 | ||
|
11d21f100f | ||
|
d70a0a832d | ||
|
f3083218af | ||
|
8ff65ec09f | ||
|
8381105f52 | ||
|
cbd0dfcdee | ||
|
ad726a0a40 | ||
|
0b98db28bb | ||
|
c05ff2847d | ||
|
cf14b2a972 | ||
|
5a22a5c8a3 | ||
|
5e80ea3371 | ||
|
d0b3042940 | ||
|
de4f9e8908 | ||
|
ab94a13522 | ||
|
09c4142dad | ||
|
e0063880ac | ||
|
7ade772e0b | ||
|
a39c2a0068 | ||
|
17cab6d955 | ||
|
cad2498d87 | ||
|
6569ef09c5 | ||
|
78ea5d8c61 | ||
|
c3648f42b2 | ||
|
f90d5bc49e | ||
|
55e158fe81 | ||
|
5d48f277f2 | ||
|
2094a8e221 | ||
|
4b3c3132cb | ||
|
c83b3cda24 | ||
|
0a2c7a1070 | ||
|
178a44bd18 | ||
|
45d771dfb0 | ||
|
1726176b9b | ||
|
c6872cec5f | ||
|
14dd0c0d06 | ||
|
06af9c85da | ||
|
d509d5833d | ||
|
2c67350605 | ||
|
9ae4da3b38 | ||
|
8b79f9cbe7 | ||
|
3e4f8d1b9c | ||
|
f3b570cf8e | ||
|
d33b67cb33 | ||
|
ae9ede9aa6 | ||
|
584b19967a | ||
|
3c85154faf | ||
|
276423dcfb | ||
|
42f351a40d | ||
|
13f2282754 | ||
|
80cfb3c97c | ||
|
73082fd2ce | ||
|
bc29774553 | ||
|
ff68c01543 | ||
|
400fbf7839 |
35
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
35
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen and what happened instead.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Versions (please complete the following information):**
|
||||
- OS: [e.g. Windows 10, MacOS 13.2, Ubuntu 22.10]
|
||||
- CEF Version: [e.g. 111.2.2]
|
||||
|
||||
**Additional context**
|
||||
Does the problem reproduce with the cefclient or cefsimple sample application at the same version?
|
||||
|
||||
Does the problem reproduce with Google Chrome at the same version?
|
||||
|
||||
Add any other context about the problem here.
|
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
36
BUILD.gn
36
BUILD.gn
@@ -385,12 +385,13 @@ source_set("libcef_static_unittested") {
|
||||
sources = [
|
||||
"libcef/browser/devtools/devtools_util.cc",
|
||||
"libcef/browser/devtools/devtools_util.h",
|
||||
"libcef/browser/screen_util.h",
|
||||
"libcef/browser/screen_util.cc",
|
||||
"libcef/browser/geometry_util.h",
|
||||
"libcef/browser/geometry_util.cc",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"//base",
|
||||
"//ui/gfx/geometry",
|
||||
]
|
||||
|
||||
configs += [
|
||||
@@ -406,7 +407,7 @@ test("libcef_static_unittests") {
|
||||
|
||||
sources = [
|
||||
"libcef/browser/devtools/devtools_util_unittest.cc",
|
||||
"libcef/browser/screen_util_unittest.cc",
|
||||
"libcef/browser/geometry_util_unittest.cc",
|
||||
]
|
||||
|
||||
deps = [
|
||||
@@ -933,8 +934,6 @@ source_set("libcef_static") {
|
||||
"libcef/renderer/render_frame_util.h",
|
||||
"libcef/renderer/render_manager.cc",
|
||||
"libcef/renderer/render_manager.h",
|
||||
"libcef/renderer/render_urlrequest_impl.cc",
|
||||
"libcef/renderer/render_urlrequest_impl.h",
|
||||
"libcef/renderer/thread_util.h",
|
||||
"libcef/renderer/v8_impl.cc",
|
||||
"libcef/renderer/v8_impl.h",
|
||||
@@ -1145,6 +1144,10 @@ source_set("libcef_static") {
|
||||
"libcef/browser/native/menu_runner_mac.mm",
|
||||
"libcef/browser/osr/browser_platform_delegate_osr_mac.h",
|
||||
"libcef/browser/osr/browser_platform_delegate_osr_mac.mm",
|
||||
"libcef/browser/views/native_widget_mac.h",
|
||||
"libcef/browser/views/native_widget_mac.mm",
|
||||
"libcef/browser/views/ns_window.h",
|
||||
"libcef/browser/views/ns_window.mm",
|
||||
"libcef/browser/views/view_util_mac.mm",
|
||||
"libcef/common/util_mac.h",
|
||||
"libcef/common/util_mac.mm",
|
||||
@@ -1349,6 +1352,8 @@ make_pack_header("resources") {
|
||||
"$root_gen_dir/content/browser/webrtc/resources/grit/webrtc_internals_resources.h",
|
||||
"$root_gen_dir/content/grit/content_resources.h",
|
||||
"$root_gen_dir/content/grit/dev_ui_content_resources.h",
|
||||
"$root_gen_dir/content/grit/gpu_resources.h",
|
||||
"$root_gen_dir/content/grit/histograms_resources.h",
|
||||
"$root_gen_dir/extensions/grit/extensions_browser_resources.h",
|
||||
"$root_gen_dir/extensions/grit/extensions_renderer_resources.h",
|
||||
"$root_gen_dir/extensions/grit/extensions_resources.h",
|
||||
@@ -1372,6 +1377,8 @@ make_pack_header("resources") {
|
||||
"//components/resources:components_resources",
|
||||
"//components/resources:dev_ui_components_resources",
|
||||
"//content/browser/devtools:devtools_resources",
|
||||
"//content/browser/resources/gpu:resources",
|
||||
"//content/browser/resources/histograms:resources",
|
||||
"//content/browser/tracing:resources",
|
||||
"//content/browser/webrtc/resources",
|
||||
"//content:content_resources",
|
||||
@@ -1501,6 +1508,8 @@ if (is_mac) {
|
||||
public_deps += [ "//third_party/icu:icudata", ]
|
||||
}
|
||||
|
||||
sources += [ "//ui/gl/resources/angle-metal/gpu_shader_cache.bin" ]
|
||||
|
||||
if (v8_use_external_startup_data) {
|
||||
sources += [
|
||||
"$root_out_dir/snapshot_blob.bin",
|
||||
@@ -1768,7 +1777,20 @@ if (is_mac) {
|
||||
}
|
||||
}
|
||||
|
||||
foreach(helper_params, content_mac_helpers) {
|
||||
# From //chrome/BUILD.gn:
|
||||
# Helper app to display alert notifications. This is necessary as an app can
|
||||
# only display either banner or alert style notifications and the main app
|
||||
# will display banners.
|
||||
alert_helper_params = [
|
||||
"alerts",
|
||||
".alerts",
|
||||
" (Alerts)",
|
||||
]
|
||||
|
||||
# Merge all helper apps needed by //content and //chrome.
|
||||
chrome_mac_helpers = content_mac_helpers + [ alert_helper_params ]
|
||||
|
||||
foreach(helper_params, chrome_mac_helpers) {
|
||||
_helper_target = helper_params[0]
|
||||
_helper_bundle_id = helper_params[1]
|
||||
_helper_suffix = helper_params[2]
|
||||
@@ -1799,7 +1821,7 @@ if (is_mac) {
|
||||
":cef_framework",
|
||||
]
|
||||
|
||||
foreach(helper_params, content_mac_helpers) {
|
||||
foreach(helper_params, chrome_mac_helpers) {
|
||||
sources += [
|
||||
"$root_out_dir/${app_helper_name}${helper_params[2]}.app",
|
||||
]
|
||||
|
@@ -7,5 +7,6 @@
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'refs/tags/111.0.5563.0'
|
||||
'chromium_checkout': 'refs/tags/114.0.5735.201',
|
||||
'depot_tools_checkout': '7ee8e6c7cb'
|
||||
}
|
||||
|
@@ -13,7 +13,7 @@
|
||||
#
|
||||
# Linux: Ninja, GCC 7.5.0+, Unix Makefiles
|
||||
# MacOS: Ninja, Xcode 12.2 to 13.0
|
||||
# Windows: Ninja, Visual Studio 2019+
|
||||
# Windows: Ninja, Visual Studio 2022
|
||||
#
|
||||
# Ninja is a cross-platform open-source tool for running fast builds using
|
||||
# pre-installed platform toolchains (GNU, clang, Xcode or MSVC). It can be
|
||||
@@ -54,9 +54,9 @@
|
||||
# recommended.
|
||||
#
|
||||
# - Windows requirements:
|
||||
# Visual Studio 2019 or newer building on Windows 10 or newer. Windows 10
|
||||
# 64-bit is recommended. Newer versions will likely also work but may not have
|
||||
# been tested.
|
||||
# Visual Studio 2022 building on Windows 10 or newer. Windows 10/11 64-bit is
|
||||
# recommended. Newer versions will likely also work but may not have been
|
||||
# tested.
|
||||
#
|
||||
# BUILD EXAMPLES
|
||||
#
|
||||
@@ -96,35 +96,35 @@
|
||||
# > ninja cefclient cefsimple
|
||||
#
|
||||
# To perform a Windows build using a 32-bit CEF binary distribution:
|
||||
# Using the Visual Studio 2019 IDE:
|
||||
# > cmake -G "Visual Studio 16" -A Win32 ..
|
||||
# Using the Visual Studio 2022 IDE:
|
||||
# > cmake -G "Visual Studio 17" -A Win32 ..
|
||||
# Open build\cef.sln in Visual Studio and select Build > Build Solution.
|
||||
#
|
||||
# Using Ninja with Visual Studio 2019 command-line tools:
|
||||
# Using Ninja with Visual Studio 2022 command-line tools:
|
||||
# (this path may be different depending on your Visual Studio installation)
|
||||
# > "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars32.bat"
|
||||
# > "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvars32.bat"
|
||||
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
|
||||
# > ninja cefclient cefsimple
|
||||
#
|
||||
# To perform a Windows build using a 64-bit CEF binary distribution:
|
||||
# Using the Visual Studio 2019 IDE:
|
||||
# > cmake -G "Visual Studio 16" -A x64 ..
|
||||
# Using the Visual Studio 2022 IDE:
|
||||
# > cmake -G "Visual Studio 17" -A x64 ..
|
||||
# Open build\cef.sln in Visual Studio and select Build > Build Solution.
|
||||
#
|
||||
# Using Ninja with Visual Studio 2019 command-line tools:
|
||||
# Using Ninja with Visual Studio 2022 command-line tools:
|
||||
# (this path may be different depending on your Visual Studio installation)
|
||||
# > "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
|
||||
# > "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvars64.bat"
|
||||
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
|
||||
# > ninja cefclient cefsimple
|
||||
#
|
||||
# To perform a Windows build using an ARM64 CEF binary distribution:
|
||||
# Using the Visual Studio 2019 IDE:
|
||||
# > cmake -G "Visual Studio 16" -A arm64 ..
|
||||
# Using the Visual Studio 2022 IDE:
|
||||
# > cmake -G "Visual Studio 17" -A arm64 ..
|
||||
# Open build\cef.sln in Visual Studio and select Build > Build Solution.
|
||||
#
|
||||
# Using Ninja with Visual Studio 2019 command-line tools:
|
||||
# Using Ninja with Visual Studio 2022 command-line tools:
|
||||
# (this path may be different depending on your Visual Studio installation)
|
||||
# > "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsamd64_arm64.bat"
|
||||
# > "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvarsamd64_arm64.bat"
|
||||
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
|
||||
# > ninja cefsimple
|
||||
|
||||
@@ -132,8 +132,8 @@
|
||||
# Global setup.
|
||||
#
|
||||
|
||||
# For VS2019 and Xcode 12+ support.
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
# For VS2022 and Xcode 12+ support.
|
||||
cmake_minimum_required(VERSION 3.21)
|
||||
|
||||
# Only generate Debug and Release configuration types.
|
||||
set(CMAKE_CONFIGURATION_TYPES Debug Release)
|
||||
|
@@ -9,6 +9,7 @@ The Chromium Embedded Framework (CEF) is a simple framework for embedding Chromi
|
||||
* Branches and Building - https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
* Announcements - https://groups.google.com/forum/#!forum/cef-announce
|
||||
* Support Forum - http://www.magpcss.org/ceforum/
|
||||
* Issue Tracker - https://github.com/chromiumembedded/cef/issues
|
||||
* C++ API Docs - [Stable release docs](https://cef-builds.spotifycdn.com/docs/stable.html) / [Beta release docs](https://cef-builds.spotifycdn.com/docs/beta.html)
|
||||
* Downloads - https://cef-builds.spotifycdn.com/index.html
|
||||
* Donations - http://www.magpcss.org/ceforum/donate.php
|
||||
@@ -57,7 +58,7 @@ If you're the maintainer of a project not listed above and would like your proje
|
||||
|
||||
CEF is still very much a work in progress. Some ways that you can help out:
|
||||
|
||||
\- Vote for issues in the [CEF issue tracker](https://bitbucket.org/chromiumembedded/cef/issues?status=new&status=open) that are important to you. This helps with development prioritization.
|
||||
\- Vote for issues in the [CEF issue tracker](https://github.com/chromiumembedded/cef/issues) that are important to you. This helps with development prioritization.
|
||||
|
||||
\- Report any bugs that you find or feature requests that are important to you. Make sure to first search for existing issues before creating new ones. Please use the [CEF Forum](http://magpcss.org/ceforum) and not the issue tracker for usage questions. Each CEF issue should:
|
||||
|
||||
@@ -68,7 +69,7 @@ CEF is still very much a work in progress. Some ways that you can help out:
|
||||
|
||||
\- Write unit tests for new or existing functionality.
|
||||
|
||||
\- Pull requests and patches are welcome. View open issues in the [CEF issue tracker](https://bitbucket.org/chromiumembedded/cef/issues?status=new&status=open) or search for TODO(cef) in the source code for ideas.
|
||||
\- Pull requests and patches are welcome. View open issues in the [CEF issue tracker](https://github.com/chromiumembedded/cef/issues) or search for TODO(cef) in the source code for ideas.
|
||||
|
||||
If you would like to contribute source code changes to CEF please follow the below guidelines:
|
||||
|
||||
|
@@ -237,6 +237,8 @@
|
||||
'tests/cefclient/browser/client_prefs.cc',
|
||||
'tests/cefclient/browser/client_prefs.h',
|
||||
'tests/cefclient/browser/client_types.h',
|
||||
'tests/cefclient/browser/default_client_handler.cc',
|
||||
'tests/cefclient/browser/default_client_handler.h',
|
||||
'tests/cefclient/browser/dialog_test.cc',
|
||||
'tests/cefclient/browser/dialog_test.h',
|
||||
'tests/cefclient/browser/image_cache.cc',
|
||||
@@ -391,6 +393,7 @@
|
||||
'tests/cefclient/browser/temp_window_mac.mm',
|
||||
'tests/cefclient/browser/text_input_client_osr_mac.h',
|
||||
'tests/cefclient/browser/text_input_client_osr_mac.mm',
|
||||
'tests/cefclient/browser/views_window_mac.mm',
|
||||
'tests/cefclient/browser/window_test_runner_mac.h',
|
||||
'tests/cefclient/browser/window_test_runner_mac.mm',
|
||||
'tests/cefclient/cefclient_mac.mm',
|
||||
|
@@ -359,6 +359,7 @@ if(OS_MAC)
|
||||
# Format is "<name suffix>:<target suffix>:<plist suffix>".
|
||||
set(CEF_HELPER_APP_SUFFIXES
|
||||
"::"
|
||||
" (Alerts):_alerts:.alerts"
|
||||
" (GPU):_gpu:.gpu"
|
||||
" (Plugin):_plugin:.plugin"
|
||||
" (Renderer):_renderer:.renderer"
|
||||
@@ -461,7 +462,7 @@ if(OS_WINDOWS)
|
||||
# only) uses fibers to switch to a 4MiB stack at runtime via
|
||||
# CefRunWinMainWithPreferredStackSize().
|
||||
list(APPEND CEF_EXE_LINKER_FLAGS
|
||||
/STACK:0x8000
|
||||
/STACK:0x80000
|
||||
)
|
||||
else()
|
||||
# Increase the initial stack size to 8MiB from the default 1MiB.
|
||||
@@ -492,6 +493,7 @@ if(OS_WINDOWS)
|
||||
# List of CEF binary files.
|
||||
set(CEF_BINARY_FILES
|
||||
chrome_elf.dll
|
||||
d3dcompiler_47.dll
|
||||
libcef.dll
|
||||
libEGL.dll
|
||||
libGLESv2.dll
|
||||
@@ -502,12 +504,6 @@ if(OS_WINDOWS)
|
||||
vulkan-1.dll
|
||||
)
|
||||
|
||||
if(NOT PROJECT_ARCH STREQUAL "arm64")
|
||||
list(APPEND CEF_BINARY_FILES
|
||||
d3dcompiler_47.dll
|
||||
)
|
||||
endif()
|
||||
|
||||
# List of CEF resource files.
|
||||
set(CEF_RESOURCE_FILES
|
||||
chrome_100_percent.pak
|
||||
@@ -538,9 +534,11 @@ if(OS_WINDOWS)
|
||||
psapi.lib
|
||||
SetupAPI.lib
|
||||
Shell32.lib
|
||||
Shcore.lib
|
||||
Userenv.lib
|
||||
version.lib
|
||||
wbemuuid.lib
|
||||
WindowsApp.lib
|
||||
winmm.lib
|
||||
)
|
||||
|
||||
|
@@ -251,13 +251,6 @@
|
||||
#define HAS_FEATURE(FEATURE) 0
|
||||
#endif
|
||||
|
||||
// Macro for telling -Wimplicit-fallthrough that a fallthrough is intentional.
|
||||
#if defined(__clang__)
|
||||
#define FALLTHROUGH [[clang::fallthrough]]
|
||||
#else
|
||||
#define FALLTHROUGH
|
||||
#endif
|
||||
|
||||
#if defined(COMPILER_GCC)
|
||||
#define PRETTY_FUNCTION __PRETTY_FUNCTION__
|
||||
#elif defined(COMPILER_MSVC)
|
||||
|
@@ -123,7 +123,7 @@ class SupportsWeakPtr;
|
||||
template <typename T>
|
||||
class WeakPtr;
|
||||
|
||||
namespace internal {
|
||||
namespace cef_internal {
|
||||
// These classes are part of the WeakPtr implementation.
|
||||
// DO NOT USE THESE CLASSES DIRECTLY YOURSELF.
|
||||
|
||||
@@ -197,7 +197,7 @@ class WeakPtrBase {
|
||||
WeakPtrBase& operator=(WeakPtrBase&& other) noexcept = default;
|
||||
|
||||
void reset() {
|
||||
ref_ = internal::WeakReference();
|
||||
ref_ = cef_internal::WeakReference();
|
||||
ptr_ = 0;
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ class SupportsWeakPtrBase {
|
||||
template <typename Derived>
|
||||
static WeakPtr<Derived> StaticAsWeakPtr(Derived* t) {
|
||||
static_assert(
|
||||
std::is_base_of<internal::SupportsWeakPtrBase, Derived>::value,
|
||||
std::is_base_of<cef_internal::SupportsWeakPtrBase, Derived>::value,
|
||||
"AsWeakPtr argument must inherit from SupportsWeakPtr");
|
||||
return AsWeakPtrImpl<Derived>(t);
|
||||
}
|
||||
@@ -242,7 +242,7 @@ class SupportsWeakPtrBase {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
} // namespace cef_internal
|
||||
|
||||
template <typename T>
|
||||
class WeakPtrFactory;
|
||||
@@ -264,7 +264,7 @@ class WeakPtrFactory;
|
||||
/// </pre>
|
||||
///
|
||||
template <typename T>
|
||||
class WeakPtr : public internal::WeakPtrBase {
|
||||
class WeakPtr : public cef_internal::WeakPtrBase {
|
||||
public:
|
||||
WeakPtr() = default;
|
||||
WeakPtr(std::nullptr_t) {}
|
||||
@@ -325,13 +325,13 @@ class WeakPtr : public internal::WeakPtrBase {
|
||||
bool WasInvalidated() const { return ptr_ && !ref_.IsValid(); }
|
||||
|
||||
private:
|
||||
friend class internal::SupportsWeakPtrBase;
|
||||
friend class cef_internal::SupportsWeakPtrBase;
|
||||
template <typename U>
|
||||
friend class WeakPtr;
|
||||
friend class SupportsWeakPtr<T>;
|
||||
friend class WeakPtrFactory<T>;
|
||||
|
||||
WeakPtr(const internal::WeakReference& ref, T* ptr)
|
||||
WeakPtr(const cef_internal::WeakReference& ref, T* ptr)
|
||||
: WeakPtrBase(ref, reinterpret_cast<uintptr_t>(ptr)) {}
|
||||
};
|
||||
|
||||
@@ -355,15 +355,15 @@ bool operator==(std::nullptr_t, const WeakPtr<T>& weak_ptr) {
|
||||
return weak_ptr == nullptr;
|
||||
}
|
||||
|
||||
namespace internal {
|
||||
namespace cef_internal {
|
||||
class WeakPtrFactoryBase {
|
||||
protected:
|
||||
WeakPtrFactoryBase(uintptr_t ptr);
|
||||
~WeakPtrFactoryBase();
|
||||
internal::WeakReferenceOwner weak_reference_owner_;
|
||||
cef_internal::WeakReferenceOwner weak_reference_owner_;
|
||||
uintptr_t ptr_;
|
||||
};
|
||||
} // namespace internal
|
||||
} // namespace cef_internal
|
||||
|
||||
///
|
||||
/// A class may be composed of a WeakPtrFactory and thereby control how it
|
||||
@@ -374,7 +374,7 @@ class WeakPtrFactoryBase {
|
||||
/// bool.
|
||||
///
|
||||
template <class T>
|
||||
class WeakPtrFactory : public internal::WeakPtrFactoryBase {
|
||||
class WeakPtrFactory : public cef_internal::WeakPtrFactoryBase {
|
||||
public:
|
||||
WeakPtrFactory() = delete;
|
||||
|
||||
@@ -416,7 +416,7 @@ class WeakPtrFactory : public internal::WeakPtrFactoryBase {
|
||||
/// destroyed, its use can lead to subtle use-after-destroy issues.
|
||||
///
|
||||
template <class T>
|
||||
class SupportsWeakPtr : public internal::SupportsWeakPtrBase {
|
||||
class SupportsWeakPtr : public cef_internal::SupportsWeakPtrBase {
|
||||
public:
|
||||
SupportsWeakPtr() = default;
|
||||
|
||||
@@ -431,7 +431,7 @@ class SupportsWeakPtr : public internal::SupportsWeakPtrBase {
|
||||
~SupportsWeakPtr() = default;
|
||||
|
||||
private:
|
||||
internal::WeakReferenceOwner weak_reference_owner_;
|
||||
cef_internal::WeakReferenceOwner weak_reference_owner_;
|
||||
};
|
||||
|
||||
///
|
||||
@@ -459,7 +459,7 @@ class SupportsWeakPtr : public internal::SupportsWeakPtrBase {
|
||||
///
|
||||
template <typename Derived>
|
||||
WeakPtr<Derived> AsWeakPtr(Derived* t) {
|
||||
return internal::SupportsWeakPtrBase::StaticAsWeakPtr<Derived>(t);
|
||||
return cef_internal::SupportsWeakPtrBase::StaticAsWeakPtr<Derived>(t);
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=46817ef557307a55a9b7138134c4f5c32562f2d7$
|
||||
// $hash=0cbb756a64d2aca1075480b5188b36cae533864d$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_COMMAND_HANDLER_CAPI_H_
|
||||
@@ -71,6 +71,46 @@ typedef struct _cef_command_handler_t {
|
||||
struct _cef_browser_t* browser,
|
||||
int command_id,
|
||||
cef_window_open_disposition_t disposition);
|
||||
|
||||
///
|
||||
/// Called to check if a Chrome app menu item should be visible. Values for
|
||||
/// |command_id| can be found in the cef_command_ids.h file. Only called for
|
||||
/// menu items that would be visible by default. Only used with the Chrome
|
||||
/// runtime.
|
||||
///
|
||||
int(CEF_CALLBACK* is_chrome_app_menu_item_visible)(
|
||||
struct _cef_command_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
int command_id);
|
||||
|
||||
///
|
||||
/// Called to check if a Chrome app menu item should be enabled. Values for
|
||||
/// |command_id| can be found in the cef_command_ids.h file. Only called for
|
||||
/// menu items that would be enabled by default. Only used with the Chrome
|
||||
/// runtime.
|
||||
///
|
||||
int(CEF_CALLBACK* is_chrome_app_menu_item_enabled)(
|
||||
struct _cef_command_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
int command_id);
|
||||
|
||||
///
|
||||
/// Called during browser creation to check if a Chrome page action icon
|
||||
/// should be visible. Only called for icons that would be visible by default.
|
||||
/// Only used with the Chrome runtime.
|
||||
///
|
||||
int(CEF_CALLBACK* is_chrome_page_action_icon_visible)(
|
||||
struct _cef_command_handler_t* self,
|
||||
cef_chrome_page_action_icon_type_t icon_type);
|
||||
|
||||
///
|
||||
/// Called during browser creation to check if a Chrome toolbar button should
|
||||
/// be visible. Only called for buttons that would be visible by default. Only
|
||||
/// used with the Chrome runtime.
|
||||
///
|
||||
int(CEF_CALLBACK* is_chrome_toolbar_button_visible)(
|
||||
struct _cef_command_handler_t* self,
|
||||
cef_chrome_toolbar_button_type_t button_type);
|
||||
} cef_command_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=332b9cb62b9c85573dc705aba4c9db3b34177e20$
|
||||
// $hash=d9e9f4b914ae2d3b1ed83ae0d9e2e46e9e736af5$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_DOWNLOAD_ITEM_CAPI_H_
|
||||
@@ -72,10 +72,21 @@ typedef struct _cef_download_item_t {
|
||||
int(CEF_CALLBACK* is_complete)(struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
/// Returns true (1) if the download has been canceled or interrupted.
|
||||
/// Returns true (1) if the download has been canceled.
|
||||
///
|
||||
int(CEF_CALLBACK* is_canceled)(struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
/// Returns true (1) if the download has been interrupted.
|
||||
///
|
||||
int(CEF_CALLBACK* is_interrupted)(struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
/// Returns the most recent interrupt reason.
|
||||
///
|
||||
cef_download_interrupt_reason_t(CEF_CALLBACK* get_interrupt_reason)(
|
||||
struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
/// Returns a simple speed estimate in bytes/s.
|
||||
///
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=b9b1308311999efcfd2aa678472f934ca783492c$
|
||||
// $hash=5bed8359f09a821f4b5ec8ebfad0aa5720bf39f9$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_FRAME_CAPI_H_
|
||||
@@ -216,24 +216,16 @@ typedef struct _cef_frame_t {
|
||||
|
||||
///
|
||||
/// Create a new URL request that will be treated as originating from this
|
||||
/// frame and the associated browser. This request may be intercepted by the
|
||||
/// client via cef_resource_request_handler_t or cef_scheme_handler_factory_t.
|
||||
/// Use cef_urlrequest_t::Create instead if you do not want the request to
|
||||
/// have this association, in which case it may be handled differently (see
|
||||
/// documentation on that function). Requests may originate from both the
|
||||
/// browser process and the render process.
|
||||
///
|
||||
/// For requests originating from the browser process:
|
||||
/// frame and the associated browser. Use cef_urlrequest_t::Create instead if
|
||||
/// you do not want the request to have this association, in which case it may
|
||||
/// be handled differently (see documentation on that function). A request
|
||||
/// created with this function may only originate from the browser process,
|
||||
/// and will behave as follows:
|
||||
/// - It may be intercepted by the client via CefResourceRequestHandler or
|
||||
/// CefSchemeHandlerFactory.
|
||||
/// - POST data may only contain a single element of type PDE_TYPE_FILE or
|
||||
/// PDE_TYPE_BYTES.
|
||||
///
|
||||
/// For requests originating from the render process:
|
||||
/// - POST data may only contain a single element of type PDE_TYPE_BYTES.
|
||||
/// - If the response contains Content-Disposition or Mime-Type header
|
||||
/// values that would not normally be rendered then the response may
|
||||
/// receive special handling inside the browser (for example, via the
|
||||
/// file download code path instead of the URL request code path).
|
||||
///
|
||||
/// The |request| object will be marked as read-only after calling this
|
||||
/// function.
|
||||
///
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=b564dfe24017a0805e393854d12791a71c46c454$
|
||||
// $hash=9330c709713a10c1e6b55278428e65c07f4c9dfb$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_ORIGIN_WHITELIST_CAPI_H_
|
||||
@@ -70,7 +70,7 @@ extern "C" {
|
||||
/// qualified |source_origin| URL (like http://www.example.com) will be allowed
|
||||
/// access to all resources hosted on the specified |target_protocol| and
|
||||
/// |target_domain|. If |target_domain| is non-NULL and
|
||||
/// |allow_target_subdomains| if false (0) only exact domain matches will be
|
||||
/// |allow_target_subdomains| is false (0) only exact domain matches will be
|
||||
/// allowed. If |target_domain| contains a top- level domain component (like
|
||||
/// "example.com") and |allow_target_subdomains| is true (1) sub-domain matches
|
||||
/// will be allowed. If |target_domain| is NULL and |allow_target_subdomains| if
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=e38c41a553d518abcd1b912d32281e99b93c4fd7$
|
||||
// $hash=94e93810316b74e54eb315d97c6fc6f1cc0c9cc5$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_BROWSER_VIEW_DELEGATE_CAPI_H_
|
||||
@@ -120,6 +120,18 @@ typedef struct _cef_browser_view_delegate_t {
|
||||
///
|
||||
cef_chrome_toolbar_type_t(CEF_CALLBACK* get_chrome_toolbar_type)(
|
||||
struct _cef_browser_view_delegate_t* self);
|
||||
|
||||
///
|
||||
/// Called when |browser_view| receives a gesture command. Return true (1) to
|
||||
/// handle (or disable) a |gesture_command| or false (0) to propagate the
|
||||
/// gesture to the browser for default handling. This function will only be
|
||||
/// called with the Alloy runtime. To handle these commands with the Chrome
|
||||
/// runtime implement cef_command_handler_t::OnChromeCommand instead.
|
||||
///
|
||||
int(CEF_CALLBACK* on_gesture_command)(
|
||||
struct _cef_browser_view_delegate_t* self,
|
||||
struct _cef_browser_view_t* browser_view,
|
||||
cef_gesture_command_t gesture_command);
|
||||
} cef_browser_view_delegate_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=019abf16be4e151d31181a6bdcb1ad8dfef03d00$
|
||||
// $hash=7201d268e16fc89f255b6ccd00d043f34fe77584$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_DELEGATE_CAPI_H_
|
||||
@@ -137,6 +137,25 @@ typedef struct _cef_window_delegate_t {
|
||||
int(CEF_CALLBACK* is_frameless)(struct _cef_window_delegate_t* self,
|
||||
struct _cef_window_t* window);
|
||||
|
||||
///
|
||||
/// Return true (1) if |window| should be created with standard window buttons
|
||||
/// like close, minimize and zoom. This function is only supported on macOS.
|
||||
///
|
||||
int(CEF_CALLBACK* with_standard_window_buttons)(
|
||||
struct _cef_window_delegate_t* self,
|
||||
struct _cef_window_t* window);
|
||||
|
||||
///
|
||||
/// Return whether the titlebar height should be overridden, and sets the
|
||||
/// height of the titlebar in |titlebar_height|. On macOS, it can also be used
|
||||
/// to adjust the vertical position of the traffic light buttons in frameless
|
||||
/// windows. The buttons will be positioned halfway down the titlebar at a
|
||||
/// height of |titlebar_height| / 2.
|
||||
///
|
||||
int(CEF_CALLBACK* get_titlebar_height)(struct _cef_window_delegate_t* self,
|
||||
struct _cef_window_t* window,
|
||||
float* titlebar_height);
|
||||
|
||||
///
|
||||
/// Return true (1) if |window| can be resized.
|
||||
///
|
||||
@@ -179,6 +198,17 @@ typedef struct _cef_window_delegate_t {
|
||||
int(CEF_CALLBACK* on_key_event)(struct _cef_window_delegate_t* self,
|
||||
struct _cef_window_t* window,
|
||||
const cef_key_event_t* event);
|
||||
|
||||
///
|
||||
/// Called when the |window| is transitioning to or from fullscreen mode. The
|
||||
/// transition occurs in two stages, with |is_competed| set to false (0) when
|
||||
/// the transition starts and true (1) when the transition completes. This
|
||||
/// function is only supported on macOS.
|
||||
///
|
||||
void(CEF_CALLBACK* on_window_fullscreen_transition)(
|
||||
struct _cef_window_delegate_t* self,
|
||||
struct _cef_window_t* window,
|
||||
int is_completed);
|
||||
} cef_window_delegate_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -42,13 +42,13 @@
|
||||
// way that may cause binary incompatibility with other builds. The universal
|
||||
// hash value will change if any platform is affected whereas the platform hash
|
||||
// values will change only if that particular platform is affected.
|
||||
#define CEF_API_HASH_UNIVERSAL "ec5797fa2a4dabdcf61183905db6b8ff2b79f9f0"
|
||||
#define CEF_API_HASH_UNIVERSAL "eb6257d3e4894dd51617d20588b7f0c3c8717301"
|
||||
#if defined(OS_WIN)
|
||||
#define CEF_API_HASH_PLATFORM "011499a93a394bf5fa92ebf0047de5ee1a4e5841"
|
||||
#define CEF_API_HASH_PLATFORM "3c99a150153b982d4d8b1a19e33b66a1d93fec21"
|
||||
#elif defined(OS_MAC)
|
||||
#define CEF_API_HASH_PLATFORM "8f276dfddb7341168f9ce0f705df212f08e2f08c"
|
||||
#define CEF_API_HASH_PLATFORM "b63aacf68a1fda1164948c24bab4f74abe046137"
|
||||
#elif defined(OS_LINUX)
|
||||
#define CEF_API_HASH_PLATFORM "3c239fa16f5a3f9f452b185c750c7145fc305274"
|
||||
#define CEF_API_HASH_PLATFORM "b12c839a3ea0dcb9705e543fc17fd3c1d9fa1e7c"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -45,9 +45,6 @@
|
||||
// Use the existing CrAppProtocol definition.
|
||||
#import "base/message_loop/message_pump_mac.h"
|
||||
|
||||
// Use the existing UnderlayableSurface definition.
|
||||
#import "ui/base/cocoa/underlay_opengl_hosting_window.h"
|
||||
|
||||
// Use the existing empty protocol definitions.
|
||||
#import "base/mac/cocoa_protocols.h"
|
||||
|
||||
@@ -70,13 +67,6 @@
|
||||
- (void)setHandlingSendEvent:(BOOL)handlingSendEvent;
|
||||
@end
|
||||
|
||||
// Copy of definition from ui/base/cocoa/underlay_opengl_hosting_window.h.
|
||||
// Common base class for windows that host a OpenGL surface that renders under
|
||||
// the window. Contains methods relating to hole punching so that the OpenGL
|
||||
// surface is visible through the window.
|
||||
@interface UnderlayOpenGLHostingWindow : NSWindow
|
||||
@end
|
||||
|
||||
#endif // USING_CHROMIUM_INCLUDES
|
||||
|
||||
// All CEF client applications must subclass NSApplication and implement this
|
||||
|
@@ -63,6 +63,52 @@ class CefCommandHandler : public virtual CefBaseRefCounted {
|
||||
cef_window_open_disposition_t disposition) {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
/// Called to check if a Chrome app menu item should be visible. Values for
|
||||
/// |command_id| can be found in the cef_command_ids.h file. Only called for
|
||||
/// menu items that would be visible by default. Only used with the Chrome
|
||||
/// runtime.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsChromeAppMenuItemVisible(CefRefPtr<CefBrowser> browser,
|
||||
int command_id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
///
|
||||
/// Called to check if a Chrome app menu item should be enabled. Values for
|
||||
/// |command_id| can be found in the cef_command_ids.h file. Only called for
|
||||
/// menu items that would be enabled by default. Only used with the Chrome
|
||||
/// runtime.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsChromeAppMenuItemEnabled(CefRefPtr<CefBrowser> browser,
|
||||
int command_id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
///
|
||||
/// Called during browser creation to check if a Chrome page action icon
|
||||
/// should be visible. Only called for icons that would be visible by default.
|
||||
/// Only used with the Chrome runtime.
|
||||
///
|
||||
/*--cef(optional_param=browser)--*/
|
||||
virtual bool IsChromePageActionIconVisible(
|
||||
cef_chrome_page_action_icon_type_t icon_type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
///
|
||||
/// Called during browser creation to check if a Chrome toolbar button
|
||||
/// should be visible. Only called for buttons that would be visible by
|
||||
/// default. Only used with the Chrome runtime.
|
||||
///
|
||||
/*--cef(optional_param=browser)--*/
|
||||
virtual bool IsChromeToolbarButtonVisible(
|
||||
cef_chrome_toolbar_button_type_t button_type) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_COMMAND_HANDLER_H_
|
||||
|
@@ -66,11 +66,23 @@ class CefDownloadItem : public virtual CefBaseRefCounted {
|
||||
virtual bool IsComplete() = 0;
|
||||
|
||||
///
|
||||
/// Returns true if the download has been canceled or interrupted.
|
||||
/// Returns true if the download has been canceled.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsCanceled() = 0;
|
||||
|
||||
///
|
||||
/// Returns true if the download has been interrupted.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsInterrupted() = 0;
|
||||
|
||||
///
|
||||
/// Returns the most recent interrupt reason.
|
||||
///
|
||||
/*--cef(default_retval=CEF_DOWNLOAD_INTERRUPT_REASON_NONE)--*/
|
||||
virtual cef_download_interrupt_reason_t GetInterruptReason() = 0;
|
||||
|
||||
///
|
||||
/// Returns a simple speed estimate in bytes/s.
|
||||
///
|
||||
|
@@ -221,24 +221,16 @@ class CefFrame : public virtual CefBaseRefCounted {
|
||||
|
||||
///
|
||||
/// Create a new URL request that will be treated as originating from this
|
||||
/// frame and the associated browser. This request may be intercepted by the
|
||||
/// client via CefResourceRequestHandler or CefSchemeHandlerFactory. Use
|
||||
/// CefURLRequest::Create instead if you do not want the request to have this
|
||||
/// association, in which case it may be handled differently (see
|
||||
/// documentation on that method). Requests may originate from both the
|
||||
/// browser process and the render process.
|
||||
///
|
||||
/// For requests originating from the browser process:
|
||||
/// frame and the associated browser. Use CefURLRequest::Create instead if you
|
||||
/// do not want the request to have this association, in which case it may be
|
||||
/// handled differently (see documentation on that method). A request created
|
||||
/// with this method may only originate from the browser process, and will
|
||||
/// behave as follows:
|
||||
/// - It may be intercepted by the client via CefResourceRequestHandler or
|
||||
/// CefSchemeHandlerFactory.
|
||||
/// - POST data may only contain a single element of type PDE_TYPE_FILE or
|
||||
/// PDE_TYPE_BYTES.
|
||||
///
|
||||
/// For requests originating from the render process:
|
||||
/// - POST data may only contain a single element of type PDE_TYPE_BYTES.
|
||||
/// - If the response contains Content-Disposition or Mime-Type header
|
||||
/// values that would not normally be rendered then the response may
|
||||
/// receive special handling inside the browser (for example, via the
|
||||
/// file download code path instead of the URL request code path).
|
||||
///
|
||||
/// The |request| object will be marked as read-only after calling this
|
||||
/// method.
|
||||
///
|
||||
|
@@ -63,7 +63,7 @@
|
||||
/// the same-origin policy. Scripts hosted underneath the fully qualified
|
||||
/// |source_origin| URL (like http://www.example.com) will be allowed access to
|
||||
/// all resources hosted on the specified |target_protocol| and |target_domain|.
|
||||
/// If |target_domain| is non-empty and |allow_target_subdomains| if false only
|
||||
/// If |target_domain| is non-empty and |allow_target_subdomains| is false only
|
||||
/// exact domain matches will be allowed. If |target_domain| contains a top-
|
||||
/// level domain component (like "example.com") and |allow_target_subdomains| is
|
||||
/// true sub-domain matches will be allowed. If |target_domain| is empty and
|
||||
|
@@ -86,13 +86,6 @@ CEF_EXPORT int cef_run_main_with_preferred_stack_size(mainPtr main,
|
||||
char* argv[]);
|
||||
#endif // defined(ARCH_CPU_32_BITS)
|
||||
|
||||
///
|
||||
/// Call during process startup to enable High-DPI support on Windows 7 or
|
||||
/// newer. Older versions of Windows should be left DPI-unaware because they do
|
||||
/// not support DirectWrite and GDI fonts are kerned very badly.
|
||||
///
|
||||
CEF_EXPORT void cef_enable_highdpi_support(void);
|
||||
|
||||
///
|
||||
/// Set to true (1) before calling Windows APIs like TrackPopupMenu that enter a
|
||||
/// modal message loop. Set to false (0) after exiting the modal message loop.
|
||||
|
@@ -41,7 +41,7 @@ extern "C" {
|
||||
///
|
||||
/// CEF string maps are a set of key/value string pairs.
|
||||
///
|
||||
typedef void* cef_string_list_t;
|
||||
typedef struct _cef_string_list_t* cef_string_list_t;
|
||||
|
||||
///
|
||||
/// Allocate a new string map.
|
||||
|
@@ -41,7 +41,7 @@ extern "C" {
|
||||
///
|
||||
/// CEF string maps are a set of key/value string pairs.
|
||||
///
|
||||
typedef void* cef_string_map_t;
|
||||
typedef struct _cef_string_map_t* cef_string_map_t;
|
||||
|
||||
///
|
||||
/// Allocate a new string map.
|
||||
@@ -75,7 +75,8 @@ CEF_EXPORT int cef_string_map_value(cef_string_map_t map,
|
||||
cef_string_t* value);
|
||||
|
||||
///
|
||||
/// Append a new key/value pair at the end of the string map.
|
||||
/// Append a new key/value pair at the end of the string map. If the key exists,
|
||||
/// overwrite the existing value with a new value w/o changing the pair order.
|
||||
///
|
||||
CEF_EXPORT int cef_string_map_append(cef_string_map_t map,
|
||||
const cef_string_t* key,
|
||||
|
@@ -42,7 +42,7 @@ extern "C" {
|
||||
/// CEF string multimaps are a set of key/value string pairs.
|
||||
/// More than one value can be assigned to a single key.
|
||||
///
|
||||
typedef void* cef_string_multimap_t;
|
||||
typedef struct _cef_string_multimap_t* cef_string_multimap_t;
|
||||
|
||||
///
|
||||
/// Allocate a new string multimap.
|
||||
|
@@ -122,7 +122,7 @@ CEF_EXPORT int cef_time_now(cef_time_t* cef_time);
|
||||
///
|
||||
/// Retrieve the current system time.
|
||||
///
|
||||
CEF_EXPORT cef_basetime_t cef_basetime_now();
|
||||
CEF_EXPORT cef_basetime_t cef_basetime_now(void);
|
||||
|
||||
///
|
||||
/// Retrieve the delta in milliseconds between two time values. Returns true (1)
|
||||
|
@@ -3000,8 +3000,8 @@ typedef enum {
|
||||
/// Structure representing a range.
|
||||
///
|
||||
typedef struct _cef_range_t {
|
||||
int from;
|
||||
int to;
|
||||
uint32_t from;
|
||||
uint32_t to;
|
||||
} cef_range_t;
|
||||
|
||||
///
|
||||
@@ -3251,7 +3251,7 @@ typedef enum {
|
||||
} cef_text_field_commands_t;
|
||||
|
||||
///
|
||||
/// Supported Chrome toolbar types.
|
||||
/// Chrome toolbar types.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_CTT_NONE = 1,
|
||||
@@ -3259,6 +3259,51 @@ typedef enum {
|
||||
CEF_CTT_LOCATION,
|
||||
} cef_chrome_toolbar_type_t;
|
||||
|
||||
///
|
||||
/// Chrome page action icon types. Should be kept in sync with Chromium's
|
||||
/// PageActionIconType type.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_CPAIT_BOOKMARK_STAR = 0,
|
||||
CEF_CPAIT_CLICK_TO_CALL,
|
||||
CEF_CPAIT_COOKIE_CONTROLS,
|
||||
CEF_CPAIT_FILE_SYSTEM_ACCESS,
|
||||
CEF_CPAIT_FIND,
|
||||
CEF_CPAIT_HIGH_EFFICIENCY,
|
||||
CEF_CPAIT_INTENT_PICKER,
|
||||
CEF_CPAIT_LOCAL_CARD_MIGRATION,
|
||||
CEF_CPAIT_MANAGE_PASSWORDS,
|
||||
CEF_CPAIT_PAYMENTS_OFFER_NOTIFICATION,
|
||||
CEF_CPAIT_PRICE_TRACKING,
|
||||
CEF_CPAIT_PWA_INSTALL,
|
||||
CEF_CPAIT_QR_CODE_GENERATOR,
|
||||
CEF_CPAIT_READER_MODE,
|
||||
CEF_CPAIT_SAVE_AUTOFILL_ADDRESS,
|
||||
CEF_CPAIT_SAVE_CARD,
|
||||
CEF_CPAIT_SEND_TAB_TO_SELF,
|
||||
CEF_CPAIT_SHARING_HUB,
|
||||
CEF_CPAIT_SIDE_SEARCH,
|
||||
CEF_CPAIT_SMS_REMOTE_FETCHER,
|
||||
CEF_CPAIT_TRANSLATE,
|
||||
CEF_CPAIT_VIRTUAL_CARD_ENROLL,
|
||||
CEF_CPAIT_VIRTUAL_CARD_MANUAL_FALLBACK,
|
||||
CEF_CPAIT_ZOOM,
|
||||
CEF_CPAIT_SAVE_IBAN,
|
||||
CEF_CPAIT_MAX_VALUE = CEF_CPAIT_SAVE_IBAN,
|
||||
} cef_chrome_page_action_icon_type_t;
|
||||
|
||||
///
|
||||
/// Chrome toolbar button types. Should be kept in sync with CEF's internal
|
||||
/// ToolbarButtonType type.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_CTBT_CAST = 0,
|
||||
CEF_CTBT_DOWNLOAD,
|
||||
CEF_CTBT_SEND_TAB_TO_SELF,
|
||||
CEF_CTBT_SIDE_PANEL,
|
||||
CEF_CTBT_MAX_VALUE = CEF_CTBT_SIDE_PANEL,
|
||||
} cef_chrome_toolbar_button_type_t;
|
||||
|
||||
///
|
||||
/// Docking modes supported by CefWindow::AddOverlay.
|
||||
///
|
||||
@@ -3443,6 +3488,131 @@ typedef enum {
|
||||
CEF_PREFERENCES_TYPE_REQUEST_CONTEXT,
|
||||
} cef_preferences_type_t;
|
||||
|
||||
///
|
||||
/// Download interrupt reasons. Should be kept in sync with
|
||||
/// Chromium's download::DownloadInterruptReason type.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_NONE = 0,
|
||||
|
||||
/// Generic file operation failure.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_FILE_FAILED = 1,
|
||||
|
||||
/// The file cannot be accessed due to security restrictions.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_FILE_ACCESS_DENIED = 2,
|
||||
|
||||
/// There is not enough room on the drive.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE = 3,
|
||||
|
||||
/// The directory or file name is too long.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_FILE_NAME_TOO_LONG = 5,
|
||||
|
||||
/// The file is too large for the file system to handle.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_FILE_TOO_LARGE = 6,
|
||||
|
||||
/// The file contains a virus.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_FILE_VIRUS_INFECTED = 7,
|
||||
|
||||
/// The file was in use. Too many files are opened at once. We have run out of
|
||||
/// memory.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_FILE_TRANSIENT_ERROR = 10,
|
||||
|
||||
/// The file was blocked due to local policy.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_FILE_BLOCKED = 11,
|
||||
|
||||
/// An attempt to check the safety of the download failed due to unexpected
|
||||
/// reasons. See http://crbug.com/153212.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_FILE_SECURITY_CHECK_FAILED = 12,
|
||||
|
||||
/// An attempt was made to seek past the end of a file in opening
|
||||
/// a file (as part of resuming a previously interrupted download).
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_FILE_TOO_SHORT = 13,
|
||||
|
||||
/// The partial file didn't match the expected hash.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_FILE_HASH_MISMATCH = 14,
|
||||
|
||||
/// The source and the target of the download were the same.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_FILE_SAME_AS_SOURCE = 15,
|
||||
|
||||
// Network errors.
|
||||
|
||||
/// Generic network failure.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED = 20,
|
||||
|
||||
/// The network operation timed out.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_NETWORK_TIMEOUT = 21,
|
||||
|
||||
/// The network connection has been lost.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED = 22,
|
||||
|
||||
/// The server has gone down.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_NETWORK_SERVER_DOWN = 23,
|
||||
|
||||
/// The network request was invalid. This may be due to the original URL or a
|
||||
/// redirected URL:
|
||||
/// - Having an unsupported scheme.
|
||||
/// - Being an invalid URL.
|
||||
/// - Being disallowed by policy.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST = 24,
|
||||
|
||||
// Server responses.
|
||||
|
||||
/// The server indicates that the operation has failed (generic).
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_SERVER_FAILED = 30,
|
||||
|
||||
/// The server does not support range requests.
|
||||
/// Internal use only: must restart from the beginning.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE = 31,
|
||||
|
||||
/// The server does not have the requested data.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT = 33,
|
||||
|
||||
/// Server didn't authorize access to resource.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_SERVER_UNAUTHORIZED = 34,
|
||||
|
||||
/// Server certificate problem.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_SERVER_CERT_PROBLEM = 35,
|
||||
|
||||
/// Server access forbidden.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_SERVER_FORBIDDEN = 36,
|
||||
|
||||
/// Unexpected server response. This might indicate that the responding server
|
||||
/// may not be the intended server.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_SERVER_UNREACHABLE = 37,
|
||||
|
||||
/// The server sent fewer bytes than the content-length header. It may
|
||||
/// indicate that the connection was closed prematurely, or the Content-Length
|
||||
/// header was invalid. The download is only interrupted if strong validators
|
||||
/// are present. Otherwise, it is treated as finished.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_SERVER_CONTENT_LENGTH_MISMATCH = 38,
|
||||
|
||||
/// An unexpected cross-origin redirect happened.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_SERVER_CROSS_ORIGIN_REDIRECT = 39,
|
||||
|
||||
// User input.
|
||||
|
||||
/// The user canceled the download.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_USER_CANCELED = 40,
|
||||
|
||||
/// The user shut down the browser.
|
||||
/// Internal use only: resume pending downloads if possible.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_USER_SHUTDOWN = 41,
|
||||
|
||||
// Crash.
|
||||
|
||||
/// The browser crashed.
|
||||
/// Internal use only: resume pending downloads if possible.
|
||||
CEF_DOWNLOAD_INTERRUPT_REASON_CRASH = 50,
|
||||
} cef_download_interrupt_reason_t;
|
||||
|
||||
///
|
||||
/// Specifies the gesture commands.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_GESTURE_COMMAND_BACK,
|
||||
CEF_GESTURE_COMMAND_FORWARD,
|
||||
} cef_gesture_command_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -31,6 +31,8 @@
|
||||
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_WRAPPERS_H_
|
||||
#pragma once
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "include/internal/cef_string.h"
|
||||
#include "include/internal/cef_string_list.h"
|
||||
#include "include/internal/cef_types.h"
|
||||
@@ -215,7 +217,12 @@ class CefRange : public cef_range_t {
|
||||
public:
|
||||
CefRange() : cef_range_t{} {}
|
||||
CefRange(const cef_range_t& r) : cef_range_t(r) {}
|
||||
CefRange(int from, int to) : cef_range_t{from, to} {}
|
||||
CefRange(uint32_t from, uint32_t to) : cef_range_t{from, to} {}
|
||||
|
||||
static CefRange InvalidRange() {
|
||||
return CefRange((std::numeric_limits<uint32_t>::max)(),
|
||||
(std::numeric_limits<uint32_t>::max)());
|
||||
}
|
||||
|
||||
void Set(int from_val, int to_val) { from = from_val, to = to_val; }
|
||||
};
|
||||
|
@@ -168,13 +168,6 @@ int CefRunWinMainWithPreferredStackSize(wWinMainPtr wWinMain,
|
||||
int CefRunMainWithPreferredStackSize(mainPtr main, int argc, char* argv[]);
|
||||
#endif // defined(ARCH_CPU_32_BITS)
|
||||
|
||||
///
|
||||
/// Call during process startup to enable High-DPI support on Windows 7 or
|
||||
/// newer. Older versions of Windows should be left DPI-unaware because they do
|
||||
/// not support DirectWrite and GDI fonts are kerned very badly.
|
||||
///
|
||||
void CefEnableHighDPISupport();
|
||||
|
||||
///
|
||||
/// Set to true before calling Windows APIs like TrackPopupMenu that enter a
|
||||
/// modal message loop. Set to false after exiting the modal message loop.
|
||||
|
@@ -81,7 +81,7 @@ class CefBrowserViewDelegate : public CefViewDelegate {
|
||||
/// popup will be a DevTools browser. Return the delegate that will be used
|
||||
/// for the new popup BrowserView.
|
||||
///
|
||||
/*--cef()--*/
|
||||
/*--cef(optional_param=client)--*/
|
||||
virtual CefRefPtr<CefBrowserViewDelegate> GetDelegateForPopupBrowserView(
|
||||
CefRefPtr<CefBrowserView> browser_view,
|
||||
const CefBrowserSettings& settings,
|
||||
@@ -114,6 +114,19 @@ class CefBrowserViewDelegate : public CefViewDelegate {
|
||||
///
|
||||
/*--cef(default_retval=CEF_CTT_NONE)--*/
|
||||
virtual ChromeToolbarType GetChromeToolbarType() { return CEF_CTT_NONE; }
|
||||
|
||||
///
|
||||
/// Called when |browser_view| receives a gesture command. Return true to
|
||||
/// handle (or disable) a |gesture_command| or false to propagate the gesture
|
||||
/// to the browser for default handling. This method will only be called with
|
||||
/// the Alloy runtime. To handle these commands with the Chrome runtime
|
||||
/// implement CefCommandHandler::OnChromeCommand instead.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool OnGestureCommand(CefRefPtr<CefBrowserView> browser_view,
|
||||
cef_gesture_command_t gesture_command) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_VIEWS_CEF_BROWSER_VIEW_DELEGATE_H_
|
||||
|
@@ -128,6 +128,29 @@ class CefWindowDelegate : public CefPanelDelegate {
|
||||
/*--cef()--*/
|
||||
virtual bool IsFrameless(CefRefPtr<CefWindow> window) { return false; }
|
||||
|
||||
///
|
||||
/// Return true if |window| should be created with standard window buttons
|
||||
/// like close, minimize and zoom. This method is only supported on macOS.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool WithStandardWindowButtons(CefRefPtr<CefWindow> window) {
|
||||
return !IsFrameless(window);
|
||||
}
|
||||
|
||||
///
|
||||
/// Return whether the titlebar height should be overridden,
|
||||
/// and sets the height of the titlebar in |titlebar_height|.
|
||||
/// On macOS, it can also be used to adjust the vertical position
|
||||
/// of the traffic light buttons in frameless windows.
|
||||
/// The buttons will be positioned halfway down the titlebar
|
||||
/// at a height of |titlebar_height| / 2.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool GetTitlebarHeight(CefRefPtr<CefWindow> window,
|
||||
float* titlebar_height) {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
/// Return true if |window| can be resized.
|
||||
///
|
||||
@@ -173,6 +196,16 @@ class CefWindowDelegate : public CefPanelDelegate {
|
||||
const CefKeyEvent& event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
/// Called when the |window| is transitioning to or from fullscreen mode. The
|
||||
/// transition occurs in two stages, with |is_competed| set to false when the
|
||||
/// transition starts and true when the transition completes.
|
||||
/// This method is only supported on macOS.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnWindowFullscreenTransition(CefRefPtr<CefWindow> window,
|
||||
bool is_completed) {}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_VIEWS_CEF_WINDOW_DELEGATE_H_
|
||||
|
@@ -440,30 +440,36 @@ ProfileKey* AlloyBrowserContext::GetProfileKey() const {
|
||||
|
||||
policy::SchemaRegistryService*
|
||||
AlloyBrowserContext::GetPolicySchemaRegistryService() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
policy::UserCloudPolicyManager*
|
||||
AlloyBrowserContext::GetUserCloudPolicyManager() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
policy::ProfileCloudPolicyManager*
|
||||
AlloyBrowserContext::GetProfileCloudPolicyManager() {
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
policy::ProfilePolicyConnector*
|
||||
AlloyBrowserContext::GetProfilePolicyConnector() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const policy::ProfilePolicyConnector*
|
||||
AlloyBrowserContext::GetProfilePolicyConnector() const {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool AlloyBrowserContext::IsNewProfile() const {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -94,6 +94,7 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
|
||||
ProfileKey* GetProfileKey() const override;
|
||||
policy::SchemaRegistryService* GetPolicySchemaRegistryService() override;
|
||||
policy::UserCloudPolicyManager* GetUserCloudPolicyManager() override;
|
||||
policy::ProfileCloudPolicyManager* GetProfileCloudPolicyManager() override;
|
||||
policy::ProfilePolicyConnector* GetProfilePolicyConnector() override;
|
||||
const policy::ProfilePolicyConnector* GetProfilePolicyConnector()
|
||||
const override;
|
||||
|
@@ -296,7 +296,7 @@ void AlloyBrowserHostImpl::CloseBrowser(bool force_close) {
|
||||
|
||||
bool AlloyBrowserHostImpl::TryCloseBrowser() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
NOTREACHED() << "called on invalid thread";
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ CefWindowHandle AlloyBrowserHostImpl::GetOpenerWindowHandle() {
|
||||
double AlloyBrowserHostImpl::GetZoomLevel() {
|
||||
// Verify that this method is being called on the UI thread.
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
NOTREACHED() << "called on invalid thread";
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -416,7 +416,7 @@ void AlloyBrowserHostImpl::CloseDevTools() {
|
||||
|
||||
bool AlloyBrowserHostImpl::HasDevTools() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
NOTREACHED() << "called on invalid thread";
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -481,7 +481,7 @@ void AlloyBrowserHostImpl::WasResized() {
|
||||
|
||||
void AlloyBrowserHostImpl::WasHidden(bool hidden) {
|
||||
if (!IsWindowless()) {
|
||||
NOTREACHED() << "Window rendering is not disabled";
|
||||
DCHECK(false) << "Window rendering is not disabled";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -498,7 +498,7 @@ void AlloyBrowserHostImpl::WasHidden(bool hidden) {
|
||||
|
||||
void AlloyBrowserHostImpl::NotifyScreenInfoChanged() {
|
||||
if (!IsWindowless()) {
|
||||
NOTREACHED() << "Window rendering is not disabled";
|
||||
DCHECK(false) << "Window rendering is not disabled";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -516,7 +516,7 @@ void AlloyBrowserHostImpl::NotifyScreenInfoChanged() {
|
||||
|
||||
void AlloyBrowserHostImpl::Invalidate(PaintElementType type) {
|
||||
if (!IsWindowless()) {
|
||||
NOTREACHED() << "Window rendering is not disabled";
|
||||
DCHECK(false) << "Window rendering is not disabled";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -533,7 +533,7 @@ void AlloyBrowserHostImpl::Invalidate(PaintElementType type) {
|
||||
|
||||
void AlloyBrowserHostImpl::SendExternalBeginFrame() {
|
||||
if (!IsWindowless()) {
|
||||
NOTREACHED() << "Window rendering is not disabled";
|
||||
DCHECK(false) << "Window rendering is not disabled";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -551,7 +551,7 @@ void AlloyBrowserHostImpl::SendExternalBeginFrame() {
|
||||
|
||||
void AlloyBrowserHostImpl::SendTouchEvent(const CefTouchEvent& event) {
|
||||
if (!IsWindowless()) {
|
||||
NOTREACHED() << "Window rendering is not disabled";
|
||||
DCHECK(false) << "Window rendering is not disabled";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -582,7 +582,7 @@ void AlloyBrowserHostImpl::SendCaptureLostEvent() {
|
||||
int AlloyBrowserHostImpl::GetWindowlessFrameRate() {
|
||||
// Verify that this method is being called on the UI thread.
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
NOTREACHED() << "called on invalid thread";
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -795,7 +795,7 @@ void AlloyBrowserHostImpl::ImeSetComposition(
|
||||
const CefRange& replacement_range,
|
||||
const CefRange& selection_range) {
|
||||
if (!IsWindowless()) {
|
||||
NOTREACHED() << "Window rendering is not disabled";
|
||||
DCHECK(false) << "Window rendering is not disabled";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -817,7 +817,7 @@ void AlloyBrowserHostImpl::ImeCommitText(const CefString& text,
|
||||
const CefRange& replacement_range,
|
||||
int relative_cursor_pos) {
|
||||
if (!IsWindowless()) {
|
||||
NOTREACHED() << "Window rendering is not disabled";
|
||||
DCHECK(false) << "Window rendering is not disabled";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -836,7 +836,7 @@ void AlloyBrowserHostImpl::ImeCommitText(const CefString& text,
|
||||
|
||||
void AlloyBrowserHostImpl::ImeFinishComposingText(bool keep_selection) {
|
||||
if (!IsWindowless()) {
|
||||
NOTREACHED() << "Window rendering is not disabled";
|
||||
DCHECK(false) << "Window rendering is not disabled";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -854,7 +854,7 @@ void AlloyBrowserHostImpl::ImeFinishComposingText(bool keep_selection) {
|
||||
|
||||
void AlloyBrowserHostImpl::ImeCancelComposition() {
|
||||
if (!IsWindowless()) {
|
||||
NOTREACHED() << "Window rendering is not disabled";
|
||||
DCHECK(false) << "Window rendering is not disabled";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -875,7 +875,7 @@ void AlloyBrowserHostImpl::DragTargetDragEnter(
|
||||
const CefMouseEvent& event,
|
||||
CefBrowserHost::DragOperationsMask allowed_ops) {
|
||||
if (!IsWindowless()) {
|
||||
NOTREACHED() << "Window rendering is not disabled";
|
||||
DCHECK(false) << "Window rendering is not disabled";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -887,7 +887,7 @@ void AlloyBrowserHostImpl::DragTargetDragEnter(
|
||||
}
|
||||
|
||||
if (!drag_data.get()) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -900,7 +900,7 @@ void AlloyBrowserHostImpl::DragTargetDragOver(
|
||||
const CefMouseEvent& event,
|
||||
CefBrowserHost::DragOperationsMask allowed_ops) {
|
||||
if (!IsWindowless()) {
|
||||
NOTREACHED() << "Window rendering is not disabled";
|
||||
DCHECK(false) << "Window rendering is not disabled";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -918,7 +918,7 @@ void AlloyBrowserHostImpl::DragTargetDragOver(
|
||||
|
||||
void AlloyBrowserHostImpl::DragTargetDragLeave() {
|
||||
if (!IsWindowless()) {
|
||||
NOTREACHED() << "Window rendering is not disabled";
|
||||
DCHECK(false) << "Window rendering is not disabled";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -936,7 +936,7 @@ void AlloyBrowserHostImpl::DragTargetDragLeave() {
|
||||
|
||||
void AlloyBrowserHostImpl::DragTargetDrop(const CefMouseEvent& event) {
|
||||
if (!IsWindowless()) {
|
||||
NOTREACHED() << "Window rendering is not disabled";
|
||||
DCHECK(false) << "Window rendering is not disabled";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -953,7 +953,7 @@ void AlloyBrowserHostImpl::DragTargetDrop(const CefMouseEvent& event) {
|
||||
|
||||
void AlloyBrowserHostImpl::DragSourceSystemDragEnded() {
|
||||
if (!IsWindowless()) {
|
||||
NOTREACHED() << "Window rendering is not disabled";
|
||||
DCHECK(false) << "Window rendering is not disabled";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -974,7 +974,7 @@ void AlloyBrowserHostImpl::DragSourceEndedAt(
|
||||
int y,
|
||||
CefBrowserHost::DragOperationsMask op) {
|
||||
if (!IsWindowless()) {
|
||||
NOTREACHED() << "Window rendering is not disabled";
|
||||
DCHECK(false) << "Window rendering is not disabled";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1004,7 +1004,7 @@ void AlloyBrowserHostImpl::SetAudioMuted(bool mute) {
|
||||
|
||||
bool AlloyBrowserHostImpl::IsAudioMuted() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
NOTREACHED() << "called on invalid thread";
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return false;
|
||||
}
|
||||
if (!web_contents()) {
|
||||
@@ -1227,7 +1227,7 @@ void AlloyBrowserHostImpl::WebContentsCreated(
|
||||
target_url,
|
||||
frame_util::MakeGlobalId(opener_render_process_id,
|
||||
opener_render_frame_id),
|
||||
settings, client, platform_delegate, extra_info);
|
||||
settings, client, platform_delegate, extra_info, new_contents);
|
||||
|
||||
scoped_refptr<CefBrowserInfo> info =
|
||||
CefBrowserInfoManager::GetInstance()->CreatePopupBrowserInfo(
|
||||
|
@@ -29,6 +29,7 @@
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/browser/media/router/chrome_media_router_factory.h"
|
||||
#include "chrome/browser/net/system_network_context_manager.h"
|
||||
#include "chrome/browser/ui/color/chrome_color_mixers.h"
|
||||
#include "chrome/browser/ui/javascript_dialogs/chrome_javascript_app_modal_dialog_view_factory.h"
|
||||
#include "chrome/browser/ui/ui_features.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
@@ -41,6 +42,7 @@
|
||||
#include "net/base/net_module.h"
|
||||
#include "third_party/widevine/cdm/buildflags.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
#include "ui/native_theme/native_theme.h"
|
||||
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
#include "ui/ozone/buildflags.h"
|
||||
@@ -73,7 +75,7 @@
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
|
||||
#include "components/os_crypt/os_crypt.h"
|
||||
#include "components/os_crypt/sync/os_crypt.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
@@ -82,7 +84,7 @@
|
||||
#include "chrome/browser/ui/views/theme_profile_key.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "chrome/grit/chromium_strings.h"
|
||||
#include "components/os_crypt/key_storage_config_linux.h"
|
||||
#include "components/os_crypt/sync/key_storage_config_linux.h"
|
||||
#include "libcef/browser/printing/print_dialog_linux.h"
|
||||
#include "ui/base/cursor/cursor_factory.h"
|
||||
#include "ui/base/ime/input_method.h"
|
||||
@@ -186,6 +188,11 @@ void AlloyBrowserMainParts::ToolkitInitialized() {
|
||||
#else
|
||||
InstallChromeJavaScriptAppModalDialogViewFactory();
|
||||
#endif
|
||||
|
||||
// On GTK that builds the native theme that, in turn, adds the GTK core color
|
||||
// mixer; core mixers should all be added before we add chrome mixers.
|
||||
ui::ColorProviderManager::Get().AppendColorProviderInitializer(
|
||||
base::BindRepeating(AddChromeColorMixers));
|
||||
}
|
||||
|
||||
void AlloyBrowserMainParts::PreCreateMainMessageLoop() {
|
||||
@@ -308,6 +315,9 @@ int AlloyBrowserMainParts::PreMainMessageLoopRun() {
|
||||
file_dialog_runner::RegisterFactory();
|
||||
permission_prompt::RegisterCreateCallback();
|
||||
|
||||
// Initialize theme configuration (high contrast, dark mode, etc).
|
||||
ui::NativeTheme::GetInstanceForNativeUi();
|
||||
|
||||
#if BUILDFLAG(ENABLE_MEDIA_FOUNDATION_WIDEVINE_CDM) || \
|
||||
BUILDFLAG(ENABLE_WIDEVINE_CDM_COMPONENT)
|
||||
const base::CommandLine* command_line =
|
||||
|
@@ -52,7 +52,6 @@
|
||||
#include "base/stl_util.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "cef/grit/cef_resources.h"
|
||||
#include "chrome/browser/accessibility/live_caption_unavailability_notifier.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/browser/content_settings/cookie_settings_factory.h"
|
||||
#include "chrome/browser/extensions/chrome_content_browser_client_extensions_part.h"
|
||||
@@ -82,6 +81,7 @@
|
||||
#include "chrome/grit/browser_resources.h"
|
||||
#include "chrome/grit/generated_resources.h"
|
||||
#include "chrome/services/printing/printing_service.h"
|
||||
#include "chrome/services/speech/buildflags/buildflags.h"
|
||||
#include "components/content_settings/core/browser/cookie_settings.h"
|
||||
#include "components/embedder_support/switches.h"
|
||||
#include "components/embedder_support/user_agent_utils.h"
|
||||
@@ -89,6 +89,7 @@
|
||||
#include "components/pdf/browser/pdf_url_loader_request_interceptor.h"
|
||||
#include "components/pdf/browser/pdf_web_contents_helper.h"
|
||||
#include "components/pdf/common/internal_plugin_helpers.h"
|
||||
#include "components/policy/core/common/policy_pref_names.h"
|
||||
#include "components/spellcheck/common/spellcheck.mojom.h"
|
||||
#include "components/version_info/version_info.h"
|
||||
#include "content/browser/plugin_service_impl.h"
|
||||
@@ -119,7 +120,6 @@
|
||||
#include "extensions/browser/extensions_browser_client.h"
|
||||
#include "extensions/browser/guest_view/extensions_guest_view.h"
|
||||
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
|
||||
#include "extensions/browser/info_map.h"
|
||||
#include "extensions/browser/process_map.h"
|
||||
#include "extensions/browser/renderer_startup_helper.h"
|
||||
#include "extensions/browser/url_loader_factory_manager.h"
|
||||
@@ -157,9 +157,12 @@
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#if BUILDFLAG(ENABLE_SPEECH_SERVICE)
|
||||
#include "media/mojo/mojom/renderer_extensions.mojom.h"
|
||||
#endif
|
||||
#include "net/ssl/client_cert_store_win.h"
|
||||
#include "sandbox/win/src/sandbox_policy.h"
|
||||
#endif
|
||||
#endif // BUILDFLAG(IS_WIN)
|
||||
|
||||
#if BUILDFLAG(USE_NSS_CERTS)
|
||||
#include "net/ssl/client_cert_store_nss.h"
|
||||
@@ -284,10 +287,12 @@ void BindBadgeServiceForServiceWorker(
|
||||
const content::ServiceWorkerVersionBaseInfo& info,
|
||||
mojo::PendingReceiver<blink::mojom::BadgeService> receiver) {}
|
||||
|
||||
#if BUILDFLAG(IS_WIN) && BUILDFLAG(ENABLE_SPEECH_SERVICE)
|
||||
void BindMediaFoundationRendererNotifierHandler(
|
||||
content::RenderFrameHost* frame_host,
|
||||
mojo::PendingReceiver<media::mojom::MediaFoundationRendererNotifier>
|
||||
receiver) {}
|
||||
#endif
|
||||
|
||||
void BindNetworkHintsHandler(
|
||||
content::RenderFrameHost* frame_host,
|
||||
@@ -917,12 +922,21 @@ AlloyContentBrowserClient::CreateURLLoaderThrottles(
|
||||
|
||||
Profile* profile = Profile::FromBrowserContext(browser_context);
|
||||
|
||||
chrome::mojom::DynamicParams dynamic_params = {
|
||||
profile->GetPrefs()->GetBoolean(prefs::kForceGoogleSafeSearch),
|
||||
profile->GetPrefs()->GetInteger(prefs::kForceYouTubeRestrict),
|
||||
profile->GetPrefs()->GetString(prefs::kAllowedDomainsForApps)};
|
||||
result.push_back(
|
||||
std::make_unique<GoogleURLLoaderThrottle>(std::move(dynamic_params)));
|
||||
chrome::mojom::DynamicParamsPtr dynamic_params =
|
||||
chrome::mojom::DynamicParams::New(
|
||||
#if BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS)
|
||||
/*bound_session_params=*/nullptr,
|
||||
#endif
|
||||
profile->GetPrefs()->GetBoolean(
|
||||
policy::policy_prefs::kForceGoogleSafeSearch),
|
||||
profile->GetPrefs()->GetInteger(
|
||||
policy::policy_prefs::kForceYouTubeRestrict),
|
||||
profile->GetPrefs()->GetString(prefs::kAllowedDomainsForApps));
|
||||
result.push_back(std::make_unique<GoogleURLLoaderThrottle>(
|
||||
#if BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS)
|
||||
/*bound_session_request_throttled_listener=*/nullptr,
|
||||
#endif
|
||||
std::move(dynamic_params)));
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -1250,8 +1264,10 @@ void AlloyContentBrowserClient::RegisterBrowserInterfaceBindersForFrame(
|
||||
map);
|
||||
|
||||
map->Add<blink::mojom::BadgeService>(base::BindRepeating(&BindBadgeService));
|
||||
#if BUILDFLAG(IS_WIN) && BUILDFLAG(ENABLE_SPEECH_SERVICE)
|
||||
map->Add<media::mojom::MediaFoundationRendererNotifier>(
|
||||
base::BindRepeating(&BindMediaFoundationRendererNotifierHandler));
|
||||
#endif
|
||||
map->Add<network_hints::mojom::NetworkHintsHandler>(
|
||||
base::BindRepeating(&BindNetworkHintsHandler));
|
||||
|
||||
@@ -1358,10 +1374,8 @@ bool AlloyContentBrowserClient::ArePersistentMediaDeviceIDsAllowed(
|
||||
// Persistent MediaDevice IDs are allowed if cookies are allowed.
|
||||
return CookieSettingsFactory::GetForProfile(
|
||||
Profile::FromBrowserContext(browser_context))
|
||||
->IsFullCookieAccessAllowed(
|
||||
url, site_for_cookies, top_frame_origin,
|
||||
net::CookieSettingOverrides(),
|
||||
content_settings::CookieSettings::QueryReason::kSiteStorage);
|
||||
->IsFullCookieAccessAllowed(url, site_for_cookies, top_frame_origin,
|
||||
net::CookieSettingOverrides());
|
||||
}
|
||||
|
||||
void AlloyContentBrowserClient::OnWebContentsCreated(
|
||||
|
@@ -219,7 +219,7 @@ void CefBrowserPlatformDelegateAlloy::CreateExtensionHost(
|
||||
extension, web_contents_, url, host_type);
|
||||
// Load will be triggered by ProcessManager::CreateBackgroundHost.
|
||||
} else {
|
||||
NOTREACHED() << " Unsupported extension host type: " << host_type;
|
||||
DCHECK(false) << " Unsupported extension host type: " << host_type;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include "content/public/browser/network_service_instance.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "net/log/net_log_capture_mode.h"
|
||||
#include "services/device/public/cpp/geolocation/geolocation_manager.h"
|
||||
#include "services/network/public/cpp/network_switches.h"
|
||||
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||
|
||||
@@ -135,22 +136,27 @@ void ChromeBrowserProcessAlloy::CleanupOnUIThread() {
|
||||
}
|
||||
|
||||
void ChromeBrowserProcessAlloy::EndSession() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void ChromeBrowserProcessAlloy::FlushLocalStateAndReply(
|
||||
base::OnceClosure reply) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
device::GeolocationManager* ChromeBrowserProcessAlloy::geolocation_manager() {
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
metrics_services_manager::MetricsServicesManager*
|
||||
ChromeBrowserProcessAlloy::GetMetricsServicesManager() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
metrics::MetricsService* ChromeBrowserProcessAlloy::metrics_service() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -162,7 +168,7 @@ ChromeBrowserProcessAlloy::system_network_context_manager() {
|
||||
|
||||
network::NetworkQualityTracker*
|
||||
ChromeBrowserProcessAlloy::network_quality_tracker() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -191,17 +197,17 @@ PrefService* ChromeBrowserProcessAlloy::local_state() {
|
||||
|
||||
scoped_refptr<network::SharedURLLoaderFactory>
|
||||
ChromeBrowserProcessAlloy::shared_url_loader_factory() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
variations::VariationsService* ChromeBrowserProcessAlloy::variations_service() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BrowserProcessPlatformPart* ChromeBrowserProcessAlloy::platform_part() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -212,16 +218,21 @@ ChromeBrowserProcessAlloy::extension_event_router_forwarder() {
|
||||
}
|
||||
|
||||
NotificationUIManager* ChromeBrowserProcessAlloy::notification_ui_manager() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NotificationPlatformBridge*
|
||||
ChromeBrowserProcessAlloy::notification_platform_bridge() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ChromeBrowserProcessAlloy::SetGeolocationManager(
|
||||
std::unique_ptr<device::GeolocationManager> geolocation_manager) {
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
policy::ChromeBrowserPolicyConnector*
|
||||
ChromeBrowserProcessAlloy::browser_policy_connector() {
|
||||
if (!browser_policy_connector_) {
|
||||
@@ -236,25 +247,25 @@ policy::PolicyService* ChromeBrowserProcessAlloy::policy_service() {
|
||||
}
|
||||
|
||||
IconManager* ChromeBrowserProcessAlloy::icon_manager() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GpuModeManager* ChromeBrowserProcessAlloy::gpu_mode_manager() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ChromeBrowserProcessAlloy::CreateDevToolsProtocolHandler() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void ChromeBrowserProcessAlloy::CreateDevToolsAutoOpener() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
bool ChromeBrowserProcessAlloy::IsShuttingDown() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -283,7 +294,7 @@ ChromeBrowserProcessAlloy::background_printing_manager() {
|
||||
|
||||
IntranetRedirectDetector*
|
||||
ChromeBrowserProcessAlloy::intranet_redirect_detector() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -298,29 +309,29 @@ void ChromeBrowserProcessAlloy::SetApplicationLocale(
|
||||
}
|
||||
|
||||
DownloadStatusUpdater* ChromeBrowserProcessAlloy::download_status_updater() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DownloadRequestLimiter* ChromeBrowserProcessAlloy::download_request_limiter() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_BACKGROUND_MODE)
|
||||
BackgroundModeManager* ChromeBrowserProcessAlloy::background_mode_manager() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ChromeBrowserProcessAlloy::set_background_mode_manager_for_test(
|
||||
std::unique_ptr<BackgroundModeManager> manager) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
StatusTray* ChromeBrowserProcessAlloy::status_tray() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -331,12 +342,12 @@ ChromeBrowserProcessAlloy::safe_browsing_service() {
|
||||
|
||||
subresource_filter::RulesetService*
|
||||
ChromeBrowserProcessAlloy::subresource_filter_ruleset_service() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
StartupData* ChromeBrowserProcessAlloy::startup_data() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -368,61 +379,55 @@ ChromeBrowserProcessAlloy::component_updater() {
|
||||
|
||||
MediaFileSystemRegistry*
|
||||
ChromeBrowserProcessAlloy::media_file_system_registry() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WebRtcLogUploader* ChromeBrowserProcessAlloy::webrtc_log_uploader() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
network_time::NetworkTimeTracker*
|
||||
ChromeBrowserProcessAlloy::network_time_tracker() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
gcm::GCMDriver* ChromeBrowserProcessAlloy::gcm_driver() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
resource_coordinator::TabManager* ChromeBrowserProcessAlloy::GetTabManager() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
resource_coordinator::ResourceCoordinatorParts*
|
||||
ChromeBrowserProcessAlloy::resource_coordinator_parts() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BuildState* ChromeBrowserProcessAlloy::GetBuildState() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SerialPolicyAllowedPorts*
|
||||
ChromeBrowserProcessAlloy::serial_policy_allowed_ports() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
HidPolicyAllowedDevices*
|
||||
ChromeBrowserProcessAlloy::hid_policy_allowed_devices() {
|
||||
NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
breadcrumbs::BreadcrumbPersistentStorageManager*
|
||||
ChromeBrowserProcessAlloy::GetBreadcrumbPersistentStorageManager() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
HidSystemTrayIcon* ChromeBrowserProcessAlloy::hid_system_tray_icon() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
@@ -51,6 +51,7 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
|
||||
// BrowserProcess implementation.
|
||||
void EndSession() override;
|
||||
void FlushLocalStateAndReply(base::OnceClosure reply) override;
|
||||
device::GeolocationManager* geolocation_manager() override;
|
||||
metrics_services_manager::MetricsServicesManager* GetMetricsServicesManager()
|
||||
override;
|
||||
metrics::MetricsService* metrics_service() override;
|
||||
@@ -65,6 +66,8 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
|
||||
extensions::EventRouterForwarder* extension_event_router_forwarder() override;
|
||||
NotificationUIManager* notification_ui_manager() override;
|
||||
NotificationPlatformBridge* notification_platform_bridge() override;
|
||||
void SetGeolocationManager(
|
||||
std::unique_ptr<device::GeolocationManager> geolocation_manager) override;
|
||||
policy::ChromeBrowserPolicyConnector* browser_policy_connector() override;
|
||||
policy::PolicyService* policy_service() override;
|
||||
IconManager* icon_manager() override;
|
||||
@@ -107,8 +110,6 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
|
||||
BuildState* GetBuildState() override;
|
||||
SerialPolicyAllowedPorts* serial_policy_allowed_ports() override;
|
||||
HidPolicyAllowedDevices* hid_policy_allowed_devices() override;
|
||||
breadcrumbs::BreadcrumbPersistentStorageManager*
|
||||
GetBreadcrumbPersistentStorageManager() override;
|
||||
HidSystemTrayIcon* hid_system_tray_icon() override;
|
||||
|
||||
private:
|
||||
|
@@ -54,7 +54,7 @@ bool ChromeProfileAlloy::IsOffTheRecord() const {
|
||||
}
|
||||
|
||||
const Profile::OTRProfileID& ChromeProfileAlloy::GetOTRProfileID() const {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
static base::NoDestructor<Profile::OTRProfileID> otr_profile_id(
|
||||
Profile::OTRProfileID::PrimaryID());
|
||||
return *otr_profile_id;
|
||||
@@ -68,19 +68,19 @@ variations::VariationsClient* ChromeProfileAlloy::GetVariationsClient() {
|
||||
}
|
||||
|
||||
scoped_refptr<base::SequencedTaskRunner> ChromeProfileAlloy::GetIOTaskRunner() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return scoped_refptr<base::SequencedTaskRunner>();
|
||||
}
|
||||
|
||||
std::string ChromeProfileAlloy::GetProfileUserName() const {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return std::string();
|
||||
}
|
||||
|
||||
Profile* ChromeProfileAlloy::GetOffTheRecordProfile(
|
||||
const Profile::OTRProfileID& otr_profile_id,
|
||||
bool create_if_needed) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ std::vector<Profile*> ChromeProfileAlloy::GetAllOffTheRecordProfiles() {
|
||||
}
|
||||
|
||||
void ChromeProfileAlloy::DestroyOffTheRecordProfile(Profile* otr_profile) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
bool ChromeProfileAlloy::HasOffTheRecordProfile(
|
||||
@@ -115,17 +115,17 @@ bool ChromeProfileAlloy::IsChild() const {
|
||||
|
||||
ExtensionSpecialStoragePolicy*
|
||||
ChromeProfileAlloy::GetExtensionSpecialStoragePolicy() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool ChromeProfileAlloy::IsSameOrParent(Profile* profile) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
base::Time ChromeProfileAlloy::GetStartTime() const {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return base::Time();
|
||||
}
|
||||
|
||||
@@ -139,30 +139,30 @@ void ChromeProfileAlloy::set_last_selected_directory(
|
||||
}
|
||||
|
||||
GURL ChromeProfileAlloy::GetHomePage() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return GURL();
|
||||
}
|
||||
|
||||
bool ChromeProfileAlloy::WasCreatedByVersionOrLater(
|
||||
const std::string& version) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
base::Time ChromeProfileAlloy::GetCreationTime() const {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return base::Time();
|
||||
}
|
||||
|
||||
void ChromeProfileAlloy::SetCreationTimeForTesting(base::Time creation_time) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void ChromeProfileAlloy::RecordPrimaryMainFrameNavigation() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
bool ChromeProfileAlloy::IsSignedIn() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return false;
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ class AlloyConstrainedWindowViewsClient
|
||||
if (auto browser = GetPreferredBrowser(parent)) {
|
||||
return browser->platform_delegate()->GetWebContentsModalDialogHost();
|
||||
}
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -73,4 +73,4 @@ class AlloyConstrainedWindowViewsClient
|
||||
std::unique_ptr<constrained_window::ConstrainedWindowViewsClient>
|
||||
CreateAlloyConstrainedWindowViewsClient() {
|
||||
return std::make_unique<AlloyConstrainedWindowViewsClient>();
|
||||
}
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@ bool AlloyWebContentsDialogHelper::IsWebContentsVisible(
|
||||
} else if (auto native_view = web_contents->GetNativeView()) {
|
||||
return platform_util::IsVisible(native_view);
|
||||
}
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ gfx::NativeView AlloyWebContentsDialogHelper::GetHostView() const {
|
||||
if (auto widget = browser_delegate_->GetWindowWidget()) {
|
||||
return widget->GetNativeView();
|
||||
}
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return gfx::NativeView();
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ gfx::AcceleratedWidget AlloyWebContentsDialogHelper::GetHostWidget() const {
|
||||
return parent_widget;
|
||||
}
|
||||
#endif // defined(USE_AURA)
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return gfx::kNullAcceleratedWidget;
|
||||
}
|
||||
|
||||
|
@@ -313,8 +313,11 @@ void CefBrowserContentsDelegate::RenderFrameCreated(
|
||||
web_contents()->SetPageBaseBackgroundColor(SkColor());
|
||||
web_contents()->SetPageBaseBackgroundColor(base_background_color);
|
||||
}
|
||||
render_view_host->GetWidget()->GetView()->SetBackgroundColor(
|
||||
base_background_color);
|
||||
if (render_view_host->GetWidget() &&
|
||||
render_view_host->GetWidget()->GetView()) {
|
||||
render_view_host->GetWidget()->GetView()->SetBackgroundColor(
|
||||
base_background_color);
|
||||
}
|
||||
|
||||
platform_delegate()->RenderViewCreated(render_view_host);
|
||||
}
|
||||
|
@@ -77,6 +77,6 @@ CefRefPtr<CefFrameHostImpl> CefBrowserFrame::GetFrameHost(
|
||||
return browser->browser_info()->GetFrameForHost(rfh, nullptr,
|
||||
prefer_speculative);
|
||||
}
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
@@ -493,7 +493,7 @@ void CefBrowserHostBase::GetNavigationEntries(
|
||||
|
||||
CefRefPtr<CefNavigationEntry> CefBrowserHostBase::GetVisibleNavigationEntry() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
NOTREACHED() << "called on invalid thread";
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@@ -53,20 +53,20 @@ bool CefBrowserHost::CreateBrowser(
|
||||
CefRefPtr<CefRequestContext> request_context) {
|
||||
// Verify that the context is in a valid state.
|
||||
if (!CONTEXT_STATE_VALID()) {
|
||||
NOTREACHED() << "context not valid";
|
||||
DCHECK(false) << "context not valid";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Verify that the settings structure is a valid size.
|
||||
if (settings.size != sizeof(cef_browser_settings_t)) {
|
||||
NOTREACHED() << "invalid CefBrowserSettings structure size";
|
||||
DCHECK(false) << "invalid CefBrowserSettings structure size";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Verify windowless rendering requirements.
|
||||
if (windowInfo.windowless_rendering_enabled &&
|
||||
!client->GetRenderHandler().get()) {
|
||||
NOTREACHED() << "CefRenderHandler implementation is required";
|
||||
DCHECK(false) << "CefRenderHandler implementation is required";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -110,13 +110,13 @@ CefRefPtr<CefBrowser> CefBrowserHost::CreateBrowserSync(
|
||||
CefRefPtr<CefRequestContext> request_context) {
|
||||
// Verify that the context is in a valid state.
|
||||
if (!CONTEXT_STATE_VALID()) {
|
||||
NOTREACHED() << "context not valid";
|
||||
DCHECK(false) << "context not valid";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Verify that the settings structure is a valid size.
|
||||
if (settings.size != sizeof(cef_browser_settings_t)) {
|
||||
NOTREACHED() << "invalid CefBrowserSettings structure size";
|
||||
DCHECK(false) << "invalid CefBrowserSettings structure size";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ CefRefPtr<CefBrowser> CefBrowserHost::CreateBrowserSync(
|
||||
// Verify windowless rendering requirements.
|
||||
if (windowInfo.windowless_rendering_enabled &&
|
||||
!client->GetRenderHandler().get()) {
|
||||
NOTREACHED() << "CefRenderHandler implementation is required";
|
||||
DCHECK(false) << "CefRenderHandler implementation is required";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@@ -125,6 +125,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
||||
|
||||
CefRefPtr<CefClient> client = browser->GetClient();
|
||||
bool allow = true;
|
||||
bool handled = false;
|
||||
|
||||
CefWindowInfo window_info;
|
||||
|
||||
@@ -133,7 +134,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
||||
#endif
|
||||
|
||||
auto pending_popup = std::make_unique<CefBrowserInfoManager::PendingPopup>();
|
||||
pending_popup->step = CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW;
|
||||
pending_popup->step = PendingPopup::CAN_CREATE_WINDOW;
|
||||
pending_popup->opener_global_id = opener->GetGlobalId();
|
||||
pending_popup->target_url = target_url;
|
||||
pending_popup->target_frame_name = frame_name;
|
||||
@@ -142,6 +143,11 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
||||
pending_popup->client = client;
|
||||
pending_popup->settings = browser->settings();
|
||||
|
||||
// With the Chrome runtime, we want to use default popup Browser creation
|
||||
// for document picture-in-picture.
|
||||
pending_popup->use_default_browser_creation =
|
||||
disposition == WindowOpenDisposition::NEW_PICTURE_IN_PICTURE;
|
||||
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefLifeSpanHandler> handler = client->GetLifeSpanHandler();
|
||||
if (handler.get()) {
|
||||
@@ -172,6 +178,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
||||
cef_features, window_info, pending_popup->client,
|
||||
pending_popup->settings, pending_popup->extra_info,
|
||||
no_javascript_access);
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,14 +186,21 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
||||
CefBrowserCreateParams create_params;
|
||||
create_params.MaybeSetWindowInfo(window_info);
|
||||
|
||||
if (!handled) {
|
||||
// Use default Browser creation if OnBeforePopup was unhandled.
|
||||
// TODO(chrome): Expose a mechanism for the client to choose default
|
||||
// creation.
|
||||
pending_popup->use_default_browser_creation = true;
|
||||
}
|
||||
|
||||
// In most cases, Views-hosted browsers should create Views-hosted popups
|
||||
// and native browsers should use default popup handling. The one exception
|
||||
// is with the Chrome runtime where a Views-hosted browser may have an
|
||||
// external parent. In that case we want to use default popup handling even
|
||||
// though the parent is (technically) Views-hosted.
|
||||
// and native browsers should use default popup handling. With the Chrome
|
||||
// runtime, we should additionally use default handling (a) when using an
|
||||
// external parent and (b) when using default Browser creation.
|
||||
create_params.popup_with_views_hosted_opener =
|
||||
browser->HasView() &&
|
||||
!browser->platform_delegate()->HasExternalParent();
|
||||
!browser->platform_delegate()->HasExternalParent() &&
|
||||
!pending_popup->use_default_browser_creation;
|
||||
|
||||
create_params.settings = pending_popup->settings;
|
||||
create_params.client = pending_popup->client;
|
||||
@@ -217,9 +231,8 @@ void CefBrowserInfoManager::GetCustomWebContentsView(
|
||||
CEF_REQUIRE_UIT();
|
||||
REQUIRE_ALLOY_RUNTIME();
|
||||
|
||||
std::unique_ptr<CefBrowserInfoManager::PendingPopup> pending_popup =
|
||||
PopPendingPopup(CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW,
|
||||
opener_global_id, target_url);
|
||||
auto pending_popup = PopPendingPopup(PendingPopup::CAN_CREATE_WINDOW,
|
||||
opener_global_id, target_url);
|
||||
DCHECK(pending_popup.get());
|
||||
DCHECK(pending_popup->platform_delegate.get());
|
||||
|
||||
@@ -228,8 +241,7 @@ void CefBrowserInfoManager::GetCustomWebContentsView(
|
||||
delegate_view);
|
||||
}
|
||||
|
||||
pending_popup->step =
|
||||
CefBrowserInfoManager::PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW;
|
||||
pending_popup->step = PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW;
|
||||
PushPendingPopup(std::move(pending_popup));
|
||||
}
|
||||
|
||||
@@ -239,16 +251,16 @@ void CefBrowserInfoManager::WebContentsCreated(
|
||||
CefBrowserSettings& settings,
|
||||
CefRefPtr<CefClient>& client,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate>& platform_delegate,
|
||||
CefRefPtr<CefDictionaryValue>& extra_info) {
|
||||
CefRefPtr<CefDictionaryValue>& extra_info,
|
||||
content::WebContents* new_contents) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
// GET_CUSTOM_WEB_CONTENTS_VIEW is only used with the alloy runtime.
|
||||
const auto previous_step =
|
||||
cef::IsAlloyRuntimeEnabled()
|
||||
? CefBrowserInfoManager::PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW
|
||||
: CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW;
|
||||
const auto previous_step = cef::IsAlloyRuntimeEnabled()
|
||||
? PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW
|
||||
: PendingPopup::CAN_CREATE_WINDOW;
|
||||
|
||||
std::unique_ptr<CefBrowserInfoManager::PendingPopup> pending_popup =
|
||||
auto pending_popup =
|
||||
PopPendingPopup(previous_step, opener_global_id, target_url);
|
||||
DCHECK(pending_popup.get());
|
||||
DCHECK(pending_popup->platform_delegate.get());
|
||||
@@ -257,6 +269,30 @@ void CefBrowserInfoManager::WebContentsCreated(
|
||||
client = pending_popup->client;
|
||||
platform_delegate = std::move(pending_popup->platform_delegate);
|
||||
extra_info = pending_popup->extra_info;
|
||||
|
||||
// AddWebContents (the next step) is only used with the Chrome runtime.
|
||||
if (cef::IsChromeRuntimeEnabled()) {
|
||||
pending_popup->step = PendingPopup::WEB_CONTENTS_CREATED;
|
||||
pending_popup->new_contents = new_contents;
|
||||
PushPendingPopup(std::move(pending_popup));
|
||||
}
|
||||
}
|
||||
|
||||
bool CefBrowserInfoManager::AddWebContents(content::WebContents* new_contents) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(cef::IsChromeRuntimeEnabled());
|
||||
|
||||
// Pending popup information may be missing in cases where
|
||||
// chrome::AddWebContents is called directly from the Chrome UI (profile
|
||||
// settings, etc).
|
||||
auto pending_popup =
|
||||
PopPendingPopup(PendingPopup::WEB_CONTENTS_CREATED, new_contents);
|
||||
if (pending_popup) {
|
||||
return !pending_popup->use_default_browser_creation;
|
||||
}
|
||||
|
||||
// Proceed with default handling.
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefBrowserInfoManager::OnGetNewBrowserInfo(
|
||||
@@ -297,7 +333,9 @@ void CefBrowserInfoManager::OnGetNewBrowserInfo(
|
||||
std::make_pair(global_id, std::move(pending)));
|
||||
|
||||
// Register a timeout for the pending response so that the renderer process
|
||||
// doesn't hang forever.
|
||||
// doesn't hang forever. With the Chrome runtime, timeouts may occur in cases
|
||||
// where chrome::AddWebContents or WebContents::Create are called directly
|
||||
// from the Chrome UI (profile settings, etc).
|
||||
if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
switches::kDisableNewBrowserInfoTimeout)) {
|
||||
CEF_POST_DELAYED_TASK(
|
||||
@@ -320,7 +358,7 @@ void CefBrowserInfoManager::RemoveBrowserInfo(
|
||||
}
|
||||
}
|
||||
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void CefBrowserInfoManager::DestroyAllBrowsers() {
|
||||
@@ -438,16 +476,18 @@ void CefBrowserInfoManager::PushPendingPopup(
|
||||
|
||||
std::unique_ptr<CefBrowserInfoManager::PendingPopup>
|
||||
CefBrowserInfoManager::PopPendingPopup(
|
||||
PendingPopup::Step step,
|
||||
PendingPopup::Step previous_step,
|
||||
const content::GlobalRenderFrameHostId& opener_global_id,
|
||||
const GURL& target_url) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(frame_util::IsValidGlobalId(opener_global_id));
|
||||
DCHECK_LE(previous_step, PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW);
|
||||
|
||||
PendingPopupList::iterator it = pending_popup_list_.begin();
|
||||
for (; it != pending_popup_list_.end(); ++it) {
|
||||
PendingPopup* popup = it->get();
|
||||
if (popup->step == step && popup->opener_global_id == opener_global_id &&
|
||||
if (popup->step == previous_step &&
|
||||
popup->opener_global_id == opener_global_id &&
|
||||
popup->target_url == target_url) {
|
||||
// Transfer ownership of the pointer.
|
||||
it->release();
|
||||
@@ -459,6 +499,26 @@ CefBrowserInfoManager::PopPendingPopup(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<CefBrowserInfoManager::PendingPopup>
|
||||
CefBrowserInfoManager::PopPendingPopup(PendingPopup::Step previous_step,
|
||||
content::WebContents* new_contents) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK_GE(previous_step, PendingPopup::WEB_CONTENTS_CREATED);
|
||||
|
||||
PendingPopupList::iterator it = pending_popup_list_.begin();
|
||||
for (; it != pending_popup_list_.end(); ++it) {
|
||||
PendingPopup* popup = it->get();
|
||||
if (popup->step == previous_step && popup->new_contents == new_contents) {
|
||||
// Transfer ownership of the pointer.
|
||||
it->release();
|
||||
pending_popup_list_.erase(it);
|
||||
return base::WrapUnique(popup);
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::GetBrowserInfoInternal(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool* is_guest_view) {
|
||||
|
@@ -97,7 +97,12 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
CefBrowserSettings& settings,
|
||||
CefRefPtr<CefClient>& client,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate>& platform_delegate,
|
||||
CefRefPtr<CefDictionaryValue>& extra_info);
|
||||
CefRefPtr<CefDictionaryValue>& extra_info,
|
||||
content::WebContents* new_contents);
|
||||
|
||||
// Called from ChromeBrowserDelegate::AddWebContents. See comments on
|
||||
// PendingPopup for more information. Returns true for custom handling.
|
||||
bool AddWebContents(content::WebContents* source_contents);
|
||||
|
||||
// Called from CefBrowserManager::GetNewBrowserInfo for delivering
|
||||
// browser info to the renderer process. If the browser info already exists
|
||||
@@ -154,6 +159,8 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
// Creates the OSR views for windowless popups.
|
||||
// - WebContentsCreated (UIT):
|
||||
// Creates the CefBrowserHost representation for the popup.
|
||||
// - AddWebContents (UIT) (chrome runtime only):
|
||||
// Creates the Browser or tab representation for the popup.
|
||||
// - CefBrowserManager::GetNewBrowserInfo (IOT)
|
||||
// Passes information about the popup to the renderer process.
|
||||
struct PendingPopup {
|
||||
@@ -163,6 +170,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
enum Step {
|
||||
CAN_CREATE_WINDOW,
|
||||
GET_CUSTOM_WEB_CONTENTS_VIEW,
|
||||
WEB_CONTENTS_CREATED,
|
||||
} step;
|
||||
|
||||
// Initial state from ViewHostMsg_CreateWindow.
|
||||
@@ -179,15 +187,29 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
|
||||
// Platform delegate specific to the new popup.
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate;
|
||||
|
||||
// True if default Browser or tab creation should proceed from
|
||||
// AddWebContents (chrome runtime only).
|
||||
bool use_default_browser_creation = false;
|
||||
|
||||
// The newly created WebContents (set in WebContentsCreated).
|
||||
content::WebContents* new_contents = nullptr;
|
||||
};
|
||||
|
||||
// Manage pending popups. Only called on the UI thread.
|
||||
void PushPendingPopup(std::unique_ptr<PendingPopup> popup);
|
||||
|
||||
// Used after CanCreateWindow is called.
|
||||
std::unique_ptr<PendingPopup> PopPendingPopup(
|
||||
PendingPopup::Step step,
|
||||
PendingPopup::Step previous_step,
|
||||
const content::GlobalRenderFrameHostId& opener_global_id,
|
||||
const GURL& target_url);
|
||||
|
||||
// Used after WebContentsCreated is called.
|
||||
std::unique_ptr<PendingPopup> PopPendingPopup(
|
||||
PendingPopup::Step previous_step,
|
||||
content::WebContents* new_contents);
|
||||
|
||||
// Retrieves the BrowserInfo matching the specified ID.
|
||||
scoped_refptr<CefBrowserInfo> GetBrowserInfoInternal(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
|
@@ -20,14 +20,14 @@ CefBrowserPlatformDelegate::~CefBrowserPlatformDelegate() {
|
||||
content::WebContents* CefBrowserPlatformDelegate::CreateWebContents(
|
||||
CefBrowserCreateParams& create_params,
|
||||
bool& own_web_contents) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::CreateViewForWebContents(
|
||||
content::WebContentsView** view,
|
||||
content::RenderViewHostDelegateView** delegate_view) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::WebContentsCreated(
|
||||
@@ -48,7 +48,7 @@ void CefBrowserPlatformDelegate::AddNewContents(
|
||||
const blink::mojom::WindowFeatures& window_features,
|
||||
bool user_gesture,
|
||||
bool* was_blocked) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::WebContentsDestroyed(
|
||||
@@ -87,12 +87,12 @@ void CefBrowserPlatformDelegate::CreateExtensionHost(
|
||||
const extensions::Extension* extension,
|
||||
const GURL& url,
|
||||
extensions::mojom::ViewType host_type) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
extensions::ExtensionHost* CefBrowserPlatformDelegate::GetExtensionHost()
|
||||
const {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -109,32 +109,32 @@ void CefBrowserPlatformDelegate::BrowserDestroyed(CefBrowserHostBase* browser) {
|
||||
}
|
||||
|
||||
bool CefBrowserPlatformDelegate::CreateHostWindow() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::CloseHostWindow() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
CefWindowHandle CefBrowserPlatformDelegate::GetHostWindowHandle() const {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return kNullWindowHandle;
|
||||
}
|
||||
|
||||
views::Widget* CefBrowserPlatformDelegate::GetWindowWidget() const {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowserView> CefBrowserPlatformDelegate::GetBrowserView() const {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
web_modal::WebContentsModalDialogHost*
|
||||
CefBrowserPlatformDelegate::GetWebContentsModalDialogHost() const {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -150,12 +150,12 @@ void CefBrowserPlatformDelegate::PopupBrowserCreated(
|
||||
bool is_devtools) {}
|
||||
|
||||
SkColor CefBrowserPlatformDelegate::GetBackgroundColor() const {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return SkColor();
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::WasResized() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::SendKeyEvent(const CefKeyEvent& event) {
|
||||
@@ -200,7 +200,7 @@ void CefBrowserPlatformDelegate::SizeTo(int width, int height) {}
|
||||
gfx::Point CefBrowserPlatformDelegate::GetScreenPoint(
|
||||
const gfx::Point& view,
|
||||
bool want_dip_coords) const {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return gfx::Point();
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ void CefBrowserPlatformDelegate::ViewText(const std::string& text) {
|
||||
|
||||
bool CefBrowserPlatformDelegate::HandleKeyboardEvent(
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ bool CefBrowserPlatformDelegate::IsNeverComposited(
|
||||
|
||||
CefEventHandle CefBrowserPlatformDelegate::GetEventHandle(
|
||||
const content::NativeWebKeyboardEvent& event) const {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return kNullEventHandle;
|
||||
}
|
||||
|
||||
@@ -241,6 +241,9 @@ std::unique_ptr<CefMenuRunner> CefBrowserPlatformDelegate::CreateMenuRunner() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::UpdateFindBarBoundingBox(
|
||||
gfx::Rect* bounds) const {}
|
||||
|
||||
bool CefBrowserPlatformDelegate::IsWindowless() const {
|
||||
return false;
|
||||
}
|
||||
@@ -256,28 +259,28 @@ bool CefBrowserPlatformDelegate::HasExternalParent() const {
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::WasHidden(bool hidden) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
bool CefBrowserPlatformDelegate::IsHidden() const {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::NotifyScreenInfoChanged() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::Invalidate(cef_paint_element_type_t type) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::SendExternalBeginFrame() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::SetWindowlessFrameRate(int frame_rate) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::ImeSetComposition(
|
||||
@@ -285,43 +288,43 @@ void CefBrowserPlatformDelegate::ImeSetComposition(
|
||||
const std::vector<CefCompositionUnderline>& underlines,
|
||||
const CefRange& replacement_range,
|
||||
const CefRange& selection_range) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::ImeCommitText(
|
||||
const CefString& text,
|
||||
const CefRange& replacement_range,
|
||||
int relative_cursor_pos) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::ImeFinishComposingText(bool keep_selection) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::ImeCancelComposition() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::DragTargetDragEnter(
|
||||
CefRefPtr<CefDragData> drag_data,
|
||||
const CefMouseEvent& event,
|
||||
cef_drag_operations_mask_t allowed_ops) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::DragTargetDragOver(
|
||||
const CefMouseEvent& event,
|
||||
cef_drag_operations_mask_t allowed_ops) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::DragTargetDragLeave() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::DragTargetDrop(const CefMouseEvent& event) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::StartDragging(
|
||||
@@ -331,33 +334,33 @@ void CefBrowserPlatformDelegate::StartDragging(
|
||||
const gfx::Vector2d& image_offset,
|
||||
const blink::mojom::DragEventSourceInfo& event_info,
|
||||
content::RenderWidgetHostImpl* source_rwh) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::UpdateDragCursor(
|
||||
ui::mojom::DragOperation operation) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::DragSourceEndedAt(
|
||||
int x,
|
||||
int y,
|
||||
cef_drag_operations_mask_t op) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::DragSourceSystemDragEnded() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::AccessibilityEventReceived(
|
||||
const content::AXEventNotificationDetails& eventData) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::AccessibilityLocationChangesReceived(
|
||||
const std::vector<content::AXLocationChangeNotificationDetails>& locData) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
gfx::Point CefBrowserPlatformDelegate::GetDialogPosition(
|
||||
|
@@ -286,6 +286,9 @@ class CefBrowserPlatformDelegate {
|
||||
// Create the platform-specific menu runner.
|
||||
virtual std::unique_ptr<CefMenuRunner> CreateMenuRunner();
|
||||
|
||||
// Optionally modify the bounding box for the Chrome Find bar.
|
||||
virtual void UpdateFindBarBoundingBox(gfx::Rect* bounds) const;
|
||||
|
||||
// Returns true if this delegate implements windowless rendering. May be
|
||||
// called on multiple threads.
|
||||
virtual bool IsWindowless() const;
|
||||
|
@@ -138,6 +138,6 @@ std::unique_ptr<CefBrowserPlatformDelegate> CefBrowserPlatformDelegate::Create(
|
||||
return std::move(native_delegate);
|
||||
}
|
||||
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#include "chrome/browser/ui/page_action/page_action_icon_type.h"
|
||||
#include "content/public/browser/web_contents_delegate.h"
|
||||
#include "ui/base/window_open_disposition.h"
|
||||
|
||||
@@ -36,7 +37,16 @@ class BrowserDelegate : public content::WebContentsDelegate {
|
||||
|
||||
~BrowserDelegate() override {}
|
||||
|
||||
// Called immediately after |new_contents| is created.
|
||||
// Optionally override chrome::AddWebContents behavior. This is most often
|
||||
// called via Browser::AddNewContents for new popup browsers and provides an
|
||||
// opportunity for CEF to create a new Browser instead of proceeding with
|
||||
// default Browser or tab creation.
|
||||
virtual std::unique_ptr<content::WebContents> AddWebContents(
|
||||
std::unique_ptr<content::WebContents> new_contents) = 0;
|
||||
|
||||
// Called immediately after |new_contents| is created via chrome::Navigate.
|
||||
// This is most often called for navigations targeting a new tab without a
|
||||
// pre-existing WebContents.
|
||||
virtual void OnWebContentsCreated(content::WebContents* new_contents) = 0;
|
||||
|
||||
// Add or remove ownership of the WebContents.
|
||||
@@ -56,6 +66,35 @@ class BrowserDelegate : public content::WebContentsDelegate {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Return true if the app menu item should be visible. ID values come from
|
||||
// chrome/app/chrome_command_ids.h.
|
||||
virtual bool IsAppMenuItemVisible(int command_id) { return true; }
|
||||
|
||||
// Return true if the app menu item should be enabled. ID values come from
|
||||
// chrome/app/chrome_command_ids.h.
|
||||
virtual bool IsAppMenuItemEnabled(int command_id) { return true; }
|
||||
|
||||
// Return true if the page action icon should be visible.
|
||||
virtual bool IsPageActionIconVisible(PageActionIconType icon_type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
enum class ToolbarButtonType {
|
||||
kCast = 0,
|
||||
kDownload,
|
||||
kSendTabToSelf,
|
||||
kSidePanel,
|
||||
kMaxValue = kSidePanel,
|
||||
};
|
||||
|
||||
// Return true if the toolbar button should be visible.
|
||||
virtual bool IsToolbarButtonVisible(ToolbarButtonType button_type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Optionally modify the bounding box for the Find bar.
|
||||
virtual void UpdateFindBarBoundingBox(gfx::Rect* bounds) {}
|
||||
|
||||
// Same as RequestMediaAccessPermission but returning |callback| if the
|
||||
// request is unhandled.
|
||||
[[nodiscard]] virtual content::MediaResponseCallback
|
||||
|
@@ -56,7 +56,7 @@ CefBrowserPlatformDelegateChrome::GetWebContentsModalDialogHost() const {
|
||||
ChromeWebModalDialogManagerDelegate* manager = chrome_browser_;
|
||||
return manager->GetWebContentsModalDialogHost();
|
||||
}
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -143,6 +143,6 @@ gfx::NativeWindow CefBrowserPlatformDelegateChrome::GetNativeWindow() const {
|
||||
if (chrome_browser_ && chrome_browser_->window()) {
|
||||
return chrome_browser_->window()->GetNativeWindow();
|
||||
}
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return gfx::NativeWindow();
|
||||
}
|
||||
|
@@ -34,6 +34,25 @@ ChromeBrowserDelegate::ChromeBrowserDelegate(
|
||||
|
||||
ChromeBrowserDelegate::~ChromeBrowserDelegate() = default;
|
||||
|
||||
std::unique_ptr<content::WebContents> ChromeBrowserDelegate::AddWebContents(
|
||||
std::unique_ptr<content::WebContents> new_contents) {
|
||||
if (CefBrowserInfoManager::GetInstance()->AddWebContents(
|
||||
new_contents.get())) {
|
||||
// The browser host should have been created in WebContentsCreated().
|
||||
auto new_browser =
|
||||
ChromeBrowserHostImpl::GetBrowserForContents(new_contents.get());
|
||||
if (new_browser) {
|
||||
// Create a new Browser and give it ownership of the new WebContents.
|
||||
new_browser->AddNewContents(std::move(new_contents));
|
||||
} else {
|
||||
LOG(ERROR) << "No host found for chrome popup browser";
|
||||
}
|
||||
}
|
||||
|
||||
// Proceed with default chrome::AddWebContents behavior.
|
||||
return new_contents;
|
||||
}
|
||||
|
||||
void ChromeBrowserDelegate::OnWebContentsCreated(
|
||||
content::WebContents* new_contents) {
|
||||
// Necessary to receive LoadingStateChanged calls during initial navigation.
|
||||
@@ -103,6 +122,66 @@ bool ChromeBrowserDelegate::HandleCommand(int command_id,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ChromeBrowserDelegate::IsAppMenuItemVisible(int command_id) {
|
||||
if (auto browser = ChromeBrowserHostImpl::GetBrowserForBrowser(browser_)) {
|
||||
if (auto client = browser->GetClient()) {
|
||||
if (auto handler = client->GetCommandHandler()) {
|
||||
return handler->IsChromeAppMenuItemVisible(browser.get(), command_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChromeBrowserDelegate::IsAppMenuItemEnabled(int command_id) {
|
||||
if (auto browser = ChromeBrowserHostImpl::GetBrowserForBrowser(browser_)) {
|
||||
if (auto client = browser->GetClient()) {
|
||||
if (auto handler = client->GetCommandHandler()) {
|
||||
return handler->IsChromeAppMenuItemEnabled(browser.get(), command_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChromeBrowserDelegate::IsPageActionIconVisible(
|
||||
PageActionIconType icon_type) {
|
||||
// Verify that our enum matches Chromium's values.
|
||||
static_assert(static_cast<int>(CEF_CPAIT_MAX_VALUE) ==
|
||||
static_cast<int>(PageActionIconType::kMaxValue),
|
||||
"enum mismatch");
|
||||
|
||||
if (auto client = create_params_.client) {
|
||||
if (auto handler = client->GetCommandHandler()) {
|
||||
return handler->IsChromePageActionIconVisible(
|
||||
static_cast<cef_chrome_page_action_icon_type_t>(icon_type));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChromeBrowserDelegate::IsToolbarButtonVisible(
|
||||
ToolbarButtonType button_type) {
|
||||
// Verify that our enum matches BrowserDelegate's values.
|
||||
static_assert(static_cast<int>(CEF_CTBT_MAX_VALUE) ==
|
||||
static_cast<int>(ToolbarButtonType::kMaxValue),
|
||||
"enum mismatch");
|
||||
|
||||
if (auto client = create_params_.client) {
|
||||
if (auto handler = client->GetCommandHandler()) {
|
||||
return handler->IsChromeToolbarButtonVisible(
|
||||
static_cast<cef_chrome_toolbar_button_type_t>(button_type));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void ChromeBrowserDelegate::UpdateFindBarBoundingBox(gfx::Rect* bounds) {
|
||||
if (auto browser = ChromeBrowserHostImpl::GetBrowserForBrowser(browser_)) {
|
||||
browser->platform_delegate()->UpdateFindBarBoundingBox(bounds);
|
||||
}
|
||||
}
|
||||
|
||||
content::MediaResponseCallback
|
||||
ChromeBrowserDelegate::RequestMediaAccessPermissionEx(
|
||||
content::WebContents* web_contents,
|
||||
@@ -132,7 +211,7 @@ void ChromeBrowserDelegate::WebContentsCreated(
|
||||
target_url,
|
||||
frame_util::MakeGlobalId(opener_render_process_id,
|
||||
opener_render_frame_id),
|
||||
settings, client, platform_delegate, extra_info);
|
||||
settings, client, platform_delegate, extra_info, new_contents);
|
||||
|
||||
auto opener = ChromeBrowserHostImpl::GetBrowserForContents(source_contents);
|
||||
if (!opener) {
|
||||
@@ -155,27 +234,6 @@ void ChromeBrowserDelegate::WebContentsCreated(
|
||||
browser_info, opener, request_context_impl);
|
||||
}
|
||||
|
||||
void ChromeBrowserDelegate::AddNewContents(
|
||||
content::WebContents* source_contents,
|
||||
std::unique_ptr<content::WebContents> new_contents,
|
||||
const GURL& target_url,
|
||||
WindowOpenDisposition disposition,
|
||||
const blink::mojom::WindowFeatures& window_features,
|
||||
bool user_gesture,
|
||||
bool* was_blocked) {
|
||||
auto new_browser =
|
||||
ChromeBrowserHostImpl::GetBrowserForContents(new_contents.get());
|
||||
if (new_browser) {
|
||||
// Create a new Browser and give it ownership of the WebContents.
|
||||
new_browser->AddNewContents(std::move(new_contents));
|
||||
return;
|
||||
}
|
||||
|
||||
// Fall back to default behavior from Browser::AddNewContents.
|
||||
chrome::AddWebContents(browser_, source_contents, std::move(new_contents),
|
||||
target_url, disposition, window_features);
|
||||
}
|
||||
|
||||
content::WebContents* ChromeBrowserDelegate::OpenURLFromTab(
|
||||
content::WebContents* source,
|
||||
const content::OpenURLParams& params) {
|
||||
|
@@ -48,12 +48,19 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
|
||||
~ChromeBrowserDelegate() override;
|
||||
|
||||
// cef::BrowserDelegate methods:
|
||||
std::unique_ptr<content::WebContents> AddWebContents(
|
||||
std::unique_ptr<content::WebContents> new_contents) override;
|
||||
void OnWebContentsCreated(content::WebContents* new_contents) override;
|
||||
void SetAsDelegate(content::WebContents* web_contents,
|
||||
bool set_delegate) override;
|
||||
bool ShowStatusBubble(bool show_by_default) override;
|
||||
bool HandleCommand(int command_id,
|
||||
WindowOpenDisposition disposition) override;
|
||||
bool IsAppMenuItemVisible(int command_id) override;
|
||||
bool IsAppMenuItemEnabled(int command_id) override;
|
||||
bool IsPageActionIconVisible(PageActionIconType icon_type) override;
|
||||
bool IsToolbarButtonVisible(ToolbarButtonType button_type) override;
|
||||
void UpdateFindBarBoundingBox(gfx::Rect* bounds) override;
|
||||
[[nodiscard]] content::MediaResponseCallback RequestMediaAccessPermissionEx(
|
||||
content::WebContents* web_contents,
|
||||
const content::MediaStreamRequest& request,
|
||||
@@ -66,13 +73,6 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
|
||||
const std::string& frame_name,
|
||||
const GURL& target_url,
|
||||
content::WebContents* new_contents) override;
|
||||
void AddNewContents(content::WebContents* source_contents,
|
||||
std::unique_ptr<content::WebContents> new_contents,
|
||||
const GURL& target_url,
|
||||
WindowOpenDisposition disposition,
|
||||
const blink::mojom::WindowFeatures& window_features,
|
||||
bool user_gesture,
|
||||
bool* was_blocked) override;
|
||||
content::WebContents* OpenURLFromTab(
|
||||
content::WebContents* source,
|
||||
const content::OpenURLParams& params) override;
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include "chrome/browser/ui/browser_tabstrip.h"
|
||||
#include "chrome/browser/ui/browser_window.h"
|
||||
#include "chrome/browser/ui/tabs/tab_strip_model.h"
|
||||
#include "chrome/browser/ui/views/frame/contents_web_view.h"
|
||||
#include "chrome/common/pref_names.h"
|
||||
#include "libcef/browser/chrome/views/chrome_browser_frame.h"
|
||||
#include "libcef/browser/chrome/views/chrome_browser_view.h"
|
||||
@@ -435,6 +436,9 @@ Browser* ChromeBrowserHostImpl::CreateBrowser(
|
||||
chrome_browser_view->InitBrowser(base::WrapUnique(browser),
|
||||
params.browser_view);
|
||||
|
||||
// Don't set theme colors in ContentsWebView::UpdateBackgroundColor.
|
||||
chrome_browser_view->contents_web_view()->SetBackgroundVisible(false);
|
||||
|
||||
// Don't show the browser by default.
|
||||
show_browser = false;
|
||||
}
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#include "libcef/browser/permission_prompt.h"
|
||||
|
||||
#include "base/task/thread_pool.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
|
||||
ChromeBrowserMainExtraPartsCef::ChromeBrowserMainExtraPartsCef() = default;
|
||||
|
||||
@@ -25,6 +26,9 @@ void ChromeBrowserMainExtraPartsCef::PostProfileInit(Profile* profile,
|
||||
CefRequestContextSettings settings;
|
||||
CefContext::Get()->PopulateGlobalRequestContextSettings(&settings);
|
||||
|
||||
// Use the existing path for the initial profile.
|
||||
CefString(&settings.cache_path) = profile->GetPath().value();
|
||||
|
||||
// Create the global RequestContext.
|
||||
global_request_context_ =
|
||||
CefRequestContextImpl::CreateGlobalRequestContext(settings);
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include "base/path_service.h"
|
||||
#include "chrome/browser/chrome_browser_main.h"
|
||||
#include "chrome/browser/net/system_network_context_manager.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "content/public/browser/navigation_throttle.h"
|
||||
@@ -241,21 +242,65 @@ bool ChromeContentBrowserClientCef::WillCreateURLLoaderFactory(
|
||||
bool* bypass_redirect_checks,
|
||||
bool* disable_secure_dns,
|
||||
network::mojom::URLLoaderFactoryOverridePtr* factory_override) {
|
||||
bool use_proxy = ChromeContentBrowserClient::WillCreateURLLoaderFactory(
|
||||
browser_context, frame, render_process_id, type, request_initiator,
|
||||
navigation_id, ukm_source_id, factory_receiver, header_client,
|
||||
bypass_redirect_checks, disable_secure_dns, factory_override);
|
||||
if (use_proxy) {
|
||||
// The chrome layer will handle the request.
|
||||
return use_proxy;
|
||||
}
|
||||
|
||||
// Don't intercept requests for Profiles that were not created by CEF.
|
||||
// For example, the User Manager profile created via
|
||||
// profiles::CreateSystemProfileForUserManager.
|
||||
auto profile = Profile::FromBrowserContext(browser_context);
|
||||
if (!CefBrowserContext::FromProfile(profile)) {
|
||||
return false;
|
||||
return ChromeContentBrowserClient::WillCreateURLLoaderFactory(
|
||||
browser_context, frame, render_process_id, type, request_initiator,
|
||||
navigation_id, ukm_source_id, factory_receiver, header_client,
|
||||
bypass_redirect_checks, disable_secure_dns, factory_override);
|
||||
}
|
||||
|
||||
// Based on content/browser/devtools/devtools_instrumentation.cc
|
||||
// WillCreateURLLoaderFactoryInternal.
|
||||
network::mojom::URLLoaderFactoryOverridePtr cef_override(
|
||||
network::mojom::URLLoaderFactoryOverride::New());
|
||||
// If caller passed some existing overrides, use those.
|
||||
// Otherwise, use our local var, then if handlers actually
|
||||
// decide to intercept, move it to |factory_override|.
|
||||
network::mojom::URLLoaderFactoryOverridePtr* handler_override =
|
||||
factory_override && *factory_override ? factory_override : &cef_override;
|
||||
network::mojom::URLLoaderFactoryOverride* intercepting_factory =
|
||||
handler_override->get();
|
||||
|
||||
// If we're the first interceptor to install an override, make a
|
||||
// remote/receiver pair, then handle this similarly to appending
|
||||
// a proxy to existing override.
|
||||
if (!intercepting_factory->overriding_factory) {
|
||||
DCHECK(!intercepting_factory->overridden_factory_receiver);
|
||||
intercepting_factory->overridden_factory_receiver =
|
||||
intercepting_factory->overriding_factory
|
||||
.InitWithNewPipeAndPassReceiver();
|
||||
}
|
||||
|
||||
// TODO(chrome): Is it necessary to proxy |header_client| callbacks?
|
||||
bool use_proxy = ChromeContentBrowserClient::WillCreateURLLoaderFactory(
|
||||
browser_context, frame, render_process_id, type, request_initiator,
|
||||
navigation_id, ukm_source_id,
|
||||
&(intercepting_factory->overridden_factory_receiver),
|
||||
/*header_client=*/nullptr, bypass_redirect_checks, disable_secure_dns,
|
||||
handler_override);
|
||||
|
||||
if (use_proxy) {
|
||||
DCHECK(intercepting_factory->overriding_factory);
|
||||
DCHECK(intercepting_factory->overridden_factory_receiver);
|
||||
if (!factory_override) {
|
||||
// Not a subresource navigation, so just override the target receiver.
|
||||
mojo::FusePipes(std::move(*factory_receiver),
|
||||
std::move(cef_override->overriding_factory));
|
||||
*factory_receiver = std::move(cef_override->overridden_factory_receiver);
|
||||
} else if (!*factory_override) {
|
||||
// No other overrides, so just returns ours as is.
|
||||
*factory_override = network::mojom::URLLoaderFactoryOverride::New(
|
||||
std::move(cef_override->overriding_factory),
|
||||
std::move(cef_override->overridden_factory_receiver), false);
|
||||
}
|
||||
// ... else things are already taken care of, as handler_override was
|
||||
// pointing to factory override and we've done all magic in-place.
|
||||
DCHECK(!cef_override->overriding_factory);
|
||||
DCHECK(!cef_override->overridden_factory_receiver);
|
||||
}
|
||||
|
||||
auto request_handler = net_service::CreateInterceptedRequestHandler(
|
||||
@@ -266,6 +311,7 @@ bool ChromeContentBrowserClientCef::WillCreateURLLoaderFactory(
|
||||
net_service::ProxyURLLoaderFactory::CreateProxy(
|
||||
browser_context, factory_receiver, header_client,
|
||||
std::move(request_handler));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -5,6 +5,7 @@
|
||||
#include "libcef/browser/chrome/views/browser_platform_delegate_chrome_views.h"
|
||||
|
||||
#include "include/views/cef_window.h"
|
||||
#include "libcef/browser/views/window_impl.h"
|
||||
|
||||
#include "chrome/browser/ui/browser.h"
|
||||
#include "ui/views/widget/widget.h"
|
||||
@@ -170,6 +171,23 @@ void CefBrowserPlatformDelegateChromeViews::PopupBrowserCreated(
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateChromeViews::UpdateFindBarBoundingBox(
|
||||
gfx::Rect* bounds) const {
|
||||
if (auto* window_impl = GetWindowImpl()) {
|
||||
if (window_impl->root_view()) {
|
||||
window_impl->root_view()->UpdateFindBarBoundingBox(bounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CefBrowserPlatformDelegateChromeViews::IsViewsHosted() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
CefWindowImpl* CefBrowserPlatformDelegateChromeViews::GetWindowImpl() const {
|
||||
if (auto* widget = GetWindowWidget()) {
|
||||
CefRefPtr<CefWindow> window = view_util::GetWindowFor(widget);
|
||||
return static_cast<CefWindowImpl*>(window.get());
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
@@ -8,6 +8,8 @@
|
||||
#include "libcef/browser/chrome/browser_platform_delegate_chrome.h"
|
||||
#include "libcef/browser/views/browser_view_impl.h"
|
||||
|
||||
class CefWindowImpl;
|
||||
|
||||
// Implementation of Chrome-based browser functionality.
|
||||
class CefBrowserPlatformDelegateChromeViews
|
||||
: public CefBrowserPlatformDelegateChrome {
|
||||
@@ -35,6 +37,7 @@ class CefBrowserPlatformDelegateChromeViews
|
||||
bool is_devtools) override;
|
||||
void PopupBrowserCreated(CefBrowserHostBase* new_browser,
|
||||
bool is_devtools) override;
|
||||
void UpdateFindBarBoundingBox(gfx::Rect* bounds) const override;
|
||||
bool IsViewsHosted() const override;
|
||||
|
||||
CefRefPtr<CefBrowserViewImpl> browser_view() const { return browser_view_; }
|
||||
@@ -42,6 +45,8 @@ class CefBrowserPlatformDelegateChromeViews
|
||||
private:
|
||||
void SetBrowserView(CefRefPtr<CefBrowserViewImpl> browser_view);
|
||||
|
||||
CefWindowImpl* GetWindowImpl() const;
|
||||
|
||||
CefRefPtr<CefBrowserViewImpl> browser_view_;
|
||||
};
|
||||
|
||||
|
@@ -8,6 +8,12 @@
|
||||
#include "chrome/browser/ui/browser.h"
|
||||
#include "chrome/browser/ui/views/frame/browser_view.h"
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
#include "libcef/browser/views/native_widget_mac.h"
|
||||
#include "libcef/browser/views/view_util.h"
|
||||
#include "ui/views/widget/native_widget_private.h"
|
||||
#endif
|
||||
|
||||
void ChromeBrowserFrame::Init(BrowserView* browser_view,
|
||||
std::unique_ptr<Browser> browser) {
|
||||
DCHECK(browser_view);
|
||||
@@ -21,6 +27,19 @@ void ChromeBrowserFrame::Init(BrowserView* browser_view,
|
||||
|
||||
// Initialize BrowserView state.
|
||||
browser_view->InitBrowser(std::move(browser));
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
// Initialize native window state.
|
||||
if (auto native_window = view_util::GetNativeWindow(this)) {
|
||||
if (auto* native_widget_private = views::internal::NativeWidgetPrivate::
|
||||
GetNativeWidgetForNativeWindow(native_window)) {
|
||||
auto* native_widget_mac =
|
||||
static_cast<CefNativeWidgetMac*>(native_widget_private);
|
||||
native_widget_mac->SetBrowserView(browser_view);
|
||||
native_widget_mac->OnWindowInitialized();
|
||||
}
|
||||
}
|
||||
#endif // BUILDFLAG(IS_MAC)
|
||||
}
|
||||
|
||||
views::internal::RootView* ChromeBrowserFrame::CreateRootView() {
|
||||
|
@@ -23,7 +23,6 @@
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#include "base/debug/alias.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/win/win_util.h"
|
||||
#include "chrome/chrome_elf/chrome_elf_main.h"
|
||||
#include "chrome/install_static/initialize_from_primary_module.h"
|
||||
#include "include/internal/cef_win.h"
|
||||
@@ -300,7 +299,7 @@ bool CefInitialize(const CefMainArgs& args,
|
||||
}
|
||||
|
||||
if (settings.size != sizeof(cef_settings_t)) {
|
||||
NOTREACHED() << "invalid CefSettings structure size";
|
||||
DCHECK(false) << "invalid CefSettings structure size";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -315,13 +314,13 @@ bool CefInitialize(const CefMainArgs& args,
|
||||
void CefShutdown() {
|
||||
// Verify that the context is in a valid state.
|
||||
if (!CONTEXT_STATE_VALID()) {
|
||||
NOTREACHED() << "context not valid";
|
||||
DCHECK(false) << "context not valid";
|
||||
return;
|
||||
}
|
||||
|
||||
// Must always be called on the same thread as Initialize.
|
||||
if (!g_context->OnInitThread()) {
|
||||
NOTREACHED() << "called on invalid thread";
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -336,13 +335,13 @@ void CefShutdown() {
|
||||
void CefDoMessageLoopWork() {
|
||||
// Verify that the context is in a valid state.
|
||||
if (!CONTEXT_STATE_VALID()) {
|
||||
NOTREACHED() << "context not valid";
|
||||
DCHECK(false) << "context not valid";
|
||||
return;
|
||||
}
|
||||
|
||||
// Must always be called on the same thread as Initialize.
|
||||
if (!g_context->OnInitThread()) {
|
||||
NOTREACHED() << "called on invalid thread";
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -353,13 +352,13 @@ void CefDoMessageLoopWork() {
|
||||
void CefRunMessageLoop() {
|
||||
// Verify that the context is in a valid state.
|
||||
if (!CONTEXT_STATE_VALID()) {
|
||||
NOTREACHED() << "context not valid";
|
||||
DCHECK(false) << "context not valid";
|
||||
return;
|
||||
}
|
||||
|
||||
// Must always be called on the same thread as Initialize.
|
||||
if (!g_context->OnInitThread()) {
|
||||
NOTREACHED() << "called on invalid thread";
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -369,13 +368,13 @@ void CefRunMessageLoop() {
|
||||
void CefQuitMessageLoop() {
|
||||
// Verify that the context is in a valid state.
|
||||
if (!CONTEXT_STATE_VALID()) {
|
||||
NOTREACHED() << "context not valid";
|
||||
DCHECK(false) << "context not valid";
|
||||
return;
|
||||
}
|
||||
|
||||
// Must always be called on the same thread as Initialize.
|
||||
if (!g_context->OnInitThread()) {
|
||||
NOTREACHED() << "called on invalid thread";
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -401,14 +400,10 @@ int CefRunMainWithPreferredStackSize(mainPtr main, int argc, char* argv[]) {
|
||||
}
|
||||
#endif // defined(ARCH_CPU_32_BITS)
|
||||
|
||||
void CefEnableHighDPISupport() {
|
||||
base::win::EnableHighDPISupport();
|
||||
}
|
||||
|
||||
void CefSetOSModalLoop(bool osModalLoop) {
|
||||
// Verify that the context is in a valid state.
|
||||
if (!CONTEXT_STATE_VALID()) {
|
||||
NOTREACHED() << "context not valid";
|
||||
DCHECK(false) << "context not valid";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -227,7 +227,7 @@ class CefDevToolsFrontend::NetworkResourceLoader
|
||||
bindings_->loaders_.erase(bindings_->loaders_.find(this));
|
||||
}
|
||||
|
||||
void OnRetry(base::OnceClosure start_retry) override { NOTREACHED(); }
|
||||
void OnRetry(base::OnceClosure start_retry) override { DCHECK(false); }
|
||||
|
||||
const int stream_id_;
|
||||
CefDevToolsFrontend* const bindings_;
|
||||
|
@@ -39,6 +39,17 @@ bool CefDownloadItemImpl::IsCanceled() {
|
||||
return const_value().GetState() == download::DownloadItem::CANCELLED;
|
||||
}
|
||||
|
||||
bool CefDownloadItemImpl::IsInterrupted() {
|
||||
CEF_VALUE_VERIFY_RETURN(false, false);
|
||||
return const_value().GetState() == download::DownloadItem::INTERRUPTED;
|
||||
}
|
||||
|
||||
cef_download_interrupt_reason_t CefDownloadItemImpl::GetInterruptReason() {
|
||||
CEF_VALUE_VERIFY_RETURN(false, CEF_DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||
return static_cast<cef_download_interrupt_reason_t>(
|
||||
const_value().GetLastReason());
|
||||
}
|
||||
|
||||
int64 CefDownloadItemImpl::GetCurrentSpeed() {
|
||||
CEF_VALUE_VERIFY_RETURN(false, 0);
|
||||
return const_value().CurrentSpeed();
|
||||
|
@@ -27,6 +27,8 @@ class CefDownloadItemImpl
|
||||
bool IsInProgress() override;
|
||||
bool IsComplete() override;
|
||||
bool IsCanceled() override;
|
||||
bool IsInterrupted() override;
|
||||
cef_download_interrupt_reason_t GetInterruptReason() override;
|
||||
int64 GetCurrentSpeed() override;
|
||||
int GetPercentComplete() override;
|
||||
int64 GetTotalBytes() override;
|
||||
|
@@ -94,7 +94,7 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
base::FilePath dir_path = suggested_path.DirName();
|
||||
if (!base::DirectoryExists(dir_path) &&
|
||||
!base::CreateDirectory(dir_path)) {
|
||||
NOTREACHED() << "failed to create the download directory";
|
||||
DCHECK(false) << "failed to create the download directory";
|
||||
suggested_path.clear();
|
||||
}
|
||||
}
|
||||
|
@@ -54,7 +54,7 @@ CefRefPtr<CefExtensionHandler> CefExtensionImpl::GetHandler() {
|
||||
|
||||
CefRefPtr<CefRequestContext> CefExtensionImpl::GetLoaderContext() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
NOTREACHED() << "called on invalid thread";
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ CefRefPtr<CefRequestContext> CefExtensionImpl::GetLoaderContext() {
|
||||
|
||||
bool CefExtensionImpl::IsLoaded() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
NOTREACHED() << "called on invalid thread";
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -69,9 +69,9 @@ ExtensionFunction::ResponseAction TabsGetFunction::Run() {
|
||||
TabsCreateFunction::TabsCreateFunction() : cef_details_(this) {}
|
||||
|
||||
ExtensionFunction::ResponseAction TabsCreateFunction::Run() {
|
||||
std::unique_ptr<tabs::Create::Params> params(
|
||||
tabs::Create::Params::Create(args()));
|
||||
EXTENSION_FUNCTION_VALIDATE(params.get());
|
||||
absl::optional<tabs::Create::Params> params =
|
||||
tabs::Create::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
CefExtensionFunctionDetails::OpenTabParams options;
|
||||
options.window_id = params->create_properties.window_id;
|
||||
@@ -90,8 +90,9 @@ ExtensionFunction::ResponseAction TabsCreateFunction::Run() {
|
||||
}
|
||||
|
||||
// Return data about the newly created tab.
|
||||
return RespondNow(has_callback() ? OneArgument(base::Value(result->ToValue()))
|
||||
: NoArguments());
|
||||
return RespondNow(has_callback()
|
||||
? WithArguments(base::Value(result->ToValue()))
|
||||
: NoArguments());
|
||||
}
|
||||
|
||||
BaseAPIFunction::BaseAPIFunction() : cef_details_(this) {}
|
||||
@@ -108,9 +109,9 @@ content::WebContents* BaseAPIFunction::GetWebContents(int tab_id) {
|
||||
}
|
||||
|
||||
ExtensionFunction::ResponseAction TabsUpdateFunction::Run() {
|
||||
std::unique_ptr<tabs::Update::Params> params(
|
||||
tabs::Update::Params::Create(args()));
|
||||
EXTENSION_FUNCTION_VALIDATE(params.get());
|
||||
absl::optional<tabs::Update::Params> params =
|
||||
tabs::Update::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
tab_id_ = params->tab_id ? *params->tab_id : -1;
|
||||
content::WebContents* web_contents = GetWebContents(tab_id_);
|
||||
@@ -195,8 +196,12 @@ bool TabsUpdateFunction::UpdateURL(const std::string& url_string,
|
||||
int tab_id,
|
||||
std::string* error) {
|
||||
GURL url;
|
||||
if (!ExtensionTabUtil::PrepareURLForNavigation(url_string, extension(), &url,
|
||||
error)) {
|
||||
auto url_expected = ExtensionTabUtil::PrepareURLForNavigation(
|
||||
url_string, extension(), browser_context());
|
||||
if (url_expected.has_value()) {
|
||||
url = *url_expected;
|
||||
} else {
|
||||
*error = std::move(url_expected.error());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -274,7 +279,7 @@ ExecuteCodeFunction::InitResult ExecuteCodeInTabFunction::Init() {
|
||||
return set_init_result(VALIDATION_FAILURE);
|
||||
}
|
||||
std::unique_ptr<InjectDetails> details(new InjectDetails());
|
||||
if (!InjectDetails::Populate(details_value, details.get())) {
|
||||
if (!InjectDetails::Populate(details_value.GetDict(), *details)) {
|
||||
return set_init_result(VALIDATION_FAILURE);
|
||||
}
|
||||
|
||||
@@ -415,8 +420,8 @@ bool TabsRemoveCSSFunction::ShouldRemoveCSS() const {
|
||||
}
|
||||
|
||||
ExtensionFunction::ResponseAction TabsSetZoomFunction::Run() {
|
||||
std::unique_ptr<tabs::SetZoom::Params> params(
|
||||
tabs::SetZoom::Params::Create(args()));
|
||||
absl::optional<tabs::SetZoom::Params> params =
|
||||
tabs::SetZoom::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
int tab_id = params->tab_id ? *params->tab_id : -1;
|
||||
@@ -447,8 +452,8 @@ ExtensionFunction::ResponseAction TabsSetZoomFunction::Run() {
|
||||
}
|
||||
|
||||
ExtensionFunction::ResponseAction TabsGetZoomFunction::Run() {
|
||||
std::unique_ptr<tabs::GetZoom::Params> params(
|
||||
tabs::GetZoom::Params::Create(args()));
|
||||
absl::optional<tabs::GetZoom::Params> params =
|
||||
tabs::GetZoom::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
int tab_id = params->tab_id ? *params->tab_id : -1;
|
||||
@@ -467,8 +472,8 @@ ExtensionFunction::ResponseAction TabsGetZoomFunction::Run() {
|
||||
ExtensionFunction::ResponseAction TabsSetZoomSettingsFunction::Run() {
|
||||
using api::tabs::ZoomSettings;
|
||||
|
||||
std::unique_ptr<tabs::SetZoomSettings::Params> params(
|
||||
tabs::SetZoomSettings::Params::Create(args()));
|
||||
absl::optional<tabs::SetZoomSettings::Params> params =
|
||||
tabs::SetZoomSettings::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
int tab_id = params->tab_id ? *params->tab_id : -1;
|
||||
@@ -518,8 +523,8 @@ ExtensionFunction::ResponseAction TabsSetZoomSettingsFunction::Run() {
|
||||
}
|
||||
|
||||
ExtensionFunction::ResponseAction TabsGetZoomSettingsFunction::Run() {
|
||||
std::unique_ptr<tabs::GetZoomSettings::Params> params(
|
||||
tabs::GetZoomSettings::Params::Create(args()));
|
||||
absl::optional<tabs::GetZoomSettings::Params> params =
|
||||
tabs::GetZoomSettings::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
int tab_id = params->tab_id ? *params->tab_id : -1;
|
||||
|
@@ -43,6 +43,7 @@ const char* const kSupportedAPIs[] = {
|
||||
ContentSettingsContentSettingGetResourceIdentifiersFunction),
|
||||
"pdfViewerPrivate",
|
||||
EXTENSION_FUNCTION_NAME(PdfViewerPrivateIsAllowedLocalFileAccessFunction),
|
||||
EXTENSION_FUNCTION_NAME(PdfViewerPrivateIsPdfOcrAlwaysActiveFunction),
|
||||
"resourcesPrivate",
|
||||
EXTENSION_FUNCTION_NAME(ResourcesPrivateGetStringsFunction),
|
||||
"storage",
|
||||
@@ -91,6 +92,7 @@ void ChromeFunctionRegistry::RegisterAll(ExtensionFunctionRegistry* registry) {
|
||||
ContentSettingsContentSettingGetResourceIdentifiersFunction>();
|
||||
registry
|
||||
->RegisterFunction<PdfViewerPrivateIsAllowedLocalFileAccessFunction>();
|
||||
registry->RegisterFunction<PdfViewerPrivateIsPdfOcrAlwaysActiveFunction>();
|
||||
registry->RegisterFunction<ResourcesPrivateGetStringsFunction>();
|
||||
registry->RegisterFunction<StorageStorageAreaGetFunction>();
|
||||
registry->RegisterFunction<StorageStorageAreaSetFunction>();
|
||||
|
@@ -324,9 +324,12 @@ std::unique_ptr<api::tabs::Tab> CefExtensionFunctionDetails::OpenTab(
|
||||
|
||||
GURL url;
|
||||
if (params.url.has_value()) {
|
||||
std::string url_string = *params.url;
|
||||
if (!ExtensionTabUtil::PrepareURLForNavigation(
|
||||
url_string, function()->extension(), &url, error_message)) {
|
||||
auto url_expected = ExtensionTabUtil::PrepareURLForNavigation(
|
||||
*params.url, function()->extension(), function()->browser_context());
|
||||
if (url_expected.has_value()) {
|
||||
url = *url_expected;
|
||||
} else {
|
||||
*error_message = std::move(url_expected.error());
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ void CefExtensionHostDelegate::OnMainFrameCreatedForBackgroundPage(
|
||||
content::JavaScriptDialogManager*
|
||||
CefExtensionHostDelegate::GetJavaScriptDialogManager() {
|
||||
// Never routed here from AlloyBrowserHostImpl.
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ void CefExtensionHostDelegate::CreateTab(
|
||||
std::unique_ptr<content::WebContents> web_contents,
|
||||
const std::string& extension_id,
|
||||
WindowOpenDisposition disposition,
|
||||
const gfx::Rect& initial_rect,
|
||||
const blink::mojom::WindowFeatures& window_features,
|
||||
bool user_gesture) {
|
||||
// TODO(cef): Add support for extensions opening popup windows.
|
||||
NOTIMPLEMENTED();
|
||||
@@ -46,7 +46,7 @@ void CefExtensionHostDelegate::ProcessMediaAccessRequest(
|
||||
content::MediaResponseCallback callback,
|
||||
const Extension* extension) {
|
||||
// Never routed here from AlloyBrowserHostImpl.
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
bool CefExtensionHostDelegate::CheckMediaAccessPermission(
|
||||
@@ -55,18 +55,18 @@ bool CefExtensionHostDelegate::CheckMediaAccessPermission(
|
||||
blink::mojom::MediaStreamType type,
|
||||
const Extension* extension) {
|
||||
// Never routed here from AlloyBrowserHostImpl.
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
content::PictureInPictureResult CefExtensionHostDelegate::EnterPictureInPicture(
|
||||
content::WebContents* web_contents) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return content::PictureInPictureResult::kNotSupported;
|
||||
}
|
||||
|
||||
void CefExtensionHostDelegate::ExitPictureInPicture() {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
} // namespace extensions
|
||||
|
@@ -27,7 +27,7 @@ class CefExtensionHostDelegate : public ExtensionHostDelegate {
|
||||
void CreateTab(std::unique_ptr<content::WebContents> web_contents,
|
||||
const std::string& extension_id,
|
||||
WindowOpenDisposition disposition,
|
||||
const gfx::Rect& initial_rect,
|
||||
const blink::mojom::WindowFeatures& window_features,
|
||||
bool user_gesture) override;
|
||||
void ProcessMediaAccessRequest(content::WebContents* web_contents,
|
||||
const content::MediaStreamRequest& request,
|
||||
|
@@ -36,7 +36,6 @@
|
||||
#include "extensions/browser/api/app_runtime/app_runtime_api.h"
|
||||
#include "extensions/browser/extension_prefs.h"
|
||||
#include "extensions/browser/extension_registry.h"
|
||||
#include "extensions/browser/info_map.h"
|
||||
#include "extensions/browser/notification_types.h"
|
||||
#include "extensions/browser/null_app_sorting.h"
|
||||
#include "extensions/browser/quota_service.h"
|
||||
@@ -437,13 +436,6 @@ CefExtensionSystem::store_factory() {
|
||||
return store_factory_;
|
||||
}
|
||||
|
||||
InfoMap* CefExtensionSystem::info_map() {
|
||||
if (!info_map_.get()) {
|
||||
info_map_ = new InfoMap;
|
||||
}
|
||||
return info_map_.get();
|
||||
}
|
||||
|
||||
QuotaService* CefExtensionSystem::quota_service() {
|
||||
return quota_service_.get();
|
||||
}
|
||||
@@ -452,31 +444,6 @@ AppSorting* CefExtensionSystem::app_sorting() {
|
||||
return app_sorting_.get();
|
||||
}
|
||||
|
||||
// Implementation based on
|
||||
// ExtensionSystemImpl::RegisterExtensionWithRequestContexts.
|
||||
void CefExtensionSystem::RegisterExtensionWithRequestContexts(
|
||||
const Extension* extension,
|
||||
base::OnceClosure callback) {
|
||||
// TODO(extensions): The |incognito_enabled| value should be set based on
|
||||
// manifest settings.
|
||||
content::GetIOThreadTaskRunner({})->PostTaskAndReply(
|
||||
FROM_HERE,
|
||||
base::BindOnce(&InfoMap::AddExtension, info_map(),
|
||||
base::RetainedRef(extension), base::Time::Now(),
|
||||
true, // incognito_enabled
|
||||
false), // notifications_disabled
|
||||
std::move(callback));
|
||||
}
|
||||
|
||||
// Implementation based on
|
||||
// ExtensionSystemImpl::UnregisterExtensionWithRequestContexts.
|
||||
void CefExtensionSystem::UnregisterExtensionWithRequestContexts(
|
||||
const std::string& extension_id) {
|
||||
content::GetIOThreadTaskRunner({})->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(&InfoMap::RemoveExtension, info_map(), extension_id));
|
||||
}
|
||||
|
||||
const base::OneShotEvent& CefExtensionSystem::ready() const {
|
||||
return ready_;
|
||||
}
|
||||
@@ -500,20 +467,20 @@ void CefExtensionSystem::InstallUpdate(
|
||||
const base::FilePath& temp_dir,
|
||||
bool install_immediately,
|
||||
InstallUpdateCallback install_update_callback) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
base::DeletePathRecursively(temp_dir);
|
||||
}
|
||||
|
||||
void CefExtensionSystem::PerformActionBasedOnOmahaAttributes(
|
||||
const std::string& extension_id,
|
||||
const base::Value& attributes) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
bool CefExtensionSystem::FinishDelayedInstallationIfReady(
|
||||
const std::string& extension_id,
|
||||
bool install_immediately) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -615,18 +582,11 @@ void CefExtensionSystem::UnloadExtension(const std::string& extension_id,
|
||||
// This method can be called via PostTask, so the extension may have been
|
||||
// unloaded by the time this runs.
|
||||
if (!extension.get()) {
|
||||
// In case the extension may have crashed/uninstalled. Allow the profile to
|
||||
// clean up its RequestContexts.
|
||||
UnregisterExtensionWithRequestContexts(extension_id);
|
||||
return;
|
||||
}
|
||||
|
||||
if (registry_->disabled_extensions().Contains(extension->id())) {
|
||||
registry_->RemoveDisabled(extension->id());
|
||||
// Make sure the profile cleans up its RequestContexts when an already
|
||||
// disabled extension is unloaded (since they are also tracking the disabled
|
||||
// extensions).
|
||||
UnregisterExtensionWithRequestContexts(extension_id);
|
||||
// Don't send the unloaded notification. It was sent when the extension
|
||||
// was disabled.
|
||||
} else {
|
||||
@@ -638,18 +598,6 @@ void CefExtensionSystem::UnloadExtension(const std::string& extension_id,
|
||||
|
||||
// Implementation based on ExtensionService::NotifyExtensionLoaded.
|
||||
void CefExtensionSystem::NotifyExtensionLoaded(const Extension* extension) {
|
||||
// The URLRequestContexts need to be first to know that the extension
|
||||
// was loaded, otherwise a race can arise where a renderer that is created
|
||||
// for the extension may try to load an extension URL with an extension id
|
||||
// that the request context doesn't yet know about. The profile is responsible
|
||||
// for ensuring its URLRequestContexts appropriately discover the loaded
|
||||
// extension.
|
||||
RegisterExtensionWithRequestContexts(
|
||||
extension,
|
||||
base::BindOnce(
|
||||
&CefExtensionSystem::OnExtensionRegisteredWithRequestContexts,
|
||||
weak_ptr_factory_.GetWeakPtr(), base::WrapRefCounted(extension)));
|
||||
|
||||
// Tell renderers about the loaded extension.
|
||||
renderer_helper_->OnExtensionLoaded(*extension);
|
||||
|
||||
@@ -690,14 +638,6 @@ void CefExtensionSystem::NotifyExtensionLoaded(const Extension* extension) {
|
||||
}
|
||||
}
|
||||
|
||||
void CefExtensionSystem::OnExtensionRegisteredWithRequestContexts(
|
||||
scoped_refptr<const extensions::Extension> extension) {
|
||||
registry_->AddReady(extension);
|
||||
if (registry_->enabled_extensions().Contains(extension->id())) {
|
||||
registry_->TriggerOnReady(extension.get());
|
||||
}
|
||||
}
|
||||
|
||||
// Implementation based on ExtensionService::NotifyExtensionUnloaded.
|
||||
void CefExtensionSystem::NotifyExtensionUnloaded(
|
||||
const Extension* extension,
|
||||
@@ -718,8 +658,6 @@ void CefExtensionSystem::NotifyExtensionUnloaded(
|
||||
|
||||
// Tell renderers about the unloaded extension.
|
||||
renderer_helper_->OnExtensionUnloaded(*extension);
|
||||
|
||||
UnregisterExtensionWithRequestContexts(extension->id());
|
||||
}
|
||||
|
||||
} // namespace extensions
|
||||
|
@@ -94,14 +94,8 @@ class CefExtensionSystem : public ExtensionSystem {
|
||||
StateStore* rules_store() override;
|
||||
StateStore* dynamic_user_scripts_store() override;
|
||||
scoped_refptr<value_store::ValueStoreFactory> store_factory() override;
|
||||
InfoMap* info_map() override;
|
||||
QuotaService* quota_service() override;
|
||||
AppSorting* app_sorting() override;
|
||||
void RegisterExtensionWithRequestContexts(
|
||||
const Extension* extension,
|
||||
base::OnceClosure callback) override;
|
||||
void UnregisterExtensionWithRequestContexts(
|
||||
const std::string& extension_id) override;
|
||||
const base::OneShotEvent& ready() const override;
|
||||
bool is_ready() const override;
|
||||
ContentVerifier* content_verifier() override;
|
||||
@@ -159,18 +153,10 @@ class CefExtensionSystem : public ExtensionSystem {
|
||||
void NotifyExtensionUnloaded(const Extension* extension,
|
||||
UnloadedExtensionReason reason);
|
||||
|
||||
// Completes extension loading after URLRequestContexts have been updated
|
||||
// on the IO thread.
|
||||
void OnExtensionRegisteredWithRequestContexts(
|
||||
scoped_refptr<const extensions::Extension> extension);
|
||||
|
||||
content::BrowserContext* browser_context_; // Not owned.
|
||||
|
||||
bool initialized_;
|
||||
|
||||
// Data to be accessed on the IO thread. Must outlive process_manager_.
|
||||
scoped_refptr<InfoMap> info_map_;
|
||||
|
||||
std::unique_ptr<ServiceWorkerManager> service_worker_manager_;
|
||||
std::unique_ptr<QuotaService> quota_service_;
|
||||
std::unique_ptr<AppSorting> app_sorting_;
|
||||
|
@@ -28,7 +28,7 @@ CefExtensionsAPIClient::CefExtensionsAPIClient() {}
|
||||
AppViewGuestDelegate* CefExtensionsAPIClient::CreateAppViewGuestDelegate()
|
||||
const {
|
||||
// TODO(extensions): Implement to support Apps.
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@@ -246,7 +246,7 @@ ProcessManagerDelegate* CefExtensionsBrowserClient::GetProcessManagerDelegate()
|
||||
std::unique_ptr<ExtensionHostDelegate>
|
||||
CefExtensionsBrowserClient::CreateExtensionHostDelegate() {
|
||||
// CEF does not use the ExtensionHost constructor that calls this method.
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return std::unique_ptr<ExtensionHostDelegate>();
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ std::unique_ptr<RuntimeAPIDelegate>
|
||||
CefExtensionsBrowserClient::CreateRuntimeAPIDelegate(
|
||||
content::BrowserContext* context) const {
|
||||
// TODO(extensions): Implement to support Apps.
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ void CefExtensionsBrowserClient::BroadcastEventToRenderers(
|
||||
|
||||
ExtensionCache* CefExtensionsBrowserClient::GetExtensionCache() {
|
||||
// Only used by Chrome via ExtensionService.
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@@ -34,19 +34,19 @@ void CefValueStore::set_status_code(StatusCode status_code) {
|
||||
|
||||
size_t CefValueStore::GetBytesInUse(const std::string& key) {
|
||||
// Let SettingsStorageQuotaEnforcer implement this.
|
||||
NOTREACHED() << "Not implemented";
|
||||
DCHECK(false) << "Not implemented";
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t CefValueStore::GetBytesInUse(const std::vector<std::string>& keys) {
|
||||
// Let SettingsStorageQuotaEnforcer implement this.
|
||||
NOTREACHED() << "Not implemented";
|
||||
DCHECK(false) << "Not implemented";
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t CefValueStore::GetBytesInUse() {
|
||||
// Let SettingsStorageQuotaEnforcer implement this.
|
||||
NOTREACHED() << "Not implemented";
|
||||
DCHECK(false) << "Not implemented";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "chrome/browser/file_select_helper.h"
|
||||
#include "content/public/browser/file_select_listener.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
@@ -490,7 +491,7 @@ CefFileDialogManager::MaybeRunDelegate(
|
||||
mode = FILE_DIALOG_SAVE;
|
||||
break;
|
||||
default:
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -227,12 +227,12 @@ CefRefPtr<CefBrowser> CefFrameHostImpl::GetBrowser() {
|
||||
}
|
||||
|
||||
CefRefPtr<CefV8Context> CefFrameHostImpl::GetV8Context() {
|
||||
NOTREACHED() << "GetV8Context cannot be called from the browser process";
|
||||
DCHECK(false) << "GetV8Context cannot be called from the browser process";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CefFrameHostImpl::VisitDOM(CefRefPtr<CefDOMVisitor> visitor) {
|
||||
NOTREACHED() << "VisitDOM cannot be called from the browser process";
|
||||
DCHECK(false) << "VisitDOM cannot be called from the browser process";
|
||||
}
|
||||
|
||||
CefRefPtr<CefURLRequest> CefFrameHostImpl::CreateURLRequest(
|
||||
@@ -243,7 +243,7 @@ CefRefPtr<CefURLRequest> CefFrameHostImpl::CreateURLRequest(
|
||||
}
|
||||
|
||||
if (!CefTaskRunnerImpl::GetCurrentTaskRunner()) {
|
||||
NOTREACHED() << "called on invalid thread";
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
102
libcef/browser/geometry_util.cc
Normal file
102
libcef/browser/geometry_util.cc
Normal file
@@ -0,0 +1,102 @@
|
||||
// Copyright (c) 2022 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/geometry_util.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "ui/gfx/geometry/rect.h"
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr int kMinWidth = 0;
|
||||
constexpr int kMinHeight = 0;
|
||||
|
||||
// Makes sure that line segment lies entirely between min and max.
|
||||
int clamp_segment_start(int start, int len, int min, int max) {
|
||||
start = std::clamp(start, min, max);
|
||||
const int end = start + len;
|
||||
const int excess = end - max;
|
||||
|
||||
if (excess > 0) {
|
||||
start = start - excess;
|
||||
}
|
||||
|
||||
return start;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
gfx::Rect MakeVisibleOnScreenRect(const gfx::Rect& rect,
|
||||
const gfx::Rect& screen) {
|
||||
const int width = std::clamp(rect.width(), kMinWidth, screen.width());
|
||||
const int height = std::clamp(rect.height(), kMinHeight, screen.height());
|
||||
|
||||
const int right_border = screen.x() + screen.width();
|
||||
const int x = clamp_segment_start(rect.x(), width, screen.x(), right_border);
|
||||
|
||||
const int bottom_border = screen.y() + screen.height();
|
||||
const int y =
|
||||
clamp_segment_start(rect.y(), height, screen.y(), bottom_border);
|
||||
|
||||
return gfx::Rect(x, y, width, height);
|
||||
}
|
||||
|
||||
gfx::Rect SubtractOverlayFromBoundingBox(const gfx::Rect& bounds,
|
||||
const gfx::Rect& overlay,
|
||||
int max_distance) {
|
||||
if (overlay.Contains(bounds)) {
|
||||
// Early exit; |bounds| is completely inside |overlay|.
|
||||
return bounds;
|
||||
}
|
||||
|
||||
// Portion of |overlay| that is inside |bounds|.
|
||||
auto overlap = overlay;
|
||||
overlap.Intersect(bounds);
|
||||
if (overlap.IsEmpty()) {
|
||||
// Early exit; |bounds| and |overlay| don't intersect.
|
||||
return bounds;
|
||||
}
|
||||
|
||||
gfx::Insets insets;
|
||||
|
||||
if (overlap.width() >= overlap.height()) {
|
||||
// Wide overlay; maybe inset |bounds| in the Y direction.
|
||||
const int delta_top = overlap.y() - bounds.y();
|
||||
const int delta_bottom =
|
||||
bounds.y() + bounds.height() - overlap.y() - overlap.height();
|
||||
|
||||
// Inset from the closest side that meets |max_distance| requirements.
|
||||
if (delta_top <= delta_bottom && delta_top <= max_distance) {
|
||||
// Inset from the top.
|
||||
insets.set_top(delta_top + overlap.height());
|
||||
} else if (delta_bottom <= max_distance) {
|
||||
// Inset from the bottom.
|
||||
insets.set_bottom(delta_bottom + overlap.height());
|
||||
}
|
||||
} else {
|
||||
// Tall overlay; maybe inset |bounds| in the X direction.
|
||||
const int delta_left = overlap.x() - bounds.x();
|
||||
const int delta_right =
|
||||
bounds.x() + bounds.width() - overlap.x() - overlap.width();
|
||||
|
||||
// Inset from the closest side that meets |max_distance| requirements.
|
||||
if (delta_left <= delta_right && delta_left <= max_distance) {
|
||||
// Inset from the left.
|
||||
insets.set_left(delta_left + overlap.width());
|
||||
} else if (delta_right <= max_distance) {
|
||||
// Inset from the right.
|
||||
insets.set_right(delta_right + overlap.width());
|
||||
}
|
||||
}
|
||||
|
||||
if (insets.IsEmpty()) {
|
||||
// |overlay| is too far inside |bounds| to trigger insets.
|
||||
return bounds;
|
||||
}
|
||||
|
||||
auto result = bounds;
|
||||
result.Inset(insets);
|
||||
return result;
|
||||
}
|
29
libcef/browser/geometry_util.h
Normal file
29
libcef/browser/geometry_util.h
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright (c) 2022 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_GEOMETRY_UTIL_H_
|
||||
#define CEF_LIBCEF_BROWSER_GEOMETRY_UTIL_H_
|
||||
#pragma once
|
||||
|
||||
namespace gfx {
|
||||
class Rect;
|
||||
}
|
||||
|
||||
// Create a new rectangle from the input |rect| rectangle that is fully visible
|
||||
// on provided |screen_rect| screen. The width and height of the resulting
|
||||
// rectangle are clamped to the screen width and height respectively if they
|
||||
// would overflow.
|
||||
gfx::Rect MakeVisibleOnScreenRect(const gfx::Rect& rect,
|
||||
const gfx::Rect& screen);
|
||||
|
||||
// Possibly subtract |overlay| from |bounds|. We only want to subtract overlays
|
||||
// that are inside |bounds| and close to the edges, so |max_distance| is the
|
||||
// maximum allowed distance between |overlay| and |bounds| extents in order to
|
||||
// trigger the subtraction. Subtraction will occur from the closest edge. If
|
||||
// distances are otherwise equal then top will be preferred followed by left.
|
||||
gfx::Rect SubtractOverlayFromBoundingBox(const gfx::Rect& bounds,
|
||||
const gfx::Rect& overlay,
|
||||
int max_distance);
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_GEOMETRY_UTIL_H_
|
352
libcef/browser/geometry_util_unittest.cc
Normal file
352
libcef/browser/geometry_util_unittest.cc
Normal file
@@ -0,0 +1,352 @@
|
||||
// Copyright (c) 2022 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 "cef/libcef/browser/geometry_util.h"
|
||||
#include "tests/gtest/include/gtest/gtest.h"
|
||||
|
||||
#include "ui/gfx/geometry/rect.h"
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr int kScreenWidth = 1024;
|
||||
constexpr int kScreenHeight = 768;
|
||||
const gfx::Rect kMainScreen(0, 0, kScreenWidth, kScreenHeight);
|
||||
const gfx::Rect kLeftScreen(-1024, 0, kScreenWidth, kScreenHeight);
|
||||
|
||||
#define EXPECT_RECT_EQ(rect1, rect2) \
|
||||
EXPECT_EQ(rect1.x(), rect2.x()); \
|
||||
EXPECT_EQ(rect1.y(), rect2.y()); \
|
||||
EXPECT_EQ(rect1.width(), rect2.width()); \
|
||||
EXPECT_EQ(rect1.height(), rect2.height())
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST(GeometryUtil, MakeVisibleOnScreenRect_RectSizeIsBiggerThanScreen) {
|
||||
const gfx::Rect rect{400, 500, 1500, 800};
|
||||
|
||||
auto result = MakeVisibleOnScreenRect(rect, kMainScreen);
|
||||
|
||||
EXPECT_EQ(result.x(), 0);
|
||||
EXPECT_EQ(result.width(), kMainScreen.width());
|
||||
EXPECT_EQ(result.y(), 0);
|
||||
EXPECT_EQ(result.height(), kMainScreen.height());
|
||||
}
|
||||
|
||||
TEST(GeometryUtil, MakeVisibleOnScreenRect_RightBorderIsOutsideTheScreen) {
|
||||
const gfx::Rect rect{600, 400, 500, 300};
|
||||
|
||||
auto result = MakeVisibleOnScreenRect(rect, kMainScreen);
|
||||
|
||||
EXPECT_EQ(result.x(), 524);
|
||||
EXPECT_EQ(result.width(), rect.width());
|
||||
EXPECT_EQ(result.y(), rect.y());
|
||||
EXPECT_EQ(result.height(), rect.height());
|
||||
}
|
||||
|
||||
TEST(GeometryUtil, MakeVisibleOnScreenRect_LeftBorderIsOutsideTheScreen) {
|
||||
const gfx::Rect rect{-400, 400, 500, 300};
|
||||
|
||||
auto result = MakeVisibleOnScreenRect(rect, kMainScreen);
|
||||
|
||||
EXPECT_EQ(result.x(), 0);
|
||||
EXPECT_EQ(result.width(), rect.width());
|
||||
EXPECT_EQ(result.y(), rect.y());
|
||||
EXPECT_EQ(result.height(), rect.height());
|
||||
}
|
||||
|
||||
TEST(GeometryUtil, MakeVisibleOnScreenRect_BottomBorderIsOutsideTheScreen) {
|
||||
const gfx::Rect rect{600, 500, 300, 300};
|
||||
|
||||
auto result = MakeVisibleOnScreenRect(rect, kMainScreen);
|
||||
|
||||
EXPECT_EQ(result.x(), 600);
|
||||
EXPECT_EQ(result.width(), rect.width());
|
||||
EXPECT_EQ(result.y(), 468);
|
||||
EXPECT_EQ(result.height(), rect.height());
|
||||
}
|
||||
|
||||
TEST(GeometryUtil, MakeVisibleOnScreenRect_RectIsVisibleOnTheLeftScreen) {
|
||||
const gfx::Rect rect{-500, 300, 300, 300};
|
||||
|
||||
auto result = MakeVisibleOnScreenRect(rect, kLeftScreen);
|
||||
|
||||
EXPECT_RECT_EQ(result, rect);
|
||||
}
|
||||
|
||||
TEST(GeometryUtil, MakeVisibleOnScreenRect_RectSizeIsBiggerThanLeftScreen) {
|
||||
const gfx::Rect rect{-500, 300, 3000, 3000};
|
||||
|
||||
auto result = MakeVisibleOnScreenRect(rect, kLeftScreen);
|
||||
|
||||
EXPECT_RECT_EQ(result, kLeftScreen);
|
||||
}
|
||||
|
||||
TEST(GeometryUtil, SubtractOverlayFromBoundingBox_Square_NoIntersect_NoInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{0, 0, 10, 10};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 10);
|
||||
|
||||
EXPECT_RECT_EQ(bounds, result);
|
||||
}
|
||||
|
||||
TEST(GeometryUtil, SubtractOverlayFromBoundingBox_Square_Contains_NoInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{5, 5, 85, 85};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 10);
|
||||
|
||||
EXPECT_RECT_EQ(bounds, result);
|
||||
}
|
||||
|
||||
TEST(GeometryUtil, SubtractOverlayFromBoundingBox_Square_AllClose_TopInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{12, 12, 76, 76};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 5);
|
||||
|
||||
// When all sides are close, inset from the top.
|
||||
const gfx::Rect expected_bounds{10, 88, 80, 2};
|
||||
EXPECT_RECT_EQ(expected_bounds, result);
|
||||
}
|
||||
|
||||
TEST(GeometryUtil,
|
||||
SubtractOverlayFromBoundingBox_Square_TopAndLeftClose_TopInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{12, 12, 30, 30};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 5);
|
||||
|
||||
// When top and left sides are close, inset from the top.
|
||||
const gfx::Rect expected_bounds{10, 42, 80, 48};
|
||||
EXPECT_RECT_EQ(expected_bounds, result);
|
||||
}
|
||||
|
||||
TEST(GeometryUtil,
|
||||
SubtractOverlayFromBoundingBox_Square_TopAndRightClose_TopInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{58, 12, 30, 30};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 5);
|
||||
|
||||
// When top and right sides are close, inset from the top.
|
||||
const gfx::Rect expected_bounds{10, 42, 80, 48};
|
||||
EXPECT_RECT_EQ(expected_bounds, result);
|
||||
}
|
||||
|
||||
TEST(GeometryUtil,
|
||||
SubtractOverlayFromBoundingBox_Square_BottomAndLeftClose_BottomInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{12, 58, 30, 30};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 5);
|
||||
|
||||
// When bottom and left sides are close, inset from the botom.
|
||||
const gfx::Rect expected_bounds{10, 10, 80, 48};
|
||||
EXPECT_RECT_EQ(expected_bounds, result);
|
||||
}
|
||||
|
||||
TEST(GeometryUtil,
|
||||
SubtractOverlayFromBoundingBox_Square_BottomAndRightClose_BottomInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{58, 58, 30, 30};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 5);
|
||||
|
||||
// When bottom and right sides are close, inset from the botom.
|
||||
const gfx::Rect expected_bounds{10, 10, 80, 48};
|
||||
EXPECT_RECT_EQ(expected_bounds, result);
|
||||
}
|
||||
|
||||
TEST(GeometryUtil,
|
||||
SubtractOverlayFromBoundingBox_WideRect_TopAndLeftExact_TopInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{10, 10, 10, 5};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 0);
|
||||
|
||||
const gfx::Rect expected_bounds{10, 15, 80, 75};
|
||||
EXPECT_RECT_EQ(expected_bounds, result);
|
||||
}
|
||||
|
||||
TEST(GeometryUtil,
|
||||
SubtractOverlayFromBoundingBox_WideRect_TopIntersectLeftExact_TopInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{10, 7, 10, 5};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 5);
|
||||
|
||||
const gfx::Rect expected_bounds{10, 12, 80, 78};
|
||||
EXPECT_RECT_EQ(expected_bounds, result);
|
||||
}
|
||||
|
||||
TEST(GeometryUtil,
|
||||
SubtractOverlayFromBoundingBox_WideRect_TopInsideLeftExact_TopInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{10, 12, 10, 5};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 5);
|
||||
|
||||
const gfx::Rect expected_bounds{10, 17, 80, 73};
|
||||
EXPECT_RECT_EQ(expected_bounds, result);
|
||||
}
|
||||
|
||||
TEST(GeometryUtil,
|
||||
SubtractOverlayFromBoundingBox_WideRect_TopTooFarInsideLeftExact_NoInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{10, 16, 10, 5};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 5);
|
||||
|
||||
EXPECT_RECT_EQ(bounds, result);
|
||||
}
|
||||
|
||||
TEST(GeometryUtil, SubtractOverlayFromBoundingBox_WideRect_Oversized_TopInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{5, 5, 85, 10};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 10);
|
||||
|
||||
const gfx::Rect expected_bounds{10, 15, 80, 75};
|
||||
EXPECT_RECT_EQ(expected_bounds, result);
|
||||
}
|
||||
|
||||
TEST(GeometryUtil,
|
||||
SubtractOverlayFromBoundingBox_WideRect_BottomAndLeftExact_BottomInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{10, 85, 10, 5};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 0);
|
||||
|
||||
const gfx::Rect expected_bounds{10, 10, 80, 75};
|
||||
EXPECT_RECT_EQ(expected_bounds, result);
|
||||
}
|
||||
|
||||
TEST(
|
||||
GeometryUtil,
|
||||
SubtractOverlayFromBoundingBox_WideRect_BottomInsideLeftExact_BottomInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{10, 83, 10, 5};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 5);
|
||||
|
||||
const gfx::Rect expected_bounds{10, 10, 80, 73};
|
||||
EXPECT_RECT_EQ(expected_bounds, result);
|
||||
}
|
||||
|
||||
TEST(
|
||||
GeometryUtil,
|
||||
SubtractOverlayFromBoundingBox_WideRect_BottomIntersectLeftExact_BottomInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{10, 87, 10, 5};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 5);
|
||||
|
||||
const gfx::Rect expected_bounds{10, 10, 80, 77};
|
||||
EXPECT_RECT_EQ(expected_bounds, result);
|
||||
}
|
||||
|
||||
TEST(
|
||||
GeometryUtil,
|
||||
SubtractOverlayFromBoundingBox_WideRect_BottomTooFarInsideLeftExact_NoInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{10, 77, 10, 5};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 5);
|
||||
|
||||
EXPECT_RECT_EQ(bounds, result);
|
||||
}
|
||||
|
||||
TEST(GeometryUtil,
|
||||
SubtractOverlayFromBoundingBox_WideRect_Oversized_BottomInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{5, 85, 85, 10};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 10);
|
||||
|
||||
const gfx::Rect expected_bounds{10, 10, 80, 75};
|
||||
EXPECT_RECT_EQ(expected_bounds, result);
|
||||
}
|
||||
|
||||
TEST(GeometryUtil,
|
||||
SubtractOverlayFromBoundingBox_TallRect_TopAndLeftExact_LeftInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{10, 10, 5, 10};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 0);
|
||||
|
||||
const gfx::Rect expected_bounds{15, 10, 75, 80};
|
||||
EXPECT_RECT_EQ(expected_bounds, result);
|
||||
}
|
||||
|
||||
TEST(GeometryUtil,
|
||||
SubtractOverlayFromBoundingBox_TallRect_TopExactLeftIntersect_LeftInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{7, 10, 5, 10};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 5);
|
||||
|
||||
const gfx::Rect expected_bounds{12, 10, 78, 80};
|
||||
EXPECT_RECT_EQ(expected_bounds, result);
|
||||
}
|
||||
|
||||
TEST(GeometryUtil,
|
||||
SubtractOverlayFromBoundingBox_TallRect_TopExactLeftInside_LeftInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{12, 10, 5, 10};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 5);
|
||||
|
||||
const gfx::Rect expected_bounds{17, 10, 73, 80};
|
||||
EXPECT_RECT_EQ(expected_bounds, result);
|
||||
}
|
||||
|
||||
TEST(GeometryUtil,
|
||||
SubtractOverlayFromBoundingBox_TallRect_TopExactLeftTooFarInside_NoInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{16, 10, 5, 10};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 5);
|
||||
|
||||
EXPECT_RECT_EQ(bounds, result);
|
||||
}
|
||||
|
||||
TEST(GeometryUtil, SubtractOverlayFromBoundingBox_TallRect_Oversize_LeftInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{5, 5, 10, 85};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 10);
|
||||
|
||||
const gfx::Rect expected_bounds{15, 10, 75, 80};
|
||||
EXPECT_RECT_EQ(expected_bounds, result);
|
||||
}
|
||||
|
||||
TEST(GeometryUtil,
|
||||
SubtractOverlayFromBoundingBox_TallRect_TopAndRightExact_RightInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{85, 10, 5, 10};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 0);
|
||||
|
||||
const gfx::Rect expected_bounds{10, 10, 75, 80};
|
||||
EXPECT_RECT_EQ(expected_bounds, result);
|
||||
}
|
||||
|
||||
TEST(GeometryUtil,
|
||||
SubtractOverlayFromBoundingBox_TallRect_TopExactRightInside_RightInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{83, 10, 5, 10};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 5);
|
||||
|
||||
const gfx::Rect expected_bounds{10, 10, 73, 80};
|
||||
EXPECT_RECT_EQ(expected_bounds, result);
|
||||
}
|
||||
|
||||
TEST(
|
||||
GeometryUtil,
|
||||
SubtractOverlayFromBoundingBox_TallRect_TopExactRightIntersect_RightInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{87, 10, 5, 10};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 5);
|
||||
|
||||
const gfx::Rect expected_bounds{10, 10, 77, 80};
|
||||
EXPECT_RECT_EQ(expected_bounds, result);
|
||||
}
|
||||
|
||||
TEST(
|
||||
GeometryUtil,
|
||||
SubtractOverlayFromBoundingBox_TallRect_TopExactRightTooFarInside_NoInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{77, 10, 5, 10};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 5);
|
||||
|
||||
EXPECT_RECT_EQ(bounds, result);
|
||||
}
|
||||
|
||||
TEST(GeometryUtil,
|
||||
SubtractOverlayFromBoundingBox_TallRect_Oversize_RightInset) {
|
||||
const gfx::Rect bounds{10, 10, 80, 80};
|
||||
const gfx::Rect overlay{85, 5, 10, 85};
|
||||
auto result = SubtractOverlayFromBoundingBox(bounds, overlay, 10);
|
||||
|
||||
const gfx::Rect expected_bounds{10, 10, 75, 80};
|
||||
EXPECT_RECT_EQ(expected_bounds, result);
|
||||
}
|
@@ -46,7 +46,7 @@ CefRefPtr<CefPreferenceManager>
|
||||
CefPreferenceManager::GetGlobalPreferenceManager() {
|
||||
// Verify that the context is in a valid state.
|
||||
if (!CONTEXT_STATE_VALID()) {
|
||||
NOTREACHED() << "context not valid";
|
||||
DCHECK(false) << "context not valid";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@@ -26,7 +26,7 @@ SkColorType GetSkColorType(cef_color_type_t color_type) {
|
||||
break;
|
||||
}
|
||||
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return kUnknown_SkColorType;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ SkAlphaType GetSkAlphaType(cef_alpha_type_t alpha_type) {
|
||||
break;
|
||||
}
|
||||
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return kUnknown_SkAlphaType;
|
||||
}
|
||||
|
||||
|
@@ -230,12 +230,12 @@ bool CefMainRunner::Initialize(CefSettings* settings,
|
||||
const int exit_code =
|
||||
ContentMainInitialize(args, windows_sandbox_info, &settings->no_sandbox);
|
||||
if (exit_code >= 0) {
|
||||
NOTREACHED() << "ContentMainInitialize failed";
|
||||
DCHECK(false) << "ContentMainInitialize failed";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ContentMainRun(initialized, std::move(context_initialized))) {
|
||||
NOTREACHED() << "ContentMainRun failed";
|
||||
DCHECK(false) << "ContentMainRun failed";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -385,15 +385,20 @@ int CefMainRunner::ContentMainInitialize(const CefMainArgs& args,
|
||||
|
||||
bool CefMainRunner::ContentMainRun(bool* initialized,
|
||||
base::OnceClosure context_initialized) {
|
||||
main_delegate_->BeforeMainThreadRun();
|
||||
main_delegate_->BeforeMainThreadRun(multi_threaded_message_loop_);
|
||||
|
||||
if (multi_threaded_message_loop_) {
|
||||
// Detach the CommandLine from the main thread so that it can be
|
||||
// attached and modified from the UI thread going forward.
|
||||
base::CommandLine::ForCurrentProcess()->DetachFromCurrentSequence();
|
||||
|
||||
base::WaitableEvent uithread_startup_event(
|
||||
base::WaitableEvent::ResetPolicy::AUTOMATIC,
|
||||
base::WaitableEvent::InitialState::NOT_SIGNALED);
|
||||
|
||||
if (!CreateUIThread(base::BindOnce(
|
||||
[](CefMainRunner* runner, base::WaitableEvent* event) {
|
||||
runner->main_delegate_->BeforeUIThreadInitialize();
|
||||
content::ContentMainRun(runner->main_runner_.get());
|
||||
event->Signal();
|
||||
},
|
||||
@@ -408,6 +413,7 @@ bool CefMainRunner::ContentMainRun(bool* initialized,
|
||||
uithread_startup_event.Wait();
|
||||
} else {
|
||||
*initialized = true;
|
||||
main_delegate_->BeforeUIThreadInitialize();
|
||||
content::ContentMainRun(main_runner_.get());
|
||||
}
|
||||
|
||||
|
@@ -130,7 +130,7 @@ class CefRegistrationImpl : public CefRegistration,
|
||||
case blink::mojom::PresentationConnectionState::TERMINATED:
|
||||
return CEF_MRCS_TERMINATED;
|
||||
}
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return CEF_MRCS_UNKNOWN;
|
||||
}
|
||||
|
||||
|
@@ -54,7 +54,7 @@ class CefSimpleMenuModel : public ui::MenuModel {
|
||||
case MENUITEMTYPE_SUBMENU:
|
||||
return TYPE_SUBMENU;
|
||||
default:
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return TYPE_COMMAND;
|
||||
}
|
||||
}
|
||||
@@ -1109,7 +1109,7 @@ void CefMenuModelImpl::OnMenuClosed() {
|
||||
bool CefMenuModelImpl::VerifyContext() {
|
||||
if (base::PlatformThread::CurrentId() != supported_thread_id_) {
|
||||
// This object should only be accessed from the thread that created it.
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -161,7 +161,7 @@ ui::MouseEvent CefBrowserPlatformDelegateNativeAura::TranslateUiClickEvent(
|
||||
changed_button_flags |= ui::EF_RIGHT_MOUSE_BUTTON;
|
||||
break;
|
||||
default:
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
ui::MouseEvent result(event_type, location, root_location, time_stamp, flags,
|
||||
|
@@ -276,7 +276,7 @@ ui::KeyEvent CefBrowserPlatformDelegateNativeLinux::TranslateUiKeyEvent(
|
||||
type = ui::ET_KEY_RELEASED;
|
||||
break;
|
||||
default:
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
#if BUILDFLAG(OZONE_PLATFORM_X11)
|
||||
|
@@ -23,8 +23,6 @@
|
||||
#include "third_party/blink/public/common/input/web_input_event.h"
|
||||
#include "third_party/blink/public/common/input/web_mouse_event.h"
|
||||
#include "third_party/blink/public/common/input/web_mouse_wheel_event.h"
|
||||
#import "ui/base/cocoa/cocoa_base_utils.h"
|
||||
#import "ui/base/cocoa/underlay_opengl_hosting_window.h"
|
||||
#include "ui/display/screen.h"
|
||||
#include "ui/events/base_event_utils.h"
|
||||
#include "ui/events/keycodes/keyboard_codes_posix.h"
|
||||
@@ -281,11 +279,10 @@ bool CefBrowserPlatformDelegateNativeMac::CreateHostWindow() {
|
||||
kDefaultStyleMask, frame_rect, content_rect);
|
||||
|
||||
// Create a new window.
|
||||
new_window = [[UnderlayOpenGLHostingWindow alloc]
|
||||
initWithContentRect:content_rect
|
||||
styleMask:kDefaultStyleMask
|
||||
backing:NSBackingStoreBuffered
|
||||
defer:NO];
|
||||
new_window = [[NSWindow alloc] initWithContentRect:content_rect
|
||||
styleMask:kDefaultStyleMask
|
||||
backing:NSBackingStoreBuffered
|
||||
defer:NO];
|
||||
|
||||
// Create the delegate for control and browser window events.
|
||||
[[CefWindowDelegate alloc] initWithWindow:new_window andBrowser:browser_];
|
||||
@@ -439,8 +436,7 @@ gfx::Point CefBrowserPlatformDelegateNativeMac::GetScreenPoint(
|
||||
NSPoint view_pt = {static_cast<CGFloat>(view.x()),
|
||||
bounds.size.height - static_cast<CGFloat>(view.y())};
|
||||
NSPoint window_pt = [nsview convertPoint:view_pt toView:nil];
|
||||
NSPoint screen_pt =
|
||||
ui::ConvertPointFromWindowToScreen([nsview window], window_pt);
|
||||
NSPoint screen_pt = [[nsview window] convertPointToScreen:window_pt];
|
||||
return gfx::Point(screen_pt.x, screen_pt.y);
|
||||
}
|
||||
return gfx::Point();
|
||||
@@ -565,7 +561,7 @@ CefBrowserPlatformDelegateNativeMac::TranslateWebClickEvent(
|
||||
result.button = blink::WebMouseEvent::Button::kRight;
|
||||
break;
|
||||
default:
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
result.click_count = clickCount;
|
||||
|
@@ -10,8 +10,8 @@
|
||||
|
||||
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/geometry_util.h"
|
||||
#include "libcef/browser/native/window_delegate_view.h"
|
||||
#include "libcef/browser/screen_util.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "base/base_paths_win.h"
|
||||
@@ -251,16 +251,14 @@ bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() {
|
||||
// Add a reference that will later be released in DestroyBrowser().
|
||||
browser_->AddRef();
|
||||
|
||||
if (!called_enable_non_client_dpi_scaling_ && has_frame_ &&
|
||||
base::win::IsProcessPerMonitorDpiAware()) {
|
||||
if (!called_enable_non_client_dpi_scaling_ && has_frame_) {
|
||||
// This call gets Windows to scale the non-client area when WM_DPICHANGED
|
||||
// is fired on Windows versions < 10.0.14393.0.
|
||||
// Derived signature; not available in headers.
|
||||
static auto enable_child_window_dpi_message_func = []() {
|
||||
using EnableChildWindowDpiMessagePtr = LRESULT(WINAPI*)(HWND, BOOL);
|
||||
return reinterpret_cast<EnableChildWindowDpiMessagePtr>(GetProcAddress(
|
||||
GetModuleHandle(L"user32.dll"), "EnableChildWindowDpiMessage"));
|
||||
}();
|
||||
using EnableChildWindowDpiMessagePtr = LRESULT(WINAPI*)(HWND, BOOL);
|
||||
static const auto enable_child_window_dpi_message_func =
|
||||
reinterpret_cast<EnableChildWindowDpiMessagePtr>(
|
||||
base::win::GetUser32FunctionPointer("EnableChildWindowDpiMessage"));
|
||||
if (enable_child_window_dpi_message_func) {
|
||||
enable_child_window_dpi_message_func(window_info_.window, TRUE);
|
||||
}
|
||||
@@ -468,7 +466,7 @@ bool CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent(
|
||||
msg.message = event.is_system_key ? WM_SYSCHAR : WM_CHAR;
|
||||
break;
|
||||
default:
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -523,7 +521,7 @@ ui::KeyEvent CefBrowserPlatformDelegateNativeWin::TranslateUiKeyEvent(
|
||||
type = ui::ET_KEY_RELEASED;
|
||||
break;
|
||||
default:
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
ui::DomKey dom_key =
|
||||
@@ -622,15 +620,15 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
|
||||
gfx::SetWindowUserData(hwnd, platform_delegate);
|
||||
platform_delegate->window_info_.window = hwnd;
|
||||
|
||||
if (platform_delegate->has_frame_ &&
|
||||
base::win::IsProcessPerMonitorDpiAware()) {
|
||||
if (platform_delegate->has_frame_) {
|
||||
// This call gets Windows to scale the non-client area when
|
||||
// WM_DPICHANGED is fired on Windows versions >= 10.0.14393.0.
|
||||
static auto enable_non_client_dpi_scaling_func = []() {
|
||||
return reinterpret_cast<decltype(::EnableNonClientDpiScaling)*>(
|
||||
GetProcAddress(GetModuleHandle(L"user32.dll"),
|
||||
"EnableNonClientDpiScaling"));
|
||||
}();
|
||||
using EnableNonClientDpiScalingPtr =
|
||||
decltype(::EnableNonClientDpiScaling)*;
|
||||
static const auto enable_non_client_dpi_scaling_func =
|
||||
reinterpret_cast<EnableNonClientDpiScalingPtr>(
|
||||
base::win::GetUser32FunctionPointer(
|
||||
"EnableNonClientDpiScaling"));
|
||||
platform_delegate->called_enable_non_client_dpi_scaling_ =
|
||||
!!(enable_non_client_dpi_scaling_func &&
|
||||
enable_non_client_dpi_scaling_func(hwnd));
|
||||
|
@@ -10,7 +10,9 @@
|
||||
#include "content/public/browser/render_widget_host_view.h"
|
||||
#include "ui/base/cursor/cursor_factory.h"
|
||||
#include "ui/base/cursor/mojom/cursor_type.mojom.h"
|
||||
#include "ui/display/display.h"
|
||||
#include "ui/display/display_util.h"
|
||||
#include "ui/display/screen.h"
|
||||
#include "ui/wm/core/cursor_loader.h"
|
||||
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
@@ -30,28 +32,6 @@ namespace cursor_util {
|
||||
|
||||
namespace {
|
||||
|
||||
display::ScreenInfo GetScreenInfo(CefRefPtr<CefBrowser> browser) {
|
||||
display::ScreenInfo screen_info;
|
||||
|
||||
bool screen_info_set = false;
|
||||
if (auto web_contents =
|
||||
static_cast<CefBrowserHostBase*>(browser.get())->GetWebContents()) {
|
||||
if (auto view = web_contents->GetRenderWidgetHostView()) {
|
||||
const auto screen_infos = view->GetScreenInfos();
|
||||
if (!screen_infos.screen_infos.empty()) {
|
||||
screen_info = screen_infos.current();
|
||||
screen_info_set = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!screen_info_set) {
|
||||
display::DisplayUtil::GetDefaultScreenInfo(&screen_info);
|
||||
}
|
||||
|
||||
return screen_info;
|
||||
}
|
||||
|
||||
display::Display::Rotation OrientationAngleToRotation(
|
||||
uint16_t orientation_angle) {
|
||||
// The Display rotation and the ScreenInfo orientation are not the same
|
||||
@@ -70,10 +50,35 @@ display::Display::Rotation OrientationAngleToRotation(
|
||||
if (orientation_angle == 270) {
|
||||
return display::Display::ROTATE_90;
|
||||
}
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return display::Display::ROTATE_0;
|
||||
}
|
||||
|
||||
// It would be better if CursorLoader took a ScreenInfo argument.
|
||||
// See https://crbug.com/1149906#c33.
|
||||
display::Display GetDisplay(CefRefPtr<CefBrowser> browser) {
|
||||
if (auto web_contents =
|
||||
static_cast<CefBrowserHostBase*>(browser.get())->GetWebContents()) {
|
||||
if (auto view = web_contents->GetRenderWidgetHostView()) {
|
||||
// Windowless browsers always return nullptr from GetNativeView().
|
||||
if (auto native_view = view->GetNativeView()) {
|
||||
return display::Screen::GetScreen()->GetDisplayNearestView(native_view);
|
||||
}
|
||||
|
||||
// Make a minimal-effort fake Display object to satisfy the actual usage
|
||||
// by CursorLoader::SetDisplay.
|
||||
display::Display fake_display;
|
||||
auto screen_info = view->GetScreenInfo();
|
||||
fake_display.set_device_scale_factor(screen_info.device_scale_factor);
|
||||
fake_display.set_rotation(
|
||||
OrientationAngleToRotation(screen_info.orientation_angle));
|
||||
return fake_display;
|
||||
}
|
||||
}
|
||||
|
||||
return display::Display::GetDefaultDisplay();
|
||||
}
|
||||
|
||||
scoped_refptr<ui::PlatformCursor> ToPlatformCursor(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
const ui::Cursor& ui_cursor) {
|
||||
@@ -87,10 +92,7 @@ scoped_refptr<ui::PlatformCursor> ToPlatformCursor(
|
||||
ui::mojom::CursorType::kCustom, ui_cursor.custom_bitmap(),
|
||||
ui_cursor.custom_hotspot());
|
||||
} else {
|
||||
const auto& screen_info = GetScreenInfo(browser);
|
||||
cursor_loader.SetDisplayData(
|
||||
OrientationAngleToRotation(screen_info.orientation_angle),
|
||||
screen_info.device_scale_factor);
|
||||
cursor_loader.SetDisplay(GetDisplay(browser));
|
||||
|
||||
// Attempts to load the cursor via the platform or from pak resources.
|
||||
cursor_loader.SetPlatformCursor(&loaded_cursor);
|
||||
|
@@ -127,6 +127,7 @@ CefWindowX11::CefWindowX11(CefRefPtr<CefBrowserHostBase> browser,
|
||||
/*visual_has_alpha=*/nullptr);
|
||||
|
||||
xwindow_ = connection_->GenerateId<x11::Window>();
|
||||
|
||||
connection_->CreateWindow({
|
||||
.depth = depth,
|
||||
.wid = xwindow_,
|
||||
@@ -140,12 +141,15 @@ CefWindowX11::CefWindowX11(CefRefPtr<CefBrowserHostBase> browser,
|
||||
.background_pixel = 0,
|
||||
.border_pixel = 0,
|
||||
.override_redirect = x11::Bool32(false),
|
||||
.event_mask = x11::EventMask::FocusChange |
|
||||
x11::EventMask::StructureNotify |
|
||||
x11::EventMask::PropertyChange,
|
||||
.colormap = colormap,
|
||||
});
|
||||
|
||||
auto event_mask = x11::EventMask::FocusChange |
|
||||
x11::EventMask::StructureNotify |
|
||||
x11::EventMask::PropertyChange;
|
||||
xwindow_events_ =
|
||||
std::make_unique<x11::XScopedEventSelector>(xwindow_, event_mask);
|
||||
|
||||
connection_->Flush();
|
||||
|
||||
DCHECK(ui::X11EventSource::HasInstance());
|
||||
@@ -384,7 +388,7 @@ bool CefWindowX11::TopLevelAlwaysOnTop() const {
|
||||
|
||||
void CefWindowX11::ProcessXEvent(const x11::Event& event) {
|
||||
if (auto* configure = event.As<x11::ConfigureNotifyEvent>()) {
|
||||
DCHECK_EQ(xwindow_, configure->event);
|
||||
DCHECK_EQ(xwindow_, configure->window);
|
||||
// It's possible that the X window may be resized by some other means
|
||||
// than from within Aura (e.g. the X window manager can change the
|
||||
// size). Make sure the root window size is maintained properly.
|
||||
|
@@ -314,7 +314,7 @@ bool OnExtensionsSupportUI(std::string* mime_type, std::string* output) {
|
||||
"<html>\n<head><title>Extensions Support</title></head>\n"
|
||||
"<body bgcolor=\"white\"><h3>Supported Chrome Extensions "
|
||||
"APIs</h3>\nFollow <a "
|
||||
"href=\"https://bitbucket.org/chromiumembedded/cef/issues/1947\" "
|
||||
"href=\"https://github.com/chromiumembedded/cef/issues/1947\" "
|
||||
"target=\"new\">issue #1947</a> for development progress.\n<ul>\n";
|
||||
|
||||
bool has_top_level_name = false;
|
||||
@@ -363,7 +363,7 @@ bool OnLicenseUI(std::string* mime_type, std::string* output) {
|
||||
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||
IDR_CEF_LICENSE_TXT);
|
||||
if (piece.empty()) {
|
||||
NOTREACHED() << "Failed to load license txt resource.";
|
||||
DCHECK(false) << "Failed to load license txt resource.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -381,7 +381,7 @@ bool OnVersionUI(Profile* profile,
|
||||
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||
IDR_CEF_VERSION_HTML);
|
||||
if (tmpl.empty()) {
|
||||
NOTREACHED() << "Failed to load version html resource.";
|
||||
DCHECK(false) << "Failed to load version html resource.";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -10,13 +10,13 @@
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "content/public/browser/network_service_instance.h"
|
||||
#include "services/network/network_service.h"
|
||||
#include "services/cert_verifier/public/mojom/cert_verifier_service_factory.mojom.h"
|
||||
|
||||
namespace {
|
||||
|
||||
void UpdateCRLSet(const std::string& crl_set_bytes) {
|
||||
CEF_REQUIRE_UIT();
|
||||
content::GetNetworkService()->UpdateCRLSet(
|
||||
content::GetCertVerifierServiceFactory()->UpdateCRLSet(
|
||||
base::as_bytes(base::make_span(crl_set_bytes)), base::DoNothing());
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ void LoadFromDisk(const base::FilePath& path) {
|
||||
|
||||
void CefLoadCRLSetsFile(const CefString& path) {
|
||||
if (!CONTEXT_STATE_VALID()) {
|
||||
NOTREACHED() << "context not valid";
|
||||
DCHECK(false) << "context not valid";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -50,7 +50,7 @@ std::string GetMimeType(const std::string& filename) {
|
||||
return "application/font-woff2";
|
||||
}
|
||||
|
||||
NOTREACHED() << "No known mime type for file: " << filename.c_str();
|
||||
DCHECK(false) << "No known mime type for file: " << filename.c_str();
|
||||
return "text/plain";
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ class RedirectHandler : public CefResourceHandler {
|
||||
int bytes_to_read,
|
||||
int& bytes_read,
|
||||
CefRefPtr<CefResourceReadCallback> callback) override {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -177,8 +177,8 @@ class InternalHandlerFactory : public CefSchemeHandlerFactory {
|
||||
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||
action.resource_id);
|
||||
if (str.empty()) {
|
||||
NOTREACHED() << "Failed to load internal resource for id: "
|
||||
<< action.resource_id << " URL: " << url.spec().c_str();
|
||||
DCHECK(false) << "Failed to load internal resource for id: "
|
||||
<< action.resource_id << " URL: " << url.spec().c_str();
|
||||
return nullptr;
|
||||
}
|
||||
action.bytes =
|
||||
|
@@ -433,7 +433,8 @@ class CefBrowserURLRequest::Context
|
||||
}
|
||||
}
|
||||
|
||||
void OnRedirect(const net::RedirectInfo& redirect_info,
|
||||
void OnRedirect(const GURL& url_before_redirect,
|
||||
const net::RedirectInfo& redirect_info,
|
||||
const network::mojom::URLResponseHead& response_head,
|
||||
std::vector<std::string>* removed_headers) {
|
||||
DCHECK(CalledOnValidThread());
|
||||
@@ -694,7 +695,7 @@ void CefBrowserURLRequest::Cancel() {
|
||||
|
||||
bool CefBrowserURLRequest::VerifyContext() {
|
||||
if (!context_->CalledOnValidThread()) {
|
||||
NOTREACHED() << "called on invalid thread";
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -1106,7 +1106,8 @@ void InterceptedRequest::OnURLLoaderClientError() {
|
||||
|
||||
void InterceptedRequest::OnURLLoaderError(uint32_t custom_reason,
|
||||
const std::string& description) {
|
||||
if (custom_reason == network::mojom::URLLoader::kClientDisconnectReason) {
|
||||
if (custom_reason == network::mojom::URLLoader::kClientDisconnectReason &&
|
||||
description == safe_browsing::kCustomCancelReasonForURLLoader) {
|
||||
SendErrorCallback(safe_browsing::kNetErrorCodeForSafeBrowsing, true);
|
||||
}
|
||||
|
||||
|
@@ -553,7 +553,7 @@ void StreamReaderURLLoader::FollowRedirect(
|
||||
const net::HttpRequestHeaders& modified_headers,
|
||||
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||
const absl::optional<GURL>& new_url) {
|
||||
NOTREACHED();
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void StreamReaderURLLoader::SetPriority(net::RequestPriority priority,
|
||||
@@ -852,4 +852,4 @@ bool StreamReaderURLLoader::byte_range_valid() const {
|
||||
return byte_range_.IsValid() && byte_range_.first_byte_position() >= 0;
|
||||
}
|
||||
|
||||
} // namespace net_service
|
||||
} // namespace net_service
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user