Commit Graph

1240 Commits

Author SHA1 Message Date
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
Cristian Amarie 7b518511df Fix crash when reading malformed Flash manifest file (fixes issue #2948) 2020-06-30 18:44:14 +00:00
Marshall Greenblatt 5c1118230d Windows: Fix CefCookieVisitor crash on invalid date (fixes issue #2927) 2020-06-30 14:32:48 -04: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 d8b4281c06 Fix window.print() of PDF file (fixes issue #2987) 2020-05-12 16:25:13 -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
Marshall Greenblatt 3adb801ca8 Fix background color assignment for popups (fixes issue #2482) 2020-04-23 13:47:10 -04:00
Marshall Greenblatt ccf7b28723 Fix PDF extension loading of large files (fixes issue #2905)
The PDF extension will send Range requests when loading large PDF files. For
these cross-origin requests to be allowed (from extension origin to PDF origin)
the CORB checks in URLLoader must be disabled.
2020-04-22 16:26:22 -04:00
Alex Maitland e876217e24 Change cef_pdf_print_settings_t custom margins from double to int (fixes issue #2694) 2020-04-21 18:44:52 +00:00
Mike Wiedenbauer ec0c57d0e1 Fix OSR keyboard input for editable PDF (fixes issue #2907) 2020-04-21 18:30:52 +00:00
Jengerer 87a7c4f94b Fix handling of partial range request (fixes issue #2873) 2020-04-20 13:19:42 -04:00
Marshall Greenblatt 27257d0288 Remove DCHECK in InterceptedRequest::OnReceiveRedirect (fixes issue #2917) 2020-04-20 12:38:31 -04:00
Marshall Greenblatt 245bc9bfab Windows: Early init parental controls to avoid blocking assertions 2020-04-15 21:46:31 -04:00
Marshall Greenblatt fa519f5108 Update to Chromium version 83.0.4103.0 (#756066) 2020-04-15 16:47:50 -04:00
Mike Wiedenbauer 30d83cb94a Fix AltGr handling for OSR keyboard events (fixes issue #2892) 2020-04-08 15:43:39 +00:00
Mike Wiedenbauer f5c79bf50c Linux: Fix CefPrintHandler callbacks from PDF viewer (fixes issue #2906) 2020-04-02 21:26:14 +00:00
Vladislav a5de549456 Fix OSR popup position when the view origin is offset in screen coords (fixes issue #2902) 2020-04-02 21:14:28 +00:00
rcdrone bdaa857c49 Windows: Disable the sandbox if windows_sandbox_info is null
This restores the behavior prior to revision 438382c. Calling
InitializeSandboxInfo from inside libcef won’t work unless libcef is
statically linked with the executable, so there's no point in doing so.
See the Chromium sandbox docs for background.
2020-04-02 21:11:16 +00:00
Cristian Amarie 1c14900093 Remove unexpected content headers when converting from POST to GET request on 302 redirect response (fixes issue #2883) 2020-04-02 21:05:07 +00:00
Andrei Kurushin 01f385a6f7 Fix CefFrame::GetSource crash on detached frame (fixes issue #2898) 2020-04-02 21:01:33 +00:00
Mike Wiedenbauer cf6b57d659 Enable smooth scrolling with OSR (fixes issue #2895) 2020-04-02 20:59:26 +00:00
Marshall Greenblatt 047e8f9349 Update to Chromium version 82.0.4085.0 (#749737)
- Building on macOS now requires the 10.15 SDK. Xcode 11.3 is recommended as
  Xcode 11.4 is not currently supported (see https://crbug.com/1065146).
- Jumbo build configuration is no longer supported.

Chromium is skipping the M82 release and consequently no CEF 4085 branch will
be created. For details on the Chromium decision see
https://groups.google.com/a/chromium.org/d/msg/chromium-dev/Vn7uzglqLz0/JItlSrZxBAAJ
2020-04-02 13:20:25 -04:00
Marshall Greenblatt 3d87a68561 Always persist local_state by default (fixes issue #2890)
If a cache_path is specified local_state will now be persisted to a
LocalPrefs.json file. This is necessary because local_state is used to store
the cookie encryption key on Windows.
2020-04-01 17:06:19 -04:00
Marshall Greenblatt 869ae21c9f Convert CefCookieManagerImpl to use CefBrowserContext::Getter.
With this change CefCookieManagerImpl no longer keeps a reference to the
originating CefRequestContextImpl. This means that the CefRequestContextImpl
can be destroyed if all other references are released while the
CefCookieManagerImpl exists. If CefRequestContextImpl destruction results in
the underlying CefBrowserContext being destroyed then the CefCookieManagerImpl's
reference to that CefBrowserContext will be invalidated.

This is the same ownership model introduced with CefMediaRouterImpl in the
previous commit.
2020-03-27 16:22:34 -04:00
Marshall Greenblatt 03fd5b15da Add support for media device discovery and messaging (fixes issue #2900)
Chromium supports communication with media devices on the local network via
the Cast and DIAL protocols. This takes two primary forms:

1. Messaging, where strings representing state information are passed between
   the client and a dedicated receiver app on the media device. The receiver
   app communicates directly with an app-specific backend service to retrieve
   and possibly control media playback.
2. Tab/desktop mirroring, where the media contents are streamed directly from
   the browser to a generic streaming app on the media device and playback is
   controlled by the browser.

This change adds support for device discovery and messaging (but not
mirroring) with functionality exposed via the new CefMediaRouter interface.

To test: Navigate to http://tests/media_router in cefclient and follow the
on-screen instructions.
2020-03-27 15:54:39 -04:00
Vladislav fecd582035 Fix OSR crash on window.open with new client (fixes issue #2894) 2020-03-06 19:51:58 +00:00
Andy Tzeng 180e9bd362 Support fragment (hash) component in CefParseURL (fixes issue #2896) 2020-03-06 17:40:28 +00:00
rcdrone 438382c5df Windows: Skip InitializeSandboxInfo if no_sandbox is true
The InitializeSandboxInfo method applies mitigations to the main process
that are inappropriate when the sandbox is disabled.
2020-03-05 17:52:41 +00:00
Marshall Greenblatt 9d9ee8b45f Update to Chromium version 81.0.4044.0 (#737173) 2020-03-04 19:31:54 -05:00
Marshall Greenblatt 8c6cc302d0 Fix OSR surface sizing on browser resize (fixes issue #2733).
This includes the following changes:
- Update usage of surface IDs to match the Aura implementation from the
  RWHVAura/Window classes.
- Batch CefBrowserHost::WasResized calls to avoid excessive/unnecessary calls
  to SynchronizeVisualProperties.
- Cache the results of CefRenderHandler::GetViewRect after resize and make
  RWHVOSR::GetViewBounds the source of truth for all size calculations.
- Fix bounds calculations in CefVideoConsumerOSR with GPU enabled.

Known issues:
- The size passed to OnPaint may be off by 1 pixel in cases where the device
  scale factor is not 1 and does not divide evenly into the pixel size. This is
  due to the inexact conversion from integer pixel size to integer logical size
  for GetViewRect.
2020-02-21 15:02:52 -05:00