Compare commits

...

21 Commits

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
121 changed files with 3828 additions and 336 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.43'
'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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -289,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',
},
{
@@ -826,5 +830,10 @@ patches = [
# 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 chrome/browser/BUILD.gn chrome/browser/BUILD.gn
index e06cdcd322877..7c0382fd1948a 100644
index db90e13763831..4448eac5885b8 100644
--- chrome/browser/BUILD.gn
+++ chrome/browser/BUILD.gn
@@ -11,6 +11,7 @@ import("//build/config/compiler/pgo/pgo.gni")
@@ -18,7 +18,7 @@ index e06cdcd322877..7c0382fd1948a 100644
"//chrome:extra_resources",
"//chrome:resources",
"//chrome:strings",
@@ -2777,6 +2779,10 @@ static_library("browser") {
@@ -2778,6 +2780,10 @@ static_library("browser") {
]
}

View File

@@ -154,10 +154,10 @@ index 49e6bdcbd55a6..0425eb49c4296 100644
]
}
diff --git chrome/browser/ui/browser.cc chrome/browser/ui/browser.cc
index b4eadfdbfcfac..8ee3f0f988f6d 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
@@ -183,7 +183,7 @@ index b4eadfdbfcfac..8ee3f0f988f6d 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),
@@ -194,7 +194,7 @@ index b4eadfdbfcfac..8ee3f0f988f6d 100644
tab_strip_model_delegate_(
std::make_unique<chrome::BrowserTabStripModelDelegate>(this)),
tab_strip_model_(std::make_unique<TabStripModel>(
@@ -759,6 +782,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();
@@ -207,7 +207,7 @@ index b4eadfdbfcfac..8ee3f0f988f6d 100644
}
///////////////////////////////////////////////////////////////////////////////
@@ -1219,6 +1248,8 @@ void Browser::WindowFullscreenStateChanged() {
@@ -1241,6 +1270,8 @@ void Browser::WindowFullscreenStateChanged() {
->WindowFullscreenStateChanged();
command_controller_->FullscreenStateChanged();
UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TOGGLE_FULLSCREEN);
@@ -216,7 +216,7 @@ index b4eadfdbfcfac..8ee3f0f988f6d 100644
}
void Browser::FullscreenTopUIStateChanged() {
@@ -1592,6 +1623,14 @@ content::KeyboardEventProcessingResult Browser::PreHandleKeyboardEvent(
@@ -1614,6 +1645,14 @@ content::KeyboardEventProcessingResult Browser::PreHandleKeyboardEvent(
if (exclusive_access_manager_->HandleUserKeyEvent(event))
return content::KeyboardEventProcessingResult::HANDLED;
@@ -231,7 +231,7 @@ index b4eadfdbfcfac..8ee3f0f988f6d 100644
return window()->PreHandleKeyboardEvent(event);
}
@@ -1599,8 +1638,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);
@@ -252,24 +252,22 @@ index b4eadfdbfcfac..8ee3f0f988f6d 100644
}
bool Browser::TabsNeedBeforeUnloadFired() const {
@@ -1776,6 +1825,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;
@@ -1938,6 +1997,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);
@@ -278,7 +276,7 @@ index b4eadfdbfcfac..8ee3f0f988f6d 100644
}
void Browser::CloseContents(WebContents* source) {
@@ -1966,6 +2027,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) {
@@ -287,7 +285,7 @@ index b4eadfdbfcfac..8ee3f0f988f6d 100644
if (!GetStatusBubble())
return;
@@ -1973,6 +2036,17 @@ void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
@@ -1995,6 +2056,17 @@ void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
GetStatusBubble()->SetURL(url);
}
@@ -305,7 +303,7 @@ index b4eadfdbfcfac..8ee3f0f988f6d 100644
void Browser::ContentsMouseEvent(WebContents* source, const ui::Event& event) {
const ui::EventType type = event.type();
const bool exited = type == ui::ET_MOUSE_EXITED;
@@ -2000,6 +2074,19 @@ bool Browser::TakeFocus(content::WebContents* source, bool reverse) {
@@ -2022,6 +2094,19 @@ bool Browser::TakeFocus(content::WebContents* source, bool reverse) {
return false;
}
@@ -325,7 +323,7 @@ index b4eadfdbfcfac..8ee3f0f988f6d 100644
void Browser::BeforeUnloadFired(WebContents* web_contents,
bool proceed,
bool* proceed_to_fire_unload) {
@@ -2099,12 +2186,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);
@@ -350,7 +348,7 @@ index b4eadfdbfcfac..8ee3f0f988f6d 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();
@@ -2117,6 +2216,13 @@ void Browser::RendererUnresponsive(
@@ -2139,6 +2236,13 @@ void Browser::RendererUnresponsive(
void Browser::RendererResponsive(
WebContents* source,
content::RenderWidgetHost* render_widget_host) {
@@ -364,7 +362,7 @@ index b4eadfdbfcfac..8ee3f0f988f6d 100644
RenderWidgetHostView* view = render_widget_host->GetView();
if (view && !render_widget_host->GetView()->IsHTMLFormPopup()) {
TabDialogs::FromWebContents(source)->HideHungRendererDialog(
@@ -2126,6 +2232,15 @@ void Browser::RendererResponsive(
@@ -2148,6 +2252,15 @@ void Browser::RendererResponsive(
content::JavaScriptDialogManager* Browser::GetJavaScriptDialogManager(
WebContents* source) {
@@ -380,7 +378,7 @@ index b4eadfdbfcfac..8ee3f0f988f6d 100644
return javascript_dialogs::TabModalDialogManager::FromWebContents(source);
}
@@ -2161,6 +2276,11 @@ void Browser::DraggableRegionsChanged(
@@ -2183,6 +2296,11 @@ void Browser::DraggableRegionsChanged(
if (app_controller_) {
app_controller_->DraggableRegionsChanged(regions, contents);
}
@@ -392,7 +390,7 @@ index b4eadfdbfcfac..8ee3f0f988f6d 100644
}
void Browser::DidFinishNavigation(
@@ -2241,11 +2361,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);
@@ -408,7 +406,7 @@ index b4eadfdbfcfac..8ee3f0f988f6d 100644
}
bool Browser::IsFullscreenForTabOrPending(const WebContents* web_contents) {
@@ -2445,6 +2569,15 @@ void Browser::RequestMediaAccessPermission(
@@ -2467,6 +2589,15 @@ void Browser::RequestMediaAccessPermission(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
content::MediaResponseCallback callback) {
@@ -424,7 +422,7 @@ index b4eadfdbfcfac..8ee3f0f988f6d 100644
const extensions::Extension* extension =
GetExtensionForOrigin(profile_, request.security_origin);
MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest(
@@ -2989,9 +3122,11 @@ void Browser::RemoveScheduledUpdatesFor(WebContents* contents) {
@@ -3011,9 +3142,11 @@ void Browser::RemoveScheduledUpdatesFor(WebContents* contents) {
// Browser, Getters for UI (private):
StatusBubble* Browser::GetStatusBubble() {
@@ -437,7 +435,7 @@ index b4eadfdbfcfac..8ee3f0f988f6d 100644
}
// We hide the status bar for web apps windows as this matches native
@@ -2999,6 +3134,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()) {
@@ -450,7 +448,7 @@ index b4eadfdbfcfac..8ee3f0f988f6d 100644
return nullptr;
}
@@ -3148,6 +3289,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);
}
@@ -459,7 +457,7 @@ index b4eadfdbfcfac..8ee3f0f988f6d 100644
}
void Browser::TabDetachedAtImpl(content::WebContents* contents,
@@ -3302,6 +3445,14 @@ bool Browser::PictureInPictureBrowserSupportsWindowFeature(
@@ -3324,6 +3465,14 @@ bool Browser::PictureInPictureBrowserSupportsWindowFeature(
bool Browser::SupportsWindowFeatureImpl(WindowFeature feature,
bool check_can_support) const {
@@ -475,7 +473,7 @@ index b4eadfdbfcfac..8ee3f0f988f6d 100644
case TYPE_NORMAL:
return NormalBrowserSupportsWindowFeature(feature, check_can_support);
diff --git chrome/browser/ui/browser.h chrome/browser/ui/browser.h
index b6d47818d7648..9265c6ffdee64 100644
index 289eb221d6fbb..13aa346aaa37c 100644
--- chrome/browser/ui/browser.h
+++ chrome/browser/ui/browser.h
@@ -24,6 +24,7 @@
@@ -497,7 +495,7 @@ index b6d47818d7648..9265c6ffdee64 100644
#if BUILDFLAG(IS_ANDROID)
#error This file should only be included on desktop.
#endif
@@ -373,6 +378,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;
@@ -513,7 +511,7 @@ index b6d47818d7648..9265c6ffdee64 100644
private:
friend class Browser;
friend class WindowSizerChromeOSTest;
@@ -454,6 +468,13 @@ class Browser : public TabStripModelObserver,
@@ -458,6 +472,13 @@ class Browser : public TabStripModelObserver,
update_ui_immediately_for_testing_ = true;
}
@@ -527,7 +525,7 @@ index b6d47818d7648..9265c6ffdee64 100644
// Accessors ////////////////////////////////////////////////////////////////
const CreateParams& create_params() const { return create_params_; }
@@ -549,6 +570,12 @@ class Browser : public TabStripModelObserver,
@@ -553,6 +574,12 @@ class Browser : public TabStripModelObserver,
base::WeakPtr<Browser> AsWeakPtr();
base::WeakPtr<const Browser> AsWeakPtr() const;
@@ -540,7 +538,7 @@ index b6d47818d7648..9265c6ffdee64 100644
// Get the FindBarController for this browser, creating it if it does not
// yet exist.
FindBarController* GetFindBarController();
@@ -962,10 +989,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;
@@ -559,7 +557,7 @@ index b6d47818d7648..9265c6ffdee64 100644
void BeforeUnloadFired(content::WebContents* source,
bool proceed,
bool* proceed_to_fire_unload) override;
@@ -1300,6 +1335,10 @@ class Browser : public TabStripModelObserver,
@@ -1308,6 +1343,10 @@ class Browser : public TabStripModelObserver,
// This Browser's window.
raw_ptr<BrowserWindow, DanglingUntriaged> window_;
@@ -570,7 +568,7 @@ index b6d47818d7648..9265c6ffdee64 100644
std::unique_ptr<TabStripModelDelegate> const tab_strip_model_delegate_;
std::unique_ptr<TabStripModel> const tab_strip_model_;
@@ -1366,6 +1405,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_;

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 ee4c942790296..f451d56cf929b 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() {
@@ -60,7 +60,7 @@ index ee4c942790296..f451d56cf929b 100644
}
Profile* RenderViewContextMenu::GetProfile() const {
@@ -3621,6 +3651,26 @@ void RenderViewContextMenu::RegisterExecutePluginActionCallbackForTesting(
@@ -3635,6 +3665,26 @@ void RenderViewContextMenu::RegisterExecutePluginActionCallbackForTesting(
execute_plugin_action_callback_ = std::move(cb);
}

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 bd2c41e30f01e..d87b8baf3de2b 100644
index bd2c41e30f01e..e57592e75dec7 100644
--- chrome/browser/download/chrome_download_manager_delegate.cc
+++ chrome/browser/download/chrome_download_manager_delegate.cc
@@ -150,6 +150,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 bd2c41e30f01e..d87b8baf3de2b 100644
using content::BrowserThread;
using content::DownloadManager;
using download::DownloadItem;
@@ -500,6 +504,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 bd2c41e30f01e..d87b8baf3de2b 100644
}
ChromeDownloadManagerDelegate::~ChromeDownloadManagerDelegate() {
@@ -559,6 +568,9 @@ void ChromeDownloadManagerDelegate::Shutdown() {
@@ -559,6 +569,9 @@ void ChromeDownloadManagerDelegate::Shutdown() {
download_manager_->RemoveObserver(this);
download_manager_ = nullptr;
}
@@ -35,7 +43,7 @@ index bd2c41e30f01e..d87b8baf3de2b 100644
}
void ChromeDownloadManagerDelegate::OnDownloadCanceledAtShutdown(
@@ -627,6 +639,12 @@ bool ChromeDownloadManagerDelegate::DetermineDownloadTarget(
@@ -627,6 +640,12 @@ bool ChromeDownloadManagerDelegate::DetermineDownloadTarget(
ReportPDFLoadStatus(PDFLoadStatus::kTriggeredNoGestureDriveByDownload);
}
@@ -48,6 +56,20 @@ index bd2c41e30f01e..d87b8baf3de2b 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

@@ -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 c6fb861755332..8f2c467018d05 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 c6fb861755332..8f2c467018d05 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"
@@ -1488,6 +1489,8 @@ ChromeContentBrowserClient::GetPopupNavigationDelegateFactoryForTesting() {
@@ -1489,6 +1490,8 @@ ChromeContentBrowserClient::GetPopupNavigationDelegateFactoryForTesting() {
}
ChromeContentBrowserClient::ChromeContentBrowserClient() {
@@ -442,7 +442,7 @@ index c6fb861755332..8f2c467018d05 100644
#if BUILDFLAG(ENABLE_PLUGINS)
extra_parts_.push_back(
std::make_unique<ChromeContentBrowserClientPluginsPart>());
@@ -1525,6 +1528,11 @@ ChromeContentBrowserClient::~ChromeContentBrowserClient() {
@@ -1526,6 +1529,11 @@ ChromeContentBrowserClient::~ChromeContentBrowserClient() {
}
}
@@ -454,7 +454,7 @@ index c6fb861755332..8f2c467018d05 100644
// static
void ChromeContentBrowserClient::RegisterLocalStatePrefs(
PrefRegistrySimple* registry) {
@@ -3746,28 +3754,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 c6fb861755332..8f2c467018d05 100644
#endif // BUILDFLAG(IS_ANDROID)
// Reauth WebUI doesn't support dark mode yet because it shares the dialog
@@ -4508,9 +4513,11 @@ void ChromeContentBrowserClient::BrowserURLHandlerCreated(
@@ -4518,9 +4523,11 @@ void ChromeContentBrowserClient::BrowserURLHandlerCreated(
&search::HandleNewTabURLReverseRewrite);
#endif // BUILDFLAG(IS_ANDROID)
@@ -512,7 +512,7 @@ index c6fb861755332..8f2c467018d05 100644
}
base::FilePath ChromeContentBrowserClient::GetDefaultDownloadDirectory() {
@@ -6637,7 +6644,7 @@ void ChromeContentBrowserClient::OnNetworkServiceCreated(
@@ -6647,7 +6654,7 @@ void ChromeContentBrowserClient::OnNetworkServiceCreated(
#endif
}
@@ -521,7 +521,7 @@ index c6fb861755332..8f2c467018d05 100644
content::BrowserContext* context,
bool in_memory,
const base::FilePath& relative_partition_path,
@@ -6655,6 +6662,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 c6fb861755332..8f2c467018d05 100644
}
std::vector<base::FilePath>
@@ -7777,10 +7786,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 c6fb861755332..8f2c467018d05 100644
FROM_HERE, keepalive_deadline_ - now,
base::BindOnce(
&ChromeContentBrowserClient::OnKeepaliveTimerFired,
@@ -7799,7 +7808,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 c6fb861755332..8f2c467018d05 100644
// This deletes the keep alive handle attached to the timer function and
// unblock the shutdown sequence.
}
@@ -7978,7 +7988,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 c6fb861755332..8f2c467018d05 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 3b6ce83dd7579..bcaa68b901656 100644
index c93cccc815a14..e39d3434fa1b0 100644
--- chrome/browser/prefs/browser_prefs.cc
+++ chrome/browser/prefs/browser_prefs.cc
@@ -16,6 +16,7 @@

View File

@@ -397,7 +397,7 @@ 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 05a0dd22ce010..3a9a8d6c839fb 100644
index 8a4afd4e2e6aa..db55c9c1a6125 100644
--- chrome/browser/ui/views/frame/browser_view.cc
+++ chrome/browser/ui/views/frame/browser_view.cc
@@ -351,11 +351,10 @@ using content::WebContents;
@@ -544,7 +544,7 @@ index 05a0dd22ce010..3a9a8d6c839fb 100644
return frame_->GetFrameView()->ShouldHideTopUIForFullscreen();
}
@@ -3183,7 +3224,8 @@ DownloadShelf* BrowserView::GetDownloadShelf() {
@@ -3196,7 +3237,8 @@ views::View* BrowserView::GetTopContainer() {
}
DownloadBubbleUIController* BrowserView::GetDownloadBubbleUIController() {
@@ -554,7 +554,7 @@ index 05a0dd22ce010..3a9a8d6c839fb 100644
if (auto* download_button = toolbar_button_provider_->GetDownloadButton())
return download_button->bubble_controller();
return nullptr;
@@ -3738,7 +3780,8 @@ void BrowserView::ReparentTopContainerForEndOfImmersive() {
@@ -3751,7 +3793,8 @@ void BrowserView::ReparentTopContainerForEndOfImmersive() {
if (top_container()->parent() == this)
return;
@@ -564,7 +564,7 @@ index 05a0dd22ce010..3a9a8d6c839fb 100644
top_container()->DestroyLayer();
AddChildViewAt(top_container(), 0);
EnsureFocusOrder();
@@ -4221,11 +4264,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 05a0dd22ce010..3a9a8d6c839fb 100644
// Draggable regions are defined relative to the web contents.
gfx::Point point_in_contents_web_view_coords(location);
views::View::ConvertPointToTarget(GetWidget()->GetRootView(),
@@ -4234,7 +4304,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 05a0dd22ce010..3a9a8d6c839fb 100644
point_in_contents_web_view_coords.x(),
point_in_contents_web_view_coords.y()) ||
WidgetOwnedByAnchorContainsPoint(point_in_contents_web_view_coords);
@@ -4345,8 +4415,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 05a0dd22ce010..3a9a8d6c839fb 100644
// Some of the situations when the BrowserView is laid out are:
// - Enter/exit immersive fullscreen mode.
@@ -4412,6 +4484,11 @@ void BrowserView::AddedToWidget() {
@@ -4425,6 +4497,11 @@ void BrowserView::AddedToWidget() {
SetThemeProfileForWindow(GetNativeWindow(), browser_->profile());
#endif
@@ -639,7 +639,7 @@ index 05a0dd22ce010..3a9a8d6c839fb 100644
toolbar_->Init();
// TODO(pbos): Investigate whether the side panels should be creatable when
@@ -4453,13 +4530,9 @@ void BrowserView::AddedToWidget() {
@@ -4466,13 +4543,9 @@ void BrowserView::AddedToWidget() {
EnsureFocusOrder();
@@ -655,7 +655,7 @@ index 05a0dd22ce010..3a9a8d6c839fb 100644
using_native_frame_ = frame_->ShouldUseNativeFrame();
MaybeInitializeWebUITabStrip();
@@ -4819,7 +4892,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 05a0dd22ce010..3a9a8d6c839fb 100644
}
void BrowserView::RequestFullscreen(bool fullscreen, int64_t display_id) {
@@ -5292,6 +5366,8 @@ Profile* BrowserView::GetProfile() {
@@ -5305,6 +5379,8 @@ Profile* BrowserView::GetProfile() {
}
void BrowserView::UpdateUIForTabFullscreen() {
@@ -674,7 +674,7 @@ index 05a0dd22ce010..3a9a8d6c839fb 100644
frame()->GetFrameView()->UpdateFullscreenTopUI();
}
@@ -5314,6 +5390,8 @@ void BrowserView::HideDownloadShelf() {
@@ -5327,6 +5403,8 @@ void BrowserView::HideDownloadShelf() {
}
bool BrowserView::CanUserExitFullscreen() const {
@@ -684,7 +684,7 @@ index 05a0dd22ce010..3a9a8d6c839fb 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) {

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

@@ -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_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

@@ -1,8 +1,8 @@
diff --git chrome/browser/ui/views/toolbar/app_menu.cc chrome/browser/ui/views/toolbar/app_menu.cc
index 0645d841f604c..0f5aa54288f5c 100644
index 5812efa0b52e0..7f5babea9a0fb 100644
--- chrome/browser/ui/views/toolbar/app_menu.cc
+++ chrome/browser/ui/views/toolbar/app_menu.cc
@@ -1037,7 +1037,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 ee8a71a213cf3..bd56c6f84cb3a 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 ee8a71a213cf3..bd56c6f84cb3a 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 76612bc5e9760..636f61739e9f3 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 76612bc5e9760..636f61739e9f3 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 76612bc5e9760..636f61739e9f3 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 76612bc5e9760..636f61739e9f3 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 76612bc5e9760..636f61739e9f3 100644
// Indicates whether the page has finished loading.
virtual void SetIsLoading(bool is_loading) = 0;
@@ -646,6 +660,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 76612bc5e9760..636f61739e9f3 100644
private:
FRIEND_TEST_ALL_PREFIXES(
BrowserSideFlingBrowserTest,
@@ -667,10 +685,6 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
@@ -668,10 +686,6 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
void SynchronizeVisualProperties();

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

@@ -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

@@ -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

@@ -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>

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -29,33 +29,33 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// Binary
//
IDS_BINARY_TRANSFER_HTML BINARY "..\\binary_transfer.html"
IDS_BINDING_HTML BINARY "..\\binding.html"
IDS_DIALOGS_HTML BINARY "..\\dialogs.html"
IDS_DRAGGABLE_HTML BINARY "..\\draggable.html"
IDS_HANG_HTML BINARY "..\\hang.html"
IDS_IPC_PERFORMANCE_HTML BINARY "..\\ipc_performance.html"
IDS_LOCALSTORAGE_HTML BINARY "..\\localstorage.html"
IDS_LOGO_PNG BINARY "..\\logo.png"
IDS_MEDIA_ROUTER_HTML BINARY "..\\media_router.html"
IDS_MENU_ICON_1X_PNG BINARY "..\\menu_icon.1x.png"
IDS_MENU_ICON_2X_PNG BINARY "..\\menu_icon.2x.png"
IDS_OSRTEST_HTML BINARY "..\\..\\..\\shared\\resources\\osr_test.html"
IDS_OTHER_TESTS_HTML BINARY "..\\other_tests.html"
IDS_PDF_HTML BINARY "..\\..\\..\\shared\\resources\\pdf.html"
IDS_PDF_PDF BINARY "..\\..\\..\\shared\\resources\\pdf.pdf"
IDS_PERFORMANCE_HTML BINARY "..\\performance.html"
IDS_PERFORMANCE2_HTML BINARY "..\\performance2.html"
IDS_PREFERENCES_HTML BINARY "..\\preferences.html"
IDS_RESPONSE_FILTER_HTML BINARY "..\\response_filter.html"
IDS_SERVER_HTML BINARY "..\\server.html"
IDS_TRANSPARENCY_HTML BINARY "..\\transparency.html"
IDS_URLREQUEST_HTML BINARY "..\\urlrequest.html"
IDS_WEBSOCKET_HTML BINARY "..\\websocket.html"
IDS_WINDOW_HTML BINARY "..\\window.html"
IDS_WINDOW_ICON_1X_PNG BINARY "..\\..\\..\\shared\\resources\\window_icon.1x.png"
IDS_WINDOW_ICON_2X_PNG BINARY "..\\..\\..\\shared\\resources\\window_icon.2x.png"
IDS_XMLHTTPREQUEST_HTML BINARY "..\\xmlhttprequest.html"
IDS_BINARY_TRANSFER_HTML BINARY "tests\\cefclient\\resources\\binary_transfer.html"
IDS_BINDING_HTML BINARY "tests\\cefclient\\resources\\binding.html"
IDS_DIALOGS_HTML BINARY "tests\\cefclient\\resources\\dialogs.html"
IDS_DRAGGABLE_HTML BINARY "tests\\cefclient\\resources\\draggable.html"
IDS_HANG_HTML BINARY "tests\\cefclient\\resources\\hang.html"
IDS_IPC_PERFORMANCE_HTML BINARY "tests\\cefclient\\resources\\ipc_performance.html"
IDS_LOCALSTORAGE_HTML BINARY "tests\\cefclient\\resources\\localstorage.html"
IDS_LOGO_PNG BINARY "tests\\cefclient\\resources\\logo.png"
IDS_MEDIA_ROUTER_HTML BINARY "tests\\cefclient\\resources\\media_router.html"
IDS_MENU_ICON_1X_PNG BINARY "tests\\cefclient\\resources\\menu_icon.1x.png"
IDS_MENU_ICON_2X_PNG BINARY "tests\\cefclient\\resources\\menu_icon.2x.png"
IDS_OSRTEST_HTML BINARY "tests\\shared\\resources\\osr_test.html"
IDS_OTHER_TESTS_HTML BINARY "tests\\cefclient\\resources\\other_tests.html"
IDS_PDF_HTML BINARY "tests\\shared\\resources\\pdf.html"
IDS_PDF_PDF BINARY "tests\\shared\\resources\\pdf.pdf"
IDS_PERFORMANCE_HTML BINARY "tests\\cefclient\\resources\\performance.html"
IDS_PERFORMANCE2_HTML BINARY "tests\\cefclient\\resources\\performance2.html"
IDS_PREFERENCES_HTML BINARY "tests\\cefclient\\resources\\preferences.html"
IDS_RESPONSE_FILTER_HTML BINARY "tests\\cefclient\\resources\\response_filter.html"
IDS_SERVER_HTML BINARY "tests\\cefclient\\resources\\server.html"
IDS_TRANSPARENCY_HTML BINARY "tests\\cefclient\\resources\\transparency.html"
IDS_URLREQUEST_HTML BINARY "tests\\cefclient\\resources\\urlrequest.html"
IDS_WEBSOCKET_HTML BINARY "tests\\cefclient\\resources\\websocket.html"
IDS_WINDOW_HTML BINARY "tests\\cefclient\\resources\\window.html"
IDS_WINDOW_ICON_1X_PNG BINARY "tests\\shared\\resources\\window_icon.1x.png"
IDS_WINDOW_ICON_2X_PNG BINARY "tests\\shared\\resources\\window_icon.2x.png"
IDS_XMLHTTPREQUEST_HTML BINARY "tests\\cefclient\\resources\\xmlhttprequest.html"
/////////////////////////////////////////////////////////////////////////////
//

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -13,6 +13,7 @@
'includes': [
'cefsimple_sources_common',
'cefsimple_sources_win:WINDOWS',
'cefsimple_sources_resources_win_rc:WINDOWS',
'cefsimple_sources_mac:MAC',
'cefsimple_sources_linux:LINUX',
],
@@ -115,7 +116,7 @@ if(OS_MAC)
add_dependencies(${CEF_TARGET} libcef_dll_wrapper)
target_link_libraries(${CEF_TARGET} libcef_dll_wrapper ${CEF_STANDARD_LIBS})
set_target_properties(${CEF_TARGET} PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/mac/Info.plist
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/mac/Info.plist.in
)
# Copy the CEF framework into the Frameworks directory.
@@ -145,7 +146,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}/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})
@@ -206,7 +207,7 @@ if(OS_WINDOWS)
endif()
# Add the custom manifest files to the executable.
ADD_WINDOWS_MANIFEST("${CMAKE_CURRENT_SOURCE_DIR}" "${CEF_TARGET}" "exe")
ADD_WINDOWS_MANIFEST("${CMAKE_CURRENT_SOURCE_DIR}/win" "${CEF_TARGET}" "exe")
# Copy 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

@@ -19,7 +19,9 @@
<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

@@ -18,6 +18,10 @@
<string>APPL</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>

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -1,6 +1,6 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#include "tests/cefsimple/resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
@@ -30,8 +30,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_CEFSIMPLE ICON "res\cefsimple.ico"
IDI_SMALL ICON "res\small.ico"
IDI_CEFSIMPLE ICON "cefsimple.ico"
IDI_SMALL ICON "small.ico"
#ifdef APSTUDIO_INVOKED

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -22,6 +22,7 @@
'ceftests_sources_linux:LINUX',
'ceftests_sources_mac:MAC',
'ceftests_sources_win:WINDOWS',
'ceftests_sources_resources_win_rc:WINDOWS',
],
}}
@@ -34,6 +35,7 @@
'shared_sources_mac_helper:MAC',
'shared_sources_renderer',
'ceftests_sources_mac_helper:MAC',
'ceftests_sources_mac_helper_shared:MAC',
],
}}
@@ -145,7 +147,7 @@ if(OS_MAC)
add_dependencies(${CEF_TARGET} libcef_dll_wrapper cef_gtest)
target_link_libraries(${CEF_TARGET} libcef_dll_wrapper cef_gtest ${CEF_STANDARD_LIBS})
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.
@@ -175,7 +177,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})
@@ -214,7 +216,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/"
)
@@ -246,7 +248,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

@@ -19,7 +19,9 @@
<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

@@ -18,6 +18,10 @@
<string>APPL</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>

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -29,11 +29,11 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// Binary
//
IDS_OSRTEST_HTML BINARY "..\\..\\..\\shared\\resources\\osr_test.html"
IDS_PDF_HTML BINARY "..\\..\\..\\shared\\resources\\pdf.html"
IDS_PDF_PDF BINARY "..\\..\\..\\shared\\resources\\pdf.pdf"
IDS_WINDOW_ICON_1X_PNG BINARY "..\\..\\..\\shared\\resources\\window_icon.1x.png"
IDS_WINDOW_ICON_2X_PNG BINARY "..\\..\\..\\shared\\resources\\window_icon.2x.png"
IDS_OSRTEST_HTML BINARY "tests\\shared\\resources\\osr_test.html"
IDS_PDF_HTML BINARY "tests\\shared\\resources\\pdf.html"
IDS_PDF_PDF BINARY "tests\\shared\\resources\\pdf.pdf"
IDS_WINDOW_ICON_1X_PNG BINARY "tests\\shared\\resources\\window_icon.1x.png"
IDS_WINDOW_ICON_2X_PNG BINARY "tests\\shared\\resources\\window_icon.2x.png"
/////////////////////////////////////////////////////////////////////////////
//

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

162
tools/bazel_util.py Normal file
View File

@@ -0,0 +1,162 @@
# 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.
QUIET = False
def bazel_set_quiet(quiet):
global QUIET
QUIET = quiet
LAST_ERROR = None
def bazel_last_error():
return LAST_ERROR
def _set_last_error(error):
global LAST_ERROR
LAST_ERROR = error
def _print(label, data, pos, msg):
data_to_pos = data[0:pos]
line = data_to_pos.count('\n')
pos_in_line = (pos - data_to_pos.rfind('\n') - 1) if line > 0 else pos
_set_last_error('ERROR: %s: %s at line %d:%d' % (label, msg, line + 1,
pos_in_line + 1))
if not QUIET:
print(LAST_ERROR)
def bazel_substitute(data,
variables,
var_delim_start='${',
var_delim_end='}',
path_list_delim=',\n ',
path_relative_to=None,
path_abs_prefix='//',
label='data'):
_set_last_error(None)
if not path_relative_to is None and len(path_relative_to) == 0:
path_relative_to = None
if not path_relative_to is None and path_relative_to[-1] != '/':
path_relative_to += '/'
result = ''
epos = 0
spos = data.find(var_delim_start, epos)
while spos >= 0:
result += data[epos:spos]
epos = data.find(var_delim_end, spos + len(var_delim_start))
if epos > spos:
sub = ''
var = data[spos + len(var_delim_start):epos]
if var in variables:
val = variables[var]
if isinstance(val, list):
# Assumed to be a list of file paths.
paths = []
for path in val:
if not path_relative_to is None and path.startswith(
path_relative_to):
# Use only the remainder of the path.
path = path[len(path_relative_to):]
else:
# Use a fully qualified path.
path = path_abs_prefix + path
paths.append('"%s"' % path)
sub = path_list_delim.join(paths)
else:
# Direct replacement.
sub = str(val)
else:
_print(label, data, spos,
'No value for "%s%s%s"' % (var_delim_start, var, var_delim_end))
if len(sub) > 0:
result += sub
epos += len(var_delim_end)
else:
_print(label, data, spos,
'Missing close bracket for "%s..."' % (data[spos:spos + 5]))
# Can't parse any further.
break
spos = data.find(var_delim_start, epos)
if epos >= 0:
result += data[epos:]
return result
# Test the module.
if __name__ == "__main__":
# Don't print error messages.
bazel_set_quiet(True)
# No substitution
assert (bazel_substitute('foobar', {}) == 'foobar')
assert (bazel_last_error() == None)
# No matching variable
assert (bazel_substitute('${a}foobar', {}) == 'foobar')
assert (bazel_last_error() == 'ERROR: data: No value for "${a}" at line 1:1')
assert (bazel_substitute('\nfoo${a}bar', {}) == '\nfoobar')
assert (bazel_last_error() == 'ERROR: data: No value for "${a}" at line 2:4')
assert (bazel_substitute('\n\nfoobar${a}', {}) == '\n\nfoobar')
assert (bazel_last_error() == 'ERROR: data: No value for "${a}" at line 3:7')
# Missing end bracket.
assert (bazel_substitute('${afoobar', {}) == '')
assert (bazel_last_error() ==
'ERROR: data: Missing close bracket for "${afo..." at line 1:1')
assert (bazel_substitute('\nfoo${abar', {}) == '\nfoo')
assert (bazel_last_error() ==
'ERROR: data: Missing close bracket for "${aba..." at line 2:4')
assert (bazel_substitute('\n\nfoobar${a', {}) == '\n\nfoobar')
assert (bazel_last_error() ==
'ERROR: data: Missing close bracket for "${a..." at line 3:7')
# Variable substitution
assert (bazel_substitute('foo${choo}bar', {'choo': 'blah'}) == 'fooblahbar')
assert (bazel_last_error() == None)
assert (bazel_substitute('${ah}${choo}bar${ba}',
{'ah': 'foo',
'choo': 5,
'ba': ''}) == 'foo5bar')
assert (bazel_last_error() == None)
# Custom variable delimiters.
assert (bazel_substitute(
'$$ah$$$$choo$$bar$$ba$$', {'ah': 'foo',
'choo': 5,
'ba': ''},
var_delim_start='$$',
var_delim_end='$$') == 'foo5bar')
assert (bazel_last_error() == None)
paths = [
'path/to/a.ext',
'path/to/b.ext',
'another/path/c.ext',
]
# All absolute paths.
assert (bazel_substitute('[${paths}]', {'paths': paths}, path_list_delim=',')
== '["//path/to/a.ext","//path/to/b.ext","//another/path/c.ext"]')
assert (bazel_last_error() == None)
# Some relative paths.
assert (bazel_substitute(
'[${paths}]', {'paths': paths},
path_list_delim=',',
path_relative_to='path/to') == '["a.ext","b.ext","//another/path/c.ext"]')
assert (bazel_last_error() == None)
print('Tests passed!')

View File

@@ -230,11 +230,16 @@ class VersionFormatter:
return self._get_old_version_parts()
return self._get_version_parts()
def get_short_version_string(self, oldFormat=None):
""" Returns the short CEF version number string based on current checkout
state. """
parts = self.get_version_parts(oldFormat=oldFormat)
return "%d.%d.%d" % (parts['MAJOR'], parts['MINOR'], parts['PATCH'])
def get_plist_version_string(self, oldFormat=None):
""" Returns the CEF version number string for plist files based on current
checkout state. """
parts = self.get_version_parts(oldFormat=oldFormat)
return "%d.%d.%d.0" % (parts['MAJOR'], parts['MINOR'], parts['PATCH'])
return self.get_short_version_string() + ".0"
def get_dylib_version_string(self, oldFormat=None):
""" Returns the CEF version number string for dylib files based on current

54
tools/distrib/bazel/.bazelrc Executable file
View File

@@ -0,0 +1,54 @@
# 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.
# Enable Bzlmod for every Bazel command.
common --enable_bzlmod
# Enable build:{macos,linux,windows}.
build --enable_platform_specific_config
#
# Common configuration.
#
# Build with C++17.
build:linux --cxxopt='-std=c++17'
build:macos --cxxopt='-std=c++17'
build:macos --copt='-std=c++17'
build:windows --cxxopt='/std:c++17'
#
# MacOS configuration.
#
build:macos --copt='-ObjC++'
#
# Windows configuration.
#
# Enable creation of symlinks for runfiles.
build:windows --enable_runfiles
# Use /MT[d].
build:windows --features=static_link_msvcrt
#
# Linux configuration.
#
# The cfi-icall attribute is not supported by the GNU C++ compiler.
# TODO: Move to toolchain or add `--config=[gcc|llvm]` command-line option.
build:linux --cxxopt=-Wno-attributes
# Use hardlinks instead of symlinks in sandboxes on Linux.
# This is required for CEF binaries to run, and for copy_filegroups() to work
# as expected on Linux.
build:linux --experimental_use_hermetic_linux_sandbox
build:linux --sandbox_add_mount_pair=/etc
build:linux --sandbox_add_mount_pair=/usr
## symlinks into /usr
build:linux --sandbox_add_mount_pair=/usr/bin:/bin
build:linux --sandbox_add_mount_pair=/usr/lib:/lib
build:linux --sandbox_add_mount_pair=/usr/lib64:/lib64

View File

@@ -0,0 +1 @@
7.1.1

323
tools/distrib/bazel/BUILD.bazel Executable file
View File

@@ -0,0 +1,323 @@
# 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",
])
load("@aspect_bazel_lib//lib:copy_directory.bzl", "copy_directory")
load("@bazel_skylib//lib:selects.bzl", "selects")
load("//bazel:library_helpers.bzl", "declare_cc_library", "declare_objc_library")
load("//bazel/win:variables.bzl",
WIN_DLLS="DLLS",
WIN_DLLS_X64="DLLS_X64",
WIN_SANDBOX_LIBS="SANDBOX_LIBS")
load("//bazel/linux:variables.bzl",
LINUX_SOS="SOS")
load("//bazel/mac:variables.bzl",
"CEF_FRAMEWORK_NAME")
load("@rules_cc//cc:defs.bzl", "cc_import")
#
# Define supported configurations.
# See https://bazel.build/docs/configurable-attributes
#
# Normal build (ARM64 host):
# % bazel build //tests/cefsimple [-c dbg]
#
# Cross-compile build (ARM64 host):
# % bazel build //tests/cefsimple --cpu=darwin_x86_64 [-c dbg]
#
config_setting(
name = "dbg",
values = {"compilation_mode": "dbg"},
)
config_setting(
name = "fastbuild",
values = {"compilation_mode": "fastbuild"},
)
config_setting(
name = "opt",
values = {"compilation_mode": "opt"},
)
selects.config_setting_group(
name = "windows_32",
match_all = ["@platforms//os:windows", "@platforms//cpu:x86_32"],
)
selects.config_setting_group(
name = "windows_64",
match_all = ["@platforms//os:windows", "@platforms//cpu:x86_64"],
)
selects.config_setting_group(
name = "windows_dbg",
match_all = ["@platforms//os:windows", "@cef//:dbg"],
)
selects.config_setting_group(
name = "windows_fastbuild",
match_all = ["@platforms//os:windows", "@cef//:fastbuild"],
)
selects.config_setting_group(
name = "windows_opt",
match_all = ["@platforms//os:windows", "@cef//:opt"],
)
selects.config_setting_group(
name = "linux_dbg",
match_all = ["@platforms//os:linux", "@cef//:dbg"],
)
selects.config_setting_group(
name = "linux_fastbuild",
match_all = ["@platforms//os:linux", "@cef//:fastbuild"],
)
selects.config_setting_group(
name = "linux_opt",
match_all = ["@platforms//os:linux", "@cef//:opt"],
)
selects.config_setting_group(
name = "macos_dbg",
match_all = ["@platforms//os:macos", "@cef//:dbg"],
)
selects.config_setting_group(
name = "macos_fastbuild",
match_all = ["@platforms//os:macos", "@cef//:fastbuild"],
)
selects.config_setting_group(
name = "macos_opt",
match_all = ["@platforms//os:macos", "@cef//:opt"],
)
#
# Define common build targets.
#
# Public headers for cef_wrapper here.
# Seperated from the actual cef_wrapper since the *.mm file needs access to these as well.
declare_cc_library(
name = "cef_wrapper_headers",
hdrs = glob(
[
"include/**/*.h",
],
exclude = [
"include/base/internal/**/*.*",
"include/internal/**/*.*",
],
),
)
declare_objc_library(
name = "cef_wrapper_apple",
srcs = [
"libcef_dll/wrapper/cef_library_loader_mac.mm",
],
implementation_deps = [":cef_wrapper_headers"],
)
declare_cc_library(
name = "cef_wrapper",
srcs = glob(
[
"libcef_dll/**/*.cc",
"libcef_dll/**/*.h",
"libcef_dll_wrapper/**/*.cc",
"libcef_dll_wrapper/**/*.h",
"include/base/internal/**/*.h",
"include/base/internal/**/*.inc",
"include/internal/**/*.h",
"include/test/*.h",
],
),
defines = [
"WRAPPING_CEF_SHARED",
],
deps = [":cef_wrapper_headers"] +
select({
"@platforms//os:macos": [":cef_wrapper_apple"],
"@platforms//os:windows": [":cef"],
"//conditions:default": None,
}),
# Support <angled> includes.
includes = ["./"],
)
# Only available on MacOS/Windows.
declare_cc_library(
name = "cef_sandbox_linkflags",
linkopts = select({
"@platforms//os:macos": ["-lsandbox"],
"@platforms//os:windows": [
"/DEFAULTLIB:{}".format(lib) for lib in WIN_SANDBOX_LIBS
],
"//conditions:default": [],
}),
)
cc_import(
name = "cef_sandbox_debug",
static_library = select({
"@platforms//os:macos": "Debug/cef_sandbox.a",
"@platforms//os:windows": "Debug/cef_sandbox.lib",
"//conditions:default": None,
}),
deps = [":cef_sandbox_linkflags"],
)
cc_import(
name = "cef_sandbox_release",
static_library = select({
"@platforms//os:macos": "Release/cef_sandbox.a",
"@platforms//os:windows": "Release/cef_sandbox.lib",
"//conditions:default": None,
}),
deps = [":cef_sandbox_linkflags"],
)
alias(
name = "cef_sandbox",
actual = select({
"@cef//:dbg": "@cef//:cef_sandbox_debug",
"//conditions:default": "@cef//:cef_sandbox_release",
}),
)
filegroup(
name = "dlls_opt",
srcs = ["Release/{}".format(name) for name in WIN_DLLS] +
select({
"@cef//:windows_64": ["Release/{}".format(name) for name in WIN_DLLS_X64],
"//conditions:default": None,
}),
)
filegroup(
name = "dlls_dbg",
srcs = ["Debug/{}".format(name) for name in WIN_DLLS] +
select({
"@cef//:windows_64": ["Debug/{}".format(name) for name in WIN_DLLS_X64],
"//conditions:default": None,
}),
)
alias(
name = "dlls",
actual = select({
"@cef//:dbg": "@cef//:dlls_dbg",
"//conditions:default": "@cef//:dlls_opt",
})
)
filegroup(
name = "sos_opt",
srcs = ["Release/{}".format(name) for name in LINUX_SOS],
)
filegroup(
name = "sos_dbg",
srcs = ["Debug/{}".format(name) for name in LINUX_SOS],
)
alias(
name = "sos",
actual = select({
"@cef//:dbg": "@cef//:sos_dbg",
"//conditions:default": "@cef//:sos_opt",
})
)
filegroup(
name = "resources_common",
srcs = glob([
"Resources/**",
]),
)
filegroup(
name = "resources_opt",
srcs = [
"Release/snapshot_blob.bin",
"Release/v8_context_snapshot.bin",
"Release/vk_swiftshader_icd.json",
"@cef//:resources_common",
],
)
filegroup(
name = "resources_dbg",
srcs = [
"Debug/snapshot_blob.bin",
"Debug/v8_context_snapshot.bin",
"Debug/vk_swiftshader_icd.json",
"@cef//:resources_common",
],
)
alias(
name = "resources",
actual = select({
"@cef//:opt": "@cef//:resources_opt",
"//conditions:default": "@cef//:resources_dbg",
})
)
# Only available on Linux/Windows.
cc_import(
name = "cef_dbg",
interface_library = select({
"@platforms//os:windows": "Debug/libcef.lib",
"//conditions:default": None,
}),
shared_library = select({
"@platforms//os:linux": "Debug/libcef.so",
"@platforms//os:windows": "Debug/libcef.dll",
"//conditions:default": None,
}),
)
cc_import(
name = "cef_opt",
interface_library = select({
"@platforms//os:windows": "Release/libcef.lib",
"//conditions:default": None,
}),
shared_library = select({
"@platforms//os:linux": "Release/libcef.so",
"@platforms//os:windows": "Release/libcef.dll",
"//conditions:default": None,
}),
)
alias(
name = "cef",
actual = select({
"@cef//:dbg": "@cef//:cef_dbg",
"//conditions:default": "@cef//:cef_opt",
}),
)
# 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 `copy_directory` instead of `filegroup` to remove
# the Debug/Release path prefix.
copy_directory(
name = "cef_framework",
src = select({
"@cef//:dbg": "Debug/{}.framework".format(CEF_FRAMEWORK_NAME),
"//conditions:default": "Release/{}.framework".format(CEF_FRAMEWORK_NAME),
}),
out = "{}.framework".format(CEF_FRAMEWORK_NAME),
)

View File

@@ -0,0 +1,18 @@
# 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.
module(name = "cef", version = "${version_short}")
# Configure local MacOS toolchain.
# See https://github.com/bazelbuild/apple_support/releases
bazel_dep(name = "apple_support", version = "1.16.0", repo_name = "build_bazel_apple_support")
# See https://github.com/bazelbuild/rules_apple/releases
bazel_dep(name = "rules_apple", version = "3.6.0", repo_name = "build_bazel_rules_apple")
# Configure local C++ toolchain.
# See https://github.com/bazelbuild/rules_cc/releases
bazel_dep(name = "rules_cc", version = "0.0.9")
# Add other dependencies here.
bazel_dep(name = "aspect_bazel_lib", version = "2.7.9")

55
tools/distrib/bazel/WORKSPACE Executable file
View File

@@ -0,0 +1,55 @@
# 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.
workspace(name = "cef")
#
# Windows configuration.
#
# Configure windows SDK.
load("//bazel/win:setup_sdk.bzl", "setup_sdk")
setup_sdk(name = "winsdk")
#
# Linux configuration.
#
# Configure Linux using pkg-config.
local_repository(name="pkg_config", path="bazel/linux/pkg_config")
load("@pkg_config//:pkg_config.bzl", "pkg_config")
# Define packages used by cefclient.
pkg_config(
name = "gmodule2",
pkg_name = "gmodule-2.0",
)
pkg_config(
name = "gtk3",
pkg_name = "gtk+-3.0",
)
pkg_config(
name = "gthread2",
pkg_name = "gthread-2.0",
)
pkg_config(
name = "gtkprint3",
pkg_name = "gtk+-unix-print-3.0",
)
pkg_config(
name = "xi",
)
# Define packages used by ceftests.
pkg_config(
name = "glib2",
pkg_name = "glib-2.0",
)

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.
# CEF version.
VERSION_LONG="${version_long}"
VERSION_SHORT="${version_short}"
VERSION_PLIST="${version_plist}"

View File

@@ -0,0 +1,129 @@
# 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.
PRODUCT_NAME = "cefclient"
PKG_NAME = "//tests/{}".format(PRODUCT_NAME)
# Allow access from subpackages only.
package(default_visibility = [
":__subpackages__",
])
load("//bazel:library_helpers.bzl", "declare_cc_library", "declare_objc_library")
load("@rules_cc//cc:defs.bzl", "cc_library")
#
# Source file lists.
#
srcs_common = [
${cefclient_sources_common}
]
srcs_renderer = [
${cefclient_sources_renderer}
]
srcs_browser = [
${cefclient_sources_browser}
]
srcs_browser_linux = [
${cefclient_sources_linux}
]
srcs_browser_mac = [
${cefclient_sources_mac}
]
srcs_browser_win = [
${cefclient_sources_win}
]
srcs_resources = [
${cefclient_sources_resources}
]
filegroup(
name = "Resources",
srcs = srcs_resources,
)
#
# MacOS targets.
#
declare_objc_library(
name = "BrowserLibMac",
srcs = srcs_common + srcs_browser + srcs_browser_mac,
target_compatible_with = [
"@platforms//os:macos",
],
deps = [
"//:cef_wrapper",
"//tests/shared:BrowserLibMac",
],
)
declare_objc_library(
name = "RendererLibMac",
srcs = srcs_common + srcs_renderer,
target_compatible_with = [
"@platforms//os:macos",
],
deps = [
"//:cef_wrapper",
"//tests/shared:RendererLibMac",
],
)
#
# Windows targets.
#
# Allow access to resource.h from the declare_exe target.
cc_library(
name = "ResourceH",
hdrs = [
"browser/resource.h"
]
)
# Include files directly in the declare_exe target. This simplifies the build
# configuration and avoids issues with Windows discarding symbols (like WinMain)
# when linking libraries.
filegroup(
name = "SrcsWin",
srcs = srcs_common + srcs_browser + srcs_browser_win + srcs_renderer,
target_compatible_with = [
"@platforms//os:windows",
],
)
#
# Linux targets.
#
# Include files directly in the declare_exe target. This simplifies the build
# configuration.
filegroup(
name = "SrcsLinux",
srcs = srcs_common + srcs_browser + srcs_browser_linux + srcs_renderer,
target_compatible_with = [
"@platforms//os:linux",
],
)
#
# Alias to platform-specific build targets.
#
alias(
name = PRODUCT_NAME,
actual = select({
"@platforms//os:linux": "{}/linux:{}".format(PKG_NAME, PRODUCT_NAME),
"@platforms//os:macos": "{}/mac:{}".format(PKG_NAME, PRODUCT_NAME),
"@platforms//os:windows": "{}/win:{}".format(PKG_NAME, PRODUCT_NAME),
}),
)

View File

@@ -0,0 +1,59 @@
# 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.
PRODUCT_NAME = "cefclient"
PKG_NAME = "//tests/{}".format(PRODUCT_NAME)
# Allow access from the parent package only.
package(default_visibility = [
"{}:__pkg__".format(PKG_NAME),
])
load("//bazel:copy_filegroups.bzl", "copy_filegroups")
load("//bazel/linux:exe_helpers.bzl", "declare_exe")
#
# Linux executable target.
#
# Copy resources into the current project.
copy_target = "{}_resources".format(PRODUCT_NAME)
copy_filegroups(
name = copy_target,
filegroups = [
"{}:Resources".format(PKG_NAME),
"//tests/shared:Resources",
],
remove_prefixes = [
"tests/{}/resources".format(PRODUCT_NAME),
"tests/shared/resources",
],
add_prefix = "cefclient_files",
)
declare_exe(
name = PRODUCT_NAME,
srcs = [
"{}:SrcsLinux".format(PKG_NAME),
"//tests/shared:SrcsLinux",
],
data = [
":{}".format(copy_target),
],
copts = [
"-Wno-deprecated-declarations",
],
linkopts = [
"-lGL",
],
deps = [
# Declared in the top-level WORKSPACE file.
"@gmodule2//:lib",
"@gtk3//:lib",
"@gthread2//:lib",
"@gtkprint3//:lib",
"@xi//:lib",
],
)

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