-
Notifications
You must be signed in to change notification settings - Fork 473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support chrome windows with CEF callbacks #2969
Comments
One important technical aspect of this change is the usage of BUILDFLAG(ENABLE_CEF) when patching Chromium code. We will need to introduce a runtime check for choosing between CEF and Chrome behaviors in these patches, instead of just compiling in the CEF-specific behaviors when building CEF. |
GTK is required for the Chrome runtime on Linux (see here), so |
Refactor process execution logic (see issue #2969) CefContext implements the public CEF API functions and delegates → <<cset 049caf913106 (bb)>> |
Add initial chrome runtime support (see issue #2969) Running The Chrome runtime requires resources.pak, chrome_100_percent.pak On Linux, the Chrome runtime requires GTK so use_gtk=true must be This change also refactors the CEF runtime, which can be tested in → <<cset 117499421184 (bb)>> |
Set enable_background_mode=false by default (see issue #2969) This mode doesn"t make sense with CEF, and it was causing strange → <<cset f5587b74f0aa (bb)>> |
Rename the current CEF runtime to Alloy (see issue #2969) As part of introducing the Chrome runtime we now need to distinguish Shared CEF library/runtime classes will continue to use the Cef This change applies the new naming pattern to an initial set of → <<cset 84f3ff2afda7 (bb)>> |
Add CefAppManager and remove global ContentClient accessors (see issue #2969) This is the first pass in removing direct dependencies on the Alloy CefBrowserHost and CefRequestContext APIs (including CefCookieManager, → <<cset b3a8da9b25dc (bb)>> |
Make CefBrowserContext an abstract base class (see issue #2969) Existing CefBrowserContext functionality is now split between This change also renames CefResourceContext to CefIOThreadState to more → <<cset 48fc0bd2206d (bb)>> |
Move browser runtime-specific logic to CefBrowserPlatformDelegate (see issue #2969) This change moves the runtime-specific implementations of CefBrowserHostImpl → <<cset 6cb9f0c695b9 (bb)>> |
Add initial Chrome runtime support for browser APIs (see issue #2969) This change adds basic Chrome runtime implementations for CefBrowserContext Any additional browser windows created via the Chrome UI will be unmanaged → <<cset e9bf3cdb9852 (bb)>> |
Move Alloy-specific logic to CefBrowserPlatformDelegateAlloy (see issue #2969) Also remove OSR-related methods where the attributes can instead be passed → <<cset 02cdf05848ea (bb)>> |
Fix build and initial Chrome runtime issues on macOS (see issue #2969) This change moves shared resource initialization to a common location and When using the Chrome runtime on macOS the Chrome application window will → <<cset 03c9156c803c (bb)>> |
Fix official build errors caused by chrome runtime changes (see issue #2969) → <<cset 13e3c8b42a7a (bb)>> |
The next step is supporting observers and delegates on the chrome
|
Update chrome_browser_net_export patch for chrome runtime (see issue #2969) → <<cset 7ca9e9c54bc3 (bb)>> |
Create a ChromeBrowserHostImpl for every Chrome tab (see issue #2969) The Browser object represents the top-level Chrome browser window. One or more The Browser object acts as the WebContentsDelegate for all attached tabs. CEF CEF callback logic is shared between the chrome and alloy runtimes where → <<cset 38d8acfa186c (bb)>> |
Rename CefBrowserHostImpl to AlloyBrowserHostImpl (see issue #2969) After commit 38d8acfa18 (bb) this object is only used with the alloy runtime. → <<cset e94a261bf518 (bb)>> |
Add chrome runtime support for more callbacks and ceftests (see issue #2969) This change adds support for:
This change also adds a new CefBrowserProcessHandler::GetCookieableSchemes callback for configuring global state that will be applied to all CefCookieManagers by default. This global callback is currently required by the chrome runtime because the primary ProfileImpl is created via ChromeBrowserMainParts::PreMainMessageLoopRun (CreatePrimaryProfile) before OnContextCreated can be called. ProfileImpl will use the "C:\Users[user]\AppData\Local\CEF\User Data\Default" directory by default (on Windows). Cookies may persist in this directory when running ceftests and may need to be manually deleted if those tests fail. Remaining work includes:
The following ceftests are now passing when run with the "--enable-chrome-runtime" command-line flag:
They can be run with this command-line:
→ <<cset 4fbd2472310b (bb)>> |
Fix chrome runtime startup assertion and PDF loading (see issue #2969) → <<cset 92508bcc871c (bb)>> |
chrome: Fix callbacks for different Profile types (see issue #2969)
→ <<cset ec7067c55ee1 (bb)>> |
chrome: Add CEF-specific WebUI handling (see issue #2969) To avoid conflicting IDs between Alloy (which uses cef.pak) and Chrome (which uses chrome_100_percent.pak) the cef/LICENSE.txt file is now included in both cef/libcef/resources/cef_resources.grd and chrome/app/theme/chrome_unscaled_resources.grd with different ID values. The cef.pak file currently contains both CEF-specific resources and Chrome resources that are already included in the default .pak files distributed with Chrome. In the future we should remove this duplication and just distribute the same .pak files as Chrome for the majority of resources. → <<cset 8f5fdc1f9adb (bb)>> |
Chrome + Views is testable on all platforms (Windows, Linux, MacOS) with builds of M90 and newer. It is considered MVP complete (meaning all basic functionality has been implemented/tested) with M101.
To launch a fully-featured Chrome window using cefsimple:
To launch a minimally-styled Views-hosted window using cefsimple:
To launch a fully-styled Views-hosted window using cefclient:
Use Expected/intentional behaviors that differ from the Alloy runtime:
The following ceftests are not yet supported with the "--enable-chrome-runtime" command-line flag:
All remaining (supported) tests can be run with this command-line:
|
chrome: Add Views API integration (see issue #2969) The Chrome browser can now be hosted in a Views-based application on Windows To launch a fully-featured Chrome window using cefsimple: To launch a minimally-styled Views-hosted window using cefsimple: To launch a fully-styled Views-hosted window using cefclient: Views unit tests also now pass with the Chrome runtime enabled: Known issues:
→ <<cset 8733cb89c74a (bb)>> |
Mac: Add Views API support (see issue #1749) The Chrome browser can now be hosted in a Views-based application on Mac To launch a fully-featured Chrome window using cefsimple: To launch a minimally-styled Views-hosted window using cefsimple: To launch a fully-styled Views-hosted window using cefclient: Known issues:
→ <<cset 1d39ff720e3e (bb)>> |
chrome: Fix URL rewrite on new tab navigation (see issue #2969) This fixes an Creating a new tab initially loads chrome://newtab which should then be → <<cset a6a8c0e845e8 (bb)>> |
Use the same pak files for the Alloy and Chrome runtimes (see issue #2969) Chrome currently uses chrome_100_percent.pak, chrome_200_percent.pak, The addition of Chrome resources results in an ~16% (~4.1MB) increase in total → <<cset 8424f166ccef (bb)>> |
Linux: cefclient: Port to GTK3 (see issue #2969) GTK3 is required by the Chrome runtime. The cefclient off-screen rendering → <<cset 020ac1b50972 (bb)>> |
Linux: Enable GTK3 by default (see issue #2969) GTK3 is required by the Chrome runtime. Client applications using GTK2 will → <<cset c4baba880e0b (bb)>> |
chrome: Add DevTools protocol support (see issue #2969) Testable with the following: → <<cset 505bf24abb6a (bb)>> |
chrome: Add support for reparenting of popups with Views (see issue #2969) → <<cset 25701cfa6fc2 (bb)>> |
…romiumembedded#2969)" The change is actually unnecessary. This reverts commit 5ddc8bd.
…me failure (see issue chromiumembedded#2969)
…bedded#2969) RequestContextTest and URLRequestTest suites now pass with the Chrome runtime enabled.
…membedded#2969) The problem occured while executing multiple URLRequestTest with the Chrome runtime.
The WebUITest suite now passes with the Chrome runtime enabled.
…ed#2969) The server thread was not guaranteed to be released in the correct scope on CEF shutdown. This resulted in occasional thread_restrictions assertions on ceftests shutdown after running the URLRequestTest suite with the Chrome runtime enabled.
…mbedded#2969) The Chrome runtime requires that cookieable scheme information be available at Profile initialization time because it also triggers NetworkContext creation at the same time. To make this possible, and to avoid various race conditions when setting state, the cookieable scheme configuration has been added as |cookieable_schemes_list| and |cookieable_schemes_exclude_defaults| in CefSettings and CefBrowserContextSettings. The CefCookieManager:: SetSupportedSchemes and CefBrowserProcessHandler::GetCookieableSchemes methods are no longer required and have been removed. This change also modifies chrome to delay OffTheRecordProfileImpl initialization so that |ChromeBrowserContext::profile_| can be set before ChromeContentBrowserClientCef::ConfigureNetworkContextParams calls CefBrowserContext::FromBrowserContext to retrieve the ChromeBrowserContext and associated cookieable scheme information. Otherwise, the ChromeBrowserContext will not be matched and the NetworkContext will not be configured correctly. The CookieTest suite now passes with the Chrome runtime enabled.
… issue chromiumembedded#2969) Profile::IsIncognitoProfile() currently returns false for CEF incognito profiles because they are not the primary OTR profile. At the same time, we don"t necessarily want IsIncognitoProfile() to return true for CEF profiles because, among other things, that causes the BrowserView to apply the dark toolbar theme. Instead, this change updates ProfileMenu expectations to support the CEF incognito profiles without otherwise modifying the incognito behavior. Note that the IsIncognitoProfile() implementation has recently changed in https://crrev.com/7bf6eb2497 and the conclusions in this commit will likely need to be revisited in an upcoming Chromium update.
…umembedded#2969) Fixes the following startup error: FATAL:crashpad_client_mac.cc(499) Check failed: exception_port_.is_valid()
…#2969) With the Chrome runtime, Profile initialization may be asynchronous. Code that waited on CefBrowserContext creation now needs to wait on CefBrowserContext initialization instead.
…omiumembedded#2969) This change adds support for CefSettings and command-line configuration of user_agent, user_agent_product (formerly product_version) and locale.
…mbedded#2969) This change adds support for CEF settings configuration of accept_language_list. If specified, this value will take precedence over the "intl.accept_languages" preference which is controlled by chrome://settings/languages.
…e issue chromiumembedded#2969) This was unintentionally lost during the Chrome runtime refactoring effort.
…omiumembedded#2969) This change adds support for CefSettings and command-line configuration of user_agent, user_agent_product (formerly product_version) and locale.
…mbedded#2969) This change adds support for CEF settings configuration of accept_language_list. If specified, this value will take precedence over the "intl.accept_languages" preference which is controlled by chrome://settings/languages.
…e issue chromiumembedded#2969) This was unintentionally lost during the Chrome runtime refactoring effort.
Original report by me.
The Chromium code base is composed of architectural layers, with the primary application layers being “content” and “chrome”. The “content” layer includes WebContents as the primary browser object and provides implementations for most of the generic web platform and application/process management functionality. The “chrome” layer includes Browser as the primary browser object and provides implementations for many advanced features including datalist/autofill (issue #906), extensions (issue #1947), gamepad (issue #1751), webhid (issue #2847), webmidi (issue #1028), async clipboard (issue #2921), input_type=color (issue #899), etc.
For historical reasons CEF browser windows are based on the “content” layer WebContents object. Adding support for additional “chrome” layer features is a serious effort because it involves careful understanding and cherry-picking of the related functionality from “chrome” into the CEF code base. Over time we have added dependencies on the “chrome” layer targets to support some features in CEF (extensions, print preview, etc) and to avoid code duplication. As a result, CEF binaries already contain most/all of the code that would be required to launch a stand-alone “chrome” Browser window.
If we could create a CEF browser window based on the “chrome” Browser object we would get much of the “chrome” layer functionality “for free”. To be usable in CEF the “chrome” window would need to support a subset of existing CEF callbacks/intercepts (e.g. loading progress, network requests, etc.), and be inserted into the existing Views framework structure (issue #1749). The “chrome” window would not support off-screen rendering, though parenting to a native (non-Views) window should be possible and likely required on macOS.
Given the above, the scope for this issue is to identify the subset of “chrome” initialization code that is required to launch and embed a Views-based Browser window object, and then hook up a TBD minimum subset of existing CEF callbacks to work with that object. MVP is an off-by-default option to create “chrome”-based browsers in cefclient/cefsimple. These browsers will initially contain many chrome-specific UI features (shortcut keys, dialogs, etc.) that might not be desired in release-quality client applications. Additional callback functionality and behavioral tweaks may be added over time as needed/appropriate.
The text was updated successfully, but these errors were encountered: