mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
37 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
a5d51ba9db | ||
|
3647d39e70 | ||
|
dca51c71fd | ||
|
c23cfb8b01 | ||
|
1e880c56ed | ||
|
239742e877 | ||
|
f6393726b4 | ||
|
162c3d60df | ||
|
b281f7aefd | ||
|
61241e4482 | ||
|
169fea9e41 | ||
|
047d3a0b4e | ||
|
300bb055bb | ||
|
c7c4ac95b1 | ||
|
4fc5399f88 | ||
|
5e718e01a0 | ||
|
64eb12c9c4 | ||
|
ecbe1244cb | ||
|
d9c1887429 | ||
|
5c56e98fc6 | ||
|
2be337fb12 | ||
|
7e5ee97d2e | ||
|
6090afb12e | ||
|
3cd94714f7 | ||
|
69b959514c | ||
|
e14495b5cb | ||
|
4771bb7ee4 | ||
|
8e0c2ff1d1 | ||
|
caf18bdadb | ||
|
59e700b0f0 | ||
|
4042303cd8 | ||
|
87d1d2a7f3 | ||
|
ecea6cc6e9 | ||
|
8af4558412 | ||
|
20a659fa66 | ||
|
34de39aac8 | ||
|
8abe66c2b2 |
36
BUILD.gn
36
BUILD.gn
@@ -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/mac/cefclient.icns",
|
||||
"tests/cefclient/resources/mac/cefclient.icns",
|
||||
]
|
||||
|
||||
outputs = [
|
||||
@@ -1978,7 +1978,7 @@ if (is_mac) {
|
||||
|
||||
bundle_data("cefclient_resources_bundle_data_english") {
|
||||
sources = [
|
||||
"tests/cefclient/mac/English.lproj/InfoPlist.strings",
|
||||
"tests/cefclient/resources/mac/English.lproj/InfoPlist.strings",
|
||||
]
|
||||
|
||||
outputs = [
|
||||
@@ -1988,7 +1988,7 @@ if (is_mac) {
|
||||
|
||||
mac_xib_bundle_data("cefclient_xibs") {
|
||||
sources = [
|
||||
"tests/cefclient/mac/English.lproj/MainMenu.xib",
|
||||
"tests/cefclient/resources/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/mac/helper-Info.plist.in"
|
||||
helper_info_plist = "tests/cefclient/resources/mac/helper-Info.plist"
|
||||
helper_sources = includes_common +
|
||||
includes_mac +
|
||||
gypi_paths2.includes_wrapper +
|
||||
@@ -2012,7 +2012,7 @@ if (is_mac) {
|
||||
"CEF_USE_SANDBOX",
|
||||
]
|
||||
|
||||
info_plist = "tests/cefclient/mac/Info.plist.in"
|
||||
info_plist = "tests/cefclient/resources/mac/Info.plist"
|
||||
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.in"
|
||||
helper_info_plist = "tests/cefsimple/mac/helper-Info.plist"
|
||||
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.in"
|
||||
info_plist = "tests/cefsimple/mac/Info.plist"
|
||||
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/mac/ceftests.icns",
|
||||
"tests/ceftests/resources/mac/ceftests.icns",
|
||||
]
|
||||
|
||||
outputs = [
|
||||
@@ -2121,7 +2121,7 @@ if (is_mac) {
|
||||
|
||||
bundle_data("ceftests_resources_bundle_data_english") {
|
||||
sources = [
|
||||
"tests/ceftests/mac/English.lproj/InfoPlist.strings",
|
||||
"tests/ceftests/resources/mac/English.lproj/InfoPlist.strings",
|
||||
]
|
||||
|
||||
outputs = [
|
||||
@@ -2131,7 +2131,7 @@ if (is_mac) {
|
||||
|
||||
mac_xib_bundle_data("ceftests_xibs") {
|
||||
sources = [
|
||||
"tests/ceftests/mac/English.lproj/MainMenu.xib",
|
||||
"tests/ceftests/resources/mac/English.lproj/MainMenu.xib",
|
||||
]
|
||||
output_path = "{{bundle_resources_dir}}/English.lproj"
|
||||
}
|
||||
@@ -2139,12 +2139,11 @@ if (is_mac) {
|
||||
cef_app("ceftests") {
|
||||
testonly = true
|
||||
|
||||
helper_info_plist = "tests/ceftests/mac/helper-Info.plist.in"
|
||||
helper_info_plist = "tests/ceftests/resources/mac/helper-Info.plist"
|
||||
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_shared
|
||||
gypi_paths2.ceftests_sources_mac_helper
|
||||
helper_deps = [
|
||||
":gtest_teamcity",
|
||||
"//testing/gtest",
|
||||
@@ -2157,7 +2156,7 @@ if (is_mac) {
|
||||
"CEF_TESTS_IN_SRC_DIRECTORY",
|
||||
]
|
||||
|
||||
info_plist = "tests/ceftests/mac/Info.plist.in"
|
||||
info_plist = "tests/ceftests/resources/mac/Info.plist"
|
||||
sources = includes_common +
|
||||
includes_mac +
|
||||
gypi_paths2.includes_wrapper +
|
||||
@@ -2242,8 +2241,7 @@ if (is_mac) {
|
||||
if (is_win) {
|
||||
sources += includes_win +
|
||||
gypi_paths2.shared_sources_win +
|
||||
gypi_paths2.cefclient_sources_win +
|
||||
gypi_paths2.cefclient_sources_resources_win_rc
|
||||
gypi_paths2.cefclient_sources_win
|
||||
|
||||
# Set /SUBSYSTEM:WINDOWS.
|
||||
configs -= [ "//build/config/win:console" ]
|
||||
@@ -2339,8 +2337,7 @@ if (is_mac) {
|
||||
|
||||
if (is_win) {
|
||||
sources += includes_win +
|
||||
gypi_paths2.cefsimple_sources_win +
|
||||
gypi_paths2.cefsimple_sources_resources_win_rc
|
||||
gypi_paths2.cefsimple_sources_win
|
||||
|
||||
# Set /SUBSYSTEM:WINDOWS.
|
||||
configs -= [ "//build/config/win:console" ]
|
||||
@@ -2415,8 +2412,7 @@ if (is_mac) {
|
||||
|
||||
if (is_win) {
|
||||
sources += gypi_paths2.shared_sources_win +
|
||||
gypi_paths2.ceftests_sources_win +
|
||||
gypi_paths2.ceftests_sources_resources_win_rc
|
||||
gypi_paths2.ceftests_sources_win
|
||||
|
||||
# Delay-load as many DLLs as possible for sandbox and startup perf
|
||||
# improvements.
|
||||
|
@@ -7,6 +7,6 @@
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'refs/tags/127.0.6533.120',
|
||||
'depot_tools_checkout': '22f6c9d8e9'
|
||||
'chromium_checkout': 'refs/tags/126.0.6478.183',
|
||||
'depot_tools_checkout': 'fca881606e'
|
||||
}
|
||||
|
@@ -1,8 +0,0 @@
|
||||
# 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",
|
||||
])
|
@@ -1,65 +0,0 @@
|
||||
# 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 = ""),
|
||||
},
|
||||
)
|
||||
|
@@ -1,90 +0,0 @@
|
||||
# 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
|
||||
)
|
@@ -1,8 +0,0 @@
|
||||
# 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",
|
||||
])
|
@@ -1,63 +0,0 @@
|
||||
# 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"],
|
||||
)
|
||||
|
@@ -1,41 +0,0 @@
|
||||
# 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),
|
||||
},
|
||||
)
|
||||
|
@@ -1,7 +0,0 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
exports_files([
|
||||
"pkg_config.bzl",
|
||||
"BUILD.tmpl",
|
||||
])
|
||||
|
@@ -1,32 +0,0 @@
|
||||
# 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}",
|
||||
)
|
||||
|
@@ -1,11 +0,0 @@
|
||||
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.
|
||||
|
@@ -1,2 +0,0 @@
|
||||
workspace(name = "pkg_config")
|
||||
|
@@ -1,194 +0,0 @@
|
||||
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,
|
||||
)
|
||||
|
@@ -1,68 +0,0 @@
|
||||
# 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",
|
||||
]
|
||||
|
@@ -1,8 +0,0 @@
|
||||
# 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",
|
||||
])
|
@@ -1,113 +0,0 @@
|
||||
# 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,
|
||||
)
|
@@ -1,52 +0,0 @@
|
||||
# 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",
|
||||
]
|
@@ -1,8 +0,0 @@
|
||||
# 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",
|
||||
])
|
@@ -1,33 +0,0 @@
|
||||
# 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
|
@@ -1,82 +0,0 @@
|
||||
# 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"],
|
||||
)
|
@@ -1,72 +0,0 @@
|
||||
# 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(),
|
||||
)
|
@@ -1,50 +0,0 @@
|
||||
# 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(),
|
||||
)
|
@@ -1,124 +0,0 @@
|
||||
# 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,
|
||||
)
|
@@ -1,199 +0,0 @@
|
||||
# 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",
|
||||
]
|
@@ -1,69 +0,0 @@
|
||||
# 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
|
@@ -242,7 +242,6 @@
|
||||
'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',
|
||||
@@ -371,14 +370,12 @@
|
||||
'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/win/cefclient.exe.manifest',
|
||||
'tests/cefclient/win/cefclient.ico',
|
||||
'tests/cefclient/win/small.ico',
|
||||
],
|
||||
'cefclient_sources_resources_win_rc': [
|
||||
'tests/cefclient/win/cefclient.rc',
|
||||
'tests/cefclient/resources/win/cefclient.exe.manifest',
|
||||
'tests/cefclient/resources/win/cefclient.ico',
|
||||
'tests/cefclient/resources/win/small.ico',
|
||||
],
|
||||
'cefclient_sources_mac': [
|
||||
'tests/cefclient/browser/browser_window_osr_mac.h',
|
||||
@@ -401,12 +398,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/mac/cefclient.icns',
|
||||
'tests/cefclient/mac/English.lproj/InfoPlist.strings',
|
||||
'tests/cefclient/mac/English.lproj/MainMenu.xib',
|
||||
'tests/cefclient/mac/Info.plist.in',
|
||||
'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',
|
||||
],
|
||||
'cefclient_sources_linux': [
|
||||
'tests/cefclient/browser/browser_window_osr_gtk.cc',
|
||||
@@ -438,17 +435,15 @@
|
||||
'tests/cefsimple/simple_handler.h',
|
||||
],
|
||||
'cefsimple_sources_win': [
|
||||
'tests/cefsimple/cefsimple.rc',
|
||||
'tests/cefsimple/cefsimple_win.cc',
|
||||
'tests/cefsimple/resource.h',
|
||||
'tests/cefsimple/simple_handler_win.cc',
|
||||
'tests/cefsimple/resource.h',
|
||||
],
|
||||
'cefsimple_sources_resources_win': [
|
||||
'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',
|
||||
'tests/cefsimple/cefsimple.exe.manifest',
|
||||
'tests/cefsimple/res/cefsimple.ico',
|
||||
'tests/cefsimple/res/small.ico',
|
||||
],
|
||||
'cefsimple_sources_mac': [
|
||||
'tests/cefsimple/cefsimple_mac.mm',
|
||||
@@ -461,7 +456,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.in',
|
||||
'tests/cefsimple/mac/Info.plist',
|
||||
],
|
||||
'cefsimple_sources_linux': [
|
||||
'tests/cefsimple/cefsimple_linux.cc',
|
||||
@@ -579,32 +574,24 @@
|
||||
'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/win/ceftests.exe.manifest',
|
||||
'tests/ceftests/win/ceftests.ico',
|
||||
'tests/ceftests/win/small.ico',
|
||||
],
|
||||
'ceftests_sources_resources_win_rc': [
|
||||
'tests/ceftests/win/ceftests.rc',
|
||||
'tests/ceftests/resources/win/ceftests.exe.manifest',
|
||||
'tests/ceftests/resources/win/ceftests.ico',
|
||||
'tests/ceftests/resources/win/small.ico',
|
||||
],
|
||||
'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_browser_shared': [
|
||||
'tests/shared/renderer/client_app_renderer.h',
|
||||
],
|
||||
'ceftests_sources_mac_helper_shared': [
|
||||
'tests/shared/browser/client_app_browser.h',
|
||||
'ceftests_sources_mac_helper': [
|
||||
'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',
|
||||
@@ -660,10 +647,10 @@
|
||||
'tests/ceftests/v8_unittest.cc',
|
||||
],
|
||||
'ceftests_bundle_resources_mac': [
|
||||
'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',
|
||||
'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',
|
||||
],
|
||||
'ceftests_sources_linux': [
|
||||
'tests/ceftests/resource_util_linux.cc',
|
||||
|
@@ -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 "d3709fcbd6630817b73287083d5440bffffcfb0b"
|
||||
#define CEF_API_HASH_UNIVERSAL "ed1dfa5ff8a041241f8fb72eb7454811f358f0d3"
|
||||
#if defined(OS_WIN)
|
||||
#define CEF_API_HASH_PLATFORM "2e66390b5f0fa21ab4667b503e76164037cd674e"
|
||||
#define CEF_API_HASH_PLATFORM "0d99d1b9b85b2efab91a39d6fc325bb6d56fd524"
|
||||
#elif defined(OS_MAC)
|
||||
#define CEF_API_HASH_PLATFORM "94ce56bc6f289ae039ca7db2ac8d32901e71a4e1"
|
||||
#define CEF_API_HASH_PLATFORM "e585e190387e31a71267207b66d175e213991470"
|
||||
#elif defined(OS_LINUX)
|
||||
#define CEF_API_HASH_PLATFORM "2fda6a422c06b87a4ce47bdfd4c985346f1eaab8"
|
||||
#define CEF_API_HASH_PLATFORM "09d3e280ed38f7a082b794c56ff71c52f86f0ea8"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -514,13 +514,6 @@ 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;
|
||||
|
||||
///
|
||||
|
@@ -438,12 +438,12 @@ typedef enum {
|
||||
|
||||
/// Website setting which is used for UnusedSitePermissionsService to store
|
||||
/// auto-revoked notification permissions from abusive sites.
|
||||
CEF_CONTENT_SETTING_TYPE_REVOKED_ABUSIVE_NOTIFICATION_PERMISSIONS,
|
||||
REVOKED_ABUSIVE_NOTIFICATION_PERMISSIONS,
|
||||
|
||||
/// Content setting that controls tracking protection status per site.
|
||||
/// BLOCK: Protections enabled. This is the default state.
|
||||
/// ALLOW: Protections disabled.
|
||||
CEF_CONTENT_SETTING_TYPE_TRACKING_PROTECTION,
|
||||
TRACKING_PROTECTION,
|
||||
} cef_content_setting_types_t;
|
||||
|
||||
///
|
||||
|
@@ -437,10 +437,6 @@ 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
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -34,7 +34,6 @@
|
||||
#include "cef/libcef/features/runtime.h"
|
||||
#include "chrome/browser/file_select_helper.h"
|
||||
#include "chrome/browser/picture_in_picture/picture_in_picture_window_manager.h"
|
||||
#include "components/input/native_web_keyboard_event.h"
|
||||
#include "components/zoom/page_zoom.h"
|
||||
#include "content/browser/gpu/compositor_util.h"
|
||||
#include "content/public/browser/desktop_media_id.h"
|
||||
@@ -47,6 +46,7 @@
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/render_widget_host.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/common/input/native_web_keyboard_event.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "net/base/net_errors.h"
|
||||
@@ -1084,13 +1084,13 @@ void AlloyBrowserHostImpl::CanDownload(
|
||||
|
||||
KeyboardEventProcessingResult AlloyBrowserHostImpl::PreHandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const input::NativeWebKeyboardEvent& event) {
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
return contents_delegate_->PreHandleKeyboardEvent(source, event);
|
||||
}
|
||||
|
||||
bool AlloyBrowserHostImpl::HandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const input::NativeWebKeyboardEvent& event) {
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
// Check to see if event should be ignored.
|
||||
if (event.skip_if_unhandled) {
|
||||
return false;
|
||||
@@ -1138,8 +1138,8 @@ void AlloyBrowserHostImpl::GetCustomWebContentsView(
|
||||
const GURL& target_url,
|
||||
int opener_render_process_id,
|
||||
int opener_render_frame_id,
|
||||
raw_ptr<content::WebContentsView>* view,
|
||||
raw_ptr<content::RenderViewHostDelegateView>* delegate_view) {
|
||||
content::WebContentsView** view,
|
||||
content::RenderViewHostDelegateView** delegate_view) {
|
||||
CefBrowserInfoManager::GetInstance()->GetCustomWebContentsView(
|
||||
target_url,
|
||||
frame_util::MakeGlobalId(opener_render_process_id,
|
||||
@@ -1297,8 +1297,7 @@ void AlloyBrowserHostImpl::ExitPictureInPicture() {
|
||||
PictureInPictureWindowManager::GetInstance()->ExitPictureInPicture();
|
||||
}
|
||||
|
||||
bool AlloyBrowserHostImpl::IsBackForwardCacheSupported(
|
||||
content::WebContents& web_contents) {
|
||||
bool AlloyBrowserHostImpl::IsBackForwardCacheSupported() {
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
return true;
|
||||
#else
|
||||
|
@@ -222,9 +222,10 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
base::OnceCallback<void(bool)> callback) override;
|
||||
content::KeyboardEventProcessingResult PreHandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const input::NativeWebKeyboardEvent& event) override;
|
||||
bool HandleKeyboardEvent(content::WebContents* source,
|
||||
const input::NativeWebKeyboardEvent& event) override;
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
bool HandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
bool PreHandleGestureEvent(content::WebContents* source,
|
||||
const blink::WebGestureEvent& event) override;
|
||||
@@ -237,8 +238,8 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
const GURL& target_url,
|
||||
int opener_render_process_id,
|
||||
int opener_render_frame_id,
|
||||
raw_ptr<content::WebContentsView>* view,
|
||||
raw_ptr<content::RenderViewHostDelegateView>* delegate_view) override;
|
||||
content::WebContentsView** view,
|
||||
content::RenderViewHostDelegateView** delegate_view) override;
|
||||
void WebContentsCreated(content::WebContents* source_contents,
|
||||
int opener_render_process_id,
|
||||
int opener_render_frame_id,
|
||||
@@ -288,7 +289,7 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
content::PictureInPictureResult EnterPictureInPicture(
|
||||
content::WebContents* web_contents) override;
|
||||
void ExitPictureInPicture() override;
|
||||
bool IsBackForwardCacheSupported(content::WebContents& web_contents) override;
|
||||
bool IsBackForwardCacheSupported() override;
|
||||
content::PreloadingEligibility IsPrerender2Supported(
|
||||
content::WebContents& web_contents) override;
|
||||
void DraggableRegionsChanged(
|
||||
|
@@ -361,15 +361,10 @@ const extensions::Extension* GetEnabledExtensionFromSiteURL(
|
||||
|
||||
std::unique_ptr<blink::URLLoaderThrottle> CreateGoogleURLLoaderThrottle(
|
||||
Profile* profile) {
|
||||
#if BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS)
|
||||
std::vector<chrome::mojom::BoundSessionThrottlerParamsPtr>
|
||||
bound_session_throttler_params;
|
||||
#endif
|
||||
|
||||
chrome::mojom::DynamicParamsPtr dynamic_params =
|
||||
chrome::mojom::DynamicParams::New(
|
||||
#if BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS)
|
||||
std::move(bound_session_throttler_params),
|
||||
/*bound_session_params=*/nullptr,
|
||||
#endif
|
||||
profile->GetPrefs()->GetBoolean(
|
||||
policy::policy_prefs::kForceGoogleSafeSearch),
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include "cef/libcef/common/cef_switches.h"
|
||||
#include "cef/libcef/common/extensions/extensions_client.h"
|
||||
#include "cef/libcef/common/extensions/extensions_util.h"
|
||||
#include "chrome/browser/browser_features.h"
|
||||
#include "chrome/browser/component_updater/chrome_component_updater_configurator.h"
|
||||
#include "chrome/browser/net/system_network_context_manager.h"
|
||||
#include "chrome/browser/permissions/chrome_permissions_client.h"
|
||||
@@ -91,12 +92,16 @@ void ChromeBrowserProcessAlloy::OnContextInitialized() {
|
||||
providers;
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// The DPAPI key provider requires OSCrypt::Init to have already been called
|
||||
// to initialize the key storage. This happens in
|
||||
// AlloyBrowserMainParts::PreCreateMainMessageLoop.
|
||||
providers.emplace_back(std::make_pair(
|
||||
/*precedence=*/10u,
|
||||
std::make_unique<os_crypt_async::DPAPIKeyProvider>(local_state())));
|
||||
// TODO(crbug.com/1373092): For Windows, continue to add providers behind
|
||||
// features, as support for them is added.
|
||||
if (base::FeatureList::IsEnabled(features::kEnableDPAPIEncryptionProvider)) {
|
||||
// The DPAPI key provider requires OSCrypt::Init to have already been called
|
||||
// to initialize the key storage. This happens in
|
||||
// AlloyBrowserMainParts::PreCreateMainMessageLoop.
|
||||
providers.emplace_back(std::make_pair(
|
||||
/*precedence=*/10u,
|
||||
std::make_unique<os_crypt_async::DPAPIKeyProvider>(local_state())));
|
||||
}
|
||||
#endif // BUILDFLAG(IS_WIN)
|
||||
|
||||
os_crypt_async_ =
|
||||
|
@@ -37,17 +37,30 @@ class CefVariationsClient : public variations::VariationsClient {
|
||||
|
||||
} // namespace
|
||||
|
||||
ChromeProfileAlloy::ChromeProfileAlloy() : Profile(nullptr) {
|
||||
// Alloy contexts are never flagged as off-the-record. It causes problems
|
||||
// for the extension system.
|
||||
DCHECK(!IsOffTheRecord());
|
||||
|
||||
ChromeProfileAlloy::ChromeProfileAlloy() {
|
||||
profile_metrics::SetBrowserProfileType(
|
||||
this, profile_metrics::BrowserProfileType::kRegular);
|
||||
}
|
||||
|
||||
ChromeProfileAlloy::~ChromeProfileAlloy() = default;
|
||||
|
||||
bool ChromeProfileAlloy::IsOffTheRecord() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ChromeProfileAlloy::IsOffTheRecord() const {
|
||||
// Alloy contexts are never flagged as off-the-record. It causes problems
|
||||
// for the extension system.
|
||||
return false;
|
||||
}
|
||||
|
||||
const Profile::OTRProfileID& ChromeProfileAlloy::GetOTRProfileID() const {
|
||||
DCHECK(false);
|
||||
static base::NoDestructor<Profile::OTRProfileID> otr_profile_id(
|
||||
Profile::OTRProfileID::PrimaryID());
|
||||
return *otr_profile_id;
|
||||
}
|
||||
|
||||
variations::VariationsClient* ChromeProfileAlloy::GetVariationsClient() {
|
||||
if (!variations_client_) {
|
||||
variations_client_ = std::make_unique<CefVariationsClient>(this);
|
||||
|
@@ -25,6 +25,9 @@ class ChromeProfileAlloy : public Profile {
|
||||
|
||||
protected:
|
||||
// Profile methods.
|
||||
bool IsOffTheRecord() override;
|
||||
bool IsOffTheRecord() const override;
|
||||
const OTRProfileID& GetOTRProfileID() const override;
|
||||
variations::VariationsClient* GetVariationsClient() override;
|
||||
scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner() override;
|
||||
std::string GetProfileUserName() const override;
|
||||
|
@@ -495,9 +495,6 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
url_loader_factory.get(), request_id);
|
||||
loaders_.insert(std::move(resource_loader));
|
||||
return;
|
||||
} else if (*method == "getHostConfig") {
|
||||
SendMessageAck(request_id, {});
|
||||
return;
|
||||
} else if (*method == "getPreferences") {
|
||||
SendMessageAck(request_id,
|
||||
GetPrefs()->GetDict(prefs::kDevToolsPreferences).Clone());
|
||||
|
@@ -12,7 +12,6 @@
|
||||
#include "cef/libcef/common/frame_util.h"
|
||||
#include "chrome/browser/ui/views/sad_tab_view.h"
|
||||
#include "chrome/common/chrome_result_codes.h"
|
||||
#include "components/input/native_web_keyboard_event.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||
#include "content/public/browser/focused_node_details.h"
|
||||
#include "content/public/browser/keyboard_event_processing_result.h"
|
||||
@@ -22,6 +21,7 @@
|
||||
#include "content/public/browser/render_widget_host.h"
|
||||
#include "content/public/browser/render_widget_host_observer.h"
|
||||
#include "content/public/browser/render_widget_host_view.h"
|
||||
#include "content/public/common/input/native_web_keyboard_event.h"
|
||||
#include "services/network/public/mojom/url_response_head.mojom.h"
|
||||
#include "third_party/blink/public/mojom/favicon/favicon_url.mojom.h"
|
||||
#include "third_party/blink/public/mojom/input/focus_type.mojom-blink.h"
|
||||
@@ -247,7 +247,7 @@ void CefBrowserContentsDelegate::CanDownload(
|
||||
KeyboardEventProcessingResult
|
||||
CefBrowserContentsDelegate::PreHandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const input::NativeWebKeyboardEvent& event) {
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
if (auto delegate = platform_delegate()) {
|
||||
if (auto c = client()) {
|
||||
if (auto handler = c->GetKeyboardHandler()) {
|
||||
@@ -274,7 +274,7 @@ CefBrowserContentsDelegate::PreHandleKeyboardEvent(
|
||||
|
||||
bool CefBrowserContentsDelegate::HandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const input::NativeWebKeyboardEvent& event) {
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
// Check to see if event should be ignored.
|
||||
if (event.skip_if_unhandled) {
|
||||
return false;
|
||||
|
@@ -105,9 +105,10 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
|
||||
base::OnceCallback<void(bool)> callback) override;
|
||||
content::KeyboardEventProcessingResult PreHandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const input::NativeWebKeyboardEvent& event) override;
|
||||
bool HandleKeyboardEvent(content::WebContents* source,
|
||||
const input::NativeWebKeyboardEvent& event) override;
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
bool HandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
void DraggableRegionsChanged(
|
||||
const std::vector<blink::mojom::DraggableRegionPtr>& regions,
|
||||
content::WebContents* contents) override;
|
||||
|
@@ -590,7 +590,7 @@ CefBrowserInfo::NotificationStateLock::NotificationStateLock(
|
||||
|
||||
// Take the browser info state lock.
|
||||
browser_info_lock_scope_ =
|
||||
std::make_unique<base::MovableAutoLock>(browser_info_->lock_);
|
||||
std::make_unique<base::AutoLock>(browser_info_->lock_);
|
||||
}
|
||||
|
||||
CefBrowserInfo::NotificationStateLock::~NotificationStateLock() {
|
||||
|
@@ -221,7 +221,7 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
friend class CefBrowserInfo;
|
||||
const raw_ptr<CefBrowserInfo> browser_info_;
|
||||
CefRefPtr<CefFrameHandler> frame_handler_;
|
||||
std::unique_ptr<base::MovableAutoLock> browser_info_lock_scope_;
|
||||
std::unique_ptr<base::AutoLock> browser_info_lock_scope_;
|
||||
std::queue<FrameNotifyOnceAction> queue_;
|
||||
};
|
||||
|
||||
|
@@ -228,8 +228,8 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
||||
void CefBrowserInfoManager::GetCustomWebContentsView(
|
||||
const GURL& target_url,
|
||||
const content::GlobalRenderFrameHostId& opener_global_id,
|
||||
raw_ptr<content::WebContentsView>* view,
|
||||
raw_ptr<content::RenderViewHostDelegateView>* delegate_view) {
|
||||
content::WebContentsView** view,
|
||||
content::RenderViewHostDelegateView** delegate_view) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
auto pending_popup = PopPendingPopup(PendingPopup::CAN_CREATE_WINDOW,
|
||||
|
@@ -87,8 +87,8 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
void GetCustomWebContentsView(
|
||||
const GURL& target_url,
|
||||
const content::GlobalRenderFrameHostId& opener_global_id,
|
||||
raw_ptr<content::WebContentsView>* view,
|
||||
raw_ptr<content::RenderViewHostDelegateView>* delegate_view);
|
||||
content::WebContentsView** view,
|
||||
content::RenderViewHostDelegateView** delegate_view);
|
||||
|
||||
// Called from WebContentsDelegate::WebContentsCreated. See comments on
|
||||
// PendingPopup for more information.
|
||||
|
@@ -34,7 +34,10 @@ class MessagePumpExternal : public base::MessagePumpForUI {
|
||||
#endif
|
||||
|
||||
base::TimeTicks next_run_time; // is_null()
|
||||
DirectRunWork(delegate, &next_run_time);
|
||||
const bool has_more_work = DirectRunWork(delegate, &next_run_time);
|
||||
if (!has_more_work) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (next_run_time.is_null()) {
|
||||
// We have more work that should run immediately.
|
||||
@@ -60,9 +63,10 @@ class MessagePumpExternal : public base::MessagePumpForUI {
|
||||
}
|
||||
|
||||
private:
|
||||
static void DirectRunWork(Delegate* delegate,
|
||||
static bool DirectRunWork(Delegate* delegate,
|
||||
base::TimeTicks* next_run_time) {
|
||||
bool more_immediate_work = false;
|
||||
bool more_idle_work = false;
|
||||
bool more_delayed_work = false;
|
||||
|
||||
Delegate::NextWorkInfo next_work_info = delegate->DoWork();
|
||||
@@ -81,8 +85,11 @@ class MessagePumpExternal : public base::MessagePumpForUI {
|
||||
}
|
||||
|
||||
if (!more_immediate_work && !more_delayed_work) {
|
||||
delegate->DoIdleWork();
|
||||
// DoIdleWork() returns true if idle work was all done.
|
||||
more_idle_work = !delegate->DoIdleWork();
|
||||
}
|
||||
|
||||
return more_immediate_work || more_idle_work || more_delayed_work;
|
||||
}
|
||||
|
||||
const float max_time_slice_;
|
||||
|
@@ -85,8 +85,8 @@ content::WebContents* CefBrowserPlatformDelegate::CreateWebContents(
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::CreateViewForWebContents(
|
||||
raw_ptr<content::WebContentsView>* view,
|
||||
raw_ptr<content::RenderViewHostDelegateView>* delegate_view) {
|
||||
content::WebContentsView** view,
|
||||
content::RenderViewHostDelegateView** delegate_view) {
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
@@ -345,7 +345,7 @@ void CefBrowserPlatformDelegate::ViewText(const std::string& text) {
|
||||
}
|
||||
|
||||
bool CefBrowserPlatformDelegate::HandleKeyboardEvent(
|
||||
const input::NativeWebKeyboardEvent& event) {
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
DCHECK(false);
|
||||
return false;
|
||||
}
|
||||
@@ -369,7 +369,7 @@ void CefBrowserPlatformDelegate::HandleExternalProtocol(const GURL& url) {
|
||||
}
|
||||
|
||||
CefEventHandle CefBrowserPlatformDelegate::GetEventHandle(
|
||||
const input::NativeWebKeyboardEvent& event) const {
|
||||
const content::NativeWebKeyboardEvent& event) const {
|
||||
DCHECK(false);
|
||||
return kNullEventHandle;
|
||||
}
|
||||
|
@@ -42,6 +42,7 @@ class WindowFeatures;
|
||||
|
||||
namespace content {
|
||||
struct DropData;
|
||||
struct NativeWebKeyboardEvent;
|
||||
class RenderViewHost;
|
||||
class RenderViewHostDelegateView;
|
||||
class RenderWidgetHostImpl;
|
||||
@@ -64,10 +65,6 @@ class Size;
|
||||
class Vector2d;
|
||||
} // namespace gfx
|
||||
|
||||
namespace input {
|
||||
struct NativeWebKeyboardEvent;
|
||||
}
|
||||
|
||||
namespace ui {
|
||||
struct AXLocationChanges;
|
||||
struct AXUpdatesAndEvents;
|
||||
@@ -111,8 +108,8 @@ class CefBrowserPlatformDelegate {
|
||||
// called a single time per instance. May be called on multiple threads. Only
|
||||
// used with windowless rendering.
|
||||
virtual void CreateViewForWebContents(
|
||||
raw_ptr<content::WebContentsView>* view,
|
||||
raw_ptr<content::RenderViewHostDelegateView>* delegate_view);
|
||||
content::WebContentsView** view,
|
||||
content::RenderViewHostDelegateView** delegate_view);
|
||||
|
||||
// Called after the WebContents for a browser has been created. |owned| will
|
||||
// be true if |web_contents| was created via CreateWebContents() and we should
|
||||
@@ -291,7 +288,8 @@ class CefBrowserPlatformDelegate {
|
||||
|
||||
// Forward the keyboard event to the application or frame window to allow
|
||||
// processing of shortcut keys.
|
||||
virtual bool HandleKeyboardEvent(const input::NativeWebKeyboardEvent& event);
|
||||
virtual bool HandleKeyboardEvent(
|
||||
const content::NativeWebKeyboardEvent& event);
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
// See WebContentsDelegate documentation.
|
||||
@@ -307,7 +305,7 @@ class CefBrowserPlatformDelegate {
|
||||
|
||||
// Returns the OS event handle, if any, associated with |event|.
|
||||
virtual CefEventHandle GetEventHandle(
|
||||
const input::NativeWebKeyboardEvent& event) const;
|
||||
const content::NativeWebKeyboardEvent& event) const;
|
||||
|
||||
// Create the platform-specific JavaScript dialog runner.
|
||||
virtual std::unique_ptr<CefJavaScriptDialogRunner>
|
||||
|
@@ -4,11 +4,11 @@
|
||||
|
||||
#include "cef/libcef/browser/browser_util.h"
|
||||
|
||||
#include "components/input/native_web_keyboard_event.h"
|
||||
#include "content/public/common/input/native_web_keyboard_event.h"
|
||||
|
||||
namespace browser_util {
|
||||
|
||||
bool GetCefKeyEvent(const input::NativeWebKeyboardEvent& event,
|
||||
bool GetCefKeyEvent(const content::NativeWebKeyboardEvent& event,
|
||||
CefKeyEvent& cef_event) {
|
||||
switch (event.GetType()) {
|
||||
case blink::WebKeyboardEvent::Type::kRawKeyDown:
|
||||
@@ -66,7 +66,7 @@ bool GetCefKeyEvent(const input::NativeWebKeyboardEvent& event,
|
||||
}
|
||||
|
||||
bool GetCefKeyEvent(const ui::KeyEvent& event, CefKeyEvent& cef_event) {
|
||||
input::NativeWebKeyboardEvent native_event(event);
|
||||
content::NativeWebKeyboardEvent native_event(event);
|
||||
return GetCefKeyEvent(native_event, cef_event);
|
||||
}
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "cef/include/internal/cef_types_wrappers.h"
|
||||
|
||||
namespace input {
|
||||
namespace content {
|
||||
struct NativeWebKeyboardEvent;
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ class KeyEvent;
|
||||
|
||||
namespace browser_util {
|
||||
|
||||
// Convert a input::NativeWebKeyboardEvent to a CefKeyEvent.
|
||||
bool GetCefKeyEvent(const input::NativeWebKeyboardEvent& event,
|
||||
// Convert a content::NativeWebKeyboardEvent to a CefKeyEvent.
|
||||
bool GetCefKeyEvent(const content::NativeWebKeyboardEvent& event,
|
||||
CefKeyEvent& cef_event);
|
||||
|
||||
// Convert a ui::KeyEvent to a CefKeyEvent.
|
||||
|
@@ -164,14 +164,13 @@ 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 false. Return false to cancel the navigation
|
||||
// or true to proceed with default chrome handling.
|
||||
virtual bool OpenURLFromTabEx(
|
||||
// if the return value is non-nullptr.
|
||||
virtual content::WebContents* OpenURLFromTabEx(
|
||||
content::WebContents* source,
|
||||
const content::OpenURLParams& params,
|
||||
base::OnceCallback<void(content::NavigationHandle&)>&
|
||||
navigation_handle_callback) {
|
||||
return true;
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -114,7 +114,7 @@ void CefBrowserPlatformDelegateChrome::ViewText(const std::string& text) {
|
||||
}
|
||||
|
||||
CefEventHandle CefBrowserPlatformDelegateChrome::GetEventHandle(
|
||||
const input::NativeWebKeyboardEvent& event) const {
|
||||
const content::NativeWebKeyboardEvent& event) const {
|
||||
return native_delegate_->GetEventHandle(event);
|
||||
}
|
||||
|
||||
|
@@ -42,7 +42,7 @@ class CefBrowserPlatformDelegateChrome
|
||||
bool want_dip_coords) const override;
|
||||
void ViewText(const std::string& text) override;
|
||||
CefEventHandle GetEventHandle(
|
||||
const input::NativeWebKeyboardEvent& event) const override;
|
||||
const content::NativeWebKeyboardEvent& event) const override;
|
||||
bool IsAlloyStyle() const override { return false; }
|
||||
|
||||
// CefBrowserPlatformDelegateNative::WindowlessHandler methods:
|
||||
|
@@ -25,12 +25,12 @@
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/ui/browser.h"
|
||||
#include "chrome/browser/ui/browser_tabstrip.h"
|
||||
#include "components/input/native_web_keyboard_event.h"
|
||||
#include "content/public/browser/global_routing_id.h"
|
||||
#include "content/public/browser/keyboard_event_processing_result.h"
|
||||
#include "content/public/browser/navigation_handle.h"
|
||||
#include "content/public/browser/render_widget_host.h"
|
||||
#include "content/public/browser/render_widget_host_view.h"
|
||||
#include "content/public/common/input/native_web_keyboard_event.h"
|
||||
#include "third_party/blink/public/mojom/page/draggable_region.mojom.h"
|
||||
|
||||
using content::KeyboardEventProcessingResult;
|
||||
@@ -527,7 +527,7 @@ void ChromeBrowserDelegate::WebContentsCreated(
|
||||
/*is_devtools_popup=*/false, opener);
|
||||
}
|
||||
|
||||
bool ChromeBrowserDelegate::OpenURLFromTabEx(
|
||||
content::WebContents* ChromeBrowserDelegate::OpenURLFromTabEx(
|
||||
content::WebContents* source,
|
||||
const content::OpenURLParams& params,
|
||||
base::OnceCallback<void(content::NavigationHandle&)>&
|
||||
@@ -536,31 +536,17 @@ bool 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();
|
||||
}
|
||||
if (!source) {
|
||||
LOG(WARNING) << "Failed to identify target browser for "
|
||||
<< params.url.spec();
|
||||
// Proceed with default chrome handling.
|
||||
return true;
|
||||
DCHECK(source);
|
||||
}
|
||||
|
||||
// Return nullptr to cancel the navigation. Otherwise, proceed with default
|
||||
// chrome handling.
|
||||
if (auto delegate = GetDelegateForWebContents(source)) {
|
||||
// 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 delegate->OpenURLFromTabEx(source, params,
|
||||
navigation_handle_callback);
|
||||
}
|
||||
|
||||
// Proceed with default chrome handling.
|
||||
return true;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ChromeBrowserDelegate::LoadingStateChanged(content::WebContents* source,
|
||||
@@ -645,7 +631,7 @@ ChromeBrowserDelegate::GetJavaScriptDialogManager(
|
||||
|
||||
KeyboardEventProcessingResult ChromeBrowserDelegate::PreHandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const input::NativeWebKeyboardEvent& event) {
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
if (auto delegate = GetDelegateForWebContents(source)) {
|
||||
return delegate->PreHandleKeyboardEvent(source, event);
|
||||
}
|
||||
@@ -654,7 +640,7 @@ KeyboardEventProcessingResult ChromeBrowserDelegate::PreHandleKeyboardEvent(
|
||||
|
||||
bool ChromeBrowserDelegate::HandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const input::NativeWebKeyboardEvent& event) {
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
if (auto delegate = GetDelegateForWebContents(source)) {
|
||||
return delegate->HandleKeyboardEvent(source, event);
|
||||
}
|
||||
|
@@ -90,10 +90,11 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
|
||||
const std::optional<SkRegion> GetDraggableRegion() const override;
|
||||
void WindowFullscreenStateChanged() override;
|
||||
bool HasViewsHostedOpener() const override;
|
||||
bool OpenURLFromTabEx(content::WebContents* source,
|
||||
const content::OpenURLParams& params,
|
||||
base::OnceCallback<void(content::NavigationHandle&)>&
|
||||
navigation_handle_callback) override;
|
||||
content::WebContents* 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,
|
||||
@@ -121,9 +122,10 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
|
||||
content::WebContents* source) override;
|
||||
content::KeyboardEventProcessingResult PreHandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const input::NativeWebKeyboardEvent& event) override;
|
||||
bool HandleKeyboardEvent(content::WebContents* source,
|
||||
const input::NativeWebKeyboardEvent& event) override;
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
bool HandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
void DraggableRegionsChanged(
|
||||
const std::vector<blink::mojom::DraggableRegionPtr>& regions,
|
||||
content::WebContents* contents) override;
|
||||
|
@@ -103,28 +103,13 @@ base::FilePath NormalizePath(const cef_string_t& path_str,
|
||||
path = path.StripTrailingSeparators();
|
||||
}
|
||||
|
||||
if (!path.empty()) {
|
||||
if (!path.IsAbsolute()) {
|
||||
LOG(ERROR) << "The " << name << " directory (" << path.value()
|
||||
<< ") is not an absolute path. Defaulting to empty.";
|
||||
if (has_error) {
|
||||
*has_error = true;
|
||||
}
|
||||
return base::FilePath();
|
||||
if (!path.empty() && !path.IsAbsolute()) {
|
||||
LOG(ERROR) << "The " << name << " directory (" << path.value()
|
||||
<< ") is not an absolute path. Defaulting to empty.";
|
||||
if (has_error) {
|
||||
*has_error = true;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(IS_POSIX)
|
||||
// Always resolve symlinks to absolute paths. This avoids issues with
|
||||
// mismatched paths when mixing Chromium and OS filesystem functions.
|
||||
// See https://crbug.com/40229712.
|
||||
base::ScopedAllowBlockingForTesting allow_blocking;
|
||||
const base::FilePath& resolved_path = base::MakeAbsoluteFilePath(path);
|
||||
if (!resolved_path.empty()) {
|
||||
return resolved_path;
|
||||
} else if (errno != 0 && errno != ENOENT) {
|
||||
PLOG(ERROR) << "realpath(" << path.value() << ") failed";
|
||||
}
|
||||
#endif // BUILDFLAG(IS_POSIX)
|
||||
path = base::FilePath();
|
||||
}
|
||||
|
||||
return path;
|
||||
|
@@ -93,13 +93,13 @@ void CefBrowserPlatformDelegateBackground::ViewText(const std::string& text) {
|
||||
}
|
||||
|
||||
bool CefBrowserPlatformDelegateBackground::HandleKeyboardEvent(
|
||||
const input::NativeWebKeyboardEvent& event) {
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
// Nothing to do here.
|
||||
return false;
|
||||
}
|
||||
|
||||
CefEventHandle CefBrowserPlatformDelegateBackground::GetEventHandle(
|
||||
const input::NativeWebKeyboardEvent& event) const {
|
||||
const content::NativeWebKeyboardEvent& event) const {
|
||||
return native_delegate_->GetEventHandle(event);
|
||||
}
|
||||
|
||||
|
@@ -37,9 +37,10 @@ class CefBrowserPlatformDelegateBackground
|
||||
gfx::Point GetScreenPoint(const gfx::Point& view,
|
||||
bool want_dip_coords) const override;
|
||||
void ViewText(const std::string& text) override;
|
||||
bool HandleKeyboardEvent(const input::NativeWebKeyboardEvent& event) override;
|
||||
bool HandleKeyboardEvent(
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
CefEventHandle GetEventHandle(
|
||||
const input::NativeWebKeyboardEvent& event) const override;
|
||||
const content::NativeWebKeyboardEvent& event) const override;
|
||||
std::unique_ptr<CefMenuRunner> CreateMenuRunner() override;
|
||||
|
||||
// CefBrowserPlatformDelegateNative::WindowlessHandler methods:
|
||||
|
@@ -40,6 +40,7 @@ const char* const kSupportedAPIs[] = {
|
||||
ContentSettingsContentSettingGetResourceIdentifiersFunction),
|
||||
"pdfViewerPrivate",
|
||||
EXTENSION_FUNCTION_NAME(PdfViewerPrivateIsAllowedLocalFileAccessFunction),
|
||||
EXTENSION_FUNCTION_NAME(PdfViewerPrivateIsPdfOcrAlwaysActiveFunction),
|
||||
"resourcesPrivate",
|
||||
EXTENSION_FUNCTION_NAME(ResourcesPrivateGetStringsFunction),
|
||||
"storage",
|
||||
@@ -88,6 +89,7 @@ void ChromeFunctionRegistry::RegisterAll(ExtensionFunctionRegistry* registry) {
|
||||
ContentSettingsContentSettingGetResourceIdentifiersFunction>();
|
||||
registry
|
||||
->RegisterFunction<PdfViewerPrivateIsAllowedLocalFileAccessFunction>();
|
||||
registry->RegisterFunction<PdfViewerPrivateIsPdfOcrAlwaysActiveFunction>();
|
||||
registry->RegisterFunction<ResourcesPrivateGetStringsFunction>();
|
||||
registry->RegisterFunction<StorageStorageAreaGetFunction>();
|
||||
registry->RegisterFunction<StorageStorageAreaSetFunction>();
|
||||
|
@@ -10,10 +10,10 @@
|
||||
#include "extensions/browser/process_util.h"
|
||||
#include "third_party/blink/public/common/input/web_gesture_event.h"
|
||||
|
||||
using content::NativeWebKeyboardEvent;
|
||||
using content::OpenURLParams;
|
||||
using content::WebContents;
|
||||
using content::WebContentsObserver;
|
||||
using input::NativeWebKeyboardEvent;
|
||||
|
||||
namespace extensions {
|
||||
|
||||
|
@@ -277,13 +277,7 @@ bool CefMainRunner::Initialize(CefSettings* settings,
|
||||
this, settings, application);
|
||||
|
||||
exit_code_ =
|
||||
ContentMainInitialize(args, windows_sandbox_info, &settings->no_sandbox,
|
||||
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID)
|
||||
settings->disable_signal_handlers
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
);
|
||||
ContentMainInitialize(args, windows_sandbox_info, &settings->no_sandbox);
|
||||
if (exit_code_ >= 0) {
|
||||
LOG(ERROR) << "ContentMainInitialize failed with exit code " << exit_code_;
|
||||
return false;
|
||||
@@ -435,8 +429,7 @@ int CefMainRunner::RunAsHelperProcess(const CefMainArgs& args,
|
||||
|
||||
int CefMainRunner::ContentMainInitialize(const CefMainArgs& args,
|
||||
void* windows_sandbox_info,
|
||||
int* no_sandbox,
|
||||
bool disable_signal_handlers) {
|
||||
int* no_sandbox) {
|
||||
main_delegate_->BeforeMainThreadInitialize(args);
|
||||
|
||||
// Initialize the content runner.
|
||||
@@ -459,10 +452,6 @@ 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());
|
||||
}
|
||||
|
@@ -60,9 +60,7 @@ class CefMainRunner : public CefMainRunnerHandler {
|
||||
// Called from Initialize().
|
||||
int ContentMainInitialize(const CefMainArgs& args,
|
||||
void* windows_sandbox_info,
|
||||
int* no_sandbox,
|
||||
bool disable_signal_handlers);
|
||||
|
||||
int* no_sandbox);
|
||||
int ContentMainRun(bool* initialized, base::OnceClosure context_initialized);
|
||||
|
||||
// CefMainRunnerHandler methods:
|
||||
|
@@ -34,7 +34,7 @@ class CefBrowserPlatformDelegateNative
|
||||
void WasResized() override;
|
||||
|
||||
// Translate CEF events to Chromium/Blink Web events.
|
||||
virtual input::NativeWebKeyboardEvent TranslateWebKeyEvent(
|
||||
virtual content::NativeWebKeyboardEvent TranslateWebKeyEvent(
|
||||
const CefKeyEvent& key_event) const = 0;
|
||||
virtual blink::WebMouseEvent TranslateWebClickEvent(
|
||||
const CefMouseEvent& mouse_event,
|
||||
|
@@ -101,10 +101,10 @@ gfx::Point CefBrowserPlatformDelegateNativeAura::GetScreenPoint(
|
||||
return screen_pt;
|
||||
}
|
||||
|
||||
input::NativeWebKeyboardEvent
|
||||
content::NativeWebKeyboardEvent
|
||||
CefBrowserPlatformDelegateNativeAura::TranslateWebKeyEvent(
|
||||
const CefKeyEvent& key_event) const {
|
||||
return input::NativeWebKeyboardEvent(TranslateUiKeyEvent(key_event));
|
||||
return content::NativeWebKeyboardEvent(TranslateUiKeyEvent(key_event));
|
||||
}
|
||||
|
||||
blink::WebMouseEvent
|
||||
|
@@ -41,7 +41,7 @@ class CefBrowserPlatformDelegateNativeAura
|
||||
bool want_dip_coords) const override;
|
||||
|
||||
// CefBrowserPlatformDelegateNative methods:
|
||||
input::NativeWebKeyboardEvent TranslateWebKeyEvent(
|
||||
content::NativeWebKeyboardEvent TranslateWebKeyEvent(
|
||||
const CefKeyEvent& key_event) const override;
|
||||
blink::WebMouseEvent TranslateWebClickEvent(
|
||||
const CefMouseEvent& mouse_event,
|
||||
|
@@ -9,9 +9,9 @@
|
||||
#include "cef/libcef/browser/context.h"
|
||||
#include "cef/libcef/browser/native/window_delegate_view.h"
|
||||
#include "cef/libcef/browser/thread_util.h"
|
||||
#include "components/input/native_web_keyboard_event.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/common/input/native_web_keyboard_event.h"
|
||||
#include "third_party/blink/public/mojom/renderer_preferences.mojom.h"
|
||||
#include "ui/events/keycodes/dom/dom_key.h"
|
||||
#include "ui/events/keycodes/dom/keycode_converter.h"
|
||||
@@ -227,13 +227,13 @@ void CefBrowserPlatformDelegateNativeLinux::ViewText(const std::string& text) {
|
||||
}
|
||||
|
||||
bool CefBrowserPlatformDelegateNativeLinux::HandleKeyboardEvent(
|
||||
const input::NativeWebKeyboardEvent& event) {
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
// TODO(cef): Is something required here to handle shortcut keys?
|
||||
return false;
|
||||
}
|
||||
|
||||
CefEventHandle CefBrowserPlatformDelegateNativeLinux::GetEventHandle(
|
||||
const input::NativeWebKeyboardEvent& event) const {
|
||||
const content::NativeWebKeyboardEvent& event) const {
|
||||
// TODO(cef): We need to return an XEvent* from this method, but
|
||||
// |event.os_event->native_event()| now returns a ui::Event* instead.
|
||||
// See https://crbug.com/965991.
|
||||
@@ -285,12 +285,12 @@ ui::KeyEvent CefBrowserPlatformDelegateNativeLinux::TranslateUiKeyEvent(
|
||||
return ui::KeyEvent(type, key_code, dom_code, flags, dom_key, time_stamp);
|
||||
}
|
||||
|
||||
input::NativeWebKeyboardEvent
|
||||
content::NativeWebKeyboardEvent
|
||||
CefBrowserPlatformDelegateNativeLinux::TranslateWebKeyEvent(
|
||||
const CefKeyEvent& key_event) const {
|
||||
ui::KeyEvent ui_event = TranslateUiKeyEvent(key_event);
|
||||
if (key_event.type == KEYEVENT_CHAR) {
|
||||
return input::NativeWebKeyboardEvent(ui_event, key_event.character);
|
||||
return content::NativeWebKeyboardEvent(ui_event, key_event.character);
|
||||
}
|
||||
return input::NativeWebKeyboardEvent(ui_event);
|
||||
return content::NativeWebKeyboardEvent(ui_event);
|
||||
}
|
||||
|
@@ -30,13 +30,14 @@ class CefBrowserPlatformDelegateNativeLinux
|
||||
void NotifyMoveOrResizeStarted() override;
|
||||
void SizeTo(int width, int height) override;
|
||||
void ViewText(const std::string& text) override;
|
||||
bool HandleKeyboardEvent(const input::NativeWebKeyboardEvent& event) override;
|
||||
bool HandleKeyboardEvent(
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
CefEventHandle GetEventHandle(
|
||||
const input::NativeWebKeyboardEvent& event) const override;
|
||||
const content::NativeWebKeyboardEvent& event) const override;
|
||||
|
||||
// CefBrowserPlatformDelegateNativeAura methods:
|
||||
ui::KeyEvent TranslateUiKeyEvent(const CefKeyEvent& key_event) const override;
|
||||
input::NativeWebKeyboardEvent TranslateWebKeyEvent(
|
||||
content::NativeWebKeyboardEvent TranslateWebKeyEvent(
|
||||
const CefKeyEvent& key_event) const override;
|
||||
|
||||
private:
|
||||
|
@@ -43,16 +43,17 @@ class CefBrowserPlatformDelegateNativeMac
|
||||
gfx::Point GetScreenPoint(const gfx::Point& view,
|
||||
bool want_dip_coords) const override;
|
||||
void ViewText(const std::string& text) override;
|
||||
bool HandleKeyboardEvent(const input::NativeWebKeyboardEvent& event) override;
|
||||
bool HandleKeyboardEvent(
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
CefEventHandle GetEventHandle(
|
||||
const input::NativeWebKeyboardEvent& event) const override;
|
||||
const content::NativeWebKeyboardEvent& event) const override;
|
||||
std::unique_ptr<CefJavaScriptDialogRunner> CreateJavaScriptDialogRunner()
|
||||
override;
|
||||
std::unique_ptr<CefMenuRunner> CreateMenuRunner() override;
|
||||
bool IsPrintPreviewSupported() const override;
|
||||
|
||||
// CefBrowserPlatformDelegateNative methods:
|
||||
input::NativeWebKeyboardEvent TranslateWebKeyEvent(
|
||||
content::NativeWebKeyboardEvent TranslateWebKeyEvent(
|
||||
const CefKeyEvent& key_event) const override;
|
||||
blink::WebMouseEvent TranslateWebClickEvent(
|
||||
const CefMouseEvent& mouse_event,
|
||||
|
@@ -17,10 +17,10 @@
|
||||
#include "cef/libcef/browser/native/javascript_dialog_runner_mac.h"
|
||||
#include "cef/libcef/browser/native/menu_runner_mac.h"
|
||||
#include "cef/libcef/browser/thread_util.h"
|
||||
#include "components/input/native_web_keyboard_event.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_view_mac.h"
|
||||
#include "content/public/browser/render_widget_host_view.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/common/input/native_web_keyboard_event.h"
|
||||
#include "third_party/blink/public/common/input/web_input_event.h"
|
||||
#include "third_party/blink/public/common/input/web_mouse_event.h"
|
||||
#include "third_party/blink/public/common/input/web_mouse_wheel_event.h"
|
||||
@@ -360,7 +360,7 @@ void CefBrowserPlatformDelegateNativeMac::SendKeyEvent(
|
||||
return;
|
||||
}
|
||||
|
||||
input::NativeWebKeyboardEvent web_event = TranslateWebKeyEvent(event);
|
||||
content::NativeWebKeyboardEvent web_event = TranslateWebKeyEvent(event);
|
||||
view->ForwardKeyboardEvent(web_event, ui::LatencyInfo());
|
||||
}
|
||||
|
||||
@@ -450,7 +450,7 @@ void CefBrowserPlatformDelegateNativeMac::ViewText(const std::string& text) {
|
||||
}
|
||||
|
||||
bool CefBrowserPlatformDelegateNativeMac::HandleKeyboardEvent(
|
||||
const input::NativeWebKeyboardEvent& event) {
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
// Give the top level menu equivalents a chance to handle the event.
|
||||
NSEvent* ns_event = event.os_event.Get();
|
||||
if (ns_event.type == NSEventTypeKeyDown) {
|
||||
@@ -460,7 +460,7 @@ bool CefBrowserPlatformDelegateNativeMac::HandleKeyboardEvent(
|
||||
}
|
||||
|
||||
CefEventHandle CefBrowserPlatformDelegateNativeMac::GetEventHandle(
|
||||
const input::NativeWebKeyboardEvent& event) const {
|
||||
const content::NativeWebKeyboardEvent& event) const {
|
||||
return CAST_NSEVENT_TO_CEF_EVENT_HANDLE(event.os_event.Get());
|
||||
}
|
||||
|
||||
@@ -481,10 +481,10 @@ bool CefBrowserPlatformDelegateNativeMac::IsPrintPreviewSupported() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
input::NativeWebKeyboardEvent
|
||||
content::NativeWebKeyboardEvent
|
||||
CefBrowserPlatformDelegateNativeMac::TranslateWebKeyEvent(
|
||||
const CefKeyEvent& key_event) const {
|
||||
input::NativeWebKeyboardEvent result(
|
||||
content::NativeWebKeyboardEvent result(
|
||||
blink::WebInputEvent::Type::kUndefined,
|
||||
blink::WebInputEvent::Modifiers::kNoModifiers, ui::EventTimeForNow());
|
||||
|
||||
@@ -533,8 +533,8 @@ CefBrowserPlatformDelegateNativeMac::TranslateWebKeyEvent(
|
||||
isARepeat:NO
|
||||
keyCode:key_event.native_key_code];
|
||||
|
||||
result =
|
||||
input::NativeWebKeyboardEvent(base::apple::OwnedNSEvent(synthetic_event));
|
||||
result = content::NativeWebKeyboardEvent(
|
||||
base::apple::OwnedNSEvent(synthetic_event));
|
||||
if (key_event.type == KEYEVENT_CHAR) {
|
||||
result.SetType(blink::WebInputEvent::Type::kChar);
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
#include "cef/libcef/browser/geometry_util.h"
|
||||
#include "cef/libcef/browser/native/window_delegate_view.h"
|
||||
#include "cef/libcef/browser/thread_util.h"
|
||||
#include "components/input/native_web_keyboard_event.h"
|
||||
#include "content/public/common/input/native_web_keyboard_event.h"
|
||||
#include "third_party/blink/public/common/input/web_mouse_event.h"
|
||||
#include "third_party/blink/public/common/input/web_mouse_wheel_event.h"
|
||||
#include "ui/aura/window.h"
|
||||
@@ -375,7 +375,7 @@ void CefBrowserPlatformDelegateNativeWin::ViewText(const std::string& text) {
|
||||
}
|
||||
|
||||
bool CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent(
|
||||
const input::NativeWebKeyboardEvent& event) {
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
// Any unhandled keyboard/character messages are sent to DefWindowProc so that
|
||||
// shortcut keys work correctly.
|
||||
if (event.os_event) {
|
||||
@@ -409,7 +409,7 @@ bool CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent(
|
||||
UINT scan_code = ::MapVirtualKeyW(event.windows_key_code, MAPVK_VK_TO_VSC);
|
||||
msg.lParam = (scan_code << 16) | // key scan code
|
||||
1; // key repeat count
|
||||
if (event.GetModifiers() & input::NativeWebKeyboardEvent::kAltKey) {
|
||||
if (event.GetModifiers() & content::NativeWebKeyboardEvent::kAltKey) {
|
||||
msg.lParam |= (1 << 29);
|
||||
}
|
||||
|
||||
@@ -418,7 +418,7 @@ bool CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent(
|
||||
}
|
||||
|
||||
CefEventHandle CefBrowserPlatformDelegateNativeWin::GetEventHandle(
|
||||
const input::NativeWebKeyboardEvent& event) const {
|
||||
const content::NativeWebKeyboardEvent& event) const {
|
||||
if (!event.os_event) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@@ -29,9 +29,10 @@ class CefBrowserPlatformDelegateNativeWin
|
||||
void NotifyMoveOrResizeStarted() override;
|
||||
void SizeTo(int width, int height) override;
|
||||
void ViewText(const std::string& text) override;
|
||||
bool HandleKeyboardEvent(const input::NativeWebKeyboardEvent& event) override;
|
||||
bool HandleKeyboardEvent(
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
CefEventHandle GetEventHandle(
|
||||
const input::NativeWebKeyboardEvent& event) const override;
|
||||
const content::NativeWebKeyboardEvent& event) const override;
|
||||
|
||||
// CefBrowserPlatformDelegateNativeAura methods:
|
||||
ui::KeyEvent TranslateUiKeyEvent(const CefKeyEvent& key_event) const override;
|
||||
|
@@ -37,8 +37,7 @@ void CefWindowDelegateView::Init(gfx::AcceleratedWidget parent_widget,
|
||||
// See CalculateWindowStylesFromInitParams in
|
||||
// ui/views/widget/widget_hwnd_utils.cc for the conversion of |params| to
|
||||
// Windows style flags.
|
||||
views::Widget::InitParams params(
|
||||
views::Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET);
|
||||
views::Widget::InitParams params;
|
||||
params.parent_widget = parent_widget;
|
||||
params.bounds = bounds;
|
||||
params.delegate = this;
|
||||
|
@@ -301,7 +301,8 @@ void SaveCookies(const CefBrowserContext::Getter& browser_context_getter,
|
||||
std::unique_ptr<net::CanonicalCookie> cookie = net::CanonicalCookie::Create(
|
||||
request.url, cookie_string, base::Time::Now(),
|
||||
std::make_optional(response_date),
|
||||
/*cookie_partition_key=*/std::nullopt, net::CookieSourceType::kHTTP,
|
||||
/*cookie_partition_key=*/std::nullopt,
|
||||
/*block_truncated=*/true, net::CookieSourceType::kHTTP,
|
||||
&returned_status);
|
||||
if (!returned_status.IsInclude()) {
|
||||
continue;
|
||||
|
@@ -95,16 +95,14 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
|
||||
void Reset(CefRefPtr<CefResourceRequestHandler> handler,
|
||||
CefRefPtr<CefSchemeHandlerFactory> scheme_factory,
|
||||
CefRefPtr<CefRequestImpl> pending_request,
|
||||
network::ResourceRequest* request,
|
||||
CefRefPtr<CefRequestImpl> request,
|
||||
bool request_was_redirected,
|
||||
CancelRequestCallback cancel_callback) {
|
||||
handler_ = handler;
|
||||
scheme_factory_ = scheme_factory;
|
||||
cookie_filter_ = nullptr;
|
||||
pending_request_ = pending_request;
|
||||
pending_request_ = request;
|
||||
pending_response_ = nullptr;
|
||||
request_ = request;
|
||||
request_was_redirected_ = request_was_redirected;
|
||||
was_custom_handled_ = false;
|
||||
cancel_callback_ = std::move(cancel_callback);
|
||||
@@ -115,7 +113,6 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
CefRefPtr<CefCookieAccessFilter> cookie_filter_;
|
||||
CefRefPtr<CefRequestImpl> pending_request_;
|
||||
CefRefPtr<CefResponseImpl> pending_response_;
|
||||
raw_ptr<network::ResourceRequest> request_;
|
||||
bool request_was_redirected_ = false;
|
||||
bool was_custom_handled_ = false;
|
||||
bool accept_language_added_ = false;
|
||||
@@ -143,11 +140,11 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
void Run(InterceptedRequestHandlerWrapper* self) {
|
||||
self->OnBeforeRequest(id_, request_, request_was_redirected_,
|
||||
std::move(callback_), std::move(cancel_callback_));
|
||||
request_ = nullptr;
|
||||
}
|
||||
|
||||
const int32_t id_;
|
||||
raw_ptr<network::ResourceRequest, DisableDanglingPtrDetection> request_;
|
||||
const raw_ptr<network::ResourceRequest, DisableDanglingPtrDetection>
|
||||
request_;
|
||||
const bool request_was_redirected_;
|
||||
OnBeforeRequestResultCallback callback_;
|
||||
CancelRequestCallback cancel_callback_;
|
||||
@@ -572,8 +569,8 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
}
|
||||
|
||||
// May have a handler and/or scheme factory.
|
||||
state->Reset(handler, scheme_factory, requestPtr, request,
|
||||
request_was_redirected, std::move(cancel_callback));
|
||||
state->Reset(handler, scheme_factory, requestPtr, request_was_redirected,
|
||||
std::move(cancel_callback));
|
||||
|
||||
if (handler) {
|
||||
state->cookie_filter_ = handler->GetCookieAccessFilter(
|
||||
@@ -590,15 +587,16 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
MaybeLoadCookies(request_id, state, std::move(exec_callback));
|
||||
MaybeLoadCookies(request_id, state, request, std::move(exec_callback));
|
||||
}
|
||||
|
||||
void MaybeLoadCookies(int32_t request_id,
|
||||
RequestState* state,
|
||||
network::ResourceRequest* request,
|
||||
base::OnceClosure callback) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
if (!cookie_helper::IsCookieableScheme(state->request_->url,
|
||||
if (!cookie_helper::IsCookieableScheme(request->url,
|
||||
init_state_->cookieable_schemes_)) {
|
||||
// The scheme does not support cookies.
|
||||
std::move(callback).Run();
|
||||
@@ -616,9 +614,10 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
&InterceptedRequestHandlerWrapper::AllowCookieAlways);
|
||||
auto done_cookie_callback = base::BindOnce(
|
||||
&InterceptedRequestHandlerWrapper::ContinueWithLoadedCookies,
|
||||
weak_ptr_factory_.GetWeakPtr(), request_id, std::move(callback));
|
||||
cookie_helper::LoadCookies(init_state_->browser_context_getter_,
|
||||
*(state->request_), allow_cookie_callback,
|
||||
weak_ptr_factory_.GetWeakPtr(), request_id,
|
||||
base::UnsafeDanglingUntriaged(request), std::move(callback));
|
||||
cookie_helper::LoadCookies(init_state_->browser_context_getter_, *request,
|
||||
allow_cookie_callback,
|
||||
std::move(done_cookie_callback));
|
||||
}
|
||||
|
||||
@@ -650,6 +649,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
}
|
||||
|
||||
void ContinueWithLoadedCookies(int32_t request_id,
|
||||
network::ResourceRequest* request,
|
||||
base::OnceClosure callback,
|
||||
int total_count,
|
||||
net::CookieList allowed_cookies) {
|
||||
@@ -666,14 +666,13 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
// Also add/save cookies ourselves for default-handled network requests
|
||||
// so that we can filter them. This will be a no-op for custom-handled
|
||||
// requests.
|
||||
state->request_->load_flags |= kLoadNoCookiesFlags;
|
||||
request->load_flags |= kLoadNoCookiesFlags;
|
||||
}
|
||||
|
||||
if (!allowed_cookies.empty()) {
|
||||
const std::string& cookie_line =
|
||||
net::CanonicalCookie::BuildCookieLine(allowed_cookies);
|
||||
state->request_->headers.SetHeader(net::HttpRequestHeaders::kCookie,
|
||||
cookie_line);
|
||||
request->headers.SetHeader(net::HttpRequestHeaders::kCookie, cookie_line);
|
||||
|
||||
state->pending_request_->SetReadOnly(false);
|
||||
state->pending_request_->SetHeaderByName(net::HttpRequestHeaders::kCookie,
|
||||
@@ -709,7 +708,8 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
CefRefPtr<RequestCallbackWrapper> callbackPtr =
|
||||
new RequestCallbackWrapper(base::BindOnce(
|
||||
&InterceptedRequestHandlerWrapper::ContinueShouldInterceptRequest,
|
||||
weak_ptr_factory_.GetWeakPtr(), request_id, std::move(callback)));
|
||||
weak_ptr_factory_.GetWeakPtr(), request_id,
|
||||
base::Unretained(request), std::move(callback)));
|
||||
|
||||
cef_return_value_t retval = state->handler_->OnBeforeResourceLoad(
|
||||
init_state_->browser_, init_state_->frame_,
|
||||
@@ -725,12 +725,14 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
}
|
||||
} else {
|
||||
// The scheme factory may choose to handle it.
|
||||
ContinueShouldInterceptRequest(request_id, std::move(callback), true);
|
||||
ContinueShouldInterceptRequest(request_id, request, std::move(callback),
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
void ContinueShouldInterceptRequest(
|
||||
int32_t request_id,
|
||||
network::ResourceRequest* request,
|
||||
ShouldInterceptRequestResultCallback callback,
|
||||
bool allow) {
|
||||
CEF_REQUIRE_IOT();
|
||||
@@ -749,7 +751,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
if (state->handler_) {
|
||||
if (allow) {
|
||||
// Apply any |requestPtr| changes to |request|.
|
||||
state->pending_request_->Get(state->request_, true /* changed_only */);
|
||||
state->pending_request_->Get(request, true /* changed_only */);
|
||||
}
|
||||
|
||||
const bool redirect =
|
||||
@@ -788,8 +790,8 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
if (!resource_handler && state->scheme_factory_) {
|
||||
// Does the scheme factory want to handle the request?
|
||||
resource_handler = state->scheme_factory_->Create(
|
||||
init_state_->browser_, init_state_->frame_,
|
||||
state->request_->url.scheme(), state->pending_request_.get());
|
||||
init_state_->browser_, init_state_->frame_, request->url.scheme(),
|
||||
state->pending_request_.get());
|
||||
}
|
||||
|
||||
std::unique_ptr<ResourceResponse> resource_response;
|
||||
@@ -801,8 +803,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
// The request will be handled by the NetworkService. Remove the
|
||||
// "Accept-Language" header here so that it can be re-added in
|
||||
// URLRequestHttpJob::AddExtraHeaders with correct ordering applied.
|
||||
state->request_->headers.RemoveHeader(
|
||||
net::HttpRequestHeaders::kAcceptLanguage);
|
||||
request->headers.RemoveHeader(net::HttpRequestHeaders::kAcceptLanguage);
|
||||
}
|
||||
|
||||
// Continue the request.
|
||||
@@ -859,7 +860,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
if (!state->handler_) {
|
||||
// Cookies may come from a scheme handler.
|
||||
MaybeSaveCookies(
|
||||
request_id, state, headers,
|
||||
request_id, state, request, headers,
|
||||
base::BindOnce(
|
||||
std::move(callback), ResponseMode::CONTINUE, nullptr,
|
||||
redirect_info.has_value() ? redirect_info->new_url : GURL()));
|
||||
@@ -870,15 +871,16 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
DCHECK(state->pending_response_);
|
||||
|
||||
if (redirect_info.has_value()) {
|
||||
HandleRedirect(request_id, state, headers, *redirect_info,
|
||||
HandleRedirect(request_id, state, request, headers, *redirect_info,
|
||||
std::move(callback));
|
||||
} else {
|
||||
HandleResponse(request_id, state, headers, std::move(callback));
|
||||
HandleResponse(request_id, state, request, headers, std::move(callback));
|
||||
}
|
||||
}
|
||||
|
||||
void HandleRedirect(int32_t request_id,
|
||||
RequestState* state,
|
||||
network::ResourceRequest* request,
|
||||
net::HttpResponseHeaders* headers,
|
||||
const net::RedirectInfo& redirect_info,
|
||||
OnRequestResponseResultCallback callback) {
|
||||
@@ -909,11 +911,13 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
auto exec_callback = base::BindOnce(
|
||||
std::move(callback), ResponseMode::CONTINUE, nullptr, new_url);
|
||||
|
||||
MaybeSaveCookies(request_id, state, headers, std::move(exec_callback));
|
||||
MaybeSaveCookies(request_id, state, request, headers,
|
||||
std::move(exec_callback));
|
||||
}
|
||||
|
||||
void HandleResponse(int32_t request_id,
|
||||
RequestState* state,
|
||||
network::ResourceRequest* request,
|
||||
net::HttpResponseHeaders* headers,
|
||||
OnRequestResponseResultCallback callback) {
|
||||
// The client may modify |pending_request_| in OnResourceResponse.
|
||||
@@ -929,7 +933,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
// The request may have been modified.
|
||||
const auto changes = state->pending_request_->GetChanges();
|
||||
if (changes) {
|
||||
state->pending_request_->Get(state->request_, true /* changed_only */);
|
||||
state->pending_request_->Get(request, true /* changed_only */);
|
||||
|
||||
if (changes & CefRequestImpl::kChangedUrl) {
|
||||
// Redirect to the new URL.
|
||||
@@ -957,11 +961,13 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
MaybeSaveCookies(request_id, state, headers, std::move(exec_callback));
|
||||
MaybeSaveCookies(request_id, state, request, headers,
|
||||
std::move(exec_callback));
|
||||
}
|
||||
|
||||
void MaybeSaveCookies(int32_t request_id,
|
||||
RequestState* state,
|
||||
network::ResourceRequest* request,
|
||||
net::HttpResponseHeaders* headers,
|
||||
base::OnceClosure callback) {
|
||||
CEF_REQUIRE_IOT();
|
||||
@@ -972,7 +978,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cookie_helper::IsCookieableScheme(state->request_->url,
|
||||
if (!cookie_helper::IsCookieableScheme(request->url,
|
||||
init_state_->cookieable_schemes_)) {
|
||||
// The scheme does not support cookies.
|
||||
std::move(callback).Run();
|
||||
@@ -991,9 +997,9 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
auto done_cookie_callback = base::BindOnce(
|
||||
&InterceptedRequestHandlerWrapper::ContinueWithSavedCookies,
|
||||
weak_ptr_factory_.GetWeakPtr(), request_id, std::move(callback));
|
||||
cookie_helper::SaveCookies(
|
||||
init_state_->browser_context_getter_, *(state->request_), headers,
|
||||
allow_cookie_callback, std::move(done_cookie_callback));
|
||||
cookie_helper::SaveCookies(init_state_->browser_context_getter_, *request,
|
||||
headers, allow_cookie_callback,
|
||||
std::move(done_cookie_callback));
|
||||
}
|
||||
|
||||
void AllowCookieSave(int32_t request_id,
|
||||
@@ -1269,12 +1275,6 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
for (auto& pair : request_map) {
|
||||
auto state = std::move(pair.second);
|
||||
if (state->cancel_callback_) {
|
||||
// The cancel callback may trigger a call to OnRequestComplete followed
|
||||
// by destruction of the InterceptedRequest that owns the
|
||||
// ResourceRequest. We therefore need to clear the
|
||||
// raw_ptr<ResourceRequest> first to avoid dangling pointer errors.
|
||||
state->request_ = nullptr;
|
||||
|
||||
std::move(state->cancel_callback_).Run(net::ERR_ABORTED);
|
||||
}
|
||||
}
|
||||
|
@@ -213,8 +213,7 @@ class InputStreamReader : public base::RefCountedThreadSafe<InputStreamReader> {
|
||||
InputStream::SkipCallback skip_callback);
|
||||
static void RunReadCallbackOnJobThread(
|
||||
int bytes_read,
|
||||
InputStream::ReadCallback read_callback,
|
||||
scoped_refptr<net::IOBuffer> buffer);
|
||||
InputStream::ReadCallback read_callback);
|
||||
|
||||
std::unique_ptr<InputStream> stream_;
|
||||
|
||||
@@ -443,9 +442,8 @@ 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_), buffer_));
|
||||
FROM_HERE, base::BindOnce(InputStreamReader::RunReadCallbackOnJobThread,
|
||||
bytes_read, std::move(pending_read_callback_)));
|
||||
|
||||
// Reset callback state.
|
||||
pending_callback_id_ = -1;
|
||||
@@ -462,8 +460,7 @@ void InputStreamReader::RunSkipCallbackOnJobThread(
|
||||
// static
|
||||
void InputStreamReader::RunReadCallbackOnJobThread(
|
||||
int bytes_read,
|
||||
InputStream::ReadCallback read_callback,
|
||||
scoped_refptr<net::IOBuffer> buffer) {
|
||||
InputStream::ReadCallback read_callback) {
|
||||
std::move(read_callback).Run(bytes_read);
|
||||
}
|
||||
|
||||
|
@@ -14,8 +14,8 @@
|
||||
#include "cef/libcef/browser/osr/web_contents_view_osr.h"
|
||||
#include "cef/libcef/browser/views/view_util.h"
|
||||
#include "cef/libcef/common/drag_data_impl.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_input_event_router.h"
|
||||
#include "content/browser/web_contents/web_contents_impl.h"
|
||||
#include "content/common/input/render_widget_host_input_event_router.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "ui/display/screen.h"
|
||||
#include "ui/events/base_event_utils.h"
|
||||
@@ -31,8 +31,8 @@ CefBrowserPlatformDelegateOsr::CefBrowserPlatformDelegateOsr(
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateOsr::CreateViewForWebContents(
|
||||
raw_ptr<content::WebContentsView>* view,
|
||||
raw_ptr<content::RenderViewHostDelegateView>* delegate_view) {
|
||||
content::WebContentsView** view,
|
||||
content::RenderViewHostDelegateView** delegate_view) {
|
||||
DCHECK(!view_osr_);
|
||||
|
||||
// Use the OSR view instead of the default platform view.
|
||||
@@ -109,7 +109,7 @@ void CefBrowserPlatformDelegateOsr::SendKeyEvent(const CefKeyEvent& event) {
|
||||
return;
|
||||
}
|
||||
|
||||
input::NativeWebKeyboardEvent web_event =
|
||||
content::NativeWebKeyboardEvent web_event =
|
||||
native_delegate_->TranslateWebKeyEvent(event);
|
||||
view->SendKeyEvent(web_event);
|
||||
}
|
||||
@@ -200,12 +200,12 @@ void CefBrowserPlatformDelegateOsr::ViewText(const std::string& text) {
|
||||
}
|
||||
|
||||
bool CefBrowserPlatformDelegateOsr::HandleKeyboardEvent(
|
||||
const input::NativeWebKeyboardEvent& event) {
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
return native_delegate_->HandleKeyboardEvent(event);
|
||||
}
|
||||
|
||||
CefEventHandle CefBrowserPlatformDelegateOsr::GetEventHandle(
|
||||
const input::NativeWebKeyboardEvent& event) const {
|
||||
const content::NativeWebKeyboardEvent& event) const {
|
||||
return native_delegate_->GetEventHandle(event);
|
||||
}
|
||||
|
||||
|
@@ -23,8 +23,8 @@ class CefBrowserPlatformDelegateOsr
|
||||
public:
|
||||
// CefBrowserPlatformDelegate methods:
|
||||
void CreateViewForWebContents(
|
||||
raw_ptr<content::WebContentsView>* view,
|
||||
raw_ptr<content::RenderViewHostDelegateView>* delegate_view) override;
|
||||
content::WebContentsView** view,
|
||||
content::RenderViewHostDelegateView** delegate_view) override;
|
||||
void WebContentsCreated(content::WebContents* web_contents,
|
||||
bool owned) override;
|
||||
void WebContentsDestroyed(content::WebContents* web_contents) override;
|
||||
@@ -47,9 +47,10 @@ class CefBrowserPlatformDelegateOsr
|
||||
gfx::Point GetScreenPoint(const gfx::Point& view,
|
||||
bool want_dip_coords) const override;
|
||||
void ViewText(const std::string& text) override;
|
||||
bool HandleKeyboardEvent(const input::NativeWebKeyboardEvent& event) override;
|
||||
bool HandleKeyboardEvent(
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
CefEventHandle GetEventHandle(
|
||||
const input::NativeWebKeyboardEvent& event) const override;
|
||||
const content::NativeWebKeyboardEvent& event) const override;
|
||||
std::unique_ptr<CefJavaScriptDialogRunner> CreateJavaScriptDialogRunner()
|
||||
override;
|
||||
std::unique_ptr<CefMenuRunner> CreateMenuRunner() override;
|
||||
|
@@ -30,15 +30,15 @@
|
||||
#include "components/viz/common/switches.h"
|
||||
#include "content/browser/bad_message.h"
|
||||
#include "content/browser/gpu/gpu_data_manager_impl.h"
|
||||
#include "content/browser/renderer_host/cursor_manager.h"
|
||||
#include "content/browser/renderer_host/delegated_frame_host.h"
|
||||
#include "content/browser/renderer_host/dip_util.h"
|
||||
#include "content/browser/renderer_host/input/motion_event_web.h"
|
||||
#include "content/browser/renderer_host/input/synthetic_gesture_target_base.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_delegate.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_input_event_router.h"
|
||||
#include "content/common/content_switches_internal.h"
|
||||
#include "content/common/input/cursor_manager.h"
|
||||
#include "content/common/input/render_widget_host_input_event_router.h"
|
||||
#include "content/public/browser/browser_task_traits.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/context_factory.h"
|
||||
@@ -1186,7 +1186,7 @@ void CefRenderWidgetHostViewOSR::SendExternalBeginFrame() {
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SendKeyEvent(
|
||||
const input::NativeWebKeyboardEvent& event) {
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
TRACE_EVENT0("cef", "CefRenderWidgetHostViewOSR::SendKeyEvent");
|
||||
content::RenderWidgetHostImpl* target_host = render_widget_host_;
|
||||
|
||||
@@ -1415,8 +1415,8 @@ void CefRenderWidgetHostViewOSR::SendTouchEvent(const CefTouchEvent& event) {
|
||||
render_widget_host_->delegate()->GetInputEventRouter()->RouteTouchEvent(
|
||||
this, &touch_event, latency_info);
|
||||
} else {
|
||||
render_widget_host_->GetRenderInputRouter()
|
||||
->ForwardTouchEventWithLatencyInfo(touch_event, latency_info);
|
||||
render_widget_host_->ForwardTouchEventWithLatencyInfo(touch_event,
|
||||
latency_info);
|
||||
}
|
||||
|
||||
bool touch_end =
|
||||
@@ -1495,7 +1495,7 @@ void CefRenderWidgetHostViewOSR::OnUpdateTextInputStateCalled(
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::ProcessAckedTouchEvent(
|
||||
const input::TouchEventWithLatencyInfo& touch,
|
||||
const content::TouchEventWithLatencyInfo& touch,
|
||||
blink::mojom::InputEventResultState ack_result) {
|
||||
const bool event_consumed =
|
||||
ack_result == blink::mojom::InputEventResultState::kConsumed;
|
||||
|
@@ -228,7 +228,7 @@ class CefRenderWidgetHostViewOSR
|
||||
|
||||
// ui::GestureProviderClient implementation.
|
||||
void ProcessAckedTouchEvent(
|
||||
const input::TouchEventWithLatencyInfo& touch,
|
||||
const content::TouchEventWithLatencyInfo& touch,
|
||||
blink::mojom::InputEventResultState ack_result) override;
|
||||
void OnGestureEvent(const ui::GestureEventData& gesture) override;
|
||||
|
||||
@@ -241,7 +241,7 @@ class CefRenderWidgetHostViewOSR
|
||||
void OnScreenInfoChanged();
|
||||
void Invalidate(CefBrowserHost::PaintElementType type);
|
||||
void SendExternalBeginFrame();
|
||||
void SendKeyEvent(const input::NativeWebKeyboardEvent& event);
|
||||
void SendKeyEvent(const content::NativeWebKeyboardEvent& event);
|
||||
void SendMouseEvent(const blink::WebMouseEvent& event);
|
||||
void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event);
|
||||
void SendTouchEvent(const CefTouchEvent& event);
|
||||
|
@@ -311,6 +311,11 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
||||
registry->RegisterBooleanPref(
|
||||
prefs::kAccessControlAllowMethodsInCORSPreflightSpecConformant, true);
|
||||
|
||||
// Based on browser_prefs::RegisterProfilePrefs.
|
||||
registry->RegisterBooleanPref(prefs::kAccessibilityPdfOcrAlwaysActive,
|
||||
false);
|
||||
registry->RegisterBooleanPref(prefs::kBlockTruncatedCookies, true);
|
||||
|
||||
// Spell checking preferences.
|
||||
// Modify defaults from SpellcheckServiceFactory::RegisterProfilePrefs.
|
||||
std::string spellcheck_lang =
|
||||
|
@@ -86,7 +86,7 @@ PersistentPrefStore::PrefReadError CefPrefStore::ReadPrefs() {
|
||||
|
||||
void CefPrefStore::ReadPrefsAsync(ReadErrorDelegate* error_delegate) {
|
||||
DCHECK(!pending_async_read_);
|
||||
error_delegate_.emplace(error_delegate);
|
||||
error_delegate_.reset(error_delegate);
|
||||
if (block_async_read_) {
|
||||
pending_async_read_ = true;
|
||||
} else {
|
||||
@@ -106,10 +106,6 @@ void CefPrefStore::SchedulePendingLossyWrites() {}
|
||||
|
||||
void CefPrefStore::OnStoreDeletionFromDisk() {}
|
||||
|
||||
bool CefPrefStore::HasReadErrorDelegate() const {
|
||||
return error_delegate_.has_value();
|
||||
}
|
||||
|
||||
void CefPrefStore::SetInitializationCompleted() {
|
||||
NotifyInitializationCompleted();
|
||||
}
|
||||
@@ -123,9 +119,8 @@ void CefPrefStore::NotifyPrefValueChanged(const std::string& key) {
|
||||
void CefPrefStore::NotifyInitializationCompleted() {
|
||||
DCHECK(!init_complete_);
|
||||
init_complete_ = true;
|
||||
if (read_success_ && read_error_ != PREF_READ_ERROR_NONE &&
|
||||
error_delegate_.has_value() && error_delegate_.value()) {
|
||||
error_delegate_.value()->OnError(read_error_);
|
||||
if (read_success_ && read_error_ != PREF_READ_ERROR_NONE && error_delegate_) {
|
||||
error_delegate_->OnError(read_error_);
|
||||
}
|
||||
for (Observer& observer : observers_) {
|
||||
observer.OnInitializationCompleted(read_success_);
|
||||
|
@@ -7,7 +7,6 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
#include "base/observer_list.h"
|
||||
@@ -52,7 +51,6 @@ class CefPrefStore : public PersistentPrefStore {
|
||||
base::OnceClosure synchronous_done_callback) override;
|
||||
void SchedulePendingLossyWrites() override;
|
||||
void OnStoreDeletionFromDisk() override;
|
||||
bool HasReadErrorDelegate() const override;
|
||||
|
||||
// Marks the store as having completed initialization.
|
||||
void SetInitializationCompleted();
|
||||
@@ -113,8 +111,7 @@ class CefPrefStore : public PersistentPrefStore {
|
||||
// mutation.
|
||||
bool committed_ = true;
|
||||
|
||||
// Optional so we can differentiate `nullopt` from `nullptr`.
|
||||
std::optional<std::unique_ptr<ReadErrorDelegate>> error_delegate_;
|
||||
std::unique_ptr<ReadErrorDelegate> error_delegate_;
|
||||
base::ObserverList<PrefStore::Observer, true>::Unchecked observers_;
|
||||
};
|
||||
|
||||
|
@@ -29,6 +29,7 @@
|
||||
#include "services/network/public/cpp/resolve_host_client_base.h"
|
||||
#include "services/network/public/mojom/clear_data_filter.mojom.h"
|
||||
#include "services/network/public/mojom/network_context.mojom.h"
|
||||
#include "ui/base/ui_base_features.h"
|
||||
|
||||
using content::BrowserThread;
|
||||
|
||||
@@ -1028,8 +1029,12 @@ void CefRequestContextImpl::SetChromeColorSchemeInternal(
|
||||
if (current_color) {
|
||||
// User color is not currently transparent.
|
||||
// Based on ThemeColorPickerHandler::SetDefaultColor.
|
||||
theme_service->SetUserColor(SK_ColorTRANSPARENT);
|
||||
theme_service->UseDeviceTheme(false);
|
||||
if (features::IsChromeWebuiRefresh2023()) {
|
||||
theme_service->SetUserColor(SK_ColorTRANSPARENT);
|
||||
theme_service->UseDeviceTheme(false);
|
||||
} else {
|
||||
theme_service->UseDefaultTheme();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ui::mojom::BrowserColorVariant ui_variant;
|
||||
@@ -1055,8 +1060,13 @@ void CefRequestContextImpl::SetChromeColorSchemeInternal(
|
||||
ui_variant != theme_service->GetBrowserColorVariant()) {
|
||||
// User color and/or variant has changed.
|
||||
// Based on ThemeColorPickerHandler::SetSeedColor.
|
||||
theme_service->SetUserColorAndBrowserColorVariant(user_color, ui_variant);
|
||||
theme_service->UseDeviceTheme(false);
|
||||
if (features::IsChromeWebuiRefresh2023()) {
|
||||
theme_service->SetUserColorAndBrowserColorVariant(user_color,
|
||||
ui_variant);
|
||||
theme_service->UseDeviceTheme(false);
|
||||
} else {
|
||||
theme_service->BuildAutogeneratedThemeFromColor(user_color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -49,11 +49,11 @@ void CefSpeechRecognitionManagerDelegate::OnAudioEnd(int session_id) {}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnRecognitionResults(
|
||||
int session_id,
|
||||
const std::vector<media::mojom::WebSpeechRecognitionResultPtr>& result) {}
|
||||
const std::vector<blink::mojom::SpeechRecognitionResultPtr>& result) {}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnRecognitionError(
|
||||
int session_id,
|
||||
const media::mojom::SpeechRecognitionError& error) {}
|
||||
const blink::mojom::SpeechRecognitionError& error) {}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnAudioLevelsChange(
|
||||
int session_id,
|
||||
|
@@ -35,11 +35,11 @@ class CefSpeechRecognitionManagerDelegate
|
||||
void OnRecognitionEnd(int session_id) override;
|
||||
void OnRecognitionResults(
|
||||
int session_id,
|
||||
const std::vector<media::mojom::WebSpeechRecognitionResultPtr>& result)
|
||||
const std::vector<blink::mojom::SpeechRecognitionResultPtr>& result)
|
||||
override;
|
||||
void OnRecognitionError(
|
||||
int session_id,
|
||||
const media::mojom::SpeechRecognitionError& error) override;
|
||||
const blink::mojom::SpeechRecognitionError& error) override;
|
||||
void OnAudioLevelsChange(int session_id,
|
||||
float volume,
|
||||
float noise_volume) override;
|
||||
|
@@ -3,7 +3,6 @@
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "base/feature_list.h"
|
||||
#include "base/features.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/path_service.h"
|
||||
#include "cef/include/test/cef_test_helpers.h"
|
||||
@@ -18,7 +17,6 @@ void CefSetDataDirectoryForTests(const CefString& dir) {
|
||||
bool CefIsFeatureEnabledForTests(const CefString& feature_name) {
|
||||
// Only includes values that are queried by unit tests.
|
||||
const base::Feature* features[] = {
|
||||
&base::features::kUseRustJsonParser,
|
||||
&network::features::kReduceAcceptLanguage,
|
||||
};
|
||||
|
||||
|
@@ -176,13 +176,13 @@ void CefBrowserPlatformDelegateViews::ViewText(const std::string& text) {
|
||||
}
|
||||
|
||||
bool CefBrowserPlatformDelegateViews::HandleKeyboardEvent(
|
||||
const input::NativeWebKeyboardEvent& event) {
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
// The BrowserView will handle accelerators.
|
||||
return browser_view_->HandleKeyboardEvent(event);
|
||||
}
|
||||
|
||||
CefEventHandle CefBrowserPlatformDelegateViews::GetEventHandle(
|
||||
const input::NativeWebKeyboardEvent& event) const {
|
||||
const content::NativeWebKeyboardEvent& event) const {
|
||||
return native_delegate_->GetEventHandle(event);
|
||||
}
|
||||
|
||||
|
@@ -50,9 +50,10 @@ class CefBrowserPlatformDelegateViews
|
||||
gfx::Point GetScreenPoint(const gfx::Point& view,
|
||||
bool want_dip_coords) const override;
|
||||
void ViewText(const std::string& text) override;
|
||||
bool HandleKeyboardEvent(const input::NativeWebKeyboardEvent& event) override;
|
||||
bool HandleKeyboardEvent(
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
CefEventHandle GetEventHandle(
|
||||
const input::NativeWebKeyboardEvent& event) const override;
|
||||
const content::NativeWebKeyboardEvent& event) const override;
|
||||
std::unique_ptr<CefMenuRunner> CreateMenuRunner() override;
|
||||
bool IsViewsHosted() const override;
|
||||
gfx::Point GetDialogPosition(const gfx::Size& size) override;
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#include "cef/libcef/browser/views/window_impl.h"
|
||||
#include "cef/libcef/features/runtime.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "components/input/native_web_keyboard_event.h"
|
||||
#include "content/public/common/input/native_web_keyboard_event.h"
|
||||
#include "ui/content_accelerators/accelerator_util.h"
|
||||
|
||||
namespace {
|
||||
@@ -186,7 +186,7 @@ void CefBrowserViewImpl::BrowserDestroyed(CefBrowserHostBase* browser) {
|
||||
}
|
||||
|
||||
bool CefBrowserViewImpl::HandleKeyboardEvent(
|
||||
const input::NativeWebKeyboardEvent& event) {
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
if (!root_view()) {
|
||||
return false;
|
||||
}
|
||||
@@ -428,7 +428,7 @@ CefWindowImpl* CefBrowserViewImpl::cef_window_impl() const {
|
||||
}
|
||||
|
||||
bool CefBrowserViewImpl::HandleAccelerator(
|
||||
const input::NativeWebKeyboardEvent& event,
|
||||
const content::NativeWebKeyboardEvent& event,
|
||||
views::FocusManager* focus_manager) {
|
||||
// Previous calls to TranslateMessage can generate Char events as well as
|
||||
// RawKeyDown events, even if the latter triggered an accelerator. In these
|
||||
|
@@ -60,7 +60,7 @@ class CefBrowserViewImpl
|
||||
|
||||
// Called to handle accelerators when the event is unhandled by the web
|
||||
// content and the browser client.
|
||||
bool HandleKeyboardEvent(const input::NativeWebKeyboardEvent& event);
|
||||
bool HandleKeyboardEvent(const content::NativeWebKeyboardEvent& event);
|
||||
|
||||
// CefBrowserView methods:
|
||||
CefRefPtr<CefBrowser> GetBrowser() override;
|
||||
@@ -120,7 +120,7 @@ class CefBrowserViewImpl
|
||||
// Logic extracted from UnhandledKeyboardEventHandler::HandleKeyboardEvent for
|
||||
// the handling of accelerators. Returns true if the event was handled by the
|
||||
// accelerator.
|
||||
bool HandleAccelerator(const input::NativeWebKeyboardEvent& event,
|
||||
bool HandleAccelerator(const content::NativeWebKeyboardEvent& event,
|
||||
views::FocusManager* focus_manager);
|
||||
|
||||
void RequestFocusInternal();
|
||||
|
@@ -410,8 +410,7 @@ void CefWindowView::CreateWidget(gfx::AcceleratedWidget parent_widget) {
|
||||
CefWidget* cef_widget = CefWidget::Create(this);
|
||||
views::Widget* widget = cef_widget->GetWidget();
|
||||
|
||||
views::Widget::InitParams params(
|
||||
views::Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET);
|
||||
views::Widget::InitParams params;
|
||||
params.delegate = this;
|
||||
|
||||
views::Widget* host_widget = nullptr;
|
||||
|
@@ -376,6 +376,12 @@ 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 =
|
||||
@@ -396,12 +402,6 @@ 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.
|
||||
|
@@ -60,9 +60,7 @@ bool CefCreateTempDirectoryInDirectory(const CefString& base_dir,
|
||||
return false;
|
||||
}
|
||||
base::FilePath result;
|
||||
base::FilePath::StringType prefix_str = prefix;
|
||||
if (base::CreateTemporaryDirInDir(
|
||||
base_dir, base::FilePath::StringPieceType(prefix_str), &result)) {
|
||||
if (base::CreateTemporaryDirInDir(base_dir, prefix, &result)) {
|
||||
new_dir = result.value();
|
||||
return true;
|
||||
}
|
||||
|
@@ -258,7 +258,7 @@ class CefPostDataElementImpl : public CefPostDataElement {
|
||||
Type type_ = PDE_TYPE_EMPTY;
|
||||
union {
|
||||
struct {
|
||||
RAW_PTR_EXCLUSION void* bytes;
|
||||
void* bytes;
|
||||
size_t size;
|
||||
} bytes;
|
||||
cef_string_t filename;
|
||||
|
@@ -282,7 +282,6 @@ void RegisterURLSchemeAsSupportingFetchAPI(const blink::WebString& scheme) {
|
||||
}
|
||||
|
||||
struct CefScriptForbiddenScope::Impl {
|
||||
STACK_ALLOCATED_IGNORE()
|
||||
blink::ScriptForbiddenScope scope_;
|
||||
};
|
||||
|
||||
|
@@ -371,9 +371,9 @@ void CefFrameImpl::OnDraggableRegionsChanged() {
|
||||
|
||||
regions.reserve(webregions.size());
|
||||
for (const auto& webregion : webregions) {
|
||||
auto region = cef::mojom::DraggableRegionEntry::New(
|
||||
render_frame->ConvertViewportToWindow(webregion.bounds),
|
||||
webregion.draggable);
|
||||
auto region = cef::mojom::DraggableRegionEntry::New(webregion.bounds,
|
||||
webregion.draggable);
|
||||
render_frame->ConvertViewportToWindow(®ion->bounds);
|
||||
regions.emplace_back(std::move(region));
|
||||
}
|
||||
}
|
||||
|
@@ -234,9 +234,6 @@ patches = [
|
||||
# From chrome/browser/ui/browser_commands.cc via
|
||||
# chrome/browser/printing/print_view_manager_common.h
|
||||
#
|
||||
# Linux: Fix duplicate symbol error for window_frame_util.cc
|
||||
# https://issuetracker.google.com/issues/343037853#comment3
|
||||
#
|
||||
# Avoid duplicate window from DevTools when CEF handles the open via
|
||||
# OnOpenURLFromTab.
|
||||
# https://github.com/chromiumembedded/cef/issues/3735
|
||||
@@ -289,10 +286,6 @@ 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',
|
||||
},
|
||||
{
|
||||
@@ -802,6 +795,19 @@ patches = [
|
||||
# https://chromium-review.googlesource.com/c/chromium/src/+/5302103
|
||||
'name': 'osr_win_remove_keyed_mutex_2575'
|
||||
},
|
||||
{
|
||||
# win: Fix generated binaries crashing with exit code 3221225477.
|
||||
# https://issues.chromium.org/issues/336007395
|
||||
# Reverts
|
||||
# https://chromium-review.googlesource.com/c/chromium/src/+/5454331
|
||||
'name': 'win_partition_freelist_entry_336007395'
|
||||
},
|
||||
{
|
||||
# Fix deadlock with enable_backup_ref_ptr_instance_tracer=true
|
||||
# https://issues.chromium.org/issues/340815319
|
||||
# https://chromium-review.googlesource.com/c/chromium/src/+/5542485
|
||||
'name': 'base_allocator_instance_tracer_5542485'
|
||||
},
|
||||
{
|
||||
# Fix dangling raw_ptr errors.
|
||||
# https://github.com/chromiumembedded/cef/issues/3239
|
||||
@@ -813,27 +819,21 @@ patches = [
|
||||
# https://issues.chromium.org/issues/323753235#comment11
|
||||
'name': 'content_initiator_policy_323753235'
|
||||
},
|
||||
{
|
||||
# Move test_fonts into their own directory.
|
||||
# https://issues.chromium.org/issues/343199633
|
||||
'name': 'DEPS'
|
||||
},
|
||||
{
|
||||
# win: Fix undefined std::_Literal_zero_is_expected() when building
|
||||
# cef_sandbox with VS 17.9.2 version of MSVC STL.
|
||||
# https://github.com/chromiumembedded/cef/issues/3708
|
||||
'name': 'win_sandbox_op3way_3708'
|
||||
},
|
||||
{
|
||||
# Fix ThreadPool DCHECK during startup when using multi-threaded message
|
||||
# loop. Related to the following CL:
|
||||
# https://chromium-review.googlesource.com/c/chromium/src/+/5548577
|
||||
'name': 'base_thread_pool_5548577'
|
||||
},
|
||||
{
|
||||
# Fix DCHECK in SimpleMenuModel::AddSeparator when adding a separator with
|
||||
# hidden menu items.
|
||||
# https://github.com/chromiumembedded/cef/issues/3577
|
||||
'name': 'ui_menu_model_3577'
|
||||
},
|
||||
{
|
||||
# linux: Fix cannot allocate memory in static TLS block in dlopen libcef.so
|
||||
# https://github.com/chromiumembedded/cef/issues/3616
|
||||
'name': 'third_party_sentencepiece_3616'
|
||||
}
|
||||
]
|
||||
|
26
patch/patches/DEPS.patch
Normal file
26
patch/patches/DEPS.patch
Normal file
@@ -0,0 +1,26 @@
|
||||
diff --git DEPS DEPS
|
||||
index faa0c930d80f9..093beb1feafca 100644
|
||||
--- DEPS
|
||||
+++ DEPS
|
||||
@@ -2102,16 +2102,16 @@ deps = {
|
||||
'dep_type': 'cipd',
|
||||
},
|
||||
|
||||
- 'src/third_party/test_fonts': {
|
||||
+ 'src/third_party/test_fonts/test_fonts': {
|
||||
'dep_type': 'gcs',
|
||||
'condition': 'non_git_source',
|
||||
'bucket': 'chromium-fonts',
|
||||
'objects': [
|
||||
{
|
||||
- 'object_name': '336e775eec536b2d785cc80eff6ac39051931286',
|
||||
- 'sha256sum': 'a2ca2962daf482a8f943163541e1c73ba4b2694fabcd2510981f2db4eda493c8',
|
||||
- 'size_bytes': 32624734,
|
||||
- 'generation': 1647440500943755,
|
||||
+ 'object_name': 'f26f29c9d3bfae588207bbc9762de8d142e58935c62a86f67332819b15203b35',
|
||||
+ 'sha256sum': 'f26f29c9d3bfae588207bbc9762de8d142e58935c62a86f67332819b15203b35',
|
||||
+ 'size_bytes': 32750602,
|
||||
+ 'generation': 1717109450425063,
|
||||
},
|
||||
],
|
||||
},
|
13
patch/patches/base_allocator_instance_tracer_5542485.patch
Normal file
13
patch/patches/base_allocator_instance_tracer_5542485.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
diff --git base/allocator/partition_allocator/src/partition_alloc/pointers/instance_tracer.cc base/allocator/partition_allocator/src/partition_alloc/pointers/instance_tracer.cc
|
||||
index fecc2c35a3dcf..3745ac1d22a93 100644
|
||||
--- base/allocator/partition_allocator/src/partition_alloc/pointers/instance_tracer.cc
|
||||
+++ base/allocator/partition_allocator/src/partition_alloc/pointers/instance_tracer.cc
|
||||
@@ -42,7 +42,7 @@ auto& GetStorage() {
|
||||
}
|
||||
|
||||
auto& GetStorageMutex() {
|
||||
- static partition_alloc::internal::base::NoDestructor<std::mutex>
|
||||
+ static partition_alloc::internal::base::NoDestructor<std::recursive_mutex>
|
||||
storage_mutex;
|
||||
return *storage_mutex;
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
diff --git base/BUILD.gn base/BUILD.gn
|
||||
index 4ae52e5351615..272875eb5fe93 100644
|
||||
index 4c7130084a91f..c0e00c6fc2636 100644
|
||||
--- base/BUILD.gn
|
||||
+++ base/BUILD.gn
|
||||
@@ -41,6 +41,7 @@ import("//build/nocompile.gni")
|
||||
@@ -10,7 +10,7 @@ index 4ae52e5351615..272875eb5fe93 100644
|
||||
import("//testing/libfuzzer/fuzzer_test.gni")
|
||||
import("//testing/test.gni")
|
||||
|
||||
@@ -1510,7 +1511,11 @@ component("base") {
|
||||
@@ -1526,7 +1527,11 @@ component("base") {
|
||||
"hash/md5_constexpr_internal.h",
|
||||
"hash/sha1.h",
|
||||
]
|
||||
@@ -23,7 +23,7 @@ index 4ae52e5351615..272875eb5fe93 100644
|
||||
sources += [
|
||||
"hash/md5_nacl.cc",
|
||||
"hash/md5_nacl.h",
|
||||
@@ -1939,6 +1944,12 @@ component("base") {
|
||||
@@ -1955,6 +1960,12 @@ component("base") {
|
||||
defines += [ "COM_INIT_CHECK_HOOK_DISABLED" ]
|
||||
}
|
||||
|
||||
@@ -73,11 +73,11 @@ index 215d636fec275..922e88f31b999 100644
|
||||
#else
|
||||
#include "base/hash/md5_boringssl.h"
|
||||
diff --git base/hash/sha1.h base/hash/sha1.h
|
||||
index 857159d757637..63b5b396a00dd 100644
|
||||
index 1891e95fa387d..fc190dc39ae7d 100644
|
||||
--- base/hash/sha1.h
|
||||
+++ base/hash/sha1.h
|
||||
@@ -15,7 +15,9 @@
|
||||
#include "base/compiler_specific.h"
|
||||
@@ -14,7 +14,9 @@
|
||||
#include "base/base_export.h"
|
||||
#include "base/containers/span.h"
|
||||
#include "build/build_config.h"
|
||||
-#if BUILDFLAG(IS_NACL)
|
||||
@@ -188,7 +188,7 @@ index 1f91a938caf55..e7b383ebe3986 100644
|
||||
return lhs.token_ == rhs.token_;
|
||||
#else
|
||||
diff --git base/win/sid.cc base/win/sid.cc
|
||||
index dd063382d97e1..968dde0567c44 100644
|
||||
index dd063382d97e1..6f8d6a0be91b1 100644
|
||||
--- base/win/sid.cc
|
||||
+++ base/win/sid.cc
|
||||
@@ -22,6 +22,7 @@
|
||||
@@ -220,12 +220,13 @@ index dd063382d97e1..968dde0567c44 100644
|
||||
CRYPTO_library_init();
|
||||
static_assert((SHA256_DIGEST_LENGTH / sizeof(DWORD)) ==
|
||||
SECURITY_APP_PACKAGE_RID_COUNT);
|
||||
@@ -143,6 +149,9 @@ Sid Sid::FromNamedCapability(const std::wstring& capability_name) {
|
||||
@@ -143,6 +149,10 @@ Sid Sid::FromNamedCapability(const std::wstring& capability_name) {
|
||||
reinterpret_cast<uint8_t*>(&rids[2]));
|
||||
return FromSubAuthorities(SECURITY_APP_PACKAGE_AUTHORITY, std::size(rids),
|
||||
rids);
|
||||
+#else
|
||||
+ NOTREACHED();
|
||||
+ return Sid(WellKnownSid::kNull);
|
||||
+#endif
|
||||
}
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
diff --git base/test/BUILD.gn base/test/BUILD.gn
|
||||
index a60a2c1de0166..a191640ca0375 100644
|
||||
index feafabc3a60f9..f78cafeadb879 100644
|
||||
--- base/test/BUILD.gn
|
||||
+++ base/test/BUILD.gn
|
||||
@@ -192,11 +192,6 @@ static_library("test_support") {
|
||||
@@ -191,11 +191,6 @@ static_library("test_support") {
|
||||
|
||||
if (enable_base_tracing) {
|
||||
public_deps += [ "//third_party/perfetto:perfetto_test_support" ]
|
||||
@@ -14,7 +14,7 @@ index a60a2c1de0166..a191640ca0375 100644
|
||||
deps += [
|
||||
":amalgamated_perfetto_sql_stdlib",
|
||||
":gen_cc_chrome_track_event_descriptor",
|
||||
@@ -564,7 +559,7 @@ if (enable_base_tracing) {
|
||||
@@ -563,7 +558,7 @@ if (enable_base_tracing) {
|
||||
# processor depends on dev_sqlite. The two share the same symbols but have
|
||||
# different implementations, so we need to hide dev_sqlite in this shared
|
||||
# library even in non-component builds to prevent duplicate symbols.
|
||||
@@ -23,7 +23,7 @@ index a60a2c1de0166..a191640ca0375 100644
|
||||
if (is_ios) {
|
||||
_target_type = "ios_framework_bundle"
|
||||
}
|
||||
@@ -573,6 +568,8 @@ if (enable_base_tracing) {
|
||||
@@ -572,6 +567,8 @@ if (enable_base_tracing) {
|
||||
defines = [ "TEST_TRACE_PROCESSOR_IMPL" ]
|
||||
testonly = true
|
||||
sources = [
|
||||
@@ -32,7 +32,7 @@ index a60a2c1de0166..a191640ca0375 100644
|
||||
"test_trace_processor_export.h",
|
||||
"test_trace_processor_impl.cc",
|
||||
"test_trace_processor_impl.h",
|
||||
@@ -590,33 +587,6 @@ if (enable_base_tracing) {
|
||||
@@ -589,33 +586,6 @@ if (enable_base_tracing) {
|
||||
output_name = "TestTraceProcessor"
|
||||
bundle_deps_filter = [ "//third_party/icu:icudata" ]
|
||||
}
|
||||
@@ -88,10 +88,10 @@ index f5191b804bc07..aadb7d66ba4c3 100644
|
||||
+
|
||||
#endif // BASE_TEST_TEST_TRACE_PROCESSOR_EXPORT_H_
|
||||
diff --git content/shell/BUILD.gn content/shell/BUILD.gn
|
||||
index fdc8e7ef0641d..494fa1379b5a3 100644
|
||||
index 2439098be9ada..7235455526000 100644
|
||||
--- content/shell/BUILD.gn
|
||||
+++ content/shell/BUILD.gn
|
||||
@@ -913,7 +913,6 @@ if (is_mac) {
|
||||
@@ -908,7 +908,6 @@ if (is_mac) {
|
||||
# Specify a sensible install_name for static builds. The library is
|
||||
# dlopen()ed so this is not used to resolve the module.
|
||||
ldflags = [ "-Wl,-install_name,@executable_path/../Frameworks/$output_name.framework/$output_name" ]
|
||||
|
@@ -1,15 +0,0 @@
|
||||
diff --git base/task/thread_pool/thread_pool_impl.cc base/task/thread_pool/thread_pool_impl.cc
|
||||
index 4ac5cea5f6c08..a9c1c152568f3 100644
|
||||
--- base/task/thread_pool/thread_pool_impl.cc
|
||||
+++ base/task/thread_pool/thread_pool_impl.cc
|
||||
@@ -105,6 +105,10 @@ ThreadPoolImpl::ThreadPoolImpl(std::string_view histogram_label,
|
||||
: kForegroundPoolEnvironmentParams.thread_type_hint,
|
||||
task_tracker_->GetTrackedRef(), tracked_ref_factory_.GetTrackedRef());
|
||||
}
|
||||
+
|
||||
+ // After https://crrev.com/e2e090c363 the ThreadPool is being created earlier
|
||||
+ // during initialization. Detach now so we can rebind later on the UI thread.
|
||||
+ DETACH_FROM_SEQUENCE(sequence_checker_);
|
||||
}
|
||||
|
||||
ThreadPoolImpl::~ThreadPoolImpl() {
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user