Commit Graph

2302 Commits

Author SHA1 Message Date
Marshall Greenblatt a6a8c0e845 chrome: Fix URL rewrite on new tab navigation (see issue #2969)
This fixes an `Unhandled chrome.send("getApps");` error when creating a new tab.

Creating a new tab initially loads chrome://newtab which should then be
rewritten to chrome://new-tab-page for normal profiles in
HandleNewTabURLRewrite. Failure to rewrite the URL results in the loading of
NewTabUI instead of the expected NewTabPageUI. NewTabUI loads different
resources for normal vs incognito/guest profiles (new_tab.js vs
incognito_tab.js), and new_tab.js calls chrome.send("getApps") via
page_list_view.js. This then fails in WebUIImpl::ProcessWebUIMessage because
the message is unhandled.
2021-02-27 14:34:49 -05:00
Marshall Greenblatt 1d39ff720e Mac: Add Views API support (see issue #1749)
The Chrome browser can now be hosted in a Views-based application on Mac
(see issue #2969).

To launch a fully-featured Chrome window using cefsimple:
$ open cefsimple.app --args --enable-chrome-runtime

To launch a minimally-styled Views-hosted window using cefsimple:
$ open cefsimple.app --args --use-views [--enable-chrome-runtime]

To launch a fully-styled Views-hosted window using cefclient:
$ open cefclient.app --args --use-views [--enable-chrome-runtime]

Known issues:
- Some Views unit tests are currently failing on Mac.
2021-02-27 12:31:45 -05:00
Marshall Greenblatt f93c9c0c5c Mac: Remove browser_compositor_mac.patch
This patch file causes the blank screen issue with Views and is not
actually required.
2021-02-26 20:12:16 -05:00
Marshall Greenblatt b5dfcd05cb Support building the chome target with enable_cef=false 2021-02-26 20:12:16 -05:00
Marshall Greenblatt 8733cb89c7 chrome: Add Views API integration (see issue #2969)
The Chrome browser can now be hosted in a Views-based application on Windows
and Linux.

To launch a fully-featured Chrome window using cefsimple:
$ cefsimple --enable-chrome-runtime

To launch a minimally-styled Views-hosted window using cefsimple:
$ cefsimple --enable-chrome-runtime --use-views

To launch a fully-styled Views-hosted window using cefclient:
$ cefclient --enable-chrome-runtime --use-views

Views unit tests also now pass with the Chrome runtime enabled:
$ ceftests --gtest_filter=Views* --enable-chrome-runtime

Known issues:
- Popup browsers cannot be intercepted and reparented.
2021-02-21 15:25:10 -05:00
Marshall Greenblatt 8f5fdc1f9a 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.
2021-02-15 18:24:52 -05:00
Marshall Greenblatt ec7067c55e chrome: Fix callbacks for different Profile types (see issue #2969)
- Only install network intercepts for Profiles that have an associated
  CefBrowserContext. For incognito windows the CefBrowserContext is
  associated with the OffTheRecordProfileImpl's original Profile.
- cefsimple: Return the default CefClient instance for browser windows
  created via the Chrome UI, and allow Chrome to show error pages.
2021-02-15 16:50:04 -05:00
Marshall Greenblatt bf3b7b2c62 Linux: cefclient: Fix GTK expectations with OSR multi-threaded-message-loop (fixes issue #3087) 2021-02-15 09:54:06 -08:00
Marshall Greenblatt b3ad79e2c5 Linux: cefclient: Fix GTK behavior with multi-threaded-message-loop (fixes issue #3087)
Switch to using g_main_context_default() in MainMessageLoopMultithreadedGtk. As of M86
(https://crrev.com/b960daf4e6) Chromium now creates its own context in MessagePumpGlib so
we can use the default context in cefclient. This is also more "correct" from a GTK usage
perspective. As part of this change all GTK dialogs and callbacks are now executed on the
main thread instead of the UI thread (note that these are the same thread when not using
multi-threaded-message-loop).
2021-02-12 11:54:31 -08:00
Marshall Greenblatt 7fe6a18f03 Mac: Fix incorrect creation of NSAutoreleasePool (fixes issue #2160) 2021-02-11 17:12:15 -05:00
Masayuki Nagamachi d6dc4b667b Support git working directory created by `git worktree add` (fixes issue #2673) 2021-02-10 18:43:30 +00:00
Cristian Amarie 59c11404e6 Fix loading of URL without scheme (fixes issue #3079) 2021-02-10 13:33:51 -05:00
Marshall Greenblatt 5ef0fb8ac8 Update to Chromium version 89.0.4389.0 (#843830)
- SSE3 is now required on x86 processors (see https://crbug.com/1123353).
2021-02-08 14:15:38 -05:00
Marshall Greenblatt 119415b8e9 Update copyright year on generated files 2021-01-27 13:36:54 -05:00
Marshall Greenblatt d06fdcff85 Add workaround for crash on Views popup window creation (see issue #3040) 2021-01-21 13:43:50 -05:00
Marshall Greenblatt 9d4f862210 Windows: cmake: Fix unknown arguments error with VS2017 generator 2021-01-21 13:43:44 -05:00
Marshall Greenblatt 5055d1f1d5 Windows: Ignore INCLUDE/LIB env if vcvarsall.bat is available (see issue #2773)
Windows ARM64 cross-compile requires building Clang x64 binaries. Building both
arm64 and x64 binaries in the same build is not possible when using INCLUDE/LIB
values set via the environment. Instead, allow Chromium to extract the correct
configuration from vcvarsall.bat for populating the environment.[arch] files.
2021-01-11 14:11:57 -05:00
Marshall Greenblatt b798147c33 Windows: Add ARM64 distribution support (see issue #2773)
To generate Windows ARM64 builds set the CEF_ENABLE_ARM64=1 environment
variable and pass the "--arm64-build --build-target=cefsimple" command-line
arguments to automate-git.py. We can't build cefclient.exe for ARM64 due to
missing OpenGL library support so build cefsimple.exe instead.
2021-01-11 13:49:39 -05:00
Marshall Greenblatt 2a64387259 Add workaround for crash on popup window creation (see issue #3040) 2020-12-07 13:53:28 -05:00
Marshall Greenblatt 71179da2f6 Mac: Add ARM64 configuration support (see issue #2981)
Requires Xcode 12.2 and the MacOS 11.0 SDK. To generate ARM64 builds set
the CEF_ENABLE_ARM64=1 environment variable and replace all usage of
--x64-build with --arm64-build in script command-line arguments.
2020-12-04 15:43:50 -05:00
Marshall Greenblatt a584bd187b Update to Chromium version 88.0.4324.0 (#827102)
- Mac: Xcode 12.2 and the MacOS 11.0 SDK are now required for building.
- MacOS 10.10 (Yosemite) is no longer supported (see https://crbug.com/1126056).
- Flash is no longer supported (see https://www.chromium.org/flash-roadmap).
2020-12-04 15:43:33 -05:00
Marshall Greenblatt 7d1d3c0206 Linux: Fix ATK assertion error when generating ARM build config. 2020-11-18 15:52:37 -05:00
Marshall Greenblatt d2c884da86 Prevent UB if a WeakPtr to an already-destroyed object is dereferenced.
If a WeakPtr references an already-destroyed object, operator-> and
operator* end up simply dereferencing nullptr. However, dereferencing
nullptr is undefined behavior and can be optimized in surprising ways
by compilers. To prevent this from happening, add a defence of last
resort and CHECK that the WeakPtr is still valid.

Based on https://crrev.com/bbb64b5c69
2020-11-10 11:51:50 -05:00
Marshall Greenblatt 0b7840ab2f Update URL for CEF downloads 2020-11-05 14:02:36 -05:00
Cristian Amarie 977cc71fd9 Win/Linux: Add support for chrome://sandbox (fixes issue #3029) 2020-10-29 17:55:45 +00:00
Marshall Greenblatt 023d218104 Move OnCursorChange from CefRenderHandler to CefDisplayHandler
The cursor change can now be handled by the client with both windowed and
off-screen rendering.

Returning true from OnCursorChange will disable the default cursor change
behavior. This is functionally equivalent to the
CefBrowserHost::SetMouseCursorChangeDisabled method, so that method has been
removed.
2020-10-28 12:56:27 -04:00
Marshall Greenblatt 4e6c558bf2 Windows: Fix focus assignment when clicking WebView with external parent (fixes issue #3031) 2020-10-27 14:43:10 -04:00
Marshall Greenblatt 6a525748c4 cefbuilds: Remove html generation and add beta channel support 2020-10-24 13:13:43 -04:00
Sergey Markelov c3aa36323b Mac: cefclient: Remove duplicated cleanup code 2020-10-15 20:18:20 +00:00
Marshall Greenblatt a1ba0c9166 Windows/Linux: Fix scrolling in popup lists with high-dpi. 2020-10-15 16:03:32 -04:00
Marshall Greenblatt e618f44667 Windows: Fix warning C4458: declaration of 'method' hides class member 2020-10-15 14:21:06 -04:00
Cristian Amarie 9e296bde3c Windows: Fix duplicate symbol ThrowBadVariantAccess with cef_sandbox build (fixes issue #3021) 2020-10-15 14:21:06 -04:00
Marshall Greenblatt 015e3621a3 Update to Chromium version 87.0.4280.0 (#812852)
- Windows: VS2015 Update 2 is now the minimum version requirement for linking
  cef_sandbox from official build binary distributions.
2020-10-15 14:21:06 -04:00
Marshall Greenblatt cae194f493 Improve documentation related to views screen coordinates (see issue #2980) 2020-10-01 16:12:01 -04:00
Marshall Greenblatt 4fbd247231 Add chrome runtime support for more callbacks and ceftests (see issue #2969)
This change adds support for:
- Protocol and request handling.
- Loading and navigation events.
- Display and focus events.
- Mouse/keyboard events.
- Popup browsers.
- Callbacks in the renderer process.
- Misc. functionality required for ceftests.

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:
- Support for client-created request contexts.
- Embedding the browser in a Views hierarchy (cefclient support).
- TryCloseBrowser and DoClose support.
- Most of the CefSettings configuration.
- DevTools protocol and window control (ShowDevTools, ExecuteDevToolsMethod).
- CEF-specific WebUI pages (about, license, webui-hosts).
- Context menu customization (CefContextMenuHandler).
- Auto resize (SetAutoResizeEnabled).
- Zoom settings (SetZoomLevel).
- File dialog runner (RunFileDialog).
- File and JS dialog handlers (CefDialogHandler, CefJSDialogHandler).
- Extension loading (LoadExtension, etc).
- Plugin loading (OnBeforePluginLoad).
- Widevine loading (CefRegisterWidevineCdm).
- PDF and print preview does not display.
- Crash reporting is untested.
- Mac: Web content loads but does not display.

The following ceftests are now passing when run with the
"--enable-chrome-runtime" command-line flag:

CorsTest.*
DisplayTest.*:-DisplayTest.AutoResize
DOMTest.*
DraggableRegionsTest.*
ImageTest.*
MessageRouterTest.*
NavigationTest.*
ParserTest.*
RequestContextTest.*Global*
RequestTest.*
ResourceManagerTest.*
ResourceRequestHandlerTest.*
ResponseTest.*
SchemeHandlerTest.*
ServerTest.*
StreamResourceHandlerTest.*
StreamTest.*
StringTest.*
TaskTest.*
TestServerTest.*
ThreadTest.*
URLRequestTest.*Global*
V8Test.*:-V8Test.OnUncaughtExceptionDevTools
ValuesTest.*
WaitableEventTest.*
XmlReaderTest.*
ZipReaderTest.*
2020-09-29 18:31:43 -04:00
Marshall Greenblatt e94a261bf5 Rename CefBrowserHostImpl to AlloyBrowserHostImpl (see issue #2969)
After commit 38d8acfa18 this object is only used with the alloy runtime.
2020-09-22 17:36:06 -04:00
Marshall Greenblatt 9022d40e6a Add missing print preview resources and prefs (fixes issue #2989) 2020-09-22 17:36:06 -04:00
Marshall Greenblatt 38d8acfa18 Create a ChromeBrowserHostImpl for every Chrome tab (see issue #2969)
The Browser object represents the top-level Chrome browser window. One or more
tabs (WebContents) are then owned by the Browser object via TabStripModel. A
new Browser object can be created programmatically using "new Browser" or
Browser::Create, or as a result of user action such as dragging a tab out of an
existing window. New or existing tabs can also be added to an already existing
Browser object.

The Browser object acts as the WebContentsDelegate for all attached tabs. CEF
integration requires WebContentsDelegate callbacks and notification of tab
attach/detach. To support this integration we add a cef::BrowserDelegate
(ChromeBrowserDelegate) member that is created in the Browser constructor and
receives delegation for the Browser callbacks. ChromeBrowserDelegate creates a
new ChromeBrowserHostImpl when a tab is added to a Browser for the first time,
and that ChromeBrowserHostImpl continues to exist until the tab's WebContents
is destroyed. The associated WebContents object does not change, but the
Browser object will change when the tab is dragged between windows.

CEF callback logic is shared between the chrome and alloy runtimes where
possible. This shared logic has been extracted from CefBrowserHostImpl to
create new CefBrowserHostBase and CefBrowserContentsDelegate classes. The
CefBrowserHostImpl class is now only used with the alloy runtime and will be
renamed to AlloyBrowserHostImpl in a future commit.
2020-09-21 17:06:56 -04:00
Marshall Greenblatt 7ca9e9c54b Update chrome_browser_net_export patch for chrome runtime (see issue #2969) 2020-09-17 13:43:04 -04:00
Marshall Greenblatt 64c561f0bd Linux: cmake: Disable GTK deprecated functions (fixes issue #2791) 2020-09-15 12:44:48 -04:00
Marshall Greenblatt f2c0c3f8fb Add support for prefers-color-scheme media queries (fixes issue #2824) 2020-09-15 12:34:22 -04:00
Marshall Greenblatt 5f9bd3ecbd Fix crash when sending programmatic event to a Views-hosted browser window.
The |web_contents_| member was nullptr in CefBrowserPlatformDelegateNativeAura
when calling methods like SendKeyEvent from CefBrowserPlatformDelegateViews.
2020-09-15 11:19:04 -04:00
Marshall Greenblatt 8796d3cd95 Persist media device IDs across navigation and restart (fixes issue #2064)
Media device IDs will now be persisted across navigation and reload by default.
The device IDs will also be persisted across restart if --cache-path=<path> and
--persist-user-preferences settings are specified.
2020-09-14 16:28:23 -04:00
Marshall Greenblatt cc56720bd2 Support CORS preflight requests with OutOfBlinkCors (fixes issue #3006)
A CORS preflight request is an "OPTIONS" request sent to a server prior to a
cross-origin XMLHttpRequest or Fetch request. The server's response determines
which HTTP request methods are allowed and supported, and whether credentials
such as Cookies and HTTP Authentication should be sent with requests.

A CORS preflight request will only be sent if certain conditions are met. For
example, it will be sent for requests that have potentially unsafe HTTP
methods [1] or request headers [2]. See the NeedsPreflight function in
services/network/cors/cors_url_loader.cc for full details.

CORS preflight functionality is implemented in the network service and will not
be triggered if the client handles the request instead of allowing it to proceed
over the network. Since the preflight request itself also runs in the network
service it cannot be intercepted by the client.

[1] https://fetch.spec.whatwg.org/#cors-safelisted-method
[2] https://fetch.spec.whatwg.org/#cors-safelisted-request-header
2020-09-11 19:21:53 -04:00
Marshall Greenblatt 88faf1023a Fix incorrect Origin and Cookie headers for POST redirects (fixes issue #2806)
This change also adds unit test coverage for cross-origin POST redirects.
2020-09-09 18:30:12 -04:00
Marshall Greenblatt 42f517ec69 Fix DCHECK failure in the URLLoader constructor.
The request.trusted_params.isolation_info.site_for_cookies value must
match request.site_for_cookies.

This change also adds unit test coverage for cross-origin GET redirects.
2020-09-09 18:29:21 -04:00
Marshall Greenblatt 4791109a28 Don't save or load cookies for non-cookieable scheme requests.
This fixes an IsCanonical() DCHECK failure triggered by calling
CanonicalCookie::Create for a non-cookieable URL.

This change also adds unit test coverage for cross-origin cookie
behavior with sub-resource requests (iframe, XHR, Fetch).
2020-09-09 18:29:15 -04:00
Marshall Greenblatt 19391d8ab0 Fix documentation typo 2020-09-08 12:18:35 -04:00
Marshall Greenblatt 59a779c38a Disable Badging API which is not supported (fixes issue #3005) 2020-09-03 17:52:09 -04:00
Marshall Greenblatt b579b37db4 views: Support specification of screen bounds for CefWindow creation (fixes issue #2980) 2020-09-03 17:51:57 -04:00