Commit Graph

903 Commits

Author SHA1 Message Date
Marshall Greenblatt 5ddd26e483 Restore support for CreateBrowserSync with NULL |request_context| (see issue #2969)
This was unintentionally lost during the Chrome runtime refactoring effort.
2021-05-20 15:11:39 -04:00
Marshall Greenblatt 21ac0be8d7 Update process message unit test expectations (see issue #3126)
See related comments in commit f3c513ba.
2021-05-20 14:56:23 -04:00
Marshall Greenblatt f3c513bafd Allow a CefProcessMessage to remain valid after receipt (see issue #3126)
A reference to a received CefProcessMessage object and/or associated argument
list can now be kept outside of the OnProcessMessageReceived callback. The
argument list is no longer explicitly owned by the CefProcessMessage object
and can be individually assigned to other CefValue types as needed (e.g. by
passing to SetList, etc). Depending on client usage this could reduce the
potential for unnecessary copies of the list contents.

Received messages can also be sent back using SendProcessMessage (after which
the CefProcessMessage would become invalid as discussed in issue #3123). This
is not new behavior but we have now added explicit unit test coverage for it.
This also no longer requires a copy of the argument list contents.

Note that a received argument list is initially read-only for logical
consistency. Assignment to another CefValue object could potentially remove
the read-only status because it is not an intrinsic property of the underlying
Chromium data type. This is fine because, at that point, ownership has been
transfered to the new CefValue object and the original logical context (as
part of the CefProcessMessage) no longer applies.
2021-05-20 14:46:19 -04:00
Marshall Greenblatt d9efaee9b9 Fix routing of frame messages after cross-origin navigation (fixes issue #2849)
When navigating cross-origin a speculative RenderFrameHost (RFH) and
CefFrameHostImpl is created in the browser process for the new frame object
created in a new renderer process. The FrameAttached message then arrives for
the speculative RFH, and as a consequence interfaces are bound between the new
CefFrameHostImpl and the speculative RFH. If the pending navigation commits
then the existing RFH will be replaced with the previously speculative RFH.
Since interfaces are already bound we must keep the new CefFrameHostImpl. This
means that frame objects (including for the main frame) will now always change
after cross-origin navigation, and the old frame object will be invalidated.
2021-05-18 21:59:48 -04:00
Marshall Greenblatt ebee84755e Convert legacy IPC messages to Mojo (fixes issue #3123)
This change introduces a few minor CEF API behavior changes:

- A CefProcessMessage object cannot be reused after being passed to
  SendProcessMessage.
- The |extra_info| argument to CefRenderProcessHandler::OnBrowserCreated may
  now be NULL.

Where appropriate, we now utilize the default UTF string encoding format and
shared memory to reduce copies and conversions for the cross-process
transfer of arbitrary-length strings. For example, CefFrame::GetSource/GetText
now involves zero UTF conversions and zero copies in the browser process for
the CefString delivered to CefStringVisitor::Visit().
2021-05-18 21:59:48 -04:00
Marshall Greenblatt fde96be168 Fix crash closing DevTools window (fixes issue #3111) 2021-05-05 12:48:07 -04:00
Marshall Greenblatt 2de07250dc Restore async CreateBrowser behavior (fixes issue #3116, fixes issue #3118)
Restore the async CreateBrowser behavior that existed prior to commit 691c9c2
because executing synchronously (for example, from inside OnContextInitialized)
causes issues on MacOS and possibly other platforms.
2021-04-29 17:33:32 -04:00
Marshall Greenblatt 3ab91a45c9 chrome: Support configuration of accept language (see issue #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.
2021-04-28 13:12:09 -04:00
Marshall Greenblatt c03a6f4386 chrome: Support configuration of user agent and locale (see issue #2969)
This change adds support for CefSettings and command-line configuration of
user_agent, user_agent_product (formerly product_version) and locale.
2021-04-27 12:39:12 -04:00
Marshall Greenblatt ae4f68f695 Update to Chromium version 91.0.4472.0 (#870763) 2021-04-23 11:38:51 -04:00
Marshall Greenblatt b189c7b472 Fix extension loading test failure 2021-04-22 17:15:14 -04:00
Marshall Greenblatt f84762d84a Fix crash closing DevTools window (fixes issue #3111) 2021-04-22 12:41:35 -04:00
Marshall Greenblatt cf1074cf49 chrome: Support configuration of renderer prefs (see issue #2969) 2021-04-17 21:23:55 -04:00
Marshall Greenblatt 9756e15a23 chrome: Don't rely on CREATE_STATUS_CREATED for disk-based profiles (see issue #2969) 2021-04-15 13:36:10 -04:00
Marshall Greenblatt 34c63a665d Wait for CefBrowserContext initialization (see issue #2969)
With the Chrome runtime, Profile initialization may be asynchronous. Code that
waited on CefBrowserContext creation now needs to wait on CefBrowserContext
initialization instead.
2021-04-14 21:03:44 -04:00
Marshall Greenblatt fc7f9ff505 Fix crash when navigating to an unregistered scheme (fixes issue #3105)
The policy->CanAccessDataForOrigin CHECK in NavigationRequest::
GetOriginForURLLoaderFactory was failing because unregistered schemes
(which are already considered non-standard schemes) didn't trigger the
registered non-standard scheme allowance that we previously added in
ChildProcessSecurityPolicyImpl::CanAccessDataForOrigin. This change
modifies GetOriginForURLLoaderFactory to always return an opaque/unique
origin for non-standard schemes resulting in unregistered and non-standard
schemes receiving the same treatment.

New test coverage has been added for this condition, and can be run with:
ceftests --gtest_filter=CorsTest.*CustomUnregistered*
2021-04-12 16:18:37 -04:00
Marshall Greenblatt a4603c6f1a chrome: Support usage of the Chrome toolbar from Views (see issue #2969) 2021-04-11 20:44:28 -04:00
Marshall Greenblatt 5318dfe252 chrome: Fix PreferenceTest failures (see issue #2969) 2021-04-09 22:00:33 -04:00
Marshall Greenblatt 76642ccafa Move cookieable scheme configuration to settings (see issue #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.
2021-04-09 15:04:24 -04:00
Marshall Greenblatt c565d9b1e6 Fix server thread assertion on CEF shutdown (see issue #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.
2021-04-09 14:22:51 -04:00
Marshall Greenblatt 09a9d9b54c chrome: Support customization of context menus (see issue #2969) 2021-04-08 19:38:29 -04:00
Marshall Greenblatt 701f51b1cc Fix URL rewrite on browser creation (see issue #2969)
The WebUITest suite now passes with the Chrome runtime enabled.
2021-04-07 18:56:07 -04:00
Marshall Greenblatt 4188cc2f75 Avoid potential use-after-free of CefIOThreadState (see issue #2969)
The problem occured while executing multiple URLRequestTest with the Chrome
runtime.
2021-04-07 18:19:46 -04:00
Marshall Greenblatt 09fa22898d chrome: Support client-created request contexts (see issue #2969)
RequestContextTest and URLRequestTest suites now pass with the Chrome runtime
enabled.
2021-04-07 18:19:17 -04:00
Marshall Greenblatt 09c6586480 chrome: Fix NavigationTest and ResourceRequestHandlerTest failures (see issue #2969) 2021-04-05 13:50:21 -04:00
Marshall Greenblatt 25701cfa6f chrome: Add support for reparenting of popups with Views (see issue #2969) 2021-04-02 16:53:34 -04:00
Marshall Greenblatt 7876a2f321 Move GetPrintHandler to CefClient (see issue #2196)
This new location is preferred because we now know the associated CefBrowser
for all CefPrintHandler callbacks.
2021-03-30 12:26:57 -04:00
Marshall Greenblatt f7a4c777e8 Remove CefBrowserSettings.web_security (fixes issue #3058) 2021-03-25 13:07:17 -04:00
Marshall Greenblatt b375397efb Fix crash in MediaRouterEnabled due to missing pref registration (see issue #2900) 2021-03-24 15:15:53 -04:00
Corentin Dumont 6574e1d914 Windows: Fix out-of-sync timestamps in OSR mode (fixes issue #3102) 2021-03-23 20:13:03 +00:00
Yannick 47f15dd307 Remove maximum frame rate limit with OSR (fixes issue #3077) 2021-03-18 17:46:03 +00:00
Dmitry Azaraev 505bf24abb chrome: Add DevTools protocol support (see issue #2969)
Testable with the following:
$ ceftests --enable-chrome-runtime --gtest_filter=DevToolsMessageTest.*
2021-03-18 13:32:56 -04:00
Marshall Greenblatt 74db00fc89 Update to Chromium version 90.0.4430.0 (#857950)
- Linux ARM builds require use_vaapi=false (see https://crbug.com/1185348)
- Windows official builds require use_thin_lto=false (see https://crbug.com/1177001)
2021-03-18 11:23:00 -04:00
Marshall Greenblatt 8424f166cc 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,
resources.pak and locales/<locale>.pak files. This change adds CEF
resources to those existing pak files and updates the Alloy runtime to
use them instead of the previous CEF-specific pak files (cef.pak,
cef_100_percent.pak, cef_200_percent.pak, cef_extensions.pak,
devtools_resources.pak) which are no longer generated.

The addition of Chrome resources results in an ~16% (~4.1MB) increase in total
combined pak file size vs. the previous CEF-specific pak files. While a size
increase is not ideal for the Alloy runtime, it seems preferable to the
alternative of distributing separate (and partially duplicated) pak files for
each runtime, which would have added ~9.8MB to the total binary distribution
size.
2021-02-28 16:51:37 -05:00
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 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
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 d06fdcff85 Add workaround for crash on Views popup window creation (see issue #3040) 2021-01-21 13:43:50 -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 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
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 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 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 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 b579b37db4 views: Support specification of screen bounds for CefWindow creation (fixes issue #2980) 2020-09-03 17:51:57 -04:00
Marshall Greenblatt e6047bd54b Restore the CefRenderHandler::OnScrollOffsetChanged callback (fixes issue #2810) 2020-09-03 17:51:09 -04:00
Marshall Greenblatt 24c2f2fa38 Update to Chromium version 86.0.4240.0 (#800218)
- CefURLRequest::Create is no longer supported in the renderer process
  (see https://crbug.com/891872). Use CefFrame::CreateURLRequest instead.
- Mac platform definitions have been changed from `MACOSX` to `MAC`
  (see https://crbug.com/1105907) and related CMake macro names have
  been updated. The old `OS_MACOSX` define is still set in code and CMake
  for backwards compatibility.
- Linux ARM build is currently broken (see https://crbug.com/1123214).
2020-09-03 17:44:25 -04:00
Marshall Greenblatt 6b1e5335bc Add support and enable out-of-Blink CORS (fixes issue #2716)
It can still be disabled for a short time by passing
`--disable-features=OutOfBlinkCors` on the command-line.
2020-08-26 16:25:25 -04:00
Masako Toda 87c8a72831 Fix initial transparency delay for OSR + gpu-disabled (see issue #2938) 2020-08-13 14:50:40 -04:00
Cristian Amarie 11f37bc6eb Add limit on request redirects (fixes issue #3001) 2020-08-13 18:45:26 +00:00
Marshall Greenblatt b822ea43b9 Fix DCHECK when showing print preview dialog (see issue #2952) 2020-07-23 15:46:57 -04:00
Marshall Greenblatt ac99621829 Fix link navigation from PDF files (fixes issue #2952)
Navigations initiated from a guest view will now be routed to the
OpenURLFromTab callback.
2020-07-23 14:48:25 -04:00
Masako Toda a3919cb0ec Fix excessive CPU usage with external and multi-threaded message loops (fixes issue #2809, fixes issue #2970). 2020-07-21 16:26:41 +00:00
Masako Toda ca1c00f95d Fix timing of InstallTransparency for OSR + gpu-disabled (see issue #2938) 2020-07-20 20:01:13 +00:00
Andrei Kurushin 574d4dcedc Fix crash when closing an OSR browser (fixes issue #2919)
Release the Compositor before the WebContents is destroyed to match
the behavior in non-OSR code.
2020-07-20 14:33:00 -04:00
Marshall Greenblatt e87fedd27c Fix shutdown crash in InitNetworkContext with multi-threaded message loop (fixes issue #2985) 2020-07-20 13:49:16 -04:00
Marshall Greenblatt e8573173dd Expose MediaSink device ip/port and model name (see issue #2900) 2020-07-16 19:11:19 -04:00
Marshall Greenblatt 13e3c8b42a Fix official build errors caused by chrome runtime changes (see issue #2969) 2020-07-16 19:11:18 -04:00
Marshall Greenblatt 280c9127c1 Remove render thread created callbacks (see issue #2498)
With site-per-process enabled a spare renderer process will be created
for use with a future browser or navigation. Consequently the
|extra_info| parameter populated in OnRenderProcessThreadCreated will no
longer be delivered to OnRenderThreadCreated in the expected renderer
process. To avoid confusion these callbacks have been removed completely.

After this change CefRenderProcessHandler::OnWebKitInitialized should
be used for startup tasks in the render process, and OnBrowserCreated
should be used in the render process to recieve |extra_info| passed from
CefBrowserHost::CreateBrowser or CefLifeSpanHandler::OnBeforePopup.
2020-07-16 19:11:18 -04:00
Marshall Greenblatt 6573df6cc3 Update to Chromium version 85.0.4183.0 (#782793)
- Windows: 10.0.19041 SDK is now required.
- macOS: 10.15.1 SDK (at least Xcode 11.2) is now required.
- Remove CefMediaSource::IsValid and CefMediaSink::IsValid which would
  always return true.
2020-07-16 19:11:12 -04:00
Marshall Greenblatt 03c9156c80 Fix build and initial Chrome runtime issues on macOS (see issue #2969)
This change moves shared resource initialization to a common location and
disables crash reporting initialization in chrome/ code via patch files.

When using the Chrome runtime on macOS the Chrome application window will
display, but web content is currently blank and the application does not
exit cleanly. This will need to be debugged further in the future.
2020-07-06 15:20:53 -04:00
Marshall Greenblatt 02cdf05848 Move Alloy-specific logic to CefBrowserPlatformDelegateAlloy (see issue #2969)
Also remove OSR-related methods where the attributes can instead be passed
to the OSR platform delegate constructor directly.
2020-07-04 16:13:30 -04:00
Marshall Greenblatt e9bf3cdb98 Add initial Chrome runtime support for browser APIs (see issue #2969)
This change adds basic Chrome runtime implementations for CefBrowserContext
and CefBrowserPlatformDelegate. A Chrome browser window with default frame
and styling can now be created using CefBrowserHost::CreateBrowser and some
CefClient callbacks will be triggered via the WebContentsObserver
implementation in CefBrowserHostImpl.

Any additional browser windows created via the Chrome UI will be unmanaged
by CEF. The application message loop will block until all browser windows
have been closed by the user.
2020-07-04 16:13:30 -04:00
Marshall Greenblatt 6cb9f0c695 Move browser runtime-specific logic to CefBrowserPlatformDelegate (see issue #2969)
This change moves the runtime-specific implementations of CefBrowserHostImpl
methods to CefBrowserPlatformDelegate. Some WebContentsDelegate methods
implemented by CefBrowserHostImpl set state or trigger client callbacks.
Those implementations will likely stay with CefBrowserHostImpl and will
need to be called from the Browser equivalents when using the Chrome runtime.
2020-07-03 18:09:52 -04:00
Marshall Greenblatt 6152d68b6a Make chrome://chrome-urls an alias for chrome://webui-hosts (fixes issue #2977) 2020-07-02 15:44:48 -04:00
Marshall Greenblatt 88b88251e7 Fix decoding of resources (fixes issue #2966)
Use LoadDataResourceString instead of GetDataResource. It will perform
decoding if necessary.
2020-07-02 14:45:23 -04:00
Marshall Greenblatt 48fc0bd220 Make CefBrowserContext an abstract base class (see issue #2969)
Existing CefBrowserContext functionality is now split between
CefBrowserContext and AlloyBrowserContext. Runtime implementations of
CefBrowserContext will provide access to the content::BrowserContext and
Profile types via different inheritance paths. For example, the Alloy
runtime uses ChromeProfileAlloy and the Chrome runtime uses ProfileImpl.

This change also renames CefResourceContext to CefIOThreadState to more
accurately represent its purpose as it no longer needs to extend
content::ResourceContext.
2020-07-01 15:35:07 -04:00
lwttai.lu 619f18fea0 Windows: File dialog add filter with all supported extensions as default (see issue #860) 2020-06-30 18:45:50 +00:00
Mike Wiedenbauer 0dfefe391c Fix decoding of the DevTools remote debugging discovery page (fixes issue #2974) 2020-06-30 14:43:48 +00:00
Marshall Greenblatt b3a8da9b25 Add CefAppManager and remove global ContentClient accessors (see issue #2969)
This is the first pass in removing direct dependencies on the Alloy
runtime from code that can potentially be shared between runtimes.

CefBrowserHost and CefRequestContext APIs (including CefCookieManager,
CefURLRequest, etc.) are not yet implemented for the Chrome runtime.
Assert early if these API methods are called while the Chrome runtime
is enabled.
2020-06-29 16:17:58 -04:00
Marshall Greenblatt 84f3ff2afd Rename the current CEF runtime to Alloy (see issue #2969)
As part of introducing the Chrome runtime we now need to distinguish
between the classes that implement the current CEF runtime and the
classes the implement the shared CEF library/runtime structure and
public API. We choose the name Alloy for the current CEF runtime
because it describes a combination of Chrome and other elements.

Shared CEF library/runtime classes will continue to use the Cef
prefix. Classes that implement the Alloy or Chrome runtime will use
the Alloy or Chrome prefixes respectively. Classes that extend an
existing Chrome-prefixed class will add the Cef or Alloy suffix,
thereby following the existing naming pattern of Chrome-derived
classes.

This change applies the new naming pattern to an initial set of
runtime-related classes. Additional classes/files will be renamed
and moved as the Chrome runtime implementation progresses.
2020-06-29 16:17:41 -04:00
Marshall Greenblatt f5587b74f0 Set enable_background_mode=false by default (see issue #2969)
This mode doesn't make sense with CEF, and it was causing strange
shutdown crashes when running with Chrome mode enabled.
2020-06-29 16:17:32 -04:00
Marshall Greenblatt 1174994211 Add initial chrome runtime support (see issue #2969)
Running `cefsimple --enable-chrome-runtime` will create and run a
Chrome browser window using the CEF app methods, and call
CefApp::OnContextInitialized as expected. CEF task methods also
work as expected in the main process. No browser-related methods or
callbacks are currently supported for the Chrome window, and the
application will exit when the last Chrome window closes.

The Chrome runtime requires resources.pak, chrome_100_percent.pak
and chrome_200_percent.pak files which were not previously built
with CEF. It shares the existing locales pak files which have been
updated to include additional Chrome-specific strings.

On Linux, the Chrome runtime requires GTK so use_gtk=true must be
specified via GN_DEFINES when building.

This change also refactors the CEF runtime, which can be tested in
the various supported modes by running:
$ cefclient
$ cefclient --multi-threaded-message-loop
$ cefclient --external-message-pump
2020-06-29 16:17:23 -04:00
Marshall Greenblatt 049caf9131 Refactor process execution logic (see issue #2969)
CefContext implements the public CEF API functions and delegates
the stages of content & service_manager process execution to
CefMainRunner. CEF-specific runtime logic (which may be replaced
with chrome-specific runtime logic) is then delegated to
CefMainDelegate which implements content::ContentMainDelegate.
2020-06-29 16:17:13 -04:00
Marshall Greenblatt 39aed35644 Add support for direct DevTools protocol messaging (fixes issue #2961).
This change allows the client to directly send and receive DevTools
protocol messages (send method calls, and receive method results and
events) without requiring a DevTools front-end or remote-debugging
session.

This change includes additional supporting changes:
- Add a new CefRequestHandler::OnDocumentAvailableInMainFrame
  callback (see issue #1454).
- Add a CefParseJSON variant that accepts a UTF8-encoded buffer.
- Add a `--devtools-protocol-log-file=<path>` command-line flag for
  logging protocol messages sent to/from the DevTools front-end
  while it is displayed. This is useful for understanding existing
  DevTools protocol usage.
- Add a new "libcef_static_unittests" executable target to support
  light-weight unit tests of libcef_static internals (e.g. without
  requiring exposure via the CEF API). Files to be unittested are
  placed in the new "libcef_static_unittested" source_set which is
  then included by both the existing libcef_static library and the
  new unittests executable target.
- Linux: Remove use_bundled_fontconfig=false, which is no longer
  required and causes unittest build errors (see issue #2424).

This change also adds a cefclient demo for configuring offline mode
using the DevTools protocol (fixes issue #245). This is controlled
by the "Offline mode" context menu option and the `--offline`
command-line switch which will launch cefclient in offline mode. When
cefclient is offline all network requests will fail with
ERR_INTERNET_DISCONNECTED and navigator.onLine will return false when
called from JavaScript in any frame. This mode is per-browser so
newly created browser windows will have the default mode. Note that
configuring offline mode in this way will not update the Network tab
UI ("Throtting" option) in a displayed DevTools front-end instance.
2020-06-19 22:15:22 -04:00
Alexander Guettler 790d248111 Update to Chromium version 84.0.4147.0 (#768962) 2020-06-10 15:26:29 -04:00
Marshall Greenblatt 31d3e88d32 Add |client_| nullptr check in CefBrowserHostImpl::CanDragEnter (fixes issue #2934) 2020-05-13 14:30:44 -04:00
Marshall Greenblatt 8c996d2efd Remember the user-selected printer by default (fixes issue #2875) 2020-05-13 13:10:08 -04:00
Marshall Greenblatt aa4473e2c6 Fix registration of WebSafe schemes (fixes issue #2929) 2020-05-11 18:11:53 -04:00
Mike Wiedenbauer 8d01442d75 Re-implement audio capturing based on the AudioService API (fixes issue #2755) 2020-05-01 18:18:18 +00:00
Marshall Greenblatt 7c6e53ddfb Save LocalPrefs.json in CefSettings.root_cache_path (see issue #2890) 2020-04-29 15:36:29 -04:00
Marshall Greenblatt ff0c36b465 Add CefMediaSink::GetIconType (see issue #2900)
This attribute is useful for identifying different classes of cast devices
without first requiring a connection (CAST, CAST_AUDIO, CAST_AUDIO_GROUP, etc).
2020-04-29 15:01:12 -04:00
Vladislav dafce45e49 Fix OSR resize issue with DPI scaling (fixes issue #2733) 2020-04-27 16:48:06 +00:00
Dmitry Azaraev be6af15754 Add SameSite (same_site) and Priority attributes to CefCookie (fixes issue #2524)
This change also restores the Chromium default values for the
SameSiteByDefaultCookies and CookiesWithoutSameSiteMustBeSecure features. See
https://www.chromium.org/updates/same-site for feature details and rollout
timeline.
2020-04-24 17:48:26 -04:00
Marshall Greenblatt cbc0625272 Revert "Fix background color assignment for popups (fixes issue #2482)"
This change is causing the OSRTest.OsrPopupJSOtherClient test to fail.

This reverts commit 3adb801ca8.
2020-04-24 15:41:07 -04:00
Marshall Greenblatt fd1f465fa7 Normalize path values and add additional error logging (fixes issue #2405)
This change also improves the settings documentation and enforces the
requirement that path values be absolute (see issue #2916).
2020-04-23 17:51:19 -04:00