Compare commits

..

86 Commits

Author SHA1 Message Date
Marshall Greenblatt
da971da381 Fix DCHECK adding menu separator with hidden items (fixes #3577) 2024-07-16 16:02:04 -04:00
Marshall Greenblatt
444983d9ec distrib: Add new tools distribution for mksnapshot (see #3734) 2024-07-16 16:00:03 -04:00
Marshall Greenblatt
d96e29b528 mac: cefclient: Fix zombie NSWindow object on exit (fixes #3602)
- Don't create a TempWindow when using Views.
- Don't call `close` on an NSWindow that is never opened.
2024-07-15 17:08:41 -04:00
Marshall Greenblatt
c4ddda42fb Call SetIsShutdown after CefInitialize (fixes #3738)
Delay shutdown checking until after CefInitialize has drained existing
task pools.
2024-07-15 17:08:34 -04:00
Marshall Greenblatt
34572843ea Fix duplicate open from DevTools when handling OnOpenURLFromTab (fixes #3735) 2024-07-11 14:20:51 -04:00
Marshall Greenblatt
499df12b97 Update to Chromium version 127.0.6533.43 2024-07-11 13:32:51 +00:00
Marshall Greenblatt
96ac3d04b4 Update to Chromium version 127.0.6533.41 2024-07-10 12:50:51 -04:00
Marshall Greenblatt
7f27173f2f tools: win: Remove dynamic_annotations.lib from cef_sandbox
This library was removed in https://crbug.com/40209570.
2024-07-10 12:34:21 -04:00
Marshall Greenblatt
d77d001f56 Include debug symbols for all distributed binaries (fixes #2235) 2024-07-08 12:20:14 -04:00
Nik Pavlov
bea9614a45 tools: Fix "invalid escape sequence '\s'" warning 2024-07-01 13:20:59 -04:00
Marshall Greenblatt
9772389a14 Allow dangling Listener in CefFileDialogManager (fixes #3720) 2024-06-25 13:59:03 -04:00
Marshall Greenblatt
bbc35eb30a Fix dangling ResourceRequest* (fixes #3719)
Add raw_ptr<network::ResourceRequest> to RequestState instead of
passing ResourceRequest* as a bound parameter.
2024-06-21 16:57:10 -04:00
Marshall Greenblatt
b59a20ac7f Allow dangling UnretainedWrapper for ResourceRequest* (fixes #3717)
Change UnretainedWrapper traits from MayNotDangle (default) to
MayDangleUntriaged as a short-term fix.
2024-06-21 13:00:52 -04:00
Yuta Sekiguchi
0c339dfc41 Rewrite raw pointers reported by clang plugin (see #3239)
Found using a CEF build with clang_use_chrome_plugins=true
and treat_warnings_as_errors=false.

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

To test:
- Run `cefclient --url=chrome://net-export`
- Click the "Start Logging to Disk" button
- Exit cefclient; get no debug assertions
2024-06-20 14:09:52 -04:00
Marshall Greenblatt
7d739b3d33 Update to Chromium version 127.0.6533.5 2024-06-20 12:13:53 -04:00
Marshall Greenblatt
5afde67593 chrome: Fix CHECK when switching from kPrerendering to kActive
In this case |render_frame_| is not bound, |render_frame_host_| is
non-nullptr and |render_frame_host| equals |render_frame_host_| in
CefFrameHostImpl::MaybeReAttach when called from
CefBrowserInfo::FrameHostStateChanged.
2024-06-20 12:09:46 -04:00
Marshall Greenblatt
3b98dbda79 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.
2024-06-20 12:09:46 -04:00
Marshall Greenblatt
c44aa35bfc Update to Chromium version 127.0.6533.0 (#1313161) 2024-06-20 12:09:46 -04:00
Marshall Greenblatt
4ed13d8c47 views: Add missing patched files (see #3711) 2024-06-13 18:07:59 -04:00
Marshall Greenblatt
fe24ce3c71 chrome: Add cleanup when context menu isn't running (fixes #3711)
The menu may not be running in the following cases:

- If the menu is empty (e.g. cleared in OnBeforeContextMenu).
- If the menu is disabled (see e.g. RenderViewContextMenuViews::Show).
- When the run call blocks until the menu is dismissed (macOS behavior).

We explicitly clean up in these cases instead of waiting for OnMenuClosed
which will otherwise never be called for the first 2 cases.

Menu run status is exposed via new ContextMenuDelegate and
RenderViewContextMenuBase methods.
2024-06-13 13:38:41 -04:00
Marshall Greenblatt
cc40cbdd45 alloy: Move warning after logging init (fixes #3713) 2024-06-10 11:03:35 -04:00
Julian Waller
7c19cb90e1 cmake: Skip docs generation if the Doxyfile is missing
The Doxyfile is not included with minimal distributions.
2024-06-06 13:54:11 +00:00
Marshall Greenblatt
47798d3dbf Fix potential dangling PendingRequest::request_ (see #3239)
See https://magpcss.org/ceforum/viewtopic.php?f=6&t=19802 for error.
2024-06-04 14:11:59 -04:00
Yuta Sekiguchi
e4bb51f6f6 chrome: Add CefJSDialogHandler support (fixes #3702) 2024-06-04 12:19:14 -04:00
Marshall Greenblatt
fd7444c7a4 win: Enable WinSboxNoFakeGdiInit for Debug component builds (see #3708)
The WinSboxNoFakeGdiInit feature requires delayload of all DLLs that
might load user32.dll in the renderer process. It's enabled as a field
trial for all non-Official builds, but caused problems with Debug
component builds using VS 17.5.0 due to MSVCP140D.dll depending on
OLE32.DLL (which depends on user32.dll). The dependency on OLE32.DLL
is removed with VS 17.9.2 so the feature can now be enabled.

See https://crbug.com/326277735#comment39 for background.
2024-06-04 11:56:12 -04:00
Marshall Greenblatt
c56ae7213e cefclient: linux: Fix gcc -Werror=parentheses (see #3314) 2024-06-04 11:19:50 -04:00
Marshall Greenblatt
cb1830e16c win: Fix undefined symbol with cef_sandbox and VS 17.9.2 (see #3708)
This avoids a bug in clang + MSVC STL when using the default three-way
comparison operator with base::TimeDelta. The compiler does not throw
away the function call to the `std::_Literal_zero_is_expected` symbol,
which is deliberately undefined.

See also https://github.com/microsoft/STL/issues/4359#issuecomment-2042911928
2024-06-03 14:01:14 -04:00
Marshall Greenblatt
39cafe3e6c tests: Fix URLRequestTest failure with ReduceAcceptLanguage trial 2024-05-31 22:53:09 -04:00
Marshall Greenblatt
15c7e80e3c cefclient: win: Fix MSVC compile error 2024-05-31 13:28:33 -04:00
Marshall Greenblatt
8e79307a62 Pass mime type values as file dialog accept filters (see #3314)
File dialogs that specify mime type (e.g. "image/*") accept filters will pass
those values unchanged to the OnFileDialog |accept_filters| parameter. The
default dialog implementation will show those filters in addition to a combined
"Custom Files" filter. This is a change from preexisting Google Chrome
behavior where only the combined "Custom Files" filter is displayed, and
restores CEF behavior that existed prior to 2ea7459a89.

Document the fact that OnFileDialog may be called twice, once before MIME type
expansion and once afterwards.

Add new OnFileDialog |accept_extensions| and |accept_descriptions| parameters
for MIME type extensions and descriptions.

Details: This change adds a SelectFileDialog::FileTypeInfo::extension_mimetypes
member and improves the logic in FileSelectHelper::GetFileTypesFromAcceptType
and file_dialog_manager.cc SelectFileToFileChooserParams to support recall of
the source mime type when populating the FileChooserParams structure.

To test:
- Run `ceftests --gtest_filter=DialogTest.*`
- Run `cefclient --url=https://tests/dialogs`
2024-05-30 15:38:36 -04:00
Marshall Greenblatt
b0bceecba9 Add cef_sandbox dependency on make_config_header (see #3685) 2024-05-26 13:45:30 -04:00
Marshall Greenblatt
b6842f8b80 Remove unused cef_ptr_util.h 2024-05-26 13:45:30 -04:00
Marshall Greenblatt
5fe6382906 cefclient: win: Fix delayload of user32.dll
The WinSboxNoFakeGdiInit feature requires delayload of all DLLs that
might load user32.dll in the renderer process. It's enabled as a field
trial for all non-Official builds, but appears to only work with
non-component Release builds. See https://crbug.com/326277735
2024-05-26 13:45:30 -04:00
Marshall Greenblatt
bd1e188c77 tests: Fix SchemeHandlerTest failure with ReduceAcceptLanguage trial 2024-05-26 13:45:29 -04:00
Marshall Greenblatt
701fc03f00 Update to Chromium version 126.0.6478.0 (#1300313) 2024-05-26 13:45:29 -04:00
pkv
bc1b856b96 alloy: Fix audio capturer crash on exit (fixes #3689) 2024-05-21 17:58:13 +00:00
Marshall Greenblatt
c7b30ee80f cefclient: win: Fix crash on close with --use-native (see #3239)
OnBeforeClose notification is delivered via TabModel destruction in
TabStripModel::SendDetachWebContentsNotifications. We need to let
that call stack unwind before triggering TabStripModel destruction
via closure of the native host window.
2024-05-21 12:58:28 -04:00
Marshall Greenblatt
48137b9538 cefclient: Use default window for DevTools non-Views popup (see #3681)
Chrome runtime only supports creation of a Views-hosted DevTools
popup in ChromeBrowserDelegate::CreateDevToolsBrowser if the parent
is also Views-hosted.

To test:
- Run `cefclient --use-native`
- Right click, select "Show DevTools"
- Close both windows and the app should exit
2024-05-21 12:56:48 -04:00
Marshall Greenblatt
5a2cfb6907 osr: Support DevTools windows with Chrome runtime Alloy style (see #3681) 2024-05-21 12:56:48 -04:00
Marshall Greenblatt
6354d8daf1 Fix dangling raw_ptr errors and related issues (see #3239)
- Use raw_ptr in class container fields.
- Use defined lifespan for StreamReaderURLLoader.
- Fix lifespan assumptions for WebContents/RFH usage.
2024-05-21 12:56:47 -04:00
Marshall Greenblatt
aad216bf56 Revert "Revert unretained dangling ptr detector crash by default (fixes #3693)"
This reverts commit 8283317cb1.
2024-05-20 13:05:37 -04:00
Marshall Greenblatt
3f036edf2d Fix deadlock with enable_backup_ref_ptr_instance_tracer=true (see #3239) 2024-05-20 13:05:37 -04:00
Marshall Greenblatt
32fc106ab0 Enable BackupRefPtr for compatible non-Official builds (see #3239)
Compatible configurations include:
- Non-component builds.
- Debug builds on Mac/Linux.
- Release builds on Windows (b/c Debug builds require component builds).
- ASAN builds (which are also Release builds).

See related logic in //build_overrides/partition_alloc.gni
2024-05-20 13:05:37 -04:00
Marshall Greenblatt
0170f431a0 Apply raw_ptr rewrite to libcef (see #3239) 2024-05-11 12:47:10 -04:00
Marshall Greenblatt
2156c9fd5d Apply raw_ptr usage in patch files (see #3239) 2024-05-11 11:23:56 -04:00
Marshall Greenblatt
00118ddcdb cefsimple: Enable Chrome runtime by default (see #3685)
Run with `--disable-chrome-runtime` to use the Alloy runtime.
2024-05-09 12:53:43 -04:00
Marshall Greenblatt
e7626b2df6 cefclient: Enable Chrome runtime by default (see #3685)
Run with `--disable-chrome-runtime` to use the Alloy runtime.
2024-05-09 12:49:06 -04:00
Marshall Greenblatt
8283317cb1 Revert unretained dangling ptr detector crash by default (fixes #3693) 2024-05-06 16:50:44 -04:00
Marshall Greenblatt
271c6f6446 Fix credentials mode for fetch request redirect (fixes #3675)
Also verified that https://browseraudit.com/ gives the same results
both with and without `--disable-request-handling-for-testing`.
2024-05-06 15:10:12 -04:00
Marshall Greenblatt
311eaf827e alloy: Add missing geolocation pref registration (fixes #3694) 2024-05-06 11:58:55 -04:00
Marshall Greenblatt
002f4b5b4a tools: Don't write args.gn if unchanged (see #3681, see #3685)
Now that args.gn is an input to the make_config_header target we
don't want to invalidate the build unnecessarily by modifying the
file if the contents are unchanged.
2024-05-03 15:38:10 -04:00
Marshall Greenblatt
17a1fd62ec tests: Remove extension tests (see #3685)
The Alloy extension API is deprecated and these tests have not been
supported for some time.
2024-05-03 15:23:35 -04:00
Marshall Greenblatt
ca636bb96e chrome: Support CefResourceBundleHandler (see #3685) 2024-05-03 12:51:09 -04:00
Marshall Greenblatt
4e3668f93a chrome: Support CefSettings logging config (see #3685)
Also enables logging by default for Release builds (previously
required the `--enable-logging` flag). Logging can still be
disabled by passing the `--disable-logging` flag.
2024-05-02 19:43:39 -04:00
Marshall Greenblatt
6b13b1c627 cefclient: Don't call GetExtension when NOTIMPLEMENTED (see #3681) 2024-05-02 19:43:39 -04:00
Marshall Greenblatt
29381355ef chrome: Support CefSettings path config (see #3685) 2024-05-02 19:43:39 -04:00
Marshall Greenblatt
7328b9e40d views: Support themes for Alloy BrowserView in Chrome Window (see #3681)
To test:
- Run `cefclient --enable-chrome-runtime --use-alloy-style
                 --use-chrome-style-window [--background-color=green]`
- OS and Chrome theme changes behave as expected.
2024-05-02 11:21:49 -04:00
Marshall Greenblatt
b92749a58a Add DISABLE_ALLOY_BOOTSTRAP to cef_config.h (see #3681, see #3685)
Include cef_config.h from base/cef_build.h and fix detection of
args.gn changes so that defines are available everywhere by default.

Fix include configuration for chrome_elf_set and sandbox targets.
2024-05-01 14:34:32 -04:00
Marshall Greenblatt
49a34d9160 Apply new Chromium style for #include sorting
Add "cef/" prefix for CEF #includes in libcef/ directory.

Sort #includes by following
https://google.github.io/styleguide/cppguide.html#Names_and_Order_of_Includes
2024-05-01 14:34:32 -04:00
Marshall Greenblatt
b5d84c254d Add GN arg to disable Alloy bootstrap (see #3681, see #3685)
Set enable_alloy_bootstrap=false to build with Alloy bootstrap code
removed. Extension API is documented as deprecated in comments but
not compiled out with this arg.
2024-05-01 14:34:21 -04:00
reito
d666ec5770 win: osr: Fix GPU mutex logic (see #2575) 2024-04-29 14:58:26 +00:00
Marshall Greenblatt
fe5b0dd668 chrome: osr: Fix performance manager init (see #3681) 2024-04-27 15:36:59 -04:00
Marshall Greenblatt
c0e7854782 cefclient: osr: Fix compile errors with binary distribution (see #2575) 2024-04-27 15:36:58 -04:00
Marshall Greenblatt
be6642df3f chrome: Add CefDownloadHandler support (see #3681)
Behaves the same as Alloy runtime except that CanDownload is not
called for invalid protocol schemes.
2024-04-27 15:36:58 -04:00
Marshall Greenblatt
ed079792b6 chrome: Add extension support for Alloy style browsers (see #3681)
This change adds minimal tabs API support for Alloy style browsers.
Clicking links in PDF documents now navigate as expected.
2024-04-27 15:36:58 -04:00
Marshall Greenblatt
0783b4c57d win: Fix generated binaries crashing with exit code 3221225477
See https://issues.chromium.org/issues/336007395
2024-04-26 13:46:45 -04:00
Marshall Greenblatt
b537fc929b mac: Disable dangling pointer detector (see #3239)
This is enabled by default on Mac in M125 but we can't use it until
raw_ptr<> is supported by libcef. For background see
https://chromium.googlesource.com/chromium/src/+/main/docs/dangling_ptr.md
2024-04-26 10:31:40 -04:00
Marshall Greenblatt
708d90a6ff chrome: osr: Create CefWebContentsViewOSR for guest views (see #3681)
Match the logic in Alloy's CefMimeHandlerViewGuestDelegate.
2024-04-26 10:31:40 -04:00
Marshall Greenblatt
5065aba1b4 Remove explicit tracking of guest view frames
This is no longer required now that we have implicit exclusion
of certain frame types including guest view frames.

Rename GuestView to ExcludedView in the renderer process.
2024-04-26 10:31:40 -04:00
Marshall Greenblatt
65234a6830 Ignore load of excluded PDF renderer frames
Starting with M125 we get WebContentsObserver callbacks for speculative
PDF renderer frames. These callbacks should be ignored.
2024-04-26 10:31:40 -04:00
Marshall Greenblatt
b67cbc47e3 Update to Chromium version 125.0.6422.0 (#1287751) 2024-04-25 18:43:05 -04:00
Marshall Greenblatt
4fe529e2dc mac: Enable allocator shim to fix builds (see #3061)
This is a workaround for https://crbug.com/326898585
2024-04-25 18:43:04 -04:00
reito
260dd0ca24 osr: Implement shared texture support (fixes #1006, fixes #2575)
Adds support for the OnAcceleratedPaint callback. Verified to work
on macOS and Windows. Linux support is present but not implemented
for cefclient, so it is not verified to work.

To test:
Run `cefclient --off-screen-rendering-enabled --shared-texture-enabled`
2024-04-23 13:03:56 -04:00
Marshall Greenblatt
dca0435d2f chrome: Add support for Alloy style browsers and windows (see #3681)
Split the Alloy runtime into bootstrap and style components. Support
creation of Alloy style browsers and windows with the Chrome runtime.
Chrome runtime (`--enable-chrome-runtime`) + Alloy style
(`--use-alloy-style`) supports Views (`--use-views`), native parent
(`--use-native`) and windowless rendering
(`--off-screen-rendering-enabled`).

Print preview is supported in all cases except with windowless rendering
on all platforms and native parent on MacOS. It is disabled by default
with Alloy style for legacy compatibility. Where supported it can be
enabled or disabled globally using `--[enable|disable]-print-preview` or
configured on a per-RequestContext basis using the
`printing.print_preview_disabled` preference. It also behaves as
expected when triggered via the PDF viewer print button.

Chrome runtime + Alloy style behavior differs from Alloy runtime in the
following significant ways:

- Supports Chrome error pages by default.
- DevTools popups are Chrome style only (cannot be windowless).
- The Alloy extension API will not supported.

Chrome runtime + Alloy style passes all expected Alloy ceftests except
the following:

- `DisplayTest.AutoResize` (Alloy extension API not supported)
- `DownloadTest.*` (Download API not yet supported)
- `ExtensionTest.*` (Alloy extension API not supported)

This change also adds Chrome runtime support for
CefContextMenuHandler::RunContextMenu (see #3293).

This change also explicitly blocks (and doesn't retry) FrameAttached
requests from PDF viewer and print preview excluded frames (see #3664).

Known issues specific to Chrome runtime + Alloy style:
- DevTools popup with windowless rendering doesn't load successfully.
  Use windowed rendering or remote debugging as a workaround.
- Chrome style Window with Alloy style BrowserView (`--use-alloy-style
  --use-chrome-style-window`) does not show Chrome theme changes.

To test:
- Run `ceftests --enable-chrome-runtime --use-alloy-style
       [--use-chrome-style-window] [--use-views|--use-native]
       --gtest_filter=...`
- Run `cefclient --enable-chrome-runtime --use-alloy-style
       [--use-chrome-style-window]
       [--use-views|--use-native|--off-screen-rendering-enabled]`
- Run `cefsimple --enable-chrome-runtime --use-alloy-style [--use-views]`
2024-04-22 14:57:37 -04:00
Marshall Greenblatt
62c93f01f4 Avoid possible reentrancy of ThemeChanged (see #3671)
The call to SelectNativeTheme from ChromeBrowserFrame::Initialized was
causing Widget::ThemeChanged reentrancy via OnColorProviderCacheResetMissed
when running with `--enable-chrome-runtime --use-native`. Make all calls to
ThemeChanged async to avoid this and possible future issues.
2024-04-14 21:43:44 -04:00
Jacobo Aragunde Pérez
81a0648ee1 tools: Use raw strings for regexps in python scripts (fixes #3677)
Starting with Python 3.12, use of invalid escape sequences in strings
is reported as a SyntaxWarning and will become a SyntaxError at a
later point.

Regular expressions use the backslash character a lot, which result in
warnings of this kind. Python docs recommend to generally use raw
strings for this purpose.
2024-04-12 15:53:51 +00:00
Nik Pavlov
744a194a6e mac: views: Add customization point for acceptsFirstMouse (fixes #3680) 2024-04-12 15:49:31 +00:00
Nik Pavlov
96dc172980 Fix how CefV8ValueImpl differentiates INT and UINT types (fixes #3657) 2024-04-12 15:37:33 +00:00
Marshall Greenblatt
f1effba336 views: Fix destruction issues with CefOverlayViewHost 2024-04-11 15:51:42 -04:00
Marshall Greenblatt
d10cc16236 distrib: Add missing cef_color_id_macros.inc (see #3671) 2024-04-11 11:35:55 -04:00
Marshall Greenblatt
da1c3179a9 win: Fix MSVC compile error with cef_color_ids.h (see #3671)
Copy and modify ui/color/color_id_macros.inc to include an MSVC
workaround for `__VA_ARGS__` expansion.
2024-04-11 11:29:51 -04:00
Marshall Greenblatt
2e33954032 cefclient: Add missing draggable.html resource reference 2024-04-11 11:24:26 -04:00
Marshall Greenblatt
f60476b848 views: Add support for OS and Chrome themes (fixes #3610, fixes #3671)
Controls now respect OS and Chrome themes by default for both Alloy
and Chrome runtimes. Chrome themes (mode and colors) can be configured
using the new CefRequestContext::SetChromeColorScheme method. Individual
theme colors can be overridden using the new CefWindowDelegate::
OnThemeColorsChanged and CefWindow::SetThemeColor methods.

The `--force-light-mode` and `--force-dark-mode` command-line flags are
now respected on all platforms as an override for the OS theme.

The current Chrome theme, if any, will take precedence over the OS theme
when determining light/dark status. On Windows and MacOS the titlebar
color will also be updated to match the light/dark theme.

Testable as follows:
- Run: `cefclient --enable-chrome-runtime` OR
       `cefclient --use-views --persist-user-preferences --cache-path=...`
  - App launches with default OS light/dark theme colors.
  - Change OS dark/light theme under system settings. Notice that theme
    colors change as expected.
  - Right click, select items from the new Theme sub-menu. Notice that
    theme colors behave as expected.
  - Exit and relaunch the app. Notice that the last-used theme colors are
    applied on app restart.
- Add `--background-color=green` to above command-line.
  - Perform the same actions as above. Notice that all controls start
    and remain green throughout (except some icons with Chrome runtime).
- Add `--force-light-mode` or `--force-dark-mode` to above command-line.
  - Perform the same actions as above. Notice that OS dark/light theme
    changes are ignored, but Chrome theme changes work as expected.
2024-04-09 16:19:35 -04:00
Marshall Greenblatt
29c21f58e8 views: Generate cef_color_ids.h header (see #3671) 2024-04-03 12:09:22 -04:00
1157 changed files with 12655 additions and 11739 deletions

1
.gitignore vendored
View File

@@ -51,6 +51,5 @@ Thumbs.db
/binary_distrib
/docs
# CEF generated files
/include/cef_config.h
/include/cef_version.h
.ccls-cache/

349
BUILD.gn
View File

@@ -99,6 +99,7 @@ import("//build/config/locales.gni")
import("//build/config/ozone.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/ui.gni")
import("//cef/libcef/features/features.gni")
import("//chrome/common/features.gni")
import("//content/public/app/mac_helpers.gni")
import("//extensions/buildflags/buildflags.gni")
@@ -251,8 +252,7 @@ if (is_linux) {
# Set by GetRequiredArgs() in //cef/tools/gn_args.py.
#
# Set ENABLE_PRINTING=1 ENABLE_BASIC_PRINTING=1.
assert(enable_basic_printing)
# Enable support for Print Preview.
assert(enable_print_preview)
# Enable support for Widevine CDM.
@@ -349,6 +349,10 @@ if (is_win) {
"//build/config:precompiled_headers",
]
public_configs = [
"libcef/features:config",
]
if (is_component_build) {
# Avoid linker errors with content_switches.cc in component build by not
# defining CONTENT_EXPORT.
@@ -457,32 +461,14 @@ source_set("libcef_test_support") {
source_set("libcef_static") {
sources = includes_common +
gypi_paths.autogen_cpp_includes + [
"libcef/browser/alloy/alloy_browser_context.cc",
"libcef/browser/alloy/alloy_browser_context.h",
"libcef/browser/alloy/alloy_browser_host_impl.cc",
"libcef/browser/alloy/alloy_browser_host_impl.h",
"libcef/browser/alloy/alloy_browser_main.cc",
"libcef/browser/alloy/alloy_browser_main.h",
"libcef/browser/alloy/alloy_content_browser_client.cc",
"libcef/browser/alloy/alloy_content_browser_client.h",
"libcef/browser/alloy/alloy_download_util.cc",
"libcef/browser/alloy/alloy_download_util.h",
"libcef/browser/alloy/alloy_web_contents_view_delegate.cc",
"libcef/browser/alloy/alloy_web_contents_view_delegate.h",
"libcef/browser/alloy/browser_platform_delegate_alloy.cc",
"libcef/browser/alloy/browser_platform_delegate_alloy.h",
"libcef/browser/alloy/dialogs/alloy_constrained_window_views_client.cc",
"libcef/browser/alloy/dialogs/alloy_constrained_window_views_client.h",
"libcef/browser/alloy/dialogs/alloy_javascript_dialog_manager_delegate.cc",
"libcef/browser/alloy/dialogs/alloy_javascript_dialog_manager_delegate.h",
"libcef/browser/alloy/dialogs/alloy_web_contents_dialog_helper.cc",
"libcef/browser/alloy/dialogs/alloy_web_contents_dialog_helper.h",
"libcef/browser/alloy/chrome_browser_process_alloy.cc",
"libcef/browser/alloy/chrome_browser_process_alloy.h",
"libcef/browser/alloy/chrome_profile_manager_alloy.cc",
"libcef/browser/alloy/chrome_profile_manager_alloy.h",
"libcef/browser/alloy/chrome_profile_alloy.cc",
"libcef/browser/alloy/chrome_profile_alloy.h",
"libcef/browser/audio_capturer.cc",
"libcef/browser/audio_capturer.h",
"libcef/browser/audio_loopback_stream_creator.cc",
@@ -491,8 +477,6 @@ source_set("libcef_static") {
"libcef/browser/browser_contents_delegate.h",
"libcef/browser/browser_context.cc",
"libcef/browser/browser_context.h",
"libcef/browser/browser_context_keyed_service_factories.cc",
"libcef/browser/browser_context_keyed_service_factories.h",
"libcef/browser/browser_frame.cc",
"libcef/browser/browser_frame.h",
"libcef/browser/browser_host_base.cc",
@@ -528,9 +512,14 @@ source_set("libcef_static") {
"libcef/browser/chrome/chrome_content_browser_client_cef.h",
"libcef/browser/chrome/chrome_context_menu_handler.cc",
"libcef/browser/chrome/chrome_context_menu_handler.h",
"libcef/browser/chrome/chrome_devtools_window_runner.cc",
"libcef/browser/chrome/chrome_devtools_window_runner.h",
"libcef/browser/chrome/chrome_startup_browser_creator.cc",
"libcef/browser/chrome/chrome_startup_browser_creator.h",
"libcef/browser/chrome/chrome_web_contents_view_delegate_cef.h",
"libcef/browser/chrome_crash_reporter_client_stub.cc",
"libcef/browser/chrome/extensions/chrome_extension_util.cc",
"libcef/browser/chrome/extensions/chrome_extension_util.h",
"libcef/browser/chrome/extensions/chrome_mime_handler_view_guest_delegate_cef.cc",
"libcef/browser/chrome/extensions/chrome_mime_handler_view_guest_delegate_cef.h",
"libcef/browser/chrome/views/browser_platform_delegate_chrome_child_window.cc",
@@ -555,62 +544,18 @@ source_set("libcef_static") {
"libcef/browser/context_menu_params_impl.h",
"libcef/browser/devtools/devtools_controller.cc",
"libcef/browser/devtools/devtools_controller.h",
"libcef/browser/devtools/devtools_file_manager.cc",
"libcef/browser/devtools/devtools_file_manager.h",
"libcef/browser/devtools/devtools_frontend.cc",
"libcef/browser/devtools/devtools_frontend.h",
"libcef/browser/devtools/devtools_manager.cc",
"libcef/browser/devtools/devtools_manager.h",
"libcef/browser/devtools/devtools_manager_delegate.cc",
"libcef/browser/devtools/devtools_manager_delegate.h",
"libcef/browser/devtools/devtools_protocol_manager.cc",
"libcef/browser/devtools/devtools_protocol_manager.h",
"libcef/browser/devtools/devtools_window_runner.h",
"libcef/browser/devtools/devtools_window_runner_create.cc",
"libcef/browser/download_item_impl.cc",
"libcef/browser/download_item_impl.h",
"libcef/browser/download_manager_delegate.cc",
"libcef/browser/download_manager_delegate.h",
"libcef/browser/extension_impl.cc",
"libcef/browser/extension_impl.h",
"libcef/browser/extensions/api/file_system/cef_file_system_delegate.cc",
"libcef/browser/extensions/api/file_system/cef_file_system_delegate.h",
"libcef/browser/extensions/api/storage/sync_value_store_cache.cc",
"libcef/browser/extensions/api/storage/sync_value_store_cache.h",
"libcef/browser/extensions/api/tabs/tabs_api.cc",
"libcef/browser/extensions/api/tabs/tabs_api.h",
"libcef/browser/extensions/alloy_extensions_util.cc",
"libcef/browser/extensions/alloy_extensions_util.h",
"libcef/browser/download_manager_delegate_impl.cc",
"libcef/browser/download_manager_delegate_impl.h",
"libcef/browser/extensions/browser_extensions_util.cc",
"libcef/browser/extensions/browser_extensions_util.h",
"libcef/browser/extensions/browser_platform_delegate_background.cc",
"libcef/browser/extensions/browser_platform_delegate_background.h",
"libcef/browser/extensions/chrome_api_registration.cc",
"libcef/browser/extensions/chrome_api_registration.h",
"libcef/browser/extensions/component_extension_resource_manager.cc",
"libcef/browser/extensions/component_extension_resource_manager.h",
"libcef/browser/extensions/extensions_api_client.cc",
"libcef/browser/extensions/extensions_api_client.h",
"libcef/browser/extensions/extensions_browser_api_provider.cc",
"libcef/browser/extensions/extensions_browser_api_provider.h",
"libcef/browser/extensions/extensions_browser_client.cc",
"libcef/browser/extensions/extensions_browser_client.h",
"libcef/browser/extensions/extension_background_host.cc",
"libcef/browser/extensions/extension_background_host.h",
"libcef/browser/extensions/extension_function_details.cc",
"libcef/browser/extensions/extension_function_details.h",
"libcef/browser/extensions/extension_host_delegate.cc",
"libcef/browser/extensions/extension_host_delegate.h",
"libcef/browser/extensions/extension_system.cc",
"libcef/browser/extensions/extension_system.h",
"libcef/browser/extensions/extension_system_factory.cc",
"libcef/browser/extensions/extension_system_factory.h",
"libcef/browser/extensions/extension_view_host.cc",
"libcef/browser/extensions/extension_view_host.h",
"libcef/browser/extensions/extension_web_contents_observer.cc",
"libcef/browser/extensions/extension_web_contents_observer.h",
"libcef/browser/extensions/mime_handler_view_guest_delegate.cc",
"libcef/browser/extensions/mime_handler_view_guest_delegate.h",
"libcef/browser/extensions/value_store/cef_value_store.cc",
"libcef/browser/extensions/value_store/cef_value_store.h",
"libcef/browser/extensions/value_store/cef_value_store_factory.cc",
"libcef/browser/extensions/value_store/cef_value_store_factory.h",
"libcef/browser/file_dialog_manager.cc",
"libcef/browser/file_dialog_manager.h",
"libcef/browser/file_dialog_runner.cc",
@@ -633,8 +578,6 @@ source_set("libcef_static") {
"libcef/browser/main_runner.h",
"libcef/browser/media_access_query.cc",
"libcef/browser/media_access_query.h",
"libcef/browser/media_capture_devices_dispatcher.cc",
"libcef/browser/media_capture_devices_dispatcher.h",
"libcef/browser/media_router/media_route_impl.cc",
"libcef/browser/media_router/media_route_impl.h",
"libcef/browser/media_router/media_router_impl.cc",
@@ -663,12 +606,6 @@ source_set("libcef_static") {
"libcef/browser/net/chrome_scheme_handler.cc",
"libcef/browser/net/chrome_scheme_handler.h",
"libcef/browser/net/crlset_file_util_impl.cc",
"libcef/browser/net/devtools_scheme_handler.cc",
"libcef/browser/net/devtools_scheme_handler.h",
"libcef/browser/net/internal_scheme_handler.cc",
"libcef/browser/net/internal_scheme_handler.h",
"libcef/browser/net/scheme_handler.cc",
"libcef/browser/net/scheme_handler.h",
"libcef/browser/net/throttle_handler.cc",
"libcef/browser/net/throttle_handler.h",
"libcef/browser/net_service/browser_urlrequest_impl.cc",
@@ -724,8 +661,6 @@ source_set("libcef_static") {
"libcef/browser/prefs/pref_helper.h",
"libcef/browser/prefs/pref_registrar.cc",
"libcef/browser/prefs/pref_registrar.h",
"libcef/browser/prefs/pref_store.cc",
"libcef/browser/prefs/pref_store.h",
"libcef/browser/prefs/renderer_prefs.cc",
"libcef/browser/prefs/renderer_prefs.h",
"libcef/browser/print_settings_impl.cc",
@@ -742,10 +677,6 @@ source_set("libcef_static") {
"libcef/browser/server_impl.h",
"libcef/browser/simple_menu_model_impl.cc",
"libcef/browser/simple_menu_model_impl.h",
"libcef/browser/speech_recognition_manager_delegate.cc",
"libcef/browser/speech_recognition_manager_delegate.h",
"libcef/browser/ssl_host_state_delegate.cc",
"libcef/browser/ssl_host_state_delegate.h",
"libcef/browser/ssl_info_impl.cc",
"libcef/browser/ssl_info_impl.h",
"libcef/browser/ssl_status_impl.cc",
@@ -828,12 +759,6 @@ source_set("libcef_static") {
"libcef/browser/xml_reader_impl.h",
"libcef/browser/zip_reader_impl.cc",
"libcef/browser/zip_reader_impl.h",
"libcef/common/alloy/alloy_content_client.cc",
"libcef/common/alloy/alloy_content_client.h",
"libcef/common/alloy/alloy_main_delegate.cc",
"libcef/common/alloy/alloy_main_delegate.h",
"libcef/common/alloy/alloy_main_runner_delegate.cc",
"libcef/common/alloy/alloy_main_runner_delegate.h",
"libcef/common/app_manager.cc",
"libcef/common/app_manager.h",
"libcef/common/base_impl.cc",
@@ -853,14 +778,6 @@ source_set("libcef_static") {
"libcef/common/crash_reporting.h",
"libcef/common/drag_data_impl.cc",
"libcef/common/drag_data_impl.h",
"libcef/common/extensions/chrome_generated_schemas.cc",
"libcef/common/extensions/chrome_generated_schemas.h",
"libcef/common/extensions/extensions_api_provider.cc",
"libcef/common/extensions/extensions_api_provider.h",
"libcef/common/extensions/extensions_client.cc",
"libcef/common/extensions/extensions_client.h",
"libcef/common/extensions/extensions_util.cc",
"libcef/common/extensions/extensions_util.h",
"libcef/common/file_util_impl.cc",
"libcef/common/frame_util.cc",
"libcef/common/frame_util.h",
@@ -870,8 +787,6 @@ source_set("libcef_static") {
"libcef/common/main_runner_handler.h",
"libcef/common/net/http_header_utils.cc",
"libcef/common/net/http_header_utils.h",
"libcef/common/net/net_resource_provider.cc",
"libcef/common/net/net_resource_provider.h",
"libcef/common/net/scheme_registration.cc",
"libcef/common/net/scheme_registration.h",
"libcef/common/net/url_util.cc",
@@ -921,12 +836,6 @@ source_set("libcef_static") {
"libcef/common/waitable_event_impl.h",
"libcef/features/runtime.h",
"libcef/features/runtime_checks.h",
"libcef/renderer/alloy/alloy_content_renderer_client.cc",
"libcef/renderer/alloy/alloy_content_renderer_client.h",
"libcef/renderer/alloy/alloy_render_thread_observer.cc",
"libcef/renderer/alloy/alloy_render_thread_observer.h",
"libcef/renderer/alloy/url_loader_throttle_provider_impl.cc",
"libcef/renderer/alloy/url_loader_throttle_provider_impl.h",
"libcef/renderer/browser_impl.cc",
"libcef/renderer/browser_impl.h",
"libcef/renderer/chrome/chrome_content_renderer_client_cef.cc",
@@ -939,8 +848,6 @@ source_set("libcef_static") {
"libcef/renderer/extensions/extensions_renderer_api_provider.h",
"libcef/renderer/extensions/extensions_renderer_client.cc",
"libcef/renderer/extensions/extensions_renderer_client.h",
"libcef/renderer/extensions/print_render_frame_helper_delegate.cc",
"libcef/renderer/extensions/print_render_frame_helper_delegate.h",
"libcef/renderer/frame_impl.cc",
"libcef/renderer/frame_impl.h",
"libcef/renderer/render_frame_observer.cc",
@@ -958,6 +865,121 @@ source_set("libcef_static") {
"//chrome/app/chrome_main_delegate.h",
]
if (enable_alloy_bootstrap) {
sources += [
"libcef/browser/alloy/alloy_browser_context.cc",
"libcef/browser/alloy/alloy_browser_context.h",
"libcef/browser/alloy/alloy_browser_main.cc",
"libcef/browser/alloy/alloy_browser_main.h",
"libcef/browser/alloy/alloy_content_browser_client.cc",
"libcef/browser/alloy/alloy_content_browser_client.h",
"libcef/browser/alloy/alloy_download_manager_delegate.cc",
"libcef/browser/alloy/alloy_download_manager_delegate.h",
"libcef/browser/alloy/alloy_download_util.cc",
"libcef/browser/alloy/alloy_download_util.h",
"libcef/browser/alloy/alloy_web_contents_view_delegate.cc",
"libcef/browser/alloy/alloy_web_contents_view_delegate.h",
"libcef/browser/alloy/devtools/alloy_devtools_window_runner.cc",
"libcef/browser/alloy/devtools/alloy_devtools_window_runner.h",
"libcef/browser/alloy/devtools/devtools_file_manager.cc",
"libcef/browser/alloy/devtools/devtools_file_manager.h",
"libcef/browser/alloy/devtools/devtools_frontend.cc",
"libcef/browser/alloy/devtools/devtools_frontend.h",
"libcef/browser/alloy/devtools/devtools_manager_delegate.cc",
"libcef/browser/alloy/devtools/devtools_manager_delegate.h",
"libcef/browser/alloy/dialogs/alloy_javascript_dialog_manager_delegate.cc",
"libcef/browser/alloy/dialogs/alloy_javascript_dialog_manager_delegate.h",
"libcef/browser/alloy/chrome_browser_process_alloy.cc",
"libcef/browser/alloy/chrome_browser_process_alloy.h",
"libcef/browser/alloy/chrome_profile_manager_alloy.cc",
"libcef/browser/alloy/chrome_profile_manager_alloy.h",
"libcef/browser/alloy/chrome_profile_alloy.cc",
"libcef/browser/alloy/chrome_profile_alloy.h",
"libcef/browser/browser_context_keyed_service_factories.cc",
"libcef/browser/browser_context_keyed_service_factories.h",
"libcef/browser/extension_impl.cc",
"libcef/browser/extension_impl.h",
"libcef/browser/extensions/api/file_system/cef_file_system_delegate.cc",
"libcef/browser/extensions/api/file_system/cef_file_system_delegate.h",
"libcef/browser/extensions/api/storage/sync_value_store_cache.cc",
"libcef/browser/extensions/api/storage/sync_value_store_cache.h",
"libcef/browser/extensions/api/tabs/tabs_api.cc",
"libcef/browser/extensions/api/tabs/tabs_api.h",
"libcef/browser/extensions/alloy_extensions_util.cc",
"libcef/browser/extensions/alloy_extensions_util.h",
"libcef/browser/extensions/browser_platform_delegate_background.cc",
"libcef/browser/extensions/browser_platform_delegate_background.h",
"libcef/browser/extensions/chrome_api_registration.cc",
"libcef/browser/extensions/chrome_api_registration.h",
"libcef/browser/extensions/component_extension_resource_manager.cc",
"libcef/browser/extensions/component_extension_resource_manager.h",
"libcef/browser/extensions/extensions_api_client.cc",
"libcef/browser/extensions/extensions_api_client.h",
"libcef/browser/extensions/extensions_browser_api_provider.cc",
"libcef/browser/extensions/extensions_browser_api_provider.h",
"libcef/browser/extensions/extensions_browser_client.cc",
"libcef/browser/extensions/extensions_browser_client.h",
"libcef/browser/extensions/extension_background_host.cc",
"libcef/browser/extensions/extension_background_host.h",
"libcef/browser/extensions/extension_function_details.cc",
"libcef/browser/extensions/extension_function_details.h",
"libcef/browser/extensions/extension_host_delegate.cc",
"libcef/browser/extensions/extension_host_delegate.h",
"libcef/browser/extensions/extension_system.cc",
"libcef/browser/extensions/extension_system.h",
"libcef/browser/extensions/extension_system_factory.cc",
"libcef/browser/extensions/extension_system_factory.h",
"libcef/browser/extensions/extension_view_host.cc",
"libcef/browser/extensions/extension_view_host.h",
"libcef/browser/extensions/extension_web_contents_observer.cc",
"libcef/browser/extensions/extension_web_contents_observer.h",
"libcef/browser/extensions/mime_handler_view_guest_delegate.cc",
"libcef/browser/extensions/mime_handler_view_guest_delegate.h",
"libcef/browser/extensions/value_store/cef_value_store.cc",
"libcef/browser/extensions/value_store/cef_value_store.h",
"libcef/browser/extensions/value_store/cef_value_store_factory.cc",
"libcef/browser/extensions/value_store/cef_value_store_factory.h",
"libcef/browser/media_capture_devices_dispatcher.cc",
"libcef/browser/media_capture_devices_dispatcher.h",
"libcef/browser/net/devtools_scheme_handler.cc",
"libcef/browser/net/devtools_scheme_handler.h",
"libcef/browser/net/internal_scheme_handler.cc",
"libcef/browser/net/internal_scheme_handler.h",
"libcef/browser/net/scheme_handler.cc",
"libcef/browser/net/scheme_handler.h",
"libcef/browser/prefs/pref_store.cc",
"libcef/browser/prefs/pref_store.h",
"libcef/browser/speech_recognition_manager_delegate.cc",
"libcef/browser/speech_recognition_manager_delegate.h",
"libcef/browser/ssl_host_state_delegate.cc",
"libcef/browser/ssl_host_state_delegate.h",
"libcef/common/alloy/alloy_content_client.cc",
"libcef/common/alloy/alloy_content_client.h",
"libcef/common/alloy/alloy_main_delegate.cc",
"libcef/common/alloy/alloy_main_delegate.h",
"libcef/common/alloy/alloy_main_runner_delegate.cc",
"libcef/common/alloy/alloy_main_runner_delegate.h",
"libcef/common/extensions/chrome_generated_schemas.cc",
"libcef/common/extensions/chrome_generated_schemas.h",
"libcef/common/extensions/extensions_api_provider.cc",
"libcef/common/extensions/extensions_api_provider.h",
"libcef/common/extensions/extensions_client.cc",
"libcef/common/extensions/extensions_client.h",
"libcef/common/extensions/extensions_util.cc",
"libcef/common/extensions/extensions_util.h",
"libcef/common/net/net_resource_provider.cc",
"libcef/common/net/net_resource_provider.h",
"libcef/renderer/alloy/alloy_content_renderer_client.cc",
"libcef/renderer/alloy/alloy_content_renderer_client.h",
"libcef/renderer/alloy/alloy_render_frame_observer.cc",
"libcef/renderer/alloy/alloy_render_frame_observer.h",
"libcef/renderer/alloy/alloy_render_thread_observer.cc",
"libcef/renderer/alloy/alloy_render_thread_observer.h",
"libcef/renderer/alloy/url_loader_throttle_provider_impl.cc",
"libcef/renderer/alloy/url_loader_throttle_provider_impl.h",
]
}
configs += [
"libcef/features:config",
"//build/config:precompiled_headers",
@@ -995,7 +1017,6 @@ source_set("libcef_static") {
# Normal build dependencies. Should be sorted alphabetically.
"//base:base_static",
"//base/third_party/dynamic_annotations",
"//cc",
"//chrome:dependencies",
"//chrome:packed_resources",
@@ -1106,12 +1127,6 @@ source_set("libcef_static") {
deps += [ "//content:sandbox_helper_win" ]
}
libs = [
"comctl32.lib",
# For D3D11_DECODER_PROFILE_H264_VLD_NOFGT.
"dxguid.lib",
]
data_deps = [
"//chrome/elevation_service",
]
@@ -1151,6 +1166,8 @@ source_set("libcef_static") {
if (is_mac) {
sources += includes_mac + [
"libcef/browser/chrome/chrome_content_browser_client_cef_mac.mm",
"libcef/browser/chrome/chrome_web_contents_view_delegate_cef_mac.mm",
"libcef/browser/native/browser_platform_delegate_native_mac.h",
"libcef/browser/native/browser_platform_delegate_native_mac.mm",
"libcef/browser/native/cursor_util_mac.mm",
@@ -1172,6 +1189,10 @@ source_set("libcef_static") {
"//chrome/app/chrome_main_mac.h",
"//chrome/app/chrome_main_mac.mm",
]
} else {
sources += [
"libcef/browser/chrome/chrome_web_contents_view_delegate_cef.cc",
]
}
if (ozone_platform_x11) {
@@ -1222,19 +1243,30 @@ config("libcef_autogen_config") {
}
}
# Configuration that supports #include paths relative to src/cef/ for CEF
# client-side code. CEF library-side code (Chromium code and cef/libcef/
# directory) uses #include paths relative to src/. See libcef/features:config
# for CEF library-side configuration.
config("libcef_includes_config") {
include_dirs = [
# cef/include/ directory and CEF client-side code use #includes relative to
# the cef/ directory.
".",
# CEF generated header files that also need to be discoverable.
# These #includes from client-side code will not be prefixed with cef/.
# They will be copied to the include/ directory in the binary distribution.
"$root_out_dir/includes/cef",
]
}
# Configuration that will be applied to all targets that depend on
# libcef_dll_wrapper.
config("libcef_dll_wrapper_config") {
include_dirs = [
# CEF sources use include paths relative to the CEF root directory.
".",
# CEF generates some header files that also need to be discoverable.
# They will be copied to the include/ directory in the binary distribution.
"$root_out_dir/includes",
configs = [
":libcef_autogen_config",
":libcef_includes_config",
]
configs = [ ":libcef_autogen_config" ]
if (is_win) {
if (current_cpu == "x86") {
# Set the initial stack size to 0.5MiB, instead of the 1.5MiB minimum
@@ -1282,20 +1314,23 @@ static_library("libcef_dll_wrapper") {
if (is_win) {
static_library("cef_sandbox") {
sources = [ "libcef_dll/sandbox/sandbox_win.cc" ]
# CEF sources use include paths relative to the CEF root directory.
include_dirs = [ "." ]
deps = [ "libcef/features", "//sandbox" ]
configs += [ ":libcef_includes_config" ]
deps = [
":make_config_header",
"libcef/features",
"//sandbox",
]
}
}
if (is_mac) {
static_library("cef_sandbox") {
sources = [ "libcef_dll/sandbox/sandbox_mac.mm" ]
# CEF sources use include paths relative to the CEF root directory.
include_dirs = [ "." ]
configs += [ ":libcef_includes_config" ]
deps = [
":make_config_header",
"//build/config:executable_deps",
"//sandbox/mac:seatbelt"
"//sandbox/mac:seatbelt",
]
}
}
@@ -1351,7 +1386,7 @@ template("make_pack_header") {
# Generate cef_pack_resources.h.
make_pack_header("resources") {
header = "$root_out_dir/includes/include/cef_pack_resources.h"
header = "$root_out_dir/includes/cef/include/cef_pack_resources.h"
inputs = [
"$root_gen_dir/base/tracing/protos/grit/tracing_proto_resources.h",
"$root_gen_dir/cef/grit/cef_resources.h",
@@ -1415,7 +1450,7 @@ make_pack_header("resources") {
# Generate cef_pack_strings.h.
make_pack_header("strings") {
header = "$root_out_dir/includes/include/cef_pack_strings.h"
header = "$root_out_dir/includes/cef/include/cef_pack_strings.h"
inputs = [
"$root_gen_dir/cef/grit/cef_strings.h",
"$root_gen_dir/chrome/grit/branded_strings.h",
@@ -1453,7 +1488,7 @@ make_pack_header("strings") {
# Generate cef_command_ids.h.
make_pack_header("command_ids") {
header = "$root_out_dir/includes/include/cef_command_ids.h"
header = "$root_out_dir/includes/cef/include/cef_command_ids.h"
inputs = [
"//chrome/app/chrome_command_ids.h",
]
@@ -1471,18 +1506,29 @@ action("make_api_hash_header") {
gypi_paths2.includes_capi +
gypi_paths.autogen_capi_includes
include_dir = [ "include" ]
outputs = [ "$root_out_dir/includes/include/cef_api_hash.h" ]
outputs = [ "$root_out_dir/includes/cef/include/cef_api_hash.h" ]
args = rebase_path(outputs + include_dir, root_build_dir)
}
# This no-op action lists args.gn as an output, allowing it to be referenced as
# an input (trigger) for other actions. Otherwise, GN will complain that no
# target generates the args.gn file because its below the $root_out_dir.
action("args_gn_source") {
script = "//build/noop.py"
outputs = [ "$root_out_dir/args.gn" ]
}
# Generate cef_config.h.
action("make_config_header") {
script = "tools/make_config_header.py"
outputs = [ "$root_out_dir/includes/include/cef_config.h" ]
deps = [ ":args_gn_source" ]
args = rebase_path(outputs + [ "$root_out_dir/args.gn" ], root_build_dir)
inputs = [ "$root_out_dir/args.gn" ]
outputs = [ "$root_out_dir/includes/cef/include/cef_config.h" ]
args = rebase_path(outputs + inputs, root_build_dir)
}
# Generate cef_color_ids.h.
@@ -1494,7 +1540,7 @@ action("make_colorids_header") {
"//components/color/color_id.h",
"//chrome/browser/ui/color/chrome_color_id.h",
]
outputs = [ "$root_out_dir/includes/include/cef_color_ids.h" ]
outputs = [ "$root_out_dir/includes/cef/include/cef_color_ids.h" ]
args = rebase_path(outputs + inputs, root_build_dir)
}
@@ -1705,6 +1751,12 @@ if (is_mac) {
# Delay-load as many DLLs as possible for sandbox and startup perf
# improvements.
configs += [ "//build/config/win:delayloads" ]
libs = [
"comctl32.lib",
# For D3D11_DECODER_PROFILE_H264_VLD_NOFGT.
"dxguid.lib",
]
}
if (is_linux && !is_debug && !use_partition_alloc_as_malloc) {
@@ -1924,13 +1976,6 @@ if (is_mac) {
]
}
bundle_data("cefclient_resources_bundle_data_extensions_set_page_color") {
sources = gypi_paths2.cefclient_sources_resources_extensions_set_page_color
outputs = [
"{{bundle_resources_dir}}/extensions/set_page_color/{{source_file_part}}",
]
}
bundle_data("cefclient_resources_bundle_data_english") {
sources = [
"tests/cefclient/resources/mac/English.lproj/InfoPlist.strings",
@@ -1980,7 +2025,6 @@ if (is_mac) {
gypi_paths2.cefclient_sources_mac
deps = [
":cefclient_resources_bundle_data",
":cefclient_resources_bundle_data_extensions_set_page_color",
":cefclient_resources_bundle_data_english",
":cefclient_xibs",
]
@@ -2170,11 +2214,6 @@ if (is_mac) {
gypi_paths2.cefclient_sources_resources
outputs = [ "${root_out_dir}/cefclient_files/{{source_file_part}}" ]
}
copy("copy_cefclient_files_extensions_set_page_color") {
sources = gypi_paths2.cefclient_sources_resources_extensions_set_page_color
outputs = [ "${root_out_dir}/cefclient_files/extensions/set_page_color/{{source_file_part}}" ]
}
}
executable("cefclient") {
@@ -2232,8 +2271,13 @@ if (is_mac) {
if (target_cpu != "arm64") {
libs += [
"glu32.lib",
"opengl32.lib",
"glu32.lib"
]
ldflags = [
"/DELAYLOAD:glu32.dll",
"/DELAYLOAD:oleaut32.dll",
"/DELAYLOAD:opengl32.dll",
]
}
}
@@ -2245,7 +2289,6 @@ if (is_mac) {
deps += [
":copy_cefclient_files",
":copy_cefclient_files_extensions_set_page_color",
]
libs = [

View File

@@ -7,6 +7,5 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': 'refs/tags/124.0.6367.207',
'depot_tools_checkout': '19199514e8'
'chromium_checkout': 'refs/tags/127.0.6533.43'
}

View File

@@ -240,16 +240,18 @@ PRINT_CEF_CONFIG()
# Define the API documentation target.
#
find_package(Doxygen)
if(DOXYGEN_FOUND)
add_custom_target(apidocs ALL
# Generate documentation in the docs/html directory.
COMMAND "${DOXYGEN_EXECUTABLE}" Doxyfile
# Write a docs/index.html file.
COMMAND ${CMAKE_COMMAND} -E echo "<html><head><meta http-equiv=\"refresh\" content=\"0;URL='html/index.html'\"/></head></html>" > docs/index.html
WORKING_DIRECTORY "${CEF_ROOT}"
COMMENT "Generating API documentation with Doxygen..."
VERBATIM )
else()
message(WARNING "Doxygen must be installed to generate API documentation.")
endif()
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile")
find_package(Doxygen)
if(DOXYGEN_FOUND)
add_custom_target(apidocs ALL
# Generate documentation in the docs/html directory.
COMMAND "${DOXYGEN_EXECUTABLE}" Doxyfile
# Write a docs/index.html file.
COMMAND ${CMAKE_COMMAND} -E echo "<html><head><meta http-equiv=\"refresh\" content=\"0;URL='html/index.html'\"/></head></html>" > docs/index.html
WORKING_DIRECTORY "${CEF_ROOT}"
COMMENT "Generating API documentation with Doxygen..."
VERBATIM )
else()
message(WARNING "Doxygen must be installed to generate API documentation.")
endif()
endif()

View File

@@ -20,7 +20,6 @@
'include/base/cef_logging.h',
'include/base/cef_macros.h',
'include/base/cef_platform_thread.h',
'include/base/cef_ptr_util.h',
'include/base/cef_ref_counted.h',
'include/base/cef_scoped_refptr.h',
'include/base/cef_thread_checker.h',
@@ -54,9 +53,10 @@
'include/internal/cef_time.h',
'include/internal/cef_trace_event_internal.h',
'include/internal/cef_types.h',
'include/internal/cef_types_color.h',
'include/internal/cef_types_content_settings.h',
'include/internal/cef_types_geometry.h',
'include/internal/cef_types_runtime.h',
'include/internal/cef_types_color.h',
],
'includes_capi': [
'include/capi/cef_base_capi.h',
@@ -166,8 +166,6 @@
'shared_sources_browser': [
'tests/shared/browser/client_app_browser.cc',
'tests/shared/browser/client_app_browser.h',
'tests/shared/browser/extension_util.cc',
'tests/shared/browser/extension_util.h',
'tests/shared/browser/file_util.cc',
'tests/shared/browser/file_util.h',
'tests/shared/browser/geometry_util.cc',
@@ -337,13 +335,6 @@
'tests/cefclient/resources/window.html',
'tests/cefclient/resources/xmlhttprequest.html',
],
'cefclient_sources_resources_extensions_set_page_color': [
'tests/cefclient/resources/extensions/set_page_color/icon.png',
'tests/cefclient/resources/extensions/set_page_color/manifest.json',
'tests/cefclient/resources/extensions/set_page_color/popup.html',
'tests/cefclient/resources/extensions/set_page_color/popup.js',
'tests/cefclient/resources/extensions/set_page_color/README.md',
],
'cefclient_sources_win': [
'tests/cefclient/browser/browser_window_osr_win.cc',
'tests/cefclient/browser/browser_window_osr_win.h',
@@ -490,13 +481,6 @@
'tests/ceftests/dom_unittest.cc',
'tests/ceftests/download_unittest.cc',
'tests/ceftests/draggable_regions_unittest.cc',
'tests/ceftests/extensions/background_unittest.cc',
'tests/ceftests/extensions/chrome_alarms_unittest.cc',
'tests/ceftests/extensions/chrome_storage_unittest.cc',
'tests/ceftests/extensions/chrome_tabs_unittest.cc',
'tests/ceftests/extensions/extension_test_handler.cc',
'tests/ceftests/extensions/extension_test_handler.h',
'tests/ceftests/extensions/view_unittest.cc',
'tests/ceftests/file_util_unittest.cc',
'tests/ceftests/frame_handler_unittest.cc',
'tests/ceftests/frame_unittest.cc',

View File

@@ -69,7 +69,28 @@
#if defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly.
#include "build/build_config.h"
#include "cef/libcef/features/features.h"
// The following #defines are used in cef/include/ headers and CEF client-side
// code. CEF library-side code should use BUILDFLAG checks directly instead of
// these #defines. CEF client-side code will get these #defines from
// cef_config.h so any changes must also be reflected in
// tools/make_config_header.py.
#if BUILDFLAG(IS_LINUX)
#include "ui/base/ozone_buildflags.h"
#if BUILDFLAG(IS_OZONE_X11)
#define CEF_X11 1
#endif
#endif
#if !BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
#define DISABLE_ALLOY_BOOTSTRAP 1
#endif
#else // !USING_CHROMIUM_INCLUDES
#include "include/cef_config.h"
// The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be
// updated to match.

View File

@@ -1,60 +0,0 @@
// Copyright (c) 2021 Marshall A. Greenblatt. Portions copyright (c) 2015
// Google Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDE_BASE_CEF_PTR_UTIL_H_
#define INCLUDE_BASE_CEF_PTR_UTIL_H_
#pragma once
#if defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly.
#include "base/memory/ptr_util.h"
#else // !USING_CHROMIUM_INCLUDES
// The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be
// updated to match.
#include <memory>
#include <utility>
namespace base {
///
/// Helper to transfer ownership of a raw pointer to a std::unique_ptr<T>.
/// Note that std::unique_ptr<T> has very different semantics from
/// std::unique_ptr<T[]>: do not use this helper for array allocations.
///
template <typename T>
std::unique_ptr<T> WrapUnique(T* ptr) {
return std::unique_ptr<T>(ptr);
}
} // namespace base
#endif // INCLUDE_BASE_CEF_PTR_UTIL_H_

View File

@@ -66,6 +66,7 @@
// updated to match.
#include <stddef.h>
#include <tuple>
#include <utility>

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=abcb584dbf5965834f415a0f2daeda3e361696b2$
// $hash=6ee74f31d37a1b5ab3c9c5ccbe2dce9841329b38$
//
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_
@@ -911,6 +911,8 @@ typedef struct _cef_browser_host_t {
/// Returns the extension hosted in this browser or NULL if no extension is
/// hosted. See cef_request_context_t::LoadExtension for details.
///
/// WARNING: This function is deprecated and will be removed in ~M127.
///
struct _cef_extension_t*(CEF_CALLBACK* get_extension)(
struct _cef_browser_host_t* self);
@@ -919,6 +921,8 @@ typedef struct _cef_browser_host_t {
/// script. Background hosts do not have a window and are not displayable. See
/// cef_request_context_t::LoadExtension for details.
///
/// WARNING: This function is deprecated and will be removed in ~M127.
///
int(CEF_CALLBACK* is_background_host)(struct _cef_browser_host_t* self);
///
@@ -985,6 +989,13 @@ typedef struct _cef_browser_host_t {
///
int(CEF_CALLBACK* is_render_process_unresponsive)(
struct _cef_browser_host_t* self);
///
/// Returns the runtime style for this browser (ALLOY or CHROME). See
/// cef_runtime_style_t documentation for details.
///
cef_runtime_style_t(CEF_CALLBACK* get_runtime_style)(
struct _cef_browser_host_t* self);
} cef_browser_host_t;
///

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=5644fdc2453dd083079bf9e3616b687eeb49f250$
// $hash=bf7208a86ee17f63fd7163cef8c3a13373a1f1c8$
//
#ifndef CEF_INCLUDE_CAPI_CEF_DIALOG_HANDLER_CAPI_H_
@@ -86,13 +86,20 @@ typedef struct _cef_dialog_handler_t {
/// to show the default title ("Open" or "Save" depending on the mode).
/// |default_file_path| is the path with optional directory and/or file name
/// component that should be initially selected in the dialog.
/// |accept_filters| are used to restrict the selectable file types and may
/// any combination of (a) valid lower-cased MIME types (e.g. "text/*" or
/// "image/*"), (b) individual file extensions (e.g. ".txt" or ".png"), or (c)
/// combined description and file extension delimited using "|" and ";" (e.g.
/// "Image Types|.png;.gif;.jpg"). To display a custom dialog return true (1)
/// and execute |callback| either inline or at a later time. To display the
/// default dialog return false (0).
/// |accept_filters| are used to restrict the selectable file types and may be
/// any combination of valid lower-cased MIME types (e.g. "text/*" or
/// "image/*") and individual file extensions (e.g. ".txt" or ".png").
/// |accept_extensions| provides the semicolon-delimited expansion of MIME
/// types to file extensions (if known, or NULL string otherwise).
/// |accept_descriptions| provides the descriptions for MIME types (if known,
/// or NULL string otherwise). For example, the "image/*" mime type might have
/// extensions ".png;.jpg;.bmp;..." and description "Image Files".
/// |accept_filters|, |accept_extensions| and |accept_descriptions| will all
/// be the same size. To display a custom dialog return true (1) and execute
/// |callback| either inline or at a later time. To display the default dialog
/// return false (0). If this function returns false (0) it may be called an
/// additional time for the same dialog (both before and after MIME type
/// expansion).
///
int(CEF_CALLBACK* on_file_dialog)(
struct _cef_dialog_handler_t* self,
@@ -101,6 +108,8 @@ typedef struct _cef_dialog_handler_t {
const cef_string_t* title,
const cef_string_t* default_file_path,
cef_string_list_t accept_filters,
cef_string_list_t accept_extensions,
cef_string_list_t accept_descriptions,
struct _cef_file_dialog_callback_t* callback);
} cef_dialog_handler_t;

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=60a08a60be70e8fe5df17f18f8e5758e1830d5e1$
// $hash=7ecfb07a95315ff81937e9f68d419122fc88f1b7$
//
#ifndef CEF_INCLUDE_CAPI_CEF_DOWNLOAD_HANDLER_CAPI_H_
@@ -117,12 +117,13 @@ typedef struct _cef_download_handler_t {
///
/// Called before a download begins. |suggested_name| is the suggested name
/// for the download file. By default the download will be canceled. Execute
/// |callback| either asynchronously or in this function to continue the
/// download if desired. Do not keep a reference to |download_item| outside of
/// this function.
/// for the download file. Return true (1) and execute |callback| either
/// asynchronously or in this function to continue or cancel the download.
/// Return false (0) to proceed with default handling (cancel with Alloy
/// style, download shelf with Chrome style). Do not keep a reference to
/// |download_item| outside of this function.
///
void(CEF_CALLBACK* on_before_download)(
int(CEF_CALLBACK* on_before_download)(
struct _cef_download_handler_t* self,
struct _cef_browser_t* browser,
struct _cef_download_item_t* download_item,

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=0ca2b788f70f8c9f5b2706d691d8e063be00ed19$
// $hash=634054ad25154c30fb4ec630fe7fb79b0cf1f9b3$
//
#ifndef CEF_INCLUDE_CAPI_CEF_EXTENSION_CAPI_H_
@@ -54,6 +54,8 @@ struct _cef_request_context_t;
/// Object representing an extension. Methods may be called on any thread unless
/// otherwise indicated.
///
/// WARNING: This API is deprecated and will be removed in ~M127.
///
typedef struct _cef_extension_t {
///
/// Base structure.

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=5cfff4465a586d2b2ea7b54a9549096faec415f6$
// $hash=ebac34c9b85de780ce7524211c5dd61a80d4576c$
//
#ifndef CEF_INCLUDE_CAPI_CEF_EXTENSION_HANDLER_CAPI_H_
@@ -80,6 +80,8 @@ typedef struct _cef_get_extension_resource_callback_t {
/// cef_request_context_t::LoadExtension for information about extension
/// loading.
///
/// WARNING: This API is deprecated and will be removed in ~M127.
///
typedef struct _cef_extension_handler_t {
///
/// Base structure.

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=7df03921b2ee743fb059f13e545ccf89904eb060$
// $hash=2c496139ca9a59303b1493ee93d2c3ae96a956c0$
//
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_CAPI_H_
@@ -253,6 +253,8 @@ typedef struct _cef_request_context_t {
/// See https://developer.chrome.com/extensions for extension implementation
/// and usage documentation.
///
/// WARNING: This function is deprecated and will be removed in ~M127.
///
void(CEF_CALLBACK* load_extension)(struct _cef_request_context_t* self,
const cef_string_t* root_directory,
struct _cef_dictionary_value_t* manifest,
@@ -264,6 +266,8 @@ typedef struct _cef_request_context_t {
/// access to the extension (see HasExtension). This function must be called
/// on the browser process UI thread.
///
/// WARNING: This function is deprecated and will be removed in ~M127.
///
int(CEF_CALLBACK* did_load_extension)(struct _cef_request_context_t* self,
const cef_string_t* extension_id);
@@ -273,6 +277,8 @@ typedef struct _cef_request_context_t {
/// extension (see DidLoadExtension). This function must be called on the
/// browser process UI thread.
///
/// WARNING: This function is deprecated and will be removed in ~M127.
///
int(CEF_CALLBACK* has_extension)(struct _cef_request_context_t* self,
const cef_string_t* extension_id);
@@ -282,6 +288,8 @@ typedef struct _cef_request_context_t {
/// extension ID values. Returns true (1) on success. This function must be
/// called on the browser process UI thread.
///
/// WARNING: This function is deprecated and will be removed in ~M127.
///
int(CEF_CALLBACK* get_extensions)(struct _cef_request_context_t* self,
cef_string_list_t extension_ids);
@@ -290,6 +298,8 @@ typedef struct _cef_request_context_t {
/// extension is accessible in this context (see HasExtension). This function
/// must be called on the browser process UI thread.
///
/// WARNING: This function is deprecated and will be removed in ~M127.
///
struct _cef_extension_t*(CEF_CALLBACK* get_extension)(
struct _cef_request_context_t* self,
const cef_string_t* extension_id);

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=3a188f380f8044060ea93fdca0b3d231df88979d$
// $hash=5dd4948a92af2ad69e2171f2dffb8f2c23e5c147$
//
#ifndef CEF_INCLUDE_CAPI_CEF_V8_CAPI_H_
@@ -611,7 +611,6 @@ typedef struct _cef_v8value_t {
///
int(CEF_CALLBACK* set_value_byaccessor)(struct _cef_v8value_t* self,
const cef_string_t* key,
cef_v8_accesscontrol_t settings,
cef_v8_propertyattribute_t attribute);
///

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=db81a65aba3c2d1213744ad4251322acf97c608c$
// $hash=da2edf5e08eb45942b6a82109aa86682c202ccac$
//
#ifndef CEF_INCLUDE_CAPI_TEST_CEF_TEST_HELPERS_CAPI_H_
@@ -67,6 +67,14 @@ CEF_EXPORT void cef_execute_java_script_with_user_gesture_for_tests(
///
CEF_EXPORT void cef_set_data_directory_for_tests(const cef_string_t* dir);
///
/// Returns true (1) if |feature_name| is enabled by default, command line or
/// field trial. This supports a short list of curated values that are queried
/// by unit tests.
///
CEF_EXPORT int cef_is_feature_enabled_for_tests(
const cef_string_t* feature_name);
#ifdef __cplusplus
}
#endif

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=2e5a3b3b1f427a7eb1e6a447fe0d31c5ace49469$
// $hash=1c2fbbffaf51e90a2d55bfa7eb3fa3a4e315f4ac$
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_BROWSER_VIEW_CAPI_H_
@@ -93,6 +93,13 @@ typedef struct _cef_browser_view_t {
///
void(CEF_CALLBACK* set_prefer_accelerators)(struct _cef_browser_view_t* self,
int prefer_accelerators);
///
/// Returns the runtime style for this BrowserView (ALLOY or CHROME). See
/// cef_runtime_style_t documentation for details.
///
cef_runtime_style_t(CEF_CALLBACK* get_runtime_style)(
struct _cef_browser_view_t* self);
} cef_browser_view_t;
///

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=1f2a6e206b86945386bef57167b80e2fb6067c59$
// $hash=a0a9f2bfcdf8e05d3d1114fcd8860caaa726ec98$
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_BROWSER_VIEW_DELEGATE_CAPI_H_
@@ -141,6 +141,13 @@ typedef struct _cef_browser_view_delegate_t {
struct _cef_browser_view_delegate_t* self,
struct _cef_browser_view_t* browser_view,
cef_gesture_command_t gesture_command);
///
/// Optionally change the runtime style for this BrowserView. See
/// cef_runtime_style_t documentation for details.
///
cef_runtime_style_t(CEF_CALLBACK* get_browser_runtime_style)(
struct _cef_browser_view_delegate_t* self);
} cef_browser_view_delegate_t;
#ifdef __cplusplus

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=2abb3759a22a95ffc0207f0538c645a74a5030c6$
// $hash=dd32b58ec9aca0e04a1d30ccf94a741995fcc094$
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_CAPI_H_
@@ -401,6 +401,13 @@ typedef struct _cef_window_t {
/// or cef_view_delegate_t::OnThemeChanged.
///
void(CEF_CALLBACK* theme_changed)(struct _cef_window_t* self);
///
/// Returns the runtime style for this Window (ALLOY or CHROME). See
/// cef_runtime_style_t documentation for details.
///
cef_runtime_style_t(CEF_CALLBACK* get_runtime_style)(
struct _cef_window_t* self);
} cef_window_t;
///

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=e6bbc33db1b5ed3832982f8799e14557204f4028$
// $hash=e8c9e32caa8d317a7cb6ff2f0ad6be49cf1b7ad1$
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_DELEGATE_CAPI_H_
@@ -275,6 +275,13 @@ typedef struct _cef_window_delegate_t {
struct _cef_window_delegate_t* self,
struct _cef_window_t* window,
int chrome_theme);
///
/// Optionally change the runtime style for this Window. See
/// cef_runtime_style_t documentation for details.
///
cef_runtime_style_t(CEF_CALLBACK* get_window_runtime_style)(
struct _cef_window_delegate_t* self);
} cef_window_delegate_t;
#ifdef __cplusplus

View File

@@ -42,13 +42,13 @@
// way that may cause binary incompatibility with other builds. The universal
// hash value will change if any platform is affected whereas the platform hash
// values will change only if that particular platform is affected.
#define CEF_API_HASH_UNIVERSAL "35035b76d79ba0c7144aedb63d72b7988d372706"
#define CEF_API_HASH_UNIVERSAL "ed1dfa5ff8a041241f8fb72eb7454811f358f0d3"
#if defined(OS_WIN)
#define CEF_API_HASH_PLATFORM "9227cf2e0abf4f378e31e6095d503a91b2da59af"
#define CEF_API_HASH_PLATFORM "0d99d1b9b85b2efab91a39d6fc325bb6d56fd524"
#elif defined(OS_MAC)
#define CEF_API_HASH_PLATFORM "fe0bdc49d209ee3cf108bdb72faec21316f9d0e0"
#define CEF_API_HASH_PLATFORM "e585e190387e31a71267207b66d175e213991470"
#elif defined(OS_LINUX)
#define CEF_API_HASH_PLATFORM "df471096e6600c025ac0655b5eaa9818f075b8ba"
#define CEF_API_HASH_PLATFORM "09d3e280ed38f7a082b794c56ff71c52f86f0ea8"
#endif
#ifdef __cplusplus

View File

@@ -39,6 +39,7 @@
#pragma once
#include <vector>
#include "include/cef_base.h"
#include "include/cef_devtools_message_observer.h"
#include "include/cef_drag_data.h"
@@ -942,6 +943,8 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
/// Returns the extension hosted in this browser or NULL if no extension is
/// hosted. See CefRequestContext::LoadExtension for details.
///
/// WARNING: This method is deprecated and will be removed in ~M127.
///
/*--cef()--*/
virtual CefRefPtr<CefExtension> GetExtension() = 0;
@@ -950,6 +953,8 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
/// Background hosts do not have a window and are not displayable. See
/// CefRequestContext::LoadExtension for details.
///
/// WARNING: This method is deprecated and will be removed in ~M127.
///
/*--cef()--*/
virtual bool IsBackgroundHost() = 0;
@@ -1018,6 +1023,13 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
///
/*--cef()--*/
virtual bool IsRenderProcessUnresponsive() = 0;
///
/// Returns the runtime style for this browser (ALLOY or CHROME). See
/// cef_runtime_style_t documentation for details.
///
/*--cef(default_retval=CEF_RUNTIME_STYLE_DEFAULT)--*/
virtual cef_runtime_style_t GetRuntimeStyle() = 0;
};
#endif // CEF_INCLUDE_CEF_BROWSER_H_

View File

@@ -40,6 +40,7 @@
#include <map>
#include <vector>
#include "include/cef_base.h"
///

View File

@@ -39,6 +39,7 @@
#pragma once
#include <vector>
#include "include/cef_base.h"
#include "include/cef_callback.h"

View File

@@ -77,21 +77,30 @@ class CefDialogHandler : public virtual CefBaseRefCounted {
/// empty to show the default title ("Open" or "Save" depending on the mode).
/// |default_file_path| is the path with optional directory and/or file name
/// component that should be initially selected in the dialog.
/// |accept_filters| are used to restrict the selectable file types and may
/// any combination of (a) valid lower-cased MIME types (e.g. "text/*" or
/// "image/*"), (b) individual file extensions (e.g. ".txt" or ".png"), or (c)
/// combined description and file extension delimited using "|" and ";" (e.g.
/// "Image Types|.png;.gif;.jpg"). To display a custom dialog return true and
/// execute |callback| either inline or at a later time. To display the
/// default dialog return false.
/// |accept_filters| are used to restrict the selectable file types and may be
/// any combination of valid lower-cased MIME types (e.g. "text/*" or
/// "image/*") and individual file extensions (e.g. ".txt" or ".png").
/// |accept_extensions| provides the semicolon-delimited expansion of MIME
/// types to file extensions (if known, or empty string otherwise).
/// |accept_descriptions| provides the descriptions for MIME types (if known,
/// or empty string otherwise). For example, the "image/*" mime type might
/// have extensions ".png;.jpg;.bmp;..." and description "Image Files".
/// |accept_filters|, |accept_extensions| and |accept_descriptions| will all
/// be the same size. To display a custom dialog return true and execute
/// |callback| either inline or at a later time. To display the default dialog
/// return false. If this method returns false it may be called an additional
/// time for the same dialog (both before and after MIME type expansion).
///
/*--cef(optional_param=title,optional_param=default_file_path,
optional_param=accept_filters)--*/
optional_param=accept_filters,optional_param=accept_extensions,
optional_param=accept_descriptions)--*/
virtual bool OnFileDialog(CefRefPtr<CefBrowser> browser,
FileDialogMode mode,
const CefString& title,
const CefString& default_file_path,
const std::vector<CefString>& accept_filters,
const std::vector<CefString>& accept_extensions,
const std::vector<CefString>& accept_descriptions,
CefRefPtr<CefFileDialogCallback> callback) {
return false;
}

View File

@@ -39,6 +39,7 @@
#pragma once
#include <map>
#include "include/cef_base.h"
class CefDOMDocument;

View File

@@ -106,17 +106,19 @@ class CefDownloadHandler : public virtual CefBaseRefCounted {
///
/// Called before a download begins. |suggested_name| is the suggested name
/// for the download file. By default the download will be canceled. Execute
/// |callback| either asynchronously or in this method to continue the
/// download if desired. Do not keep a reference to |download_item| outside of
/// this method.
/// for the download file. Return true and execute |callback| either
/// asynchronously or in this method to continue or cancel the download.
/// Return false to proceed with default handling (cancel with Alloy style,
/// download shelf with Chrome style). Do not keep a reference to
/// |download_item| outside of this method.
///
/*--cef()--*/
virtual void OnBeforeDownload(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDownloadItem> download_item,
const CefString& suggested_name,
CefRefPtr<CefBeforeDownloadCallback> callback) = 0;
virtual bool OnBeforeDownload(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDownloadItem> download_item,
const CefString& suggested_name,
CefRefPtr<CefBeforeDownloadCallback> callback) {
return false;
}
///
/// Called when a download's status or progress information has been updated.

View File

@@ -39,6 +39,7 @@
#pragma once
#include <vector>
#include "include/cef_base.h"
#include "include/cef_image.h"
#include "include/cef_stream.h"

View File

@@ -48,6 +48,8 @@ class CefRequestContext;
/// Object representing an extension. Methods may be called on any thread unless
/// otherwise indicated.
///
/// WARNING: This API is deprecated and will be removed in ~M127.
///
/*--cef(source=library)--*/
class CefExtension : public CefBaseRefCounted {
public:

View File

@@ -70,6 +70,8 @@ class CefGetExtensionResourceCallback : public CefBaseRefCounted {
/// The methods of this class will be called on the UI thread. See
/// CefRequestContext::LoadExtension for information about extension loading.
///
/// WARNING: This API is deprecated and will be removed in ~M127.
///
/*--cef(source=client)--*/
class CefExtensionHandler : public virtual CefBaseRefCounted {
public:

View File

@@ -39,6 +39,7 @@
#pragma once
#include <vector>
#include "include/cef_base.h"
#include "include/cef_callback.h"
#include "include/cef_registration.h"

View File

@@ -40,6 +40,7 @@
#include <map>
#include <vector>
#include "include/cef_base.h"
class CefPostData;

View File

@@ -266,6 +266,8 @@ class CefRequestContext : public CefPreferenceManager {
/// See https://developer.chrome.com/extensions for extension implementation
/// and usage documentation.
///
/// WARNING: This method is deprecated and will be removed in ~M127.
///
/*--cef(optional_param=manifest,optional_param=handler)--*/
virtual void LoadExtension(const CefString& root_directory,
CefRefPtr<CefDictionaryValue> manifest,
@@ -277,6 +279,8 @@ class CefRequestContext : public CefPreferenceManager {
/// access to the extension (see HasExtension). This method must be called on
/// the browser process UI thread.
///
/// WARNING: This method is deprecated and will be removed in ~M127.
///
/*--cef()--*/
virtual bool DidLoadExtension(const CefString& extension_id) = 0;
@@ -286,6 +290,8 @@ class CefRequestContext : public CefPreferenceManager {
/// extension (see DidLoadExtension). This method must be called on the
/// browser process UI thread.
///
/// WARNING: This method is deprecated and will be removed in ~M127.
///
/*--cef()--*/
virtual bool HasExtension(const CefString& extension_id) = 0;
@@ -295,6 +301,8 @@ class CefRequestContext : public CefPreferenceManager {
/// extension ID values. Returns true on success. This method must be called
/// on the browser process UI thread.
///
/// WARNING: This method is deprecated and will be removed in ~M127.
///
/*--cef()--*/
virtual bool GetExtensions(std::vector<CefString>& extension_ids) = 0;
@@ -303,6 +311,8 @@ class CefRequestContext : public CefPreferenceManager {
/// extension is accessible in this context (see HasExtension). This method
/// must be called on the browser process UI thread.
///
/// WARNING: This method is deprecated and will be removed in ~M127.
///
/*--cef()--*/
virtual CefRefPtr<CefExtension> GetExtension(
const CefString& extension_id) = 0;

View File

@@ -39,6 +39,7 @@
#pragma once
#include <map>
#include "include/cef_base.h"
///

View File

@@ -39,6 +39,7 @@
#pragma once
#include <map>
#include "include/cef_base.h"
#include "include/cef_callback.h"
#include "include/cef_request.h"

View File

@@ -40,7 +40,6 @@
#include "include/cef_base.h"
#include "include/cef_values.h"
#include "include/cef_x509_certificate.h"
///

View File

@@ -39,6 +39,7 @@
#pragma once
#include <vector>
#include "include/cef_base.h"
#include "include/cef_browser.h"
#include "include/cef_frame.h"
@@ -434,7 +435,6 @@ class CefV8ArrayBufferReleaseCallback : public virtual CefBaseRefCounted {
/*--cef(source=library,no_debugct_check)--*/
class CefV8Value : public virtual CefBaseRefCounted {
public:
typedef cef_v8_accesscontrol_t AccessControl;
typedef cef_v8_propertyattribute_t PropertyAttribute;
///
@@ -793,9 +793,7 @@ class CefV8Value : public virtual CefBaseRefCounted {
/// will return true even though assignment failed.
///
/*--cef(capi_name=set_value_byaccessor,optional_param=key)--*/
virtual bool SetValue(const CefString& key,
AccessControl settings,
PropertyAttribute attribute) = 0;
virtual bool SetValue(const CefString& key, PropertyAttribute attribute) = 0;
///
/// Read the keys for the object's values into the specified vector. Integer-

View File

@@ -39,6 +39,7 @@
#pragma once
#include <vector>
#include "include/cef_base.h"
class CefBinaryValue;

View File

@@ -70,6 +70,7 @@ struct CefWindowInfoTraits {
target->shared_texture_enabled = src->shared_texture_enabled;
target->external_begin_frame_enabled = src->external_begin_frame_enabled;
target->window = src->window;
target->runtime_style = src->runtime_style;
}
};
@@ -110,6 +111,7 @@ class CefWindowInfo : public CefStructBase<CefWindowInfoTraits> {
void SetAsWindowless(CefWindowHandle parent) {
windowless_rendering_enabled = true;
parent_window = parent;
runtime_style = CEF_RUNTIME_STYLE_ALLOY;
}
};

View File

@@ -71,6 +71,7 @@ struct CefWindowInfoTraits {
target->shared_texture_enabled = src->shared_texture_enabled;
target->external_begin_frame_enabled = src->external_begin_frame_enabled;
target->view = src->view;
target->runtime_style = src->runtime_style;
}
};
@@ -112,6 +113,7 @@ class CefWindowInfo : public CefStructBase<CefWindowInfoTraits> {
void SetAsWindowless(CefWindowHandle parent) {
windowless_rendering_enabled = true;
parent_view = parent;
runtime_style = CEF_RUNTIME_STYLE_ALLOY;
}
};

View File

@@ -235,12 +235,14 @@ typedef struct _cef_settings_t {
///
cef_string_t main_bundle_path;
#if !defined(DISABLE_ALLOY_BOOTSTRAP)
///
/// Set to true (1) to enable use of the Chrome runtime in CEF. This feature
/// is considered experimental and is not recommended for most users at this
/// time. See issue #2969 for details.
///
int chrome_runtime;
#endif
///
/// Set to true (1) to have the browser process message loop run in a separate
@@ -1237,16 +1239,6 @@ typedef enum {
CEF_TEXT_INPUT_MODE_MAX = CEF_TEXT_INPUT_MODE_SEARCH,
} cef_text_input_mode_t;
///
/// V8 access control values.
///
typedef enum {
V8_ACCESS_CONTROL_DEFAULT = 0,
V8_ACCESS_CONTROL_ALL_CAN_READ = 1,
V8_ACCESS_CONTROL_ALL_CAN_WRITE = 1 << 1,
V8_ACCESS_CONTROL_PROHIBITS_OVERWRITING = 1 << 2
} cef_v8_accesscontrol_t;
///
/// V8 property attribute values.
///
@@ -3471,18 +3463,18 @@ typedef enum {
CEF_CPAIT_COOKIE_CONTROLS,
CEF_CPAIT_FILE_SYSTEM_ACCESS,
CEF_CPAIT_FIND,
CEF_CPAIT_HIGH_EFFICIENCY,
CEF_CPAIT_MEMORY_SAVER,
CEF_CPAIT_INTENT_PICKER,
CEF_CPAIT_LOCAL_CARD_MIGRATION,
CEF_CPAIT_MANAGE_PASSWORDS,
CEF_CPAIT_PAYMENTS_OFFER_NOTIFICATION,
CEF_CPAIT_PRICE_TRACKING,
CEF_CPAIT_PWA_INSTALL,
CEF_CPAIT_QR_CODE_GENERATOR,
CEF_CPAIT_READER_MODE,
CEF_CPAIT_QR_CODE_GENERATOR_DEPRECATED,
CEF_CPAIT_READER_MODE_DEPRECATED,
CEF_CPAIT_SAVE_AUTOFILL_ADDRESS,
CEF_CPAIT_SAVE_CARD,
CEF_CPAIT_SEND_TAB_TO_SELF,
CEF_CPAIT_SEND_TAB_TO_SELF_DEPRECATED,
CEF_CPAIT_SHARING_HUB,
CEF_CPAIT_SIDE_SEARCH,
CEF_CPAIT_SMS_REMOTE_FETCHER,
@@ -3494,7 +3486,9 @@ typedef enum {
CEF_CPAIT_MANDATORY_REAUTH,
CEF_CPAIT_PRICE_INSIGHTS,
CEF_CPAIT_PRICE_READ_ANYTHING,
CEF_CPAIT_MAX_VALUE = CEF_CPAIT_PRICE_READ_ANYTHING,
CEF_CPAIT_PRODUCT_SPECIFICATIONS,
CEF_CPAIT_LENS_OVERLAY,
CEF_CPAIT_MAX_VALUE = CEF_CPAIT_LENS_OVERLAY,
} cef_chrome_page_action_icon_type_t;
///
@@ -3640,12 +3634,14 @@ typedef enum {
CEF_PERMISSION_TYPE_MIDI_SYSEX = 1 << 13,
CEF_PERMISSION_TYPE_MULTIPLE_DOWNLOADS = 1 << 14,
CEF_PERMISSION_TYPE_NOTIFICATIONS = 1 << 15,
CEF_PERMISSION_TYPE_PROTECTED_MEDIA_IDENTIFIER = 1 << 16,
CEF_PERMISSION_TYPE_REGISTER_PROTOCOL_HANDLER = 1 << 17,
CEF_PERMISSION_TYPE_STORAGE_ACCESS = 1 << 18,
CEF_PERMISSION_TYPE_VR_SESSION = 1 << 19,
CEF_PERMISSION_TYPE_WINDOW_MANAGEMENT = 1 << 20,
CEF_PERMISSION_TYPE_FILE_SYSTEM_ACCESS = 1 << 21,
CEF_PERMISSION_TYPE_KEYBOARD_LOCK = 1 << 16,
CEF_PERMISSION_TYPE_POINTER_LOCK = 1 << 17,
CEF_PERMISSION_TYPE_PROTECTED_MEDIA_IDENTIFIER = 1 << 18,
CEF_PERMISSION_TYPE_REGISTER_PROTOCOL_HANDLER = 1 << 19,
CEF_PERMISSION_TYPE_STORAGE_ACCESS = 1 << 20,
CEF_PERMISSION_TYPE_VR_SESSION = 1 << 21,
CEF_PERMISSION_TYPE_WINDOW_MANAGEMENT = 1 << 22,
CEF_PERMISSION_TYPE_FILE_SYSTEM_ACCESS = 1 << 23,
} cef_permission_request_types_t;
///

View File

@@ -380,6 +380,13 @@ typedef enum {
/// a requesting-origin/top-level-site combination and persistent.
CEF_CONTENT_SETTING_TYPE_TOP_LEVEL_TPCD_TRIAL,
/// Content Setting for a first-party origin trial that allows websites to
/// enable third-party cookie deprecation.
/// ALLOW (default): no effect (e.g. third-party cookies allowed, if not
/// blocked otherwise).
/// BLOCK: third-party cookies blocked, but 3PCD mitigations enabled.
CEF_CONTENT_SETTING_TOP_LEVEL_TPCD_ORIGIN_TRIAL,
/// Content setting used to indicate whether entering picture-in-picture
/// automatically should be enabled.
CEF_CONTENT_SETTING_TYPE_AUTO_PICTURE_IN_PICTURE,
@@ -428,6 +435,15 @@ typedef enum {
/// Pointer Lock API allows a site to hide the cursor and have exclusive
/// access to mouse inputs.
CEF_CONTENT_SETTING_TYPE_POINTER_LOCK,
/// Website setting which is used for UnusedSitePermissionsService to store
/// auto-revoked notification permissions from abusive sites.
REVOKED_ABUSIVE_NOTIFICATION_PERMISSIONS,
/// Content setting that controls tracking protection status per site.
/// BLOCK: Protections enabled. This is the default state.
/// ALLOW: Protections disabled.
TRACKING_PROTECTION,
} cef_content_setting_types_t;
///

View File

@@ -32,7 +32,6 @@
#pragma once
#include "include/base/cef_build.h"
#include "include/cef_config.h"
#if defined(OS_LINUX)
@@ -45,6 +44,7 @@ typedef struct _XDisplay XDisplay;
#include "include/internal/cef_string.h"
#include "include/internal/cef_types_color.h"
#include "include/internal/cef_types_geometry.h"
#include "include/internal/cef_types_runtime.h"
// Handle types.
#if defined(CEF_X11)
@@ -136,6 +136,13 @@ typedef struct _cef_window_info_t {
/// Pointer for the new browser window. Only used with windowed rendering.
///
cef_window_handle_t window;
///
/// Optionally change the runtime style. Alloy style will always be used if
/// |windowless_rendering_enabled| is true. See cef_runtime_style_t
/// documentation for details.
///
cef_runtime_style_t runtime_style;
} cef_window_info_t;
///

View File

@@ -37,6 +37,7 @@
#include "include/internal/cef_string.h"
#include "include/internal/cef_types_color.h"
#include "include/internal/cef_types_geometry.h"
#include "include/internal/cef_types_runtime.h"
// Handle types.
// Actually NSCursor*
@@ -137,6 +138,13 @@ typedef struct _cef_window_info_t {
/// rendering.
///
cef_window_handle_t view;
///
/// Optionally change the runtime style. Alloy style will always be used if
/// |windowless_rendering_enabled| is true or if |parent_view| is provided.
/// See cef_runtime_style_t documentation for details.
///
cef_runtime_style_t runtime_style;
} cef_window_info_t;
///

View File

@@ -0,0 +1,88 @@
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef CEF_INCLUDE_INTERNAL_CEF_TYPES_RUNTIME_H_
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_RUNTIME_H_
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
///
/// CEF supports both a Chrome runtime (based on the Chrome UI layer) and an
/// Alloy runtime (based on the Chromium content layer). The Chrome runtime
/// provides the full Chrome UI and browser functionality whereas the Alloy
/// runtime provides less default browser functionality but adds additional
/// client callbacks and support for windowless (off-screen) rendering. For
/// additional comparative details on runtime types see
/// https://bitbucket.org/chromiumembedded/cef/wiki/Architecture.md#markdown-header-cef3
///
/// Each runtime is composed of a bootstrap component and a style component. The
/// bootstrap component is configured via CefSettings.chrome_runtime and cannot
/// be changed after CefInitialize. The style component is individually
/// configured for each window/browser at creation time and, in combination with
/// the Chrome bootstrap, different styles can be mixed during runtime.
///
/// Windowless rendering will always use Alloy style. Windowed rendering with a
/// default window or client-provided parent window can configure the style via
/// CefWindowInfo.runtime_style. Windowed rendering with the Views framework can
/// configure the style via CefWindowDelegate::GetWindowRuntimeStyle and
/// CefBrowserViewDelegate::GetBrowserRuntimeStyle. Alloy style Windows with the
/// Views framework can host only Alloy style BrowserViews but Chrome style
/// Windows can host both style BrowserViews. Additionally, a Chrome style
/// Window can host at most one Chrome style BrowserView but potentially
/// multiple Alloy style BrowserViews. See CefWindowInfo.runtime_style
/// documentation for any additional platform-specific limitations.
///
typedef enum {
///
/// Use the default runtime style. The default style will match the
/// CefSettings.chrome_runtime value in most cases. See above documentation
/// for exceptions.
///
CEF_RUNTIME_STYLE_DEFAULT,
///
/// Use the Chrome runtime style. Only supported with the Chrome runtime.
///
CEF_RUNTIME_STYLE_CHROME,
///
/// Use the Alloy runtime style. Supported with both the Alloy and Chrome
/// runtime.
///
CEF_RUNTIME_STYLE_ALLOY,
} cef_runtime_style_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_RUNTIME_H_

View File

@@ -39,6 +39,7 @@
#include "include/internal/cef_string.h"
#include "include/internal/cef_types_color.h"
#include "include/internal/cef_types_geometry.h"
#include "include/internal/cef_types_runtime.h"
// Handle types.
#define cef_cursor_handle_t HCURSOR
@@ -104,6 +105,13 @@ typedef struct _cef_window_info_t {
/// Handle for the new browser window. Only used with windowed rendering.
///
cef_window_handle_t window;
///
/// Optionally change the runtime style. Alloy style will always be used if
/// |windowless_rendering_enabled| is true. See cef_runtime_style_t
/// documentation for details.
///
cef_runtime_style_t runtime_style;
} cef_window_info_t;
///

View File

@@ -387,7 +387,9 @@ struct CefSettingsTraits {
&target->framework_dir_path, copy);
cef_string_set(src->main_bundle_path.str, src->main_bundle_path.length,
&target->main_bundle_path, copy);
#if !defined(DISABLE_ALLOY_BOOTSTRAP)
target->chrome_runtime = src->chrome_runtime;
#endif
target->multi_threaded_message_loop = src->multi_threaded_message_loop;
target->external_message_pump = src->external_message_pump;
target->windowless_rendering_enabled = src->windowless_rendering_enabled;

View File

@@ -73,6 +73,7 @@ struct CefWindowInfoTraits {
target->shared_texture_enabled = src->shared_texture_enabled;
target->external_begin_frame_enabled = src->external_begin_frame_enabled;
target->window = src->window;
target->runtime_style = src->runtime_style;
}
};
@@ -130,6 +131,7 @@ class CefWindowInfo : public CefStructBase<CefWindowInfoTraits> {
void SetAsWindowless(CefWindowHandle parent) {
windowless_rendering_enabled = TRUE;
parent_window = parent;
runtime_style = CEF_RUNTIME_STYLE_ALLOY;
}
};

View File

@@ -67,4 +67,12 @@ void CefExecuteJavaScriptWithUserGestureForTests(CefRefPtr<CefFrame> frame,
/*--cef()--*/
void CefSetDataDirectoryForTests(const CefString& dir);
///
/// Returns true if |feature_name| is enabled by default, command line or field
/// trial. This supports a short list of curated values that are queried by unit
/// tests.
///
/*--cef()--*/
bool CefIsFeatureEnabledForTests(const CefString& feature_name);
#endif // CEF_INCLUDE_TEST_CEF_TEST_HELPERS_H_

View File

@@ -49,6 +49,7 @@
#endif
#include <map>
#include "include/cef_base.h"
#include "include/cef_request.h"

View File

@@ -107,6 +107,13 @@ class CefBrowserView : public CefView {
///
/*--cef()--*/
virtual void SetPreferAccelerators(bool prefer_accelerators) = 0;
///
/// Returns the runtime style for this BrowserView (ALLOY or CHROME). See
/// cef_runtime_style_t documentation for details.
///
/*--cef(default_retval=CEF_RUNTIME_STYLE_DEFAULT)--*/
virtual cef_runtime_style_t GetRuntimeStyle() = 0;
};
#endif // CEF_INCLUDE_VIEWS_CEF_BROWSER_VIEW_H_

View File

@@ -140,6 +140,15 @@ class CefBrowserViewDelegate : public CefViewDelegate {
cef_gesture_command_t gesture_command) {
return false;
}
///
/// Optionally change the runtime style for this BrowserView. See
/// cef_runtime_style_t documentation for details.
///
/*--cef(default_retval=CEF_RUNTIME_STYLE_DEFAULT)--*/
virtual cef_runtime_style_t GetBrowserRuntimeStyle() {
return CEF_RUNTIME_STYLE_DEFAULT;
}
};
#endif // CEF_INCLUDE_VIEWS_CEF_BROWSER_VIEW_DELEGATE_H_

View File

@@ -414,6 +414,13 @@ class CefWindow : public CefPanel {
///
/*--cef()--*/
virtual void ThemeChanged() = 0;
///
/// Returns the runtime style for this Window (ALLOY or CHROME). See
/// cef_runtime_style_t documentation for details.
///
/*--cef(default_retval=CEF_RUNTIME_STYLE_DEFAULT)--*/
virtual cef_runtime_style_t GetRuntimeStyle() = 0;
};
#endif // CEF_INCLUDE_VIEWS_CEF_WINDOW_H_

View File

@@ -271,6 +271,15 @@ class CefWindowDelegate : public CefPanelDelegate {
/*--cef()--*/
virtual void OnThemeColorsChanged(CefRefPtr<CefWindow> window,
bool chrome_theme) {}
///
/// Optionally change the runtime style for this Window. See
/// cef_runtime_style_t documentation for details.
///
/*--cef(default_retval=CEF_RUNTIME_STYLE_DEFAULT)--*/
virtual cef_runtime_style_t GetWindowRuntimeStyle() {
return CEF_RUNTIME_STYLE_DEFAULT;
}
};
#endif // CEF_INCLUDE_VIEWS_CEF_WINDOW_DELEGATE_H_

View File

@@ -2,25 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/alloy/alloy_browser_context.h"
#include "cef/libcef/browser/alloy/alloy_browser_context.h"
#include <map>
#include <memory>
#include <utility>
#include "libcef/browser/download_manager_delegate.h"
#include "libcef/browser/extensions/extension_system.h"
#include "libcef/browser/prefs/browser_prefs.h"
#include "libcef/browser/ssl_host_state_delegate.h"
#include "libcef/browser/thread_util.h"
#include "libcef/common/cef_switches.h"
#include "libcef/common/extensions/extensions_util.h"
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/strings/string_util.h"
#include "cef/libcef/browser/alloy/alloy_download_manager_delegate.h"
#include "cef/libcef/browser/extensions/extension_system.h"
#include "cef/libcef/browser/prefs/browser_prefs.h"
#include "cef/libcef/browser/ssl_host_state_delegate.h"
#include "cef/libcef/browser/thread_util.h"
#include "cef/libcef/common/cef_switches.h"
#include "cef/libcef/common/extensions/extensions_util.h"
#include "chrome/browser/font_family_cache.h"
#include "chrome/browser/permissions/permission_manager_factory.h"
#include "chrome/browser/plugins/chrome_plugin_service_filter.h"
@@ -195,6 +194,10 @@ void AlloyBrowserContext::Shutdown() {
ChromePluginServiceFilter::GetInstance()->UnregisterProfile(this);
// Clear this reference before the associated KeyedServiceFactory is destroyed
// by PerformInterlockedTwoPhaseShutdown().
extension_system_ = nullptr;
// Remove any BrowserContextKeyedServiceFactory associations. This must be
// called before the ProxyService owned by AlloyBrowserContext is destroyed.
// The SimpleDependencyManager should always be passed after the
@@ -297,15 +300,6 @@ bool AlloyBrowserContext::UnloadExtension(const CefString& extension_id) {
return extension_system()->UnloadExtension(extension_id);
}
bool AlloyBrowserContext::IsPrintPreviewSupported() const {
CEF_REQUIRE_UIT();
if (!extensions::PrintPreviewEnabled()) {
return false;
}
return !GetPrefs()->GetBoolean(prefs::kPrintPreviewDisabled);
}
content::ClientHintsControllerDelegate*
AlloyBrowserContext::GetClientHintsControllerDelegate() {
return nullptr;
@@ -345,7 +339,7 @@ content::DownloadManagerDelegate*
AlloyBrowserContext::GetDownloadManagerDelegate() {
if (!download_manager_delegate_) {
download_manager_delegate_ =
std::make_unique<CefDownloadManagerDelegate>(GetDownloadManager());
std::make_unique<AlloyDownloadManagerDelegate>(GetDownloadManager());
}
return download_manager_delegate_.get();
}
@@ -438,6 +432,11 @@ AlloyBrowserContext::GetProfileCloudPolicyManager() {
return nullptr;
}
policy::CloudPolicyManager* AlloyBrowserContext::GetCloudPolicyManager() {
DCHECK(false);
return nullptr;
}
policy::ProfilePolicyConnector*
AlloyBrowserContext::GetProfilePolicyConnector() {
DCHECK(false);
@@ -461,6 +460,12 @@ void AlloyBrowserContext::RebuildTable(
enumerator->OnComplete(true);
}
void AlloyBrowserContext::BuildVisitedLinkTable(
const scoped_refptr<VisitedLinkEnumerator>& enumerator) {
// Called when visited links will not or cannot be loaded from disk.
enumerator->OnVisitedLinkComplete(true);
}
DownloadPrefs* AlloyBrowserContext::GetDownloadPrefs() {
CEF_REQUIRE_UIT();
if (!download_prefs_) {
@@ -469,6 +474,13 @@ DownloadPrefs* AlloyBrowserContext::GetDownloadPrefs() {
return download_prefs_.get();
}
void AlloyBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) {
visitedlink_master_->AddURLs(urls);
void AlloyBrowserContext::AddVisitedURLs(
const GURL& url,
const std::vector<GURL>& redirect_chain,
ui::PageTransition /*transition*/) {
if (!redirect_chain.empty()) {
visitedlink_master_->AddURLs(redirect_chain);
} else {
visitedlink_master_->AddURL(url);
}
}

View File

@@ -6,16 +6,16 @@
#define CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_CONTEXT_H_
#pragma once
#include "include/cef_request_context_handler.h"
#include "libcef/browser/alloy/chrome_profile_alloy.h"
#include "libcef/browser/browser_context.h"
#include "libcef/browser/request_context_handler_map.h"
#include "base/memory/raw_ptr.h"
#include "cef/include/cef_request_context_handler.h"
#include "cef/libcef/browser/alloy/chrome_profile_alloy.h"
#include "cef/libcef/browser/browser_context.h"
#include "cef/libcef/browser/request_context_handler_map.h"
#include "chrome/browser/download/download_prefs.h"
#include "components/proxy_config/pref_proxy_config_tracker.h"
#include "components/visitedlink/browser/visitedlink_delegate.h"
class CefDownloadManagerDelegate;
class AlloyDownloadManagerDelegate;
class CefSSLHostStateDelegate;
class CefVisitedLinkListener;
class PrefService;
@@ -56,7 +56,9 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
bool GetExtensions(std::vector<CefString>& extension_ids) override;
CefRefPtr<CefExtension> GetExtension(const CefString& extension_id) override;
bool UnloadExtension(const CefString& extension_id) override;
bool IsPrintPreviewSupported() const override;
void AddVisitedURLs(const GURL& url,
const std::vector<GURL>& redirect_chain,
ui::PageTransition transition) override;
// content::BrowserContext overrides.
content::ClientHintsControllerDelegate* GetClientHintsControllerDelegate()
@@ -92,6 +94,7 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
policy::SchemaRegistryService* GetPolicySchemaRegistryService() override;
policy::UserCloudPolicyManager* GetUserCloudPolicyManager() override;
policy::ProfileCloudPolicyManager* GetProfileCloudPolicyManager() override;
policy::CloudPolicyManager* GetCloudPolicyManager() override;
policy::ProfilePolicyConnector* GetProfilePolicyConnector() override;
const policy::ProfilePolicyConnector* GetProfilePolicyConnector()
const override;
@@ -108,17 +111,16 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
// visitedlink::VisitedLinkDelegate methods.
void RebuildTable(const scoped_refptr<URLEnumerator>& enumerator) override;
void BuildVisitedLinkTable(
const scoped_refptr<VisitedLinkEnumerator>& enumerator) override;
// Manages extensions.
extensions::CefExtensionSystem* extension_system() const {
return extension_system_;
}
// Called from AlloyBrowserHostImpl::DidFinishNavigation to update the table
// of visited links.
void AddVisitedURLs(const std::vector<GURL>& urls);
// Called from DownloadPrefs::FromBrowserContext.
// Called from DownloadPrefs::FromBrowserContext via
// alloy::GetDownloadPrefsFromBrowserContext.
DownloadPrefs* GetDownloadPrefs();
private:
@@ -127,14 +129,14 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
std::unique_ptr<PrefService> pref_service_;
std::unique_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
std::unique_ptr<CefDownloadManagerDelegate> download_manager_delegate_;
std::unique_ptr<AlloyDownloadManagerDelegate> download_manager_delegate_;
std::unique_ptr<CefSSLHostStateDelegate> ssl_host_state_delegate_;
std::unique_ptr<visitedlink::VisitedLinkWriter> visitedlink_master_;
// |visitedlink_listener_| is owned by visitedlink_master_.
CefVisitedLinkListener* visitedlink_listener_ = nullptr;
raw_ptr<CefVisitedLinkListener> visitedlink_listener_ = nullptr;
// Owned by the KeyedService system.
extensions::CefExtensionSystem* extension_system_ = nullptr;
raw_ptr<extensions::CefExtensionSystem> extension_system_ = nullptr;
// The key to index KeyedService instances created by
// SimpleKeyedServiceFactory.

View File

@@ -3,39 +3,38 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
#include "cef/libcef/browser/alloy/alloy_browser_host_impl.h"
#include <memory>
#include <string>
#include <utility>
#include "libcef/browser/alloy/alloy_browser_context.h"
#include "libcef/browser/alloy/browser_platform_delegate_alloy.h"
#include "libcef/browser/audio_capturer.h"
#include "libcef/browser/browser_context.h"
#include "libcef/browser/browser_info.h"
#include "libcef/browser/browser_info_manager.h"
#include "libcef/browser/browser_platform_delegate.h"
#include "libcef/browser/context.h"
#include "libcef/browser/devtools/devtools_manager.h"
#include "libcef/browser/hang_monitor.h"
#include "libcef/browser/media_access_query.h"
#include "libcef/browser/osr/osr_util.h"
#include "libcef/browser/request_context_impl.h"
#include "libcef/browser/thread_util.h"
#include "libcef/common/cef_switches.h"
#include "libcef/common/drag_data_impl.h"
#include "libcef/common/frame_util.h"
#include "libcef/common/net/url_util.h"
#include "libcef/common/request_impl.h"
#include "libcef/common/values_impl.h"
#include "libcef/features/runtime_checks.h"
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "cef/libcef/browser/alloy/browser_platform_delegate_alloy.h"
#include "cef/libcef/browser/audio_capturer.h"
#include "cef/libcef/browser/browser_context.h"
#include "cef/libcef/browser/browser_info.h"
#include "cef/libcef/browser/browser_info_manager.h"
#include "cef/libcef/browser/browser_platform_delegate.h"
#include "cef/libcef/browser/context.h"
#include "cef/libcef/browser/extensions/browser_extensions_util.h"
#include "cef/libcef/browser/hang_monitor.h"
#include "cef/libcef/browser/media_access_query.h"
#include "cef/libcef/browser/osr/osr_util.h"
#include "cef/libcef/browser/request_context_impl.h"
#include "cef/libcef/browser/thread_util.h"
#include "cef/libcef/common/cef_switches.h"
#include "cef/libcef/common/drag_data_impl.h"
#include "cef/libcef/common/frame_util.h"
#include "cef/libcef/common/net/url_util.h"
#include "cef/libcef/common/request_impl.h"
#include "cef/libcef/common/values_impl.h"
#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"
@@ -48,13 +47,15 @@
#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 "extensions/common/extension.h"
#include "net/base/net_errors.h"
#include "ui/events/base_event_utils.h"
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
#include "extensions/common/extension.h"
#endif
using content::KeyboardEventProcessingResult;
namespace {
@@ -73,11 +74,19 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::Create(
CefBrowserPlatformDelegate::Create(create_params);
CHECK(platform_delegate);
// Expect runtime style to match.
CHECK(platform_delegate->IsAlloyStyle());
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
const bool is_devtools_popup = !!create_params.devtools_opener;
#else
const bool is_devtools_popup = false;
#endif
scoped_refptr<CefBrowserInfo> info =
CefBrowserInfoManager::GetInstance()->CreateBrowserInfo(
is_devtools_popup, platform_delegate->IsWindowless(),
platform_delegate->IsPrintPreviewSupported(),
create_params.extra_info);
bool own_web_contents = false;
@@ -89,6 +98,7 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::Create(
auto request_context_impl =
static_cast<CefRequestContextImpl*>(create_params.request_context.get());
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
CefRefPtr<CefExtension> cef_extension;
if (create_params.extension) {
auto cef_browser_context = request_context_impl->GetBrowserContext();
@@ -96,25 +106,39 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::Create(
cef_browser_context->GetExtension(create_params.extension->id());
CHECK(cef_extension);
}
#endif
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
auto platform_delegate_ptr = platform_delegate.get();
#endif
CefRefPtr<AlloyBrowserHostImpl> browser = CreateInternal(
create_params.settings, create_params.client, web_contents,
own_web_contents, info,
static_cast<AlloyBrowserHostImpl*>(create_params.devtools_opener.get()),
is_devtools_popup, request_context_impl, std::move(platform_delegate),
cef_extension);
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
FromBaseChecked(create_params.devtools_opener),
#else
/*opener=*/nullptr,
#endif
is_devtools_popup, request_context_impl, std::move(platform_delegate)
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
,
cef_extension
#endif
);
if (!browser) {
return nullptr;
}
GURL url = url_util::MakeGURL(create_params.url, /*fixup=*/true);
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
if (create_params.extension) {
platform_delegate_ptr->CreateExtensionHost(
create_params.extension, url, create_params.extension_host_type);
} else if (!url.is_empty()) {
} else
#endif
if (!url.is_empty()) {
content::OpenURLParams params(url, content::Referrer(),
WindowOpenDisposition::CURRENT_TAB,
CefFrameHostImpl::kPageTransitionExplicit,
@@ -135,8 +159,12 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::CreateInternal(
CefRefPtr<AlloyBrowserHostImpl> opener,
bool is_devtools_popup,
CefRefPtr<CefRequestContextImpl> request_context,
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate,
CefRefPtr<CefExtension> extension) {
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
,
CefRefPtr<CefExtension> extension
#endif
) {
CEF_REQUIRE_UIT();
DCHECK(web_contents);
DCHECK(browser_info);
@@ -167,7 +195,12 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::CreateInternal(
CefRefPtr<AlloyBrowserHostImpl> browser = new AlloyBrowserHostImpl(
settings, client, web_contents, browser_info, opener, request_context,
std::move(platform_delegate), extension);
std::move(platform_delegate)
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
,
extension
#endif
);
browser->InitializeBrowser();
if (!browser->CreateHostWindow()) {
@@ -181,8 +214,8 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::CreateInternal(
// 1. Notify the opener browser's platform delegate. With Views this will
// result in a call to CefBrowserViewDelegate::OnPopupBrowserViewCreated().
// Do this first for consistency with the Chrome runtime.
opener->platform_delegate_->PopupBrowserCreated(browser.get(),
is_devtools_popup);
opener->platform_delegate_->PopupBrowserCreated(
browser->platform_delegate(), browser.get(), is_devtools_popup);
}
// 2. Notify the browser's LifeSpanHandler. This must always be the first
@@ -200,36 +233,38 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::CreateInternal(
return browser;
}
// static
CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::FromBaseChecked(
CefRefPtr<CefBrowserHostBase> host_base) {
if (!host_base) {
return nullptr;
}
CHECK(host_base->IsAlloyStyle());
return static_cast<AlloyBrowserHostImpl*>(host_base.get());
}
// static
CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::GetBrowserForHost(
const content::RenderViewHost* host) {
REQUIRE_ALLOY_RUNTIME();
auto browser = CefBrowserHostBase::GetBrowserForHost(host);
return static_cast<AlloyBrowserHostImpl*>(browser.get());
return FromBaseChecked(CefBrowserHostBase::GetBrowserForHost(host));
}
// static
CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::GetBrowserForHost(
const content::RenderFrameHost* host) {
REQUIRE_ALLOY_RUNTIME();
auto browser = CefBrowserHostBase::GetBrowserForHost(host);
return static_cast<AlloyBrowserHostImpl*>(browser.get());
return FromBaseChecked(CefBrowserHostBase::GetBrowserForHost(host));
}
// static
CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::GetBrowserForContents(
const content::WebContents* contents) {
REQUIRE_ALLOY_RUNTIME();
auto browser = CefBrowserHostBase::GetBrowserForContents(contents);
return static_cast<AlloyBrowserHostImpl*>(browser.get());
return FromBaseChecked(CefBrowserHostBase::GetBrowserForContents(contents));
}
// static
CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::GetBrowserForGlobalId(
const content::GlobalRenderFrameHostId& global_id) {
REQUIRE_ALLOY_RUNTIME();
auto browser = CefBrowserHostBase::GetBrowserForGlobalId(global_id);
return static_cast<AlloyBrowserHostImpl*>(browser.get());
return FromBaseChecked(CefBrowserHostBase::GetBrowserForGlobalId(global_id));
}
// AlloyBrowserHostImpl methods.
@@ -333,42 +368,6 @@ void AlloyBrowserHostImpl::StopFinding(bool clearSelection) {
}
}
void AlloyBrowserHostImpl::ShowDevToolsOnUIThread(
std::unique_ptr<CefShowDevToolsParams> params) {
CEF_REQUIRE_UIT();
if (!EnsureDevToolsManager()) {
return;
}
devtools_manager_->ShowDevTools(params->window_info_, params->client_,
params->settings_,
params->inspect_element_at_);
}
void AlloyBrowserHostImpl::CloseDevTools() {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::BindOnce(&AlloyBrowserHostImpl::CloseDevTools, this));
return;
}
if (!devtools_manager_) {
return;
}
devtools_manager_->CloseDevTools();
}
bool AlloyBrowserHostImpl::HasDevTools() {
if (!CEF_CURRENTLY_ON_UIT()) {
DCHECK(false) << "called on invalid thread";
return false;
}
if (!devtools_manager_) {
return false;
}
return devtools_manager_->HasDevTools();
}
void AlloyBrowserHostImpl::SetAutoResizeEnabled(bool enabled,
const CefSize& min_size,
const CefSize& max_size) {
@@ -384,6 +383,7 @@ void AlloyBrowserHostImpl::SetAutoResizeEnabled(bool enabled,
}
}
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
CefRefPtr<CefExtension> AlloyBrowserHostImpl::GetExtension() {
return extension_;
}
@@ -391,6 +391,7 @@ CefRefPtr<CefExtension> AlloyBrowserHostImpl::GetExtension() {
bool AlloyBrowserHostImpl::IsBackgroundHost() {
return is_background_host_;
}
#endif
bool AlloyBrowserHostImpl::CanExecuteChromeCommand(int command_id) {
return false;
@@ -580,17 +581,6 @@ void AlloyBrowserHostImpl::DestroyBrowser() {
destruction_state_ = DESTRUCTION_STATE_COMPLETED;
// Notify that this browser has been destroyed. These must be delivered in
// the expected order.
// 1. Notify the platform delegate. With Views this will result in a call to
// CefBrowserViewDelegate::OnBrowserDestroyed().
platform_delegate_->NotifyBrowserDestroyed();
// 2. Notify the browser's LifeSpanHandler. This must always be the last
// notification for this browser.
OnBeforeClose();
// Destroy any platform constructs first.
if (javascript_dialog_manager_.get()) {
javascript_dialog_manager_->Destroy();
@@ -599,16 +589,8 @@ void AlloyBrowserHostImpl::DestroyBrowser() {
menu_manager_->Destroy();
}
// Notify any observers that may have state associated with this browser.
OnBrowserDestroyed();
// If the WebContents still exists at this point, signal destruction before
// browser destruction.
if (web_contents()) {
WebContentsDestroyed();
}
// Disassociate the platform delegate from this browser.
// Disassociate the platform delegate from this browser. This will trigger
// WebContents destruction in most cases.
platform_delegate_->BrowserDestroyed(this);
// Delete objects created by the platform delegate that may be referenced by
@@ -636,8 +618,9 @@ void AlloyBrowserHostImpl::CancelContextMenu() {
bool AlloyBrowserHostImpl::MaybeAllowNavigation(
content::RenderFrameHost* opener,
bool is_guest_view,
const content::OpenURLParams& params) {
const bool is_guest_view = extensions::IsBrowserPluginGuest(
content::WebContents::FromRenderFrameHost(opener));
if (is_guest_view && !params.is_pdf &&
!params.url.SchemeIs(extensions::kExtensionScheme) &&
!params.url.SchemeIs(content::kChromeUIScheme)) {
@@ -649,7 +632,7 @@ bool AlloyBrowserHostImpl::MaybeAllowNavigation(
CEF_POST_TASK(CEF_UIT,
base::BindOnce(
base::IgnoreResult(&AlloyBrowserHostImpl::OpenURLFromTab),
this, nullptr, params));
this, nullptr, params, base::NullCallback()));
return false;
}
@@ -657,11 +640,13 @@ bool AlloyBrowserHostImpl::MaybeAllowNavigation(
return true;
}
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
extensions::ExtensionHost* AlloyBrowserHostImpl::GetExtensionHost() const {
CEF_REQUIRE_UIT();
DCHECK(platform_delegate_);
return platform_delegate_->GetExtensionHost();
}
#endif
void AlloyBrowserHostImpl::OnSetFocus(cef_focus_source_t source) {
if (!CEF_CURRENTLY_ON_UIT()) {
@@ -957,8 +942,11 @@ bool AlloyBrowserHostImpl::IsAudioMuted() {
content::WebContents* AlloyBrowserHostImpl::OpenURLFromTab(
content::WebContents* source,
const content::OpenURLParams& params) {
auto target_contents = contents_delegate_->OpenURLFromTab(source, params);
const content::OpenURLParams& params,
base::OnceCallback<void(content::NavigationHandle&)>
navigation_handle_callback) {
auto target_contents = contents_delegate_->OpenURLFromTabEx(
source, params, navigation_handle_callback);
if (target_contents) {
// Start a navigation in the current browser that will result in the
// creation of a new render process.
@@ -970,11 +958,13 @@ content::WebContents* AlloyBrowserHostImpl::OpenURLFromTab(
return nullptr;
}
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
bool AlloyBrowserHostImpl::ShouldAllowRendererInitiatedCrossProcessNavigation(
bool is_main_frame_navigation) {
return platform_delegate_->ShouldAllowRendererInitiatedCrossProcessNavigation(
is_main_frame_navigation);
}
#endif
void AlloyBrowserHostImpl::AddNewContents(
content::WebContents* source,
@@ -1094,13 +1084,13 @@ void AlloyBrowserHostImpl::CanDownload(
KeyboardEventProcessingResult AlloyBrowserHostImpl::PreHandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) {
const input::NativeWebKeyboardEvent& event) {
return contents_delegate_->PreHandleKeyboardEvent(source, event);
}
bool AlloyBrowserHostImpl::HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) {
const input::NativeWebKeyboardEvent& event) {
// Check to see if event should be ignored.
if (event.skip_if_unhandled) {
return false;
@@ -1116,11 +1106,13 @@ bool AlloyBrowserHostImpl::HandleKeyboardEvent(
return false;
}
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
bool AlloyBrowserHostImpl::PreHandleGestureEvent(
content::WebContents* source,
const blink::WebGestureEvent& event) {
return platform_delegate_->PreHandleGestureEvent(source, event);
}
#endif
bool AlloyBrowserHostImpl::CanDragEnter(content::WebContents* source,
const content::DropData& data,
@@ -1146,8 +1138,8 @@ void AlloyBrowserHostImpl::GetCustomWebContentsView(
const GURL& target_url,
int opener_render_process_id,
int opener_render_frame_id,
content::WebContentsView** view,
content::RenderViewHostDelegateView** delegate_view) {
raw_ptr<content::WebContentsView>* view,
raw_ptr<content::RenderViewHostDelegateView>* delegate_view) {
CefBrowserInfoManager::GetInstance()->GetCustomWebContentsView(
target_url,
frame_util::MakeGlobalId(opener_render_process_id,
@@ -1175,7 +1167,8 @@ void AlloyBrowserHostImpl::WebContentsCreated(
scoped_refptr<CefBrowserInfo> info =
CefBrowserInfoManager::GetInstance()->CreatePopupBrowserInfo(
new_contents, platform_delegate->IsWindowless(), extra_info);
new_contents, platform_delegate->IsWindowless(),
platform_delegate->IsPrintPreviewSupported(), extra_info);
CHECK(info.get());
CHECK(info->is_popup());
@@ -1191,10 +1184,14 @@ void AlloyBrowserHostImpl::WebContentsCreated(
// We don't officially own |new_contents| until AddNewContents() is called.
// However, we need to install observers/delegates here.
CefRefPtr<AlloyBrowserHostImpl> browser =
CreateInternal(settings, client, new_contents, /*own_web_contents=*/false,
info, opener, /*is_devtools_popup=*/false, request_context,
std::move(platform_delegate), /*extension=*/nullptr);
CefRefPtr<AlloyBrowserHostImpl> browser = CreateInternal(
settings, client, new_contents, /*own_web_contents=*/false, info, opener,
/*is_devtools_popup=*/false, request_context, std::move(platform_delegate)
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
,
/*extension=*/nullptr
#endif
);
}
void AlloyBrowserHostImpl::RendererUnresponsive(
@@ -1213,11 +1210,7 @@ void AlloyBrowserHostImpl::RendererResponsive(
content::JavaScriptDialogManager*
AlloyBrowserHostImpl::GetJavaScriptDialogManager(content::WebContents* source) {
if (!javascript_dialog_manager_) {
javascript_dialog_manager_ =
std::make_unique<CefJavaScriptDialogManager>(this);
}
return javascript_dialog_manager_.get();
return CefBrowserHostBase::GetJavaScriptDialogManager();
}
void AlloyBrowserHostImpl::RunFileChooser(
@@ -1282,10 +1275,12 @@ bool AlloyBrowserHostImpl::CheckMediaAccessPermission(
security_origin, type);
}
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
bool AlloyBrowserHostImpl::IsNeverComposited(
content::WebContents* web_contents) {
return platform_delegate_->IsNeverComposited(web_contents);
}
#endif
content::PictureInPictureResult AlloyBrowserHostImpl::EnterPictureInPicture(
content::WebContents* web_contents) {
@@ -1302,9 +1297,14 @@ void AlloyBrowserHostImpl::ExitPictureInPicture() {
PictureInPictureWindowManager::GetInstance()->ExitPictureInPicture();
}
bool AlloyBrowserHostImpl::IsBackForwardCacheSupported() {
// Disabled due to issue #3237.
return false;
bool AlloyBrowserHostImpl::IsBackForwardCacheSupported(
content::WebContents& web_contents) {
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
return true;
#else
// Disabled with Alloy bootstrap due to issue #3237.
return cef::IsChromeRuntimeEnabled();
#endif
}
content::PreloadingEligibility AlloyBrowserHostImpl::IsPrerender2Supported(
@@ -1312,17 +1312,24 @@ content::PreloadingEligibility AlloyBrowserHostImpl::IsPrerender2Supported(
return content::PreloadingEligibility::kEligible;
}
void AlloyBrowserHostImpl::DraggableRegionsChanged(
const std::vector<blink::mojom::DraggableRegionPtr>& regions,
content::WebContents* contents) {
contents_delegate_->DraggableRegionsChanged(regions, contents);
}
// content::WebContentsObserver methods.
// -----------------------------------------------------------------------------
void AlloyBrowserHostImpl::DidFinishNavigation(
content::NavigationHandle* navigation_handle) {
if (web_contents()) {
auto cef_browser_context =
static_cast<AlloyBrowserContext*>(web_contents()->GetBrowserContext());
auto cef_browser_context = CefBrowserContext::FromBrowserContext(
web_contents()->GetBrowserContext());
if (cef_browser_context) {
cef_browser_context->AddVisitedURLs(
navigation_handle->GetRedirectChain());
navigation_handle->GetURL(), navigation_handle->GetRedirectChain(),
navigation_handle->GetPageTransition());
}
}
}
@@ -1355,34 +1362,46 @@ void AlloyBrowserHostImpl::OnRecentlyAudibleTimerFired() {
}
void AlloyBrowserHostImpl::AccessibilityEventReceived(
const content::AXEventNotificationDetails& content_event_bundle) {
const ui::AXUpdatesAndEvents& details) {
// Only needed in windowless mode.
if (IsWindowless()) {
if (!web_contents() || !platform_delegate_) {
return;
}
platform_delegate_->AccessibilityEventReceived(content_event_bundle);
platform_delegate_->AccessibilityEventReceived(details);
}
}
void AlloyBrowserHostImpl::AccessibilityLocationChangesReceived(
const std::vector<content::AXLocationChangeNotificationDetails>& locData) {
const std::vector<ui::AXLocationChanges>& details) {
// Only needed in windowless mode.
if (IsWindowless()) {
if (!web_contents() || !platform_delegate_) {
return;
}
platform_delegate_->AccessibilityLocationChangesReceived(locData);
platform_delegate_->AccessibilityLocationChangesReceived(details);
}
}
void AlloyBrowserHostImpl::WebContentsDestroyed() {
// In case we're notified before the CefBrowserContentsDelegate,
// reset it first for consistent state in DestroyWebContents.
if (GetWebContents()) {
contents_delegate_->WebContentsDestroyed();
}
auto wc = web_contents();
content::WebContentsObserver::Observe(nullptr);
if (platform_delegate_) {
platform_delegate_->WebContentsDestroyed(wc);
DestroyWebContents(wc);
if (destruction_state_ < DESTRUCTION_STATE_COMPLETED) {
// We were not called via DestroyBrowser. This can occur when (for example)
// a pending popup WebContents is destroyed during parent WebContents
// destruction. Try to close the associated browser now.
CEF_POST_TASK(CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::CloseBrowser,
this, /*force_close=*/true));
}
}
@@ -1419,8 +1438,12 @@ AlloyBrowserHostImpl::AlloyBrowserHostImpl(
scoped_refptr<CefBrowserInfo> browser_info,
CefRefPtr<AlloyBrowserHostImpl> opener,
CefRefPtr<CefRequestContextImpl> request_context,
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate,
CefRefPtr<CefExtension> extension)
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
,
CefRefPtr<CefExtension> extension
#endif
)
: CefBrowserHostBase(settings,
client,
std::move(platform_delegate),
@@ -1428,8 +1451,12 @@ AlloyBrowserHostImpl::AlloyBrowserHostImpl(
request_context),
content::WebContentsObserver(web_contents),
opener_(kNullWindowHandle),
is_windowless_(platform_delegate_->IsWindowless()),
extension_(extension) {
is_windowless_(platform_delegate_->IsWindowless())
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
,
extension_(extension)
#endif
{
contents_delegate_->ObserveWebContents(web_contents);
if (opener.get() && !is_views_hosted_) {

View File

@@ -11,21 +11,22 @@
#include <string>
#include <vector>
#include "include/cef_browser.h"
#include "include/cef_client.h"
#include "include/cef_frame.h"
#include "libcef/browser/browser_host_base.h"
#include "libcef/browser/browser_info.h"
#include "libcef/browser/frame_host_impl.h"
#include "libcef/browser/javascript_dialog_manager.h"
#include "libcef/browser/menu_manager.h"
#include "libcef/browser/request_context_impl.h"
#include "base/synchronization/lock.h"
#include "cef/include/cef_browser.h"
#include "cef/include/cef_client.h"
#include "cef/include/cef_frame.h"
#include "cef/libcef/browser/browser_host_base.h"
#include "cef/libcef/browser/browser_info.h"
#include "cef/libcef/browser/frame_host_impl.h"
#include "cef/libcef/browser/menu_manager.h"
#include "cef/libcef/browser/request_context_impl.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h"
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
#include "extensions/common/mojom/view_type.mojom-forward.h"
#endif
class CefAudioCapturer;
class CefBrowserInfo;
@@ -62,6 +63,11 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
static CefRefPtr<AlloyBrowserHostImpl> Create(
CefBrowserCreateParams& create_params);
// Safe (checked) conversion from CefBrowserHostBase to AlloyBrowserHostImpl.
// Use this method instead of static_cast.
static CefRefPtr<AlloyBrowserHostImpl> FromBaseChecked(
CefRefPtr<CefBrowserHostBase> host_base);
// Returns the browser associated with the specified RenderViewHost.
static CefRefPtr<AlloyBrowserHostImpl> GetBrowserForHost(
const content::RenderViewHost* host);
@@ -85,8 +91,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
bool matchCase,
bool findNext) override;
void StopFinding(bool clearSelection) override;
void CloseDevTools() override;
bool HasDevTools() override;
bool IsWindowRenderingDisabled() override;
void WasResized() override;
void WasHidden(bool hidden) override;
@@ -120,15 +124,17 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
void SetAutoResizeEnabled(bool enabled,
const CefSize& min_size,
const CefSize& max_size) override;
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
CefRefPtr<CefExtension> GetExtension() override;
bool IsBackgroundHost() override;
#endif
bool CanExecuteChromeCommand(int command_id) override;
void ExecuteChromeCommand(int command_id,
cef_window_open_disposition_t disposition) override;
// Returns true if windowless rendering is enabled.
// CefBrowserHostBase methods:
bool IsWindowless() const override;
bool IsAlloyStyle() const override { return true; }
bool IsVisible() const override;
// Returns true if this browser supports picture-in-picture.
@@ -147,7 +153,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
void CancelContextMenu();
bool MaybeAllowNavigation(content::RenderFrameHost* opener,
bool is_guest_view,
const content::OpenURLParams& params) override;
// Convert from view DIP coordinates to screen coordinates. If
@@ -164,8 +169,10 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
void UpdateDragOperation(ui::mojom::DragOperation operation,
bool document_is_handling_drag);
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
// Accessors that must be called on the UI thread.
extensions::ExtensionHost* GetExtensionHost() const;
#endif
void OnSetFocus(cef_focus_source_t source) override;
@@ -182,9 +189,13 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
// content::WebContentsDelegate methods.
content::WebContents* OpenURLFromTab(
content::WebContents* source,
const content::OpenURLParams& params) override;
const content::OpenURLParams& params,
base::OnceCallback<void(content::NavigationHandle&)>
navigation_handle_callback) override;
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
bool ShouldAllowRendererInitiatedCrossProcessNavigation(
bool is_main_frame_navigation) override;
#endif
void AddNewContents(content::WebContents* source,
std::unique_ptr<content::WebContents> new_contents,
const GURL& target_url,
@@ -211,12 +222,13 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
base::OnceCallback<void(bool)> callback) override;
content::KeyboardEventProcessingResult PreHandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) override;
bool HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) override;
const input::NativeWebKeyboardEvent& event) override;
bool HandleKeyboardEvent(content::WebContents* source,
const input::NativeWebKeyboardEvent& event) override;
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
bool PreHandleGestureEvent(content::WebContents* source,
const blink::WebGestureEvent& event) override;
#endif
bool CanDragEnter(content::WebContents* source,
const content::DropData& data,
blink::DragOperationsMask operations_allowed) override;
@@ -225,8 +237,8 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
const GURL& target_url,
int opener_render_process_id,
int opener_render_frame_id,
content::WebContentsView** view,
content::RenderViewHostDelegateView** delegate_view) override;
raw_ptr<content::WebContentsView>* view,
raw_ptr<content::RenderViewHostDelegateView>* delegate_view) override;
void WebContentsCreated(content::WebContents* source_contents,
int opener_render_process_id,
int opener_render_frame_id,
@@ -270,13 +282,18 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host,
const url::Origin& security_origin,
blink::mojom::MediaStreamType type) override;
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
bool IsNeverComposited(content::WebContents* web_contents) override;
#endif
content::PictureInPictureResult EnterPictureInPicture(
content::WebContents* web_contents) override;
void ExitPictureInPicture() override;
bool IsBackForwardCacheSupported() override;
bool IsBackForwardCacheSupported(content::WebContents& web_contents) override;
content::PreloadingEligibility IsPrerender2Supported(
content::WebContents& web_contents) override;
void DraggableRegionsChanged(
const std::vector<blink::mojom::DraggableRegionPtr>& regions,
content::WebContents* contents) override;
// content::WebContentsObserver methods.
using content::WebContentsObserver::BeforeUnloadFired;
@@ -284,16 +301,11 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
content::NavigationHandle* navigation_handle) override;
void OnAudioStateChanged(bool audible) override;
void AccessibilityEventReceived(
const content::AXEventNotificationDetails& content_event_bundle) override;
const ui::AXUpdatesAndEvents& details) override;
void AccessibilityLocationChangesReceived(
const std::vector<content::AXLocationChangeNotificationDetails>& locData)
override;
const std::vector<ui::AXLocationChanges>& details) override;
void WebContentsDestroyed() override;
protected:
void ShowDevToolsOnUIThread(
std::unique_ptr<CefShowDevToolsParams> params) override;
private:
friend class CefBrowserPlatformDelegateAlloy;
@@ -306,8 +318,12 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
CefRefPtr<AlloyBrowserHostImpl> opener,
bool is_devtools_popup,
CefRefPtr<CefRequestContextImpl> request_context,
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate,
CefRefPtr<CefExtension> extension);
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
,
CefRefPtr<CefExtension> extension
#endif
);
AlloyBrowserHostImpl(
const CefBrowserSettings& settings,
@@ -316,8 +332,12 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
scoped_refptr<CefBrowserInfo> browser_info,
CefRefPtr<AlloyBrowserHostImpl> opener,
CefRefPtr<CefRequestContextImpl> request_context,
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate,
CefRefPtr<CefExtension> extension);
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
,
CefRefPtr<CefExtension> extension
#endif
);
// Give the platform delegate an opportunity to create the host window.
bool CreateHostWindow();
@@ -328,8 +348,10 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
CefWindowHandle opener_;
const bool is_windowless_;
CefWindowHandle host_window_handle_ = kNullWindowHandle;
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
CefRefPtr<CefExtension> extension_;
bool is_background_host_ = false;
#endif
// Represents the current browser destruction state. Only accessed on the UI
// thread.
@@ -339,9 +361,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
// on the UI thread.
bool window_destroyed_ = false;
// Used for creating and managing JavaScript dialogs.
std::unique_ptr<CefJavaScriptDialogManager> javascript_dialog_manager_;
// Used for creating and managing context menus.
std::unique_ptr<CefMenuManager> menu_manager_;

View File

@@ -2,32 +2,31 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/alloy/alloy_browser_main.h"
#include "cef/libcef/browser/alloy/alloy_browser_main.h"
#include <stdint.h>
#include <memory>
#include <string>
#include "libcef/browser/alloy/dialogs/alloy_constrained_window_views_client.h"
#include "libcef/browser/browser_context.h"
#include "libcef/browser/browser_context_keyed_service_factories.h"
#include "libcef/browser/context.h"
#include "libcef/browser/devtools/devtools_manager_delegate.h"
#include "libcef/browser/extensions/extension_system_factory.h"
#include "libcef/browser/file_dialog_runner.h"
#include "libcef/browser/net/chrome_scheme_handler.h"
#include "libcef/browser/permission_prompt.h"
#include "libcef/browser/thread_util.h"
#include "libcef/common/app_manager.h"
#include "libcef/common/command_line_impl.h"
#include "libcef/common/extensions/extensions_util.h"
#include "libcef/common/net/net_resource_provider.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/thread_pool.h"
#include "cef/libcef/browser/alloy/devtools/devtools_manager_delegate.h"
#include "cef/libcef/browser/alloy/dialogs/alloy_constrained_window_views_client.h"
#include "cef/libcef/browser/browser_context.h"
#include "cef/libcef/browser/browser_context_keyed_service_factories.h"
#include "cef/libcef/browser/context.h"
#include "cef/libcef/browser/extensions/extension_system_factory.h"
#include "cef/libcef/browser/file_dialog_runner.h"
#include "cef/libcef/browser/net/chrome_scheme_handler.h"
#include "cef/libcef/browser/permission_prompt.h"
#include "cef/libcef/browser/thread_util.h"
#include "cef/libcef/common/app_manager.h"
#include "cef/libcef/common/command_line_impl.h"
#include "cef/libcef/common/extensions/extensions_util.h"
#include "cef/libcef/common/net/net_resource_provider.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_process_singleton.h"
#include "chrome/browser/media/router/chrome_media_router_factory.h"
@@ -51,6 +50,7 @@
#include "ui/native_theme/native_theme.h"
#if BUILDFLAG(IS_LINUX)
#include "components/password_manager/core/browser/password_manager_switches.h"
#include "ui/base/ozone_buildflags.h"
#if defined(USE_AURA) && BUILDFLAG(IS_OZONE_X11)
#include "ui/events/devices/x11/touch_factory_x11.h"
@@ -90,11 +90,11 @@
#if BUILDFLAG(IS_LINUX)
#include "base/path_service.h"
#include "cef/libcef/browser/printing/print_dialog_linux.h"
#include "chrome/browser/themes/theme_service_aura_linux.h"
#include "chrome/browser/ui/views/theme_profile_key.h"
#include "chrome/grit/branded_strings.h"
#include "components/os_crypt/sync/key_storage_config_linux.h"
#include "libcef/browser/printing/print_dialog_linux.h"
#include "ui/base/cursor/cursor_factory.h"
#include "ui/base/ime/input_method.h"
#include "ui/base/l10n/l10n_util.h"
@@ -191,7 +191,8 @@ AlloyBrowserMainParts::~AlloyBrowserMainParts() {
}
void AlloyBrowserMainParts::ToolkitInitialized() {
SetConstrainedWindowViewsClient(CreateAlloyConstrainedWindowViewsClient());
SetConstrainedWindowViewsClient(
CreateAlloyConstrainedWindowViewsClient(nullptr));
#if defined(USE_AURA)
CHECK(aura::Env::GetInstance());
@@ -283,12 +284,13 @@ void AlloyBrowserMainParts::PostCreateMainMessageLoop() {
std::unique_ptr<os_crypt::Config> config =
std::make_unique<os_crypt::Config>();
// Forward to os_crypt the flag to use a specific password store.
config->store = command_line->GetSwitchValueASCII(switches::kPasswordStore);
// Forward the product name (defaults to "Chromium").
config->store =
command_line->GetSwitchValueASCII(password_manager::kPasswordStore);
// Forward the product name
config->product_name = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME);
// OSCrypt can be disabled in a special settings file.
config->should_use_preference =
command_line->HasSwitch(switches::kEnableEncryptionSelection);
command_line->HasSwitch(password_manager::kEnableEncryptionSelection);
base::PathService::Get(chrome::DIR_USER_DATA, &config->user_data_path);
DCHECK(!config->user_data_path.empty());
OSCrypt::SetConfig(std::move(config));

View File

@@ -6,11 +6,12 @@
#define CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_MAIN_H_
#pragma once
#include "libcef/browser/request_context_impl.h"
#include <string_view>
#include "base/command_line.h"
#include "base/strings/string_piece.h"
#include "base/memory/raw_ptr.h"
#include "build/build_config.h"
#include "cef/libcef/browser/request_context_impl.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/browser_main_parts.h"
#include "ui/display/screen.h"
@@ -79,7 +80,7 @@ class AlloyBrowserMainParts : public content::BrowserMainParts {
#endif // BUILDFLAG(IS_WIN)
CefRefPtr<CefRequestContextImpl> global_request_context_;
CefDevToolsDelegate* devtools_delegate_ = nullptr; // Deletes itself.
raw_ptr<CefDevToolsDelegate> devtools_delegate_ = nullptr; // Deletes itself.
// Blocking task runners exposed via CefTaskRunner. For consistency with
// previous named thread behavior always execute all pending tasks before

View File

@@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "cef/libcef/browser/alloy/alloy_browser_main.h"
#include <Objbase.h>
#include <commctrl.h>
#include <windows.h>
#include "libcef/browser/alloy/alloy_browser_main.h"
#include <commctrl.h>
#include "base/logging.h"

View File

@@ -2,48 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/alloy/alloy_content_browser_client.h"
#include "cef/libcef/browser/alloy/alloy_content_browser_client.h"
#include <algorithm>
#include <tuple>
#include <utility>
#include "include/cef_version.h"
#include "libcef/browser/alloy/alloy_browser_context.h"
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
#include "libcef/browser/alloy/alloy_browser_main.h"
#include "libcef/browser/alloy/alloy_web_contents_view_delegate.h"
#include "libcef/browser/browser_context.h"
#include "libcef/browser/browser_frame.h"
#include "libcef/browser/browser_info.h"
#include "libcef/browser/browser_info_manager.h"
#include "libcef/browser/browser_manager.h"
#include "libcef/browser/browser_platform_delegate.h"
#include "libcef/browser/certificate_query.h"
#include "libcef/browser/context.h"
#include "libcef/browser/devtools/devtools_manager_delegate.h"
#include "libcef/browser/extensions/extension_system.h"
#include "libcef/browser/extensions/extension_web_contents_observer.h"
#include "libcef/browser/media_capture_devices_dispatcher.h"
#include "libcef/browser/net/chrome_scheme_handler.h"
#include "libcef/browser/net/throttle_handler.h"
#include "libcef/browser/net_service/cookie_manager_impl.h"
#include "libcef/browser/net_service/login_delegate.h"
#include "libcef/browser/net_service/proxy_url_loader_factory.h"
#include "libcef/browser/net_service/resource_request_handler_wrapper.h"
#include "libcef/browser/prefs/renderer_prefs.h"
#include "libcef/browser/speech_recognition_manager_delegate.h"
#include "libcef/browser/thread_util.h"
#include "libcef/browser/x509_certificate_impl.h"
#include "libcef/common/alloy/alloy_content_client.h"
#include "libcef/common/app_manager.h"
#include "libcef/common/cef_switches.h"
#include "libcef/common/command_line_impl.h"
#include "libcef/common/extensions/extensions_util.h"
#include "libcef/common/frame_util.h"
#include "libcef/common/net/scheme_registration.h"
#include "libcef/common/request_impl.h"
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
@@ -52,6 +16,41 @@
#include "base/stl_util.h"
#include "base/threading/thread_restrictions.h"
#include "cef/grit/cef_resources.h"
#include "cef/include/cef_version.h"
#include "cef/libcef/browser/alloy/alloy_browser_context.h"
#include "cef/libcef/browser/alloy/alloy_browser_host_impl.h"
#include "cef/libcef/browser/alloy/alloy_browser_main.h"
#include "cef/libcef/browser/alloy/alloy_web_contents_view_delegate.h"
#include "cef/libcef/browser/alloy/devtools/devtools_manager_delegate.h"
#include "cef/libcef/browser/browser_context.h"
#include "cef/libcef/browser/browser_frame.h"
#include "cef/libcef/browser/browser_info.h"
#include "cef/libcef/browser/browser_info_manager.h"
#include "cef/libcef/browser/browser_manager.h"
#include "cef/libcef/browser/browser_platform_delegate.h"
#include "cef/libcef/browser/certificate_query.h"
#include "cef/libcef/browser/context.h"
#include "cef/libcef/browser/extensions/extension_system.h"
#include "cef/libcef/browser/extensions/extension_web_contents_observer.h"
#include "cef/libcef/browser/media_capture_devices_dispatcher.h"
#include "cef/libcef/browser/net/chrome_scheme_handler.h"
#include "cef/libcef/browser/net/throttle_handler.h"
#include "cef/libcef/browser/net_service/cookie_manager_impl.h"
#include "cef/libcef/browser/net_service/login_delegate.h"
#include "cef/libcef/browser/net_service/proxy_url_loader_factory.h"
#include "cef/libcef/browser/net_service/resource_request_handler_wrapper.h"
#include "cef/libcef/browser/prefs/renderer_prefs.h"
#include "cef/libcef/browser/speech_recognition_manager_delegate.h"
#include "cef/libcef/browser/thread_util.h"
#include "cef/libcef/browser/x509_certificate_impl.h"
#include "cef/libcef/common/alloy/alloy_content_client.h"
#include "cef/libcef/common/app_manager.h"
#include "cef/libcef/common/cef_switches.h"
#include "cef/libcef/common/command_line_impl.h"
#include "cef/libcef/common/extensions/extensions_util.h"
#include "cef/libcef/common/frame_util.h"
#include "cef/libcef/common/net/scheme_registration.h"
#include "cef/libcef/common/request_impl.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/extensions/chrome_content_browser_client_extensions_part.h"
@@ -92,6 +91,7 @@
#include "components/pdf/browser/pdf_navigation_throttle.h"
#include "components/pdf/browser/pdf_url_loader_request_interceptor.h"
#include "components/pdf/common/constants.h"
#include "components/pdf/common/pdf_util.h"
#include "components/policy/core/common/policy_pref_names.h"
#include "components/spellcheck/common/spellcheck.mojom.h"
#include "components/version_info/version_info.h"
@@ -160,10 +160,10 @@
#include "net/ssl/client_cert_store_mac.h"
#include "services/video_capture/public/mojom/constants.mojom.h"
#elif BUILDFLAG(IS_POSIX)
#include "cef/libcef/common/crash_reporting.h"
#include "components/crash/core/app/crash_switches.h"
#include "components/crash/core/app/crashpad.h"
#include "content/public/common/content_descriptors.h"
#include "libcef/common/crash_reporting.h"
#endif
#if BUILDFLAG(IS_WIN)
@@ -361,10 +361,15 @@ 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)
/*bound_session_params=*/nullptr,
std::move(bound_session_throttler_params),
#endif
profile->GetPrefs()->GetBoolean(
policy::policy_prefs::kForceGoogleSafeSearch),
@@ -384,6 +389,10 @@ AlloyContentBrowserClient::AlloyContentBrowserClient() = default;
AlloyContentBrowserClient::~AlloyContentBrowserClient() = default;
void AlloyContentBrowserClient::CleanupOnUIThread() {
browser_main_parts_ = nullptr;
}
std::unique_ptr<content::BrowserMainParts>
AlloyContentBrowserClient::CreateBrowserMainParts(
bool /* is_integration_test */) {
@@ -449,7 +458,7 @@ bool AlloyContentBrowserClient::DoesSiteRequireDedicatedProcess(
}
bool AlloyContentBrowserClient::ShouldTreatURLSchemeAsFirstPartyWhenTopLevel(
base::StringPiece scheme,
std::string_view scheme,
bool is_embedded_origin_secure) {
// This is needed to bypass the normal SameSite rules for any chrome:// page
// embedding a secure origin, regardless of the registrable domains of any
@@ -470,7 +479,7 @@ bool AlloyContentBrowserClient::ShouldTreatURLSchemeAsFirstPartyWhenTopLevel(
bool AlloyContentBrowserClient::
ShouldIgnoreSameSiteCookieRestrictionsWhenTopLevel(
base::StringPiece scheme,
std::string_view scheme,
bool is_embedded_origin_secure) {
return is_embedded_origin_secure && scheme == content::kChromeUIScheme;
}
@@ -625,10 +634,6 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
process ? CefBrowserContext::FromBrowserContext(browser_context)
: nullptr;
if (cef_browser_context) {
if (cef_browser_context->IsPrintPreviewSupported()) {
command_line->AppendSwitch(switches::kEnablePrintPreview);
}
// Based on ChromeContentBrowserClientExtensionsPart::
// AppendExtraRendererCommandLineSwitches
if (extensions::ProcessMap::Get(browser_context)
@@ -917,10 +922,10 @@ void AlloyContentBrowserClient::
},
&render_frame_host));
associated_registry.AddInterface<pdf::mojom::PdfService>(base::BindRepeating(
associated_registry.AddInterface<pdf::mojom::PdfHost>(base::BindRepeating(
[](content::RenderFrameHost* render_frame_host,
mojo::PendingAssociatedReceiver<pdf::mojom::PdfService> receiver) {
pdf::PDFDocumentHelper::BindPdfService(
mojo::PendingAssociatedReceiver<pdf::mojom::PdfHost> receiver) {
pdf::PDFDocumentHelper::BindPdfHost(
std::move(receiver), render_frame_host,
std::make_unique<ChromePDFDocumentHelperClient>());
},
@@ -1183,6 +1188,7 @@ void AlloyContentBrowserClient::WillCreateURLLoaderFactory(
int render_process_id,
URLLoaderFactoryType type,
const url::Origin& request_initiator,
const net::IsolationInfo& isolation_info,
std::optional<int64_t> navigation_id,
ukm::SourceIdObj ukm_source_id,
network::URLLoaderFactoryBuilder& factory_builder,

View File

@@ -9,11 +9,11 @@
#include <string>
#include <utility>
#include "include/cef_request_context_handler.h"
#include "libcef/browser/request_context_impl.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "build/build_config.h"
#include "cef/include/cef_request_context_handler.h"
#include "cef/libcef/browser/request_context_impl.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/web_contents.h"
#include "third_party/skia/include/core/SkColor.h"
@@ -34,6 +34,8 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
AlloyContentBrowserClient();
~AlloyContentBrowserClient() override;
void CleanupOnUIThread();
// ContentBrowserClient implementation.
std::unique_ptr<content::BrowserMainParts> CreateBrowserMainParts(
bool is_integration_test) override;
@@ -45,10 +47,10 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
bool DoesSiteRequireDedicatedProcess(content::BrowserContext* browser_context,
const GURL& effective_site_url) override;
bool ShouldTreatURLSchemeAsFirstPartyWhenTopLevel(
base::StringPiece scheme,
std::string_view scheme,
bool is_embedded_origin_secure) override;
bool ShouldIgnoreSameSiteCookieRestrictionsWhenTopLevel(
base::StringPiece scheme,
std::string_view scheme,
bool is_embedded_origin_secure) override;
void OverrideURLLoaderFactoryParams(
content::BrowserContext* browser_context,
@@ -186,6 +188,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
int render_process_id,
URLLoaderFactoryType type,
const url::Origin& request_initiator,
const net::IsolationInfo& isolation_info,
std::optional<int64_t> navigation_id,
ukm::SourceIdObj ukm_source_id,
network::URLLoaderFactoryBuilder& factory_builder,
@@ -278,7 +281,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
const extensions::Extension* GetExtension(
content::SiteInstance* site_instance);
AlloyBrowserMainParts* browser_main_parts_ = nullptr;
raw_ptr<AlloyBrowserMainParts> browser_main_parts_ = nullptr;
};
#endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_CONTENT_BROWSER_CLIENT_H_

View File

@@ -0,0 +1,22 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "cef/libcef/browser/alloy/alloy_download_manager_delegate.h"
#include "chrome/common/chrome_constants.h"
#include "components/download/public/common/download_item.h"
AlloyDownloadManagerDelegate::AlloyDownloadManagerDelegate(
content::DownloadManager* manager)
: CefDownloadManagerDelegateImpl(manager, /*alloy_bootstrap=*/true) {}
void AlloyDownloadManagerDelegate::GetNextId(
content::DownloadIdCallback callback) {
static uint32_t next_id = download::DownloadItem::kInvalidId + 1;
std::move(callback).Run(next_id++);
}
std::string AlloyDownloadManagerDelegate::ApplicationClientIdForFileScanning() {
return std::string(chrome::kApplicationClientIDStringForAVScanning);
}

View File

@@ -0,0 +1,26 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_ALLOY_ALLOY_DOWNLOAD_MANAGER_DELEGATE_H_
#define CEF_LIBCEF_BROWSER_ALLOY_ALLOY_DOWNLOAD_MANAGER_DELEGATE_H_
#pragma once
#include "cef/libcef/browser/download_manager_delegate_impl.h"
// Specialization for the Alloy bootstrap.
class AlloyDownloadManagerDelegate : public CefDownloadManagerDelegateImpl {
public:
explicit AlloyDownloadManagerDelegate(content::DownloadManager* manager);
AlloyDownloadManagerDelegate(const AlloyDownloadManagerDelegate&) = delete;
AlloyDownloadManagerDelegate& operator=(const AlloyDownloadManagerDelegate&) =
delete;
private:
// DownloadManagerDelegate methods.
void GetNextId(content::DownloadIdCallback callback) override;
std::string ApplicationClientIdForFileScanning() override;
};
#endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_DOWNLOAD_MANAGER_DELEGATE_H_

View File

@@ -2,14 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#include "libcef/browser/alloy/alloy_download_util.h"
#include "cef/libcef/browser/alloy/alloy_download_util.h"
#include "libcef/browser/alloy/alloy_browser_context.h"
#include "cef/libcef/browser/alloy/alloy_browser_context.h"
namespace alloy {
DownloadPrefs* GetDownloadPrefsFromBrowserContext(
content::BrowserContext* context) {
// This function is only called with Alloy bootstrap, so the static_cast is
// safe.
return static_cast<AlloyBrowserContext*>(context)->GetDownloadPrefs();
}

View File

@@ -6,6 +6,8 @@
#define CEF_LIBCEF_BROWSER_ALLOY_ALLOY_DOWNLOAD_UTIL_H_
#pragma once
#include "cef/libcef/features/features.h"
class DownloadPrefs;
namespace content {

View File

@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/alloy/alloy_web_contents_view_delegate.h"
#include "cef/libcef/browser/alloy/alloy_web_contents_view_delegate.h"
#include "cef/libcef/browser/alloy/alloy_browser_host_impl.h"
#include "content/public/browser/web_contents.h"
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
AlloyWebContentsViewDelegate::AlloyWebContentsViewDelegate(
content::WebContents* web_contents)
: web_contents_(web_contents) {}

View File

@@ -6,8 +6,8 @@
#define CEF_LIBCEF_BROWSER_ALLOY_ALLOY_WEB_CONTENTS_VIEW_DELEGATE_H_
#pragma once
#include "include/internal/cef_ptr.h"
#include "base/memory/raw_ptr.h"
#include "cef/include/internal/cef_ptr.h"
#include "content/public/browser/web_contents_view_delegate.h"
namespace content {
@@ -27,7 +27,7 @@ class AlloyWebContentsViewDelegate : public content::WebContentsViewDelegate {
const content::ContextMenuParams& params) override;
private:
content::WebContents* const web_contents_;
const raw_ptr<content::WebContents> web_contents_;
};
#endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_WEB_CONTENTS_VIEW_DELEGATE_H_

View File

@@ -2,42 +2,66 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/alloy/browser_platform_delegate_alloy.h"
#include "cef/libcef/browser/alloy/browser_platform_delegate_alloy.h"
#include <memory>
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
#include "libcef/browser/alloy/dialogs/alloy_javascript_dialog_manager_delegate.h"
#include "libcef/browser/extensions/browser_extensions_util.h"
#include "libcef/browser/extensions/extension_background_host.h"
#include "libcef/browser/extensions/extension_system.h"
#include "libcef/browser/extensions/extension_view_host.h"
#include "libcef/browser/extensions/extension_web_contents_observer.h"
#include "libcef/common/extensions/extensions_util.h"
#include "libcef/common/net/url_util.h"
#include "libcef/features/runtime_checks.h"
#include "base/logging.h"
#include "chrome/browser/printing/print_view_manager.h"
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
#include "cef/libcef/browser/alloy/alloy_browser_host_impl.h"
#include "cef/libcef/browser/extensions/extension_background_host.h"
#include "cef/libcef/browser/extensions/extension_system.h"
#include "cef/libcef/browser/extensions/extension_view_host.h"
#include "cef/libcef/browser/extensions/extension_web_contents_observer.h"
#include "cef/libcef/common/extensions/extensions_util.h"
#include "cef/libcef/common/net/url_util.h"
#include "cef/libcef/features/features.h"
#include "chrome/browser/task_manager/web_contents_tags.h"
#include "chrome/browser/ui/tab_helpers.h"
#include "components/find_in_page/find_tab_helper.h"
#include "components/find_in_page/find_types.h"
#include "components/javascript_dialogs/tab_modal_dialog_manager.h"
#include "components/permissions/permission_request_manager.h"
#include "components/zoom/zoom_controller.h"
#include "components/performance_manager/embedder/performance_manager_registry.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/public/browser/render_view_host.h"
#include "extensions/browser/process_manager.h"
#include "pdf/pdf_features.h"
#include "third_party/blink/public/mojom/frame/find_in_page.mojom.h"
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
#include "cef/libcef/browser/alloy/dialogs/alloy_javascript_dialog_manager_delegate.h"
#include "cef/libcef/features/runtime_checks.h"
#include "chrome/browser/printing/printing_init.h"
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
#include "components/javascript_dialogs/tab_modal_dialog_manager.h"
#include "components/permissions/permission_request_manager.h"
#include "components/zoom/zoom_controller.h"
#include "extensions/browser/extension_registry.h"
#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
namespace {
const char kAttachedHelpersUserDataKey[] = "CefAttachedHelpers";
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
const extensions::Extension* GetExtensionForUrl(
content::BrowserContext* browser_context,
const GURL& url) {
auto* registry = extensions::ExtensionRegistry::Get(browser_context);
if (!registry) {
return nullptr;
}
std::string extension_id = url.host();
return registry->enabled_extensions().GetByID(extension_id);
}
#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
} // namespace
CefBrowserPlatformDelegateAlloy::CefBrowserPlatformDelegateAlloy()
: weak_ptr_factory_(this) {}
content::WebContents* CefBrowserPlatformDelegateAlloy::CreateWebContents(
CefBrowserCreateParams& create_params,
bool& own_web_contents) {
REQUIRE_ALLOY_RUNTIME();
DCHECK(primary_);
if (!create_params.request_context) {
@@ -50,13 +74,13 @@ content::WebContents* CefBrowserPlatformDelegateAlloy::CreateWebContents(
CHECK(browser_context);
scoped_refptr<content::SiteInstance> site_instance;
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
if (extensions::ExtensionsEnabled() && !create_params.url.empty()) {
GURL gurl = url_util::MakeGURL(create_params.url, /*fixup=*/true);
if (!create_params.extension) {
// We might be loading an extension app view where the extension URL is
// provided by the client.
create_params.extension =
extensions::GetExtensionForUrl(browser_context, gurl);
create_params.extension = GetExtensionForUrl(browser_context, gurl);
}
if (create_params.extension) {
if (create_params.extension_host_type ==
@@ -77,6 +101,7 @@ content::WebContents* CefBrowserPlatformDelegateAlloy::CreateWebContents(
DCHECK(site_instance);
}
}
#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
content::WebContents::CreateParams wc_create_params(browser_context,
site_instance);
@@ -100,7 +125,7 @@ void CefBrowserPlatformDelegateAlloy::WebContentsCreated(
CefBrowserPlatformDelegate::WebContentsCreated(web_contents, owned);
if (primary_) {
find_in_page::FindTabHelper::CreateForWebContents(web_contents);
AttachHelpers(web_contents);
if (owned) {
SetOwnedWebContents(web_contents);
@@ -118,7 +143,6 @@ void CefBrowserPlatformDelegateAlloy::AddNewContents(
const blink::mojom::WindowFeatures& window_features,
bool user_gesture,
bool* was_blocked) {
REQUIRE_ALLOY_RUNTIME();
DCHECK(primary_);
CefRefPtr<AlloyBrowserHostImpl> owner =
@@ -131,13 +155,16 @@ void CefBrowserPlatformDelegateAlloy::AddNewContents(
return;
}
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
if (extension_host_) {
extension_host_->AddNewContents(source, std::move(new_contents), target_url,
disposition, window_features, user_gesture,
was_blocked);
}
#endif
}
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
bool CefBrowserPlatformDelegateAlloy::
ShouldAllowRendererInitiatedCrossProcessNavigation(
bool is_main_frame_navigation) {
@@ -147,6 +174,7 @@ bool CefBrowserPlatformDelegateAlloy::
}
return true;
}
#endif
void CefBrowserPlatformDelegateAlloy::RenderViewReady() {
ConfigureAutoResize();
@@ -162,22 +190,17 @@ void CefBrowserPlatformDelegateAlloy::BrowserCreated(
}
DCHECK(!web_contents_->GetDelegate());
web_contents_->SetDelegate(static_cast<AlloyBrowserHostImpl*>(browser));
web_contents_->SetDelegate(
AlloyBrowserHostImpl::FromBaseChecked(browser).get());
permissions::PermissionRequestManager::CreateForWebContents(web_contents_);
PrefsTabHelper::CreateForWebContents(web_contents_);
printing::PrintViewManager::CreateForWebContents(web_contents_);
zoom::ZoomController::CreateForWebContents(web_contents_);
javascript_dialogs::TabModalDialogManager::CreateForWebContents(
web_contents_,
CreateAlloyJavaScriptTabModalDialogManagerDelegateDesktop(web_contents_));
AttachHelpers(web_contents_);
// Used for print preview and JavaScript dialogs.
web_contents_dialog_helper_ =
std::make_unique<AlloyWebContentsDialogHelper>(web_contents_, this);
}
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
void CefBrowserPlatformDelegateAlloy::CreateExtensionHost(
const extensions::Extension* extension,
const GURL& url,
@@ -190,12 +213,12 @@ void CefBrowserPlatformDelegateAlloy::CreateExtensionHost(
DCHECK(browser_);
DCHECK(!extension_host_);
auto alloy_browser = static_cast<AlloyBrowserHostImpl*>(browser_);
auto alloy_browser = AlloyBrowserHostImpl::FromBaseChecked(browser_.get());
if (host_type == extensions::mojom::ViewType::kExtensionPopup) {
// Create an extension host that we own.
extension_host_ = new extensions::CefExtensionViewHost(
alloy_browser, extension, web_contents_, url, host_type);
alloy_browser.get(), extension, web_contents_, url, host_type);
// Trigger load of the extension URL.
extension_host_->CreateRendererSoon();
} else if (host_type ==
@@ -204,7 +227,7 @@ void CefBrowserPlatformDelegateAlloy::CreateExtensionHost(
alloy_browser->is_background_host_ = true;
// Create an extension host that will be owned by ProcessManager.
extension_host_ = new extensions::CefExtensionBackgroundHost(
alloy_browser,
alloy_browser.get(),
base::BindOnce(&CefBrowserPlatformDelegateAlloy::OnExtensionHostDeleted,
weak_ptr_factory_.GetWeakPtr()),
extension, web_contents_, url, host_type);
@@ -218,11 +241,14 @@ extensions::ExtensionHost* CefBrowserPlatformDelegateAlloy::GetExtensionHost()
const {
return extension_host_;
}
#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
void CefBrowserPlatformDelegateAlloy::BrowserDestroyed(
CefBrowserHostBase* browser) {
if (primary_) {
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
DestroyExtensionHost();
#endif
owned_web_contents_.reset();
}
@@ -264,6 +290,7 @@ void CefBrowserPlatformDelegateAlloy::NotifyMoveOrResizeStarted() {
}
#endif
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
bool CefBrowserPlatformDelegateAlloy::PreHandleGestureEvent(
content::WebContents* source,
const blink::WebGestureEvent& event) {
@@ -280,6 +307,7 @@ bool CefBrowserPlatformDelegateAlloy::IsNeverComposited(
}
return false;
}
#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
void CefBrowserPlatformDelegateAlloy::SetAutoResizeEnabled(
bool enabled,
@@ -312,19 +340,6 @@ void CefBrowserPlatformDelegateAlloy::ConfigureAutoResize() {
}
}
bool CefBrowserPlatformDelegateAlloy::IsPrintPreviewSupported() const {
REQUIRE_ALLOY_RUNTIME();
// Print preview is not currently supported with OSR.
if (IsWindowless()) {
return false;
}
auto cef_browser_context =
CefBrowserContext::FromBrowserContext(web_contents_->GetBrowserContext());
return cef_browser_context->IsPrintPreviewSupported();
}
void CefBrowserPlatformDelegateAlloy::Find(const CefString& searchText,
bool forward,
bool matchCase,
@@ -389,6 +404,7 @@ void CefBrowserPlatformDelegateAlloy::SetOwnedWebContents(
owned_web_contents_.reset(owned_contents);
}
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
void CefBrowserPlatformDelegateAlloy::DestroyExtensionHost() {
if (!extension_host_) {
return;
@@ -414,3 +430,51 @@ void CefBrowserPlatformDelegateAlloy::OnExtensionHostDeleted() {
DCHECK(extension_host_);
extension_host_ = nullptr;
}
#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
void CefBrowserPlatformDelegateAlloy::AttachHelpers(
content::WebContents* web_contents) {
// If already attached, nothing to be done.
base::SupportsUserData::Data* attached_tag =
web_contents->GetUserData(&kAttachedHelpersUserDataKey);
if (attached_tag) {
return;
}
// Mark as attached.
web_contents->SetUserData(&kAttachedHelpersUserDataKey,
std::make_unique<base::SupportsUserData::Data>());
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
// Create all the helpers.
if (cef::IsAlloyRuntimeEnabled()) {
find_in_page::FindTabHelper::CreateForWebContents(web_contents);
permissions::PermissionRequestManager::CreateForWebContents(web_contents);
PrefsTabHelper::CreateForWebContents(web_contents);
printing::InitializePrintingForWebContents(web_contents);
zoom::ZoomController::CreateForWebContents(web_contents);
javascript_dialogs::TabModalDialogManager::CreateForWebContents(
web_contents, CreateAlloyJavaScriptTabModalDialogManagerDelegateDesktop(
web_contents));
} else
#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
{
if (IsWindowless()) {
// Logic from ChromeContentBrowserClientCef::GetWebContentsViewDelegate
// which is not called for windowless browsers. Needs to be done before
// calling AttachTabHelpers.
if (auto* registry =
performance_manager::PerformanceManagerRegistry::GetInstance()) {
registry->MaybeCreatePageNodeForWebContents(web_contents);
}
}
// Adopt the WebContents now, so all observers are in place, as the network
// requests for its initial navigation will start immediately
TabHelpers::AttachTabHelpers(web_contents);
// Make the tab show up in the task manager.
task_manager::WebContentsTags::CreateForTabContents(web_contents);
}
}

View File

@@ -6,10 +6,10 @@
#ifndef CEF_LIBCEF_BROWSER_ALLOY_BROWSER_PLATFORM_DELEGATE_ALLOY_H_
#define CEF_LIBCEF_BROWSER_ALLOY_BROWSER_PLATFORM_DELEGATE_ALLOY_H_
#include "libcef/browser/alloy/dialogs/alloy_web_contents_dialog_helper.h"
#include "libcef/browser/browser_platform_delegate.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "cef/libcef/browser/alloy/dialogs/alloy_web_contents_dialog_helper.h"
#include "cef/libcef/browser/browser_platform_delegate.h"
#include "components/find_in_page/find_notification_details.h"
#include "content/public/browser/web_contents.h"
#include "ui/gfx/geometry/size.h"
@@ -33,14 +33,18 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
const blink::mojom::WindowFeatures& window_features,
bool user_gesture,
bool* was_blocked) override;
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
bool ShouldAllowRendererInitiatedCrossProcessNavigation(
bool is_main_frame_navigation) override;
#endif
void RenderViewReady() override;
void BrowserCreated(CefBrowserHostBase* browser) override;
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
void CreateExtensionHost(const extensions::Extension* extension,
const GURL& url,
extensions::mojom::ViewType host_type) override;
extensions::ExtensionHost* GetExtensionHost() const override;
#endif
void BrowserDestroyed(CefBrowserHostBase* browser) override;
web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost()
const override;
@@ -48,13 +52,15 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC))
void NotifyMoveOrResizeStarted() override;
#endif
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
bool PreHandleGestureEvent(content::WebContents* source,
const blink::WebGestureEvent& event) override;
bool IsNeverComposited(content::WebContents* web_contents) override;
#endif
bool IsAlloyStyle() const override { return true; }
void SetAutoResizeEnabled(bool enabled,
const CefSize& min_size,
const CefSize& max_size) override;
bool IsPrintPreviewSupported() const override;
void Find(const CefString& searchText,
bool forward,
bool matchCase,
@@ -83,11 +89,17 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
private:
void SetOwnedWebContents(content::WebContents* owned_contents);
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
void DestroyExtensionHost();
void OnExtensionHostDeleted();
#endif
void ConfigureAutoResize();
// Attach all the associated helpers that are needed for the WebContents. It
// is safe to call this on a WebContents that was already attached.
void AttachHelpers(content::WebContents* web_contents);
// Non-nullptr if this object owns the WebContents. Will be nullptr for popup
// browsers between the calls to WebContentsCreated() and AddNewContents(),
// and may never be set if the parent browser is destroyed during popup
@@ -101,9 +113,11 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
// matches, the find selection rectangle, etc.
find_in_page::FindNotificationDetails last_search_result_;
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
// Used when the browser is hosting an extension.
extensions::ExtensionHost* extension_host_ = nullptr;
raw_ptr<extensions::ExtensionHost> extension_host_ = nullptr;
bool is_background_host_ = false;
#endif
// Used with auto-resize.
bool auto_resize_enabled_ = false;

View File

@@ -3,23 +3,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/alloy/chrome_browser_process_alloy.h"
#include "cef/libcef/browser/alloy/chrome_browser_process_alloy.h"
#include <memory>
#include "libcef/browser/alloy/chrome_profile_manager_alloy.h"
#include "libcef/browser/browser_context.h"
#include "libcef/browser/context.h"
#include "libcef/browser/extensions/extensions_browser_client.h"
#include "libcef/browser/prefs/browser_prefs.h"
#include "libcef/browser/thread_util.h"
#include "libcef/common/cef_switches.h"
#include "libcef/common/extensions/extensions_client.h"
#include "libcef/common/extensions/extensions_util.h"
#include "base/command_line.h"
#include "base/path_service.h"
#include "chrome/browser/browser_features.h"
#include "cef/libcef/browser/alloy/chrome_profile_manager_alloy.h"
#include "cef/libcef/browser/browser_context.h"
#include "cef/libcef/browser/context.h"
#include "cef/libcef/browser/extensions/extensions_browser_client.h"
#include "cef/libcef/browser/prefs/browser_prefs.h"
#include "cef/libcef/browser/thread_util.h"
#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/component_updater/chrome_component_updater_configurator.h"
#include "chrome/browser/net/system_network_context_manager.h"
#include "chrome/browser/permissions/chrome_permissions_client.h"
@@ -93,16 +91,12 @@ void ChromeBrowserProcessAlloy::OnContextInitialized() {
providers;
#if BUILDFLAG(IS_WIN)
// 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())));
}
// 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_ =
@@ -155,6 +149,7 @@ void ChromeBrowserProcessAlloy::CleanupOnUIThread() {
}
}
os_crypt_async_.reset();
local_state_.reset();
browser_policy_connector_.reset();
background_printing_manager_.reset();
@@ -370,6 +365,12 @@ ChromeBrowserProcessAlloy::subresource_filter_ruleset_service() {
return nullptr;
}
subresource_filter::RulesetService*
ChromeBrowserProcessAlloy::fingerprinting_protection_ruleset_service() {
DCHECK(false);
return nullptr;
}
StartupData* ChromeBrowserProcessAlloy::startup_data() {
DCHECK(false);
return nullptr;
@@ -439,6 +440,12 @@ os_crypt_async::OSCryptAsync* ChromeBrowserProcessAlloy::os_crypt_async() {
return os_crypt_async_.get();
}
void ChromeBrowserProcessAlloy::set_additional_os_crypt_async_provider_for_test(
size_t precedence,
std::unique_ptr<os_crypt_async::KeyProvider> provider) {
DCHECK(false);
}
BuildState* ChromeBrowserProcessAlloy::GetBuildState() {
DCHECK(false);
return nullptr;

View File

@@ -92,6 +92,8 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
safe_browsing::SafeBrowsingService* safe_browsing_service() override;
subresource_filter::RulesetService* subresource_filter_ruleset_service()
override;
subresource_filter::RulesetService*
fingerprinting_protection_ruleset_service() override;
StartupData* startup_data() override;
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
@@ -107,6 +109,9 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
resource_coordinator::ResourceCoordinatorParts* resource_coordinator_parts()
override;
os_crypt_async::OSCryptAsync* os_crypt_async() override;
void set_additional_os_crypt_async_provider_for_test(
size_t precedence,
std::unique_ptr<os_crypt_async::KeyProvider> provider) override;
BuildState* GetBuildState() override;
SerialPolicyAllowedPorts* serial_policy_allowed_ports() override;
HidSystemTrayIcon* hid_system_tray_icon() override;

View File

@@ -3,8 +3,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/alloy/chrome_profile_alloy.h"
#include "cef/libcef/browser/alloy/chrome_profile_alloy.h"
#include "base/memory/raw_ptr.h"
#include "base/no_destructor.h"
#include "components/profile_metrics/browser_profile_type.h"
#include "components/variations/variations_client.h"
@@ -31,35 +32,22 @@ class CefVariationsClient : public variations::VariationsClient {
}
private:
content::BrowserContext* browser_context_;
raw_ptr<content::BrowserContext> browser_context_;
};
} // namespace
ChromeProfileAlloy::ChromeProfileAlloy() {
ChromeProfileAlloy::ChromeProfileAlloy() : Profile(nullptr) {
// Alloy contexts are never flagged as off-the-record. It causes problems
// for the extension system.
DCHECK(!IsOffTheRecord());
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);

View File

@@ -25,9 +25,6 @@ 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;

View File

@@ -3,11 +3,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/alloy/chrome_profile_manager_alloy.h"
#include "cef/libcef/browser/alloy/chrome_profile_manager_alloy.h"
#include "libcef/browser/browser_context.h"
#include "libcef/browser/request_context_impl.h"
#include "libcef/common/app_manager.h"
#include "cef/libcef/browser/browser_context.h"
#include "cef/libcef/browser/request_context_impl.h"
#include "cef/libcef/common/app_manager.h"
namespace {

View File

@@ -0,0 +1,46 @@
// Copyright 2024 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "cef/libcef/browser/alloy/devtools/alloy_devtools_window_runner.h"
#include "cef/libcef/browser/alloy/devtools/devtools_frontend.h"
#include "cef/libcef/browser/thread_util.h"
void AlloyDevToolsWindowRunner::ShowDevTools(
CefBrowserHostBase* opener,
std::unique_ptr<CefShowDevToolsParams> params) {
CEF_REQUIRE_UIT();
if (devtools_frontend_) {
if (!params->inspect_element_at_.IsEmpty()) {
devtools_frontend_->InspectElementAt(params->inspect_element_at_.x,
params->inspect_element_at_.y);
}
devtools_frontend_->Focus();
return;
}
auto alloy_browser = AlloyBrowserHostImpl::FromBaseChecked(opener);
devtools_frontend_ = CefDevToolsFrontend::Show(
alloy_browser.get(), params->window_info_, params->client_,
params->settings_, params->inspect_element_at_,
base::BindOnce(&AlloyDevToolsWindowRunner::OnFrontEndDestroyed,
weak_ptr_factory_.GetWeakPtr()));
}
void AlloyDevToolsWindowRunner::CloseDevTools() {
CEF_REQUIRE_UIT();
if (devtools_frontend_) {
devtools_frontend_->Close();
}
}
bool AlloyDevToolsWindowRunner::HasDevTools() {
CEF_REQUIRE_UIT();
return !!devtools_frontend_;
}
void AlloyDevToolsWindowRunner::OnFrontEndDestroyed() {
CEF_REQUIRE_UIT();
devtools_frontend_ = nullptr;
}

View File

@@ -0,0 +1,40 @@
// Copyright 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.
#ifndef CEF_LIBCEF_BROWSER_ALLOY_DEVTOOLS_ALLOY_DEVTOOLS_WINDOW_RUNNER_H_
#define CEF_LIBCEF_BROWSER_ALLOY_DEVTOOLS_ALLOY_DEVTOOLS_WINDOW_RUNNER_H_
#pragma once
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "cef/libcef/browser/devtools/devtools_window_runner.h"
class CefDevToolsFrontend;
// Creates and runs a DevTools window instance. Only accessed on the UI thread.
class AlloyDevToolsWindowRunner : public CefDevToolsWindowRunner {
public:
AlloyDevToolsWindowRunner() = default;
AlloyDevToolsWindowRunner(const AlloyDevToolsWindowRunner&) = delete;
AlloyDevToolsWindowRunner& operator=(const AlloyDevToolsWindowRunner&) =
delete;
// CefDevToolsWindowRunner methods:
void ShowDevTools(CefBrowserHostBase* opener,
std::unique_ptr<CefShowDevToolsParams> params) override;
void CloseDevTools() override;
bool HasDevTools() override;
private:
void OnFrontEndDestroyed();
// CefDevToolsFrontend will delete itself when the frontend WebContents is
// destroyed.
raw_ptr<CefDevToolsFrontend> devtools_frontend_ = nullptr;
base::WeakPtrFactory<AlloyDevToolsWindowRunner> weak_ptr_factory_{this};
};
#endif // CEF_LIBCEF_BROWSER_ALLOY_DEVTOOLS_ALLOY_DEVTOOLS_WINDOW_RUNNER_H_

View File

@@ -2,9 +2,7 @@
// 2013 The Chromium Authors. All rights reserved. Use of this source code is
// governed by a BSD-style license that can be found in the LICENSE file.
#include "libcef/browser/devtools/devtools_file_manager.h"
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
#include "cef/libcef/browser/alloy/devtools/devtools_file_manager.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
@@ -19,6 +17,7 @@
#include "base/task/sequenced_task_runner.h"
#include "base/task/thread_pool.h"
#include "base/values.h"
#include "cef/libcef/browser/alloy/alloy_browser_host_impl.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "content/public/browser/web_contents.h"
@@ -35,7 +34,7 @@ void WriteToFile(const base::FilePath& path, const std::string& content) {
void AppendToFile(const base::FilePath& path, const std::string& content) {
DCHECK(!path.empty());
base::AppendToFile(path, base::StringPiece(content));
base::AppendToFile(path, std::string_view(content));
}
} // namespace

View File

@@ -2,15 +2,16 @@
// 2013 The Chromium Authors. All rights reserved. Use of this source code is
// governed by a BSD-style license that can be found in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_FILE_MANAGER_H_
#define CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_FILE_MANAGER_H_
#include "base/functional/callback_forward.h"
#include "base/memory/weak_ptr.h"
#ifndef CEF_LIBCEF_BROWSER_ALLOY_DEVTOOLS_DEVTOOLS_FILE_MANAGER_H_
#define CEF_LIBCEF_BROWSER_ALLOY_DEVTOOLS_DEVTOOLS_FILE_MANAGER_H_
#include <map>
#include <string>
#include "base/functional/callback_forward.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
namespace base {
class FilePath;
class SequencedTaskRunner;
@@ -70,8 +71,8 @@ class CefDevToolsFileManager {
const base::Value* arg3);
// Guaranteed to outlive this object.
AlloyBrowserHostImpl* browser_impl_;
PrefService* prefs_;
raw_ptr<AlloyBrowserHostImpl> browser_impl_;
raw_ptr<PrefService> prefs_;
using PathsMap = std::map<std::string, base::FilePath>;
PathsMap saved_files_;
@@ -79,4 +80,4 @@ class CefDevToolsFileManager {
base::WeakPtrFactory<CefDevToolsFileManager> weak_factory_;
};
#endif // CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_FILE_MANAGER_H_
#endif // CEF_LIBCEF_BROWSER_ALLOY_DEVTOOLS_DEVTOOLS_FILE_MANAGER_H_

View File

@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/devtools/devtools_frontend.h"
#include "cef/libcef/browser/alloy/devtools/devtools_frontend.h"
#include <stddef.h>
@@ -10,13 +10,6 @@
#include <memory>
#include <utility>
#include "libcef/browser/browser_context.h"
#include "libcef/browser/devtools/devtools_manager_delegate.h"
#include "libcef/browser/net/devtools_scheme_handler.h"
#include "libcef/browser/thread_util.h"
#include "libcef/common/cef_switches.h"
#include "libcef/common/task_runner_manager.h"
#include "base/base64.h"
#include "base/command_line.h"
#include "base/files/file_util.h"
@@ -24,12 +17,20 @@
#include "base/json/json_writer.h"
#include "base/json/string_escape.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/uuid.h"
#include "base/values.h"
#include "cef/libcef/browser/alloy/devtools/devtools_manager_delegate.h"
#include "cef/libcef/browser/browser_context.h"
#include "cef/libcef/browser/net/devtools_scheme_handler.h"
#include "cef/libcef/browser/thread_util.h"
#include "cef/libcef/common/cef_switches.h"
#include "cef/libcef/common/task_runner_manager.h"
#include "cef/libcef/features/runtime_checks.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/scoped_user_pref_update.h"
@@ -165,7 +166,7 @@ void LogProtocolMessage(const base::FilePath& log_file,
WriteTimestamp(stream);
stream << ": " << type_label << ": " << to_log << "\n";
const std::string& str = stream.str();
if (!base::AppendToFile(log_file, base::StringPiece(str))) {
if (!base::AppendToFile(log_file, std::string_view(str))) {
LOG(ERROR) << "Failed to write file " << log_file.value();
log_error = true;
}
@@ -199,7 +200,7 @@ class CefDevToolsFrontend::NetworkResourceLoader
response_headers_ = response_head.headers;
}
void OnDataReceived(base::StringPiece chunk,
void OnDataReceived(std::string_view chunk,
base::OnceClosure resume) override {
base::Value chunkValue;
@@ -229,7 +230,7 @@ class CefDevToolsFrontend::NetworkResourceLoader
void OnRetry(base::OnceClosure start_retry) override { DCHECK(false); }
const int stream_id_;
CefDevToolsFrontend* const bindings_;
const raw_ptr<CefDevToolsFrontend> bindings_;
std::unique_ptr<network::SimpleURLLoader> loader_;
int request_id_;
scoped_refptr<net::HttpResponseHeaders> response_headers_;
@@ -243,6 +244,8 @@ CefDevToolsFrontend* CefDevToolsFrontend::Show(
const CefBrowserSettings& settings,
const CefPoint& inspect_element_at,
base::OnceClosure frontend_destroyed_callback) {
REQUIRE_ALLOY_RUNTIME();
CefBrowserSettings new_settings = settings;
if (!windowInfo.windowless_rendering_enabled &&
CefColorGetA(new_settings.background_color) != SK_AlphaOPAQUE) {
@@ -252,11 +255,14 @@ CefDevToolsFrontend* CefDevToolsFrontend::Show(
}
CefBrowserCreateParams create_params;
create_params.MaybeSetWindowInfo(windowInfo, /*allow_alloy_style=*/true,
/*allow_chrome_style=*/false);
if (inspected_browser->is_views_hosted()) {
create_params.popup_with_views_hosted_opener = true;
} else {
create_params.window_info = std::make_unique<CefWindowInfo>(windowInfo);
}
create_params.popup_with_alloy_style_opener = true;
create_params.client = client;
create_params.settings = new_settings;
create_params.devtools_opener = inspected_browser;
@@ -271,8 +277,7 @@ CefDevToolsFrontend* CefDevToolsFrontend::Show(
// CefDevToolsFrontend will delete itself when the frontend WebContents is
// destroyed.
CefDevToolsFrontend* devtools_frontend = new CefDevToolsFrontend(
static_cast<AlloyBrowserHostImpl*>(frontend_browser.get()),
inspected_contents, inspect_element_at,
frontend_browser.get(), inspected_contents, inspect_element_at,
std::move(frontend_destroyed_callback));
// Need to load the URL after creating the DevTools objects.
@@ -490,6 +495,9 @@ 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());
@@ -572,8 +580,8 @@ void CefDevToolsFrontend::DispatchProtocolMessage(
return;
}
base::StringPiece str_message(reinterpret_cast<const char*>(message.data()),
message.size());
std::string_view str_message(reinterpret_cast<const char*>(message.data()),
message.size());
if (ProtocolLoggingEnabled()) {
// Quick check to avoid parsing the JSON object. Events begin with a
// "method" value whereas method results begin with an "id" value.
@@ -590,7 +598,7 @@ void CefDevToolsFrontend::DispatchProtocolMessage(
size_t total_size = str_message.length();
for (size_t pos = 0; pos < str_message.length();
pos += kMaxMessageChunkSize) {
base::StringPiece str_message_chunk =
std::string_view str_message_chunk =
str_message.substr(pos, kMaxMessageChunkSize);
CallClientFunction(
@@ -638,7 +646,7 @@ bool CefDevToolsFrontend::ProtocolLoggingEnabled() const {
}
void CefDevToolsFrontend::LogProtocolMessage(ProtocolMessageType type,
const base::StringPiece& message) {
const std::string_view& message) {
DCHECK(ProtocolLoggingEnabled());
std::string to_log(message.substr(0, kMaxLogLineLength));

View File

@@ -2,18 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_FRONTEND_H_
#define CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_FRONTEND_H_
#ifndef CEF_LIBCEF_BROWSER_ALLOY_DEVTOOLS_DEVTOOLS_FRONTEND_H_
#define CEF_LIBCEF_BROWSER_ALLOY_DEVTOOLS_DEVTOOLS_FRONTEND_H_
#include <memory>
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
#include "libcef/browser/devtools/devtools_file_manager.h"
#include "base/files/file_path.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/values.h"
#include "cef/libcef/browser/alloy/alloy_browser_host_impl.h"
#include "cef/libcef/browser/alloy/devtools/devtools_file_manager.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/devtools_frontend_host.h"
#include "content/public/browser/web_contents_observer.h"
@@ -87,12 +87,12 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
bool ProtocolLoggingEnabled() const;
void LogProtocolMessage(ProtocolMessageType type,
const base::StringPiece& message);
const std::string_view& message);
PrefService* GetPrefs() const;
CefRefPtr<AlloyBrowserHostImpl> frontend_browser_;
content::WebContents* inspected_contents_;
raw_ptr<content::WebContents> inspected_contents_;
scoped_refptr<content::DevToolsAgentHost> agent_host_;
CefPoint inspect_element_at_;
base::OnceClosure frontend_destroyed_callback_;
@@ -111,4 +111,4 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
base::WeakPtrFactory<CefDevToolsFrontend> weak_factory_;
};
#endif // CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_FRONTEND_H_
#endif // CEF_LIBCEF_BROWSER_ALLOY_DEVTOOLS_DEVTOOLS_FRONTEND_H_

View File

@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/devtools/devtools_manager_delegate.h"
#include "cef/libcef/browser/alloy/devtools/devtools_manager_delegate.h"
#include <stdint.h>

View File

@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_DELEGATE_H_
#define CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_DELEGATE_H_
#ifndef CEF_LIBCEF_BROWSER_ALLOY_DEVTOOLS_DEVTOOLS_MANAGER_DELEGATE_H_
#define CEF_LIBCEF_BROWSER_ALLOY_DEVTOOLS_DEVTOOLS_MANAGER_DELEGATE_H_
#include "content/public/browser/devtools_manager_delegate.h"
@@ -32,4 +32,4 @@ class CefDevToolsManagerDelegate : public content::DevToolsManagerDelegate {
bool HasBundledFrontendResources() override;
};
#endif // CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_DELEGATE_H_
#endif // CEF_LIBCEF_BROWSER_ALLOY_DEVTOOLS_DEVTOOLS_MANAGER_DELEGATE_H_

View File

@@ -3,11 +3,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/alloy/dialogs/alloy_constrained_window_views_client.h"
#include "libcef/browser/browser_host_base.h"
#include "cef/libcef/browser/alloy/dialogs/alloy_constrained_window_views_client.h"
#include "base/notreached.h"
#include "cef/libcef/browser/browser_host_base.h"
#include "components/web_modal/web_contents_modal_dialog_host.h"
namespace {
@@ -15,7 +14,10 @@ namespace {
class AlloyConstrainedWindowViewsClient
: public constrained_window::ConstrainedWindowViewsClient {
public:
AlloyConstrainedWindowViewsClient() = default;
explicit AlloyConstrainedWindowViewsClient(
std::unique_ptr<constrained_window::ConstrainedWindowViewsClient>
chrome_client)
: chrome_client_(std::move(chrome_client)) {}
AlloyConstrainedWindowViewsClient(const AlloyConstrainedWindowViewsClient&) =
delete;
@@ -26,6 +28,12 @@ class AlloyConstrainedWindowViewsClient
// ConstrainedWindowViewsClient methods:
web_modal::ModalDialogHost* GetModalDialogHost(
gfx::NativeWindow parent) override {
if (chrome_client_) {
if (auto dialog_host = chrome_client_->GetModalDialogHost(parent)) {
return dialog_host;
}
}
if (auto browser = GetPreferredBrowser(parent)) {
return browser->platform_delegate()->GetWebContentsModalDialogHost();
}
@@ -34,6 +42,12 @@ class AlloyConstrainedWindowViewsClient
}
gfx::NativeView GetDialogHostView(gfx::NativeWindow parent) override {
if (chrome_client_) {
if (auto host_view = chrome_client_->GetDialogHostView(parent)) {
return host_view;
}
}
if (auto dialog_host = GetModalDialogHost(parent)) {
return dialog_host->GetHostView();
}
@@ -66,11 +80,17 @@ class AlloyConstrainedWindowViewsClient
return browser;
}
std::unique_ptr<constrained_window::ConstrainedWindowViewsClient>
chrome_client_;
};
} // namespace
std::unique_ptr<constrained_window::ConstrainedWindowViewsClient>
CreateAlloyConstrainedWindowViewsClient() {
return std::make_unique<AlloyConstrainedWindowViewsClient>();
CreateAlloyConstrainedWindowViewsClient(
std::unique_ptr<constrained_window::ConstrainedWindowViewsClient>
chrome_client) {
return std::make_unique<AlloyConstrainedWindowViewsClient>(
std::move(chrome_client));
}

View File

@@ -12,6 +12,8 @@
// Creates a ConstrainedWindowViewsClient for the Chrome environment.
std::unique_ptr<constrained_window::ConstrainedWindowViewsClient>
CreateAlloyConstrainedWindowViewsClient();
CreateAlloyConstrainedWindowViewsClient(
std::unique_ptr<constrained_window::ConstrainedWindowViewsClient>
chrome_client);
#endif // CEF_LIBCEF_BROWSER_ALLOY_DIALOGS_ALLOY_CONSTRAINED_WINDOW_VIEWS_CLIENT_H_
#endif // CEF_LIBCEF_BROWSER_ALLOY_DIALOGS_ALLOY_CONSTRAINED_WINDOW_VIEWS_CLIENT_H_

View File

@@ -3,11 +3,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/alloy/dialogs/alloy_javascript_dialog_manager_delegate.h"
#include "libcef/browser/browser_host_base.h"
#include "cef/libcef/browser/alloy/dialogs/alloy_javascript_dialog_manager_delegate.h"
#include "base/logging.h"
#include "cef/libcef/browser/browser_host_base.h"
namespace {

View File

@@ -15,4 +15,4 @@ std::unique_ptr<JavaScriptTabModalDialogManagerDelegateDesktop>
CreateAlloyJavaScriptTabModalDialogManagerDelegateDesktop(
content::WebContents* web_contents);
#endif // CEF_LIBCEF_BROWSER_ALLOY_DIALOGS_ALLOY_JAVASCRIPT_DIALOG_MANAGER_DELEGATE_H_
#endif // CEF_LIBCEF_BROWSER_ALLOY_DIALOGS_ALLOY_JAVASCRIPT_DIALOG_MANAGER_DELEGATE_H_

View File

@@ -2,11 +2,10 @@
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "libcef/browser/alloy/dialogs/alloy_web_contents_dialog_helper.h"
#include "libcef/browser/browser_platform_delegate.h"
#include "cef/libcef/browser/alloy/dialogs/alloy_web_contents_dialog_helper.h"
#include "base/notreached.h"
#include "cef/libcef/browser/browser_platform_delegate.h"
#include "chrome/browser/platform_util.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "ui/views/widget/widget.h"
@@ -44,14 +43,20 @@ AlloyWebContentsDialogHelper::GetWebContentsModalDialogHost() {
gfx::NativeView AlloyWebContentsDialogHelper::GetHostView() const {
// Windowless rendering uses GetAcceleratedWidget() instead.
if (browser_delegate_->IsWindowless()) {
return gfx::NativeView();
if (!browser_delegate_->IsWindowless()) {
#if BUILDFLAG(IS_MAC)
// This is supported with all configurations except MacOS with external
// parent because we can't provide a gfx::NativeView or a
// gfx::AcceleratedWidget on that platform (it's an arbitrary internal
// Chromium type). This code should not be reached in that case because
// print preview is disabled.
DCHECK(!browser_delegate_->HasExternalParent());
#endif
if (auto widget = browser_delegate_->GetWindowWidget()) {
return widget->GetNativeView();
}
}
if (auto widget = browser_delegate_->GetWindowWidget()) {
return widget->GetNativeView();
}
DCHECK(false);
NOTIMPLEMENTED();
return gfx::NativeView();
}
@@ -59,15 +64,13 @@ gfx::AcceleratedWidget AlloyWebContentsDialogHelper::GetAcceleratedWidget()
const {
#if defined(USE_AURA)
// Windowed rendering uses GetHostView() instead.
if (!browser_delegate_->IsWindowless()) {
return gfx::kNullAcceleratedWidget;
}
if (auto parent_widget = browser_delegate_->GetHostWindowHandle()) {
return parent_widget;
if (browser_delegate_->IsWindowless()) {
if (auto parent_widget = browser_delegate_->GetHostWindowHandle()) {
return parent_widget;
}
}
#endif // defined(USE_AURA)
DCHECK(false);
NOTIMPLEMENTED();
return gfx::kNullAcceleratedWidget;
}

View File

@@ -7,6 +7,7 @@
#pragma once
#include "base/functional/callback_forward.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "components/web_modal/modal_dialog_host.h"
@@ -40,7 +41,7 @@ class AlloyWebContentsDialogHelper
private:
void OnBoundsChanged();
CefBrowserPlatformDelegate* const browser_delegate_;
const raw_ptr<CefBrowserPlatformDelegate> browser_delegate_;
// Used to notify WebContentsModalDialog.
base::ObserverList<web_modal::ModalDialogHostObserver>::Unchecked

View File

@@ -3,11 +3,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/audio_capturer.h"
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
#include "libcef/browser/audio_loopback_stream_creator.h"
#include "cef/libcef/browser/audio_capturer.h"
#include "cef/libcef/browser/alloy/alloy_browser_host_impl.h"
#include "cef/libcef/browser/audio_loopback_stream_creator.h"
#include "components/mirroring/service/captured_audio_input.h"
#include "media/audio/audio_input_device.h"

View File

@@ -7,9 +7,8 @@
#define CEF_LIBCEF_BROWSER_AUDIO_CAPTURER_H_
#pragma once
#include "include/internal/cef_ptr.h"
#include "include/internal/cef_types_wrappers.h"
#include "cef/include/internal/cef_ptr.h"
#include "cef/include/internal/cef_types_wrappers.h"
#include "media/base/audio_capturer_source.h"
namespace media {

View File

@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/audio_loopback_stream_creator.h"
#include "cef/libcef/browser/audio_loopback_stream_creator.h"
#include <memory>
#include <utility>

View File

@@ -2,16 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/browser_contents_delegate.h"
#include "libcef/browser/browser_host_base.h"
#include "libcef/browser/browser_platform_delegate.h"
#include "libcef/browser/browser_util.h"
#include "libcef/browser/native/cursor_util.h"
#include "libcef/common/frame_util.h"
#include "cef/libcef/browser/browser_contents_delegate.h"
#include "base/memory/raw_ptr.h"
#include "cef/libcef/browser/browser_host_base.h"
#include "cef/libcef/browser/browser_platform_delegate.h"
#include "cef/libcef/browser/browser_util.h"
#include "cef/libcef/browser/native/cursor_util.h"
#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"
@@ -21,10 +22,10 @@
#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"
#include "third_party/blink/public/mojom/page/draggable_region.mojom.h"
#include "third_party/blink/public/mojom/widget/platform_widget.mojom-test-utils.h"
#if defined(OS_WIN)
@@ -73,8 +74,8 @@ class CefWidgetHostInterceptor
private:
CefRefPtr<CefBrowser> const browser_;
content::RenderWidgetHost* const render_widget_host_;
blink::mojom::WidgetHost* const impl_;
const raw_ptr<content::RenderWidgetHost> render_widget_host_;
const raw_ptr<blink::mojom::WidgetHost> impl_;
};
} // namespace
@@ -93,8 +94,7 @@ void CefBrowserContentsDelegate::ObserveWebContents(
// Make sure MaybeCreateFrame is called at least one time.
// Create the frame representation before OnAfterCreated is called for a new
// browser.
browser_info_->MaybeCreateFrame(new_contents->GetPrimaryMainFrame(),
false /* is_guest_view */);
browser_info_->MaybeCreateFrame(new_contents->GetPrimaryMainFrame());
// Make sure RenderWidgetCreated is called at least one time. This Observer
// is registered too late to catch the initial creation.
@@ -112,9 +112,11 @@ void CefBrowserContentsDelegate::RemoveObserver(Observer* observer) {
// |source| may be NULL for navigations in the current tab, or if the
// navigation originates from a guest view via MaybeAllowNavigation.
content::WebContents* CefBrowserContentsDelegate::OpenURLFromTab(
content::WebContents* CefBrowserContentsDelegate::OpenURLFromTabEx(
content::WebContents* source,
const content::OpenURLParams& params) {
const content::OpenURLParams& params,
base::OnceCallback<void(content::NavigationHandle&)>&
navigation_handle_callback) {
bool cancel = false;
if (auto c = client()) {
@@ -133,8 +135,13 @@ content::WebContents* CefBrowserContentsDelegate::OpenURLFromTab(
}
}
if (!cancel) {
// TODO: Do something with |navigation_handle_callback|.
return web_contents();
}
// Returning nullptr will cancel the navigation.
return cancel ? nullptr : web_contents();
return nullptr;
}
void CefBrowserContentsDelegate::LoadingStateChanged(
@@ -228,11 +235,9 @@ void CefBrowserContentsDelegate::CanDownload(
base::OnceCallback<void(bool)> callback) {
bool allow = true;
if (auto delegate = platform_delegate()) {
if (auto c = client()) {
if (auto handler = c->GetDownloadHandler()) {
allow = handler->CanDownload(browser(), url.spec(), request_method);
}
if (auto c = client()) {
if (auto handler = c->GetDownloadHandler()) {
allow = handler->CanDownload(browser(), url.spec(), request_method);
}
}
@@ -242,7 +247,7 @@ void CefBrowserContentsDelegate::CanDownload(
KeyboardEventProcessingResult
CefBrowserContentsDelegate::PreHandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) {
const input::NativeWebKeyboardEvent& event) {
if (auto delegate = platform_delegate()) {
if (auto c = client()) {
if (auto handler = c->GetKeyboardHandler()) {
@@ -269,7 +274,7 @@ CefBrowserContentsDelegate::PreHandleKeyboardEvent(
bool CefBrowserContentsDelegate::HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) {
const input::NativeWebKeyboardEvent& event) {
// Check to see if event should be ignored.
if (event.skip_if_unhandled) {
return false;
@@ -294,9 +299,26 @@ bool CefBrowserContentsDelegate::HandleKeyboardEvent(
return false;
}
void CefBrowserContentsDelegate::DraggableRegionsChanged(
const std::vector<blink::mojom::DraggableRegionPtr>& regions,
content::WebContents* contents) {
// Already converted to window bounds in WebViewImpl::DraggableRegionsChanged.
std::vector<cef::mojom::DraggableRegionEntryPtr> cef_regions;
if (!regions.empty()) {
cef_regions.reserve(regions.size());
for (const auto& region : regions) {
auto cef_region = cef::mojom::DraggableRegionEntry::New(
region->bounds, region->draggable);
cef_regions.emplace_back(std::move(cef_region));
}
}
browser_info_->GetMainFrame()->UpdateDraggableRegions(std::move(cef_regions));
}
void CefBrowserContentsDelegate::RenderFrameCreated(
content::RenderFrameHost* render_frame_host) {
browser_info_->MaybeCreateFrame(render_frame_host, false /* is_guest_view */);
browser_info_->MaybeCreateFrame(render_frame_host);
if (render_frame_host->GetParent() == nullptr) {
auto render_view_host = render_frame_host->GetRenderViewHost();
auto base_background_color = platform_delegate()->GetBackgroundColor();
@@ -319,7 +341,7 @@ void CefBrowserContentsDelegate::RenderFrameCreated(
void CefBrowserContentsDelegate::RenderFrameHostChanged(
content::RenderFrameHost* old_host,
content::RenderFrameHost* new_host) {
// Just in case RenderFrameCreated wasn't called for some reason.
// Update tracking for the RFH.
RenderFrameCreated(new_host);
}
@@ -472,6 +494,11 @@ void CefBrowserContentsDelegate::DidFinishNavigation(
return;
}
if (browser_info_->IsClosing()) {
// Ignore notifications when the browser is closing.
return;
}
if (navigation_handle->IsInPrimaryMainFrame() &&
navigation_handle->HasCommitted()) {
// A primary main frame navigation has occured.
@@ -484,21 +511,15 @@ void CefBrowserContentsDelegate::DidFinishNavigation(
const GURL& url =
(error_code == net::OK ? navigation_handle->GetURL() : GURL());
auto browser_info = browser_info_;
if (!browser_info->browser()) {
// Ignore notifications when the browser is closing.
return;
}
// May return NULL when starting a new navigation if the previous navigation
// caused the renderer process to crash during load.
CefRefPtr<CefFrameHostImpl> frame =
browser_info->GetFrameForGlobalId(global_id);
browser_info_->GetFrameForGlobalId(global_id);
if (!frame) {
if (is_main_frame) {
frame = browser_info->GetMainFrame();
frame = browser_info_->GetMainFrame();
} else {
frame = browser_info->CreateTempSubFrame(frame_util::InvalidGlobalId());
frame = browser_info_->CreateTempSubFrame(frame_util::InvalidGlobalId());
}
}
frame->RefreshAttributes();
@@ -546,6 +567,10 @@ void CefBrowserContentsDelegate::DidFinishLoad(
content::RenderFrameHost* render_frame_host,
const GURL& validated_url) {
auto frame = browser_info_->GetFrameForHost(render_frame_host);
if (!frame) {
return;
}
frame->RefreshAttributes();
int http_status_code = 0;

View File

@@ -8,10 +8,9 @@
#include <memory>
#include "libcef/browser/frame_host_impl.h"
#include "base/callback_list.h"
#include "base/observer_list.h"
#include "cef/libcef/browser/frame_host_impl.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h"
@@ -80,10 +79,15 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
// WebContentsDelegate methods:
content::WebContents* OpenURLFromTab(
// Same as OpenURLFromTab but only taking |navigation_handle_callback|
// if the return value is non-nullptr.
content::WebContents* OpenURLFromTabEx(
content::WebContents* source,
const content::OpenURLParams& params) override;
const content::OpenURLParams& params,
base::OnceCallback<void(content::NavigationHandle&)>&
navigation_handle_callback);
// WebContentsDelegate methods:
void LoadingStateChanged(content::WebContents* source,
bool should_show_loading_ui) override;
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
@@ -101,10 +105,12 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
base::OnceCallback<void(bool)> callback) override;
content::KeyboardEventProcessingResult PreHandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) override;
bool HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) override;
const input::NativeWebKeyboardEvent& event) override;
bool HandleKeyboardEvent(content::WebContents* source,
const input::NativeWebKeyboardEvent& event) override;
void DraggableRegionsChanged(
const std::vector<blink::mojom::DraggableRegionPtr>& regions,
content::WebContents* contents) override;
// WebContentsObserver methods:
void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;

View File

@@ -2,26 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/browser_context.h"
#include "cef/libcef/browser/browser_context.h"
#include <map>
#include <memory>
#include <utility>
#include "libcef/browser/context.h"
#include "libcef/browser/media_router/media_router_manager.h"
#include "libcef/browser/request_context_impl.h"
#include "libcef/browser/thread_util.h"
#include "libcef/common/cef_switches.h"
#include "libcef/common/frame_util.h"
#include "libcef/features/runtime.h"
#include "base/files/file_util.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/no_destructor.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "cef/libcef/browser/context.h"
#include "cef/libcef/browser/media_router/media_router_manager.h"
#include "cef/libcef/browser/request_context_impl.h"
#include "cef/libcef/browser/thread_util.h"
#include "cef/libcef/common/cef_switches.h"
#include "cef/libcef/common/frame_util.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
@@ -134,7 +132,7 @@ class ImplManager {
return all_.end();
}
using PathMap = std::map<base::FilePath, CefBrowserContext*>;
using PathMap = std::map<base::FilePath, raw_ptr<CefBrowserContext>>;
PathMap map_;
Vector all_;
@@ -284,8 +282,7 @@ std::vector<CefBrowserContext*> CefBrowserContext::GetAll() {
void CefBrowserContext::OnRenderFrameCreated(
CefRequestContextImpl* request_context,
const content::GlobalRenderFrameHostId& global_id,
bool is_main_frame,
bool is_guest_view) {
bool is_main_frame) {
CEF_REQUIRE_UIT();
DCHECK(frame_util::IsValidGlobalId(global_id));
@@ -303,8 +300,7 @@ void CefBrowserContext::OnRenderFrameCreated(
void CefBrowserContext::OnRenderFrameDeleted(
CefRequestContextImpl* request_context,
const content::GlobalRenderFrameHostId& global_id,
bool is_main_frame,
bool is_guest_view) {
bool is_main_frame) {
CEF_REQUIRE_UIT();
DCHECK(frame_util::IsValidGlobalId(global_id));
@@ -369,6 +365,7 @@ void CefBrowserContext::ClearSchemeHandlerFactories() {
iothread_state_));
}
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
void CefBrowserContext::LoadExtension(
const CefString& root_directory,
CefRefPtr<CefDictionaryValue> manifest,
@@ -395,10 +392,7 @@ bool CefBrowserContext::UnloadExtension(const CefString& extension_id) {
NOTIMPLEMENTED();
return false;
}
bool CefBrowserContext::IsPrintPreviewSupported() const {
return true;
}
#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
network::mojom::NetworkContext* CefBrowserContext::GetNetworkContext() {
CEF_REQUIRE_UIT();
@@ -425,12 +419,12 @@ CefRefPtr<CefRequestContextImpl> CefBrowserContext::GetAnyRequestContext(
if (prefer_no_handler) {
for (const auto& request_context : request_context_set_) {
if (!request_context->GetHandler()) {
return request_context;
return request_context.get();
}
}
}
return *request_context_set_.begin();
return request_context_set_.begin()->get();
}
CefBrowserContext::CookieableSchemes CefBrowserContext::GetCookieableSchemes()

View File

@@ -10,16 +10,17 @@
#include <set>
#include <vector>
#include "include/cef_request_context_handler.h"
#include "libcef/browser/iothread_state.h"
#include "libcef/browser/request_context_handler_map.h"
#include "base/files/file_path.h"
#include "base/functional/callback.h"
#include "base/memory/weak_ptr.h"
#include "base/task/sequenced_task_runner_helpers.h"
#include "cef/include/cef_request_context_handler.h"
#include "cef/libcef/browser/iothread_state.h"
#include "cef/libcef/browser/request_context_handler_map.h"
#include "cef/libcef/features/features.h"
#include "chrome/common/plugin.mojom.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "ui/base/page_transition_types.h"
#include "url/origin.h"
/*
@@ -131,14 +132,12 @@ class CefBrowserContext {
// Called from CefRequestContextImpl::OnRenderFrameCreated.
void OnRenderFrameCreated(CefRequestContextImpl* request_context,
const content::GlobalRenderFrameHostId& global_id,
bool is_main_frame,
bool is_guest_view);
bool is_main_frame);
// Called from CefRequestContextImpl::OnRenderFrameDeleted.
void OnRenderFrameDeleted(CefRequestContextImpl* request_context,
const content::GlobalRenderFrameHostId& global_id,
bool is_main_frame,
bool is_guest_view);
bool is_main_frame);
// Returns the handler that matches the specified IDs. Pass -1 for unknown
// values. If |require_frame_match| is true only exact matches will be
@@ -161,7 +160,8 @@ class CefBrowserContext {
const CefString& domain_name,
CefRefPtr<CefSchemeHandlerFactory> factory);
void ClearSchemeHandlerFactories();
// TODO(chrome-runtime): Make these extension methods pure virtual.
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
virtual void LoadExtension(const CefString& root_directory,
CefRefPtr<CefDictionaryValue> manifest,
CefRefPtr<CefExtensionHandler> handler,
@@ -171,9 +171,13 @@ class CefBrowserContext {
// Called from CefExtensionImpl::Unload().
virtual bool UnloadExtension(const CefString& extension_id);
#endif
// Returns true if this context supports print preview.
virtual bool IsPrintPreviewSupported() const;
// Called from AlloyBrowserHostImpl::DidFinishNavigation to update the table
// of visited links.
virtual void AddVisitedURLs(const GURL& url,
const std::vector<GURL>& redirect_chain,
ui::PageTransition transition) = 0;
network::mojom::NetworkContext* GetNetworkContext();
@@ -231,7 +235,7 @@ class CefBrowserContext {
std::unique_ptr<CefMediaRouterManager> media_router_manager_;
// CefRequestContextImpl objects referencing this object.
std::set<CefRequestContextImpl*> request_context_set_;
std::set<raw_ptr<CefRequestContextImpl>> request_context_set_;
// Map IDs to CefRequestContextHandler objects.
CefRequestContextHandlerMap handler_map_;

View File

@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#include "libcef/browser/browser_context_keyed_service_factories.h"
#include "libcef/common/extensions/extensions_util.h"
#include "cef/libcef/browser/browser_context_keyed_service_factories.h"
#include "base/feature_list.h"
#include "cef/libcef/common/extensions/extensions_util.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/first_party_sets/first_party_sets_policy_service_factory.h"
#include "chrome/browser/media/router/chrome_media_router_factory.h"

View File

@@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/browser_frame.h"
#include "libcef/browser/browser_host_base.h"
#include "libcef/browser/thread_util.h"
#include "cef/libcef/browser/browser_frame.h"
#include "cef/libcef/browser/browser_host_base.h"
#include "cef/libcef/browser/browser_info_manager.h"
#include "cef/libcef/browser/thread_util.h"
#include "cef/libcef/common/frame_util.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
@@ -57,26 +58,31 @@ void CefBrowserFrame::FrameAttached(
bool reattached) {
// Always send to the newly created RFH, which may be speculative when
// navigating cross-origin.
if (auto host = GetFrameHost(/*prefer_speculative=*/true)) {
bool is_excluded;
if (auto host = GetFrameHost(/*prefer_speculative=*/true, &is_excluded)) {
host->FrameAttached(std::move(render_frame), reattached);
} else if (is_excluded) {
VLOG(1) << "frame "
<< frame_util::GetFrameDebugString(
render_frame_host()->GetGlobalFrameToken())
<< " attach denied";
mojo::Remote<cef::mojom::RenderFrame> render_frame_remote;
render_frame_remote.Bind(std::move(render_frame));
render_frame_remote->FrameAttachedAck(/*allow=*/false);
}
}
void CefBrowserFrame::UpdateDraggableRegions(
std::optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions) {
if (auto host = GetFrameHost()) {
if (auto host = GetFrameHost(/*prefer_speculative=*/false)) {
host->UpdateDraggableRegions(std::move(regions));
}
}
CefRefPtr<CefFrameHostImpl> CefBrowserFrame::GetFrameHost(
bool prefer_speculative) const {
CEF_REQUIRE_UIT();
auto rfh = render_frame_host();
if (auto browser = CefBrowserHostBase::GetBrowserForHost(rfh)) {
return browser->browser_info()->GetFrameForHost(rfh, nullptr,
prefer_speculative);
}
DCHECK(false);
return nullptr;
bool prefer_speculative,
bool* is_excluded) const {
return CefBrowserInfoManager::GetFrameHost(
render_frame_host(), prefer_speculative,
/*browser_info=*/nullptr, is_excluded);
}

View File

@@ -6,9 +6,8 @@
#define CEF_LIBCEF_BROWSER_BROWSER_FRAME_H_
#pragma once
#include "libcef/browser/frame_host_impl.h"
#include "libcef/browser/frame_service_base.h"
#include "cef/libcef/browser/frame_host_impl.h"
#include "cef/libcef/browser/frame_service_base.h"
#include "cef/libcef/common/mojom/cef.mojom.h"
#include "mojo/public/cpp/bindings/binder_map.h"
@@ -48,8 +47,8 @@ class CefBrowserFrame
// FrameServiceBase methods:
bool ShouldCloseOnFinishNavigation() const override { return false; }
CefRefPtr<CefFrameHostImpl> GetFrameHost(
bool prefer_speculative = false) const;
CefRefPtr<CefFrameHostImpl> GetFrameHost(bool prefer_speculative,
bool* is_excluded = nullptr) const;
};
#endif // CEF_LIBCEF_BROWSER_BROWSER_FRAME_H_

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