Compare commits

...

40 Commits
6943 ... 6533

Author SHA1 Message Date
Marshall Greenblatt
c1e5ae6a9e Pin depot_tools version for out-of-support branch 2024-08-29 11:59:37 +03:00
Marshall Greenblatt
114ea2af1b Update to Chromium version 127.0.6533.120 2024-08-14 14:13:12 +00:00
Marshall Greenblatt
e9e2e1487f bazel: mac: Copy but don't link the CEF framework (see #3757)
Copy the CEF framework into the app bundle but do not link it. See
https://groups.google.com/g/cef-announce/c/Fith0A3kWtw/m/6ds_mJVMCQAJ
for background.

Use `**kwargs` to pass all other arguments to the actual
`macos_application` target declaration.
2024-08-09 13:45:26 -04:00
Marshall Greenblatt
62b2b5a80f Route Download bubble file open to OnOpenURLFromTab (fixes #3750)
Some downloaded file types [1] default to opening in a Browser. Open
requests for these file types originating from the Download bubble UI
should route to the source Browser (call OnOpenURLFromTab). If
OnOpenURLFromTab is unhandled proceed with the default Chrome behavior
of opening the URL in a new default Browser.

[1] PDF, html, etc. For the complete list of file types see
ChromeDownloadManagerDelegate::IsOpenInBrowserPreferredForFile.
2024-08-09 13:32:42 -04:00
Marshall Greenblatt
f1af6179f0 Fix path override ordering (fixes #3749)
The chrome::DIR_RESOURCES and ui::DIR_LOCALES overrides need to be
configured before calling ChromeMainDelegate::PreSandboxStartup.
2024-08-08 13:45:27 -04:00
Marshall Greenblatt
6cbb30e49e cefclient: mac: Fix "undefined symbol" link error (see #3499) 2024-08-07 11:36:03 -04:00
Marshall Greenblatt
d529f0259d Use int instead of bool in cef_settings_t 2024-08-07 11:15:10 -04:00
Marshall Greenblatt
a226b447dd Update to Chromium version 127.0.6533.100 2024-08-07 14:25:57 +00:00
Loïc Frasse-Mathon
84246a31a2 posix: Added option to disable signal handlers
See https://github.com/chromiumembedded/java-cef/issues/477
2024-08-06 19:06:46 +00:00
Marshall Greenblatt
c95c4aa8ea bazel: Limit define scope to specific cc targets (see #3757)
- Add `declare_[cc|objc]_library` macros to configure common `copts`
  and `local_defines` (where supported) on `[cc|objc]_library`
  targets. This limits the scope of defines to the specific target
  without inheritance by dependent targets.
- `objc_library` does not currently support `local_defines` so we
  use `copts` instead of MacOS.
- Use `**kwargs` to pass all other arguments to the actual cc
  target declaration.
2024-08-06 15:00:24 -04:00
Marshall Greenblatt
49b6073ba9 cefclient: Fix invalid cast to ClientHandlerStd (see #3499) 2024-08-05 18:49:23 -04:00
Marshall Greenblatt
0d1d087186 bazel: Support <angled> includes of CEF headers (see #3757)
Fixes "file not found with <angled> include" errors.
2024-08-05 17:27:56 -04:00
JC Yang
b1c7fade27 Fix dangling ptr in ReadResponseCallbackWrapper (fixes #3760) 2024-08-05 15:41:26 -04:00
Sergey Markelov
9fb397603b linux: Fix TLS error on dlopen of libcef.so (fixes #3616) 2024-08-05 15:41:12 -04:00
Marshall Greenblatt
35f74ccdef bazel: Fix resource paths as external repo (see #3757)
- Headers that are included by .rc files need to be supplied to
  `declare_exe` via the `resources_deps` attribute (passed as the `deps
  attribute to `compile_rc`). The headers must be part of a cc_library
  target via either the `hdrs` or `srcs` attribute.
- File paths for CEF resources are prefixed with "external/<repo>"
  when CEF is loaded as an external repo. Update `copy_filegroups` to
  work with these paths.
2024-08-02 16:55:42 -04:00
Marshall Greenblatt
e71a509e5b bazel: Add repo for package-local target labels (see #3757)
Unqualified target labels don't resolve correctly when the
disribution is loaded as an external repo. Mapping, if necessary,
can be performed using the `repo_mapping` parameter to
http_archive() or local_repository().
2024-07-31 18:01:12 -04:00
Marshall Greenblatt
c80b00886f Update to Chromium version 127.0.6533.89 2024-07-31 15:04:09 +00:00
Marshall Greenblatt
1cd242422a bazel: Add initial config for binary distribution (see #3757)
Add support for building the CEF binary distribution using Bazel
and the default platform toolchain. Tested to work for Windows
x64, MacOS ARM64 and x64 (cross-compile from ARM64), and
Linux x64. Windows x86 (cross-compile from x64) is known to
be broken, see https://github.com/bazelbuild/bazel/issues/22164.

Includes minor changes to tests directory structure to meet
Bazel build requirements.
2024-07-30 12:40:04 -04:00
Marshall Greenblatt
7b8e0ab0f5 Update to Chromium version 127.0.6533.73 2024-07-30 13:29:22 +00:00
Marshall Greenblatt
a1ec5042c6 Fix content settings enum values 2024-07-29 12:34:26 -04:00
Marshall Greenblatt
1567840505 Update to Chromium version 127.0.6533.57 2024-07-18 13:35:21 +00:00
Marshall Greenblatt
5bafd32ee1 cefclient: Allow download with --hide-controls (fixes #3742) 2024-07-17 15:07:18 -04:00
Marshall Greenblatt
9ca230c960 Disable dangling ptr check for PendingRequest::request_ (fixes #3743)
The InterceptedRequestHandlerWrapper object may be deleted (likely via
~InterceptedRequest) while the task to call
InterceptedRequestHandlerWrapper:ContinueCreateURLLoaderNetworkObserver
is still pending. That binding holds a
WeakPtr<InterceptedRequestHandlerWrapper> (which is now nullptr)
resulting in the bound std::unique_ptr<PendingRequest> being deleted
while still holding a raw_ptr<network::ResourceRequest> to the
already-deleted object. This is always safe (raw_ptr will never be
dereferenced) because of the WeakPtr check.
2024-07-17 14:46:59 -04:00
Marshall Greenblatt
da971da381 Fix DCHECK adding menu separator with hidden items (fixes #3577) 2024-07-16 16:02:04 -04:00
Marshall Greenblatt
444983d9ec distrib: Add new tools distribution for mksnapshot (see #3734) 2024-07-16 16:00:03 -04:00
Marshall Greenblatt
d96e29b528 mac: cefclient: Fix zombie NSWindow object on exit (fixes #3602)
- Don't create a TempWindow when using Views.
- Don't call `close` on an NSWindow that is never opened.
2024-07-15 17:08:41 -04:00
Marshall Greenblatt
c4ddda42fb Call SetIsShutdown after CefInitialize (fixes #3738)
Delay shutdown checking until after CefInitialize has drained existing
task pools.
2024-07-15 17:08:34 -04:00
Marshall Greenblatt
34572843ea Fix duplicate open from DevTools when handling OnOpenURLFromTab (fixes #3735) 2024-07-11 14:20:51 -04:00
Marshall Greenblatt
499df12b97 Update to Chromium version 127.0.6533.43 2024-07-11 13:32:51 +00:00
Marshall Greenblatt
96ac3d04b4 Update to Chromium version 127.0.6533.41 2024-07-10 12:50:51 -04:00
Marshall Greenblatt
7f27173f2f tools: win: Remove dynamic_annotations.lib from cef_sandbox
This library was removed in https://crbug.com/40209570.
2024-07-10 12:34:21 -04:00
Marshall Greenblatt
d77d001f56 Include debug symbols for all distributed binaries (fixes #2235) 2024-07-08 12:20:14 -04:00
Nik Pavlov
bea9614a45 tools: Fix "invalid escape sequence '\s'" warning 2024-07-01 13:20:59 -04:00
Marshall Greenblatt
9772389a14 Allow dangling Listener in CefFileDialogManager (fixes #3720) 2024-06-25 13:59:03 -04:00
Marshall Greenblatt
bbc35eb30a Fix dangling ResourceRequest* (fixes #3719)
Add raw_ptr<network::ResourceRequest> to RequestState instead of
passing ResourceRequest* as a bound parameter.
2024-06-21 16:57:10 -04:00
Marshall Greenblatt
b59a20ac7f Allow dangling UnretainedWrapper for ResourceRequest* (fixes #3717)
Change UnretainedWrapper traits from MayNotDangle (default) to
MayDangleUntriaged as a short-term fix.
2024-06-21 13:00:52 -04:00
Yuta Sekiguchi
0c339dfc41 Rewrite raw pointers reported by clang plugin (see #3239)
Found using a CEF build with clang_use_chrome_plugins=true
and treat_warnings_as_errors=false.

This change rewrites remaining raw pointers reported by
chromium-rawptr checker and fixes a build error reported
by StackAllocatedChecker.
2024-06-21 13:00:52 -04:00
Marshall Greenblatt
c741db0d1f Update to Chromium version 127.0.6533.17 2024-06-21 15:11:46 +00:00
Marshall Greenblatt
5ab32347b8 Fix assertions with Save As dialog
Fixes some issues introduced by 8e79307a62 (see #3314) and
6354d8daf1 (see #3239).

To test:
- Run `cefclient --url=chrome://net-export`
- Click the "Start Logging to Disk" button
- Exit cefclient; get no debug assertions
2024-06-20 14:09:52 -04:00
Marshall Greenblatt
7d739b3d33 Update to Chromium version 127.0.6533.5 2024-06-20 12:13:53 -04:00
159 changed files with 4442 additions and 559 deletions

View File

@@ -1968,7 +1968,7 @@ if (is_mac) {
bundle_data("cefclient_resources_bundle_data") {
sources = gypi_paths2.shared_sources_resources +
gypi_paths2.cefclient_sources_resources + [
"tests/cefclient/resources/mac/cefclient.icns",
"tests/cefclient/mac/cefclient.icns",
]
outputs = [
@@ -1978,7 +1978,7 @@ if (is_mac) {
bundle_data("cefclient_resources_bundle_data_english") {
sources = [
"tests/cefclient/resources/mac/English.lproj/InfoPlist.strings",
"tests/cefclient/mac/English.lproj/InfoPlist.strings",
]
outputs = [
@@ -1988,7 +1988,7 @@ if (is_mac) {
mac_xib_bundle_data("cefclient_xibs") {
sources = [
"tests/cefclient/resources/mac/English.lproj/MainMenu.xib",
"tests/cefclient/mac/English.lproj/MainMenu.xib",
]
output_path = "{{bundle_resources_dir}}/English.lproj"
@@ -1998,7 +1998,7 @@ if (is_mac) {
# Necessary because the cef_framework target is testonly.
testonly = true
helper_info_plist = "tests/cefclient/resources/mac/helper-Info.plist"
helper_info_plist = "tests/cefclient/mac/helper-Info.plist.in"
helper_sources = includes_common +
includes_mac +
gypi_paths2.includes_wrapper +
@@ -2012,7 +2012,7 @@ if (is_mac) {
"CEF_USE_SANDBOX",
]
info_plist = "tests/cefclient/resources/mac/Info.plist"
info_plist = "tests/cefclient/mac/Info.plist.in"
sources = includes_common +
includes_mac +
gypi_paths2.includes_wrapper +
@@ -2074,7 +2074,7 @@ if (is_mac) {
# Necessary because the cef_framework target is testonly.
testonly = true
helper_info_plist = "tests/cefsimple/mac/helper-Info.plist"
helper_info_plist = "tests/cefsimple/mac/helper-Info.plist.in"
helper_sources = includes_common +
includes_mac +
gypi_paths2.includes_wrapper +
@@ -2084,7 +2084,7 @@ if (is_mac) {
"CEF_USE_SANDBOX",
]
info_plist = "tests/cefsimple/mac/Info.plist"
info_plist = "tests/cefsimple/mac/Info.plist.in"
sources = includes_common +
includes_mac +
gypi_paths2.includes_wrapper +
@@ -2111,7 +2111,7 @@ if (is_mac) {
bundle_data("ceftests_resources_bundle_data") {
sources = gypi_paths2.shared_sources_resources + [
"tests/ceftests/resources/mac/ceftests.icns",
"tests/ceftests/mac/ceftests.icns",
]
outputs = [
@@ -2121,7 +2121,7 @@ if (is_mac) {
bundle_data("ceftests_resources_bundle_data_english") {
sources = [
"tests/ceftests/resources/mac/English.lproj/InfoPlist.strings",
"tests/ceftests/mac/English.lproj/InfoPlist.strings",
]
outputs = [
@@ -2131,7 +2131,7 @@ if (is_mac) {
mac_xib_bundle_data("ceftests_xibs") {
sources = [
"tests/ceftests/resources/mac/English.lproj/MainMenu.xib",
"tests/ceftests/mac/English.lproj/MainMenu.xib",
]
output_path = "{{bundle_resources_dir}}/English.lproj"
}
@@ -2139,11 +2139,12 @@ if (is_mac) {
cef_app("ceftests") {
testonly = true
helper_info_plist = "tests/ceftests/resources/mac/helper-Info.plist"
helper_info_plist = "tests/ceftests/mac/helper-Info.plist.in"
helper_sources = gypi_paths2.shared_sources_common +
gypi_paths2.shared_sources_renderer +
gypi_paths2.shared_sources_mac_helper +
gypi_paths2.ceftests_sources_mac_helper
gypi_paths2.ceftests_sources_mac_helper +
gypi_paths2.ceftests_sources_mac_helper_shared
helper_deps = [
":gtest_teamcity",
"//testing/gtest",
@@ -2156,7 +2157,7 @@ if (is_mac) {
"CEF_TESTS_IN_SRC_DIRECTORY",
]
info_plist = "tests/ceftests/resources/mac/Info.plist"
info_plist = "tests/ceftests/mac/Info.plist.in"
sources = includes_common +
includes_mac +
gypi_paths2.includes_wrapper +
@@ -2241,7 +2242,8 @@ if (is_mac) {
if (is_win) {
sources += includes_win +
gypi_paths2.shared_sources_win +
gypi_paths2.cefclient_sources_win
gypi_paths2.cefclient_sources_win +
gypi_paths2.cefclient_sources_resources_win_rc
# Set /SUBSYSTEM:WINDOWS.
configs -= [ "//build/config/win:console" ]
@@ -2337,7 +2339,8 @@ if (is_mac) {
if (is_win) {
sources += includes_win +
gypi_paths2.cefsimple_sources_win
gypi_paths2.cefsimple_sources_win +
gypi_paths2.cefsimple_sources_resources_win_rc
# Set /SUBSYSTEM:WINDOWS.
configs -= [ "//build/config/win:console" ]
@@ -2412,7 +2415,8 @@ if (is_mac) {
if (is_win) {
sources += gypi_paths2.shared_sources_win +
gypi_paths2.ceftests_sources_win
gypi_paths2.ceftests_sources_win +
gypi_paths2.ceftests_sources_resources_win_rc
# Delay-load as many DLLs as possible for sandbox and startup perf
# improvements.

View File

@@ -7,5 +7,6 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': 'refs/tags/127.0.6533.0'
'chromium_checkout': 'refs/tags/127.0.6533.120',
'depot_tools_checkout': '22f6c9d8e9'
}

8
bazel/BUILD.bazel Normal file
View File

@@ -0,0 +1,8 @@
# Copyright (c) 2024 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.
# Allow access from targets in other packages.
package(default_visibility = [
"//visibility:public",
])

65
bazel/copy_filegroups.bzl Normal file
View File

@@ -0,0 +1,65 @@
# Copyright (c) 2024 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.
def _copy_filegroups_impl(ctx):
inputs = ctx.files.filegroups
remove_prefixes = ctx.attr.remove_prefixes
add_prefix = ctx.attr.add_prefix
outputs = []
for f in inputs:
relative_path = f.path
if relative_path.startswith("external/"):
# Remove the "external/<repo>" component, if any.
relative_path = "/".join(relative_path.split("/")[2:])
for prefix in remove_prefixes:
# Add trailing forward slash if necessary.
if prefix[-1] != "/":
prefix += "/"
if len(prefix) > 0 and relative_path.startswith(prefix):
relative_path = relative_path[len(prefix):]
break
if len(add_prefix) > 0:
# Add trailing forward slash if necessary.
if add_prefix[-1] != "/":
add_prefix += "/"
relative_path = add_prefix + relative_path
out = ctx.actions.declare_file(relative_path)
outputs.append(out)
if relative_path.find("/") > 0:
command="mkdir -p $(dirname {}) && cp {} {}".format(out.path, f.path, out.path)
else:
command="cp {} {}".format(f.path, out.path)
ctx.actions.run_shell(
outputs=[out],
inputs=depset([f]),
command=command
)
# Small sanity check
if len(inputs) != len(outputs):
fail("Output count should be 1-to-1 with input count.")
return DefaultInfo(
files=depset(outputs),
runfiles=ctx.runfiles(files=outputs)
)
# Allows the file contents of |filegroups| to be copied next to a cc_binary
# target via the |data| attribute.
# Implementation based on https://stackoverflow.com/a/57983629
copy_filegroups = rule(
implementation=_copy_filegroups_impl,
attrs={
"filegroups": attr.label_list(),
"remove_prefixes": attr.string_list(default = []),
"add_prefix": attr.string(default = ""),
},
)

90
bazel/library_helpers.bzl Normal file
View File

@@ -0,0 +1,90 @@
# Copyright (c) 2024 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.
load("//bazel/win:variables.bzl",
WIN_COMMON_COPTS="COMMON_COPTS",
WIN_COMMON_COPTS_RELEASE="COMMON_COPTS_RELEASE",
WIN_COMMON_COPTS_DEBUG="COMMON_COPTS_DEBUG",
WIN_COMMON_DEFINES="COMMON_DEFINES",
WIN_COMMON_DEFINES_RELEASE="COMMON_DEFINES_RELEASE",
WIN_COMMON_DEFINES_DEBUG="COMMON_DEFINES_DEBUG")
load("//bazel/linux:variables.bzl",
LINUX_COMMON_COPTS="COMMON_COPTS",
LINUX_COMMON_COPTS_RELEASE="COMMON_COPTS_RELEASE",
LINUX_COMMON_COPTS_DEBUG="COMMON_COPTS_DEBUG",
LINUX_COMMON_DEFINES="COMMON_DEFINES",
LINUX_COMMON_DEFINES_RELEASE="COMMON_DEFINES_RELEASE",
LINUX_COMMON_DEFINES_DEBUG="COMMON_DEFINES_DEBUG")
load("//bazel/mac:variables.bzl",
MAC_COMMON_COPTS="COMMON_COPTS",
MAC_COMMON_COPTS_RELEASE="COMMON_COPTS_RELEASE",
MAC_COMMON_COPTS_DEBUG="COMMON_COPTS_DEBUG")
load("@rules_cc//cc:defs.bzl", "cc_library", "objc_library")
def declare_cc_library(copts=[], local_defines=[], **kwargs):
"""
cc_library wrapper that applies common copts and local_defines.
"""
# NOTE: objc_library does not support local_defines on MacOS, so on
# that platform we put the defines in copts instead.
cc_library(
copts = select({
"@platforms//os:windows": WIN_COMMON_COPTS,
"@platforms//os:linux": LINUX_COMMON_COPTS,
"@platforms//os:macos": MAC_COMMON_COPTS,
"//conditions:default": None,
}) + select({
"@cef//:windows_opt": WIN_COMMON_COPTS_RELEASE,
"@cef//:windows_dbg": WIN_COMMON_COPTS_DEBUG,
"@cef//:windows_fastbuild": WIN_COMMON_COPTS_RELEASE,
"@cef//:linux_opt": LINUX_COMMON_COPTS_RELEASE,
"@cef//:linux_dbg": LINUX_COMMON_COPTS_DEBUG,
"@cef//:linux_fastbuild": LINUX_COMMON_COPTS_RELEASE,
"@cef//:macos_opt": MAC_COMMON_COPTS_RELEASE,
"@cef//:macos_dbg": MAC_COMMON_COPTS_DEBUG,
"@cef//:macos_fastbuild": MAC_COMMON_COPTS_RELEASE,
"//conditions:default": None,
}) + copts,
local_defines = select({
"@platforms//os:windows": WIN_COMMON_DEFINES,
"@platforms//os:linux": LINUX_COMMON_DEFINES,
"//conditions:default": None,
}) + select({
"@cef//:windows_opt": WIN_COMMON_DEFINES_RELEASE,
"@cef//:windows_dbg": WIN_COMMON_DEFINES_DEBUG,
"@cef//:windows_fastbuild": WIN_COMMON_DEFINES_RELEASE,
"@cef//:linux_opt": LINUX_COMMON_DEFINES_RELEASE,
"@cef//:linux_dbg": LINUX_COMMON_DEFINES_DEBUG,
"@cef//:linux_fastbuild": LINUX_COMMON_DEFINES_RELEASE,
"//conditions:default": None,
}) + local_defines,
**kwargs
)
def declare_objc_library(copts=[], **kwargs):
"""
objc_library wrapper that applies common copts.
"""
# NOTE: objc_library does not support local_defines on MacOS, so on
# that platform we put the defines in copts instead.
objc_library(
copts = select({
"@platforms//os:windows": WIN_COMMON_COPTS,
"@platforms//os:linux": LINUX_COMMON_COPTS,
"@platforms//os:macos": MAC_COMMON_COPTS,
"//conditions:default": None,
}) + select({
"@cef//:windows_opt": WIN_COMMON_COPTS_RELEASE,
"@cef//:windows_dbg": WIN_COMMON_COPTS_DEBUG,
"@cef//:windows_fastbuild": WIN_COMMON_COPTS_RELEASE,
"@cef//:linux_opt": LINUX_COMMON_COPTS_RELEASE,
"@cef//:linux_dbg": LINUX_COMMON_COPTS_DEBUG,
"@cef//:linux_fastbuild": LINUX_COMMON_COPTS_RELEASE,
"@cef//:macos_opt": MAC_COMMON_COPTS_RELEASE,
"@cef//:macos_dbg": MAC_COMMON_COPTS_DEBUG,
"@cef//:macos_fastbuild": MAC_COMMON_COPTS_RELEASE,
"//conditions:default": None,
}) + copts,
**kwargs
)

8
bazel/linux/BUILD.bazel Executable file
View File

@@ -0,0 +1,8 @@
# Copyright (c) 2024 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.
# Allow access from targets in other packages.
package(default_visibility = [
"//visibility:public",
])

63
bazel/linux/exe_helpers.bzl Executable file
View File

@@ -0,0 +1,63 @@
# Copyright (c) 2024 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.
load("//bazel:copy_filegroups.bzl", "copy_filegroups")
load("//bazel/linux:fix_rpath.bzl", "fix_rpath")
load("//bazel/linux:variables.bzl",
"COMMON_LINKOPTS",
"COMMON_COPTS", "COMMON_COPTS_RELEASE", "COMMON_COPTS_DEBUG",
"COMMON_DEFINES", "COMMON_DEFINES_RELEASE", "COMMON_DEFINES_DEBUG")
load("@rules_cc//cc:defs.bzl", "cc_binary")
def declare_exe(name, srcs=[], deps=[], linkopts=[], copts=[], local_defines=[], data=[], **kwargs):
# Copy SOs and resources into the current project.
copy_target = "{}_sos_and_resources".format(name)
copy_filegroups(
name = copy_target,
filegroups = [
"@cef//:sos",
"@cef//:resources",
],
remove_prefixes = [
"Debug",
"Release",
"Resources",
],
)
# Executable target.
binary_target = "{}_incorrect_rpath".format(name)
cc_binary(
name = binary_target,
srcs = srcs,
deps = [
"@cef//:cef_wrapper",
"@cef//:cef",
"@cef//:cef_sandbox",
] + deps,
linkopts = COMMON_LINKOPTS + linkopts,
copts = COMMON_COPTS + select({
"@cef//:linux_dbg": COMMON_COPTS_DEBUG,
"//conditions:default": COMMON_COPTS_RELEASE,
}) + copts,
local_defines = COMMON_DEFINES + select({
"@cef//:linux_dbg": COMMON_DEFINES_DEBUG,
"//conditions:default": COMMON_DEFINES_RELEASE,
}) + local_defines,
data = [
":{}".format(copy_target),
] + data,
target_compatible_with = ["@platforms//os:linux"],
**kwargs
)
# Set rpath to $ORIGIN so that libraries can be loaded from next to the
# executable.
fix_rpath(
name = "{}_fixed_rpath".format(name),
src = ":{}".format(binary_target),
out = name,
target_compatible_with = ["@platforms//os:linux"],
)

41
bazel/linux/fix_rpath.bzl Normal file
View File

@@ -0,0 +1,41 @@
# Copyright (c) 2024 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.
def _fix_rpath_impl(ctx):
inputs = ctx.runfiles(files = [ctx.file.src])
# Bring over 'data' dependencies from the input.
inputs = inputs.merge_all([ctx.attr.src[DefaultInfo].default_runfiles])
src = ctx.file.src.path
out = ctx.outputs.out.path
ctx.actions.run_shell(
outputs = [ctx.outputs.out],
inputs = inputs.files,
arguments = [src, out],
command = "cp $1 $2 && " +
"chmod +w $2 && " +
"patchelf --remove-rpath $2 && " +
"patchelf --set-rpath '$ORIGIN' $2"
)
return [DefaultInfo(files = depset([ctx.outputs.out]))]
# Set rpath to $ORIGIN so that libraries can be loaded from next to the
# executable. The result can be confirmed with:
# $ objdump -x ./bazel-bin/path/to/binary | grep 'R.*PATH'
#
# Alternatively, define a custom CC toolchain that overrides
# 'runtime_library_search_directories'.
#
# This rule requires preinstallation of the patchelf package:
# $ sudo apt install patchelf
fix_rpath = rule(
implementation = _fix_rpath_impl,
attrs = {
"src": attr.label(allow_single_file = True),
"out": attr.output(mandatory = True),
},
)

View File

@@ -0,0 +1,7 @@
package(default_visibility = ["//visibility:public"])
exports_files([
"pkg_config.bzl",
"BUILD.tmpl",
])

View File

@@ -0,0 +1,32 @@
# vi: ft=bzl
package(default_visibility = ["//visibility:private"])
_imports = [p[:len(p)-2] for p in glob(["{}/**/*.a".format(d) for d in [%{deps}]])]
[cc_import(
name = i.replace("/", "_"),
hdrs = glob([%{hdrs}]),
# TODO: library extension for platform.
static_library = "{}.a".format(i),
shared_library = "{}.dylib".format(i),
) for i in _imports]
cc_library(
name = "internal_lib",
hdrs = glob([%{hdrs}]),
copts = [%{copts}],
includes = [%{includes}],
linkopts = [%{linkopts}],
deps = [(":" + i.replace("/", "_")) for i in _imports],
)
cc_library(
name = "lib",
hdrs = glob(["%{strip_include}/**/*.h"]),
copts = [%{extra_copts}],
linkopts = [%{extra_linkopts}],
deps = [":internal_lib"] + [%{extra_deps}],
visibility = ["//visibility:public"],
strip_include_prefix = "%{strip_include}",
include_prefix = "%{include_prefix}",
)

View File

@@ -0,0 +1,11 @@
Name: pkg_config
URL: https://github.com/cherrry/bazel_pkg_config
Version: 284219a
Description:
Bazel rules for pkg-config tools.
CEF-specific changes:
- Fix failure with duplicate symlinks.
- Remove `--static` flag from pkg-config invocation.

View File

@@ -0,0 +1,2 @@
workspace(name = "pkg_config")

View File

@@ -0,0 +1,194 @@
def _success(value):
return struct(error = None, value = value)
def _error(message):
return struct(error = message, value = None)
def _split(result, delimeter = " "):
if result.error != None:
return result
return _success([arg for arg in result.value.strip().split(delimeter) if arg])
def _find_binary(ctx, binary_name):
binary = ctx.which(binary_name)
if binary == None:
return _error("Unable to find binary: {}".format(binary_name))
return _success(binary)
def _execute(ctx, binary, args):
result = ctx.execute([binary] + args)
if result.return_code != 0:
return _error("Failed execute {} {}".format(binary, args))
return _success(result.stdout)
def _pkg_config(ctx, pkg_config, pkg_name, args):
return _execute(ctx, pkg_config, [pkg_name] + args)
def _check(ctx, pkg_config, pkg_name):
exist = _pkg_config(ctx, pkg_config, pkg_name, ["--exists"])
if exist.error != None:
return _error("Package {} does not exist".format(pkg_name))
if ctx.attr.version != "":
version = _pkg_config(ctx, pkg_config, pkg_name, ["--exact-version", ctx.attr.version])
if version.error != None:
return _error("Require {} version = {}".format(pkg_name, ctx.attr.version))
if ctx.attr.min_version != "":
version = _pkg_config(ctx, pkg_config, pkg_name, ["--atleast-version", ctx.attr.min_version])
if version.error != None:
return _error("Require {} version >= {}".format(pkg_name, ctx.attr.min_version))
if ctx.attr.max_version != "":
version = _pkg_config(ctx, pkg_config, pkg_name, ["--max-version", ctx.attr.max_version])
if version.error != None:
return _error("Require {} version <= {}".format(pkg_name, ctx.attr.max_version))
return _success(None)
def _extract_prefix(flags, prefix, strip = True):
stripped, remain = [], []
for arg in flags:
if arg.startswith(prefix):
if strip:
stripped += [arg[len(prefix):]]
else:
stripped += [arg]
else:
remain += [arg]
return stripped, remain
def _includes(ctx, pkg_config, pkg_name):
includes = _split(_pkg_config(ctx, pkg_config, pkg_name, ["--cflags-only-I"]))
if includes.error != None:
return includes
includes, unused = _extract_prefix(includes.value, "-I", strip = True)
return _success(includes)
def _copts(ctx, pkg_config, pkg_name):
return _split(_pkg_config(ctx, pkg_config, pkg_name, [
"--cflags-only-other",
"--libs-only-L",
]))
def _linkopts(ctx, pkg_config, pkg_name):
return _split(_pkg_config(ctx, pkg_config, pkg_name, [
"--libs-only-other",
"--libs-only-l",
]))
def _ignore_opts(opts, ignore_opts):
remain = []
for opt in opts:
if opt not in ignore_opts:
remain += [opt]
return remain
def _symlinks(ctx, basename, srcpaths):
result = []
root = ctx.path("")
base = root.get_child(basename)
rootlen = len(str(base)) - len(basename)
for src in [ctx.path(p) for p in srcpaths]:
dest = base.get_child(src.basename)
if not dest.exists:
ctx.symlink(src, dest)
result += [str(dest)[rootlen:]]
return result
def _deps(ctx, pkg_config, pkg_name):
deps = _split(_pkg_config(ctx, pkg_config, pkg_name, [
"--libs-only-L",
"--static",
]))
if deps.error != None:
return deps
deps, unused = _extract_prefix(deps.value, "-L", strip = True)
result = []
for dep in {dep: True for dep in deps}.keys():
base = "deps_" + dep.replace("/", "_").replace(".", "_")
result += _symlinks(ctx, base, [dep])
return _success(result)
def _fmt_array(array):
return ",".join(['"{}"'.format(a) for a in array])
def _fmt_glob(array):
return _fmt_array(["{}/**/*.h".format(a) for a in array])
def _pkg_config_impl(ctx):
pkg_name = ctx.attr.pkg_name
if pkg_name == "":
pkg_name = ctx.attr.name
pkg_config = _find_binary(ctx, "pkg-config")
if pkg_config.error != None:
return pkg_config
pkg_config = pkg_config.value
check = _check(ctx, pkg_config, pkg_name)
if check.error != None:
return check
includes = _includes(ctx, pkg_config, pkg_name)
if includes.error != None:
return includes
includes = includes.value
includes = _symlinks(ctx, "includes", includes)
strip_include = "includes"
if len(includes) == 1:
strip_include = includes[0]
if ctx.attr.strip_include != "":
strip_include += "/" + ctx.attr.strip_include
ignore_opts = ctx.attr.ignore_opts
copts = _copts(ctx, pkg_config, pkg_name)
if copts.error != None:
return copts
copts = _ignore_opts(copts.value, ignore_opts)
linkopts = _linkopts(ctx, pkg_config, pkg_name)
if linkopts.error != None:
return linkopts
linkopts = _ignore_opts(linkopts.value, ignore_opts)
deps = _deps(ctx, pkg_config, pkg_name)
if deps.error != None:
return deps
deps = deps.value
include_prefix = ctx.attr.name
if ctx.attr.include_prefix != "":
include_prefix = ctx.attr.include_prefix + "/" + ctx.attr.name
build = ctx.template("BUILD", Label("//:BUILD.tmpl"), substitutions = {
"%{name}": ctx.attr.name,
"%{hdrs}": _fmt_glob(includes),
"%{includes}": _fmt_array(includes),
"%{copts}": _fmt_array(copts),
"%{extra_copts}": _fmt_array(ctx.attr.copts),
"%{deps}": _fmt_array(deps),
"%{extra_deps}": _fmt_array(ctx.attr.deps),
"%{linkopts}": _fmt_array(linkopts),
"%{extra_linkopts}": _fmt_array(ctx.attr.linkopts),
"%{strip_include}": strip_include,
"%{include_prefix}": include_prefix,
}, executable = False)
pkg_config = repository_rule(
attrs = {
"pkg_name": attr.string(doc = "Package name for pkg-config query, default to name."),
"include_prefix": attr.string(doc = "Additional prefix when including file, e.g. third_party. Compatible with strip_include option to produce desired include paths."),
"strip_include": attr.string(doc = "Strip prefix when including file, e.g. libs, files not included will be invisible. Compatible with include_prefix option to produce desired include paths."),
"version": attr.string(doc = "Exact package version."),
"min_version": attr.string(doc = "Minimum package version."),
"max_version": attr.string(doc = "Maximum package version."),
"deps": attr.string_list(doc = "Dependency targets."),
"linkopts": attr.string_list(doc = "Extra linkopts value."),
"copts": attr.string_list(doc = "Extra copts value."),
"ignore_opts": attr.string_list(doc = "Ignore listed opts in copts or linkopts."),
},
local = True,
implementation = _pkg_config_impl,
)

68
bazel/linux/variables.bzl Executable file
View File

@@ -0,0 +1,68 @@
# Copyright (c) 2024 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.
#
# Distribution SOs.
#
SOS = [
"libcef.so",
"libEGL.so",
"libGLESv2.so",
"libvk_swiftshader.so",
"libvulkan.so.1",
]
#
# Common 'linkopts' for cc_binary targets.
#
# Standard link libraries.
STANDARD_LIBS = [
"X11",
]
COMMON_LINKOPTS_DEBUG = [
]
COMMON_LINKOPTS_RELEASE = [
]
COMMON_LINKOPTS = [
"-l{}".format(lib) for lib in STANDARD_LIBS
] + select({
"@cef//:linux_dbg": COMMON_LINKOPTS_DEBUG,
"//conditions:default": COMMON_LINKOPTS_RELEASE,
})
#
# Common 'copts' for cc_libary and cc_binary targets.
#
COMMON_COPTS = [
]
COMMON_COPTS_DEBUG = [
]
COMMON_COPTS_RELEASE = [
]
#
# Common 'defines' for cc_libary targets.
#
COMMON_DEFINES = [
# Used by apps to test if the sandbox is enabled
"CEF_USE_SANDBOX",
]
COMMON_DEFINES_DEBUG = [
]
COMMON_DEFINES_RELEASE = [
# Not a debug build
"NDEBUG",
]

8
bazel/mac/BUILD.bazel Normal file
View File

@@ -0,0 +1,8 @@
# Copyright (c) 2024 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.
# Allow access from targets in other packages.
package(default_visibility = [
"//visibility:public",
])

113
bazel/mac/app_helpers.bzl Normal file
View File

@@ -0,0 +1,113 @@
# Copyright (c) 2024 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.
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
load("@build_bazel_rules_apple//apple:macos.bzl", "macos_application")
load("//bazel:variables.bzl", "VERSION_PLIST")
load("//bazel/mac:variables.bzl",
"MACOS_DEPLOYMENT_TARGET",
"MACOS_BUNDLE_ID_BASE",
"CEF_FRAMEWORK_NAME",
"COMMON_LINKOPTS")
def _declare_helper_app(name, info_plist, deps, helper_base_name, helper_suffix, **kwargs):
"""
Creates a Helper .app target.
"""
helper_name = "{} Helper".format(name)
bundle_id_suffix = ""
if helper_suffix:
helper_name += " ({})".format(helper_suffix)
bundle_id_suffix += ".{}".format(helper_suffix.lower())
# Helper app bundle Info.plist.
expand_template(
name = "{}_InfoPList".format(helper_base_name),
template = info_plist,
out = "{}Info.plist".format(helper_base_name),
substitutions = {
"${EXECUTABLE_NAME}": helper_name,
"${PRODUCT_NAME}": name,
"${BUNDLE_ID_SUFFIX}": bundle_id_suffix,
"${VERSION_SHORT}": VERSION_PLIST,
"${VERSION_LONG}": VERSION_PLIST,
},
)
# Helper app bundle.
macos_application(
name = helper_base_name,
bundle_name = helper_name,
bundle_id = "{}.{}.helper{}".format(MACOS_BUNDLE_ID_BASE, name.lower(), bundle_id_suffix),
infoplists = [":{}_InfoPList".format(helper_base_name)],
minimum_os_version = MACOS_DEPLOYMENT_TARGET,
deps = [
"@cef//:cef_sandbox",
] + deps,
**kwargs,
)
HELPERS = {
"HelperBase": "",
"HelperAlerts": "Alerts",
"HelperGPU": "GPU",
"HelperPlugin": "Plugin",
"HelperRenderer": "Renderer",
}
def declare_all_helper_apps(name, info_plist, deps, **kwargs):
"""
Creates all Helper .app targets.
"""
[_declare_helper_app(
name = name,
info_plist = info_plist,
deps = deps,
helper_base_name = h,
helper_suffix = v,
**kwargs,
) for h, v in HELPERS.items()]
def declare_main_app(name, info_plist, deps, resources, linkopts=[], **kwargs):
"""
Creates the main .app target.
"""
# Main app bundle Info.plist.
expand_template(
name = "InfoPList",
template = info_plist,
out = "Info.plist",
substitutions = {
"${EXECUTABLE_NAME}": name,
"${PRODUCT_NAME}": name,
"${VERSION_SHORT}": VERSION_PLIST,
"${VERSION_LONG}": VERSION_PLIST,
},
)
# Main app bindle.
macos_application(
name = name,
additional_contents = {
":HelperBase": "Frameworks",
":HelperAlerts": "Frameworks",
":HelperGPU": "Frameworks",
":HelperPlugin": "Frameworks",
":HelperRenderer": "Frameworks",
"@cef//:cef_framework": "Frameworks/{}.framework".format(CEF_FRAMEWORK_NAME),
},
bundle_name = name,
bundle_id = "{}.{}".format(MACOS_BUNDLE_ID_BASE, name.lower()),
infoplists = [":InfoPList"],
linkopts = COMMON_LINKOPTS + linkopts,
minimum_os_version = MACOS_DEPLOYMENT_TARGET,
resources = resources,
target_compatible_with = [
"@platforms//os:macos",
],
deps = deps,
**kwargs,
)

52
bazel/mac/variables.bzl Normal file
View File

@@ -0,0 +1,52 @@
# Copyright (c) 2024 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.
MACOS_DEPLOYMENT_TARGET="10.15"
MACOS_BUNDLE_ID_BASE="org.cef"
CEF_FRAMEWORK_NAME="Chromium Embedded Framework"
#
# Common 'linkopts' for macos_application targets.
#
# Standard link frameworks.
STANDARD_FRAMEWORKS = [
"AppKit",
]
COMMON_LINKOPTS_DEBUG = [
]
COMMON_LINKOPTS_RELEASE = [
]
COMMON_LINKOPTS = [
"-framework {}".format(lib) for lib in STANDARD_FRAMEWORKS
] + select({
"@cef//:macos_dbg": COMMON_LINKOPTS_DEBUG,
"//conditions:default": COMMON_LINKOPTS_RELEASE,
})
#
# Common 'copts' for cc_libary, objc_library and macos_application targets.
# We include defines in 'copts' because objc_library does not support
# 'local_defines'. See https://github.com/bazelbuild/bazel/issues/17482.
#
COMMON_COPTS = [
"-Wno-undefined-var-template",
"-Wno-missing-field-initializers",
"-Wno-deprecated-copy",
# Used by apps to test if the sandbox is enabled
"-DCEF_USE_SANDBOX",
]
COMMON_COPTS_DEBUG = [
]
COMMON_COPTS_RELEASE = [
# Not a debug build
"-DNDEBUG",
]

8
bazel/win/BUILD.bazel Normal file
View File

@@ -0,0 +1,8 @@
# Copyright (c) 2024 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.
# Allow access from targets in other packages.
package(default_visibility = [
"//visibility:public",
])

33
bazel/win/cc_env.bzl Normal file
View File

@@ -0,0 +1,33 @@
# Copyright (c) 2024 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.
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", _use_cpp_toolchain="use_cpp_toolchain")
load("@rules_cc//cc:action_names.bzl", "CPP_COMPILE_ACTION_NAME")
# Since we need windows.h and other headers, we should ensure we have the same
# development environment as a regular cl.exe call. So use the current toolchain
# to grab environment variables to feed into the actual rc.exe call
# Much of this is taken from:
# https://github.com/bazelbuild/rules_cc/blob/main/examples/my_c_archive/my_c_archive.bzl
def collect_compilation_env(ctx):
cc_toolchain = find_cpp_toolchain(ctx)
feature_configuration = cc_common.configure_features(
ctx = ctx,
cc_toolchain = cc_toolchain,
requested_features = ctx.features,
unsupported_features = ctx.disabled_features,
)
compiler_variables = cc_common.create_compile_variables(
feature_configuration = feature_configuration,
cc_toolchain = cc_toolchain,
)
return cc_common.get_environment_variables(
feature_configuration = feature_configuration,
action_name = CPP_COMPILE_ACTION_NAME,
variables = compiler_variables,
)
use_cpp_toolchain=_use_cpp_toolchain

82
bazel/win/exe_helpers.bzl Normal file
View File

@@ -0,0 +1,82 @@
# Copyright (c) 2024 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.
load("//bazel:copy_filegroups.bzl", "copy_filegroups")
load("//bazel/win:mt.bzl", "add_manifest")
load("//bazel/win:rc.bzl", "compile_rc")
load("//bazel/win:variables.bzl",
"COMMON_LINKOPTS",
"COMMON_COPTS", "COMMON_COPTS_RELEASE", "COMMON_COPTS_DEBUG",
"COMMON_DEFINES", "COMMON_DEFINES_RELEASE", "COMMON_DEFINES_DEBUG")
load("@rules_cc//cc:defs.bzl", "cc_binary")
def declare_exe(name, srcs, manifest_srcs, rc_file, resources_srcs, resources_deps=[],
deps=[], linkopts=[], copts=[], local_defines=[], data=[],
additional_linker_inputs=[], features=[], **kwargs):
# Resource file.
res_target = "{}_res".format(name)
compile_rc(
name = res_target,
rc_file = rc_file,
srcs = resources_srcs,
deps = resources_deps,
out = "{}.res".format(name),
target_compatible_with = ["@platforms//os:windows"],
)
# Copy DLLs and resources into the current project.
copy_target = "{}_dlls_and_resources".format(name)
copy_filegroups(
name = copy_target,
filegroups = [
"@cef//:dlls",
"@cef//:resources",
],
remove_prefixes = [
"Debug",
"Release",
"Resources",
],
)
# Executable target.
binary_target = "{}_no_manifest".format(name)
cc_binary(
name = binary_target,
srcs = srcs,
deps = [
"@cef//:cef_wrapper",
"@cef//:cef",
"@cef//:cef_sandbox",
] + deps,
linkopts = [
"$(location :{})".format(res_target),
] + COMMON_LINKOPTS + linkopts,
copts = COMMON_COPTS + select({
"@cef//:windows_dbg": COMMON_COPTS_DEBUG,
"//conditions:default": COMMON_COPTS_RELEASE,
}) + copts,
local_defines = COMMON_DEFINES + select({
"@cef//:windows_dbg": COMMON_DEFINES_DEBUG,
"//conditions:default": COMMON_DEFINES_RELEASE,
}) + local_defines,
additional_linker_inputs = [
":{}".format(res_target),
] + additional_linker_inputs,
data = [
":{}".format(copy_target),
] + data,
features = ["generate_pdb_file"] + features,
target_compatible_with = ["@platforms//os:windows"],
**kwargs
)
# Add manifest and rename to final executable.
add_manifest(
name = name,
mt_files = manifest_srcs,
in_binary = ":{}".format(binary_target),
out_binary = "{}.exe".format(name),
target_compatible_with = ["@platforms//os:windows"],
)

72
bazel/win/mt.bzl Normal file
View File

@@ -0,0 +1,72 @@
# Copyright (c) 2024 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.
load("//bazel/win:cc_env.bzl", "collect_compilation_env", "use_cpp_toolchain")
# Copy exe and pdb file without tracking the destination as an output.
# Based on https://github.com/bazelbuild/bazel-skylib/blob/main/rules/private/copy_file_private.bzl
def _write_copy_cmd(ctx, src, dst):
# Most Windows binaries built with MSVC use a certain argument quoting
# scheme. Bazel uses that scheme too to quote arguments. However,
# cmd.exe uses different semantics, so Bazel's quoting is wrong here.
# To fix that we write the command to a .bat file so no command line
# quoting or escaping is required.
bat = ctx.actions.declare_file(ctx.label.name + "-cmd.bat")
src_path = src.path.replace("/", "\\")
dst_path = dst.path.replace("/", "\\")
ctx.actions.write(
output = bat,
# Do not use lib/shell.bzl's shell.quote() method, because that uses
# Bash quoting syntax, which is different from cmd.exe's syntax.
content = "@copy /Y \"%s\" \"%s\" >NUL\n@copy /Y \"%s\" \"%s\" >NUL" % (
src_path,
dst_path,
src_path.replace(".exe", ".pdb"),
dst_path.replace(".exe", ".pdb"),
),
is_executable = True,
)
return bat
def _add_mt_impl(ctx):
mt_files = ctx.files.mt_files
input = ctx.attr.in_binary[DebugPackageInfo].unstripped_file
output = ctx.outputs.out_binary
bat = _write_copy_cmd(ctx, input, output)
inputs = mt_files + [input, bat]
# Bring over 'data' dependencies from the input.
deps_inputs = ctx.runfiles(files = inputs)
deps_inputs = deps_inputs.merge_all([ctx.attr.in_binary[DefaultInfo].default_runfiles])
ctx.actions.run(
executable = ctx.executable._tool,
inputs = deps_inputs.files,
outputs = [output],
env = collect_compilation_env(ctx),
# The bat file will be executed before the tool command.
arguments = [bat.path, "-nologo", "-manifest"] + [f.path for f in mt_files] +
["-outputresource:{}".format(output.path)],
mnemonic = "AddMT"
)
return DefaultInfo(files = depset([output]))
add_manifest = rule(
implementation = _add_mt_impl,
attrs = {
"mt_files": attr.label_list(allow_files = [".manifest"]),
"in_binary": attr.label(providers = [CcInfo], allow_single_file = True),
"out_binary": attr.output(),
"_cc_toolchain": attr.label(default = Label("@bazel_tools//tools/cpp:current_cc_toolchain")),
"_tool": attr.label(
default = "@winsdk//:mt_pybin",
executable = True,
cfg = "exec"
)
},
fragments = ["cpp"],
toolchains = use_cpp_toolchain(),
)

50
bazel/win/rc.bzl Normal file
View File

@@ -0,0 +1,50 @@
# Copyright (c) 2024 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.
load("//bazel/win:cc_env.bzl", "collect_compilation_env", "use_cpp_toolchain")
def _compile_rc_impl(ctx):
rc_file = ctx.file.rc_file
output = ctx.outputs.out
inputs = [rc_file] + ctx.files.srcs
includes = ["/i{}/{}".format(ctx.label.package, i) for i in ctx.attr.includes]
# Grab all include paths/files required for the run
for dep in ctx.attr.deps:
comp_ctx = dep[CcInfo].compilation_context
includes += ["/i{}".format(i) for i in comp_ctx.quote_includes.to_list()]
includes += ["/i{}".format(i) for i in comp_ctx.system_includes.to_list()]
inputs += comp_ctx.headers.to_list()
ctx.actions.run(
executable = ctx.executable._tool,
inputs = inputs,
outputs = [output],
env = collect_compilation_env(ctx),
arguments = includes + ["/fo", output.path, rc_file.path],
mnemonic = "CompileRC"
)
return DefaultInfo(files = depset([output]))
compile_rc = rule(
implementation = _compile_rc_impl,
attrs = {
"rc_file": attr.label(allow_single_file = [".rc"]),
"srcs": attr.label_list(allow_files = True),
"deps": attr.label_list(providers = [CcInfo]),
"includes": attr.string_list(),
"out": attr.output(),
"_cc_toolchain": attr.label(default = Label("@bazel_tools//tools/cpp:current_cc_toolchain")),
"_tool": attr.label(
default = "@winsdk//:rc_pybin",
executable = True,
cfg = "exec"
)
},
fragments = ["cpp"],
toolchains = use_cpp_toolchain(),
)

124
bazel/win/setup_sdk.bzl Normal file
View File

@@ -0,0 +1,124 @@
# Copyright (c) 2024 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.
load("@bazel_tools//tools/cpp:windows_cc_configure.bzl", "find_vc_path", "setup_vc_env_vars")
def _get_arch(rctx):
if rctx.os.arch == "amd64":
return "x64"
def _is_windows(rctx):
return rctx.os.name.find("windows") != -1
# Tools in the form <Target>: [<Tool>, <Other files needed for that target>]
TOOLS = {
"mt": {
"tool": "mt.exe",
"deps": [],
},
"rc": {
"tool": "rc.exe",
"deps": ["rcdll.dll"],
},
}
def _setup_tools(rctx, sdk_bin_path, sdk_metadata_path):
contents = ""
rctx.symlink(sdk_metadata_path, "VerUnionMetadata")
contents += """
exports_files(["VerUnionMetadata"])
"""
for toolname, toolcfg in TOOLS.items():
toolexec = toolcfg["tool"]
deps = toolcfg["deps"]
direct_deps = [toolexec] + deps
shared_deps = toolcfg.get("shared_deps", [])
# Symlink any tools into the right places
for dep in direct_deps:
rctx.symlink(
"{}/{}".format(sdk_bin_path, dep),
dep,
)
# Setting up a filegroup for those dependents
contents += """
filegroup(
name = "{}_deps",
srcs = {},
)
""".format(toolname, direct_deps + shared_deps)
# Now create a wrapper for this tool that simply calls it
rctx.template(
"{}_wrapper.py".format(toolname),
Label("//bazel/win:wrapper.py.tpl"),
substitutions = {
"${binary}": toolexec,
},
executable = True,
)
# And add that newly created wrapper to the BUILD.bazel file
contents += """
py_binary(
name = "{0}_pybin",
srcs = ["{0}_wrapper.py"],
main = "{0}_wrapper.py",
data = [
"@rules_python//python/runfiles",
":{0}_deps"
],
python_version = "PY3",
)
""".format(toolname)
return contents
def _setup_vc_debug_runtime(rctx, sdk_bin_path):
ucrtbased_dll = "ucrtbased.dll"
rctx.symlink("{}/ucrt/{}".format(sdk_bin_path, ucrtbased_dll), ucrtbased_dll)
contents = """
filegroup(
name = "vc_debug_runtime",
srcs = ["{}"],
)
""".format(ucrtbased_dll)
return contents
def _windows_sdk_impl(rctx):
# We only support Windows
if not _is_windows(rctx):
fail("This rule only supports Windows")
# Figure out where the SDK is, which is based on a registry key.
vc_path = find_vc_path(rctx)
env = setup_vc_env_vars(rctx, vc_path, envvars = ["WINDOWSSDKVERBINPATH", "WindowsSdkDir", "WindowsSDKVersion"])
sdk_bin_path = "{}{}".format(env["WINDOWSSDKVERBINPATH"], _get_arch(rctx))
sdk_metadata_path = "{}UnionMetadata/{}".format(env["WindowsSdkDir"], env["WindowsSDKVersion"])
# Start with some pre-amble
contents = """# Autogenerated by //bazel/win:sdk.bzl
load("@rules_python//python:defs.bzl", "py_binary")
package(default_visibility = ["//visibility:public"])
"""
# Handle setting up tools from our list
contents += _setup_tools(rctx, sdk_bin_path, sdk_metadata_path)
contents += _setup_vc_debug_runtime(rctx, sdk_bin_path)
rctx.file("BUILD.bazel", contents)
setup_sdk = repository_rule(
attrs = {},
local = True,
configure = True,
implementation = _windows_sdk_impl,
)

199
bazel/win/variables.bzl Normal file
View File

@@ -0,0 +1,199 @@
# Copyright (c) 2024 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.
#
# Distribution DLLs.
#
# NOTE: libcef.dll is included via the //:cef dependency.
DLLS = [
"chrome_elf.dll",
"d3dcompiler_47.dll",
"libEGL.dll",
"libGLESv2.dll",
"vk_swiftshader.dll",
"vulkan-1.dll",
]
DLLS_X64 = [
"dxil.dll",
"dxcompiler.dll",
]
#
# Common 'linkopts' for cc_binary targets.
#
# Windows delayload DLLs.
# Delayload most libraries as the DLLs are simply not required at startup (or
# at all, depending on the process type). Some dlls open handles when they are
# loaded, and we may not want them to be loaded in renderers or other sandboxed
# processes. Conversely, some DLLs must be loaded before sandbox lockdown. In
# unsandboxed processes they will load when first needed. The linker will
# automatically ignore anything which is not linked to the binary at all (it is
# harmless to have an unmatched /delayload). This list should be kept in sync
# with Chromium's "delayloads" target from the //build/config/win/BUILD.gn file.
DELAYLOAD_DLLS = [
"api-ms-win-core-winrt-error-l1-1-0.dll",
"api-ms-win-core-winrt-l1-1-0.dll",
"api-ms-win-core-winrt-string-l1-1-0.dll",
"advapi32.dll",
"comctl32.dll",
"comdlg32.dll",
"credui.dll",
"cryptui.dll",
"d3d11.dll",
"d3d9.dll",
"dwmapi.dll",
"dxgi.dll",
"dxva2.dll",
"esent.dll",
"gdi32.dll",
"hid.dll",
"imagehlp.dll",
"imm32.dll",
"msi.dll",
"netapi32.dll",
"ncrypt.dll",
"ole32.dll",
"oleacc.dll",
"propsys.dll",
"psapi.dll",
"rpcrt4.dll",
"rstrtmgr.dll",
"setupapi.dll",
"shell32.dll",
"shlwapi.dll",
"uiautomationcore.dll",
"urlmon.dll",
"user32.dll",
"usp10.dll",
"uxtheme.dll",
"wer.dll",
"wevtapi.dll",
"wininet.dll",
"winusb.dll",
"wsock32.dll",
"wtsapi32.dll",
]
# Standard link libraries.
STANDARD_LIBS = [
"comctl32.lib",
"gdi32.lib",
"rpcrt4.lib",
"shlwapi.lib",
"user32.lib",
"ws2_32.lib",
]
# Sandbox link libraries.
SANDBOX_LIBS = [
"Advapi32.lib",
"dbghelp.lib",
"Delayimp.lib",
"ntdll.lib",
"OleAut32.lib",
"PowrProf.lib",
"Propsys.lib",
"psapi.lib",
"SetupAPI.lib",
"Shcore.lib",
"Shell32.lib",
"Userenv.lib",
"version.lib",
"wbemuuid.lib",
"WindowsApp.lib",
"winmm.lib",
]
COMMON_LINKOPTS_DEBUG = [
]
COMMON_LINKOPTS_RELEASE = [
]
COMMON_LINKOPTS = [
# No default manifest (see compile_rc target).
"/MANIFEST:NO",
# Allow 32-bit processes to access 3GB of RAM.
"/LARGEADDRESSAWARE",
# Generate Debug information.
# TODO: Remove after fixing opt builds to work without it.
"/DEBUG",
] + [
"/DELAYLOAD:{}".format(dll) for dll in DELAYLOAD_DLLS
] + [
"/DEFAULTLIB:{}".format(lib) for lib in STANDARD_LIBS
] + select({
# Set the initial stack size to 0.5MiB, instead of the 1.5MiB minimum
# needed by CEF's main thread. This saves significant memory on threads
# (like those in the Windows thread pool, and others) whose stack size we
# can only control through this setting. The main thread (in 32-bit builds
# only) uses fibers to switch to a 4MiB stack at runtime via
# CefRunWinMainWithPreferredStackSize().
"@cef//:windows_32": ["/STACK:0x80000"],
# Increase the initial stack size to 8MiB from the default 1MiB.
"//conditions:default": ["/STACK:0x800000"],
}) + select({
"@cef//:windows_dbg": COMMON_LINKOPTS_DEBUG,
"//conditions:default": COMMON_LINKOPTS_RELEASE,
})
#
# Common 'copts' for cc_libary and cc_binary targets.
#
COMMON_COPTS = [
]
COMMON_COPTS_DEBUG = [
]
COMMON_COPTS_RELEASE = [
]
#
# Common 'defines' for cc_libary targets.
#
COMMON_DEFINES = [
# Windows platform
"WIN32",
"_WIN32",
"_WINDOWS",
# Unicode build
"UNICODE",
"_UNICODE",
# Targeting Windows 10. We can't say `=_WIN32_WINNT_WIN10` here because
# some files do `#if WINVER < 0x0600` without including windows.h before,
# and then _WIN32_WINNT_WIN10 isn't yet known to be 0x0A00.
"WINVER=0x0A00",
"_WIN32_WINNT=0x0A00",
"NTDDI_VERSION=NTDDI_WIN10_FE",
# Use the standard's templated min/max
"NOMINMAX",
# Exclude less common API declarations
"WIN32_LEAN_AND_MEAN",
# Disable exceptions
"_HAS_EXCEPTIONS=0",
# Required by cef_sandbox.lib
"PSAPI_VERSION=1",
# Used by apps to test if the sandbox is enabled
"CEF_USE_SANDBOX",
]
COMMON_DEFINES_DEBUG = [
# Required by cef_sandbox.lib
# Disable iterator debugging
"HAS_ITERATOR_DEBUGGING=0",
"_ITERATOR_DEBUG_LEVEL=0",
]
COMMON_DEFINES_RELEASE = [
# Not a debug build
"NDEBUG",
"_NDEBUG",
]

69
bazel/win/wrapper.py.tpl Normal file
View File

@@ -0,0 +1,69 @@
# Copyright (c) 2024 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.
import os
import subprocess
import sys
from rules_python.python.runfiles import runfiles
REPLACEMENTS = {
"XXX_GETCWD_XXX": os.getcwd(),
}
def replace_in_str(input):
output = input
for placeholder, replacement in REPLACEMENTS.items():
if placeholder in output:
output = output.replace(placeholder, replacement)
return output
def print_error(str):
print(str, file=sys.stderr)
r = runfiles.Create()
wrapped_binary = r.Rlocation("winsdk/${binary}")
args = list(map(replace_in_str, sys.argv[1:]))
# Optionally execute a script before tool execution.
if args[0].endswith('.bat') or args[0].endswith('.cmd'):
if sys.platform != 'win32':
raise RuntimeError("Error running bat file; unsupported platform")
# Execute the .bat file first.
bat_file = args[0].replace('/', '\\')
p = subprocess.run(
bat_file, shell=True,
stdout = subprocess.PIPE,
stderr = subprocess.STDOUT,
text=True)
if p.returncode != 0:
print_error("[Generated python wrapper] Error running bat file:")
print_error(f"CWD: {os.getcwd()}")
print_error(f"EXEC: {bat_file}")
print_error(f"Exec output:")
print_error(p.stdout)
raise RuntimeError(f"Error running bat file; {bat_file}")
args = args[1:]
try:
p = subprocess.run(
[wrapped_binary] + args,
stdout = subprocess.PIPE,
stderr = subprocess.STDOUT,
text=True)
if p.returncode != 0:
print_error("[Generated python wrapper] Error running command:")
print_error(f"CWD: {os.getcwd()}")
print_error(f"EXEC: {wrapped_binary}")
print_error(f"ARGS: {args}")
print_error(f"Exec output:")
print_error(p.stdout)
raise RuntimeError(f"Error running wrapped command; {wrapped_binary}")
except OSError as e:
print_error("[Generated python wrapper] Error running command:")
print_error(f"CWD: {os.getcwd()}")
print_error(f"EXEC: {wrapped_binary}")
print_error(f"ARGS: {args}")
raise

View File

@@ -242,6 +242,7 @@
'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',
@@ -370,12 +371,14 @@
'tests/cefclient/browser/window_test_runner_win.cc',
'tests/cefclient/browser/window_test_runner_win.h',
'tests/cefclient/cefclient_win.cc',
'tests/cefclient/resources/win/cefclient.rc',
],
'cefclient_sources_resources_win': [
'tests/cefclient/resources/win/cefclient.exe.manifest',
'tests/cefclient/resources/win/cefclient.ico',
'tests/cefclient/resources/win/small.ico',
'tests/cefclient/win/cefclient.exe.manifest',
'tests/cefclient/win/cefclient.ico',
'tests/cefclient/win/small.ico',
],
'cefclient_sources_resources_win_rc': [
'tests/cefclient/win/cefclient.rc',
],
'cefclient_sources_mac': [
'tests/cefclient/browser/browser_window_osr_mac.h',
@@ -398,12 +401,12 @@
'tests/cefclient/browser/window_test_runner_mac.h',
'tests/cefclient/browser/window_test_runner_mac.mm',
'tests/cefclient/cefclient_mac.mm',
],
],
'cefclient_bundle_resources_mac': [
'tests/cefclient/resources/mac/cefclient.icns',
'tests/cefclient/resources/mac/English.lproj/InfoPlist.strings',
'tests/cefclient/resources/mac/English.lproj/MainMenu.xib',
'tests/cefclient/resources/mac/Info.plist',
'tests/cefclient/mac/cefclient.icns',
'tests/cefclient/mac/English.lproj/InfoPlist.strings',
'tests/cefclient/mac/English.lproj/MainMenu.xib',
'tests/cefclient/mac/Info.plist.in',
],
'cefclient_sources_linux': [
'tests/cefclient/browser/browser_window_osr_gtk.cc',
@@ -435,15 +438,17 @@
'tests/cefsimple/simple_handler.h',
],
'cefsimple_sources_win': [
'tests/cefsimple/cefsimple.rc',
'tests/cefsimple/cefsimple_win.cc',
'tests/cefsimple/simple_handler_win.cc',
'tests/cefsimple/resource.h',
'tests/cefsimple/simple_handler_win.cc',
],
'cefsimple_sources_resources_win': [
'tests/cefsimple/cefsimple.exe.manifest',
'tests/cefsimple/res/cefsimple.ico',
'tests/cefsimple/res/small.ico',
'tests/cefsimple/win/cefsimple.exe.manifest',
'tests/cefsimple/win/cefsimple.ico',
'tests/cefsimple/win/small.ico',
],
'cefsimple_sources_resources_win_rc': [
'tests/cefsimple/win/cefsimple.rc',
],
'cefsimple_sources_mac': [
'tests/cefsimple/cefsimple_mac.mm',
@@ -456,7 +461,7 @@
'tests/cefsimple/mac/cefsimple.icns',
'tests/cefsimple/mac/English.lproj/InfoPlist.strings',
'tests/cefsimple/mac/English.lproj/MainMenu.xib',
'tests/cefsimple/mac/Info.plist',
'tests/cefsimple/mac/Info.plist.in',
],
'cefsimple_sources_linux': [
'tests/cefsimple/cefsimple_linux.cc',
@@ -574,24 +579,32 @@
'ceftests_sources_win': [
'tests/ceftests/resource_util_win_dir.cc',
'tests/ceftests/resource_util_win_idmap.cc',
'tests/ceftests/resources/win/ceftests.rc',
],
'ceftests_sources_resources_win': [
'tests/ceftests/resources/win/ceftests.exe.manifest',
'tests/ceftests/resources/win/ceftests.ico',
'tests/ceftests/resources/win/small.ico',
'tests/ceftests/win/ceftests.exe.manifest',
'tests/ceftests/win/ceftests.ico',
'tests/ceftests/win/small.ico',
],
'ceftests_sources_resources_win_rc': [
'tests/ceftests/win/ceftests.rc',
],
'ceftests_sources_mac': [
'tests/ceftests/os_rendering_unittest_mac.h',
'tests/ceftests/os_rendering_unittest_mac.mm',
'tests/ceftests/run_all_unittests_mac.mm',
],
'ceftests_sources_mac_helper': [
'ceftests_sources_mac_browser_shared': [
'tests/shared/renderer/client_app_renderer.h',
],
'ceftests_sources_mac_helper_shared': [
'tests/shared/browser/client_app_browser.h',
'tests/shared/browser/file_util.cc',
'tests/shared/browser/file_util.h',
'tests/shared/browser/resource_util.h',
'tests/shared/browser/resource_util_mac.mm',
'tests/shared/browser/resource_util_posix.cc',
],
'ceftests_sources_mac_helper': [
'tests/ceftests/audio_output_unittest.cc',
'tests/ceftests/client_app_delegates.cc',
'tests/ceftests/cookie_unittest.cc',
@@ -647,10 +660,10 @@
'tests/ceftests/v8_unittest.cc',
],
'ceftests_bundle_resources_mac': [
'tests/ceftests/resources/mac/ceftests.icns',
'tests/ceftests/resources/mac/English.lproj/InfoPlist.strings',
'tests/ceftests/resources/mac/English.lproj/MainMenu.xib',
'tests/ceftests/resources/mac/Info.plist',
'tests/ceftests/mac/ceftests.icns',
'tests/ceftests/mac/English.lproj/InfoPlist.strings',
'tests/ceftests/mac/English.lproj/MainMenu.xib',
'tests/ceftests/mac/Info.plist.in',
],
'ceftests_sources_linux': [
'tests/ceftests/resource_util_linux.cc',

View File

@@ -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 "ed1dfa5ff8a041241f8fb72eb7454811f358f0d3"
#define CEF_API_HASH_UNIVERSAL "d3709fcbd6630817b73287083d5440bffffcfb0b"
#if defined(OS_WIN)
#define CEF_API_HASH_PLATFORM "0d99d1b9b85b2efab91a39d6fc325bb6d56fd524"
#define CEF_API_HASH_PLATFORM "2e66390b5f0fa21ab4667b503e76164037cd674e"
#elif defined(OS_MAC)
#define CEF_API_HASH_PLATFORM "e585e190387e31a71267207b66d175e213991470"
#define CEF_API_HASH_PLATFORM "94ce56bc6f289ae039ca7db2ac8d32901e71a4e1"
#elif defined(OS_LINUX)
#define CEF_API_HASH_PLATFORM "09d3e280ed38f7a082b794c56ff71c52f86f0ea8"
#define CEF_API_HASH_PLATFORM "2fda6a422c06b87a4ce47bdfd4c985346f1eaab8"
#endif
#ifdef __cplusplus

View File

@@ -514,6 +514,13 @@ typedef struct _cef_settings_t {
/// runtime on Windows.
///
int chrome_app_icon_id;
#if defined(OS_POSIX) && !defined(OS_ANDROID)
///
/// Specify whether signal handlers must be disabled on POSIX systems.
///
int disable_signal_handlers;
#endif
} cef_settings_t;
///

View File

@@ -438,12 +438,12 @@ typedef enum {
/// Website setting which is used for UnusedSitePermissionsService to store
/// auto-revoked notification permissions from abusive sites.
REVOKED_ABUSIVE_NOTIFICATION_PERMISSIONS,
CEF_CONTENT_SETTING_TYPE_REVOKED_ABUSIVE_NOTIFICATION_PERMISSIONS,
/// Content setting that controls tracking protection status per site.
/// BLOCK: Protections enabled. This is the default state.
/// ALLOW: Protections disabled.
TRACKING_PROTECTION,
CEF_CONTENT_SETTING_TYPE_TRACKING_PROTECTION,
} cef_content_setting_types_t;
///

View File

@@ -437,6 +437,10 @@ struct CefSettingsTraits {
cef_string_set(src->chrome_policy_id.str, src->chrome_policy_id.length,
&target->chrome_policy_id, copy);
target->chrome_app_icon_id = src->chrome_app_icon_id;
#if defined(OS_POSIX) && !defined(OS_ANDROID)
target->disable_signal_handlers = src->disable_signal_handlers;
#endif
}
};

View File

@@ -1138,8 +1138,8 @@ void AlloyBrowserHostImpl::GetCustomWebContentsView(
const GURL& target_url,
int opener_render_process_id,
int opener_render_frame_id,
content::WebContentsView** view,
content::RenderViewHostDelegateView** delegate_view) {
raw_ptr<content::WebContentsView>* view,
raw_ptr<content::RenderViewHostDelegateView>* delegate_view) {
CefBrowserInfoManager::GetInstance()->GetCustomWebContentsView(
target_url,
frame_util::MakeGlobalId(opener_render_process_id,

View File

@@ -237,8 +237,8 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
const GURL& target_url,
int opener_render_process_id,
int opener_render_frame_id,
content::WebContentsView** view,
content::RenderViewHostDelegateView** delegate_view) override;
raw_ptr<content::WebContentsView>* view,
raw_ptr<content::RenderViewHostDelegateView>* delegate_view) override;
void WebContentsCreated(content::WebContents* source_contents,
int opener_render_process_id,
int opener_render_frame_id,

View File

@@ -228,8 +228,8 @@ bool CefBrowserInfoManager::CanCreateWindow(
void CefBrowserInfoManager::GetCustomWebContentsView(
const GURL& target_url,
const content::GlobalRenderFrameHostId& opener_global_id,
content::WebContentsView** view,
content::RenderViewHostDelegateView** delegate_view) {
raw_ptr<content::WebContentsView>* view,
raw_ptr<content::RenderViewHostDelegateView>* delegate_view) {
CEF_REQUIRE_UIT();
auto pending_popup = PopPendingPopup(PendingPopup::CAN_CREATE_WINDOW,

View File

@@ -87,8 +87,8 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
void GetCustomWebContentsView(
const GURL& target_url,
const content::GlobalRenderFrameHostId& opener_global_id,
content::WebContentsView** view,
content::RenderViewHostDelegateView** delegate_view);
raw_ptr<content::WebContentsView>* view,
raw_ptr<content::RenderViewHostDelegateView>* delegate_view);
// Called from WebContentsDelegate::WebContentsCreated. See comments on
// PendingPopup for more information.

View File

@@ -85,8 +85,8 @@ content::WebContents* CefBrowserPlatformDelegate::CreateWebContents(
}
void CefBrowserPlatformDelegate::CreateViewForWebContents(
content::WebContentsView** view,
content::RenderViewHostDelegateView** delegate_view) {
raw_ptr<content::WebContentsView>* view,
raw_ptr<content::RenderViewHostDelegateView>* delegate_view) {
DCHECK(false);
}

View File

@@ -111,8 +111,8 @@ class CefBrowserPlatformDelegate {
// called a single time per instance. May be called on multiple threads. Only
// used with windowless rendering.
virtual void CreateViewForWebContents(
content::WebContentsView** view,
content::RenderViewHostDelegateView** delegate_view);
raw_ptr<content::WebContentsView>* view,
raw_ptr<content::RenderViewHostDelegateView>* delegate_view);
// Called after the WebContents for a browser has been created. |owned| will
// be true if |web_contents| was created via CreateWebContents() and we should

View File

@@ -164,13 +164,14 @@ class BrowserDelegate : public content::WebContentsDelegate {
virtual bool HasViewsHostedOpener() const { return false; }
// Same as OpenURLFromTab but only taking |navigation_handle_callback|
// if the return value is non-nullptr.
virtual content::WebContents* OpenURLFromTabEx(
// if the return value is false. Return false to cancel the navigation
// or true to proceed with default chrome handling.
virtual bool OpenURLFromTabEx(
content::WebContents* source,
const content::OpenURLParams& params,
base::OnceCallback<void(content::NavigationHandle&)>&
navigation_handle_callback) {
return nullptr;
return true;
}
};

View File

@@ -527,7 +527,7 @@ void ChromeBrowserDelegate::WebContentsCreated(
/*is_devtools_popup=*/false, opener);
}
content::WebContents* ChromeBrowserDelegate::OpenURLFromTabEx(
bool ChromeBrowserDelegate::OpenURLFromTabEx(
content::WebContents* source,
const content::OpenURLParams& params,
base::OnceCallback<void(content::NavigationHandle&)>&
@@ -536,17 +536,31 @@ content::WebContents* ChromeBrowserDelegate::OpenURLFromTabEx(
// Reading List sidebar. In that case we default to using the Browser's
// currently active WebContents.
if (!source) {
// GetActiveWebContents() may return nullptr if we're in a new Browser
// created using ScopedTabbedBrowserDisplayer. This new Browser does
// not have a WebContents yet.
source = browser_->tab_strip_model()->GetActiveWebContents();
DCHECK(source);
}
if (!source) {
LOG(WARNING) << "Failed to identify target browser for "
<< params.url.spec();
// Proceed with default chrome handling.
return true;
}
// Return nullptr to cancel the navigation. Otherwise, proceed with default
// chrome handling.
if (auto delegate = GetDelegateForWebContents(source)) {
return delegate->OpenURLFromTabEx(source, params,
navigation_handle_callback);
// Returns nullptr to cancel the navigation.
const bool cancel =
delegate->OpenURLFromTabEx(source, params,
navigation_handle_callback) == nullptr;
if (cancel) {
// Cancel the navigation.
return false;
}
}
return nullptr;
// Proceed with default chrome handling.
return true;
}
void ChromeBrowserDelegate::LoadingStateChanged(content::WebContents* source,

View File

@@ -90,11 +90,10 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
const std::optional<SkRegion> GetDraggableRegion() const override;
void WindowFullscreenStateChanged() override;
bool HasViewsHostedOpener() const override;
content::WebContents* OpenURLFromTabEx(
content::WebContents* source,
const content::OpenURLParams& params,
base::OnceCallback<void(content::NavigationHandle&)>&
navigation_handle_callback) override;
bool OpenURLFromTabEx(content::WebContents* source,
const content::OpenURLParams& params,
base::OnceCallback<void(content::NavigationHandle&)>&
navigation_handle_callback) override;
// WebContentsDelegate methods:
void WebContentsCreated(content::WebContents* source_contents,

View File

@@ -146,7 +146,8 @@ FileChooserParams SelectFileToFileChooserParams(
// |extensions| is a list of allowed extensions. For example, it might be
// { { "htm", "html" }, { "txt" } }
for (size_t i = 0; i < file_types->extensions.size(); ++i) {
if (!file_types->extension_mimetypes[i].empty()) {
if (file_types->extension_mimetypes.size() > i &&
!file_types->extension_mimetypes[i].empty()) {
// Use the original mime type.
params.accept_types.push_back(file_types->extension_mimetypes[i]);
} else if (file_types->extensions[i].size() == 1) {
@@ -273,7 +274,8 @@ CefFileDialogManager::~CefFileDialogManager() = default;
void CefFileDialogManager::Destroy() {
if (dialog_listener_) {
// Cancel the listener and delete related objects.
SelectFileDoneByListenerCallback(/*listener_destroyed=*/false);
SelectFileDoneByListenerCallback(/*listener=*/nullptr,
/*listener_destroyed=*/false);
}
DCHECK(!dialog_);
DCHECK(!dialog_listener_);
@@ -386,8 +388,8 @@ void CefFileDialogManager::RunSelectFile(
SelectFileToFileChooserParams(type, title, default_path, file_types);
auto callback =
base::BindOnce(&CefFileDialogManager::SelectFileDoneByDelegateCallback,
weak_ptr_factory_.GetWeakPtr(), base::Unretained(listener),
base::Unretained(params));
weak_ptr_factory_.GetWeakPtr(),
base::UnsafeDangling(listener), base::Unretained(params));
callback = MaybeRunDelegate(chooser_params, file_types->extensions,
file_types->extension_description_overrides,
std::move(callback));
@@ -424,7 +426,8 @@ void CefFileDialogManager::RunSelectFile(
listener, params,
base::BindOnce(&CefFileDialogManager::SelectFileDoneByListenerCallback,
weak_ptr_factory_.GetWeakPtr(),
/*listener_destroyed=*/false));
base::UnsafeDangling(listener),
/*listener_destroyed=*/true));
// This call will not be intercepted by CefSelectFileDialogFactory due to the
// |run_from_cef=true| flag.
@@ -449,9 +452,9 @@ void CefFileDialogManager::SelectFileListenerDestroyed(
// This notification will arrive from whomever owns |listener|, so we don't
// want to execute any |listener| methods after this point.
if (dialog_listener_ && listener == dialog_listener_->listener()) {
if (dialog_listener_) {
// Cancel the currently active dialog.
SelectFileDoneByListenerCallback(/*listener_destroyed=*/true);
SelectFileDoneByListenerCallback(listener, /*listener_destroyed=*/true);
} else {
// Any future SelectFileDoneByDelegateCallback call for |listener| becomes a
// no-op.
@@ -545,7 +548,7 @@ CefFileDialogManager::MaybeRunDelegate(
}
void CefFileDialogManager::SelectFileDoneByDelegateCallback(
ui::SelectFileDialog::Listener* listener,
MayBeDangling<ui::SelectFileDialog::Listener> listener,
void* params,
const std::vector<base::FilePath>& paths) {
CEF_REQUIRE_UIT();
@@ -556,7 +559,7 @@ void CefFileDialogManager::SelectFileDoneByDelegateCallback(
return;
}
active_listeners_.erase(listener);
active_listeners_.erase(listener.get());
if (paths.empty()) {
listener->FileSelectionCanceled(params);
@@ -570,9 +573,14 @@ void CefFileDialogManager::SelectFileDoneByDelegateCallback(
}
void CefFileDialogManager::SelectFileDoneByListenerCallback(
MayBeDangling<ui::SelectFileDialog::Listener> listener,
bool listener_destroyed) {
CEF_REQUIRE_UIT();
// |listener| will be provided iff |listener_destroyed=true|, as
// |dialog_listener_->listener()| will return nullptr at this point.
DCHECK(!listener || listener_destroyed);
// Avoid re-entrancy of this method. CefSelectFileDialogListener callbacks to
// the delegated listener may result in an immediate call to
// SelectFileListenerDestroyed() while |dialog_listener_| is still on the
@@ -587,7 +595,8 @@ void CefFileDialogManager::SelectFileDoneByListenerCallback(
DCHECK(dialog_);
DCHECK(dialog_listener_);
active_listeners_.erase(dialog_listener_->listener());
active_listeners_.erase(listener ? listener.get()
: dialog_listener_->listener());
// Clear |dialog_listener_| before calling Cancel() to avoid re-entrancy.
auto dialog_listener = dialog_listener_;

View File

@@ -82,10 +82,12 @@ class CefFileDialogManager {
RunFileChooserCallback callback);
void SelectFileDoneByDelegateCallback(
ui::SelectFileDialog::Listener* listener,
MayBeDangling<ui::SelectFileDialog::Listener> listener,
void* params,
const std::vector<base::FilePath>& paths);
void SelectFileDoneByListenerCallback(bool listener_destroyed);
void SelectFileDoneByListenerCallback(
MayBeDangling<ui::SelectFileDialog::Listener> listener,
bool listener_destroyed);
// CefBrowserHostBase pointer is guaranteed to outlive this object.
const raw_ptr<CefBrowserHostBase> browser_;

View File

@@ -39,6 +39,8 @@ class CefSelectFileDialogFactory final : public ui::SelectFileDialogFactory {
// Delegates the running of the dialog to CefFileDialogManager.
class CefSelectFileDialog final : public ui::SelectFileDialog {
public:
// |listener| is not owned by this object. It will remain valid until
// ListenerDestroyed() is called.
CefSelectFileDialog(ui::SelectFileDialog::Listener* listener,
std::unique_ptr<ui::SelectFilePolicy> policy)
: ui::SelectFileDialog(listener, std::move(policy)) {

View File

@@ -277,7 +277,13 @@ bool CefMainRunner::Initialize(CefSettings* settings,
this, settings, application);
exit_code_ =
ContentMainInitialize(args, windows_sandbox_info, &settings->no_sandbox);
ContentMainInitialize(args, windows_sandbox_info, &settings->no_sandbox,
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID)
settings->disable_signal_handlers
#else
false
#endif
);
if (exit_code_ >= 0) {
LOG(ERROR) << "ContentMainInitialize failed with exit code " << exit_code_;
return false;
@@ -429,7 +435,8 @@ int CefMainRunner::RunAsHelperProcess(const CefMainArgs& args,
int CefMainRunner::ContentMainInitialize(const CefMainArgs& args,
void* windows_sandbox_info,
int* no_sandbox) {
int* no_sandbox,
bool disable_signal_handlers) {
main_delegate_->BeforeMainThreadInitialize(args);
// Initialize the content runner.
@@ -452,6 +459,10 @@ int CefMainRunner::ContentMainInitialize(const CefMainArgs& args,
main_params.argv = const_cast<const char**>(args.argv);
#endif
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID)
main_params.disable_signal_handlers = disable_signal_handlers;
#endif
return content::ContentMainInitialize(std::move(main_params),
main_runner_.get());
}

View File

@@ -60,7 +60,9 @@ class CefMainRunner : public CefMainRunnerHandler {
// Called from Initialize().
int ContentMainInitialize(const CefMainArgs& args,
void* windows_sandbox_info,
int* no_sandbox);
int* no_sandbox,
bool disable_signal_handlers);
int ContentMainRun(bool* initialized, base::OnceClosure context_initialized);
// CefMainRunnerHandler methods:

View File

@@ -95,14 +95,16 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
void Reset(CefRefPtr<CefResourceRequestHandler> handler,
CefRefPtr<CefSchemeHandlerFactory> scheme_factory,
CefRefPtr<CefRequestImpl> request,
CefRefPtr<CefRequestImpl> pending_request,
network::ResourceRequest* request,
bool request_was_redirected,
CancelRequestCallback cancel_callback) {
handler_ = handler;
scheme_factory_ = scheme_factory;
cookie_filter_ = nullptr;
pending_request_ = request;
pending_request_ = pending_request;
pending_response_ = nullptr;
request_ = request;
request_was_redirected_ = request_was_redirected;
was_custom_handled_ = false;
cancel_callback_ = std::move(cancel_callback);
@@ -113,6 +115,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
CefRefPtr<CefCookieAccessFilter> cookie_filter_;
CefRefPtr<CefRequestImpl> pending_request_;
CefRefPtr<CefResponseImpl> pending_response_;
raw_ptr<network::ResourceRequest> request_;
bool request_was_redirected_ = false;
bool was_custom_handled_ = false;
bool accept_language_added_ = false;
@@ -144,7 +147,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
}
const int32_t id_;
raw_ptr<network::ResourceRequest> request_;
raw_ptr<network::ResourceRequest, DisableDanglingPtrDetection> request_;
const bool request_was_redirected_;
OnBeforeRequestResultCallback callback_;
CancelRequestCallback cancel_callback_;
@@ -569,8 +572,8 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
}
// May have a handler and/or scheme factory.
state->Reset(handler, scheme_factory, requestPtr, request_was_redirected,
std::move(cancel_callback));
state->Reset(handler, scheme_factory, requestPtr, request,
request_was_redirected, std::move(cancel_callback));
if (handler) {
state->cookie_filter_ = handler->GetCookieAccessFilter(
@@ -587,16 +590,15 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
return;
}
MaybeLoadCookies(request_id, state, request, std::move(exec_callback));
MaybeLoadCookies(request_id, state, std::move(exec_callback));
}
void MaybeLoadCookies(int32_t request_id,
RequestState* state,
network::ResourceRequest* request,
base::OnceClosure callback) {
CEF_REQUIRE_IOT();
if (!cookie_helper::IsCookieableScheme(request->url,
if (!cookie_helper::IsCookieableScheme(state->request_->url,
init_state_->cookieable_schemes_)) {
// The scheme does not support cookies.
std::move(callback).Run();
@@ -614,10 +616,9 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
&InterceptedRequestHandlerWrapper::AllowCookieAlways);
auto done_cookie_callback = base::BindOnce(
&InterceptedRequestHandlerWrapper::ContinueWithLoadedCookies,
weak_ptr_factory_.GetWeakPtr(), request_id, request,
std::move(callback));
cookie_helper::LoadCookies(init_state_->browser_context_getter_, *request,
allow_cookie_callback,
weak_ptr_factory_.GetWeakPtr(), request_id, std::move(callback));
cookie_helper::LoadCookies(init_state_->browser_context_getter_,
*(state->request_), allow_cookie_callback,
std::move(done_cookie_callback));
}
@@ -649,7 +650,6 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
}
void ContinueWithLoadedCookies(int32_t request_id,
network::ResourceRequest* request,
base::OnceClosure callback,
int total_count,
net::CookieList allowed_cookies) {
@@ -666,13 +666,14 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
// Also add/save cookies ourselves for default-handled network requests
// so that we can filter them. This will be a no-op for custom-handled
// requests.
request->load_flags |= kLoadNoCookiesFlags;
state->request_->load_flags |= kLoadNoCookiesFlags;
}
if (!allowed_cookies.empty()) {
const std::string& cookie_line =
net::CanonicalCookie::BuildCookieLine(allowed_cookies);
request->headers.SetHeader(net::HttpRequestHeaders::kCookie, cookie_line);
state->request_->headers.SetHeader(net::HttpRequestHeaders::kCookie,
cookie_line);
state->pending_request_->SetReadOnly(false);
state->pending_request_->SetHeaderByName(net::HttpRequestHeaders::kCookie,
@@ -708,8 +709,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
CefRefPtr<RequestCallbackWrapper> callbackPtr =
new RequestCallbackWrapper(base::BindOnce(
&InterceptedRequestHandlerWrapper::ContinueShouldInterceptRequest,
weak_ptr_factory_.GetWeakPtr(), request_id,
base::Unretained(request), std::move(callback)));
weak_ptr_factory_.GetWeakPtr(), request_id, std::move(callback)));
cef_return_value_t retval = state->handler_->OnBeforeResourceLoad(
init_state_->browser_, init_state_->frame_,
@@ -725,14 +725,12 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
}
} else {
// The scheme factory may choose to handle it.
ContinueShouldInterceptRequest(request_id, request, std::move(callback),
true);
ContinueShouldInterceptRequest(request_id, std::move(callback), true);
}
}
void ContinueShouldInterceptRequest(
int32_t request_id,
network::ResourceRequest* request,
ShouldInterceptRequestResultCallback callback,
bool allow) {
CEF_REQUIRE_IOT();
@@ -751,7 +749,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
if (state->handler_) {
if (allow) {
// Apply any |requestPtr| changes to |request|.
state->pending_request_->Get(request, true /* changed_only */);
state->pending_request_->Get(state->request_, true /* changed_only */);
}
const bool redirect =
@@ -790,8 +788,8 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
if (!resource_handler && state->scheme_factory_) {
// Does the scheme factory want to handle the request?
resource_handler = state->scheme_factory_->Create(
init_state_->browser_, init_state_->frame_, request->url.scheme(),
state->pending_request_.get());
init_state_->browser_, init_state_->frame_,
state->request_->url.scheme(), state->pending_request_.get());
}
std::unique_ptr<ResourceResponse> resource_response;
@@ -803,7 +801,8 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
// The request will be handled by the NetworkService. Remove the
// "Accept-Language" header here so that it can be re-added in
// URLRequestHttpJob::AddExtraHeaders with correct ordering applied.
request->headers.RemoveHeader(net::HttpRequestHeaders::kAcceptLanguage);
state->request_->headers.RemoveHeader(
net::HttpRequestHeaders::kAcceptLanguage);
}
// Continue the request.
@@ -860,7 +859,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
if (!state->handler_) {
// Cookies may come from a scheme handler.
MaybeSaveCookies(
request_id, state, request, headers,
request_id, state, headers,
base::BindOnce(
std::move(callback), ResponseMode::CONTINUE, nullptr,
redirect_info.has_value() ? redirect_info->new_url : GURL()));
@@ -871,16 +870,15 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
DCHECK(state->pending_response_);
if (redirect_info.has_value()) {
HandleRedirect(request_id, state, request, headers, *redirect_info,
HandleRedirect(request_id, state, headers, *redirect_info,
std::move(callback));
} else {
HandleResponse(request_id, state, request, headers, std::move(callback));
HandleResponse(request_id, state, headers, std::move(callback));
}
}
void HandleRedirect(int32_t request_id,
RequestState* state,
network::ResourceRequest* request,
net::HttpResponseHeaders* headers,
const net::RedirectInfo& redirect_info,
OnRequestResponseResultCallback callback) {
@@ -911,13 +909,11 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
auto exec_callback = base::BindOnce(
std::move(callback), ResponseMode::CONTINUE, nullptr, new_url);
MaybeSaveCookies(request_id, state, request, headers,
std::move(exec_callback));
MaybeSaveCookies(request_id, state, headers, std::move(exec_callback));
}
void HandleResponse(int32_t request_id,
RequestState* state,
network::ResourceRequest* request,
net::HttpResponseHeaders* headers,
OnRequestResponseResultCallback callback) {
// The client may modify |pending_request_| in OnResourceResponse.
@@ -933,7 +929,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
// The request may have been modified.
const auto changes = state->pending_request_->GetChanges();
if (changes) {
state->pending_request_->Get(request, true /* changed_only */);
state->pending_request_->Get(state->request_, true /* changed_only */);
if (changes & CefRequestImpl::kChangedUrl) {
// Redirect to the new URL.
@@ -961,13 +957,11 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
return;
}
MaybeSaveCookies(request_id, state, request, headers,
std::move(exec_callback));
MaybeSaveCookies(request_id, state, headers, std::move(exec_callback));
}
void MaybeSaveCookies(int32_t request_id,
RequestState* state,
network::ResourceRequest* request,
net::HttpResponseHeaders* headers,
base::OnceClosure callback) {
CEF_REQUIRE_IOT();
@@ -978,7 +972,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
return;
}
if (!cookie_helper::IsCookieableScheme(request->url,
if (!cookie_helper::IsCookieableScheme(state->request_->url,
init_state_->cookieable_schemes_)) {
// The scheme does not support cookies.
std::move(callback).Run();
@@ -997,9 +991,9 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
auto done_cookie_callback = base::BindOnce(
&InterceptedRequestHandlerWrapper::ContinueWithSavedCookies,
weak_ptr_factory_.GetWeakPtr(), request_id, std::move(callback));
cookie_helper::SaveCookies(init_state_->browser_context_getter_, *request,
headers, allow_cookie_callback,
std::move(done_cookie_callback));
cookie_helper::SaveCookies(
init_state_->browser_context_getter_, *(state->request_), headers,
allow_cookie_callback, std::move(done_cookie_callback));
}
void AllowCookieSave(int32_t request_id,
@@ -1275,6 +1269,12 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
for (auto& pair : request_map) {
auto state = std::move(pair.second);
if (state->cancel_callback_) {
// The cancel callback may trigger a call to OnRequestComplete followed
// by destruction of the InterceptedRequest that owns the
// ResourceRequest. We therefore need to clear the
// raw_ptr<ResourceRequest> first to avoid dangling pointer errors.
state->request_ = nullptr;
std::move(state->cancel_callback_).Run(net::ERR_ABORTED);
}
}

View File

@@ -213,7 +213,8 @@ class InputStreamReader : public base::RefCountedThreadSafe<InputStreamReader> {
InputStream::SkipCallback skip_callback);
static void RunReadCallbackOnJobThread(
int bytes_read,
InputStream::ReadCallback read_callback);
InputStream::ReadCallback read_callback,
scoped_refptr<net::IOBuffer> buffer);
std::unique_ptr<InputStream> stream_;
@@ -442,8 +443,9 @@ void InputStreamReader::RunReadCallback(int bytes_read) {
DCHECK(!pending_read_callback_.is_null());
job_thread_task_runner_->PostTask(
FROM_HERE, base::BindOnce(InputStreamReader::RunReadCallbackOnJobThread,
bytes_read, std::move(pending_read_callback_)));
FROM_HERE,
base::BindOnce(InputStreamReader::RunReadCallbackOnJobThread, bytes_read,
std::move(pending_read_callback_), buffer_));
// Reset callback state.
pending_callback_id_ = -1;
@@ -460,7 +462,8 @@ void InputStreamReader::RunSkipCallbackOnJobThread(
// static
void InputStreamReader::RunReadCallbackOnJobThread(
int bytes_read,
InputStream::ReadCallback read_callback) {
InputStream::ReadCallback read_callback,
scoped_refptr<net::IOBuffer> buffer) {
std::move(read_callback).Run(bytes_read);
}

View File

@@ -31,8 +31,8 @@ CefBrowserPlatformDelegateOsr::CefBrowserPlatformDelegateOsr(
}
void CefBrowserPlatformDelegateOsr::CreateViewForWebContents(
content::WebContentsView** view,
content::RenderViewHostDelegateView** delegate_view) {
raw_ptr<content::WebContentsView>* view,
raw_ptr<content::RenderViewHostDelegateView>* delegate_view) {
DCHECK(!view_osr_);
// Use the OSR view instead of the default platform view.

View File

@@ -23,8 +23,8 @@ class CefBrowserPlatformDelegateOsr
public:
// CefBrowserPlatformDelegate methods:
void CreateViewForWebContents(
content::WebContentsView** view,
content::RenderViewHostDelegateView** delegate_view) override;
raw_ptr<content::WebContentsView>* view,
raw_ptr<content::RenderViewHostDelegateView>* delegate_view) override;
void WebContentsCreated(content::WebContents* web_contents,
bool owned) override;
void WebContentsDestroyed(content::WebContents* web_contents) override;

View File

@@ -376,12 +376,6 @@ void ChromeMainDelegateCef::PreSandboxStartup() {
// number in the app bundle path.
resource_util::OverrideUserDataDir(settings_, command_line);
ChromeMainDelegate::PreSandboxStartup();
// Initialize crash reporting state for this process/module.
// chrome::DIR_CRASH_DUMPS must be configured before calling this function.
crash_reporting::PreSandboxStartup(*command_line, process_type);
base::FilePath resources_dir;
if (command_line->HasSwitch(switches::kResourcesDirPath)) {
resources_dir =
@@ -402,6 +396,12 @@ void ChromeMainDelegateCef::PreSandboxStartup() {
}
}
ChromeMainDelegate::PreSandboxStartup();
// Initialize crash reporting state for this process/module.
// chrome::DIR_CRASH_DUMPS must be configured before calling this function.
crash_reporting::PreSandboxStartup(*command_line, process_type);
#if !BUILDFLAG(IS_WIN)
// Call after InitLogging() potentially changes values in
// chrome/app/chrome_main_delegate.cc.

View File

@@ -258,7 +258,7 @@ class CefPostDataElementImpl : public CefPostDataElement {
Type type_ = PDE_TYPE_EMPTY;
union {
struct {
void* bytes;
RAW_PTR_EXCLUSION void* bytes;
size_t size;
} bytes;
cef_string_t filename;

View File

@@ -282,6 +282,7 @@ void RegisterURLSchemeAsSupportingFetchAPI(const blink::WebString& scheme) {
}
struct CefScriptForbiddenScope::Impl {
STACK_ALLOCATED_IGNORE()
blink::ScriptForbiddenScope scope_;
};

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=bc230d77e2985959bc5a6a2af80b500eec070384$
// $hash=4a4490df4b9440aeb853d6625fddb7de5741f5b0$
//
#include "include/capi/cef_app_capi.h"
@@ -131,12 +131,12 @@ CEF_EXPORT int cef_get_exit_code() {
CEF_EXPORT void cef_shutdown() {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
CefShutdown();
#if DCHECK_IS_ON()
shutdown_checker::SetIsShutdown();
#endif
// Execute
CefShutdown();
}
CEF_EXPORT void cef_do_message_loop_work() {

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=16d4e51ecbe1fd8eb6915d951a84f707f73dfb1a$
// $hash=e9099c29c9695cabcedfde25b85c1f77f14cb516$
//
#include "include/capi/cef_app_capi.h"
@@ -119,12 +119,12 @@ NO_SANITIZE("cfi-icall") CEF_GLOBAL int CefGetExitCode() {
NO_SANITIZE("cfi-icall") CEF_GLOBAL void CefShutdown() {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_shutdown();
#if DCHECK_IS_ON()
shutdown_checker::SetIsShutdown();
#endif
// Execute
cef_shutdown();
}
NO_SANITIZE("cfi-icall") CEF_GLOBAL void CefDoMessageLoopWork() {

View File

@@ -236,6 +236,10 @@ patches = [
#
# Linux: Fix duplicate symbol error for window_frame_util.cc
# https://issuetracker.google.com/issues/343037853#comment3
#
# Avoid duplicate window from DevTools when CEF handles the open via
# OnOpenURLFromTab.
# https://github.com/chromiumembedded/cef/issues/3735
'name': 'chrome_browser_browser',
},
{
@@ -285,6 +289,10 @@ patches = [
# alloy: Support override of DownloadPrefs::FromBrowserContext
# chrome: Support custom DownloadManagerDelegate handling.
# https://github.com/chromiumembedded/cef/issues/3681
#
# chrome: Allow routing of Download bubble file open to non-Tabbed
# source browser.
# https://github.com/chromiumembedded/cef/issues/3750
'name': 'chrome_browser_download',
},
{
@@ -818,8 +826,14 @@ patches = [
'name': 'base_thread_pool_5548577'
},
{
# Linux: Fix ARM build broken by build_tflite_with_xnnpack change.
# https://issues.chromium.org/issues/348117454
'name': 'linux_tflite_348117454'
# Fix DCHECK in SimpleMenuModel::AddSeparator when adding a separator with
# hidden menu items.
# https://github.com/chromiumembedded/cef/issues/3577
'name': 'ui_menu_model_3577'
},
{
# linux: Fix cannot allocate memory in static TLS block in dlopen libcef.so
# https://github.com/chromiumembedded/cef/issues/3616
'name': 'third_party_sentencepiece_3616'
}
]

View File

@@ -1,5 +1,5 @@
diff --git base/task/thread_pool/thread_pool_impl.cc base/task/thread_pool/thread_pool_impl.cc
index 4ac5cea5f6c08..559593f1564c9 100644
index 4ac5cea5f6c08..a9c1c152568f3 100644
--- base/task/thread_pool/thread_pool_impl.cc
+++ base/task/thread_pool/thread_pool_impl.cc
@@ -105,6 +105,10 @@ ThreadPoolImpl::ThreadPoolImpl(std::string_view histogram_label,

View File

@@ -20,7 +20,7 @@ index 26fbdc7e7db0c..ac02e60276e5c 100644
// Make an exception to allow most visited tiles to commit in
diff --git content/browser/renderer_host/navigation_request.cc content/browser/renderer_host/navigation_request.cc
index 87db8bec18603..22c7d3fb838ab 100644
index eaed2976e16ac..f4a67c2447e69 100644
--- content/browser/renderer_host/navigation_request.cc
+++ content/browser/renderer_host/navigation_request.cc
@@ -8057,10 +8057,22 @@ NavigationRequest::GetOriginForURLLoaderFactoryBeforeResponseWithDebugInfo(

View File

@@ -1,5 +1,5 @@
diff --git chrome/browser/BUILD.gn chrome/browser/BUILD.gn
index 8e3fde5e841e1..8adc42aea0836 100644
index db90e13763831..4448eac5885b8 100644
--- chrome/browser/BUILD.gn
+++ chrome/browser/BUILD.gn
@@ -11,6 +11,7 @@ import("//build/config/compiler/pgo/pgo.gni")
@@ -10,7 +10,7 @@ index 8e3fde5e841e1..8adc42aea0836 100644
import("//chrome/browser/buildflags.gni")
import("//chrome/browser/downgrade/buildflags.gni")
import("//chrome/common/features.gni")
@@ -2049,6 +2050,7 @@ static_library("browser") {
@@ -2055,6 +2056,7 @@ static_library("browser") {
"//build/config/chromebox_for_meetings:buildflags",
"//build/config/compiler:compiler_buildflags",
"//cc",
@@ -18,7 +18,7 @@ index 8e3fde5e841e1..8adc42aea0836 100644
"//chrome:extra_resources",
"//chrome:resources",
"//chrome:strings",
@@ -2769,6 +2771,10 @@ static_library("browser") {
@@ -2778,6 +2780,10 @@ static_library("browser") {
]
}

View File

@@ -13,7 +13,7 @@ index 2480282a19d12..dbd1fbf8a15b5 100644
return false;
}
diff --git chrome/browser/devtools/devtools_window.cc chrome/browser/devtools/devtools_window.cc
index 02ff1e580d3a7..7f51115896049 100644
index 02ff1e580d3a7..e2e232c424029 100644
--- chrome/browser/devtools/devtools_window.cc
+++ chrome/browser/devtools/devtools_window.cc
@@ -37,6 +37,7 @@
@@ -38,7 +38,21 @@ index 02ff1e580d3a7..7f51115896049 100644
}
// Create WebContents with devtools.
@@ -1919,12 +1927,28 @@ void DevToolsWindow::CreateDevToolsBrowser() {
@@ -1754,9 +1762,13 @@ void DevToolsWindow::OpenInNewTab(const GURL& url) {
if (!inspected_web_contents ||
!inspected_web_contents->OpenURL(params,
/*navigation_handle_callback=*/{})) {
+#if !BUILDFLAG(ENABLE_CEF)
+ // Remove default behavior when CEF handles the open via OnOpenURLFromTab.
+ // See CEF issue #3735.
chrome::ScopedTabbedBrowserDisplayer displayer(profile_);
chrome::AddSelectedTabWithURL(displayer.browser(), fixed_url,
ui::PAGE_TRANSITION_LINK);
+#endif
}
}
@@ -1919,12 +1931,28 @@ void DevToolsWindow::CreateDevToolsBrowser() {
Browser::CreationStatus::kOk) {
return;
}
@@ -74,7 +88,7 @@ index 02ff1e580d3a7..7f51115896049 100644
}
diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn
index 74460ac479210..8cf70c80a87ad 100644
index 49e6bdcbd55a6..0425eb49c4296 100644
--- chrome/browser/ui/BUILD.gn
+++ chrome/browser/ui/BUILD.gn
@@ -8,6 +8,7 @@ import("//build/config/compiler/compiler.gni")
@@ -104,7 +118,7 @@ index 74460ac479210..8cf70c80a87ad 100644
"//chrome:resources",
"//chrome:strings",
"//chrome/app:chrome_dll_resources",
@@ -3040,6 +3046,8 @@ static_library("ui") {
@@ -3045,6 +3051,8 @@ static_library("ui") {
"views/apps/app_dialog/app_local_block_dialog_view.h",
"views/apps/app_dialog/app_pause_dialog_view.cc",
"views/apps/app_dialog/app_pause_dialog_view.h",
@@ -113,7 +127,7 @@ index 74460ac479210..8cf70c80a87ad 100644
"views/apps/app_info_dialog/arc_app_info_links_panel.cc",
"views/apps/app_info_dialog/arc_app_info_links_panel.h",
"views/apps/chrome_app_window_client_views_chromeos.cc",
@@ -4249,8 +4257,6 @@ static_library("ui") {
@@ -4254,8 +4262,6 @@ static_library("ui") {
"autofill/payments/webauthn_dialog_model.h",
"autofill/payments/webauthn_dialog_model_observer.h",
"autofill/payments/webauthn_dialog_state.h",
@@ -122,7 +136,7 @@ index 74460ac479210..8cf70c80a87ad 100644
"incognito_clear_browsing_data_dialog_interface.h",
"signin/signin_modal_dialog.cc",
"signin/signin_modal_dialog.h",
@@ -5125,8 +5131,6 @@ static_library("ui") {
@@ -5130,8 +5136,6 @@ static_library("ui") {
"views/accessibility/theme_tracking_non_accessible_image_view.h",
"views/apps/app_dialog/app_dialog_view.cc",
"views/apps/app_dialog/app_dialog_view.h",
@@ -131,7 +145,7 @@ index 74460ac479210..8cf70c80a87ad 100644
"views/apps/app_info_dialog/app_info_dialog_container.cc",
"views/apps/app_info_dialog/app_info_dialog_container.h",
"views/apps/app_info_dialog/app_info_dialog_views.cc",
@@ -6908,6 +6912,7 @@ static_library("ui") {
@@ -6913,6 +6917,7 @@ static_library("ui") {
if (enable_printing) {
deps += [
"//components/printing/browser",
@@ -140,10 +154,10 @@ index 74460ac479210..8cf70c80a87ad 100644
]
}
diff --git chrome/browser/ui/browser.cc chrome/browser/ui/browser.cc
index 557abfcd71d85..fb64e93157148 100644
index a7a3a0722bcbe..4a9ce76019fc3 100644
--- chrome/browser/ui/browser.cc
+++ chrome/browser/ui/browser.cc
@@ -272,6 +272,25 @@
@@ -271,6 +271,25 @@
#include "components/captive_portal/content/captive_portal_tab_helper.h"
#endif
@@ -169,7 +183,7 @@ index 557abfcd71d85..fb64e93157148 100644
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/extension_browser_window_helper.h"
#endif
@@ -537,6 +556,10 @@ Browser::Browser(const CreateParams& params)
@@ -536,6 +555,10 @@ Browser::Browser(const CreateParams& params)
type_(params.type),
profile_(params.profile),
window_(nullptr),
@@ -180,7 +194,7 @@ index 557abfcd71d85..fb64e93157148 100644
tab_strip_model_delegate_(
std::make_unique<chrome::BrowserTabStripModelDelegate>(this)),
tab_strip_model_(std::make_unique<TabStripModel>(
@@ -757,6 +780,12 @@ Browser::~Browser() {
@@ -768,6 +791,12 @@ Browser::~Browser() {
// away so they don't try and call back to us.
if (select_file_dialog_.get())
select_file_dialog_->ListenerDestroyed();
@@ -193,7 +207,7 @@ index 557abfcd71d85..fb64e93157148 100644
}
///////////////////////////////////////////////////////////////////////////////
@@ -1217,6 +1246,8 @@ void Browser::WindowFullscreenStateChanged() {
@@ -1241,6 +1270,8 @@ void Browser::WindowFullscreenStateChanged() {
->WindowFullscreenStateChanged();
command_controller_->FullscreenStateChanged();
UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TOGGLE_FULLSCREEN);
@@ -202,7 +216,7 @@ index 557abfcd71d85..fb64e93157148 100644
}
void Browser::FullscreenTopUIStateChanged() {
@@ -1584,6 +1615,14 @@ content::KeyboardEventProcessingResult Browser::PreHandleKeyboardEvent(
@@ -1614,6 +1645,14 @@ content::KeyboardEventProcessingResult Browser::PreHandleKeyboardEvent(
if (exclusive_access_manager_->HandleUserKeyEvent(event))
return content::KeyboardEventProcessingResult::HANDLED;
@@ -217,7 +231,7 @@ index 557abfcd71d85..fb64e93157148 100644
return window()->PreHandleKeyboardEvent(event);
}
@@ -1591,8 +1630,18 @@ bool Browser::HandleKeyboardEvent(content::WebContents* source,
@@ -1621,8 +1660,18 @@ bool Browser::HandleKeyboardEvent(content::WebContents* source,
const NativeWebKeyboardEvent& event) {
DevToolsWindow* devtools_window =
DevToolsWindow::GetInstanceForInspectedWebContents(source);
@@ -238,24 +252,22 @@ index 557abfcd71d85..fb64e93157148 100644
}
bool Browser::TabsNeedBeforeUnloadFired() const {
@@ -1768,6 +1817,16 @@ WebContents* Browser::OpenURLFromTab(
@@ -1798,6 +1847,14 @@ WebContents* Browser::OpenURLFromTab(
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
+#if BUILDFLAG(ENABLE_CEF)
+ if (cef_browser_delegate_) {
+ auto web_contents =
+ cef_browser_delegate_->OpenURLFromTabEx(source, params,
+ navigation_handle_callback);
+ if (!web_contents)
+ return nullptr;
+ if (cef_browser_delegate_ &&
+ !cef_browser_delegate_->OpenURLFromTabEx(source, params,
+ navigation_handle_callback)) {
+ return nullptr;
+ }
+#endif
+
NavigateParams nav_params(this, params.url, params.transition);
nav_params.FillNavigateParamsFromOpenURLParams(params);
nav_params.source_contents = source;
@@ -1930,6 +1989,8 @@ void Browser::LoadingStateChanged(WebContents* source,
@@ -1960,6 +2017,8 @@ void Browser::LoadingStateChanged(WebContents* source,
bool should_show_loading_ui) {
ScheduleUIUpdate(source, content::INVALIDATE_TYPE_LOAD);
UpdateWindowForLoadingStateChanged(source, should_show_loading_ui);
@@ -264,7 +276,7 @@ index 557abfcd71d85..fb64e93157148 100644
}
void Browser::CloseContents(WebContents* source) {
@@ -1958,6 +2019,8 @@ void Browser::SetContentsBounds(WebContents* source, const gfx::Rect& bounds) {
@@ -1988,6 +2047,8 @@ void Browser::SetContentsBounds(WebContents* source, const gfx::Rect& bounds) {
}
void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
@@ -273,7 +285,7 @@ index 557abfcd71d85..fb64e93157148 100644
if (!GetStatusBubble())
return;
@@ -1965,6 +2028,17 @@ void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
@@ -1995,6 +2056,17 @@ void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
GetStatusBubble()->SetURL(url);
}
@@ -291,7 +303,7 @@ index 557abfcd71d85..fb64e93157148 100644
void Browser::ContentsMouseEvent(WebContents* source, const ui::Event& event) {
const ui::EventType type = event.type();
const bool exited = type == ui::ET_MOUSE_EXITED;
@@ -1992,6 +2066,19 @@ bool Browser::TakeFocus(content::WebContents* source, bool reverse) {
@@ -2022,6 +2094,19 @@ bool Browser::TakeFocus(content::WebContents* source, bool reverse) {
return false;
}
@@ -311,7 +323,7 @@ index 557abfcd71d85..fb64e93157148 100644
void Browser::BeforeUnloadFired(WebContents* web_contents,
bool proceed,
bool* proceed_to_fire_unload) {
@@ -2091,12 +2178,24 @@ void Browser::WebContentsCreated(WebContents* source_contents,
@@ -2121,12 +2206,24 @@ void Browser::WebContentsCreated(WebContents* source_contents,
// Make the tab show up in the task manager.
task_manager::WebContentsTags::CreateForTabContents(new_contents);
@@ -336,7 +348,7 @@ index 557abfcd71d85..fb64e93157148 100644
// Don't show the page hung dialog when a HTML popup hangs because
// the dialog will take the focus and immediately close the popup.
RenderWidgetHostView* view = render_widget_host->GetView();
@@ -2109,6 +2208,13 @@ void Browser::RendererUnresponsive(
@@ -2139,6 +2236,13 @@ void Browser::RendererUnresponsive(
void Browser::RendererResponsive(
WebContents* source,
content::RenderWidgetHost* render_widget_host) {
@@ -350,7 +362,7 @@ index 557abfcd71d85..fb64e93157148 100644
RenderWidgetHostView* view = render_widget_host->GetView();
if (view && !render_widget_host->GetView()->IsHTMLFormPopup()) {
TabDialogs::FromWebContents(source)->HideHungRendererDialog(
@@ -2118,6 +2224,15 @@ void Browser::RendererResponsive(
@@ -2148,6 +2252,15 @@ void Browser::RendererResponsive(
content::JavaScriptDialogManager* Browser::GetJavaScriptDialogManager(
WebContents* source) {
@@ -366,7 +378,7 @@ index 557abfcd71d85..fb64e93157148 100644
return javascript_dialogs::TabModalDialogManager::FromWebContents(source);
}
@@ -2153,6 +2268,11 @@ void Browser::DraggableRegionsChanged(
@@ -2183,6 +2296,11 @@ void Browser::DraggableRegionsChanged(
if (app_controller_) {
app_controller_->DraggableRegionsChanged(regions, contents);
}
@@ -378,7 +390,7 @@ index 557abfcd71d85..fb64e93157148 100644
}
void Browser::DidFinishNavigation(
@@ -2233,11 +2353,15 @@ void Browser::EnterFullscreenModeForTab(
@@ -2263,11 +2381,15 @@ void Browser::EnterFullscreenModeForTab(
const blink::mojom::FullscreenOptions& options) {
exclusive_access_manager_->fullscreen_controller()->EnterFullscreenModeForTab(
requesting_frame, options.display_id);
@@ -394,7 +406,7 @@ index 557abfcd71d85..fb64e93157148 100644
}
bool Browser::IsFullscreenForTabOrPending(const WebContents* web_contents) {
@@ -2437,6 +2561,15 @@ void Browser::RequestMediaAccessPermission(
@@ -2467,6 +2589,15 @@ void Browser::RequestMediaAccessPermission(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
content::MediaResponseCallback callback) {
@@ -410,7 +422,7 @@ index 557abfcd71d85..fb64e93157148 100644
const extensions::Extension* extension =
GetExtensionForOrigin(profile_, request.security_origin);
MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest(
@@ -2981,9 +3114,11 @@ void Browser::RemoveScheduledUpdatesFor(WebContents* contents) {
@@ -3011,9 +3142,11 @@ void Browser::RemoveScheduledUpdatesFor(WebContents* contents) {
// Browser, Getters for UI (private):
StatusBubble* Browser::GetStatusBubble() {
@@ -423,7 +435,7 @@ index 557abfcd71d85..fb64e93157148 100644
}
// We hide the status bar for web apps windows as this matches native
@@ -2991,6 +3126,12 @@ StatusBubble* Browser::GetStatusBubble() {
@@ -3021,6 +3154,12 @@ StatusBubble* Browser::GetStatusBubble() {
// mode, as the minimal browser UI includes the status bar.
if (web_app::AppBrowserController::IsWebApp(this) &&
!app_controller()->HasMinimalUiButtons()) {
@@ -436,7 +448,7 @@ index 557abfcd71d85..fb64e93157148 100644
return nullptr;
}
@@ -3140,6 +3281,8 @@ void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) {
@@ -3170,6 +3309,8 @@ void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) {
BookmarkTabHelper::FromWebContents(web_contents)->RemoveObserver(this);
web_contents_collection_.StopObserving(web_contents);
}
@@ -445,7 +457,7 @@ index 557abfcd71d85..fb64e93157148 100644
}
void Browser::TabDetachedAtImpl(content::WebContents* contents,
@@ -3294,6 +3437,14 @@ bool Browser::PictureInPictureBrowserSupportsWindowFeature(
@@ -3324,6 +3465,14 @@ bool Browser::PictureInPictureBrowserSupportsWindowFeature(
bool Browser::SupportsWindowFeatureImpl(WindowFeature feature,
bool check_can_support) const {
@@ -461,10 +473,10 @@ index 557abfcd71d85..fb64e93157148 100644
case TYPE_NORMAL:
return NormalBrowserSupportsWindowFeature(feature, check_can_support);
diff --git chrome/browser/ui/browser.h chrome/browser/ui/browser.h
index 69f2c9c0ff003..3cae24a0e42d2 100644
index 289eb221d6fbb..13aa346aaa37c 100644
--- chrome/browser/ui/browser.h
+++ chrome/browser/ui/browser.h
@@ -22,6 +22,7 @@
@@ -24,6 +24,7 @@
#include "base/timer/elapsed_timer.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
@@ -472,7 +484,7 @@ index 69f2c9c0ff003..3cae24a0e42d2 100644
#include "chrome/browser/tab_contents/web_contents_collection.h"
#include "chrome/browser/themes/theme_service_observer.h"
#include "chrome/browser/ui/bookmarks/bookmark_bar.h"
@@ -51,6 +52,10 @@
@@ -53,6 +54,10 @@
#include "ui/gfx/geometry/rect.h"
#include "ui/shell_dialogs/select_file_dialog.h"
@@ -483,7 +495,7 @@ index 69f2c9c0ff003..3cae24a0e42d2 100644
#if BUILDFLAG(IS_ANDROID)
#error This file should only be included on desktop.
#endif
@@ -370,6 +375,15 @@ class Browser : public TabStripModelObserver,
@@ -377,6 +382,15 @@ class Browser : public TabStripModelObserver,
// Document Picture in Picture options, specific to TYPE_PICTURE_IN_PICTURE.
std::optional<blink::mojom::PictureInPictureWindowOptions> pip_options;
@@ -499,7 +511,7 @@ index 69f2c9c0ff003..3cae24a0e42d2 100644
private:
friend class Browser;
friend class WindowSizerChromeOSTest;
@@ -451,6 +465,13 @@ class Browser : public TabStripModelObserver,
@@ -458,6 +472,13 @@ class Browser : public TabStripModelObserver,
update_ui_immediately_for_testing_ = true;
}
@@ -513,7 +525,7 @@ index 69f2c9c0ff003..3cae24a0e42d2 100644
// Accessors ////////////////////////////////////////////////////////////////
const CreateParams& create_params() const { return create_params_; }
@@ -546,6 +567,12 @@ class Browser : public TabStripModelObserver,
@@ -553,6 +574,12 @@ class Browser : public TabStripModelObserver,
base::WeakPtr<Browser> AsWeakPtr();
base::WeakPtr<const Browser> AsWeakPtr() const;
@@ -526,7 +538,7 @@ index 69f2c9c0ff003..3cae24a0e42d2 100644
// Get the FindBarController for this browser, creating it if it does not
// yet exist.
FindBarController* GetFindBarController();
@@ -959,10 +986,18 @@ class Browser : public TabStripModelObserver,
@@ -970,10 +997,18 @@ class Browser : public TabStripModelObserver,
void SetContentsBounds(content::WebContents* source,
const gfx::Rect& bounds) override;
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
@@ -545,7 +557,7 @@ index 69f2c9c0ff003..3cae24a0e42d2 100644
void BeforeUnloadFired(content::WebContents* source,
bool proceed,
bool* proceed_to_fire_unload) override;
@@ -1297,6 +1332,10 @@ class Browser : public TabStripModelObserver,
@@ -1308,6 +1343,10 @@ class Browser : public TabStripModelObserver,
// This Browser's window.
raw_ptr<BrowserWindow, DanglingUntriaged> window_;
@@ -556,7 +568,7 @@ index 69f2c9c0ff003..3cae24a0e42d2 100644
std::unique_ptr<TabStripModelDelegate> const tab_strip_model_delegate_;
std::unique_ptr<TabStripModel> const tab_strip_model_;
@@ -1363,6 +1402,8 @@ class Browser : public TabStripModelObserver,
@@ -1374,6 +1413,8 @@ class Browser : public TabStripModelObserver,
const std::string initial_workspace_;
bool initial_visible_on_all_workspaces_state_;
@@ -566,7 +578,7 @@ index 69f2c9c0ff003..3cae24a0e42d2 100644
UnloadController unload_controller_;
diff --git chrome/browser/ui/browser_navigator.cc chrome/browser/ui/browser_navigator.cc
index ec2ca0cefeb4a..66b480f50f72d 100644
index de008a12ca355..abfe1d6dda667 100644
--- chrome/browser/ui/browser_navigator.cc
+++ chrome/browser/ui/browser_navigator.cc
@@ -313,6 +313,10 @@ std::pair<Browser*, int> GetBrowserAndTabForDisposition(

View File

@@ -1,5 +1,5 @@
diff --git chrome/browser/renderer_context_menu/render_view_context_menu.cc chrome/browser/renderer_context_menu/render_view_context_menu.cc
index b3908e6711f3e..58db1ed6e1e8a 100644
index 2c61092b98efd..05934c29c32da 100644
--- chrome/browser/renderer_context_menu/render_view_context_menu.cc
+++ chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -356,6 +356,18 @@ base::OnceCallback<void(RenderViewContextMenu*)>* GetMenuShownCallback() {
@@ -32,7 +32,7 @@ index b3908e6711f3e..58db1ed6e1e8a 100644
id = CollapseCommandsForUMA(id);
const auto& map = GetIdcToUmaMap(type);
auto it = map.find(id);
@@ -882,6 +898,14 @@ RenderViewContextMenu::RenderViewContextMenu(
@@ -884,6 +900,14 @@ RenderViewContextMenu::RenderViewContextMenu(
: nullptr;
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
@@ -47,7 +47,7 @@ index b3908e6711f3e..58db1ed6e1e8a 100644
observers_.AddObserver(&autofill_context_menu_manager_);
}
@@ -1350,6 +1374,12 @@ void RenderViewContextMenu::InitMenu() {
@@ -1352,6 +1376,12 @@ void RenderViewContextMenu::InitMenu() {
autofill_client->HideAutofillSuggestions(
autofill::SuggestionHidingReason::kContextMenuOpened);
}
@@ -60,7 +60,7 @@ index b3908e6711f3e..58db1ed6e1e8a 100644
}
Profile* RenderViewContextMenu::GetProfile() const {
@@ -3596,6 +3626,26 @@ void RenderViewContextMenu::RegisterExecutePluginActionCallbackForTesting(
@@ -3635,6 +3665,26 @@ void RenderViewContextMenu::RegisterExecutePluginActionCallbackForTesting(
execute_plugin_action_callback_ = std::move(cb);
}
@@ -88,10 +88,10 @@ index b3908e6711f3e..58db1ed6e1e8a 100644
RenderViewContextMenu::GetHandlersForLinkUrl() {
custom_handlers::ProtocolHandlerRegistry::ProtocolHandlerList handlers =
diff --git chrome/browser/renderer_context_menu/render_view_context_menu.h chrome/browser/renderer_context_menu/render_view_context_menu.h
index 8f0e62fe84ff2..77bf0875db2b2 100644
index db2108a4fa3ca..3520d8364e2a1 100644
--- chrome/browser/renderer_context_menu/render_view_context_menu.h
+++ chrome/browser/renderer_context_menu/render_view_context_menu.h
@@ -153,7 +153,21 @@ class RenderViewContextMenu
@@ -154,7 +154,21 @@ class RenderViewContextMenu
}
#endif
@@ -113,7 +113,7 @@ index 8f0e62fe84ff2..77bf0875db2b2 100644
Profile* GetProfile() const;
// This may return nullptr (e.g. for WebUI dialogs). Virtual to allow tests to
@@ -475,6 +489,9 @@ class RenderViewContextMenu
@@ -477,6 +491,9 @@ class RenderViewContextMenu
// built.
bool is_protocol_submenu_valid_ = false;

View File

@@ -12,7 +12,7 @@ index b169371e4d42f..509e4bda85b47 100644
// on the screen, we can't actually attach to it.
parent_window = nullptr;
diff --git components/constrained_window/constrained_window_views.cc components/constrained_window/constrained_window_views.cc
index 0ffc333329d4d..91b7567c123ac 100644
index bff9ae7b67f41..fac9ee139d181 100644
--- components/constrained_window/constrained_window_views.cc
+++ components/constrained_window/constrained_window_views.cc
@@ -101,10 +101,17 @@ class WidgetModalDialogHostObserverViews : public views::WidgetObserver,
@@ -121,7 +121,7 @@ index 0ffc333329d4d..91b7567c123ac 100644
return;
}
@@ -284,8 +279,13 @@ views::Widget* CreateBrowserModalDialogViews(views::DialogDelegate* dialog,
@@ -292,8 +287,13 @@ views::Widget* CreateBrowserModalDialogViews(views::DialogDelegate* dialog,
gfx::NativeView parent_view =
parent ? CurrentClient()->GetDialogHostView(parent) : nullptr;
@@ -136,7 +136,7 @@ index 0ffc333329d4d..91b7567c123ac 100644
widget->SetNativeWindowProperty(
views::kWidgetIdentifierKey,
const_cast<void*>(kConstrainedWindowWidgetIdentifier));
@@ -301,8 +301,7 @@ views::Widget* CreateBrowserModalDialogViews(views::DialogDelegate* dialog,
@@ -309,8 +309,7 @@ views::Widget* CreateBrowserModalDialogViews(views::DialogDelegate* dialog,
if (!requires_positioning)
return widget;
@@ -146,7 +146,7 @@ index 0ffc333329d4d..91b7567c123ac 100644
if (host) {
DCHECK_EQ(parent_view, host->GetHostView());
ModalDialogHostObserver* dialog_host_observer =
@@ -315,10 +314,17 @@ views::Widget* CreateBrowserModalDialogViews(views::DialogDelegate* dialog,
@@ -325,10 +324,17 @@ views::Widget* CreateBrowserModalDialogViews(views::DialogDelegate* dialog,
views::Widget* ShowBrowserModal(std::unique_ptr<ui::DialogModel> dialog_model,
gfx::NativeWindow parent) {

View File

@@ -1,8 +1,16 @@
diff --git chrome/browser/download/chrome_download_manager_delegate.cc chrome/browser/download/chrome_download_manager_delegate.cc
index 2628f1751cd14..cc2c330d8db5d 100644
index bd2c41e30f01e..e57592e75dec7 100644
--- chrome/browser/download/chrome_download_manager_delegate.cc
+++ chrome/browser/download/chrome_download_manager_delegate.cc
@@ -148,6 +148,10 @@
@@ -30,6 +30,7 @@
#include "base/time/time.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
+#include "cef/libcef/features/features.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/download/bubble/download_bubble_prefs.h"
#include "chrome/browser/download/download_core_service.h"
@@ -150,6 +151,10 @@
#include "chrome/browser/safe_browsing/download_protection/download_protection_util.h"
#endif
@@ -13,7 +21,7 @@ index 2628f1751cd14..cc2c330d8db5d 100644
using content::BrowserThread;
using content::DownloadManager;
using download::DownloadItem;
@@ -492,6 +496,11 @@ ChromeDownloadManagerDelegate::ChromeDownloadManagerDelegate(Profile* profile)
@@ -500,6 +505,11 @@ ChromeDownloadManagerDelegate::ChromeDownloadManagerDelegate(Profile* profile)
download_dialog_bridge_ = std::make_unique<DownloadDialogBridge>();
download_message_bridge_ = std::make_unique<DownloadMessageBridge>();
#endif
@@ -25,7 +33,7 @@ index 2628f1751cd14..cc2c330d8db5d 100644
}
ChromeDownloadManagerDelegate::~ChromeDownloadManagerDelegate() {
@@ -551,6 +560,9 @@ void ChromeDownloadManagerDelegate::Shutdown() {
@@ -559,6 +569,9 @@ void ChromeDownloadManagerDelegate::Shutdown() {
download_manager_->RemoveObserver(this);
download_manager_ = nullptr;
}
@@ -35,7 +43,7 @@ index 2628f1751cd14..cc2c330d8db5d 100644
}
void ChromeDownloadManagerDelegate::OnDownloadCanceledAtShutdown(
@@ -619,6 +631,12 @@ bool ChromeDownloadManagerDelegate::DetermineDownloadTarget(
@@ -627,6 +640,12 @@ bool ChromeDownloadManagerDelegate::DetermineDownloadTarget(
ReportPDFLoadStatus(PDFLoadStatus::kTriggeredNoGestureDriveByDownload);
}
@@ -48,6 +56,20 @@ index 2628f1751cd14..cc2c330d8db5d 100644
DownloadTargetDeterminer::CompletionCallback target_determined_callback =
base::BindOnce(&ChromeDownloadManagerDelegate::OnDownloadTargetDetermined,
weak_ptr_factory_.GetWeakPtr(), download->GetId(),
@@ -1015,8 +1034,11 @@ void ChromeDownloadManagerDelegate::OpenDownload(DownloadItem* download) {
Browser* browser =
web_contents ? chrome::FindBrowserWithTab(web_contents) : nullptr;
std::unique_ptr<chrome::ScopedTabbedBrowserDisplayer> browser_displayer;
- if (!browser ||
- !browser->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP)) {
+ if (!browser
+#if !BUILDFLAG(ENABLE_CEF)
+ || !browser->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP)
+#endif
+ ) {
browser_displayer =
std::make_unique<chrome::ScopedTabbedBrowserDisplayer>(profile_);
browser = browser_displayer->browser();
diff --git chrome/browser/download/chrome_download_manager_delegate.h chrome/browser/download/chrome_download_manager_delegate.h
index af7f1d5fac12b..1cb1d01464c11 100644
--- chrome/browser/download/chrome_download_manager_delegate.h

View File

@@ -33,10 +33,10 @@ index decd0b51ddc3d..17fce2da6ad0e 100644
~BrowserFrameMac() override;
diff --git chrome/browser/ui/views/frame/browser_frame_mac.mm chrome/browser/ui/views/frame/browser_frame_mac.mm
index 0d7f72e291a14..b0fb3eae5eab6 100644
index 7b52e844d31d1..38862163b6698 100644
--- chrome/browser/ui/views/frame/browser_frame_mac.mm
+++ chrome/browser/ui/views/frame/browser_frame_mac.mm
@@ -182,7 +182,14 @@ void BrowserFrameMac::OnWindowFullscreenTransitionComplete() {
@@ -184,7 +184,14 @@ void BrowserFrameMac::OnWindowFullscreenTransitionComplete() {
void BrowserFrameMac::ValidateUserInterfaceItem(
int32_t tag,
remote_cocoa::mojom::ValidateUserInterfaceItemResult* result) {
@@ -52,7 +52,7 @@ index 0d7f72e291a14..b0fb3eae5eab6 100644
if (!chrome::SupportsCommand(browser, tag)) {
result->enable = false;
return;
@@ -294,8 +301,16 @@ bool BrowserFrameMac::WillExecuteCommand(
@@ -305,8 +312,16 @@ bool BrowserFrameMac::WillExecuteCommand(
int32_t command,
WindowOpenDisposition window_open_disposition,
bool is_before_first_responder) {
@@ -70,7 +70,7 @@ index 0d7f72e291a14..b0fb3eae5eab6 100644
if (is_before_first_responder) {
// The specification for this private extensions API is incredibly vague.
// For now, we avoid triggering chrome commands prior to giving the
@@ -326,11 +341,20 @@ bool BrowserFrameMac::ExecuteCommand(
@@ -337,11 +352,20 @@ bool BrowserFrameMac::ExecuteCommand(
int32_t command,
WindowOpenDisposition window_open_disposition,
bool is_before_first_responder) {

View File

@@ -85,10 +85,10 @@ index 02454f4e780b5..4641f33c26f5f 100644
// Returns whether the user has signed in this profile to an account.
diff --git chrome/browser/profiles/profile_impl.cc chrome/browser/profiles/profile_impl.cc
index 0909a332a46bf..163de8ef6a878 100644
index a7d35836cb9da..a73eca3fc66d0 100644
--- chrome/browser/profiles/profile_impl.cc
+++ chrome/browser/profiles/profile_impl.cc
@@ -1030,7 +1030,9 @@ Profile* ProfileImpl::GetOffTheRecordProfile(const OTRProfileID& otr_profile_id,
@@ -1036,7 +1036,9 @@ Profile* ProfileImpl::GetOffTheRecordProfile(const OTRProfileID& otr_profile_id,
otr_profiles_[otr_profile_id] = std::move(otr_profile);

View File

@@ -64,7 +64,7 @@ index 00dd9a34cd3fb..89d4588bdbe4e 100644
const extensions::Extension* extension =
registry->enabled_extensions().GetByID(extension_id);
diff --git chrome/renderer/chrome_content_renderer_client.cc chrome/renderer/chrome_content_renderer_client.cc
index 120ec8af72623..012f7b602cf40 100644
index a88d69d5d4369..fb64754b50156 100644
--- chrome/renderer/chrome_content_renderer_client.cc
+++ chrome/renderer/chrome_content_renderer_client.cc
@@ -996,6 +996,7 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(

View File

@@ -1,5 +1,5 @@
diff --git chrome/renderer/BUILD.gn chrome/renderer/BUILD.gn
index 3108e12b92e7f..18cc9062a4cd0 100644
index 2e8cad63df85b..a4065dd237107 100644
--- chrome/renderer/BUILD.gn
+++ chrome/renderer/BUILD.gn
@@ -5,6 +5,7 @@
@@ -18,7 +18,7 @@ index 3108e12b92e7f..18cc9062a4cd0 100644
"//chrome:resources",
"//chrome:strings",
"//chrome/common",
@@ -246,6 +248,10 @@ static_library("renderer") {
@@ -247,6 +249,10 @@ static_library("renderer") {
configs += [ "//build/config/compiler:wexit_time_destructors" ]

View File

@@ -422,7 +422,7 @@ index 6b27cf7037fce..70fd49bb873ff 100644
+#endif
}
diff --git chrome/browser/chrome_content_browser_client.cc chrome/browser/chrome_content_browser_client.cc
index d81a2b75f4c6c..4c29ef42b4576 100644
index 7c3178793b3fb..98a4e74106b97 100644
--- chrome/browser/chrome_content_browser_client.cc
+++ chrome/browser/chrome_content_browser_client.cc
@@ -46,6 +46,7 @@
@@ -433,7 +433,7 @@ index d81a2b75f4c6c..4c29ef42b4576 100644
#include "chrome/browser/after_startup_task_utils.h"
#include "chrome/browser/ai/ai_manager_impl.h"
#include "chrome/browser/app_mode/app_mode_utils.h"
@@ -1486,6 +1487,8 @@ ChromeContentBrowserClient::GetPopupNavigationDelegateFactoryForTesting() {
@@ -1489,6 +1490,8 @@ ChromeContentBrowserClient::GetPopupNavigationDelegateFactoryForTesting() {
}
ChromeContentBrowserClient::ChromeContentBrowserClient() {
@@ -442,7 +442,7 @@ index d81a2b75f4c6c..4c29ef42b4576 100644
#if BUILDFLAG(ENABLE_PLUGINS)
extra_parts_.push_back(
std::make_unique<ChromeContentBrowserClientPluginsPart>());
@@ -1523,6 +1526,11 @@ ChromeContentBrowserClient::~ChromeContentBrowserClient() {
@@ -1526,6 +1529,11 @@ ChromeContentBrowserClient::~ChromeContentBrowserClient() {
}
}
@@ -454,7 +454,7 @@ index d81a2b75f4c6c..4c29ef42b4576 100644
// static
void ChromeContentBrowserClient::RegisterLocalStatePrefs(
PrefRegistrySimple* registry) {
@@ -3744,28 +3752,25 @@ bool UpdatePreferredColorScheme(WebPreferences* web_prefs,
@@ -3756,28 +3764,25 @@ bool UpdatePreferredColorScheme(WebPreferences* web_prefs,
web_prefs->preferred_color_scheme;
}
#else
@@ -500,7 +500,7 @@ index d81a2b75f4c6c..4c29ef42b4576 100644
#endif // BUILDFLAG(IS_ANDROID)
// Reauth WebUI doesn't support dark mode yet because it shares the dialog
@@ -4506,9 +4511,11 @@ void ChromeContentBrowserClient::BrowserURLHandlerCreated(
@@ -4518,9 +4523,11 @@ void ChromeContentBrowserClient::BrowserURLHandlerCreated(
&search::HandleNewTabURLReverseRewrite);
#endif // BUILDFLAG(IS_ANDROID)
@@ -512,7 +512,7 @@ index d81a2b75f4c6c..4c29ef42b4576 100644
}
base::FilePath ChromeContentBrowserClient::GetDefaultDownloadDirectory() {
@@ -6627,7 +6634,7 @@ void ChromeContentBrowserClient::OnNetworkServiceCreated(
@@ -6647,7 +6654,7 @@ void ChromeContentBrowserClient::OnNetworkServiceCreated(
#endif
}
@@ -521,7 +521,7 @@ index d81a2b75f4c6c..4c29ef42b4576 100644
content::BrowserContext* context,
bool in_memory,
const base::FilePath& relative_partition_path,
@@ -6645,6 +6652,8 @@ void ChromeContentBrowserClient::ConfigureNetworkContextParams(
@@ -6665,6 +6672,8 @@ void ChromeContentBrowserClient::ConfigureNetworkContextParams(
network_context_params->user_agent = GetUserAgentBasedOnPolicy(context);
network_context_params->accept_language = GetApplicationLocale();
}
@@ -530,7 +530,7 @@ index d81a2b75f4c6c..4c29ef42b4576 100644
}
std::vector<base::FilePath>
@@ -7767,10 +7776,10 @@ void ChromeContentBrowserClient::OnKeepaliveRequestStarted(
@@ -7787,10 +7796,10 @@ void ChromeContentBrowserClient::OnKeepaliveRequestStarted(
const auto now = base::TimeTicks::Now();
const auto timeout = GetKeepaliveTimerTimeout(context);
keepalive_deadline_ = std::max(keepalive_deadline_, now + timeout);
@@ -543,7 +543,7 @@ index d81a2b75f4c6c..4c29ef42b4576 100644
FROM_HERE, keepalive_deadline_ - now,
base::BindOnce(
&ChromeContentBrowserClient::OnKeepaliveTimerFired,
@@ -7789,7 +7798,8 @@ void ChromeContentBrowserClient::OnKeepaliveRequestFinished() {
@@ -7809,7 +7818,8 @@ void ChromeContentBrowserClient::OnKeepaliveRequestFinished() {
--num_keepalive_requests_;
if (num_keepalive_requests_ == 0) {
DVLOG(1) << "Stopping the keepalive timer";
@@ -553,7 +553,7 @@ index d81a2b75f4c6c..4c29ef42b4576 100644
// This deletes the keep alive handle attached to the timer function and
// unblock the shutdown sequence.
}
@@ -7968,7 +7978,7 @@ void ChromeContentBrowserClient::OnKeepaliveTimerFired(
@@ -7988,7 +7998,7 @@ void ChromeContentBrowserClient::OnKeepaliveTimerFired(
const auto now = base::TimeTicks::Now();
const auto then = keepalive_deadline_;
if (now < then) {
@@ -563,7 +563,7 @@ index d81a2b75f4c6c..4c29ef42b4576 100644
base::BindOnce(&ChromeContentBrowserClient::OnKeepaliveTimerFired,
weak_factory_.GetWeakPtr(),
diff --git chrome/browser/chrome_content_browser_client.h chrome/browser/chrome_content_browser_client.h
index 522c072575325..b63e9aacd1f0a 100644
index c7ede4d105592..49cfa4193ab5e 100644
--- chrome/browser/chrome_content_browser_client.h
+++ chrome/browser/chrome_content_browser_client.h
@@ -147,6 +147,8 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
@@ -575,7 +575,7 @@ index 522c072575325..b63e9aacd1f0a 100644
// TODO(crbug.com/41356866): This file is about calls from content/ out
// to chrome/ to get values or notify about events, but both of these
// functions are from chrome/ to chrome/ and don't involve content/ at all.
@@ -691,7 +693,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
@@ -693,7 +695,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
override;
void OnNetworkServiceCreated(
network::mojom::NetworkService* network_service) override;
@@ -584,7 +584,7 @@ index 522c072575325..b63e9aacd1f0a 100644
content::BrowserContext* context,
bool in_memory,
const base::FilePath& relative_partition_path,
@@ -1233,7 +1235,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
@@ -1235,7 +1237,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
#if !BUILDFLAG(IS_ANDROID)
uint64_t num_keepalive_requests_ = 0;
@@ -594,7 +594,7 @@ index 522c072575325..b63e9aacd1f0a 100644
#endif
diff --git chrome/browser/prefs/browser_prefs.cc chrome/browser/prefs/browser_prefs.cc
index 7c9cd6b688f88..f66aa28081c37 100644
index c93cccc815a14..e39d3434fa1b0 100644
--- chrome/browser/prefs/browser_prefs.cc
+++ chrome/browser/prefs/browser_prefs.cc
@@ -16,6 +16,7 @@
@@ -605,7 +605,7 @@ index 7c9cd6b688f88..f66aa28081c37 100644
#include "chrome/browser/about_flags.h"
#include "chrome/browser/accessibility/accessibility_labels_service.h"
#include "chrome/browser/accessibility/invert_bubble_prefs.h"
@@ -198,6 +199,10 @@
@@ -199,6 +200,10 @@
#include "chrome/browser/background/background_mode_manager.h"
#endif
@@ -616,7 +616,7 @@ index 7c9cd6b688f88..f66aa28081c37 100644
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/browser/accessibility/animation_policy_prefs.h"
#include "chrome/browser/apps/platform_apps/shortcut_manager.h"
@@ -1917,7 +1922,8 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
@@ -1919,7 +1924,8 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
#endif // BUILDFLAG(IS_WIN)
@@ -626,7 +626,7 @@ index 7c9cd6b688f88..f66aa28081c37 100644
downgrade::RegisterPrefs(registry);
#endif
@@ -1961,6 +1967,11 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
@@ -1963,6 +1969,11 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
// This is intentionally last.
RegisterLocalStatePrefsForMigration(registry);
@@ -638,7 +638,7 @@ index 7c9cd6b688f88..f66aa28081c37 100644
}
// Register prefs applicable to all profiles.
@@ -2411,6 +2422,10 @@ void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
@@ -2416,6 +2427,10 @@ void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
const std::string& locale) {
RegisterProfilePrefs(registry, locale);

View File

@@ -1,8 +1,8 @@
diff --git chrome/browser/ui/browser_command_controller.cc chrome/browser/ui/browser_command_controller.cc
index e70c1340dd2ee..745b3982aa9ad 100644
index 963362357f5ff..1e90afe4b6542 100644
--- chrome/browser/ui/browser_command_controller.cc
+++ chrome/browser/ui/browser_command_controller.cc
@@ -411,6 +411,7 @@ bool BrowserCommandController::ExecuteCommandWithDisposition(
@@ -412,6 +412,7 @@ bool BrowserCommandController::ExecuteCommandWithDisposition(
// choose to not implement CommandUpdaterDelegate inside this class and
// therefore command_updater_ doesn't have the delegate set).
if (!SupportsCommand(id) || !IsCommandEnabled(id)) {
@@ -10,7 +10,7 @@ index e70c1340dd2ee..745b3982aa9ad 100644
return false;
}
@@ -427,6 +428,13 @@ bool BrowserCommandController::ExecuteCommandWithDisposition(
@@ -428,6 +429,13 @@ bool BrowserCommandController::ExecuteCommandWithDisposition(
DCHECK(command_updater_.IsCommandEnabled(id))
<< "Invalid/disabled command " << id;
@@ -24,7 +24,7 @@ index e70c1340dd2ee..745b3982aa9ad 100644
// The order of commands in this switch statement must match the function
// declaration order in browser.h!
switch (id) {
@@ -1215,11 +1223,13 @@ void BrowserCommandController::TabRestoreServiceLoaded(
@@ -1219,11 +1227,13 @@ void BrowserCommandController::TabRestoreServiceLoaded(
// BrowserCommandController, private:
bool BrowserCommandController::IsShowingMainUI() {
@@ -41,10 +41,10 @@ index e70c1340dd2ee..745b3982aa9ad 100644
bool BrowserCommandController::IsWebAppOrCustomTab() const {
diff --git chrome/browser/ui/toolbar/app_menu_model.cc chrome/browser/ui/toolbar/app_menu_model.cc
index 2a1eb7cd0a644..b3e95b92b2951 100644
index 51a97fd92beb4..8e726f5d18f75 100644
--- chrome/browser/ui/toolbar/app_menu_model.cc
+++ chrome/browser/ui/toolbar/app_menu_model.cc
@@ -658,10 +658,12 @@ FindAndEditSubMenuModel::FindAndEditSubMenuModel(
@@ -663,10 +663,12 @@ FindAndEditSubMenuModel::FindAndEditSubMenuModel(
ui::SimpleMenuModel::Delegate* delegate)
: SimpleMenuModel(delegate) {
AddItemWithStringIdAndVectorIcon(this, IDC_FIND, IDS_FIND, kSearchMenuIcon);
@@ -57,7 +57,7 @@ index 2a1eb7cd0a644..b3e95b92b2951 100644
}
class SaveAndShareSubMenuModel : public ui::SimpleMenuModel {
@@ -736,6 +738,57 @@ SaveAndShareSubMenuModel::SaveAndShareSubMenuModel(
@@ -741,6 +743,57 @@ SaveAndShareSubMenuModel::SaveAndShareSubMenuModel(
}
}
@@ -115,7 +115,7 @@ index 2a1eb7cd0a644..b3e95b92b2951 100644
} // namespace
////////////////////////////////////////////////////////////////////////////////
@@ -1596,7 +1649,7 @@ bool AppMenuModel::IsCommandIdChecked(int command_id) const {
@@ -1622,7 +1675,7 @@ bool AppMenuModel::IsCommandIdChecked(int command_id) const {
return false;
}
@@ -124,7 +124,7 @@ index 2a1eb7cd0a644..b3e95b92b2951 100644
GlobalError* error =
GlobalErrorServiceFactory::GetForProfile(browser_->profile())
->GetGlobalErrorByMenuItemCommandID(command_id);
@@ -1611,6 +1664,30 @@ bool AppMenuModel::IsCommandIdEnabled(int command_id) const {
@@ -1638,6 +1691,30 @@ bool AppMenuModel::IsCommandIdEnabled(int command_id) const {
}
}
@@ -155,7 +155,7 @@ index 2a1eb7cd0a644..b3e95b92b2951 100644
bool AppMenuModel::IsCommandIdAlerted(int command_id) const {
if (command_id == IDC_VIEW_PASSWORDS ||
command_id == IDC_SHOW_PASSWORD_MANAGER) {
@@ -1773,8 +1850,10 @@ void AppMenuModel::Build() {
@@ -1800,8 +1877,10 @@ void AppMenuModel::Build() {
IDS_CLEAR_BROWSING_DATA,
kTrashCanRefreshIcon);
@@ -166,7 +166,7 @@ index 2a1eb7cd0a644..b3e95b92b2951 100644
AddSeparator(ui::NORMAL_SEPARATOR);
AddItemWithStringIdAndVectorIcon(this, IDC_PRINT, IDS_PRINT, kPrintMenuIcon);
@@ -1896,6 +1975,11 @@ void AppMenuModel::Build() {
@@ -1923,6 +2002,11 @@ void AppMenuModel::Build() {
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
@@ -397,10 +397,10 @@ index 14a8a70d853f6..bf81594947886 100644
// regenerated.
bool RegenerateFrameOnThemeChange(BrowserThemeChangeType theme_change_type);
diff --git chrome/browser/ui/views/frame/browser_view.cc chrome/browser/ui/views/frame/browser_view.cc
index 1142fec7a138c..71e381f04adcc 100644
index 8a4afd4e2e6aa..db55c9c1a6125 100644
--- chrome/browser/ui/views/frame/browser_view.cc
+++ chrome/browser/ui/views/frame/browser_view.cc
@@ -350,11 +350,10 @@ using content::WebContents;
@@ -351,11 +351,10 @@ using content::WebContents;
using input::NativeWebKeyboardEvent;
using web_modal::WebContentsModalDialogHost;
@@ -415,7 +415,7 @@ index 1142fec7a138c..71e381f04adcc 100644
#if BUILDFLAG(IS_CHROMEOS_ASH)
// UMA histograms that record animation smoothness for tab loading animation.
@@ -694,6 +693,14 @@ class BrowserViewLayoutDelegateImpl : public BrowserViewLayoutDelegate {
@@ -695,6 +694,14 @@ class BrowserViewLayoutDelegateImpl : public BrowserViewLayoutDelegate {
return browser_view_->frame()->GetTopInset() - browser_view_->y();
}
@@ -430,7 +430,7 @@ index 1142fec7a138c..71e381f04adcc 100644
bool IsToolbarVisible() const override {
return browser_view_->IsToolbarVisible();
}
@@ -845,11 +852,21 @@ class BrowserView::AccessibilityModeObserver : public ui::AXModeObserver {
@@ -846,11 +853,21 @@ class BrowserView::AccessibilityModeObserver : public ui::AXModeObserver {
///////////////////////////////////////////////////////////////////////////////
// BrowserView, public:
@@ -453,7 +453,7 @@ index 1142fec7a138c..71e381f04adcc 100644
SetShowIcon(
::ShouldShowWindowIcon(browser_.get(), AppUsesWindowControlsOverlay()));
@@ -944,8 +961,15 @@ BrowserView::BrowserView(std::unique_ptr<Browser> browser)
@@ -945,8 +962,15 @@ BrowserView::BrowserView(std::unique_ptr<Browser> browser)
contents_container->SetLayoutManager(std::make_unique<ContentsLayoutManager>(
devtools_web_view_, contents_web_view_, watermark_view_));
@@ -471,7 +471,17 @@ index 1142fec7a138c..71e381f04adcc 100644
contents_separator_ =
top_container_->AddChildView(std::make_unique<ContentsSeparator>());
@@ -1019,7 +1043,9 @@ BrowserView::~BrowserView() {
@@ -1013,7 +1037,9 @@ BrowserView::BrowserView(std::unique_ptr<Browser> browser)
}
BrowserView::~BrowserView() {
+ if (browser_) {
browser_->GetFeatures().TearDownPreBrowserViewDestruction();
+ }
// Destroy the top controls slide controller first as it depends on the
// tabstrip model and the browser frame.
@@ -1021,7 +1047,9 @@ BrowserView::~BrowserView() {
// All the tabs should have been destroyed already. If we were closed by the
// OS with some tabs than the NativeBrowserFrame should have destroyed them.
@@ -481,7 +491,7 @@ index 1142fec7a138c..71e381f04adcc 100644
// Stop the animation timer explicitly here to avoid running it in a nested
// message loop, which may run by Browser destructor.
@@ -1028,17 +1054,18 @@ BrowserView::~BrowserView() {
@@ -1030,17 +1058,18 @@ BrowserView::~BrowserView() {
// Immersive mode may need to reparent views before they are removed/deleted.
immersive_mode_controller_.reset();
@@ -504,17 +514,7 @@ index 1142fec7a138c..71e381f04adcc 100644
// The TabStrip attaches a listener to the model. Make sure we shut down the
// TabStrip first so that it can cleanly remove the listener.
@@ -1062,7 +1089,9 @@ BrowserView::~BrowserView() {
// `SidePanelUI::RemoveSidePanelUIForBrowser()` deletes the
// SidePanelCoordinator.
+ if (browser()) {
SidePanelUI::RemoveSidePanelUIForBrowser(browser());
+ }
}
// static
@@ -1618,6 +1647,13 @@ gfx::Point BrowserView::GetThemeOffsetFromBrowserView() const {
@@ -1616,6 +1645,13 @@ gfx::Point BrowserView::GetThemeOffsetFromBrowserView() const {
ThemeProperties::kFrameHeightAboveTabs - browser_view_origin.y());
}
@@ -528,7 +528,7 @@ index 1142fec7a138c..71e381f04adcc 100644
// static:
BrowserView::DevToolsDockedPlacement BrowserView::GetDevToolsDockedPlacement(
const gfx::Rect& contents_webview_bounds,
@@ -2021,9 +2057,14 @@ void BrowserView::OnExclusiveAccessUserInput() {
@@ -2019,9 +2055,14 @@ void BrowserView::OnExclusiveAccessUserInput() {
bool BrowserView::ShouldHideUIForFullscreen() const {
// Immersive mode needs UI for the slide-down top panel.
@@ -544,7 +544,7 @@ index 1142fec7a138c..71e381f04adcc 100644
return frame_->GetFrameView()->ShouldHideTopUIForFullscreen();
}
@@ -3185,7 +3226,8 @@ DownloadShelf* BrowserView::GetDownloadShelf() {
@@ -3196,7 +3237,8 @@ views::View* BrowserView::GetTopContainer() {
}
DownloadBubbleUIController* BrowserView::GetDownloadBubbleUIController() {
@@ -554,7 +554,7 @@ index 1142fec7a138c..71e381f04adcc 100644
if (auto* download_button = toolbar_button_provider_->GetDownloadButton())
return download_button->bubble_controller();
return nullptr;
@@ -3740,7 +3782,8 @@ void BrowserView::ReparentTopContainerForEndOfImmersive() {
@@ -3751,7 +3793,8 @@ void BrowserView::ReparentTopContainerForEndOfImmersive() {
if (top_container()->parent() == this)
return;
@@ -564,7 +564,7 @@ index 1142fec7a138c..71e381f04adcc 100644
top_container()->DestroyLayer();
AddChildViewAt(top_container(), 0);
EnsureFocusOrder();
@@ -4223,11 +4266,38 @@ void BrowserView::GetAccessiblePanes(std::vector<views::View*>* panes) {
@@ -4234,11 +4277,38 @@ void BrowserView::GetAccessiblePanes(std::vector<views::View*>* panes) {
bool BrowserView::ShouldDescendIntoChildForEventHandling(
gfx::NativeView child,
const gfx::Point& location) {
@@ -605,7 +605,7 @@ index 1142fec7a138c..71e381f04adcc 100644
// Draggable regions are defined relative to the web contents.
gfx::Point point_in_contents_web_view_coords(location);
views::View::ConvertPointToTarget(GetWidget()->GetRootView(),
@@ -4236,7 +4306,7 @@ bool BrowserView::ShouldDescendIntoChildForEventHandling(
@@ -4247,7 +4317,7 @@ bool BrowserView::ShouldDescendIntoChildForEventHandling(
// Draggable regions should be ignored for clicks into any browser view's
// owned widgets, for example alerts, permission prompts or find bar.
@@ -614,7 +614,7 @@ index 1142fec7a138c..71e381f04adcc 100644
point_in_contents_web_view_coords.x(),
point_in_contents_web_view_coords.y()) ||
WidgetOwnedByAnchorContainsPoint(point_in_contents_web_view_coords);
@@ -4347,8 +4417,10 @@ void BrowserView::Layout(PassKey) {
@@ -4358,8 +4428,10 @@ void BrowserView::Layout(PassKey) {
// TODO(jamescook): Why was this in the middle of layout code?
toolbar_->location_bar()->omnibox_view()->SetFocusBehavior(
@@ -627,7 +627,7 @@ index 1142fec7a138c..71e381f04adcc 100644
// Some of the situations when the BrowserView is laid out are:
// - Enter/exit immersive fullscreen mode.
@@ -4414,6 +4486,11 @@ void BrowserView::AddedToWidget() {
@@ -4425,6 +4497,11 @@ void BrowserView::AddedToWidget() {
SetThemeProfileForWindow(GetNativeWindow(), browser_->profile());
#endif
@@ -639,7 +639,7 @@ index 1142fec7a138c..71e381f04adcc 100644
toolbar_->Init();
// TODO(pbos): Investigate whether the side panels should be creatable when
@@ -4455,13 +4532,9 @@ void BrowserView::AddedToWidget() {
@@ -4466,13 +4543,9 @@ void BrowserView::AddedToWidget() {
EnsureFocusOrder();
@@ -655,7 +655,7 @@ index 1142fec7a138c..71e381f04adcc 100644
using_native_frame_ = frame_->ShouldUseNativeFrame();
MaybeInitializeWebUITabStrip();
@@ -4821,7 +4894,8 @@ void BrowserView::ProcessFullscreen(bool fullscreen,
@@ -4832,7 +4905,8 @@ void BrowserView::ProcessFullscreen(bool fullscreen,
// Undo our anti-jankiness hacks and force a re-layout.
in_process_fullscreen_ = false;
ToolbarSizeChanged(false);
@@ -665,7 +665,7 @@ index 1142fec7a138c..71e381f04adcc 100644
}
void BrowserView::RequestFullscreen(bool fullscreen, int64_t display_id) {
@@ -5294,6 +5368,8 @@ Profile* BrowserView::GetProfile() {
@@ -5305,6 +5379,8 @@ Profile* BrowserView::GetProfile() {
}
void BrowserView::UpdateUIForTabFullscreen() {
@@ -674,7 +674,7 @@ index 1142fec7a138c..71e381f04adcc 100644
frame()->GetFrameView()->UpdateFullscreenTopUI();
}
@@ -5316,6 +5392,8 @@ void BrowserView::HideDownloadShelf() {
@@ -5327,6 +5403,8 @@ void BrowserView::HideDownloadShelf() {
}
bool BrowserView::CanUserExitFullscreen() const {
@@ -684,7 +684,7 @@ index 1142fec7a138c..71e381f04adcc 100644
}
diff --git chrome/browser/ui/views/frame/browser_view.h chrome/browser/ui/views/frame/browser_view.h
index 0e1ac9a2fd806..0b6f9370737f0 100644
index 942d62947353e..5c84e60b797e4 100644
--- chrome/browser/ui/views/frame/browser_view.h
+++ chrome/browser/ui/views/frame/browser_view.h
@@ -142,11 +142,16 @@ class BrowserView : public BrowserWindow,
@@ -704,7 +704,7 @@ index 0e1ac9a2fd806..0b6f9370737f0 100644
void set_frame(BrowserFrame* frame) {
frame_ = frame;
paint_as_active_subscription_ =
@@ -862,6 +867,10 @@ class BrowserView : public BrowserWindow,
@@ -863,6 +868,10 @@ class BrowserView : public BrowserWindow,
base::WeakPtr<content::WebContents> expected_web_contents,
const enterprise_data_protection::UrlSettings& settings);
@@ -715,7 +715,7 @@ index 0e1ac9a2fd806..0b6f9370737f0 100644
protected:
// Enumerates where the devtools are docked relative to the browser's main
// web contents.
@@ -885,6 +894,8 @@ class BrowserView : public BrowserWindow,
@@ -886,6 +895,8 @@ class BrowserView : public BrowserWindow,
const gfx::Rect& contents_webview_bounds,
const gfx::Rect& local_webview_container_bounds);
@@ -944,10 +944,10 @@ index b862ceac7225d..9575440a77d67 100644
LocationBarView* location_bar_view = browser_view_->GetLocationBarView();
CHECK(location_bar_view);
diff --git chrome/browser/ui/views/page_action/page_action_icon_controller.cc chrome/browser/ui/views/page_action/page_action_icon_controller.cc
index 04639b0a2f603..f4cfc16f6b4de 100644
index 352755587b5d9..111f6f42d206b 100644
--- chrome/browser/ui/views/page_action/page_action_icon_controller.cc
+++ chrome/browser/ui/views/page_action/page_action_icon_controller.cc
@@ -96,6 +96,12 @@ void PageActionIconController::Init(const PageActionIconParams& params,
@@ -97,6 +97,12 @@ void PageActionIconController::Init(const PageActionIconParams& params,
};
for (PageActionIconType type : params.types_enabled) {
@@ -961,7 +961,7 @@ index 04639b0a2f603..f4cfc16f6b4de 100644
case PageActionIconType::kPaymentsOfferNotification:
add_page_action_icon(
diff --git chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
index 9ba58b49d613e..90749dcd2d945 100644
index 5a2e3899a8a15..38d609b83fe75 100644
--- chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
+++ chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
@@ -605,29 +605,41 @@ gfx::Range BrowserTabStripController::ListTabsInGroup(

View File

@@ -47,10 +47,10 @@ index 6ff681f94dcba..82b93e6d3052a 100644
return std::make_pair(
/*is_cacheable=*/false,
diff --git content/public/browser/content_browser_client.cc content/public/browser/content_browser_client.cc
index 8df62dd712ad5..b191ea472448a 100644
index fe7feddd55aad..86e2ef537de36 100644
--- content/public/browser/content_browser_client.cc
+++ content/public/browser/content_browser_client.cc
@@ -1104,7 +1104,7 @@ ContentBrowserClient::CreateURLLoaderHandlerForServiceWorkerNavigationPreload(
@@ -1109,7 +1109,7 @@ ContentBrowserClient::CreateURLLoaderHandlerForServiceWorkerNavigationPreload(
void ContentBrowserClient::OnNetworkServiceCreated(
network::mojom::NetworkService* network_service) {}
@@ -59,7 +59,7 @@ index 8df62dd712ad5..b191ea472448a 100644
BrowserContext* context,
bool in_memory,
const base::FilePath& relative_partition_path,
@@ -1113,6 +1113,7 @@ void ContentBrowserClient::ConfigureNetworkContextParams(
@@ -1118,6 +1118,7 @@ void ContentBrowserClient::ConfigureNetworkContextParams(
cert_verifier_creation_params) {
network_context_params->user_agent = GetUserAgentBasedOnPolicy(context);
network_context_params->accept_language = "en-us,en";
@@ -68,10 +68,10 @@ index 8df62dd712ad5..b191ea472448a 100644
std::vector<base::FilePath>
diff --git content/public/browser/content_browser_client.h content/public/browser/content_browser_client.h
index 8f457dd1d2afb..6df18f193039e 100644
index 698dcf4d5ac83..d93d32acd423e 100644
--- content/public/browser/content_browser_client.h
+++ content/public/browser/content_browser_client.h
@@ -2094,7 +2094,7 @@ class CONTENT_EXPORT ContentBrowserClient {
@@ -2100,7 +2100,7 @@ class CONTENT_EXPORT ContentBrowserClient {
//
// If |relative_partition_path| is the empty string, it means this needs to
// create the default NetworkContext for the BrowserContext.
@@ -80,7 +80,7 @@ index 8f457dd1d2afb..6df18f193039e 100644
BrowserContext* context,
bool in_memory,
const base::FilePath& relative_partition_path,
@@ -2307,6 +2307,21 @@ class CONTENT_EXPORT ContentBrowserClient {
@@ -2313,6 +2313,21 @@ class CONTENT_EXPORT ContentBrowserClient {
RenderFrameHost* initiator_document,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory);
@@ -102,7 +102,7 @@ index 8f457dd1d2afb..6df18f193039e 100644
// Creates an OverlayWindow to be used for video or Picture-in-Picture.
// This window will house the content shown when in Picture-in-Picture mode.
// This will return a new OverlayWindow.
@@ -2364,6 +2379,10 @@ class CONTENT_EXPORT ContentBrowserClient {
@@ -2370,6 +2385,10 @@ class CONTENT_EXPORT ContentBrowserClient {
// Used as part of the user agent string.
virtual std::string GetProduct();

View File

@@ -12,7 +12,7 @@ index 79ba3ac1913f8..46bcb4366d2f8 100644
if (main_argv)
setproctitle_init(main_argv);
diff --git content/app/content_main.cc content/app/content_main.cc
index 96c28a7ce3183..3d60ab170e9a5 100644
index 96c28a7ce3183..8a396ce7adf86 100644
--- content/app/content_main.cc
+++ content/app/content_main.cc
@@ -174,11 +174,8 @@ ContentMainParams::~ContentMainParams() = default;
@@ -39,7 +39,18 @@ index 96c28a7ce3183..3d60ab170e9a5 100644
// A flag to indicate whether Main() has been called before. On Android, we
// may re-run Main() without restarting the browser process. This flag
@@ -274,14 +268,6 @@ RunContentProcess(ContentMainParams params,
@@ -266,7 +260,9 @@ RunContentProcess(ContentMainParams params,
// default, "C", locale.
setlocale(LC_NUMERIC, "C");
- SetupSignalHandlers();
+ if (!params.disable_signal_handlers) {
+ SetupSignalHandlers();
+ }
#endif
#if BUILDFLAG(IS_WIN)
@@ -274,14 +270,6 @@ RunContentProcess(ContentMainParams params,
#endif
#if BUILDFLAG(IS_MAC)
@@ -54,7 +65,7 @@ index 96c28a7ce3183..3d60ab170e9a5 100644
InitializeMac();
#endif
@@ -329,12 +315,46 @@ RunContentProcess(ContentMainParams params,
@@ -329,12 +317,46 @@ RunContentProcess(ContentMainParams params,
if (IsSubprocess())
CommonSubprocessInit();
@@ -149,10 +160,22 @@ index cbbc2f3ec12fa..f097b3cdded2f 100644
int RunBrowser(MainFunctionParams main_function_params,
bool start_minimal_browser);
diff --git content/public/app/content_main.h content/public/app/content_main.h
index 7f9b515297357..89b52e34fa31a 100644
index 7f9b515297357..5606867e43780 100644
--- content/public/app/content_main.h
+++ content/public/app/content_main.h
@@ -94,6 +94,13 @@ struct CONTENT_EXPORT ContentMainParams {
@@ -66,6 +66,11 @@ struct CONTENT_EXPORT ContentMainParams {
// are left uninitialized.
bool minimal_browser_mode = false;
+#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID)
+ // Indicates whether to disable signal handlers
+ bool disable_signal_handlers = false;
+#endif
+
#if BUILDFLAG(IS_MAC)
// The outermost autorelease pool to pass to main entry points.
STACK_ALLOCATED_IGNORE("https://crbug.com/1424190")
@@ -94,6 +99,13 @@ struct CONTENT_EXPORT ContentMainParams {
}
};

View File

@@ -238,11 +238,11 @@ index 8b515b7b8c353..f8e4106ac26d4 100644
// once each time the extensions system is loaded per browser_context. The
// implementation may wish to use the BrowserContext to record the current
diff --git extensions/browser/process_manager.cc extensions/browser/process_manager.cc
index 8e512cd3c826e..0cfda0e69be23 100644
index bd6ee1176e306..621204ecdce81 100644
--- extensions/browser/process_manager.cc
+++ extensions/browser/process_manager.cc
@@ -353,9 +353,17 @@ bool ProcessManager::CreateBackgroundHost(const Extension* extension,
return true; // TODO(kalman): return false here? It might break things...
@@ -358,9 +358,17 @@ bool ProcessManager::CreateBackgroundHost(const Extension* extension,
}
DVLOG(1) << "CreateBackgroundHost " << extension->id();
- ExtensionHost* host =

View File

@@ -1,17 +0,0 @@
diff --git third_party/tflite/features.gni third_party/tflite/features.gni
index 2466577542552..d94d80cda02d6 100644
--- third_party/tflite/features.gni
+++ third_party/tflite/features.gni
@@ -7,9 +7,9 @@ import("//build/config/chrome_build.gni")
declare_args() {
# This enables building TFLite with XNNPACK. Currently only available for
# Linux, macOS and Windows arm64/x64/x86 targets and ChromeOS non-ARM targets.
- build_tflite_with_xnnpack =
- is_win || is_mac || is_linux ||
- (is_chromeos && target_cpu != "arm64" && target_cpu != "arm")
+ build_tflite_with_xnnpack = (is_win || is_mac || is_linux ||
+ (is_chromeos && current_cpu != "arm64" && current_cpu != "arm")) &&
+ (current_cpu == "arm64" || current_cpu == "x64" || current_cpu == "x86")
# Turns on TFLITE_WITH_RUY, using ruy as the gemm backend instead of gemmlowp.
build_tflite_with_ruy = true

View File

@@ -44,7 +44,7 @@ index 57ef85cbfdfdf..758af3beffde6 100644
return nullptr;
}
diff --git content/browser/renderer_host/render_widget_host_impl.cc content/browser/renderer_host/render_widget_host_impl.cc
index 7f2fdc026d61b..9d719020f971f 100644
index 97741dfcb91db..4618a40ae097f 100644
--- content/browser/renderer_host/render_widget_host_impl.cc
+++ content/browser/renderer_host/render_widget_host_impl.cc
@@ -3277,6 +3277,11 @@ void RenderWidgetHostImpl::OnInvalidInputEventSource() {

View File

@@ -1,5 +1,5 @@
diff --git content/browser/renderer_host/render_frame_host_impl.cc content/browser/renderer_host/render_frame_host_impl.cc
index 9c8b401d00136..f1b9050b55bc3 100644
index 6c2d3a422cb49..6fe875b4f714f 100644
--- content/browser/renderer_host/render_frame_host_impl.cc
+++ content/browser/renderer_host/render_frame_host_impl.cc
@@ -10880,6 +10880,7 @@ void RenderFrameHostImpl::CommitNavigation(

View File

@@ -1,5 +1,5 @@
diff --git content/browser/renderer_host/render_widget_host_view_aura.cc content/browser/renderer_host/render_widget_host_view_aura.cc
index a2e0720681d6f..5534dce563fcb 100644
index 8de58b731e9de..886ef453fc98c 100644
--- content/browser/renderer_host/render_widget_host_view_aura.cc
+++ content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -6,6 +6,7 @@
@@ -35,7 +35,7 @@ index a2e0720681d6f..5534dce563fcb 100644
}
#if BUILDFLAG(IS_WIN)
@@ -2364,6 +2368,16 @@ void RenderWidgetHostViewAura::CreateAuraWindow(aura::client::WindowType type) {
@@ -2365,6 +2369,16 @@ void RenderWidgetHostViewAura::CreateAuraWindow(aura::client::WindowType type) {
window_->layer()->SetColor(GetBackgroundColor() ? *GetBackgroundColor()
: SK_ColorWHITE);
UpdateFrameSinkIdRegistration();

View File

@@ -0,0 +1,33 @@
diff --git third_party/sentencepiece/src/src/util.cc third_party/sentencepiece/src/src/util.cc
index c5e5289807a0c..e10880abc17eb 100644
--- third_party/sentencepiece/src/src/util.cc
+++ third_party/sentencepiece/src/src/util.cc
@@ -16,6 +16,7 @@
#include <atomic>
#include <iostream>
+#include <memory>
namespace sentencepiece {
@@ -197,8 +198,18 @@ std::mt19937 *GetRandomGenerator() {
}
#else
std::mt19937 *GetRandomGenerator() {
- thread_local static std::mt19937 mt(GetRandomGeneratorSeed());
- return &mt;
+ // Thread-locals occupy stack space in every thread ever created by the
+ // program, even if that thread never uses the thread-local variable.
+ //
+ // https://maskray.me/blog/2021-02-14-all-about-thread-local-storage
+ //
+ // sizeof(std::mt19937) is several kilobytes, so it is safer to put that on
+ // the heap, leaving only a pointer to it in thread-local storage. This must
+ // be a unique_ptr, not a raw pointer, so that the generator is not leaked on
+ // thread exit.
+ thread_local static auto mt =
+ std::make_unique<std::mt19937>(GetRandomGeneratorSeed());
+ return mt.get();
}
#endif
} // namespace random

View File

@@ -0,0 +1,23 @@
diff --git ui/base/models/simple_menu_model.cc ui/base/models/simple_menu_model.cc
index 88e27362452e5..9c18ac5c77544 100644
--- ui/base/models/simple_menu_model.cc
+++ ui/base/models/simple_menu_model.cc
@@ -10,6 +10,7 @@
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/task/single_thread_task_runner.h"
+#include "cef/libcef/features/features.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/image_model.h"
#include "ui/gfx/image/image.h"
@@ -170,8 +171,10 @@ void SimpleMenuModel::AddSeparator(MenuSeparatorType separator_type) {
}
if (items_.at(last_visible_item).type == TYPE_SEPARATOR) {
+#if !BUILDFLAG(ENABLE_CEF)
DCHECK_EQ(NORMAL_SEPARATOR, separator_type);
DCHECK_EQ(NORMAL_SEPARATOR, items_.at(last_visible_item).separator_type);
+#endif
// The last item is already a separator. Don't add another.
return;
}

View File

@@ -1,8 +1,8 @@
diff --git chrome/browser/ui/views/toolbar/app_menu.cc chrome/browser/ui/views/toolbar/app_menu.cc
index 7986c86012518..fa75795aa6c30 100644
index 5812efa0b52e0..7f5babea9a0fb 100644
--- chrome/browser/ui/views/toolbar/app_menu.cc
+++ chrome/browser/ui/views/toolbar/app_menu.cc
@@ -1025,7 +1025,9 @@ void AppMenu::RunMenu(views::MenuButtonController* host) {
@@ -1027,7 +1027,9 @@ void AppMenu::RunMenu(views::MenuButtonController* host) {
host->button()->GetWidget(), host,
host->button()->GetAnchorBoundsInScreen(),
views::MenuAnchorPosition::kTopRight, ui::MENU_SOURCE_NONE,

View File

@@ -61,10 +61,10 @@ index 791fc1874851e..db58beed440f8 100644
case ui::SHOW_STATE_MAXIMIZED:
return kSerializedShowStateMaximized;
diff --git content/browser/renderer_host/render_widget_host_view_base.cc content/browser/renderer_host/render_widget_host_view_base.cc
index c9b1737f91452..7231c79be3bdc 100644
index 58f2288e16997..52b70bc56c7af 100644
--- content/browser/renderer_host/render_widget_host_view_base.cc
+++ content/browser/renderer_host/render_widget_host_view_base.cc
@@ -677,6 +677,14 @@ float RenderWidgetHostViewBase::GetScaleOverrideForCapture() const {
@@ -678,6 +678,14 @@ float RenderWidgetHostViewBase::GetScaleOverrideForCapture() const {
return scale_override_for_capture_;
}
@@ -80,7 +80,7 @@ index c9b1737f91452..7231c79be3bdc 100644
if (!GetMouseWheelPhaseHandler())
return;
diff --git content/browser/renderer_host/render_widget_host_view_base.h content/browser/renderer_host/render_widget_host_view_base.h
index 1a7932a580836..7ceb1b03ce36c 100644
index 6dbc2a933dfc3..d2c0c38deecba 100644
--- content/browser/renderer_host/render_widget_host_view_base.h
+++ content/browser/renderer_host/render_widget_host_view_base.h
@@ -72,6 +72,7 @@ class CursorManager;
@@ -91,7 +91,7 @@ index 1a7932a580836..7ceb1b03ce36c 100644
class RenderWidgetHostViewInputObserver;
class ScopedViewTransitionResources;
class TextInputManager;
@@ -195,6 +196,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
@@ -196,6 +197,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
float GetDeviceScaleFactor() const final;
bool IsPointerLocked() override;
@@ -101,7 +101,7 @@ index 1a7932a580836..7ceb1b03ce36c 100644
// Identical to `CopyFromSurface()`, except that this method issues the
// `viz::CopyOutputRequest` against the exact `viz::Surface` currently
// embedded by this View, while `CopyFromSurface()` may return a copy of any
@@ -256,6 +260,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
@@ -257,6 +261,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
// Called when screen information or native widget bounds change.
virtual void UpdateScreenInfo();
@@ -112,7 +112,7 @@ index 1a7932a580836..7ceb1b03ce36c 100644
// Called by the TextInputManager to notify the view about being removed from
// the list of registered views, i.e., TextInputManager is no longer tracking
// TextInputState from this view. The RWHV should reset |text_input_manager_|
@@ -384,6 +392,12 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
@@ -385,6 +393,12 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
const gfx::Rect& bounds,
const gfx::Rect& anchor_rect) = 0;
@@ -125,7 +125,7 @@ index 1a7932a580836..7ceb1b03ce36c 100644
// Indicates whether the page has finished loading.
virtual void SetIsLoading(bool is_loading) = 0;
@@ -649,6 +663,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
@@ -647,6 +661,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
// to all displays.
gfx::Size system_cursor_size_;
@@ -136,7 +136,7 @@ index 1a7932a580836..7ceb1b03ce36c 100644
private:
FRIEND_TEST_ALL_PREFIXES(
BrowserSideFlingBrowserTest,
@@ -670,10 +688,6 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
@@ -668,10 +686,6 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
void SynchronizeVisualProperties();
@@ -259,10 +259,10 @@ index 2cf9330a4e24b..4bf0890ae000b 100644
// Specifies which edges of the window are tiled.
diff --git ui/ozone/platform/x11/x11_window.cc ui/ozone/platform/x11/x11_window.cc
index 4907de4e24cea..9824c17378207 100644
index b11e5604f0d5d..415fe672ba8d4 100644
--- ui/ozone/platform/x11/x11_window.cc
+++ ui/ozone/platform/x11/x11_window.cc
@@ -1864,7 +1864,8 @@ void X11Window::CreateXWindow(const PlatformWindowInitProperties& properties) {
@@ -1867,7 +1867,8 @@ void X11Window::CreateXWindow(const PlatformWindowInitProperties& properties) {
req.border_pixel = 0;
bounds_in_pixels_ = SanitizeBounds(bounds);
@@ -350,7 +350,7 @@ index e698f71577c51..8a6e28128564d 100644
base::WeakPtrFactory<DesktopWindowTreeHostLinux> weak_factory_{this};
};
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
index 30781b584b649..6edaa60e652ab 100644
index 74016f5663952..8c7171639f979 100644
--- ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
@@ -281,8 +281,8 @@ void DesktopWindowTreeHostPlatform::Init(const Widget::InitParams& params) {

View File

@@ -1,5 +1,5 @@
diff --git content/browser/web_contents/web_contents_impl.cc content/browser/web_contents/web_contents_impl.cc
index 205a1bb692091..d5cf0a22b11b2 100644
index 8033e5e15ac1d..1658f658a9441 100644
--- content/browser/web_contents/web_contents_impl.cc
+++ content/browser/web_contents/web_contents_impl.cc
@@ -3610,6 +3610,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
@@ -60,7 +60,7 @@ index 205a1bb692091..d5cf0a22b11b2 100644
FrameTree* WebContentsImpl::GetOwnedPictureInPictureFrameTree() {
diff --git content/public/browser/web_contents.h content/public/browser/web_contents.h
index 1ee36913ac37c..19b13abaf0679 100644
index 1ee36913ac37c..6dcca3c80ede2 100644
--- content/public/browser/web_contents.h
+++ content/public/browser/web_contents.h
@@ -105,10 +105,12 @@ class BrowserContext;
@@ -81,14 +81,14 @@ index 1ee36913ac37c..19b13abaf0679 100644
network::mojom::WebSandboxFlags::kNone;
+ // Optionally specify the view and delegate view.
+ content::WebContentsView* view = nullptr;
+ content::RenderViewHostDelegateView* delegate_view = nullptr;
+ raw_ptr<content::WebContentsView> view = nullptr;
+ raw_ptr<content::RenderViewHostDelegateView> delegate_view = nullptr;
+
// Value used to set the last time the WebContents was made active, this is
// the value that'll be returned by GetLastActiveTime(). If this is left
// default initialized then the value is not passed on to the WebContents
diff --git content/public/browser/web_contents_delegate.h content/public/browser/web_contents_delegate.h
index fd851a9347dd6..82abe6dd2fd07 100644
index fd851a9347dd6..dc77e13235743 100644
--- content/public/browser/web_contents_delegate.h
+++ content/public/browser/web_contents_delegate.h
@@ -63,9 +63,11 @@ class EyeDropperListener;
@@ -112,8 +112,8 @@ index fd851a9347dd6..82abe6dd2fd07 100644
+ const GURL& target_url,
+ int opener_render_process_id,
+ int opener_render_frame_id,
+ content::WebContentsView** view,
+ content::RenderViewHostDelegateView** delegate_view) {}
+ raw_ptr<content::WebContentsView>* view,
+ raw_ptr<content::RenderViewHostDelegateView>* delegate_view) {}
+
// Notifies the delegate about the creation of a new WebContents. This
// typically happens when popups are created.

View File

@@ -72,6 +72,7 @@
'includes': [
'shared_sources_win',
'cefclient_sources_win',
'cefclient_sources_resources_win_rc',
],
}}
@@ -199,7 +200,7 @@ if(OS_MAC)
add_dependencies(${CEF_TARGET} libcef_dll_wrapper)
target_link_libraries(${CEF_TARGET} libcef_dll_wrapper ${CEF_STANDARD_LIBS} "-framework OpenGL")
set_target_properties(${CEF_TARGET} PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/mac/Info.plist
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/mac/Info.plist.in
)
# Copy the CEF framework into the Frameworks directory.
@@ -229,7 +230,7 @@ if(OS_MAC)
# MACOSX_BUNDLE_INFO_PLIST) uses global env variables and would insert the
# wrong values with multiple targets.
set(_helper_info_plist "${CMAKE_CURRENT_BINARY_DIR}/helper-Info${_target_suffix}.plist")
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/resources/mac/helper-Info.plist" _plist_contents)
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/mac/helper-Info.plist.in" _plist_contents)
string(REPLACE "\${EXECUTABLE_NAME}" "${_helper_output_name}" _plist_contents ${_plist_contents})
string(REPLACE "\${PRODUCT_NAME}" "${_helper_output_name}" _plist_contents ${_plist_contents})
string(REPLACE "\${BUNDLE_ID_SUFFIX}" "${_plist_suffix}" _plist_contents ${_plist_contents})
@@ -268,7 +269,7 @@ if(OS_MAC)
# directive but that doesn't properly handle nested resource directories.
# Remove these prefixes from input file paths.
set(PREFIXES
"resources/mac/"
"mac/"
"resources/"
"../shared/resources/"
)
@@ -311,7 +312,7 @@ if(OS_WINDOWS)
endif()
# Add the custom manifest files to the executable.
ADD_WINDOWS_MANIFEST("${CMAKE_CURRENT_SOURCE_DIR}/resources/win" "${CEF_TARGET}" "exe")
ADD_WINDOWS_MANIFEST("${CMAKE_CURRENT_SOURCE_DIR}/win" "${CEF_TARGET}" "exe")
# Copy CEF binary and resource files to the target output directory.
COPY_FILES("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${CEF_TARGET_OUT_DIR}")

View File

@@ -14,7 +14,13 @@ BaseClientHandler::BaseClientHandler() {
// static
CefRefPtr<BaseClientHandler> BaseClientHandler::GetForBrowser(
CefRefPtr<CefBrowser> browser) {
return static_cast<BaseClientHandler*>(browser->GetHost()->GetClient().get());
return GetForClient(browser->GetHost()->GetClient());
}
// static
CefRefPtr<BaseClientHandler> BaseClientHandler::GetForClient(
CefRefPtr<CefClient> client) {
return static_cast<BaseClientHandler*>(client.get());
}
bool BaseClientHandler::OnProcessMessageReceived(

View File

@@ -24,6 +24,9 @@ class BaseClientHandler : public CefClient,
static CefRefPtr<BaseClientHandler> GetForBrowser(
CefRefPtr<CefBrowser> browser);
// Returns the BaseClientHandler for |client|.
static CefRefPtr<BaseClientHandler> GetForClient(CefRefPtr<CefClient> client);
// CefClient methods
CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() override { return this; }
CefRefPtr<CefRequestHandler> GetRequestHandler() override { return this; }
@@ -92,6 +95,9 @@ class BaseClientHandler : public CefClient,
void SetHangAction(HangAction action);
HangAction GetHangAction() const;
// Used to determine the object type for each concrete implementation.
virtual const void* GetTypeKey() const = 0;
protected:
CefRefPtr<CefResourceManager> GetResourceManager() const {
return resource_manager_;

View File

@@ -1124,7 +1124,9 @@ void BrowserWindowOsrGtk::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
CEF_REQUIRE_UI_THREAD();
// Detach |this| from the ClientHandlerOsr.
static_cast<ClientHandlerOsr*>(client_handler_.get())->DetachOsrDelegate();
auto handler = ClientHandlerOsr::GetForClient(client_handler_);
CHECK(handler);
handler->DetachOsrDelegate();
ScopedGdkThreadsEnter scoped_gdk_threads;

View File

@@ -1581,8 +1581,10 @@ void BrowserWindowOsrMacImpl::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
REQUIRE_MAIN_THREAD();
// Detach |this| from the ClientHandlerOsr.
static_cast<ClientHandlerOsr*>(browser_window_.client_handler_.get())
->DetachOsrDelegate();
auto handler =
ClientHandlerOsr::GetForClient(browser_window_.client_handler_);
CHECK(handler);
handler->DetachOsrDelegate();
}
bool BrowserWindowOsrMacImpl::GetRootScreenRect(CefRefPtr<CefBrowser> browser,

View File

@@ -850,12 +850,6 @@ bool ClientHandler::CanDownload(CefRefPtr<CefBrowser> browser,
const CefString& request_method) {
CEF_REQUIRE_UI_THREAD();
if (!with_controls_) {
// Block the download.
LOG(INFO) << "Blocking download";
return false;
}
// Allow the download.
return true;
}

View File

@@ -19,6 +19,16 @@ ClientHandlerOsr::ClientHandlerOsr(Delegate* delegate,
DCHECK(osr_delegate_);
}
// static
CefRefPtr<ClientHandlerOsr> ClientHandlerOsr::GetForClient(
CefRefPtr<CefClient> client) {
auto base = BaseClientHandler::GetForClient(client);
if (base && base->GetTypeKey() == &kTypeKey) {
return static_cast<ClientHandlerOsr*>(base.get());
}
return nullptr;
}
void ClientHandlerOsr::DetachOsrDelegate() {
if (!CefCurrentlyOn(TID_UI)) {
// Execute this method on the UI thread.

View File

@@ -80,6 +80,10 @@ class ClientHandlerOsr : public ClientHandler,
bool with_controls,
const std::string& startup_url);
// Returns the ClientHandlerOsr for |client|, or nullptr if |client| is not a
// ClientHandlerOsr.
static CefRefPtr<ClientHandlerOsr> GetForClient(CefRefPtr<CefClient> client);
// This object may outlive the OsrDelegate object so it's necessary for the
// OsrDelegate to detach itself before destruction.
void DetachOsrDelegate();
@@ -139,6 +143,10 @@ class ClientHandlerOsr : public ClientHandler,
void OnAccessibilityLocationChange(CefRefPtr<CefValue> value) override;
private:
// Used to determine the object type.
virtual const void* GetTypeKey() const override { return &kTypeKey; }
static constexpr int kTypeKey = 0;
// Only accessed on the UI thread.
OsrDelegate* osr_delegate_;

View File

@@ -11,4 +11,14 @@ ClientHandlerStd::ClientHandlerStd(Delegate* delegate,
const std::string& startup_url)
: ClientHandler(delegate, /*is_osr=*/false, with_controls, startup_url) {}
// static
CefRefPtr<ClientHandlerStd> ClientHandlerStd::GetForClient(
CefRefPtr<CefClient> client) {
auto base = BaseClientHandler::GetForClient(client);
if (base && base->GetTypeKey() == &kTypeKey) {
return static_cast<ClientHandlerStd*>(base.get());
}
return nullptr;
}
} // namespace client

View File

@@ -18,7 +18,15 @@ class ClientHandlerStd : public ClientHandler {
bool with_controls,
const std::string& startup_url);
// Returns the ClientHandlerStd for |client|, or nullptr if |client| is not a
// ClientHandlerStd.
static CefRefPtr<ClientHandlerStd> GetForClient(CefRefPtr<CefClient> client);
private:
// Used to determine the object type.
virtual const void* GetTypeKey() const override { return &kTypeKey; }
static constexpr int kTypeKey = 0;
// Include the default reference counting implementation.
IMPLEMENT_REFCOUNTING(ClientHandlerStd);
DISALLOW_COPY_AND_ASSIGN(ClientHandlerStd);

View File

@@ -0,0 +1,19 @@
// Copyright (c) 2024 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 "tests/cefclient/browser/default_client_handler.h"
namespace client {
// static
CefRefPtr<DefaultClientHandler> DefaultClientHandler::GetForClient(
CefRefPtr<CefClient> client) {
auto base = BaseClientHandler::GetForClient(client);
if (base && base->GetTypeKey() == &kTypeKey) {
return static_cast<DefaultClientHandler*>(base.get());
}
return nullptr;
}
} // namespace client

View File

@@ -16,7 +16,16 @@ class DefaultClientHandler : public BaseClientHandler {
public:
DefaultClientHandler() = default;
// Returns the DefaultClientHandler for |client|, or nullptr if |client| is
// not a DefaultClientHandler.
static CefRefPtr<DefaultClientHandler> GetForClient(
CefRefPtr<CefClient> client);
private:
// Used to determine the object type.
virtual const void* GetTypeKey() const override { return &kTypeKey; }
static constexpr int kTypeKey = 0;
IMPLEMENT_REFCOUNTING(DefaultClientHandler);
DISALLOW_COPY_AND_ASSIGN(DefaultClientHandler);
};

View File

@@ -947,8 +947,10 @@ void OsrWindowWin::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
void OsrWindowWin::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
CEF_REQUIRE_UI_THREAD();
// Detach |this| from the ClientHandlerOsr.
static_cast<ClientHandlerOsr*>(browser_->GetHost()->GetClient().get())
->DetachOsrDelegate();
auto handler =
ClientHandlerOsr::GetForClient(browser_->GetHost()->GetClient());
CHECK(handler);
handler->DetachOsrDelegate();
browser_ = nullptr;
render_handler_->SetBrowser(nullptr);
Destroy();

View File

@@ -147,8 +147,9 @@ scoped_refptr<RootWindow> RootWindowManager::CreateRootWindowAsPopup(
SanityCheckWindowConfig(is_devtools, use_views, use_alloy_style, with_osr);
if (!temp_window_) {
// TempWindow must be created on the UI thread.
if (!temp_window_ && !use_views) {
// TempWindow must be created on the UI thread. It is only used with
// native (non-Views) parent windows.
temp_window_.reset(new TempWindow());
}

View File

@@ -273,7 +273,12 @@ ViewsWindow::Delegate* RootWindowViews::GetDelegateForPopup(
CefRefPtr<CefClient> client) {
CEF_REQUIRE_UI_THREAD();
// |handler| was created in RootWindowViews::InitAsPopup().
ClientHandlerStd* handler = static_cast<ClientHandlerStd*>(client.get());
// May return nullptr when running with `--use-default-popup`.
auto handler = ClientHandlerStd::GetForClient(client);
if (!handler) {
return nullptr;
}
RootWindowViews* root_window =
static_cast<RootWindowViews*>(handler->delegate());

View File

@@ -29,7 +29,7 @@ class TempWindowMacImpl {
}
~TempWindowMacImpl() {
DCHECK(window_);
[window_ close];
window_ = nil;
}
private:

View File

@@ -16,12 +16,12 @@
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<string>${VERSION_SHORT}</string>
<key>CFBundleShortVersionString</key>
<string>${VERSION_SHORT}</string>
<key>LSEnvironment</key>
<dict>
<key>MallocNanoZone</key>

View File

@@ -16,10 +16,12 @@
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${VERSION_SHORT}</string>
<key>CFBundleShortVersionString</key>
<string>${VERSION_SHORT}</string>
<key>LSEnvironment</key>
<dict>
<key>MallocNanoZone</key>

Some files were not shown because too many files have changed in this diff Show More