Compare commits

..

63 Commits
4692 ... 4844

Author SHA1 Message Date
Marshall Greenblatt
71e9523743 Set dcheck_always_on=false for cef_sandbox Release builds (fixes issue #3302) 2022-03-31 16:13:16 -04:00
Marshall Greenblatt
3f796b8bc7 Update to Chromium version 99.0.4844.84 2022-03-29 15:13:19 +00:00
Marshall Greenblatt
d9af8665d0 Update to Chromium version 99.0.4844.83 2022-03-21 13:59:39 +00:00
Marshall Greenblatt
2977b3a12c Update to Chromium version 99.0.4844.74 2022-03-16 19:08:59 +00:00
Marshall Greenblatt
35f91954f8 Fix DevTools crash due to unknown .md mime type (fixes issue #3278) 2022-03-15 13:08:46 -04:00
Marshall Greenblatt
fecf7ca2cb Fix shutdown crash in RenderProcessHostImpl::Cleanup (fixes issue #3276)
Execute all pending UI thread tasks at the beginning of the shutdown sequence.
2022-03-09 15:57:27 -05:00
Marshall Greenblatt
f42676506b alloy: Fix PDF download 'With your changes' (fixes issue #3169) 2022-03-04 14:01:21 -05:00
Marshall Greenblatt
55f7a3c8a6 alloy: Fix print preview Save as PDF (fixes issue #2867) 2022-03-04 14:01:14 -05:00
Cristian Amarie
674fc0124f alloy: Fix crash when downloading a modified PDF form (see issue #3169)
Create a CefFileSystemDelegate based on the ShellFileSystemDelegate placeholder
implementation. An actual implementation will still be required to properly
support this download functionality.
2022-03-02 15:44:35 -05:00
Marshall Greenblatt
f1f3fc871c Update to Chromium version 99.0.4844.51 2022-03-01 17:38:21 +00:00
Marshall Greenblatt
75e15a91bd Update to Chromium version 99.0.4844.45 2022-02-28 18:12:13 -05:00
Hunter Laux
8b70990bf9 Fix std::result_of deprecation error in C++17 (fixes issue #3194) 2022-02-24 12:35:57 -05:00
Sergey Markelov
962d9c90ad Fix documentation typo in cef_sandbox_win.h 2022-02-18 17:04:57 -05:00
Jun Tseng
77a4b405e3 Fix incorrect then/than usage in docs 2022-02-18 17:04:46 -05:00
Marshall Greenblatt
e4e11990c7 Include PDF resource IDs in cef_pack_resources.h (fixes issue #3172) 2022-02-18 16:56:58 -05:00
Marshall Greenblatt
6b54de52b6 Update context menu type enums to match Chromium (fixes issue #3257) 2022-02-18 16:46:07 -05:00
Marshall Greenblatt
6eedb28faf alloy: Fix printing of PDF viewer (see issue #3047)
Match the logic for printing::StartPrint() used by Chrome.
2022-02-18 11:35:57 -05:00
Marshall Greenblatt
34800dbe2e alloy: Implement Find() using find_in_page::FindTabHelper (fixes issue #3098, see issue #3047)
The find behavior should now match Chrome.
2022-02-17 13:57:16 -05:00
Marshall Greenblatt
3f59363425 chrome: Disable Chrome WebUI factory registration (see issue #3047)
Disable the initial Chrome factory registration in ChromeBrowserMainParts
so that all WebUI loading goes through CefWebUIControllerFactory.
2022-02-16 18:23:50 -05:00
Marshall Greenblatt
e7aa571012 Revert "chrome: Simplify WebUIControllerFactory registration (see issue #3047)"
Still need to unregister the Content-level factory to stop Alloy loading
unsupported pages.

This reverts commit a21d0c41a4.
2022-02-16 18:22:32 -05:00
Marshall Greenblatt
a21d0c41a4 chrome: Simplify WebUIControllerFactory registration (see issue #3047)
Disable the initial Chrome factory registration in ChromeBrowserMainParts
instead of trying to unregister those factories at a later point.
2022-02-16 18:05:29 -05:00
Marshall Greenblatt
61886e6d21 Revert "chrome: Fix loading of CEF-specific WebUI pages (see issue #2969)"
The change is actually unnecessary.

This reverts commit 5ddc8bd65c.
2022-02-16 17:42:25 -05:00
Marshall Greenblatt
5ddc8bd65c chrome: Fix loading of CEF-specific WebUI pages (see issue #2969)
Disable the code in ChromeContentBrowserClient::HandleWebUI that explicitly
fails WebUI not handled by ChromeWebUIControllerFactory. This allows CEF to
evaluate it via CefWebUIControllerFactory instead.
2022-02-16 17:31:52 -05:00
Marshall Greenblatt
0fc092c4aa alloy: Add support for chrome-untrusted scheme (see issue #3047)
Lack of this functionality was causing print preview to fail with
PdfUnseasoned enabled.
2022-02-16 17:28:07 -05:00
Marshall Greenblatt
7909550112 Fix incorrect patch of constrained_web_dialog_ui.cc 2022-02-16 16:26:44 -05:00
Marshall Greenblatt
a5c0963deb Add support for the chrome-untrusted scheme (see issue #3047)
Lack of this functionality was causing print preview to fail with
PdfUnseasoned enabled.
2022-02-16 16:25:10 -05:00
Marshall Greenblatt
f01b1bc66c Support reconnect of the mojo frame channel (fixes issue #3260)
The mojo channel used for frame communication may disconnect for a variety of
reasons including frame navigation, frame destruction, or insertion into the
BackForwardCache (when the browser-side frame representation is destroyed and
closes the connection). When disconnect occurs we now evaluate the situation
and reconnect if appropriate.

Connections are now initiated solely from the renderer process and the
RenderFrame is passed as an argument to FrameAttached() instead of being
retrieved independently. Messages are queued while the frame is disconnected
and sent only after FrameAttachedAck() is received from the browser process.
The renderer process will be crashed intentionally with a "connection retry
failure" message if the reconnect fails 3 times in a row.
2022-02-14 14:50:06 -05:00
Marshall Greenblatt
be54d4572f Update to Chromium version 99.0.4844.27 2022-02-10 13:43:45 -05:00
Marshall Greenblatt
50ec41ca0c Fix includes path for Linux ARM cross-compile (see issue #2926) 2022-02-09 16:52:26 -05:00
Marshall Greenblatt
ed8d1b315a Make cef_config.h discoverable from patched Chromium targets (see issue #2926)
Add the generated includes/ directory to CEF's "config" so that source files
included in patched Chromium targets (for example, blink_glue.cc) can find
cef_config.h which will be included via `include/internal/cef_types_linux.h`
on Linux.
2022-02-08 13:19:58 -05:00
Marshall Greenblatt
63a1e584bc Remove cef_config.h from cef_paths2.gypi (see issue #2926) 2022-02-05 00:49:21 +00:00
Marshall Greenblatt
c5da38dee7 Make cef_config.h generation a dependency of libcef_dll_wrapper (see issue #2926)
The libcef_dll_wrapper target may be built very early due to minimal
dependencies. Make sure that cef_config.h is generated first as it will be
included via `include/internal/cef_types_linux.h` on Linux.
2022-02-02 15:11:54 -05:00
Marshall Greenblatt
5491502a52 alloy: Fix extension function registration for print preview dialog (fixes issue #3167) 2022-02-02 14:45:53 -05:00
Marshall Greenblatt
9ed0ce82d9 Generate cef_config.h as a build-time step (fixes issue #2926) 2022-02-02 12:33:12 -05:00
Marshall Greenblatt
9e5e8208d8 alloy: Move ExtensionsBrowserClient ownership to BrowserProcess (fixes issue #3247)
Fixes a shutdown crash due to `ExtensionsBrowserClient::Set(nullptr)` being
called too early. Some code that may occasionally be triggered via
`content::ContentMainShutdown()` is expecting the extensions objects to still
be valid.

This new ownership pattern matches the code in chrome/.
2022-01-28 16:32:14 -05:00
Marshall Greenblatt
71b315d55c Remove DCHECK that triggers while loading DevTools resources
See https://crbug.com/1289230 for background.
2022-01-28 12:14:41 -05:00
Marshall Greenblatt
ec0a26124c Update to Chromium version 99.0.4844.9 2022-01-27 20:30:10 -05:00
Marshall Greenblatt
303280dd71 alloy: Fix shutdown assert if OneShotTimer is deleted on the wrong thread 2022-01-26 21:10:29 -05:00
Marshall Greenblatt
1e1133ec66 Update to Chromium version 99.0.4844.0 (#961656) 2022-01-26 21:10:29 -05:00
Marshall Greenblatt
c32f366dfa Migrate ignore_result to std::ignore (see issue #3234)
See https://crbug.com/1285085 for background.
2022-01-25 14:40:53 -05:00
Marshall Greenblatt
ebde595370 Convert defined(OS_XXX) to BUILDFLAG(IS_XXX) in libcef
See https://crbug.com/1234043 for background.
2022-01-24 12:58:04 -05:00
Shezan Baig
7b0bb931b1 Fix notification for focused frame (fixes issue #3248) 2022-01-24 16:13:32 +00:00
Marshall Greenblatt
51e8bd9bd8 chrome: Fix crash when clicking Reading List sidebar link (fixes issue #3128) 2022-01-14 13:52:56 -05:00
Marshall Greenblatt
9276dba712 cefclient: Disable alert on space bar press (see issue #3184)
This will be reverted after issue #3184 is resolved.
2022-01-14 12:15:26 -05:00
Nick Mueller
029cc67915 Fix OSR resize issue when multiple monitors have different scale factors (fixes issue #3240) 2022-01-14 12:04:38 -05:00
Marshall Greenblatt
17d51ceed0 Revert "Fix OSR resize issue when multiple monitors have different scale factors (fixes issue #3240)"
This reverts commit 9e416a7921.

Reverted due to compile error.
2022-01-14 12:04:06 -05:00
Nick Mueller
9e416a7921 Fix OSR resize issue when multiple monitors have different scale factors (fixes issue #3240) 2022-01-14 16:50:23 +00:00
Marshall Greenblatt
031c8a7f52 chrome: Fix crashes when toggling full-screen mode (fixes issue #3182) 2022-01-12 18:11:27 -05:00
Marshall Greenblatt
2428b35f6c alloy: Disable bfcache (see issue #3237)
This will be reverted if the bfcache issue is fixed.
2022-01-10 17:32:22 -05:00
Marshall Greenblatt
ff0e5c0348 Fix possible use after shutdown of BrowserContext (fixes issue #3193) 2022-01-10 17:21:07 -05:00
Marshall Greenblatt
839fdb211c Fix certificate errors with restarted/redirected requests (fixes issue #3200)
URLLoaderNetworkServiceObserver is used for routing certificate and
authentication callbacks from the NetworkService to the associated
StoragePartition instance. With request interception enabled this object was
previously only assigned for the initial request. This change adds assignment
for restarted/redirected requests as well.
2022-01-06 20:53:00 -05:00
Marshall Greenblatt
2b9a06933b Update copyright year in generated files 2022-01-06 13:34:35 -05:00
Marshall Greenblatt
2f5e1b621e Mac: Use system allocator instead of PartitionAlloc (fixes issue #3061)
This change disables PartitionAlloc and the related allocator shim. Using the
system allocator makes it easier to integrate with client applications which
may perform allocations before initializing CEF.
2021-12-18 15:57:49 -05:00
Marshall Greenblatt
dfc0131516 Update to Chromium version 98.0.4758.0 (#950365) 2021-12-18 15:57:34 -05:00
Marshall Greenblatt
b76badd958 Remove DISALLOW_ macro from include/ (see issue #3234)
Also perform related C++ cleanup:
- Use =default instead of {} for default implementations of
  constructors/destructors.
- Replace typedef with using.
2021-12-07 15:02:28 -05:00
Marshall Greenblatt
1eb55cbba8 Remove DISALLOW_ macro from libcef_dll/ (see issue #3234)
Also perform related C++ cleanup:
- Use =default instead of {} for default implementations of
  constructors/destructors.
- Replace typedef with using.
2021-12-07 15:02:28 -05:00
Marshall Greenblatt
9484d6528c Remove DISALLOW_ macro from libcef/ (see issue #3234)
Also perform related C++ cleanup:
- Use =default instead of {} for default implementations of
  constructors/destructors.
- Replace typedef with using.
2021-12-07 15:02:28 -05:00
Marshall Greenblatt
83ffc1f00d Add kPdfRenderer define for non-Windows platforms (see issue #3047)
This switch is currently only defined for Windows in
content/public/common/content_switches.h.
2021-12-02 12:37:02 -05:00
Marshall Greenblatt
f4d5395c4b Skip GetNewBrowserInfo call for PDF renderer processes (see issue #3047)
With PdfUnseasoned the PDF file will be loaded in a dedicated renderer process.
We identify this process by adding the kPdfRenderer command-line flag (similar
to how kExtensionProcess is used to identify an extension renderer process). We
then avoid calling GetNewBrowserInfo for the PDF renderer process because we
know the request will otherwise time out.
2021-11-29 15:46:39 -05:00
Nicolas Dusart
f6cf7f9ec7 Fix CefURLRequest crash with failing HEAD requests (fixes issue #3226) 2021-11-23 22:14:59 +00:00
Marshall Greenblatt
c75ebbccec alloy: Add support for the new non-PPAPI PDF viewer (see issue #3047)
Enable by passing `--enable-features=PdfUnseasoned` on the command line.
2021-11-23 16:38:16 -05:00
Marshall Greenblatt
d6d316e304 Fix discontinued/outdated External Projects links (fixes issue #3225) 2021-11-23 11:50:32 -05:00
Sarah
833612ba9a Prevent possible null dereference in ctocpp_ref_counted.h (fixes issue #3218) 2021-11-22 15:28:06 +00:00
402 changed files with 3577 additions and 2673 deletions

View File

@@ -96,6 +96,7 @@
import("//base/allocator/allocator.gni") import("//base/allocator/allocator.gni")
import("//build/config/features.gni") import("//build/config/features.gni")
import("//build/config/locales.gni") import("//build/config/locales.gni")
import("//build/config/ozone.gni")
import("//build/config/sanitizers/sanitizers.gni") import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/ui.gni") import("//build/config/ui.gni")
import("//chrome/common/features.gni") import("//chrome/common/features.gni")
@@ -306,7 +307,7 @@ group("cef") {
":libcef_static_unittests", ":libcef_static_unittests",
] ]
if (!is_linux || use_x11) { if (!is_linux || ozone_platform_x11) {
deps += [ ":cefclient" ] deps += [ ":cefclient" ]
} }
} }
@@ -488,6 +489,8 @@ static_library("libcef_static") {
"libcef/browser/download_manager_delegate.h", "libcef/browser/download_manager_delegate.h",
"libcef/browser/extension_impl.cc", "libcef/browser/extension_impl.cc",
"libcef/browser/extension_impl.h", "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.cc",
"libcef/browser/extensions/api/storage/sync_value_store_cache.h", "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.cc",
@@ -524,8 +527,6 @@ static_library("libcef_static") {
"libcef/browser/extensions/extension_web_contents_observer.h", "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.cc",
"libcef/browser/extensions/mime_handler_view_guest_delegate.h", "libcef/browser/extensions/mime_handler_view_guest_delegate.h",
"libcef/browser/extensions/pdf_web_contents_helper_client.cc",
"libcef/browser/extensions/pdf_web_contents_helper_client.h",
"libcef/browser/extensions/value_store/cef_value_store.cc", "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.h",
"libcef/browser/extensions/value_store/cef_value_store_factory.cc", "libcef/browser/extensions/value_store/cef_value_store_factory.cc",
@@ -944,10 +945,6 @@ static_library("libcef_static") {
"libcef/browser/native/native_menu_win.h", "libcef/browser/native/native_menu_win.h",
"libcef/browser/osr/browser_platform_delegate_osr_win.cc", "libcef/browser/osr/browser_platform_delegate_osr_win.cc",
"libcef/browser/osr/browser_platform_delegate_osr_win.h", "libcef/browser/osr/browser_platform_delegate_osr_win.h",
# Part of //chrome/utility.
"//chrome/utility/printing_handler.cc",
"//chrome/utility/printing_handler.h",
] ]
deps += [ deps += [
@@ -983,7 +980,7 @@ static_library("libcef_static") {
"libcef/browser/printing/print_dialog_linux.h", "libcef/browser/printing/print_dialog_linux.h",
] ]
if (use_x11) { if (ozone_platform_x11) {
sources += [ sources += [
"libcef/browser/native/window_x11.cc", "libcef/browser/native/window_x11.cc",
"libcef/browser/native/window_x11.h", "libcef/browser/native/window_x11.h",
@@ -995,7 +992,7 @@ static_library("libcef_static") {
"//third_party/fontconfig", "//third_party/fontconfig",
] ]
if (is_linux && !use_x11) { if (is_linux && !ozone_platform_x11) {
deps += [ deps += [
"//third_party/angle:libEGL", "//third_party/angle:libEGL",
] ]
@@ -1027,7 +1024,7 @@ static_library("libcef_static") {
deps += [ "//third_party/crashpad/crashpad/handler" ] deps += [ "//third_party/crashpad/crashpad/handler" ]
} }
if (use_x11) { if (ozone_platform_x11) {
deps += [ "//ui/events/devices/x11" ] deps += [ "//ui/events/devices/x11" ]
} }
@@ -1201,7 +1198,7 @@ static_library("libcef_static") {
"//ui/ozone:generate_test_support_constructor_list", "//ui/ozone:generate_test_support_constructor_list",
] ]
if (use_x11) { if (ozone_platform_x11) {
sources += [ sources += [
# Support for UI input events. # Support for UI input events.
# Part of //ui/base/x:test_support which is testingonly. # Part of //ui/base/x:test_support which is testingonly.
@@ -1296,6 +1293,8 @@ static_library("libcef_dll_wrapper") {
configs += [ ":libcef_dll_wrapper_config" ] configs += [ ":libcef_dll_wrapper_config" ]
public_configs = [ ":libcef_dll_wrapper_config" ] public_configs = [ ":libcef_dll_wrapper_config" ]
deps = [ ":cef_make_headers" ]
} }
@@ -1382,6 +1381,7 @@ make_pack_header("resources") {
"$root_gen_dir/chrome/grit/common_resources.h", "$root_gen_dir/chrome/grit/common_resources.h",
"$root_gen_dir/chrome/grit/component_extension_resources.h", "$root_gen_dir/chrome/grit/component_extension_resources.h",
"$root_gen_dir/chrome/grit/dev_ui_browser_resources.h", "$root_gen_dir/chrome/grit/dev_ui_browser_resources.h",
"$root_gen_dir/chrome/grit/pdf_resources.h",
"$root_gen_dir/chrome/grit/renderer_resources.h", "$root_gen_dir/chrome/grit/renderer_resources.h",
"$root_gen_dir/components/grit/components_resources.h", "$root_gen_dir/components/grit/components_resources.h",
"$root_gen_dir/components/grit/dev_ui_components_resources.h", "$root_gen_dir/components/grit/dev_ui_components_resources.h",
@@ -1407,6 +1407,7 @@ make_pack_header("resources") {
"//chrome/browser:dev_ui_browser_resources", "//chrome/browser:dev_ui_browser_resources",
"//chrome/browser:resources", "//chrome/browser:resources",
"//chrome/browser/resources:component_extension_resources", "//chrome/browser/resources:component_extension_resources",
"//chrome/browser/resources/pdf:resources",
"//chrome/common:resources", "//chrome/common:resources",
"//chrome/renderer:resources", "//chrome/renderer:resources",
"//components/resources:components_resources", "//components/resources:components_resources",
@@ -1447,6 +1448,7 @@ make_pack_header("strings") {
"$root_gen_dir/components/strings/grit/components_strings.h", "$root_gen_dir/components/strings/grit/components_strings.h",
"$root_gen_dir/extensions/strings/grit/extensions_strings.h", "$root_gen_dir/extensions/strings/grit/extensions_strings.h",
"$root_gen_dir/services/strings/grit/services_strings.h", "$root_gen_dir/services/strings/grit/services_strings.h",
"$root_gen_dir/third_party/blink/public/strings/grit/blink_accessibility_strings.h",
"$root_gen_dir/third_party/blink/public/strings/grit/blink_strings.h", "$root_gen_dir/third_party/blink/public/strings/grit/blink_strings.h",
"$root_gen_dir/ui/strings/grit/ui_strings.h", "$root_gen_dir/ui/strings/grit/ui_strings.h",
] ]
@@ -1464,6 +1466,7 @@ make_pack_header("strings") {
"//extensions/strings", "//extensions/strings",
"//services/strings", "//services/strings",
"//third_party/blink/public/strings", "//third_party/blink/public/strings",
"//third_party/blink/public/strings:accessibility_strings",
"//ui/strings:app_locale_settings", "//ui/strings:app_locale_settings",
"//ui/strings:ui_strings", "//ui/strings:ui_strings",
] ]
@@ -1486,12 +1489,22 @@ action("make_api_hash_header") {
args = rebase_path(outputs + include_dir, root_build_dir) args = rebase_path(outputs + include_dir, root_build_dir)
} }
# Generate cef_config.h.
action("make_config_header") {
script = "tools/make_config_header.py"
outputs = [ "$root_out_dir/includes/include/cef_config.h" ]
args = rebase_path(outputs + [ "$root_out_dir/args.gn" ], root_build_dir)
}
# Generate pack files and associated CEF header files. # Generate pack files and associated CEF header files.
group("cef_make_headers") { group("cef_make_headers") {
deps = [ deps = [
":make_pack_header_resources", ":make_pack_header_resources",
":make_pack_header_strings", ":make_pack_header_strings",
":make_api_hash_header", ":make_api_hash_header",
":make_config_header",
] ]
} }
@@ -2249,7 +2262,7 @@ if (is_mac) {
sources += includes_linux + sources += includes_linux +
gypi_paths2.cefsimple_sources_linux gypi_paths2.cefsimple_sources_linux
if (use_x11) { if (ozone_platform_x11) {
libs = [ libs = [
"X11", "X11",
] ]
@@ -2309,7 +2322,7 @@ if (is_mac) {
sources += gypi_paths2.shared_sources_linux + sources += gypi_paths2.shared_sources_linux +
gypi_paths2.ceftests_sources_linux gypi_paths2.ceftests_sources_linux
if (use_x11) { if (ozone_platform_x11) {
libs = [ libs = [
"X11", "X11",
] ]

View File

@@ -7,6 +7,6 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding # https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{ {
'chromium_checkout': 'refs/tags/97.0.4692.99', 'chromium_checkout': 'refs/tags/99.0.4844.84',
'depot_tools_checkout': 'f7b8f8f3cd' 'depot_tools_checkout': '289dedd36b'
} }

View File

@@ -45,15 +45,11 @@ The base CEF framework includes support for the C and C++ programming languages.
* .Net (CEF3) - https://github.com/cefsharp/CefSharp * .Net (CEF3) - https://github.com/cefsharp/CefSharp
* .Net (CEF1) - https://bitbucket.org/fddima/cefglue * .Net (CEF1) - https://bitbucket.org/fddima/cefglue
* .Net/Mono (CEF3) - https://bitbucket.org/xilium/xilium.cefglue * .Net/Mono (CEF3) - https://gitlab.com/xiliumhq/chromiumembedded/cefglue
* .Net (CEF3) - https://bitbucket.org/chromiumfx/chromiumfx * Delphi - https://github.com/hgourvest/dcef3
* Delphi (CEF1) - http://code.google.com/p/delphichromiumembedded/ * Delphi - https://github.com/salvadordf/CEF4Delphi
* Delphi (CEF3) - https://github.com/hgourvest/dcef3
* Delphi (CEF3) - https://github.com/salvadordf/CEF4Delphi
* Go - https://github.com/richardwilkes/cef
* Go - https://github.com/CzarekTomczak/cef2go * Go - https://github.com/CzarekTomczak/cef2go
* Java - https://bitbucket.org/chromiumembedded/java-cef * Java - https://bitbucket.org/chromiumembedded/java-cef
* Java - http://code.google.com/p/javacef/
* Python - http://code.google.com/p/cefpython/ * Python - http://code.google.com/p/cefpython/
If you're the maintainer of a project not listed above and would like your project listed here please either post to the [CEF Forum](http://www.magpcss.org/ceforum/) or contact Marshall directly. If you're the maintainer of a project not listed above and would like your project listed here please either post to the [CEF Forum](http://www.magpcss.org/ceforum/) or contact Marshall directly.

View File

@@ -38,7 +38,6 @@
'include/base/internal/cef_thread_checker_impl.h', 'include/base/internal/cef_thread_checker_impl.h',
'include/cef_api_hash.h', 'include/cef_api_hash.h',
'include/cef_base.h', 'include/cef_base.h',
'include/cef_config.h',
'include/cef_version.h', 'include/cef_version.h',
'include/internal/cef_export.h', 'include/internal/cef_export.h',
'include/internal/cef_ptr.h', 'include/internal/cef_ptr.h',

View File

@@ -45,7 +45,6 @@
#include <atomic> #include <atomic>
#include "include/base/cef_macros.h"
#include "include/base/cef_thread_checker.h" #include "include/base/cef_thread_checker.h"
namespace base { namespace base {
@@ -56,6 +55,10 @@ namespace base {
class AtomicFlag { class AtomicFlag {
public: public:
AtomicFlag(); AtomicFlag();
AtomicFlag(const AtomicFlag&) = delete;
AtomicFlag& operator=(const AtomicFlag&) = delete;
~AtomicFlag(); ~AtomicFlag();
// Set the flag. Must always be called from the same thread. // Set the flag. Must always be called from the same thread.
@@ -76,8 +79,6 @@ class AtomicFlag {
private: private:
std::atomic<uint_fast8_t> flag_{0}; std::atomic<uint_fast8_t> flag_{0};
base::ThreadChecker set_thread_checker_; base::ThreadChecker set_thread_checker_;
DISALLOW_COPY_AND_ASSIGN(AtomicFlag);
}; };
} // namespace base } // namespace base

View File

@@ -156,7 +156,7 @@
// Annotate a function indicating the caller must examine the return value. // Annotate a function indicating the caller must examine the return value.
// Use like: // Use like:
// int foo() WARN_UNUSED_RESULT; // int foo() WARN_UNUSED_RESULT;
// To explicitly ignore a result, see |ignore_result()| in base/macros.h. // To explicitly ignore a result, use std::ignore from <tuple>.
#undef WARN_UNUSED_RESULT #undef WARN_UNUSED_RESULT
#if defined(COMPILER_GCC) || defined(__clang__) #if defined(COMPILER_GCC) || defined(__clang__)
#define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) #define WARN_UNUSED_RESULT __attribute__((warn_unused_result))

View File

@@ -41,7 +41,6 @@
// updated to match. // updated to match.
#include "include/base/cef_logging.h" #include "include/base/cef_logging.h"
#include "include/base/cef_macros.h"
#include "include/base/cef_platform_thread.h" #include "include/base/cef_platform_thread.h"
#include "include/base/internal/cef_lock_impl.h" #include "include/base/internal/cef_lock_impl.h"
@@ -55,6 +54,10 @@ class Lock {
public: public:
#if !DCHECK_IS_ON() // Optimized wrapper implementation #if !DCHECK_IS_ON() // Optimized wrapper implementation
Lock() : lock_() {} Lock() : lock_() {}
Lock(const Lock&) = delete;
Lock& operator=(const Lock&) = delete;
~Lock() {} ~Lock() {}
void Acquire() { lock_.Lock(); } void Acquire() { lock_.Lock(); }
void Release() { lock_.Unlock(); } void Release() { lock_.Unlock(); }
@@ -111,8 +114,6 @@ class Lock {
// Platform specific underlying lock implementation. // Platform specific underlying lock implementation.
LockImpl lock_; LockImpl lock_;
DISALLOW_COPY_AND_ASSIGN(Lock);
}; };
// A helper class that acquires the given Lock while the AutoLock is in scope. // A helper class that acquires the given Lock while the AutoLock is in scope.
@@ -126,6 +127,9 @@ class AutoLock {
lock_.AssertAcquired(); lock_.AssertAcquired();
} }
AutoLock(const AutoLock&) = delete;
AutoLock& operator=(const AutoLock&) = delete;
~AutoLock() { ~AutoLock() {
lock_.AssertAcquired(); lock_.AssertAcquired();
lock_.Release(); lock_.Release();
@@ -133,7 +137,6 @@ class AutoLock {
private: private:
Lock& lock_; Lock& lock_;
DISALLOW_COPY_AND_ASSIGN(AutoLock);
}; };
// AutoUnlock is a helper that will Release() the |lock| argument in the // AutoUnlock is a helper that will Release() the |lock| argument in the
@@ -146,11 +149,13 @@ class AutoUnlock {
lock_.Release(); lock_.Release();
} }
AutoUnlock(const AutoUnlock&) = delete;
AutoUnlock& operator=(const AutoUnlock&) = delete;
~AutoUnlock() { lock_.Acquire(); } ~AutoUnlock() { lock_.Acquire(); }
private: private:
Lock& lock_; Lock& lock_;
DISALLOW_COPY_AND_ASSIGN(AutoUnlock);
}; };
} // namespace cef_internal } // namespace cef_internal
@@ -158,9 +163,9 @@ class AutoUnlock {
// Implement classes in the cef_internal namespace and then expose them to the // Implement classes in the cef_internal namespace and then expose them to the
// base namespace. This avoids conflicts with the base.lib implementation when // base namespace. This avoids conflicts with the base.lib implementation when
// linking sandbox support on Windows. // linking sandbox support on Windows.
using cef_internal::Lock;
using cef_internal::AutoLock; using cef_internal::AutoLock;
using cef_internal::AutoUnlock; using cef_internal::AutoUnlock;
using cef_internal::Lock;
} // namespace base } // namespace base

View File

@@ -164,7 +164,6 @@
#include <string> #include <string>
#include "include/base/cef_build.h" #include "include/base/cef_build.h"
#include "include/base/cef_macros.h"
#include "include/internal/cef_logging_internal.h" #include "include/internal/cef_logging_internal.h"
namespace cef { namespace cef {
@@ -583,6 +582,9 @@ class LogMessage {
LogSeverity severity, LogSeverity severity,
std::string* result); std::string* result);
LogMessage(const LogMessage&) = delete;
LogMessage& operator=(const LogMessage&) = delete;
~LogMessage(); ~LogMessage();
std::ostream& stream() { return stream_; } std::ostream& stream() { return stream_; }
@@ -614,8 +616,6 @@ class LogMessage {
SaveLastError last_error_; SaveLastError last_error_;
#endif #endif
DISALLOW_COPY_AND_ASSIGN(LogMessage);
}; };
// A non-macro interface to the log facility; (useful // A non-macro interface to the log facility; (useful
@@ -655,6 +655,9 @@ class Win32ErrorLogMessage {
LogSeverity severity, LogSeverity severity,
SystemErrorCode err); SystemErrorCode err);
Win32ErrorLogMessage(const Win32ErrorLogMessage&) = delete;
Win32ErrorLogMessage& operator=(const Win32ErrorLogMessage&) = delete;
// Appends the error message before destructing the encapsulated class. // Appends the error message before destructing the encapsulated class.
~Win32ErrorLogMessage(); ~Win32ErrorLogMessage();
@@ -663,8 +666,6 @@ class Win32ErrorLogMessage {
private: private:
SystemErrorCode err_; SystemErrorCode err_;
LogMessage log_message_; LogMessage log_message_;
DISALLOW_COPY_AND_ASSIGN(Win32ErrorLogMessage);
}; };
#elif defined(OS_POSIX) #elif defined(OS_POSIX)
// Appends a formatted system message of the errno type // Appends a formatted system message of the errno type
@@ -675,6 +676,9 @@ class ErrnoLogMessage {
LogSeverity severity, LogSeverity severity,
SystemErrorCode err); SystemErrorCode err);
ErrnoLogMessage(const ErrnoLogMessage&) = delete;
ErrnoLogMessage& operator=(const ErrnoLogMessage&) = delete;
// Appends the error message before destructing the encapsulated class. // Appends the error message before destructing the encapsulated class.
~ErrnoLogMessage(); ~ErrnoLogMessage();
@@ -683,8 +687,6 @@ class ErrnoLogMessage {
private: private:
SystemErrorCode err_; SystemErrorCode err_;
LogMessage log_message_; LogMessage log_message_;
DISALLOW_COPY_AND_ASSIGN(ErrnoLogMessage);
}; };
#endif // OS_WIN #endif // OS_WIN

View File

@@ -32,11 +32,7 @@
#define CEF_INCLUDE_BASE_CEF_MACROS_H_ #define CEF_INCLUDE_BASE_CEF_MACROS_H_
#pragma once #pragma once
#if defined(USING_CHROMIUM_INCLUDES) #if !defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly.
#include "base/macros.h"
#else // !USING_CHROMIUM_INCLUDES
// The following is substantially similar to the Chromium implementation. // The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be // If the Chromium implementation diverges the below implementation should be
// updated to match. // updated to match.
@@ -62,17 +58,6 @@
TypeName() = delete; \ TypeName() = delete; \
DISALLOW_COPY_AND_ASSIGN(TypeName) DISALLOW_COPY_AND_ASSIGN(TypeName)
// Used to explicitly mark the return value of a function as unused. If you are
// really sure you don't want to do anything with the return value of a function
// that has been marked WARN_UNUSED_RESULT, wrap it with this. Example:
//
// std::unique_ptr<MyType> my_var = ...;
// if (TakeOwnership(my_var.get()) == SUCCESS)
// ignore_result(my_var.release());
//
template <typename T>
inline void ignore_result(const T&) {}
#endif // !USING_CHROMIUM_INCLUDES #endif // !USING_CHROMIUM_INCLUDES
#endif // CEF_INCLUDE_BASE_CEF_MACROS_H_ #endif // CEF_INCLUDE_BASE_CEF_MACROS_H_

View File

@@ -49,7 +49,6 @@
#include "include/base/cef_build.h" #include "include/base/cef_build.h"
#include "include/base/cef_compiler_specific.h" #include "include/base/cef_compiler_specific.h"
#include "include/base/cef_logging.h" #include "include/base/cef_logging.h"
#include "include/base/cef_macros.h"
#include "include/base/cef_scoped_refptr.h" #include "include/base/cef_scoped_refptr.h"
#include "include/base/cef_template_util.h" #include "include/base/cef_template_util.h"
#include "include/base/cef_thread_checker.h" #include "include/base/cef_thread_checker.h"
@@ -76,6 +75,9 @@ class RefCountedBase {
#endif #endif
} }
RefCountedBase(const RefCountedBase&) = delete;
RefCountedBase& operator=(const RefCountedBase&) = delete;
~RefCountedBase() { ~RefCountedBase() {
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
DCHECK(in_dtor_) << "RefCounted object deleted without calling Release()"; DCHECK(in_dtor_) << "RefCounted object deleted without calling Release()";
@@ -168,8 +170,6 @@ class RefCountedBase {
mutable bool in_dtor_ = false; mutable bool in_dtor_ = false;
mutable ThreadChecker thread_checker_; mutable ThreadChecker thread_checker_;
#endif #endif
DISALLOW_COPY_AND_ASSIGN(RefCountedBase);
}; };
class RefCountedThreadSafeBase { class RefCountedThreadSafeBase {
@@ -186,6 +186,9 @@ class RefCountedThreadSafeBase {
#endif #endif
} }
RefCountedThreadSafeBase(const RefCountedThreadSafeBase&) = delete;
RefCountedThreadSafeBase& operator=(const RefCountedThreadSafeBase&) = delete;
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
~RefCountedThreadSafeBase(); ~RefCountedThreadSafeBase();
#else #else
@@ -259,8 +262,6 @@ class RefCountedThreadSafeBase {
mutable bool needs_adopt_ref_ = false; mutable bool needs_adopt_ref_ = false;
mutable bool in_dtor_ = false; mutable bool in_dtor_ = false;
#endif #endif
DISALLOW_COPY_AND_ASSIGN(RefCountedThreadSafeBase);
}; };
// ScopedAllowCrossThreadRefCountAccess disables the check documented on // ScopedAllowCrossThreadRefCountAccess disables the check documented on
@@ -357,6 +358,9 @@ class RefCounted : public cef_subtle::RefCountedBase {
RefCounted() : cef_subtle::RefCountedBase(T::kRefCountPreference) {} RefCounted() : cef_subtle::RefCountedBase(T::kRefCountPreference) {}
RefCounted(const RefCounted&) = delete;
RefCounted& operator=(const RefCounted&) = delete;
void AddRef() const { cef_subtle::RefCountedBase::AddRef(); } void AddRef() const { cef_subtle::RefCountedBase::AddRef(); }
void Release() const { void Release() const {
@@ -379,8 +383,6 @@ class RefCounted : public cef_subtle::RefCountedBase {
static void DeleteInternal(const U* x) { static void DeleteInternal(const U* x) {
delete x; delete x;
} }
DISALLOW_COPY_AND_ASSIGN(RefCounted);
}; };
// Forward declaration. // Forward declaration.
@@ -424,6 +426,9 @@ class RefCountedThreadSafe : public cef_subtle::RefCountedThreadSafeBase {
explicit RefCountedThreadSafe() explicit RefCountedThreadSafe()
: cef_subtle::RefCountedThreadSafeBase(T::kRefCountPreference) {} : cef_subtle::RefCountedThreadSafeBase(T::kRefCountPreference) {}
RefCountedThreadSafe(const RefCountedThreadSafe&) = delete;
RefCountedThreadSafe& operator=(const RefCountedThreadSafe&) = delete;
void AddRef() const { AddRefImpl(T::kRefCountPreference); } void AddRef() const { AddRefImpl(T::kRefCountPreference); }
void Release() const { void Release() const {
@@ -450,8 +455,6 @@ class RefCountedThreadSafe : public cef_subtle::RefCountedThreadSafeBase {
void AddRefImpl(cef_subtle::StartRefCountFromOneTag) const { void AddRefImpl(cef_subtle::StartRefCountFromOneTag) const {
cef_subtle::RefCountedThreadSafeBase::AddRefWithCheck(); cef_subtle::RefCountedThreadSafeBase::AddRefWithCheck();
} }
DISALLOW_COPY_AND_ASSIGN(RefCountedThreadSafe);
}; };
// //

View File

@@ -48,7 +48,6 @@
#include "include/base/cef_compiler_specific.h" #include "include/base/cef_compiler_specific.h"
#include "include/base/cef_logging.h" #include "include/base/cef_logging.h"
#include "include/base/cef_macros.h"
template <class T> template <class T>
class scoped_refptr; class scoped_refptr;

View File

@@ -276,8 +276,13 @@ struct negation : bool_constant<!static_cast<bool>(B::value)> {};
// References: // References:
// [1] https://en.cppreference.com/w/cpp/types/result_of // [1] https://en.cppreference.com/w/cpp/types/result_of
// [2] https://wg21.link/meta.trans.other#lib:invoke_result // [2] https://wg21.link/meta.trans.other#lib:invoke_result
#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
template <typename Functor, typename... Args>
using invoke_result = std::invoke_result<Functor, Args...>;
#else
template <typename Functor, typename... Args> template <typename Functor, typename... Args>
using invoke_result = std::result_of<Functor && (Args && ...)>; using invoke_result = std::result_of<Functor && (Args && ...)>;
#endif
// Implementation of C++17's std::invoke_result_t. // Implementation of C++17's std::invoke_result_t.
// //

View File

@@ -109,7 +109,6 @@
#include "include/base/cef_atomic_flag.h" #include "include/base/cef_atomic_flag.h"
#include "include/base/cef_logging.h" #include "include/base/cef_logging.h"
#include "include/base/cef_macros.h"
#include "include/base/cef_ref_counted.h" #include "include/base/cef_ref_counted.h"
#include "include/base/cef_thread_checker.h" #include "include/base/cef_thread_checker.h"
@@ -357,9 +356,14 @@ class WeakPtrFactoryBase {
template <class T> template <class T>
class WeakPtrFactory : public internal::WeakPtrFactoryBase { class WeakPtrFactory : public internal::WeakPtrFactoryBase {
public: public:
WeakPtrFactory() = delete;
explicit WeakPtrFactory(T* ptr) explicit WeakPtrFactory(T* ptr)
: WeakPtrFactoryBase(reinterpret_cast<uintptr_t>(ptr)) {} : WeakPtrFactoryBase(reinterpret_cast<uintptr_t>(ptr)) {}
WeakPtrFactory(const WeakPtrFactory&) = delete;
WeakPtrFactory& operator=(const WeakPtrFactory&) = delete;
~WeakPtrFactory() = default; ~WeakPtrFactory() = default;
WeakPtr<T> GetWeakPtr() const { WeakPtr<T> GetWeakPtr() const {
@@ -378,9 +382,6 @@ class WeakPtrFactory : public internal::WeakPtrFactoryBase {
DCHECK(ptr_); DCHECK(ptr_);
return weak_reference_owner_.HasRefs(); return weak_reference_owner_.HasRefs();
} }
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(WeakPtrFactory);
}; };
// A class may extend from SupportsWeakPtr to let others take weak pointers to // A class may extend from SupportsWeakPtr to let others take weak pointers to
@@ -393,6 +394,9 @@ class SupportsWeakPtr : public internal::SupportsWeakPtrBase {
public: public:
SupportsWeakPtr() = default; SupportsWeakPtr() = default;
SupportsWeakPtr(const SupportsWeakPtr&) = delete;
SupportsWeakPtr& operator=(const SupportsWeakPtr&) = delete;
WeakPtr<T> AsWeakPtr() { WeakPtr<T> AsWeakPtr() {
return WeakPtr<T>(weak_reference_owner_.GetRef(), static_cast<T*>(this)); return WeakPtr<T>(weak_reference_owner_.GetRef(), static_cast<T*>(this));
} }
@@ -402,7 +406,6 @@ class SupportsWeakPtr : public internal::SupportsWeakPtrBase {
private: private:
internal::WeakReferenceOwner weak_reference_owner_; internal::WeakReferenceOwner weak_reference_owner_;
DISALLOW_COPY_AND_ASSIGN(SupportsWeakPtr);
}; };
// Helper function that uses type deduction to safely return a WeakPtr<Derived> // Helper function that uses type deduction to safely return a WeakPtr<Derived>

View File

@@ -40,8 +40,6 @@
#include <pthread.h> #include <pthread.h>
#endif #endif
#include "include/base/cef_macros.h"
namespace base { namespace base {
namespace cef_internal { namespace cef_internal {
@@ -57,6 +55,10 @@ class LockImpl {
#endif #endif
LockImpl(); LockImpl();
LockImpl(const LockImpl&) = delete;
LockImpl& operator=(const LockImpl&) = delete;
~LockImpl(); ~LockImpl();
// If the lock is not held, take it and return true. If the lock is already // If the lock is not held, take it and return true. If the lock is already
@@ -77,8 +79,6 @@ class LockImpl {
private: private:
NativeHandle native_handle_; NativeHandle native_handle_;
DISALLOW_COPY_AND_ASSIGN(LockImpl);
}; };
} // namespace cef_internal } // namespace cef_internal

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=8af93d03e0b2a6b50d7612b145599600285b76d4$ // $hash=b80e84c0039ab45d5c4562d64b67a84766c0dab3$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_
@@ -450,18 +450,15 @@ typedef struct _cef_browser_host_t {
struct _cef_pdf_print_callback_t* callback); struct _cef_pdf_print_callback_t* callback);
/// ///
// Search for |searchText|. |identifier| must be a unique ID and these IDs // Search for |searchText|. |forward| indicates whether to search forward or
// must strictly increase so that newer requests always have greater IDs than // backward within the page. |matchCase| indicates whether the search should
// older requests. If |identifier| is zero or less than the previous ID value // be case-sensitive. |findNext| indicates whether this is the first request
// then it will be automatically assigned a new valid ID. |forward| indicates // or a follow-up. The search will be restarted if |searchText| or |matchCase|
// whether to search forward or backward within the page. |matchCase| // change. The search will be stopped if |searchText| is NULL. The
// indicates whether the search should be case-sensitive. |findNext| indicates // cef_find_handler_t instance, if any, returned via
// whether this is the first request or a follow-up. The cef_find_handler_t // cef_client_t::GetFindHandler will be called to report find results.
// instance, if any, returned via cef_client_t::GetFindHandler will be called
// to report find results.
/// ///
void(CEF_CALLBACK* find)(struct _cef_browser_host_t* self, void(CEF_CALLBACK* find)(struct _cef_browser_host_t* self,
int identifier,
const cef_string_t* searchText, const cef_string_t* searchText,
int forward, int forward,
int matchCase, int matchCase,

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=b1fe7f7db5ab92c6ae64dc1288b6fd47c80f9423$ // $hash=f2e80b8637b07f19adea666e554269de4627e399$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_FIND_HANDLER_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_FIND_HANDLER_CAPI_H_
@@ -59,11 +59,12 @@ typedef struct _cef_find_handler_t {
/// ///
// Called to report find results returned by cef_browser_host_t::find(). // Called to report find results returned by cef_browser_host_t::find().
// |identifer| is the identifier passed to find(), |count| is the number of // |identifer| is a unique incremental identifier for the currently active
// matches currently identified, |selectionRect| is the location of where the // search, |count| is the number of matches currently identified,
// match was found (in window coordinates), |activeMatchOrdinal| is the // |selectionRect| is the location of where the match was found (in window
// current position in the search results, and |finalUpdate| is true (1) if // coordinates), |activeMatchOrdinal| is the current position in the search
// this is the last find notification. // results, and |finalUpdate| is true (1) if this is the last find
// notification.
/// ///
void(CEF_CALLBACK* on_find_result)(struct _cef_find_handler_t* self, void(CEF_CALLBACK* on_find_result)(struct _cef_find_handler_t* self,
struct _cef_browser_t* browser, struct _cef_browser_t* browser,

View File

@@ -42,13 +42,13 @@
// way that may cause binary incompatibility with other builds. The universal // way that may cause binary incompatibility with other builds. The universal
// hash value will change if any platform is affected whereas the platform hash // hash value will change if any platform is affected whereas the platform hash
// values will change only if that particular platform is affected. // values will change only if that particular platform is affected.
#define CEF_API_HASH_UNIVERSAL "6f6a9c0f3b420cd3120cf4f5924cbc91f5095abd" #define CEF_API_HASH_UNIVERSAL "58a564a53597120d05cedf5bcd355064168af0a7"
#if defined(OS_WIN) #if defined(OS_WIN)
#define CEF_API_HASH_PLATFORM "5835e67ed251fec96837b475df44248a286e422f" #define CEF_API_HASH_PLATFORM "5fa37a277dca51dee1d13058e6218dc1e2e68adb"
#elif defined(OS_MAC) #elif defined(OS_MAC)
#define CEF_API_HASH_PLATFORM "b8187d9f99b028d767dfd6a40490190c25a3d901" #define CEF_API_HASH_PLATFORM "77dc909a3d568d3b98fe32fa040801f748656ad2"
#elif defined(OS_LINUX) #elif defined(OS_LINUX)
#define CEF_API_HASH_PLATFORM "d7199dfd396052e1517e55f18ea75d3d61336538" #define CEF_API_HASH_PLATFORM "76077b5939104ed96c1378a24d4acbb1ae4e3cb5"
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -90,7 +90,10 @@ class CefBaseScoped {
/// ///
class CefRefCount { class CefRefCount {
public: public:
CefRefCount() {} CefRefCount() = default;
CefRefCount(const CefRefCount&) = delete;
CefRefCount& operator=(const CefRefCount&) = delete;
/// ///
// Increment the reference count. // Increment the reference count.
@@ -114,7 +117,6 @@ class CefRefCount {
private: private:
mutable base::AtomicRefCount ref_count_{0}; mutable base::AtomicRefCount ref_count_{0};
DISALLOW_COPY_AND_ASSIGN(CefRefCount);
}; };
/// ///

View File

@@ -479,19 +479,16 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
CefRefPtr<CefPdfPrintCallback> callback) = 0; CefRefPtr<CefPdfPrintCallback> callback) = 0;
/// ///
// Search for |searchText|. |identifier| must be a unique ID and these IDs // Search for |searchText|. |forward| indicates whether to search forward or
// must strictly increase so that newer requests always have greater IDs than // backward within the page. |matchCase| indicates whether the search should
// older requests. If |identifier| is zero or less than the previous ID value // be case-sensitive. |findNext| indicates whether this is the first request
// then it will be automatically assigned a new valid ID. |forward| indicates // or a follow-up. The search will be restarted if |searchText| or |matchCase|
// whether to search forward or backward within the page. |matchCase| // change. The search will be stopped if |searchText| is empty. The
// indicates whether the search should be case-sensitive. |findNext| indicates // CefFindHandler instance, if any, returned via CefClient::GetFindHandler
// whether this is the first request or a follow-up. The CefFindHandler // will be called to report find results.
// instance, if any, returned via CefClient::GetFindHandler will be called to
// report find results.
/// ///
/*--cef()--*/ /*--cef()--*/
virtual void Find(int identifier, virtual void Find(const CefString& searchText,
const CefString& searchText,
bool forward, bool forward,
bool matchCase, bool matchCase,
bool findNext) = 0; bool findNext) = 0;

View File

@@ -50,11 +50,11 @@ class CefFindHandler : public virtual CefBaseRefCounted {
public: public:
/// ///
// Called to report find results returned by CefBrowserHost::Find(). // Called to report find results returned by CefBrowserHost::Find().
// |identifer| is the identifier passed to Find(), |count| is the number of // |identifer| is a unique incremental identifier for the currently active
// matches currently identified, |selectionRect| is the location of where the // search, |count| is the number of matches currently identified,
// match was found (in window coordinates), |activeMatchOrdinal| is the // |selectionRect| is the location of where the match was found (in window
// current position in the search results, and |finalUpdate| is true if this // coordinates), |activeMatchOrdinal| is the current position in the search
// is the last find notification. // results, and |finalUpdate| is true if this is the last find notification.
/// ///
/*--cef()--*/ /*--cef()--*/
virtual void OnFindResult(CefRefPtr<CefBrowser> browser, virtual void OnFindResult(CefRefPtr<CefBrowser> browser,

View File

@@ -50,13 +50,13 @@ extern "C" {
// 2. Link the executable with the cef_sandbox static library. // 2. Link the executable with the cef_sandbox static library.
// 3. Call the cef_sandbox_info_create() function from within the executable // 3. Call the cef_sandbox_info_create() function from within the executable
// (not from a separate DLL) and pass the resulting pointer into both the // (not from a separate DLL) and pass the resulting pointer into both the
// CefExecutProcess() and CefInitialize() functions via the // CefExecuteProcess() and CefInitialize() functions via the
// |windows_sandbox_info| parameter. // |windows_sandbox_info| parameter.
/// ///
// Create the sandbox information object for this process. It is safe to create // Create the sandbox information object for this process. It is safe to create
// multiple of this object and to destroy the object immediately after passing // multiple of this object and to destroy the object immediately after passing
// into the CefExecutProcess() and/or CefInitialize() functions. // into the CefExecuteProcess() and/or CefInitialize() functions.
/// ///
void* cef_sandbox_info_create(); void* cef_sandbox_info_create();

View File

@@ -202,7 +202,7 @@ typedef struct _cef_settings_t {
/// ///
// Set to true (1) to have the browser process message loop run in a separate // Set to true (1) to have the browser process message loop run in a separate
// thread. If false (0) than the CefDoMessageLoopWork() function must be // thread. If false (0) then the CefDoMessageLoopWork() function must be
// called from your application message loop. This option is only supported on // called from your application message loop. This option is only supported on
// Windows and Linux. // Windows and Linux.
/// ///
@@ -1028,7 +1028,8 @@ typedef enum {
} cef_postdataelement_type_t; } cef_postdataelement_type_t;
/// ///
// Resource type for a request. // Resource type for a request. These constants match their equivalents in
// Chromium's ResourceType and should not be renumbered.
/// ///
typedef enum { typedef enum {
/// ///
@@ -1616,8 +1617,7 @@ typedef enum {
MENU_ID_NO_SPELLING_SUGGESTIONS = 205, MENU_ID_NO_SPELLING_SUGGESTIONS = 205,
MENU_ID_ADD_TO_DICTIONARY = 206, MENU_ID_ADD_TO_DICTIONARY = 206,
// Custom menu items originating from the renderer process. For example, // Custom menu items originating from the renderer process.
// plugin placeholder menu items.
MENU_ID_CUSTOM_FIRST = 220, MENU_ID_CUSTOM_FIRST = 220,
MENU_ID_CUSTOM_LAST = 250, MENU_ID_CUSTOM_LAST = 250,
@@ -1819,7 +1819,8 @@ typedef enum {
} cef_context_menu_type_flags_t; } cef_context_menu_type_flags_t;
/// ///
// Supported context menu media types. // Supported context menu media types. These constants match their equivalents
// in Chromium's ContextMenuDataMediaType and should not be renumbered.
/// ///
typedef enum { typedef enum {
/// ///
@@ -1839,6 +1840,10 @@ typedef enum {
/// ///
CM_MEDIATYPE_AUDIO, CM_MEDIATYPE_AUDIO,
/// ///
// An canvas node is selected.
///
CM_MEDIATYPE_CANVAS,
///
// A file node is selected. // A file node is selected.
/// ///
CM_MEDIATYPE_FILE, CM_MEDIATYPE_FILE,
@@ -1849,24 +1854,31 @@ typedef enum {
} cef_context_menu_media_type_t; } cef_context_menu_media_type_t;
/// ///
// Supported context menu media state bit flags. // Supported context menu media state bit flags. These constants match their
// equivalents in Chromium's ContextMenuData::MediaFlags and should not be
// renumbered.
/// ///
typedef enum { typedef enum {
CM_MEDIAFLAG_NONE = 0, CM_MEDIAFLAG_NONE = 0,
CM_MEDIAFLAG_ERROR = 1 << 0, CM_MEDIAFLAG_IN_ERROR = 1 << 0,
CM_MEDIAFLAG_PAUSED = 1 << 1, CM_MEDIAFLAG_PAUSED = 1 << 1,
CM_MEDIAFLAG_MUTED = 1 << 2, CM_MEDIAFLAG_MUTED = 1 << 2,
CM_MEDIAFLAG_LOOP = 1 << 3, CM_MEDIAFLAG_LOOP = 1 << 3,
CM_MEDIAFLAG_CAN_SAVE = 1 << 4, CM_MEDIAFLAG_CAN_SAVE = 1 << 4,
CM_MEDIAFLAG_HAS_AUDIO = 1 << 5, CM_MEDIAFLAG_HAS_AUDIO = 1 << 5,
CM_MEDIAFLAG_HAS_VIDEO = 1 << 6, CM_MEDIAFLAG_CAN_TOGGLE_CONTROLS = 1 << 6,
CM_MEDIAFLAG_CONTROL_ROOT_ELEMENT = 1 << 7, CM_MEDIAFLAG_CONTROLS = 1 << 7,
CM_MEDIAFLAG_CAN_PRINT = 1 << 8, CM_MEDIAFLAG_CAN_PRINT = 1 << 8,
CM_MEDIAFLAG_CAN_ROTATE = 1 << 9, CM_MEDIAFLAG_CAN_ROTATE = 1 << 9,
CM_MEDIAFLAG_CAN_PICTURE_IN_PICTURE = 1 << 10,
CM_MEDIAFLAG_PICTURE_IN_PICTURE = 1 << 11,
CM_MEDIAFLAG_CAN_LOOP = 1 << 12,
} cef_context_menu_media_state_flags_t; } cef_context_menu_media_state_flags_t;
/// ///
// Supported context menu edit state bit flags. // Supported context menu edit state bit flags. These constants match their
// equivalents in Chromium's ContextMenuDataEditFlags and should not be
// renumbered.
/// ///
typedef enum { typedef enum {
CM_EDITFLAG_NONE = 0, CM_EDITFLAG_NONE = 0,
@@ -1878,6 +1890,7 @@ typedef enum {
CM_EDITFLAG_CAN_DELETE = 1 << 5, CM_EDITFLAG_CAN_DELETE = 1 << 5,
CM_EDITFLAG_CAN_SELECT_ALL = 1 << 6, CM_EDITFLAG_CAN_SELECT_ALL = 1 << 6,
CM_EDITFLAG_CAN_TRANSLATE = 1 << 7, CM_EDITFLAG_CAN_TRANSLATE = 1 << 7,
CM_EDITFLAG_CAN_EDIT_RICHLY = 1 << 8,
} cef_context_menu_edit_state_flags_t; } cef_context_menu_edit_state_flags_t;
/// ///

View File

@@ -38,7 +38,6 @@
#pragma once #pragma once
#include "include/base/cef_lock.h" #include "include/base/cef_lock.h"
#include "include/base/cef_macros.h"
#include "include/cef_base.h" #include "include/cef_base.h"
#include "include/cef_stream.h" #include "include/cef_stream.h"
@@ -57,6 +56,9 @@ class CefByteReadHandler : public CefReadHandler {
size_t size, size_t size,
CefRefPtr<CefBaseRefCounted> source); CefRefPtr<CefBaseRefCounted> source);
CefByteReadHandler(const CefByteReadHandler&) = delete;
CefByteReadHandler& operator=(const CefByteReadHandler&) = delete;
// CefReadHandler methods. // CefReadHandler methods.
virtual size_t Read(void* ptr, size_t size, size_t n) override; virtual size_t Read(void* ptr, size_t size, size_t n) override;
virtual int Seek(int64 offset, int whence) override; virtual int Seek(int64 offset, int whence) override;
@@ -73,7 +75,6 @@ class CefByteReadHandler : public CefReadHandler {
base::Lock lock_; base::Lock lock_;
IMPLEMENT_REFCOUNTING(CefByteReadHandler); IMPLEMENT_REFCOUNTING(CefByteReadHandler);
DISALLOW_COPY_AND_ASSIGN(CefByteReadHandler);
}; };
#endif // CEF_INCLUDE_WRAPPER_CEF_BYTE_READ_HANDLER_H_ #endif // CEF_INCLUDE_WRAPPER_CEF_BYTE_READ_HANDLER_H_

View File

@@ -38,7 +38,6 @@
#pragma once #pragma once
#include "include/base/cef_callback_forward.h" #include "include/base/cef_callback_forward.h"
#include "include/base/cef_macros.h"
#include "include/cef_task.h" #include "include/cef_task.h"
/// ///

View File

@@ -43,7 +43,6 @@
#include "include/base/cef_bind.h" #include "include/base/cef_bind.h"
#include "include/base/cef_logging.h" #include "include/base/cef_logging.h"
#include "include/base/cef_macros.h"
#include "include/cef_task.h" #include "include/cef_task.h"
#define CEF_REQUIRE_UI_THREAD() DCHECK(CefCurrentlyOn(TID_UI)); #define CEF_REQUIRE_UI_THREAD() DCHECK(CefCurrentlyOn(TID_UI));
@@ -140,6 +139,10 @@ class CefScopedArgArray {
} }
array_[argc] = NULL; array_[argc] = NULL;
} }
CefScopedArgArray(const CefScopedArgArray&) = delete;
CefScopedArgArray& operator=(const CefScopedArgArray&) = delete;
~CefScopedArgArray() { delete[] array_; } ~CefScopedArgArray() { delete[] array_; }
char** array() const { return array_; } char** array() const { return array_; }
@@ -150,8 +153,6 @@ class CefScopedArgArray {
// Keep values in a vector separate from |array_| because various users may // Keep values in a vector separate from |array_| because various users may
// modify |array_| and we still want to clean up memory properly. // modify |array_| and we still want to clean up memory properly.
std::vector<std::string> values_; std::vector<std::string> values_;
DISALLOW_COPY_AND_ASSIGN(CefScopedArgArray);
}; };
#endif // CEF_INCLUDE_WRAPPER_CEF_HELPERS_H_ #endif // CEF_INCLUDE_WRAPPER_CEF_HELPERS_H_

View File

@@ -36,8 +36,6 @@
#ifdef __cplusplus #ifdef __cplusplus
#include <string> #include <string>
#include "include/base/cef_macros.h"
extern "C" { extern "C" {
#endif // __cplusplus #endif // __cplusplus
@@ -99,6 +97,10 @@ int cef_unload_library();
class CefScopedLibraryLoader { class CefScopedLibraryLoader {
public: public:
CefScopedLibraryLoader(); CefScopedLibraryLoader();
CefScopedLibraryLoader(const CefScopedLibraryLoader&) = delete;
CefScopedLibraryLoader& operator=(const CefScopedLibraryLoader&) = delete;
~CefScopedLibraryLoader(); ~CefScopedLibraryLoader();
/// ///
@@ -119,7 +121,6 @@ class CefScopedLibraryLoader {
bool Load(bool helper); bool Load(bool helper);
bool loaded_; bool loaded_;
DISALLOW_COPY_AND_ASSIGN(CefScopedLibraryLoader);
}; };
#endif // defined(OS_MAC) #endif // defined(OS_MAC)

View File

@@ -78,7 +78,7 @@
// with an error code of -1. // with an error code of -1.
// //
// Queries can be either persistent or non-persistent. If the query is // Queries can be either persistent or non-persistent. If the query is
// persistent than the callbacks will remain registered until one of the // persistent then the callbacks will remain registered until one of the
// following conditions are met: // following conditions are met:
// //
// A. The query is canceled in JavaScript using the |window.cefQueryCancel| // A. The query is canceled in JavaScript using the |window.cefQueryCancel|
@@ -245,7 +245,7 @@ class CefMessageRouterBrowserSide
/// ///
class Handler { class Handler {
public: public:
typedef CefMessageRouterBrowserSide::Callback Callback; using Callback = CefMessageRouterBrowserSide::Callback;
/// ///
// Executed when a new query is received. |query_id| uniquely identifies the // Executed when a new query is received. |query_id| uniquely identifies the

View File

@@ -41,7 +41,6 @@
#include <memory> #include <memory>
#include "include/base/cef_callback.h" #include "include/base/cef_callback.h"
#include "include/base/cef_macros.h"
#include "include/base/cef_ref_counted.h" #include "include/base/cef_ref_counted.h"
#include "include/base/cef_weak_ptr.h" #include "include/base/cef_weak_ptr.h"
#include "include/cef_request_handler.h" #include "include/cef_request_handler.h"
@@ -101,6 +100,9 @@ class CefResourceManager
/// ///
class Request : public base::RefCountedThreadSafe<Request> { class Request : public base::RefCountedThreadSafe<Request> {
public: public:
Request(const Request&) = delete;
Request& operator=(const Request&) = delete;
/// ///
// Returns the URL associated with this request. The returned value will be // Returns the URL associated with this request. The returned value will be
// fully qualified but will not contain query or fragment components. It // fully qualified but will not contain query or fragment components. It
@@ -176,11 +178,9 @@ class CefResourceManager
// Params that stay with this request object. Safe to access on any thread. // Params that stay with this request object. Safe to access on any thread.
RequestParams params_; RequestParams params_;
DISALLOW_COPY_AND_ASSIGN(Request);
}; };
typedef std::list<scoped_refptr<Request>> RequestList; using RequestList = std::list<scoped_refptr<Request>>;
/// ///
// Interface implemented by resource providers. A provider may be created on // Interface implemented by resource providers. A provider may be created on
@@ -210,6 +210,9 @@ class CefResourceManager
CefResourceManager(); CefResourceManager();
CefResourceManager(const CefResourceManager&) = delete;
CefResourceManager& operator=(const CefResourceManager&) = delete;
/// ///
// Add a provider that maps requests for |url| to |content|. |url| should be // Add a provider that maps requests for |url| to |content|. |url| should be
// fully qualified but not include a query or fragment component. If // fully qualified but not include a query or fragment component. If
@@ -316,7 +319,7 @@ class CefResourceManager
// Provider and associated information. // Provider and associated information.
struct ProviderEntry; struct ProviderEntry;
typedef std::list<ProviderEntry*> ProviderEntryList; using ProviderEntryList = std::list<ProviderEntry*>;
// Values associated with the pending request only. Ownership will be passed // Values associated with the pending request only. Ownership will be passed
// between requests and the resource manager as request handling proceeds. // between requests and the resource manager as request handling proceeds.
@@ -357,7 +360,7 @@ class CefResourceManager
ProviderEntryList providers_; ProviderEntryList providers_;
// Map of response ID to pending CefResourceHandler object. // Map of response ID to pending CefResourceHandler object.
typedef std::map<uint64, CefRefPtr<CefResourceHandler>> PendingHandlersMap; using PendingHandlersMap = std::map<uint64, CefRefPtr<CefResourceHandler>>;
PendingHandlersMap pending_handlers_; PendingHandlersMap pending_handlers_;
UrlFilter url_filter_; UrlFilter url_filter_;
@@ -365,8 +368,6 @@ class CefResourceManager
// Must be the last member. Created and accessed on the IO thread. // Must be the last member. Created and accessed on the IO thread.
std::unique_ptr<base::WeakPtrFactory<CefResourceManager>> weak_ptr_factory_; std::unique_ptr<base::WeakPtrFactory<CefResourceManager>> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(CefResourceManager);
}; };
#endif // CEF_INCLUDE_WRAPPER_CEF_RESOURCE_MANAGER_H_ #endif // CEF_INCLUDE_WRAPPER_CEF_RESOURCE_MANAGER_H_

View File

@@ -39,7 +39,6 @@
#pragma once #pragma once
#include "include/base/cef_build.h" #include "include/base/cef_build.h"
#include "include/base/cef_macros.h"
#include "include/cef_base.h" #include "include/cef_base.h"
/// ///
@@ -60,6 +59,9 @@ class CefScopedTempDir {
/// ///
CefScopedTempDir(); CefScopedTempDir();
CefScopedTempDir(const CefScopedTempDir&) = delete;
CefScopedTempDir& operator=(const CefScopedTempDir&) = delete;
/// ///
// Recursively delete path. // Recursively delete path.
/// ///
@@ -111,8 +113,6 @@ class CefScopedTempDir {
private: private:
CefString path_; CefString path_;
DISALLOW_COPY_AND_ASSIGN(CefScopedTempDir);
}; };
#endif // CEF_INCLUDE_SCOPED_TEMP_DIR_H_ #endif // CEF_INCLUDE_SCOPED_TEMP_DIR_H_

View File

@@ -37,7 +37,6 @@
#define CEF_INCLUDE_WRAPPER_CEF_STREAM_RESOURCE_HANDLER_H_ #define CEF_INCLUDE_WRAPPER_CEF_STREAM_RESOURCE_HANDLER_H_
#pragma once #pragma once
#include "include/base/cef_macros.h"
#include "include/cef_resource_handler.h" #include "include/cef_resource_handler.h"
#include "include/cef_response.h" #include "include/cef_response.h"
#include "include/cef_stream.h" #include "include/cef_stream.h"
@@ -61,6 +60,9 @@ class CefStreamResourceHandler : public CefResourceHandler {
CefResponse::HeaderMap header_map, CefResponse::HeaderMap header_map,
CefRefPtr<CefStreamReader> stream); CefRefPtr<CefStreamReader> stream);
CefStreamResourceHandler(const CefStreamResourceHandler&) = delete;
CefStreamResourceHandler& operator=(const CefStreamResourceHandler&) = delete;
// CefResourceHandler methods. // CefResourceHandler methods.
bool Open(CefRefPtr<CefRequest> request, bool Open(CefRefPtr<CefRequest> request,
bool& handle_request, bool& handle_request,
@@ -82,7 +84,6 @@ class CefStreamResourceHandler : public CefResourceHandler {
const CefRefPtr<CefStreamReader> stream_; const CefRefPtr<CefStreamReader> stream_;
IMPLEMENT_REFCOUNTING(CefStreamResourceHandler); IMPLEMENT_REFCOUNTING(CefStreamResourceHandler);
DISALLOW_COPY_AND_ASSIGN(CefStreamResourceHandler);
}; };
#endif // CEF_INCLUDE_WRAPPER_CEF_STREAM_RESOURCE_HANDLER_H_ #endif // CEF_INCLUDE_WRAPPER_CEF_STREAM_RESOURCE_HANDLER_H_

View File

@@ -41,7 +41,6 @@
#include <vector> #include <vector>
#include "include/base/cef_lock.h" #include "include/base/cef_lock.h"
#include "include/base/cef_macros.h"
#include "include/base/cef_ref_counted.h" #include "include/base/cef_ref_counted.h"
#include "include/cef_base.h" #include "include/cef_base.h"
#include "include/cef_xml_reader.h" #include "include/cef_xml_reader.h"
@@ -73,8 +72,8 @@ class CefStreamReader;
/// ///
class CefXmlObject : public base::RefCountedThreadSafe<CefXmlObject> { class CefXmlObject : public base::RefCountedThreadSafe<CefXmlObject> {
public: public:
typedef std::vector<CefRefPtr<CefXmlObject>> ObjectVector; using ObjectVector = std::vector<CefRefPtr<CefXmlObject>>;
typedef std::map<CefString, CefString> AttributeMap; using AttributeMap = std::map<CefString, CefString>;
/// ///
// Create a new object with the specified name. An object name must always be // Create a new object with the specified name. An object name must always be
@@ -82,6 +81,9 @@ class CefXmlObject : public base::RefCountedThreadSafe<CefXmlObject> {
/// ///
explicit CefXmlObject(const CefString& name); explicit CefXmlObject(const CefString& name);
CefXmlObject(const CefXmlObject&) = delete;
CefXmlObject& operator=(const CefXmlObject&) = delete;
/// ///
// Load the contents of the specified XML stream into this object. The // Load the contents of the specified XML stream into this object. The
// existing children and attributes, if any, will first be cleared. // existing children and attributes, if any, will first be cleared.
@@ -190,8 +192,6 @@ class CefXmlObject : public base::RefCountedThreadSafe<CefXmlObject> {
ObjectVector children_; ObjectVector children_;
base::Lock lock_; base::Lock lock_;
DISALLOW_COPY_AND_ASSIGN(CefXmlObject);
}; };
#endif // CEF_INCLUDE_WRAPPER_CEF_XML_OBJECT_H_ #endif // CEF_INCLUDE_WRAPPER_CEF_XML_OBJECT_H_

View File

@@ -40,7 +40,6 @@
#include <map> #include <map>
#include "include/base/cef_lock.h" #include "include/base/cef_lock.h"
#include "include/base/cef_macros.h"
#include "include/base/cef_ref_counted.h" #include "include/base/cef_ref_counted.h"
#include "include/cef_base.h" #include "include/cef_base.h"
@@ -80,13 +79,16 @@ class CefZipArchive : public base::RefCountedThreadSafe<CefZipArchive> {
virtual CefRefPtr<CefStreamReader> GetStreamReader() const = 0; virtual CefRefPtr<CefStreamReader> GetStreamReader() const = 0;
}; };
typedef std::map<CefString, CefRefPtr<File>> FileMap; using FileMap = std::map<CefString, CefRefPtr<File>>;
/// ///
// Create a new object. // Create a new object.
/// ///
CefZipArchive(); CefZipArchive();
CefZipArchive(const CefZipArchive&) = delete;
CefZipArchive& operator=(const CefZipArchive&) = delete;
/// ///
// Load the contents of the specified zip archive stream into this object. // Load the contents of the specified zip archive stream into this object.
// If the zip archive requires a password then provide it via |password|. // If the zip archive requires a password then provide it via |password|.
@@ -136,8 +138,6 @@ class CefZipArchive : public base::RefCountedThreadSafe<CefZipArchive> {
FileMap contents_; FileMap contents_;
mutable base::Lock lock_; mutable base::Lock lock_;
DISALLOW_COPY_AND_ASSIGN(CefZipArchive);
}; };
#endif // CEF_INCLUDE_WRAPPER_CEF_ZIP_ARCHIVE_H_ #endif // CEF_INCLUDE_WRAPPER_CEF_ZIP_ARCHIVE_H_

View File

@@ -55,6 +55,9 @@ class CefVisitedLinkListener : public visitedlink::VisitedLinkWriter::Listener {
public: public:
CefVisitedLinkListener() { DCHECK(listener_map_.empty()); } CefVisitedLinkListener() { DCHECK(listener_map_.empty()); }
CefVisitedLinkListener(const CefVisitedLinkListener&) = delete;
CefVisitedLinkListener& operator=(const CefVisitedLinkListener&) = delete;
void CreateListenerForContext(content::BrowserContext* context) { void CreateListenerForContext(content::BrowserContext* context) {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
auto listener = auto listener =
@@ -94,12 +97,10 @@ class CefVisitedLinkListener : public visitedlink::VisitedLinkWriter::Listener {
private: private:
// Map of AlloyBrowserContext to the associated VisitedLinkEventListener. // Map of AlloyBrowserContext to the associated VisitedLinkEventListener.
typedef std::map<const content::BrowserContext*, using ListenerMap =
std::unique_ptr<visitedlink::VisitedLinkEventListener>> std::map<const content::BrowserContext*,
ListenerMap; std::unique_ptr<visitedlink::VisitedLinkEventListener>>;
ListenerMap listener_map_; ListenerMap listener_map_;
DISALLOW_COPY_AND_ASSIGN(CefVisitedLinkListener);
}; };
AlloyBrowserContext::AlloyBrowserContext( AlloyBrowserContext::AlloyBrowserContext(

View File

@@ -39,6 +39,9 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
public: public:
explicit AlloyBrowserContext(const CefRequestContextSettings& settings); explicit AlloyBrowserContext(const CefRequestContextSettings& settings);
AlloyBrowserContext(const AlloyBrowserContext&) = delete;
AlloyBrowserContext& operator=(const AlloyBrowserContext&) = delete;
// CefBrowserContext overrides. // CefBrowserContext overrides.
content::BrowserContext* AsBrowserContext() override { return this; } content::BrowserContext* AsBrowserContext() override { return this; }
Profile* AsProfile() override { return this; } Profile* AsProfile() override { return this; }
@@ -142,8 +145,6 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
std::unique_ptr<content::ResourceContext> resource_context_; std::unique_ptr<content::ResourceContext> resource_context_;
scoped_refptr<MediaDeviceIDSalt> media_device_id_salt_; scoped_refptr<MediaDeviceIDSalt> media_device_id_salt_;
DISALLOW_COPY_AND_ASSIGN(AlloyBrowserContext);
}; };
#endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_CONTEXT_H_ #endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_CONTEXT_H_

View File

@@ -9,6 +9,7 @@
#include <utility> #include <utility>
#include "libcef/browser/alloy/alloy_browser_context.h" #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/audio_capturer.h"
#include "libcef/browser/browser_context.h" #include "libcef/browser/browser_context.h"
#include "libcef/browser/browser_info.h" #include "libcef/browser/browser_info.h"
@@ -99,6 +100,9 @@ class CefWidgetHostInterceptor
render_widget_host_->AddObserver(this); render_widget_host_->AddObserver(this);
} }
CefWidgetHostInterceptor(const CefWidgetHostInterceptor&) = delete;
CefWidgetHostInterceptor& operator=(const CefWidgetHostInterceptor&) = delete;
blink::mojom::WidgetHost* GetForwardingInterface() override { return impl_; } blink::mojom::WidgetHost* GetForwardingInterface() override { return impl_; }
// WidgetHostInterceptorForTesting method: // WidgetHostInterceptorForTesting method:
@@ -122,8 +126,6 @@ class CefWidgetHostInterceptor
AlloyBrowserHostImpl* const browser_; AlloyBrowserHostImpl* const browser_;
content::RenderWidgetHostImpl* const render_widget_host_; content::RenderWidgetHostImpl* const render_widget_host_;
blink::mojom::WidgetHost* const impl_; blink::mojom::WidgetHost* const impl_;
DISALLOW_COPY_AND_ASSIGN(CefWidgetHostInterceptor);
}; };
static constexpr base::TimeDelta kRecentlyAudibleTimeout = base::Seconds(2); static constexpr base::TimeDelta kRecentlyAudibleTimeout = base::Seconds(2);
@@ -449,21 +451,19 @@ void AlloyBrowserHostImpl::PrintToPDF(const CefString& path,
} }
} }
void AlloyBrowserHostImpl::Find(int identifier, void AlloyBrowserHostImpl::Find(const CefString& searchText,
const CefString& searchText,
bool forward, bool forward,
bool matchCase, bool matchCase,
bool findNext) { bool findNext) {
if (!CEF_CURRENTLY_ON_UIT()) { if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT, CEF_POST_TASK(CEF_UIT,
base::BindOnce(&AlloyBrowserHostImpl::Find, this, identifier, base::BindOnce(&AlloyBrowserHostImpl::Find, this, searchText,
searchText, forward, matchCase, findNext)); forward, matchCase, findNext));
return; return;
} }
if (platform_delegate_) { if (platform_delegate_) {
platform_delegate_->Find(identifier, searchText, forward, matchCase, platform_delegate_->Find(searchText, forward, matchCase, findNext);
findNext);
} }
} }
@@ -665,7 +665,7 @@ void AlloyBrowserHostImpl::SendCaptureLostEvent() {
} }
void AlloyBrowserHostImpl::NotifyMoveOrResizeStarted() { void AlloyBrowserHostImpl::NotifyMoveOrResizeStarted() {
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC)) #if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC))
if (!CEF_CURRENTLY_ON_UIT()) { if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK( CEF_POST_TASK(
CEF_UIT, CEF_UIT,
@@ -859,13 +859,21 @@ void AlloyBrowserHostImpl::FindReply(content::WebContents* web_contents,
const gfx::Rect& selection_rect, const gfx::Rect& selection_rect,
int active_match_ordinal, int active_match_ordinal,
bool final_update) { bool final_update) {
if (client_.get()) { auto alloy_delegate =
CefRefPtr<CefFindHandler> handler = client_->GetFindHandler(); static_cast<CefBrowserPlatformDelegateAlloy*>(platform_delegate());
if (handler.get()) { if (alloy_delegate->HandleFindReply(request_id, number_of_matches,
CefRect rect(selection_rect.x(), selection_rect.y(), selection_rect, active_match_ordinal,
selection_rect.width(), selection_rect.height()); final_update)) {
handler->OnFindResult(this, request_id, number_of_matches, rect, if (client_) {
active_match_ordinal, final_update); if (auto handler = client_->GetFindHandler()) {
const auto& details = alloy_delegate->last_search_result();
CefRect rect(details.selection_rect().x(), details.selection_rect().y(),
details.selection_rect().width(),
details.selection_rect().height());
handler->OnFindResult(
this, details.request_id(), details.number_of_matches(), rect,
details.active_match_ordinal(), details.final_update());
}
} }
} }
} }
@@ -1125,8 +1133,8 @@ void AlloyBrowserHostImpl::AddNewContents(
} }
void AlloyBrowserHostImpl::LoadingStateChanged(content::WebContents* source, void AlloyBrowserHostImpl::LoadingStateChanged(content::WebContents* source,
bool to_different_document) { bool should_show_loading_ui) {
contents_delegate_->LoadingStateChanged(source, to_different_document); contents_delegate_->LoadingStateChanged(source, should_show_loading_ui);
} }
void AlloyBrowserHostImpl::CloseContents(content::WebContents* source) { void AlloyBrowserHostImpl::CloseContents(content::WebContents* source) {
@@ -1352,7 +1360,7 @@ bool AlloyBrowserHostImpl::HandleContextMenu(
void AlloyBrowserHostImpl::UpdatePreferredSize(content::WebContents* source, void AlloyBrowserHostImpl::UpdatePreferredSize(content::WebContents* source,
const gfx::Size& pref_size) { const gfx::Size& pref_size) {
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC)) #if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC))
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
if (platform_delegate_) if (platform_delegate_)
platform_delegate_->SizeTo(pref_size.width(), pref_size.height()); platform_delegate_->SizeTo(pref_size.width(), pref_size.height());

View File

@@ -94,8 +94,7 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
void PrintToPDF(const CefString& path, void PrintToPDF(const CefString& path,
const CefPdfPrintSettings& settings, const CefPdfPrintSettings& settings,
CefRefPtr<CefPdfPrintCallback> callback) override; CefRefPtr<CefPdfPrintCallback> callback) override;
void Find(int identifier, void Find(const CefString& searchText,
const CefString& searchText,
bool forward, bool forward,
bool matchCase, bool matchCase,
bool findNext) override; bool findNext) override;
@@ -212,7 +211,7 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
bool user_gesture, bool user_gesture,
bool* was_blocked) override; bool* was_blocked) override;
void LoadingStateChanged(content::WebContents* source, void LoadingStateChanged(content::WebContents* source,
bool to_different_document) override; bool should_show_loading_ui) override;
void CloseContents(content::WebContents* source) override; void CloseContents(content::WebContents* source) override;
void UpdateTargetURL(content::WebContents* source, const GURL& url) override; void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
bool DidAddMessageToConsole(content::WebContents* source, bool DidAddMessageToConsole(content::WebContents* source,

View File

@@ -39,9 +39,12 @@
#include "third_party/widevine/cdm/buildflags.h" #include "third_party/widevine/cdm/buildflags.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#if defined(USE_AURA) && defined(USE_X11) #if BUILDFLAG(IS_LINUX)
#include "ui/ozone/buildflags.h"
#if defined(USE_AURA) && BUILDFLAG(OZONE_PLATFORM_X11)
#include "ui/events/devices/x11/touch_factory_x11.h" #include "ui/events/devices/x11/touch_factory_x11.h"
#endif #endif
#endif
#if defined(USE_AURA) #if defined(USE_AURA)
#include "ui/aura/env.h" #include "ui/aura/env.h"
@@ -49,15 +52,14 @@
#include "ui/views/widget/desktop_aura/desktop_screen.h" #include "ui/views/widget/desktop_aura/desktop_screen.h"
#include "ui/wm/core/wm_state.h" #include "ui/wm/core/wm_state.h"
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include "chrome/browser/chrome_browser_main_win.h" #include "chrome/browser/chrome_browser_main_win.h"
#include "chrome/browser/win/parental_controls.h" #include "chrome/browser/win/parental_controls.h"
#include "components/os_crypt/os_crypt.h"
#endif #endif
#endif // defined(USE_AURA) #endif // defined(USE_AURA)
#if defined(TOOLKIT_VIEWS) #if defined(TOOLKIT_VIEWS)
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
#include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/chrome_views_delegate.h" #include "chrome/browser/ui/views/chrome_views_delegate.h"
#else #else
@@ -65,14 +67,23 @@
#endif #endif
#endif // defined(TOOLKIT_VIEWS) #endif // defined(TOOLKIT_VIEWS)
#if defined(USE_AURA) && defined(OS_LINUX) #if defined(USE_AURA) && BUILDFLAG(IS_LINUX)
#include "ui/base/ime/init/input_method_initializer.h" #include "ui/base/ime/init/input_method_initializer.h"
#endif #endif
#if defined(OS_LINUX) #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
#include "libcef/browser/printing/print_dialog_linux.h" #include "components/os_crypt/os_crypt.h"
#endif #endif
#if BUILDFLAG(IS_LINUX)
#include "base/path_service.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/grit/chromium_strings.h"
#include "components/os_crypt/key_storage_config_linux.h"
#include "libcef/browser/printing/print_dialog_linux.h"
#include "ui/base/l10n/l10n_util.h"
#endif // BUILDFLAG(IS_LINUX)
#if BUILDFLAG(ENABLE_MEDIA_FOUNDATION_WIDEVINE_CDM) #if BUILDFLAG(ENABLE_MEDIA_FOUNDATION_WIDEVINE_CDM)
#include "chrome/browser/component_updater/media_foundation_widevine_cdm_component_installer.h" #include "chrome/browser/component_updater/media_foundation_widevine_cdm_component_installer.h"
#endif #endif
@@ -82,15 +93,15 @@
#endif #endif
AlloyBrowserMainParts::AlloyBrowserMainParts( AlloyBrowserMainParts::AlloyBrowserMainParts(
const content::MainFunctionParams& parameters) content::MainFunctionParams parameters)
: BrowserMainParts(), devtools_delegate_(nullptr) {} : BrowserMainParts(), parameters_(std::move(parameters)) {}
AlloyBrowserMainParts::~AlloyBrowserMainParts() { AlloyBrowserMainParts::~AlloyBrowserMainParts() {
constrained_window::SetConstrainedWindowViewsClient(nullptr); constrained_window::SetConstrainedWindowViewsClient(nullptr);
} }
int AlloyBrowserMainParts::PreEarlyInitialization() { int AlloyBrowserMainParts::PreEarlyInitialization() {
#if defined(USE_AURA) && defined(OS_LINUX) #if defined(USE_AURA) && BUILDFLAG(IS_LINUX)
// TODO(linux): Consider using a real input method or // TODO(linux): Consider using a real input method or
// views::LinuxUI::SetInstance. // views::LinuxUI::SetInstance.
ui::InitializeInputMethodForTesting(); ui::InitializeInputMethodForTesting();
@@ -108,7 +119,7 @@ void AlloyBrowserMainParts::ToolkitInitialized() {
#endif // defined(USE_AURA) #endif // defined(USE_AURA)
#if defined(TOOLKIT_VIEWS) #if defined(TOOLKIT_VIEWS)
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
views_delegate_ = std::make_unique<ChromeViewsDelegate>(); views_delegate_ = std::make_unique<ChromeViewsDelegate>();
layout_provider_ = ChromeLayoutProvider::CreateLayoutProvider(); layout_provider_ = ChromeLayoutProvider::CreateLayoutProvider();
#else #else
@@ -118,11 +129,13 @@ void AlloyBrowserMainParts::ToolkitInitialized() {
} }
void AlloyBrowserMainParts::PreCreateMainMessageLoop() { void AlloyBrowserMainParts::PreCreateMainMessageLoop() {
#if defined(USE_AURA) && defined(USE_X11) #if BUILDFLAG(IS_LINUX)
#if defined(USE_AURA) && BUILDFLAG(OZONE_PLATFORM_X11)
ui::TouchFactory::SetTouchDeviceListFromCommandLine(); ui::TouchFactory::SetTouchDeviceListFromCommandLine();
#endif #endif
#endif
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
// Initialize the OSCrypt. // Initialize the OSCrypt.
PrefService* local_state = g_browser_process->local_state(); PrefService* local_state = g_browser_process->local_state();
DCHECK(local_state); DCHECK(local_state);
@@ -132,22 +145,44 @@ void AlloyBrowserMainParts::PreCreateMainMessageLoop() {
// installer_util references strings that are normally compiled into // installer_util references strings that are normally compiled into
// setup.exe. In Chrome, these strings are in the locale files. // setup.exe. In Chrome, these strings are in the locale files.
ChromeBrowserMainPartsWin::SetupInstallerUtilStrings(); ChromeBrowserMainPartsWin::SetupInstallerUtilStrings();
#endif // defined(OS_WIN) #endif // BUILDFLAG(IS_WIN)
media_router::ChromeMediaRouterFactory::DoPlatformInit(); media_router::ChromeMediaRouterFactory::DoPlatformInit();
} }
void AlloyBrowserMainParts::PostCreateMainMessageLoop() { void AlloyBrowserMainParts::PostCreateMainMessageLoop() {
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
printing::PrintingContextLinux::SetCreatePrintDialogFunction( printing::PrintingContextLinux::SetCreatePrintDialogFunction(
&CefPrintDialogLinux::CreatePrintDialog); &CefPrintDialogLinux::CreatePrintDialog);
printing::PrintingContextLinux::SetPdfPaperSizeFunction( printing::PrintingContextLinux::SetPdfPaperSizeFunction(
&CefPrintDialogLinux::GetPdfPaperSize); &CefPrintDialogLinux::GetPdfPaperSize);
#endif
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
// Set up crypt config. This needs to be done before anything starts the
// network service, as the raw encryption key needs to be shared with the
// network service for encrypted cookie storage.
// Based on ChromeBrowserMainPartsLinux::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->product_name = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME);
// OSCrypt may target keyring, which requires calls from the main thread.
config->main_thread_runner = content::GetUIThreadTaskRunner({});
// OSCrypt can be disabled in a special settings file.
config->should_use_preference =
command_line->HasSwitch(switches::kEnableEncryptionSelection);
base::PathService::Get(chrome::DIR_USER_DATA, &config->user_data_path);
DCHECK(!config->user_data_path.empty());
OSCrypt::SetConfig(std::move(config));
#endif // BUILDFLAG(IS_LINUX)
} }
int AlloyBrowserMainParts::PreCreateThreads() { int AlloyBrowserMainParts::PreCreateThreads() {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
PlatformInitialize(); PlatformInitialize();
#endif #endif
@@ -200,7 +235,7 @@ int AlloyBrowserMainParts::PreMainMessageLoopRun() {
CefDevToolsManagerDelegate::StartHttpHandler(browser_context); CefDevToolsManagerDelegate::StartHttpHandler(browser_context);
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
// Windows parental controls calls can be slow, so we do an early init here // Windows parental controls calls can be slow, so we do an early init here
// that calculates this value off of the UI thread. // that calculates this value off of the UI thread.
InitializeWinParentalControls(); InitializeWinParentalControls();
@@ -244,7 +279,7 @@ void AlloyBrowserMainParts::PostMainMessageLoopRun() {
void AlloyBrowserMainParts::PostDestroyThreads() { void AlloyBrowserMainParts::PostDestroyThreads() {
#if defined(TOOLKIT_VIEWS) #if defined(TOOLKIT_VIEWS)
views_delegate_.reset(); views_delegate_.reset();
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
layout_provider_.reset(); layout_provider_.reset();
#endif #endif
#endif // defined(TOOLKIT_VIEWS) #endif // defined(TOOLKIT_VIEWS)

View File

@@ -9,15 +9,11 @@
#include "libcef/browser/request_context_impl.h" #include "libcef/browser/request_context_impl.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/macros.h"
#include "base/strings/string_piece.h" #include "base/strings/string_piece.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "content/public/browser/browser_main_parts.h" #include "content/public/browser/browser_main_parts.h"
#include "content/public/common/main_function_params.h"
namespace content {
struct MainFunctionParams;
}
#if defined(USE_AURA) #if defined(USE_AURA)
namespace display { namespace display {
@@ -31,7 +27,7 @@ class WMState;
#if defined(TOOLKIT_VIEWS) #if defined(TOOLKIT_VIEWS)
namespace views { namespace views {
class ViewsDelegate; class ViewsDelegate;
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
class LayoutProvider; class LayoutProvider;
#endif #endif
} // namespace views } // namespace views
@@ -41,7 +37,11 @@ class CefDevToolsDelegate;
class AlloyBrowserMainParts : public content::BrowserMainParts { class AlloyBrowserMainParts : public content::BrowserMainParts {
public: public:
explicit AlloyBrowserMainParts(const content::MainFunctionParams& parameters); explicit AlloyBrowserMainParts(content::MainFunctionParams parameters);
AlloyBrowserMainParts(const AlloyBrowserMainParts&) = delete;
AlloyBrowserMainParts& operator=(const AlloyBrowserMainParts&) = delete;
~AlloyBrowserMainParts() override; ~AlloyBrowserMainParts() override;
int PreEarlyInitialization() override; int PreEarlyInitialization() override;
@@ -70,12 +70,14 @@ class AlloyBrowserMainParts : public content::BrowserMainParts {
} }
private: private:
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
void PlatformInitialize(); void PlatformInitialize();
#endif // defined(OS_WIN) #endif // BUILDFLAG(IS_WIN)
content::MainFunctionParams parameters_;
CefRefPtr<CefRequestContextImpl> global_request_context_; CefRefPtr<CefRequestContextImpl> global_request_context_;
CefDevToolsDelegate* devtools_delegate_; // Deletes itself. CefDevToolsDelegate* devtools_delegate_ = nullptr; // Deletes itself.
// Blocking task runners exposed via CefTaskRunner. For consistency with // Blocking task runners exposed via CefTaskRunner. For consistency with
// previous named thread behavior always execute all pending tasks before // previous named thread behavior always execute all pending tasks before
@@ -92,12 +94,10 @@ class AlloyBrowserMainParts : public content::BrowserMainParts {
#if defined(TOOLKIT_VIEWS) #if defined(TOOLKIT_VIEWS)
std::unique_ptr<views::ViewsDelegate> views_delegate_; std::unique_ptr<views::ViewsDelegate> views_delegate_;
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
std::unique_ptr<views::LayoutProvider> layout_provider_; std::unique_ptr<views::LayoutProvider> layout_provider_;
#endif #endif
#endif // defined(TOOLKIT_VIEWS) #endif // defined(TOOLKIT_VIEWS)
DISALLOW_COPY_AND_ASSIGN(AlloyBrowserMainParts);
}; };
#endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_MAIN_H_ #endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_MAIN_H_

View File

@@ -5,6 +5,7 @@
#include "libcef/browser/alloy/alloy_content_browser_client.h" #include "libcef/browser/alloy/alloy_content_browser_client.h"
#include <algorithm> #include <algorithm>
#include <tuple>
#include <utility> #include <utility>
#include "include/cef_version.h" #include "include/cef_version.h"
@@ -107,6 +108,7 @@
#include "content/public/common/storage_quota_params.h" #include "content/public/common/storage_quota_params.h"
#include "content/public/common/url_constants.h" #include "content/public/common/url_constants.h"
#include "content/public/common/user_agent.h" #include "content/public/common/user_agent.h"
#include "crypto/crypto_buildflags.h"
#include "extensions/browser/event_router.h" #include "extensions/browser/event_router.h"
#include "extensions/browser/extension_message_filter.h" #include "extensions/browser/extension_message_filter.h"
#include "extensions/browser/extension_protocols.h" #include "extensions/browser/extension_protocols.h"
@@ -141,7 +143,7 @@
#include "ui/base/ui_base_switches.h" #include "ui/base/ui_base_switches.h"
#include "url/gurl.h" #include "url/gurl.h"
#if defined(OS_POSIX) && !defined(OS_MAC) #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
#include "base/debug/leak_annotations.h" #include "base/debug/leak_annotations.h"
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
#include "components/crash/content/browser/crash_handler_host_linux.h" #include "components/crash/content/browser/crash_handler_host_linux.h"
@@ -149,17 +151,17 @@
#include "content/public/common/content_descriptors.h" #include "content/public/common/content_descriptors.h"
#endif #endif
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
#include "net/ssl/client_cert_store_mac.h" #include "net/ssl/client_cert_store_mac.h"
#include "services/video_capture/public/mojom/constants.mojom.h" #include "services/video_capture/public/mojom/constants.mojom.h"
#endif #endif
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include "net/ssl/client_cert_store_win.h" #include "net/ssl/client_cert_store_win.h"
#include "sandbox/win/src/sandbox_policy.h" #include "sandbox/win/src/sandbox_policy.h"
#endif #endif
#if defined(USE_NSS_CERTS) #if BUILDFLAG(USE_NSS_CERTS)
#include "net/ssl/client_cert_store_nss.h" #include "net/ssl/client_cert_store_nss.h"
#endif #endif
@@ -176,6 +178,9 @@ class CefQuotaCallbackImpl : public CefCallback {
explicit CefQuotaCallbackImpl(CallbackType callback) explicit CefQuotaCallbackImpl(CallbackType callback)
: callback_(std::move(callback)) {} : callback_(std::move(callback)) {}
CefQuotaCallbackImpl(const CefQuotaCallbackImpl&) = delete;
CefQuotaCallbackImpl& operator=(const CefQuotaCallbackImpl&) = delete;
~CefQuotaCallbackImpl() { ~CefQuotaCallbackImpl() {
if (!callback_.is_null()) { if (!callback_.is_null()) {
// The callback is still pending. Cancel it now. // The callback is still pending. Cancel it now.
@@ -217,17 +222,21 @@ class CefQuotaCallbackImpl : public CefCallback {
CallbackType callback_; CallbackType callback_;
IMPLEMENT_REFCOUNTING(CefQuotaCallbackImpl); IMPLEMENT_REFCOUNTING(CefQuotaCallbackImpl);
DISALLOW_COPY_AND_ASSIGN(CefQuotaCallbackImpl);
}; };
class CefAllowCertificateErrorCallbackImpl : public CefCallback { class CefAllowCertificateErrorCallbackImpl : public CefCallback {
public: public:
typedef base::OnceCallback<void(content::CertificateRequestResultType)> using CallbackType =
CallbackType; base::OnceCallback<void(content::CertificateRequestResultType)>;
explicit CefAllowCertificateErrorCallbackImpl(CallbackType callback) explicit CefAllowCertificateErrorCallbackImpl(CallbackType callback)
: callback_(std::move(callback)) {} : callback_(std::move(callback)) {}
CefAllowCertificateErrorCallbackImpl(
const CefAllowCertificateErrorCallbackImpl&) = delete;
CefAllowCertificateErrorCallbackImpl& operator=(
const CefAllowCertificateErrorCallbackImpl&) = delete;
~CefAllowCertificateErrorCallbackImpl() { ~CefAllowCertificateErrorCallbackImpl() {
if (!callback_.is_null()) { if (!callback_.is_null()) {
// The callback is still pending. Cancel it now. // The callback is still pending. Cancel it now.
@@ -272,7 +281,6 @@ class CefAllowCertificateErrorCallbackImpl : public CefCallback {
CallbackType callback_; CallbackType callback_;
IMPLEMENT_REFCOUNTING(CefAllowCertificateErrorCallbackImpl); IMPLEMENT_REFCOUNTING(CefAllowCertificateErrorCallbackImpl);
DISALLOW_COPY_AND_ASSIGN(CefAllowCertificateErrorCallbackImpl);
}; };
class CefSelectClientCertificateCallbackImpl class CefSelectClientCertificateCallbackImpl
@@ -282,6 +290,11 @@ class CefSelectClientCertificateCallbackImpl
std::unique_ptr<content::ClientCertificateDelegate> delegate) std::unique_ptr<content::ClientCertificateDelegate> delegate)
: delegate_(std::move(delegate)) {} : delegate_(std::move(delegate)) {}
CefSelectClientCertificateCallbackImpl(
const CefSelectClientCertificateCallbackImpl&) = delete;
CefSelectClientCertificateCallbackImpl& operator=(
const CefSelectClientCertificateCallbackImpl&) = delete;
~CefSelectClientCertificateCallbackImpl() { ~CefSelectClientCertificateCallbackImpl() {
// If Select has not been called, call it with NULL to continue without any // If Select has not been called, call it with NULL to continue without any
// client certificate. // client certificate.
@@ -342,12 +355,15 @@ class CefSelectClientCertificateCallbackImpl
std::unique_ptr<content::ClientCertificateDelegate> delegate_; std::unique_ptr<content::ClientCertificateDelegate> delegate_;
IMPLEMENT_REFCOUNTING(CefSelectClientCertificateCallbackImpl); IMPLEMENT_REFCOUNTING(CefSelectClientCertificateCallbackImpl);
DISALLOW_COPY_AND_ASSIGN(CefSelectClientCertificateCallbackImpl);
}; };
class CefQuotaPermissionContext : public content::QuotaPermissionContext { class CefQuotaPermissionContext : public content::QuotaPermissionContext {
public: public:
CefQuotaPermissionContext() {} CefQuotaPermissionContext() = default;
CefQuotaPermissionContext(const CefQuotaPermissionContext&) = delete;
CefQuotaPermissionContext& operator=(const CefQuotaPermissionContext&) =
delete;
// The callback will be dispatched on the IO thread. // The callback will be dispatched on the IO thread.
void RequestQuotaPermission(const content::StorageQuotaParams& params, void RequestQuotaPermission(const content::StorageQuotaParams& params,
@@ -389,12 +405,10 @@ class CefQuotaPermissionContext : public content::QuotaPermissionContext {
} }
private: private:
~CefQuotaPermissionContext() override {} ~CefQuotaPermissionContext() override = default;
DISALLOW_COPY_AND_ASSIGN(CefQuotaPermissionContext);
}; };
#if defined(OS_POSIX) && !defined(OS_MAC) #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost( breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost(
const std::string& process_type) { const std::string& process_type) {
base::FilePath dumps_path; base::FilePath dumps_path;
@@ -449,7 +463,7 @@ int GetCrashSignalFD(const base::CommandLine& command_line) {
return -1; return -1;
} }
#endif // defined(OS_POSIX) && !defined(OS_MAC) #endif // BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
// From chrome/browser/plugins/chrome_content_browser_client_plugins_part.cc. // From chrome/browser/plugins/chrome_content_browser_client_plugins_part.cc.
void BindPluginInfoHost( void BindPluginInfoHost(
@@ -495,8 +509,8 @@ AlloyContentBrowserClient::~AlloyContentBrowserClient() = default;
std::unique_ptr<content::BrowserMainParts> std::unique_ptr<content::BrowserMainParts>
AlloyContentBrowserClient::CreateBrowserMainParts( AlloyContentBrowserClient::CreateBrowserMainParts(
const content::MainFunctionParams& parameters) { content::MainFunctionParams parameters) {
browser_main_parts_ = new AlloyBrowserMainParts(parameters); browser_main_parts_ = new AlloyBrowserMainParts(std::move(parameters));
return base::WrapUnique(browser_main_parts_); return base::WrapUnique(browser_main_parts_);
} }
@@ -563,18 +577,6 @@ bool AlloyContentBrowserClient::DoesSiteRequireDedicatedProcess(
browser_context, effective_site_url); browser_context, effective_site_url);
} }
bool AlloyContentBrowserClient::ShouldLockProcessToSite(
content::BrowserContext* browser_context,
const GURL& effective_site_url) {
if (extensions::ExtensionsEnabled()) {
return extensions::ChromeContentBrowserClientExtensionsPart::
ShouldLockProcessToSite(browser_context, effective_site_url);
}
return content::ContentBrowserClient::ShouldLockProcessToSite(
browser_context, effective_site_url);
}
bool AlloyContentBrowserClient::ShouldTreatURLSchemeAsFirstPartyWhenTopLevel( bool AlloyContentBrowserClient::ShouldTreatURLSchemeAsFirstPartyWhenTopLevel(
base::StringPiece scheme, base::StringPiece scheme,
bool is_embedded_origin_secure) { bool is_embedded_origin_secure) {
@@ -631,6 +633,7 @@ void AlloyContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem(
additional_allowed_schemes); additional_allowed_schemes);
additional_allowed_schemes->push_back(content::kChromeDevToolsScheme); additional_allowed_schemes->push_back(content::kChromeDevToolsScheme);
additional_allowed_schemes->push_back(content::kChromeUIScheme); additional_allowed_schemes->push_back(content::kChromeUIScheme);
additional_allowed_schemes->push_back(content::kChromeUIUntrustedScheme);
} }
bool AlloyContentBrowserClient::IsWebUIAllowedToMakeNetworkRequests( bool AlloyContentBrowserClient::IsWebUIAllowedToMakeNetworkRequests(
@@ -727,7 +730,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
// associated values) if present in the browser command line. // associated values) if present in the browser command line.
static const char* const kSwitchNames[] = { static const char* const kSwitchNames[] = {
switches::kDisablePackLoading, switches::kDisablePackLoading,
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
switches::kFrameworkDirPath, switches::kFrameworkDirPath,
switches::kMainBundlePath, switches::kMainBundlePath,
#endif #endif
@@ -763,14 +766,6 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
if (extensions::ExtensionsEnabled()) { if (extensions::ExtensionsEnabled()) {
content::RenderProcessHost* process = content::RenderProcessHost* process =
content::RenderProcessHost::FromID(child_process_id); content::RenderProcessHost::FromID(child_process_id);
#if !defined(OS_WIN)
// kPdfRenderer will be set for Windows in
// RenderProcessHostImpl::AppendRendererCommandLine.
if (process && process->IsPdf()) {
command_line->AppendSwitch(switches::kPdfRenderer);
}
#endif // !defined(OS_WIN)
auto browser_context = process->GetBrowserContext(); auto browser_context = process->GetBrowserContext();
CefBrowserContext* cef_browser_context = CefBrowserContext* cef_browser_context =
process ? CefBrowserContext::FromBrowserContext(browser_context) process ? CefBrowserContext::FromBrowserContext(browser_context)
@@ -805,7 +800,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir); command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir);
} }
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
if (process_type == switches::kZygoteProcess) { if (process_type == switches::kZygoteProcess) {
if (browser_cmd->HasSwitch(switches::kBrowserSubprocessPath)) { if (browser_cmd->HasSwitch(switches::kBrowserSubprocessPath)) {
// Force use of the sub-process executable path for the zygote process. // Force use of the sub-process executable path for the zygote process.
@@ -823,7 +818,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames, command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
base::size(kSwitchNames)); base::size(kSwitchNames));
} }
#endif // defined(OS_LINUX) #endif // BUILDFLAG(IS_LINUX)
CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication(); CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication();
if (app.get()) { if (app.get()) {
@@ -833,7 +828,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
CefRefPtr<CefCommandLineImpl> commandLinePtr( CefRefPtr<CefCommandLineImpl> commandLinePtr(
new CefCommandLineImpl(command_line, false, false)); new CefCommandLineImpl(command_line, false, false));
handler->OnBeforeChildProcessLaunch(commandLinePtr.get()); handler->OnBeforeChildProcessLaunch(commandLinePtr.get());
ignore_result(commandLinePtr->Detach(nullptr)); std::ignore = commandLinePtr->Detach(nullptr);
} }
} }
} }
@@ -1042,33 +1037,35 @@ AlloyContentBrowserClient::CreateDevToolsManagerDelegate() {
return std::make_unique<CefDevToolsManagerDelegate>(); return std::make_unique<CefDevToolsManagerDelegate>();
} }
bool AlloyContentBrowserClient::BindAssociatedReceiverFromFrame( void AlloyContentBrowserClient::
content::RenderFrameHost* render_frame_host, RegisterAssociatedInterfaceBindersForRenderFrameHost(
const std::string& interface_name, content::RenderFrameHost& render_frame_host,
mojo::ScopedInterfaceEndpointHandle* handle) { blink::AssociatedInterfaceRegistry& associated_registry) {
if (interface_name == extensions::mojom::LocalFrameHost::Name_) { associated_registry.AddInterface(base::BindRepeating(
[](content::RenderFrameHost* render_frame_host,
mojo::PendingAssociatedReceiver<extensions::mojom::LocalFrameHost>
receiver) {
extensions::ExtensionWebContentsObserver::BindLocalFrameHost( extensions::ExtensionWebContentsObserver::BindLocalFrameHost(
mojo::PendingAssociatedReceiver<extensions::mojom::LocalFrameHost>( std::move(receiver), render_frame_host);
std::move(*handle)), },
render_frame_host); &render_frame_host));
return true;
}
if (interface_name == printing::mojom::PrintManagerHost::Name_) {
printing::CefPrintViewManager::BindPrintManagerHost(
mojo::PendingAssociatedReceiver<printing::mojom::PrintManagerHost>(
std::move(*handle)),
render_frame_host);
return true;
}
if (interface_name == pdf::mojom::PdfService::Name_) {
pdf::PDFWebContentsHelper::BindPdfService(
mojo::PendingAssociatedReceiver<pdf::mojom::PdfService>(
std::move(*handle)),
render_frame_host);
return true;
}
return false; associated_registry.AddInterface(base::BindRepeating(
[](content::RenderFrameHost* render_frame_host,
mojo::PendingAssociatedReceiver<printing::mojom::PrintManagerHost>
receiver) {
printing::CefPrintViewManager::BindPrintManagerHost(std::move(receiver),
render_frame_host);
},
&render_frame_host));
associated_registry.AddInterface(base::BindRepeating(
[](content::RenderFrameHost* render_frame_host,
mojo::PendingAssociatedReceiver<pdf::mojom::PdfService> receiver) {
pdf::PDFWebContentsHelper::BindPdfService(std::move(receiver),
render_frame_host);
},
&render_frame_host));
} }
std::vector<std::unique_ptr<content::NavigationThrottle>> std::vector<std::unique_ptr<content::NavigationThrottle>>
@@ -1138,7 +1135,7 @@ AlloyContentBrowserClient::WillCreateURLLoaderRequestInterceptors(
return interceptors; return interceptors;
} }
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
void AlloyContentBrowserClient::GetAdditionalMappedFilesForChildProcess( void AlloyContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line, const base::CommandLine& command_line,
int child_process_id, int child_process_id,
@@ -1148,7 +1145,7 @@ void AlloyContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
mappings->Share(kCrashDumpSignal, crash_signal_fd); mappings->Share(kCrashDumpSignal, crash_signal_fd);
} }
} }
#endif // defined(OS_LINUX) #endif // BUILDFLAG(IS_LINUX)
void AlloyContentBrowserClient::ExposeInterfacesToRenderer( void AlloyContentBrowserClient::ExposeInterfacesToRenderer(
service_manager::BinderRegistry* registry, service_manager::BinderRegistry* registry,
@@ -1170,13 +1167,13 @@ std::unique_ptr<net::ClientCertStore>
AlloyContentBrowserClient::CreateClientCertStore( AlloyContentBrowserClient::CreateClientCertStore(
content::BrowserContext* browser_context) { content::BrowserContext* browser_context) {
// Match the logic in ProfileNetworkContextService::CreateClientCertStore. // Match the logic in ProfileNetworkContextService::CreateClientCertStore.
#if defined(USE_NSS_CERTS) #if BUILDFLAG(USE_NSS_CERTS)
// TODO: Add support for client implementation of crypto password dialog. // TODO: Add support for client implementation of crypto password dialog.
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS( return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS(
net::ClientCertStoreNSS::PasswordDelegateFactory())); net::ClientCertStoreNSS::PasswordDelegateFactory()));
#elif defined(OS_WIN) #elif BUILDFLAG(IS_WIN)
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreWin()); return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreWin());
#elif defined(OS_MAC) #elif BUILDFLAG(IS_MAC)
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreMac()); return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreMac());
#else #else
#error Unknown platform. #error Unknown platform.
@@ -1217,6 +1214,7 @@ void AlloyContentBrowserClient::RegisterNonNetworkNavigationURLLoaderFactories(
void AlloyContentBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories( void AlloyContentBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories(
int render_process_id, int render_process_id,
int render_frame_id, int render_frame_id,
const absl::optional<url::Origin>& request_initiator_origin,
NonNetworkURLLoaderFactoryMap* factories) { NonNetworkURLLoaderFactoryMap* factories) {
if (!extensions::ExtensionsEnabled()) if (!extensions::ExtensionsEnabled())
return; return;
@@ -1372,6 +1370,7 @@ bool AlloyContentBrowserClient::HandleExternalProtocol(
ui::PageTransition page_transition, ui::PageTransition page_transition,
bool has_user_gesture, bool has_user_gesture,
const absl::optional<url::Origin>& initiating_origin, const absl::optional<url::Origin>& initiating_origin,
content::RenderFrameHost* initiator_document,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) { mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
// Call the other HandleExternalProtocol variant. // Call the other HandleExternalProtocol variant.
return false; return false;
@@ -1383,6 +1382,8 @@ bool AlloyContentBrowserClient::HandleExternalProtocol(
content::NavigationUIData* navigation_data, content::NavigationUIData* navigation_data,
network::mojom::WebSandboxFlags sandbox_flags, network::mojom::WebSandboxFlags sandbox_flags,
const network::ResourceRequest& resource_request, const network::ResourceRequest& resource_request,
const absl::optional<url::Origin>& initiating_origin,
content::RenderFrameHost* initiator_document,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) { mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver = mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver =
out_factory->InitWithNewPipeAndPassReceiver(); out_factory->InitWithNewPipeAndPassReceiver();
@@ -1510,6 +1511,18 @@ bool AlloyContentBrowserClient::ShouldAllowPluginCreation(
return true; return true;
} }
void AlloyContentBrowserClient::OnWebContentsCreated(
content::WebContents* web_contents) {
// Attach universal WebContentsObservers. These are quite rare, and in most
// cases CefBrowserPlatformDelegateAlloy::BrowserCreated and/or
// CefExtensionsAPIClient::AttachWebContentsHelpers should be used instead.
if (extensions::ExtensionsEnabled()) {
extensions::CefExtensionWebContentsObserver::CreateForWebContents(
web_contents);
}
}
bool AlloyContentBrowserClient::IsFindInPageDisabledForOrigin( bool AlloyContentBrowserClient::IsFindInPageDisabledForOrigin(
const url::Origin& origin) { const url::Origin& origin) {
// For PDF viewing with the PPAPI-free PDF Viewer, find-in-page should only // For PDF viewing with the PPAPI-free PDF Viewer, find-in-page should only

View File

@@ -12,7 +12,6 @@
#include "include/cef_request_context_handler.h" #include "include/cef_request_context_handler.h"
#include "libcef/browser/request_context_impl.h" #include "libcef/browser/request_context_impl.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "content/public/browser/content_browser_client.h" #include "content/public/browser/content_browser_client.h"
@@ -36,7 +35,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
// ContentBrowserClient implementation. // ContentBrowserClient implementation.
std::unique_ptr<content::BrowserMainParts> CreateBrowserMainParts( std::unique_ptr<content::BrowserMainParts> CreateBrowserMainParts(
const content::MainFunctionParams& parameters) override; content::MainFunctionParams parameters) override;
void RenderProcessWillLaunch(content::RenderProcessHost* host) override; void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
bool ShouldUseProcessPerSite(content::BrowserContext* browser_context, bool ShouldUseProcessPerSite(content::BrowserContext* browser_context,
const GURL& site_url) override; const GURL& site_url) override;
@@ -44,8 +43,6 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
const GURL& site_url) override; const GURL& site_url) override;
bool DoesSiteRequireDedicatedProcess(content::BrowserContext* browser_context, bool DoesSiteRequireDedicatedProcess(content::BrowserContext* browser_context,
const GURL& effective_site_url) override; const GURL& effective_site_url) override;
bool ShouldLockProcessToSite(content::BrowserContext* browser_context,
const GURL& effective_site_url) override;
bool ShouldTreatURLSchemeAsFirstPartyWhenTopLevel( bool ShouldTreatURLSchemeAsFirstPartyWhenTopLevel(
base::StringPiece scheme, base::StringPiece scheme,
bool is_embedded_origin_secure) override; bool is_embedded_origin_secure) override;
@@ -120,10 +117,9 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override; void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
std::unique_ptr<content::DevToolsManagerDelegate> std::unique_ptr<content::DevToolsManagerDelegate>
CreateDevToolsManagerDelegate() override; CreateDevToolsManagerDelegate() override;
bool BindAssociatedReceiverFromFrame( void RegisterAssociatedInterfaceBindersForRenderFrameHost(
content::RenderFrameHost* render_frame_host, content::RenderFrameHost& render_frame_host,
const std::string& interface_name, blink::AssociatedInterfaceRegistry& associated_registry) override;
mojo::ScopedInterfaceEndpointHandle* handle) override;
std::vector<std::unique_ptr<content::NavigationThrottle>> std::vector<std::unique_ptr<content::NavigationThrottle>>
CreateThrottlesForNavigation( CreateThrottlesForNavigation(
content::NavigationHandle* navigation_handle) override; content::NavigationHandle* navigation_handle) override;
@@ -141,7 +137,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
const scoped_refptr<network::SharedURLLoaderFactory>& const scoped_refptr<network::SharedURLLoaderFactory>&
network_loader_factory) override; network_loader_factory) override;
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
void GetAdditionalMappedFilesForChildProcess( void GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line, const base::CommandLine& command_line,
int child_process_id, int child_process_id,
@@ -170,6 +166,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
void RegisterNonNetworkSubresourceURLLoaderFactories( void RegisterNonNetworkSubresourceURLLoaderFactories(
int render_process_id, int render_process_id,
int render_frame_id, int render_frame_id,
const absl::optional<url::Origin>& request_initiator_origin,
NonNetworkURLLoaderFactoryMap* factories) override; NonNetworkURLLoaderFactoryMap* factories) override;
bool WillCreateURLLoaderFactory( bool WillCreateURLLoaderFactory(
content::BrowserContext* browser_context, content::BrowserContext* browser_context,
@@ -206,6 +203,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
ui::PageTransition page_transition, ui::PageTransition page_transition,
bool has_user_gesture, bool has_user_gesture,
const absl::optional<url::Origin>& initiating_origin, const absl::optional<url::Origin>& initiating_origin,
content::RenderFrameHost* initiator_document,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
override; override;
bool HandleExternalProtocol( bool HandleExternalProtocol(
@@ -214,6 +212,8 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
content::NavigationUIData* navigation_data, content::NavigationUIData* navigation_data,
network::mojom::WebSandboxFlags sandbox_flags, network::mojom::WebSandboxFlags sandbox_flags,
const network::ResourceRequest& request, const network::ResourceRequest& request,
const absl::optional<url::Origin>& initiating_origin,
content::RenderFrameHost* initiator_document,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
override; override;
std::unique_ptr<content::OverlayWindow> CreateWindowForPictureInPicture( std::unique_ptr<content::OverlayWindow> CreateWindowForPictureInPicture(
@@ -237,6 +237,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
bool ShouldAllowPluginCreation( bool ShouldAllowPluginCreation(
const url::Origin& embedder_origin, const url::Origin& embedder_origin,
const content::PepperPluginInfo& plugin_info) override; const content::PepperPluginInfo& plugin_info) override;
void OnWebContentsCreated(content::WebContents* web_contents) override;
bool IsFindInPageDisabledForOrigin(const url::Origin& origin) override; bool IsFindInPageDisabledForOrigin(const url::Origin& origin) override;
CefRefPtr<CefRequestContextImpl> request_context() const; CefRefPtr<CefRequestContextImpl> request_context() const;

View File

@@ -5,6 +5,8 @@
#include "libcef/browser/alloy/alloy_dialog_util.h" #include "libcef/browser/alloy/alloy_dialog_util.h"
#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/alloy/alloy_browser_host_impl.h"
#include "libcef/browser/extensions/browser_extensions_util.h"
#include "libcef/browser/file_dialog_runner.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
@@ -13,9 +15,12 @@ namespace alloy {
void RunFileChooser(content::WebContents* web_contents, void RunFileChooser(content::WebContents* web_contents,
const blink::mojom::FileChooserParams& params, const blink::mojom::FileChooserParams& params,
RunFileChooserCallback callback) { RunFileChooserCallback callback) {
CefRefPtr<AlloyBrowserHostImpl> browser = CefRefPtr<AlloyBrowserHostImpl> browser = static_cast<AlloyBrowserHostImpl*>(
AlloyBrowserHostImpl::GetBrowserForContents(web_contents); extensions::GetOwnerBrowserForHost(web_contents->GetRenderViewHost(),
nullptr)
.get());
if (!browser) { if (!browser) {
LOG(ERROR) << "Failed to identify browser; canceling file dialog";
std::move(callback).Run(-1, {}); std::move(callback).Run(-1, {});
return; return;
} }
@@ -31,9 +36,9 @@ void RunFileChooser(content::WebContents* web_contents,
// Based on net/base/filename_util_internal.cc FilePathToString16(). // Based on net/base/filename_util_internal.cc FilePathToString16().
std::u16string FilePathTypeToString16(const base::FilePath::StringType& str) { std::u16string FilePathTypeToString16(const base::FilePath::StringType& str) {
std::u16string result; std::u16string result;
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
result.assign(str.begin(), str.end()); result.assign(str.begin(), str.end());
#elif defined(OS_POSIX) || defined(OS_FUCHSIA) #elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
if (!str.empty()) { if (!str.empty()) {
base::UTF8ToUTF16(str.c_str(), str.size(), &result); base::UTF8ToUTF16(str.c_str(), str.size(), &result);
} }

View File

@@ -17,13 +17,17 @@
#include "base/logging.h" #include "base/logging.h"
#include "chrome/browser/printing/print_view_manager.h" #include "chrome/browser/printing/print_view_manager.h"
#include "chrome/browser/printing/print_view_manager_common.h"
#include "chrome/browser/ui/prefs/prefs_tab_helper.h" #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
#include "components/find_in_page/find_tab_helper.h"
#include "components/find_in_page/find_types.h"
#include "components/zoom/zoom_controller.h" #include "components/zoom/zoom_controller.h"
#include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h" #include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h" #include "content/public/browser/render_widget_host.h"
#include "extensions/browser/process_manager.h" #include "extensions/browser/process_manager.h"
#include "pdf/pdf_features.h"
#include "printing/mojom/print.mojom.h" #include "printing/mojom/print.mojom.h"
#include "third_party/blink/public/mojom/frame/find_in_page.mojom.h" #include "third_party/blink/public/mojom/frame/find_in_page.mojom.h"
@@ -108,6 +112,7 @@ void CefBrowserPlatformDelegateAlloy::WebContentsCreated(
content::WebContents* web_contents, content::WebContents* web_contents,
bool owned) { bool owned) {
CefBrowserPlatformDelegate::WebContentsCreated(web_contents, owned); CefBrowserPlatformDelegate::WebContentsCreated(web_contents, owned);
find_in_page::FindTabHelper::CreateForWebContents(web_contents);
if (owned) { if (owned) {
SetOwnedWebContents(web_contents); SetOwnedWebContents(web_contents);
@@ -179,9 +184,6 @@ void CefBrowserPlatformDelegateAlloy::BrowserCreated(
printing::CefPrintViewManager::CreateForWebContents(web_contents_); printing::CefPrintViewManager::CreateForWebContents(web_contents_);
if (extensions::ExtensionsEnabled()) { if (extensions::ExtensionsEnabled()) {
extensions::CefExtensionWebContentsObserver::CreateForWebContents(
web_contents_);
// Used by the tabs extension API. // Used by the tabs extension API.
zoom::ZoomController::CreateForWebContents(web_contents_); zoom::ZoomController::CreateForWebContents(web_contents_);
} }
@@ -257,7 +259,7 @@ void CefBrowserPlatformDelegateAlloy::SendCaptureLostEvent() {
widget->LostCapture(); widget->LostCapture();
} }
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC)) #if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC))
void CefBrowserPlatformDelegateAlloy::NotifyMoveOrResizeStarted() { void CefBrowserPlatformDelegateAlloy::NotifyMoveOrResizeStarted() {
if (!browser_) if (!browser_)
return; return;
@@ -341,33 +343,30 @@ void CefBrowserPlatformDelegateAlloy::SetAccessibilityState(
bool CefBrowserPlatformDelegateAlloy::IsPrintPreviewSupported() const { bool CefBrowserPlatformDelegateAlloy::IsPrintPreviewSupported() const {
REQUIRE_ALLOY_RUNTIME(); REQUIRE_ALLOY_RUNTIME();
auto actionable_contents = GetActionableWebContents();
if (!actionable_contents)
return false;
auto cef_browser_context = CefBrowserContext::FromBrowserContext(
actionable_contents->GetBrowserContext());
if (!cef_browser_context->IsPrintPreviewSupported()) {
return false;
}
// Print preview is not currently supported with OSR. // Print preview is not currently supported with OSR.
return !IsWindowless(); if (IsWindowless())
return false;
auto cef_browser_context =
CefBrowserContext::FromBrowserContext(web_contents_->GetBrowserContext());
return cef_browser_context->IsPrintPreviewSupported();
} }
void CefBrowserPlatformDelegateAlloy::Print() { void CefBrowserPlatformDelegateAlloy::Print() {
REQUIRE_ALLOY_RUNTIME(); REQUIRE_ALLOY_RUNTIME();
auto actionable_contents = GetActionableWebContents(); auto contents_to_use = printing::GetWebContentsToUse(web_contents_);
if (!actionable_contents) if (!contents_to_use)
return; return;
auto rfh = actionable_contents->GetMainFrame(); auto rfh_to_use = printing::GetRenderFrameHostToUse(contents_to_use);
if (!rfh_to_use)
return;
if (IsPrintPreviewSupported()) { if (IsPrintPreviewSupported()) {
GetPrintViewManager(actionable_contents)->PrintPreviewNow(rfh, false); GetPrintViewManager(contents_to_use)->PrintPreviewNow(rfh_to_use, false);
} else { } else {
GetPrintViewManager(actionable_contents)->PrintNow(rfh); GetPrintViewManager(contents_to_use)->PrintNow(rfh_to_use);
} }
} }
@@ -377,50 +376,65 @@ void CefBrowserPlatformDelegateAlloy::PrintToPDF(
CefRefPtr<CefPdfPrintCallback> callback) { CefRefPtr<CefPdfPrintCallback> callback) {
REQUIRE_ALLOY_RUNTIME(); REQUIRE_ALLOY_RUNTIME();
content::WebContents* actionable_contents = GetActionableWebContents(); auto contents_to_use = printing::GetWebContentsToUse(web_contents_);
if (!actionable_contents) if (!contents_to_use)
return; return;
auto rfh_to_use = printing::GetRenderFrameHostToUse(contents_to_use);
if (!rfh_to_use)
return;
printing::CefPrintViewManager::PdfPrintCallback pdf_callback; printing::CefPrintViewManager::PdfPrintCallback pdf_callback;
if (callback.get()) { if (callback.get()) {
pdf_callback = base::BindOnce(&CefPdfPrintCallback::OnPdfPrintFinished, pdf_callback = base::BindOnce(&CefPdfPrintCallback::OnPdfPrintFinished,
callback.get(), path); callback.get(), path);
} }
GetPrintViewManager(actionable_contents) GetPrintViewManager(contents_to_use)
->PrintToPDF(actionable_contents->GetMainFrame(), base::FilePath(path), ->PrintToPDF(rfh_to_use, base::FilePath(path), settings,
settings, std::move(pdf_callback)); std::move(pdf_callback));
} }
void CefBrowserPlatformDelegateAlloy::Find(int identifier, void CefBrowserPlatformDelegateAlloy::Find(const CefString& searchText,
const CefString& searchText,
bool forward, bool forward,
bool matchCase, bool matchCase,
bool findNext) { bool findNext) {
if (!web_contents_) if (!web_contents_)
return; return;
// Every find request must have a unique ID and these IDs must strictly find_in_page::FindTabHelper::FromWebContents(web_contents_)
// increase so that newer requests always have greater IDs than older ->StartFinding(searchText.ToString16(), forward, matchCase, findNext,
// requests. /*run_synchronously_for_testing=*/false);
if (identifier <= find_request_id_counter_)
identifier = ++find_request_id_counter_;
else
find_request_id_counter_ = identifier;
auto options = blink::mojom::FindOptions::New();
options->forward = forward;
options->match_case = matchCase;
options->find_match = findNext;
web_contents_->Find(identifier, searchText, std::move(options));
} }
void CefBrowserPlatformDelegateAlloy::StopFinding(bool clearSelection) { void CefBrowserPlatformDelegateAlloy::StopFinding(bool clearSelection) {
if (!web_contents_) if (!web_contents_)
return; return;
content::StopFindAction action = last_search_result_ = find_in_page::FindNotificationDetails();
clearSelection ? content::STOP_FIND_ACTION_CLEAR_SELECTION find_in_page::FindTabHelper::FromWebContents(web_contents_)
: content::STOP_FIND_ACTION_KEEP_SELECTION; ->StopFinding(clearSelection ? find_in_page::SelectionAction::kClear
web_contents_->StopFinding(action); : find_in_page::SelectionAction::kKeep);
}
bool CefBrowserPlatformDelegateAlloy::HandleFindReply(
int request_id,
int number_of_matches,
const gfx::Rect& selection_rect,
int active_match_ordinal,
bool final_update) {
if (!web_contents_)
return false;
auto find_in_page =
find_in_page::FindTabHelper::FromWebContents(web_contents_);
find_in_page->HandleFindReply(request_id, number_of_matches, selection_rect,
active_match_ordinal, final_update);
if (!(find_in_page->find_result() == last_search_result_)) {
last_search_result_ = find_in_page->find_result();
return true;
}
return false;
} }
base::RepeatingClosure base::RepeatingClosure
@@ -432,17 +446,6 @@ CefBrowserPlatformDelegateAlloy::GetBoundsChangedCallback() {
return base::RepeatingClosure(); return base::RepeatingClosure();
} }
content::WebContents*
CefBrowserPlatformDelegateAlloy::GetActionableWebContents() const {
if (web_contents_ && extensions::ExtensionsEnabled()) {
content::WebContents* guest_contents =
extensions::GetFullPageGuestForOwnerContents(web_contents_);
if (guest_contents)
return guest_contents;
}
return web_contents_;
}
void CefBrowserPlatformDelegateAlloy::SetOwnedWebContents( void CefBrowserPlatformDelegateAlloy::SetOwnedWebContents(
content::WebContents* owned_contents) { content::WebContents* owned_contents) {
DCHECK(primary_); DCHECK(primary_);

View File

@@ -10,12 +10,18 @@
#include "libcef/browser/web_contents_dialog_helper.h" #include "libcef/browser/web_contents_dialog_helper.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "components/find_in_page/find_notification_details.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "ui/gfx/geometry/size.h" #include "ui/gfx/geometry/size.h"
// Implementation of Alloy-based browser functionality. // Implementation of Alloy-based browser functionality.
class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate { class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
public: public:
CefBrowserPlatformDelegateAlloy(const CefBrowserPlatformDelegateAlloy&) =
delete;
CefBrowserPlatformDelegateAlloy& operator=(
const CefBrowserPlatformDelegateAlloy&) = delete;
content::WebContents* CreateWebContents(CefBrowserCreateParams& create_params, content::WebContents* CreateWebContents(CefBrowserCreateParams& create_params,
bool& own_web_contents) override; bool& own_web_contents) override;
void WebContentsCreated(content::WebContents* web_contents, void WebContentsCreated(content::WebContents* web_contents,
@@ -38,7 +44,7 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
extensions::ExtensionHost* GetExtensionHost() const override; extensions::ExtensionHost* GetExtensionHost() const override;
void BrowserDestroyed(CefBrowserHostBase* browser) override; void BrowserDestroyed(CefBrowserHostBase* browser) override;
void SendCaptureLostEvent() override; void SendCaptureLostEvent() override;
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC)) #if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC))
void NotifyMoveOrResizeStarted() override; void NotifyMoveOrResizeStarted() override;
#endif #endif
bool PreHandleGestureEvent(content::WebContents* source, bool PreHandleGestureEvent(content::WebContents* source,
@@ -53,24 +59,28 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
void PrintToPDF(const CefString& path, void PrintToPDF(const CefString& path,
const CefPdfPrintSettings& settings, const CefPdfPrintSettings& settings,
CefRefPtr<CefPdfPrintCallback> callback) override; CefRefPtr<CefPdfPrintCallback> callback) override;
void Find(int identifier, void Find(const CefString& searchText,
const CefString& searchText,
bool forward, bool forward,
bool matchCase, bool matchCase,
bool findNext) override; bool findNext) override;
void StopFinding(bool clearSelection) override; void StopFinding(bool clearSelection) override;
// Called from AlloyBrowserHostImpl::FindReply().
bool HandleFindReply(int request_id,
int number_of_matches,
const gfx::Rect& selection_rect,
int active_match_ordinal,
bool final_update);
const find_in_page::FindNotificationDetails& last_search_result() const {
return last_search_result_;
}
protected: protected:
CefBrowserPlatformDelegateAlloy(); CefBrowserPlatformDelegateAlloy();
base::RepeatingClosure GetBoundsChangedCallback(); base::RepeatingClosure GetBoundsChangedCallback();
// Returns the WebContents most likely to handle an action. If extensions are
// enabled and this browser has a full-page guest (for example, a full-page
// PDF viewer extension) then the guest's WebContents will be returned.
// Otherwise, the browser's WebContents will be returned.
content::WebContents* GetActionableWebContents() const;
// Called from BrowserPlatformDelegateNative::set_windowless_handler(). // Called from BrowserPlatformDelegateNative::set_windowless_handler().
void set_as_secondary() { primary_ = false; } void set_as_secondary() { primary_ = false; }
@@ -91,8 +101,9 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
// Used for the print preview dialog. // Used for the print preview dialog.
std::unique_ptr<CefWebContentsDialogHelper> web_contents_dialog_helper_; std::unique_ptr<CefWebContentsDialogHelper> web_contents_dialog_helper_;
// Used to provide unique incremental IDs for each find request. // The last find result. This object contains details about the number of
int find_request_id_counter_ = 0; // matches, the find selection rectangle, etc.
find_in_page::FindNotificationDetails last_search_result_;
// Used when the browser is hosting an extension. // Used when the browser is hosting an extension.
extensions::ExtensionHost* extension_host_ = nullptr; extensions::ExtensionHost* extension_host_ = nullptr;
@@ -108,8 +119,6 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
bool primary_ = true; bool primary_ = true;
base::WeakPtrFactory<CefBrowserPlatformDelegateAlloy> weak_ptr_factory_; base::WeakPtrFactory<CefBrowserPlatformDelegateAlloy> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(CefBrowserPlatformDelegateAlloy);
}; };
#endif // CEF_LIBCEF_BROWSER_ALLOY_BROWSER_PLATFORM_DELEGATE_ALLOY_H_ #endif // CEF_LIBCEF_BROWSER_ALLOY_BROWSER_PLATFORM_DELEGATE_ALLOY_H_

View File

@@ -160,11 +160,6 @@ ChromeBrowserProcessAlloy::network_quality_tracker() {
return nullptr; return nullptr;
} }
WatchDogThread* ChromeBrowserProcessAlloy::watchdog_thread() {
NOTREACHED();
return nullptr;
}
ProfileManager* ChromeBrowserProcessAlloy::profile_manager() { ProfileManager* ChromeBrowserProcessAlloy::profile_manager() {
DCHECK(context_initialized_); DCHECK(context_initialized_);
return profile_manager_.get(); return profile_manager_.get();
@@ -345,7 +340,7 @@ StartupData* ChromeBrowserProcessAlloy::startup_data() {
return nullptr; return nullptr;
} }
#if defined(OS_WIN) || defined(OS_LINUX) #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
void ChromeBrowserProcessAlloy::StartAutoupdateTimer() {} void ChromeBrowserProcessAlloy::StartAutoupdateTimer() {}
#endif #endif
@@ -365,7 +360,7 @@ ChromeBrowserProcessAlloy::component_updater() {
component_updater::MakeChromeComponentUpdaterConfigurator( component_updater::MakeChromeComponentUpdaterConfigurator(
base::CommandLine::ForCurrentProcess(), base::CommandLine::ForCurrentProcess(),
g_browser_process->local_state()), g_browser_process->local_state()),
std::move(scheduler)); std::move(scheduler), /*brand=*/std::string());
return component_updater_.get(); return component_updater_.get();
} }

View File

@@ -28,15 +28,21 @@ class ChromeProfileManagerAlloy;
class BackgroundModeManager { class BackgroundModeManager {
public: public:
BackgroundModeManager(); BackgroundModeManager();
virtual ~BackgroundModeManager();
private: BackgroundModeManager(const BackgroundModeManager&) = delete;
DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager); BackgroundModeManager& operator=(const BackgroundModeManager&) = delete;
virtual ~BackgroundModeManager();
}; };
class ChromeBrowserProcessAlloy : public BrowserProcess { class ChromeBrowserProcessAlloy : public BrowserProcess {
public: public:
ChromeBrowserProcessAlloy(); ChromeBrowserProcessAlloy();
ChromeBrowserProcessAlloy(const ChromeBrowserProcessAlloy&) = delete;
ChromeBrowserProcessAlloy& operator=(const ChromeBrowserProcessAlloy&) =
delete;
~ChromeBrowserProcessAlloy() override; ~ChromeBrowserProcessAlloy() override;
void Initialize(); void Initialize();
@@ -51,7 +57,6 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
metrics::MetricsService* metrics_service() override; metrics::MetricsService* metrics_service() override;
SystemNetworkContextManager* system_network_context_manager() override; SystemNetworkContextManager* system_network_context_manager() override;
network::NetworkQualityTracker* network_quality_tracker() override; network::NetworkQualityTracker* network_quality_tracker() override;
WatchDogThread* watchdog_thread() override;
ProfileManager* profile_manager() override; ProfileManager* profile_manager() override;
PrefService* local_state() override; PrefService* local_state() override;
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory() scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory()
@@ -90,7 +95,7 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
floc_sorting_lsh_clusters_service() override; floc_sorting_lsh_clusters_service() override;
StartupData* startup_data() override; StartupData* startup_data() override;
#if defined(OS_WIN) || defined(OS_LINUX) #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
void StartAutoupdateTimer() override; void StartAutoupdateTimer() override;
#endif #endif
@@ -131,8 +136,6 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
std::unique_ptr<base::FieldTrialList> field_trial_list_; std::unique_ptr<base::FieldTrialList> field_trial_list_;
std::unique_ptr<component_updater::ComponentUpdateService> component_updater_; std::unique_ptr<component_updater::ComponentUpdateService> component_updater_;
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserProcessAlloy);
}; };
#endif // CEF_LIBCEF_BROWSER_ALLOY_CHROME_BROWSER_PROCESS_ALLOY_H_ #endif // CEF_LIBCEF_BROWSER_ALLOY_CHROME_BROWSER_PROCESS_ALLOY_H_

View File

@@ -108,10 +108,6 @@ const Profile* ChromeProfileAlloy::GetOriginalProfile() const {
return this; return this;
} }
bool ChromeProfileAlloy::IsSupervised() const {
return false;
}
bool ChromeProfileAlloy::IsChild() const { bool ChromeProfileAlloy::IsChild() const {
return false; return false;
} }

View File

@@ -16,6 +16,10 @@
class ChromeProfileAlloy : public Profile { class ChromeProfileAlloy : public Profile {
public: public:
ChromeProfileAlloy(); ChromeProfileAlloy();
ChromeProfileAlloy(const ChromeProfileAlloy&) = delete;
ChromeProfileAlloy& operator=(const ChromeProfileAlloy&) = delete;
~ChromeProfileAlloy() override; ~ChromeProfileAlloy() override;
protected: protected:
@@ -35,7 +39,6 @@ class ChromeProfileAlloy : public Profile {
bool HasAnyOffTheRecordProfile() override; bool HasAnyOffTheRecordProfile() override;
Profile* GetOriginalProfile() override; Profile* GetOriginalProfile() override;
const Profile* GetOriginalProfile() const override; const Profile* GetOriginalProfile() const override;
bool IsSupervised() const override;
bool IsChild() const override; bool IsChild() const override;
ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy() override; ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy() override;
bool IsSameOrParent(Profile* profile) override; bool IsSameOrParent(Profile* profile) override;
@@ -51,8 +54,6 @@ class ChromeProfileAlloy : public Profile {
private: private:
std::unique_ptr<variations::VariationsClient> variations_client_; std::unique_ptr<variations::VariationsClient> variations_client_;
DISALLOW_COPY_AND_ASSIGN(ChromeProfileAlloy);
}; };
#endif // CEF_LIBCEF_BROWSER_ALLOY_CHROME_PROFILE_ALLOY_H_ #endif // CEF_LIBCEF_BROWSER_ALLOY_CHROME_PROFILE_ALLOY_H_

View File

@@ -14,13 +14,15 @@
class ChromeProfileManagerAlloy : public ProfileManager { class ChromeProfileManagerAlloy : public ProfileManager {
public: public:
ChromeProfileManagerAlloy(); ChromeProfileManagerAlloy();
ChromeProfileManagerAlloy(const ChromeProfileManagerAlloy&) = delete;
ChromeProfileManagerAlloy& operator=(const ChromeProfileManagerAlloy&) =
delete;
~ChromeProfileManagerAlloy() override; ~ChromeProfileManagerAlloy() override;
Profile* GetProfile(const base::FilePath& profile_dir) override; Profile* GetProfile(const base::FilePath& profile_dir) override;
bool IsValidProfile(const void* profile) override; bool IsValidProfile(const void* profile) override;
private:
DISALLOW_COPY_AND_ASSIGN(ChromeProfileManagerAlloy);
}; };
#endif // CEF_LIBCEF_BROWSER_ALLOY_CHROME_PROFILE_MANAGER_ALLOY_H_ #endif // CEF_LIBCEF_BROWSER_ALLOY_CHROME_PROFILE_MANAGER_ALLOY_H_

View File

@@ -35,6 +35,10 @@ class StreamCreatedCallbackAdapter final
DCHECK(callback_); DCHECK(callback_);
} }
StreamCreatedCallbackAdapter(const StreamCreatedCallbackAdapter&) = delete;
StreamCreatedCallbackAdapter& operator=(const StreamCreatedCallbackAdapter&) =
delete;
~StreamCreatedCallbackAdapter() override {} ~StreamCreatedCallbackAdapter() override {}
// blink::mojom::RendererAudioInputStreamFactoryClient implementation. // blink::mojom::RendererAudioInputStreamFactoryClient implementation.
@@ -52,8 +56,6 @@ class StreamCreatedCallbackAdapter final
private: private:
const CefAudioLoopbackStreamCreator::StreamCreatedCallback callback_; const CefAudioLoopbackStreamCreator::StreamCreatedCallback callback_;
DISALLOW_COPY_AND_ASSIGN(StreamCreatedCallbackAdapter);
}; };
void CreateLoopbackStreamHelper( void CreateLoopbackStreamHelper(

View File

@@ -6,7 +6,6 @@
#define CEF_LIBCEF_BROWSER_AUDIO_LOOPBACK_STREAM_CREATOR_H_ #define CEF_LIBCEF_BROWSER_AUDIO_LOOPBACK_STREAM_CREATOR_H_
#include "base/callback.h" #include "base/callback.h"
#include "base/macros.h"
#include "content/browser/media/forwarding_audio_stream_factory.h" #include "content/browser/media/forwarding_audio_stream_factory.h"
#include "content/common/content_export.h" #include "content/common/content_export.h"
#include "media/mojo/mojom/audio_data_pipe.mojom.h" #include "media/mojo/mojom/audio_data_pipe.mojom.h"
@@ -25,6 +24,11 @@ class AudioParameters;
class CefAudioLoopbackStreamCreator final { class CefAudioLoopbackStreamCreator final {
public: public:
CefAudioLoopbackStreamCreator(); CefAudioLoopbackStreamCreator();
CefAudioLoopbackStreamCreator(const CefAudioLoopbackStreamCreator&) = delete;
CefAudioLoopbackStreamCreator& operator=(
const CefAudioLoopbackStreamCreator&) = delete;
~CefAudioLoopbackStreamCreator(); ~CefAudioLoopbackStreamCreator();
// The callback that is called when the requested stream is created. // The callback that is called when the requested stream is created.
@@ -44,8 +48,6 @@ class CefAudioLoopbackStreamCreator final {
private: private:
content::ForwardingAudioStreamFactory factory_; content::ForwardingAudioStreamFactory factory_;
DISALLOW_COPY_AND_ASSIGN(CefAudioLoopbackStreamCreator);
}; };
#endif // CEF_LIBCEF_BROWSER_AUDIO_LOOPBACK_STREAM_CREATOR_H_ #endif // CEF_LIBCEF_BROWSER_AUDIO_LOOPBACK_STREAM_CREATOR_H_

View File

@@ -91,7 +91,7 @@ content::WebContents* CefBrowserContentsDelegate::OpenURLFromTab(
void CefBrowserContentsDelegate::LoadingStateChanged( void CefBrowserContentsDelegate::LoadingStateChanged(
content::WebContents* source, content::WebContents* source,
bool to_different_document) { bool should_show_loading_ui) {
const int current_index = const int current_index =
source->GetController().GetLastCommittedEntryIndex(); source->GetController().GetLastCommittedEntryIndex();
const int max_index = source->GetController().GetEntryCount() - 1; const int max_index = source->GetController().GetEntryCount() - 1;

View File

@@ -72,6 +72,10 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
explicit CefBrowserContentsDelegate( explicit CefBrowserContentsDelegate(
scoped_refptr<CefBrowserInfo> browser_info); scoped_refptr<CefBrowserInfo> browser_info);
CefBrowserContentsDelegate(const CefBrowserContentsDelegate&) = delete;
CefBrowserContentsDelegate& operator=(const CefBrowserContentsDelegate&) =
delete;
void ObserveWebContents(content::WebContents* new_contents); void ObserveWebContents(content::WebContents* new_contents);
// Manage observer objects. The observer must either outlive this object or // Manage observer objects. The observer must either outlive this object or
@@ -84,7 +88,7 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
content::WebContents* source, content::WebContents* source,
const content::OpenURLParams& params) override; const content::OpenURLParams& params) override;
void LoadingStateChanged(content::WebContents* source, void LoadingStateChanged(content::WebContents* source,
bool to_different_document) override; bool should_show_loading_ui) override;
void UpdateTargetURL(content::WebContents* source, const GURL& url) override; void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
bool DidAddMessageToConsole(content::WebContents* source, bool DidAddMessageToConsole(content::WebContents* source,
blink::mojom::ConsoleMessageLevel log_level, blink::mojom::ConsoleMessageLevel log_level,
@@ -195,8 +199,6 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
// True if the focus is currently on an editable field on the page. // True if the focus is currently on an editable field on the page.
bool focus_on_editable_field_ = false; bool focus_on_editable_field_ = false;
DISALLOW_COPY_AND_ASSIGN(CefBrowserContentsDelegate);
}; };
#endif // CEF_LIBCEF_BROWSER_BROWSER_CONTENTS_DELEGATE_H_ #endif // CEF_LIBCEF_BROWSER_BROWSER_CONTENTS_DELEGATE_H_

View File

@@ -34,9 +34,13 @@ namespace {
// Manages the global list of Impl instances. // Manages the global list of Impl instances.
class ImplManager { class ImplManager {
public: public:
typedef std::vector<CefBrowserContext*> Vector; using Vector = std::vector<CefBrowserContext*>;
ImplManager() {} ImplManager() {}
ImplManager(const ImplManager&) = delete;
ImplManager& operator=(const ImplManager&) = delete;
~ImplManager() { ~ImplManager() {
DCHECK(all_.empty()); DCHECK(all_.empty());
DCHECK(map_.empty()); DCHECK(map_.empty());
@@ -122,12 +126,10 @@ class ImplManager {
return all_.end(); return all_.end();
} }
typedef std::map<base::FilePath, CefBrowserContext*> PathMap; using PathMap = std::map<base::FilePath, CefBrowserContext*>;
PathMap map_; PathMap map_;
Vector all_; Vector all_;
DISALLOW_COPY_AND_ASSIGN(ImplManager);
}; };
#if DCHECK_IS_ON() #if DCHECK_IS_ON()

View File

@@ -91,6 +91,9 @@ class Profile;
// the UI thread unless otherwise indicated. // the UI thread unless otherwise indicated.
class CefBrowserContext { class CefBrowserContext {
public: public:
CefBrowserContext(const CefBrowserContext&) = delete;
CefBrowserContext& operator=(const CefBrowserContext&) = delete;
// Returns the existing instance, if any, associated with the specified // Returns the existing instance, if any, associated with the specified
// |cache_path|. // |cache_path|.
static CefBrowserContext* FromCachePath(const base::FilePath& cache_path); static CefBrowserContext* FromCachePath(const base::FilePath& cache_path);
@@ -226,7 +229,7 @@ class CefBrowserContext {
CefRequestContextHandlerMap handler_map_; CefRequestContextHandlerMap handler_map_;
// Set of global IDs associated with this context. // Set of global IDs associated with this context.
typedef std::set<content::GlobalRenderFrameHostId> RenderIdSet; using RenderIdSet = std::set<content::GlobalRenderFrameHostId>;
RenderIdSet render_id_set_; RenderIdSet render_id_set_;
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
@@ -235,8 +238,6 @@ class CefBrowserContext {
Getter getter_; Getter getter_;
base::WeakPtrFactory<CefBrowserContext> weak_ptr_factory_; base::WeakPtrFactory<CefBrowserContext> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(CefBrowserContext);
}; };
#endif // CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_IMPL_H_ #endif // CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_IMPL_H_

View File

@@ -35,18 +35,20 @@ void CefBrowserFrame::RegisterBrowserInterfaceBindersForFrame(
void CefBrowserFrame::SendMessage(const std::string& name, void CefBrowserFrame::SendMessage(const std::string& name,
base::Value arguments) { base::Value arguments) {
// Always associate with the newly created RFH, which may be speculative when // Always send to the newly created RFH, which may be speculative when
// navigating cross-origin. // navigating cross-origin.
if (auto host = GetFrameHost(/*prefer_speculative=*/true)) { if (auto host = GetFrameHost(/*prefer_speculative=*/true)) {
host->SendMessage(name, std::move(arguments)); host->SendMessage(name, std::move(arguments));
} }
} }
void CefBrowserFrame::FrameAttached() { void CefBrowserFrame::FrameAttached(
mojo::PendingRemote<cef::mojom::RenderFrame> render_frame,
bool reattached) {
// Always send to the newly created RFH, which may be speculative when // Always send to the newly created RFH, which may be speculative when
// navigating cross-origin. // navigating cross-origin.
if (auto host = GetFrameHost(/*prefer_speculative=*/true)) { if (auto host = GetFrameHost(/*prefer_speculative=*/true)) {
host->FrameAttached(); host->FrameAttached(std::move(render_frame), reattached);
} }
} }

View File

@@ -22,6 +22,10 @@ class CefBrowserFrame
public: public:
CefBrowserFrame(content::RenderFrameHost* render_frame_host, CefBrowserFrame(content::RenderFrameHost* render_frame_host,
mojo::PendingReceiver<cef::mojom::BrowserFrame> receiver); mojo::PendingReceiver<cef::mojom::BrowserFrame> receiver);
CefBrowserFrame(const CefBrowserFrame&) = delete;
CefBrowserFrame& operator=(const CefBrowserFrame&) = delete;
~CefBrowserFrame() override; ~CefBrowserFrame() override;
// Called from the ContentBrowserClient method of the same name. // Called from the ContentBrowserClient method of the same name.
@@ -32,7 +36,8 @@ class CefBrowserFrame
private: private:
// cef::mojom::BrowserFrame methods: // cef::mojom::BrowserFrame methods:
void SendMessage(const std::string& name, base::Value arguments) override; void SendMessage(const std::string& name, base::Value arguments) override;
void FrameAttached() override; void FrameAttached(mojo::PendingRemote<cef::mojom::RenderFrame> render_frame,
bool reattached) override;
void DidFinishFrameLoad(const GURL& validated_url, void DidFinishFrameLoad(const GURL& validated_url,
int32_t http_status_code) override; int32_t http_status_code) override;
void UpdateDraggableRegions( void UpdateDraggableRegions(
@@ -44,8 +49,6 @@ class CefBrowserFrame
CefRefPtr<CefFrameHostImpl> GetFrameHost( CefRefPtr<CefFrameHostImpl> GetFrameHost(
bool prefer_speculative = false) const; bool prefer_speculative = false) const;
DISALLOW_COPY_AND_ASSIGN(CefBrowserFrame);
}; };
#endif // CEF_LIBCEF_BROWSER_BROWSER_FRAME_H_ #endif // CEF_LIBCEF_BROWSER_BROWSER_FRAME_H_

View File

@@ -4,6 +4,8 @@
#include "libcef/browser/browser_host_base.h" #include "libcef/browser/browser_host_base.h"
#include <tuple>
#include "libcef/browser/browser_info_manager.h" #include "libcef/browser/browser_info_manager.h"
#include "libcef/browser/browser_platform_delegate.h" #include "libcef/browser/browser_platform_delegate.h"
#include "libcef/browser/context.h" #include "libcef/browser/context.h"
@@ -24,7 +26,7 @@
#include "content/public/browser/navigation_entry.h" #include "content/public/browser/navigation_entry.h"
#include "ui/gfx/image/image_skia.h" #include "ui/gfx/image/image_skia.h"
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
#include "components/spellcheck/browser/spellcheck_platform.h" #include "components/spellcheck/browser/spellcheck_platform.h"
#endif #endif
@@ -345,7 +347,7 @@ void CefBrowserHostBase::GetNavigationEntries(
CefRefPtr<CefNavigationEntryImpl> entry = CefRefPtr<CefNavigationEntryImpl> entry =
new CefNavigationEntryImpl(controller.GetEntryAtIndex(current)); new CefNavigationEntryImpl(controller.GetEntryAtIndex(current));
visitor->Visit(entry.get(), true, current, total); visitor->Visit(entry.get(), true, current, total);
ignore_result(entry->Detach(nullptr)); std::ignore = entry->Detach(nullptr);
} else { } else {
// Visit all entries. // Visit all entries.
bool cont = true; bool cont = true;
@@ -353,7 +355,7 @@ void CefBrowserHostBase::GetNavigationEntries(
CefRefPtr<CefNavigationEntryImpl> entry = CefRefPtr<CefNavigationEntryImpl> entry =
new CefNavigationEntryImpl(controller.GetEntryAtIndex(i)); new CefNavigationEntryImpl(controller.GetEntryAtIndex(i));
cont = visitor->Visit(entry.get(), (i == current), i, total); cont = visitor->Visit(entry.get(), (i == current), i, total);
ignore_result(entry->Detach(nullptr)); std::ignore = entry->Detach(nullptr);
} }
} }
} }
@@ -407,7 +409,7 @@ void CefBrowserHostBase::AddWordToDictionary(const CefString& word) {
if (spellcheck) if (spellcheck)
spellcheck->GetCustomDictionary()->AddWord(word); spellcheck->GetCustomDictionary()->AddWord(word);
} }
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
if (spellcheck && spellcheck::UseBrowserSpellChecker()) { if (spellcheck && spellcheck::UseBrowserSpellChecker()) {
spellcheck_platform::AddWord(spellcheck->platform_spell_checker(), word); spellcheck_platform::AddWord(spellcheck->platform_spell_checker(), word);
} }

View File

@@ -134,6 +134,9 @@ class CefBrowserHostBase : public CefBrowserHost,
scoped_refptr<CefBrowserInfo> browser_info, scoped_refptr<CefBrowserInfo> browser_info,
CefRefPtr<CefRequestContextImpl> request_context); CefRefPtr<CefRequestContextImpl> request_context);
CefBrowserHostBase(const CefBrowserHostBase&) = delete;
CefBrowserHostBase& operator=(const CefBrowserHostBase&) = delete;
// Called on the UI thread after the associated WebContents is created. // Called on the UI thread after the associated WebContents is created.
virtual void InitializeBrowser(); virtual void InitializeBrowser();
@@ -310,7 +313,6 @@ class CefBrowserHostBase : public CefBrowserHost,
private: private:
IMPLEMENT_REFCOUNTING(CefBrowserHostBase); IMPLEMENT_REFCOUNTING(CefBrowserHostBase);
DISALLOW_COPY_AND_ASSIGN(CefBrowserHostBase);
}; };
#endif // CEF_LIBCEF_BROWSER_BROWSER_HOST_BASE_H_ #endif // CEF_LIBCEF_BROWSER_BROWSER_HOST_BASE_H_

View File

@@ -168,10 +168,13 @@ void CefBrowserInfo::FrameHostStateChanged(
content::RenderFrameHost::LifecycleState::kInBackForwardCache) && content::RenderFrameHost::LifecycleState::kInBackForwardCache) &&
new_state == content::RenderFrameHost::LifecycleState::kActive) { new_state == content::RenderFrameHost::LifecycleState::kActive) {
if (auto frame = GetFrameForHost(host)) { if (auto frame = GetFrameForHost(host)) {
// Should only occur for the main frame.
CHECK(frame->IsMain());
// Update the associated RFH, which may have changed. // Update the associated RFH, which may have changed.
frame->MaybeReAttach(this, host); frame->MaybeReAttach(this, host);
if (frame->IsMain()) { {
// Update the main frame object. // Update the main frame object.
NotificationStateLock lock_scope(this); NotificationStateLock lock_scope(this);
SetMainFrame(browser_, frame); SetMainFrame(browser_, frame);

View File

@@ -39,6 +39,9 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
bool is_windowless, bool is_windowless,
CefRefPtr<CefDictionaryValue> extra_info); CefRefPtr<CefDictionaryValue> extra_info);
CefBrowserInfo(const CefBrowserInfo&) = delete;
CefBrowserInfo& operator=(const CefBrowserInfo&) = delete;
int browser_id() const { return browser_id_; } int browser_id() const { return browser_id_; }
bool is_popup() const { return is_popup_; } bool is_popup() const { return is_popup_; }
bool is_windowless() const { return is_windowless_; } bool is_windowless() const { return is_windowless_; }
@@ -119,7 +122,7 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
// Returns all non-speculative frame objects that currently exist. Guest views // Returns all non-speculative frame objects that currently exist. Guest views
// will be excluded because they don't have a frame object. Safe to call from // will be excluded because they don't have a frame object. Safe to call from
// any thread. // any thread.
typedef std::set<CefRefPtr<CefFrameHostImpl>> FrameHostList; using FrameHostList = std::set<CefRefPtr<CefFrameHostImpl>>;
FrameHostList GetAllFrames() const; FrameHostList GetAllFrames() const;
class NavigationLock final : public base::RefCounted<NavigationLock> { class NavigationLock final : public base::RefCounted<NavigationLock> {
@@ -251,8 +254,6 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
// Only accessed on the UI thread. // Only accessed on the UI thread.
std::vector<CefDraggableRegion> draggable_regions_; std::vector<CefDraggableRegion> draggable_regions_;
DISALLOW_COPY_AND_ASSIGN(CefBrowserInfo);
}; };
#endif // CEF_LIBCEF_BROWSER_BROWSER_INFO_H_ #endif // CEF_LIBCEF_BROWSER_BROWSER_INFO_H_

View File

@@ -131,7 +131,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
std::unique_ptr<CefWindowInfo> window_info(new CefWindowInfo); std::unique_ptr<CefWindowInfo> window_info(new CefWindowInfo);
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
window_info->SetAsPopup(nullptr, CefString()); window_info->SetAsPopup(nullptr, CefString());
#endif #endif
@@ -154,7 +154,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
CefPopupFeatures cef_features; CefPopupFeatures cef_features;
TranslatePopupFeatures(features, cef_features); TranslatePopupFeatures(features, cef_features);
#if (defined(OS_WIN) || defined(OS_MAC)) #if (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC))
// Default to the size from the popup features. // Default to the size from the popup features.
if (cef_features.xSet) if (cef_features.xSet)
window_info->bounds.x = cef_features.x; window_info->bounds.x = cef_features.x;

View File

@@ -44,6 +44,10 @@ class CefBrowserPlatformDelegate;
class CefBrowserInfoManager : public content::RenderProcessHostObserver { class CefBrowserInfoManager : public content::RenderProcessHostObserver {
public: public:
CefBrowserInfoManager(); CefBrowserInfoManager();
CefBrowserInfoManager(const CefBrowserInfoManager&) = delete;
CefBrowserInfoManager& operator=(const CefBrowserInfoManager&) = delete;
~CefBrowserInfoManager() override; ~CefBrowserInfoManager() override;
// Returns this singleton instance of this class. // Returns this singleton instance of this class.
@@ -232,8 +236,6 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
PendingPopupList pending_popup_list_; PendingPopupList pending_popup_list_;
int next_timeout_id_ = 0; int next_timeout_id_ = 0;
DISALLOW_COPY_AND_ASSIGN(CefBrowserInfoManager);
}; };
#endif // CEF_LIBCEF_BROWSER_BROWSER_INFO_H_ #endif // CEF_LIBCEF_BROWSER_BROWSER_INFO_H_

View File

@@ -20,6 +20,10 @@ class RenderProcessHost;
class CefBrowserManager : public cef::mojom::BrowserManager { class CefBrowserManager : public cef::mojom::BrowserManager {
public: public:
explicit CefBrowserManager(int render_process_id); explicit CefBrowserManager(int render_process_id);
CefBrowserManager(const CefBrowserManager&) = delete;
CefBrowserManager& operator=(const CefBrowserManager&) = delete;
~CefBrowserManager() override; ~CefBrowserManager() override;
// Called from the ContentBrowserClient method of the same name. // Called from the ContentBrowserClient method of the same name.
@@ -47,8 +51,6 @@ class CefBrowserManager : public cef::mojom::BrowserManager {
// The process ID of the renderer. // The process ID of the renderer.
const int render_process_id_; const int render_process_id_;
DISALLOW_COPY_AND_ASSIGN(CefBrowserManager);
}; };
#endif // CEF_LIBCEF_BROWSER_BROWSER_MANAGER_H_ #endif // CEF_LIBCEF_BROWSER_BROWSER_MANAGER_H_

View File

@@ -9,7 +9,7 @@
#include "base/message_loop/message_pump.h" #include "base/message_loop/message_pump.h"
#include "base/message_loop/message_pump_for_ui.h" #include "base/message_loop/message_pump_for_ui.h"
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
#include "base/mac/scoped_nsautorelease_pool.h" #include "base/mac/scoped_nsautorelease_pool.h"
#include "base/message_loop/message_pump_mac.h" #include "base/message_loop/message_pump_mac.h"
#endif #endif
@@ -29,7 +29,7 @@ class MessagePumpExternal : public base::MessagePumpForUI {
void Run(Delegate* delegate) override { void Run(Delegate* delegate) override {
base::TimeTicks start = base::TimeTicks::Now(); base::TimeTicks start = base::TimeTicks::Now();
while (true) { while (true) {
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
base::mac::ScopedNSAutoreleasePool autorelease_pool; base::mac::ScopedNSAutoreleasePool autorelease_pool;
#endif #endif
@@ -108,7 +108,7 @@ std::unique_ptr<base::MessagePump> MessagePumpFactoryForUI() {
return std::make_unique<MessagePumpExternal>(0.01f, handler); return std::make_unique<MessagePumpExternal>(0.01f, handler);
} }
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
return base::MessagePumpMac::Create(); return base::MessagePumpMac::Create();
#else #else
return std::make_unique<base::MessagePumpForUI>(); return std::make_unique<base::MessagePumpForUI>();

View File

@@ -180,7 +180,7 @@ void CefBrowserPlatformDelegate::SendCaptureLostEvent() {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC)) #if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC))
void CefBrowserPlatformDelegate::NotifyMoveOrResizeStarted() {} void CefBrowserPlatformDelegate::NotifyMoveOrResizeStarted() {}
void CefBrowserPlatformDelegate::SizeTo(int width, int height) {} void CefBrowserPlatformDelegate::SizeTo(int width, int height) {}
@@ -381,8 +381,7 @@ void CefBrowserPlatformDelegate::PrintToPDF(
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void CefBrowserPlatformDelegate::Find(int identifier, void CefBrowserPlatformDelegate::Find(const CefString& searchText,
const CefString& searchText,
bool forward, bool forward,
bool matchCase, bool matchCase,
bool findNext) { bool findNext) {

View File

@@ -74,6 +74,10 @@ class CefMenuRunner;
// indicated. // indicated.
class CefBrowserPlatformDelegate { class CefBrowserPlatformDelegate {
public: public:
CefBrowserPlatformDelegate(const CefBrowserPlatformDelegate&) = delete;
CefBrowserPlatformDelegate& operator=(const CefBrowserPlatformDelegate&) =
delete;
// Create a new CefBrowserPlatformDelegate instance. May be called on multiple // Create a new CefBrowserPlatformDelegate instance. May be called on multiple
// threads. // threads.
static std::unique_ptr<CefBrowserPlatformDelegate> Create( static std::unique_ptr<CefBrowserPlatformDelegate> Create(
@@ -230,7 +234,7 @@ class CefBrowserPlatformDelegate {
// Send capture lost event. // Send capture lost event.
virtual void SendCaptureLostEvent(); virtual void SendCaptureLostEvent();
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC)) #if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC))
// The window hosting the browser is about to be moved or resized. Only used // The window hosting the browser is about to be moved or resized. Only used
// on Windows and Linux. // on Windows and Linux.
virtual void NotifyMoveOrResizeStarted(); virtual void NotifyMoveOrResizeStarted();
@@ -349,8 +353,7 @@ class CefBrowserPlatformDelegate {
virtual void PrintToPDF(const CefString& path, virtual void PrintToPDF(const CefString& path,
const CefPdfPrintSettings& settings, const CefPdfPrintSettings& settings,
CefRefPtr<CefPdfPrintCallback> callback); CefRefPtr<CefPdfPrintCallback> callback);
virtual void Find(int identifier, virtual void Find(const CefString& searchText,
const CefString& searchText,
bool forward, bool forward,
bool matchCase, bool matchCase,
bool findNext); bool findNext);
@@ -368,8 +371,6 @@ class CefBrowserPlatformDelegate {
// Not owned by this object. // Not owned by this object.
content::WebContents* web_contents_ = nullptr; content::WebContents* web_contents_ = nullptr;
CefBrowserHostBase* browser_ = nullptr; CefBrowserHostBase* browser_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(CefBrowserPlatformDelegate);
}; };
#endif // CEF_LIBCEF_BROWSER_BROWSER_PLATFORM_DELEGATE_H_ #endif // CEF_LIBCEF_BROWSER_BROWSER_PLATFORM_DELEGATE_H_

View File

@@ -16,13 +16,13 @@
#include "libcef/browser/extensions/browser_platform_delegate_background.h" #include "libcef/browser/extensions/browser_platform_delegate_background.h"
#include "libcef/features/runtime_checks.h" #include "libcef/features/runtime_checks.h"
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include "libcef/browser/native/browser_platform_delegate_native_win.h" #include "libcef/browser/native/browser_platform_delegate_native_win.h"
#include "libcef/browser/osr/browser_platform_delegate_osr_win.h" #include "libcef/browser/osr/browser_platform_delegate_osr_win.h"
#elif defined(OS_MAC) #elif BUILDFLAG(IS_MAC)
#include "libcef/browser/native/browser_platform_delegate_native_mac.h" #include "libcef/browser/native/browser_platform_delegate_native_mac.h"
#include "libcef/browser/osr/browser_platform_delegate_osr_mac.h" #include "libcef/browser/osr/browser_platform_delegate_osr_mac.h"
#elif defined(OS_LINUX) #elif BUILDFLAG(IS_LINUX)
#include "libcef/browser/native/browser_platform_delegate_native_linux.h" #include "libcef/browser/native/browser_platform_delegate_native_linux.h"
#include "libcef/browser/osr/browser_platform_delegate_osr_linux.h" #include "libcef/browser/osr/browser_platform_delegate_osr_linux.h"
#else #else
@@ -39,13 +39,13 @@ namespace {
std::unique_ptr<CefBrowserPlatformDelegateNative> CreateNativeDelegate( std::unique_ptr<CefBrowserPlatformDelegateNative> CreateNativeDelegate(
const CefWindowInfo& window_info, const CefWindowInfo& window_info,
SkColor background_color) { SkColor background_color) {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
return std::make_unique<CefBrowserPlatformDelegateNativeWin>( return std::make_unique<CefBrowserPlatformDelegateNativeWin>(
window_info, background_color); window_info, background_color);
#elif defined(OS_MAC) #elif BUILDFLAG(IS_MAC)
return std::make_unique<CefBrowserPlatformDelegateNativeMac>( return std::make_unique<CefBrowserPlatformDelegateNativeMac>(
window_info, background_color); window_info, background_color);
#elif defined(OS_LINUX) #elif BUILDFLAG(IS_LINUX)
return std::make_unique<CefBrowserPlatformDelegateNativeLinux>( return std::make_unique<CefBrowserPlatformDelegateNativeLinux>(
window_info, background_color); window_info, background_color);
#endif #endif
@@ -55,13 +55,13 @@ std::unique_ptr<CefBrowserPlatformDelegateOsr> CreateOSRDelegate(
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate, std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate,
bool use_shared_texture, bool use_shared_texture,
bool use_external_begin_frame) { bool use_external_begin_frame) {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
return std::make_unique<CefBrowserPlatformDelegateOsrWin>( return std::make_unique<CefBrowserPlatformDelegateOsrWin>(
std::move(native_delegate), use_shared_texture, use_external_begin_frame); std::move(native_delegate), use_shared_texture, use_external_begin_frame);
#elif defined(OS_MAC) #elif BUILDFLAG(IS_MAC)
return std::make_unique<CefBrowserPlatformDelegateOsrMac>( return std::make_unique<CefBrowserPlatformDelegateOsrMac>(
std::move(native_delegate)); std::move(native_delegate));
#elif defined(OS_LINUX) #elif BUILDFLAG(IS_LINUX)
return std::make_unique<CefBrowserPlatformDelegateOsrLinux>( return std::make_unique<CefBrowserPlatformDelegateOsrLinux>(
std::move(native_delegate), use_external_begin_frame); std::move(native_delegate), use_external_begin_frame);
#endif #endif

View File

@@ -8,9 +8,9 @@
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/keep_alive/profile_keep_alive_types.h"
#include "chrome/browser/profiles/keep_alive/scoped_profile_keep_alive.h"
#include "chrome/browser/profiles/off_the_record_profile_impl.h" #include "chrome/browser/profiles/off_the_record_profile_impl.h"
#include "chrome/browser/profiles/profile_keep_alive_types.h"
#include "chrome/browser/profiles/scoped_profile_keep_alive.h"
ChromeBrowserContext::ChromeBrowserContext( ChromeBrowserContext::ChromeBrowserContext(
const CefRequestContextSettings& settings) const CefRequestContextSettings& settings)

View File

@@ -20,6 +20,9 @@ class ChromeBrowserContext : public CefBrowserContext, public ProfileObserver {
public: public:
explicit ChromeBrowserContext(const CefRequestContextSettings& settings); explicit ChromeBrowserContext(const CefRequestContextSettings& settings);
ChromeBrowserContext(const ChromeBrowserContext&) = delete;
ChromeBrowserContext& operator=(const ChromeBrowserContext&) = delete;
void InitializeAsync(base::OnceClosure initialized_cb); void InitializeAsync(base::OnceClosure initialized_cb);
// CefBrowserContext overrides. // CefBrowserContext overrides.
@@ -47,8 +50,6 @@ class ChromeBrowserContext : public CefBrowserContext, public ProfileObserver {
std::vector<base::OnceClosure> init_callbacks_; std::vector<base::OnceClosure> init_callbacks_;
base::WeakPtrFactory<ChromeBrowserContext> weak_ptr_factory_; base::WeakPtrFactory<ChromeBrowserContext> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserContext);
}; };
#endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_BROWSER_CONTEXT_H_ #endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_BROWSER_CONTEXT_H_

View File

@@ -152,9 +152,9 @@ content::WebContents* ChromeBrowserDelegate::OpenURLFromTab(
} }
void ChromeBrowserDelegate::LoadingStateChanged(content::WebContents* source, void ChromeBrowserDelegate::LoadingStateChanged(content::WebContents* source,
bool to_different_document) { bool should_show_loading_ui) {
if (auto delegate = GetDelegateForWebContents(source)) { if (auto delegate = GetDelegateForWebContents(source)) {
delegate->LoadingStateChanged(source, to_different_document); delegate->LoadingStateChanged(source, should_show_loading_ui);
} }
} }

View File

@@ -41,6 +41,10 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
public: public:
ChromeBrowserDelegate(Browser* browser, ChromeBrowserDelegate(Browser* browser,
const CefBrowserCreateParams& create_params); const CefBrowserCreateParams& create_params);
ChromeBrowserDelegate(const ChromeBrowserDelegate&) = delete;
ChromeBrowserDelegate& operator=(const ChromeBrowserDelegate&) = delete;
~ChromeBrowserDelegate() override; ~ChromeBrowserDelegate() override;
// cef::BrowserDelegate methods: // cef::BrowserDelegate methods:
@@ -66,7 +70,7 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
content::WebContents* source, content::WebContents* source,
const content::OpenURLParams& params) override; const content::OpenURLParams& params) override;
void LoadingStateChanged(content::WebContents* source, void LoadingStateChanged(content::WebContents* source,
bool to_different_document) override; bool should_show_loading_ui) override;
void UpdateTargetURL(content::WebContents* source, const GURL& url) override; void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
bool DidAddMessageToConsole(content::WebContents* source, bool DidAddMessageToConsole(content::WebContents* source,
blink::mojom::ConsoleMessageLevel log_level, blink::mojom::ConsoleMessageLevel log_level,
@@ -105,8 +109,6 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
// Used when creating a new browser host. // Used when creating a new browser host.
const CefBrowserCreateParams create_params_; const CefBrowserCreateParams create_params_;
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserDelegate);
}; };
#endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_BROWSER_DELEGATE_H_ #endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_BROWSER_DELEGATE_H_

View File

@@ -215,8 +215,7 @@ void ChromeBrowserHostImpl::PrintToPDF(
callback->OnPdfPrintFinished(CefString(), false); callback->OnPdfPrintFinished(CefString(), false);
} }
void ChromeBrowserHostImpl::Find(int identifier, void ChromeBrowserHostImpl::Find(const CefString& searchText,
const CefString& searchText,
bool forward, bool forward,
bool matchCase, bool matchCase,
bool findNext) { bool findNext) {

View File

@@ -74,8 +74,7 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
void PrintToPDF(const CefString& path, void PrintToPDF(const CefString& path,
const CefPdfPrintSettings& settings, const CefPdfPrintSettings& settings,
CefRefPtr<CefPdfPrintCallback> callback) override; CefRefPtr<CefPdfPrintCallback> callback) override;
void Find(int identifier, void Find(const CefString& searchText,
const CefString& searchText,
bool forward, bool forward,
bool matchCase, bool matchCase,
bool findNext) override; bool findNext) override;

View File

@@ -15,7 +15,11 @@ ChromeBrowserMainExtraPartsCef::ChromeBrowserMainExtraPartsCef() = default;
ChromeBrowserMainExtraPartsCef::~ChromeBrowserMainExtraPartsCef() = default; ChromeBrowserMainExtraPartsCef::~ChromeBrowserMainExtraPartsCef() = default;
void ChromeBrowserMainExtraPartsCef::PostProfileInit() { void ChromeBrowserMainExtraPartsCef::PostProfileInit(Profile* profile,
bool is_initial_profile) {
if (!is_initial_profile)
return;
CefRequestContextSettings settings; CefRequestContextSettings settings;
CefContext::Get()->PopulateGlobalRequestContextSettings(&settings); CefContext::Get()->PopulateGlobalRequestContextSettings(&settings);

View File

@@ -9,7 +9,6 @@
#include "libcef/browser/request_context_impl.h" #include "libcef/browser/request_context_impl.h"
#include "base/macros.h"
#include "base/task/single_thread_task_runner.h" #include "base/task/single_thread_task_runner.h"
#include "chrome/browser/chrome_browser_main_extra_parts.h" #include "chrome/browser/chrome_browser_main_extra_parts.h"
@@ -17,6 +16,12 @@
class ChromeBrowserMainExtraPartsCef : public ChromeBrowserMainExtraParts { class ChromeBrowserMainExtraPartsCef : public ChromeBrowserMainExtraParts {
public: public:
ChromeBrowserMainExtraPartsCef(); ChromeBrowserMainExtraPartsCef();
ChromeBrowserMainExtraPartsCef(const ChromeBrowserMainExtraPartsCef&) =
delete;
ChromeBrowserMainExtraPartsCef& operator=(
const ChromeBrowserMainExtraPartsCef&) = delete;
~ChromeBrowserMainExtraPartsCef() override; ~ChromeBrowserMainExtraPartsCef() override;
CefRefPtr<CefRequestContextImpl> request_context() const { CefRefPtr<CefRequestContextImpl> request_context() const {
@@ -36,7 +41,7 @@ class ChromeBrowserMainExtraPartsCef : public ChromeBrowserMainExtraParts {
private: private:
// ChromeBrowserMainExtraParts overrides. // ChromeBrowserMainExtraParts overrides.
void PostProfileInit() override; void PostProfileInit(Profile* profile, bool is_initial_profile) override;
void PreMainMessageLoopRun() override; void PreMainMessageLoopRun() override;
CefRefPtr<CefRequestContextImpl> global_request_context_; CefRefPtr<CefRequestContextImpl> global_request_context_;
@@ -47,8 +52,6 @@ class ChromeBrowserMainExtraPartsCef : public ChromeBrowserMainExtraParts {
scoped_refptr<base::SingleThreadTaskRunner> background_task_runner_; scoped_refptr<base::SingleThreadTaskRunner> background_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> user_visible_task_runner_; scoped_refptr<base::SingleThreadTaskRunner> user_visible_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> user_blocking_task_runner_; scoped_refptr<base::SingleThreadTaskRunner> user_blocking_task_runner_;
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainExtraPartsCef);
}; };
#endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_BROWSER_MAIN_EXTRA_PARTS_CEF_H_ #endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_BROWSER_MAIN_EXTRA_PARTS_CEF_H_

View File

@@ -5,6 +5,8 @@
#include "libcef/browser/chrome/chrome_content_browser_client_cef.h" #include "libcef/browser/chrome/chrome_content_browser_client_cef.h"
#include <tuple>
#include "libcef/browser/browser_frame.h" #include "libcef/browser/browser_frame.h"
#include "libcef/browser/browser_info_manager.h" #include "libcef/browser/browser_info_manager.h"
#include "libcef/browser/browser_manager.h" #include "libcef/browser/browser_manager.h"
@@ -34,6 +36,7 @@
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h" #include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/weak_document_ptr.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "third_party/blink/public/common/web_preferences/web_preferences.h" #include "third_party/blink/public/common/web_preferences/web_preferences.h"
#include "third_party/blink/public/mojom/loader/resource_load_info.mojom-shared.h" #include "third_party/blink/public/mojom/loader/resource_load_info.mojom-shared.h"
@@ -46,7 +49,15 @@ void HandleExternalProtocolHelper(
int frame_tree_node_id, int frame_tree_node_id,
content::NavigationUIData* navigation_data, content::NavigationUIData* navigation_data,
network::mojom::WebSandboxFlags sandbox_flags, network::mojom::WebSandboxFlags sandbox_flags,
const network::ResourceRequest& resource_request) { const network::ResourceRequest& resource_request,
const absl::optional<url::Origin>& initiating_origin,
content::WeakDocumentPtr initiator_document) {
// May return nullptr if frame has been deleted or a cross-document navigation
// has committed in the same RenderFrameHost.
auto initiator_rfh = initiator_document.AsRenderFrameHostIfValid();
if (!initiator_rfh)
return;
// Match the logic of the original call in // Match the logic of the original call in
// NavigationURLLoaderImpl::PrepareForNonInterceptedRequest. // NavigationURLLoaderImpl::PrepareForNonInterceptedRequest.
self->HandleExternalProtocol( self->HandleExternalProtocol(
@@ -57,7 +68,7 @@ void HandleExternalProtocolHelper(
static_cast<int>(blink::mojom::ResourceType::kMainFrame), static_cast<int>(blink::mojom::ResourceType::kMainFrame),
sandbox_flags, sandbox_flags,
static_cast<ui::PageTransition>(resource_request.transition_type), static_cast<ui::PageTransition>(resource_request.transition_type),
resource_request.has_user_gesture, resource_request.request_initiator, resource_request.has_user_gesture, initiating_origin, initiator_rfh,
nullptr); nullptr);
} }
@@ -68,9 +79,9 @@ ChromeContentBrowserClientCef::~ChromeContentBrowserClientCef() = default;
std::unique_ptr<content::BrowserMainParts> std::unique_ptr<content::BrowserMainParts>
ChromeContentBrowserClientCef::CreateBrowserMainParts( ChromeContentBrowserClientCef::CreateBrowserMainParts(
const content::MainFunctionParams& parameters) { content::MainFunctionParams parameters) {
auto main_parts = auto main_parts =
ChromeContentBrowserClient::CreateBrowserMainParts(parameters); ChromeContentBrowserClient::CreateBrowserMainParts(std::move(parameters));
browser_main_parts_ = new ChromeBrowserMainExtraPartsCef; browser_main_parts_ = new ChromeBrowserMainExtraPartsCef;
static_cast<ChromeBrowserMainParts*>(main_parts.get()) static_cast<ChromeBrowserMainParts*>(main_parts.get())
->AddParts( ->AddParts(
@@ -116,16 +127,6 @@ void ChromeContentBrowserClientCef::AppendExtraCommandLineSwitches(
}; };
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames, command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
base::size(kSwitchNames)); base::size(kSwitchNames));
#if !defined(OS_WIN)
// kPdfRenderer will be set for Windows in
// RenderProcessHostImpl::AppendRendererCommandLine.
content::RenderProcessHost* process =
content::RenderProcessHost::FromID(child_process_id);
if (process && process->IsPdf()) {
command_line->AppendSwitch(switches::kPdfRenderer);
}
#endif // !defined(OS_WIN)
} }
CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication(); CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication();
@@ -136,7 +137,7 @@ void ChromeContentBrowserClientCef::AppendExtraCommandLineSwitches(
CefRefPtr<CefCommandLineImpl> commandLinePtr( CefRefPtr<CefCommandLineImpl> commandLinePtr(
new CefCommandLineImpl(command_line, false, false)); new CefCommandLineImpl(command_line, false, false));
handler->OnBeforeChildProcessLaunch(commandLinePtr.get()); handler->OnBeforeChildProcessLaunch(commandLinePtr.get());
ignore_result(commandLinePtr->Detach(nullptr)); std::ignore = commandLinePtr->Detach(nullptr);
} }
} }
} }
@@ -255,6 +256,7 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
ui::PageTransition page_transition, ui::PageTransition page_transition,
bool has_user_gesture, bool has_user_gesture,
const absl::optional<url::Origin>& initiating_origin, const absl::optional<url::Origin>& initiating_origin,
content::RenderFrameHost* initiator_document,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) { mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
// |out_factory| will be non-nullptr when this method is initially called // |out_factory| will be non-nullptr when this method is initially called
// from NavigationURLLoaderImpl::PrepareForNonInterceptedRequest. // from NavigationURLLoaderImpl::PrepareForNonInterceptedRequest.
@@ -269,7 +271,7 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
return ChromeContentBrowserClient::HandleExternalProtocol( return ChromeContentBrowserClient::HandleExternalProtocol(
url, web_contents_getter, child_id, frame_tree_node_id, navigation_data, url, web_contents_getter, child_id, frame_tree_node_id, navigation_data,
is_main_frame, sandbox_flags, page_transition, has_user_gesture, is_main_frame, sandbox_flags, page_transition, has_user_gesture,
initiating_origin, nullptr); initiating_origin, initiator_document, nullptr);
} }
bool ChromeContentBrowserClientCef::HandleExternalProtocol( bool ChromeContentBrowserClientCef::HandleExternalProtocol(
@@ -278,16 +280,24 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
content::NavigationUIData* navigation_data, content::NavigationUIData* navigation_data,
network::mojom::WebSandboxFlags sandbox_flags, network::mojom::WebSandboxFlags sandbox_flags,
const network::ResourceRequest& resource_request, const network::ResourceRequest& resource_request,
const absl::optional<url::Origin>& initiating_origin,
content::RenderFrameHost* initiator_document,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) { mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver = mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver =
out_factory->InitWithNewPipeAndPassReceiver(); out_factory->InitWithNewPipeAndPassReceiver();
auto weak_initiator_document = initiator_document
? initiator_document->GetWeakDocumentPtr()
: content::WeakDocumentPtr();
// HandleExternalProtocolHelper may be called if nothing handles the request. // HandleExternalProtocolHelper may be called if nothing handles the request.
auto request_handler = net_service::CreateInterceptedRequestHandler( auto request_handler = net_service::CreateInterceptedRequestHandler(
web_contents_getter, frame_tree_node_id, resource_request, web_contents_getter, frame_tree_node_id, resource_request,
base::BindRepeating(HandleExternalProtocolHelper, base::Unretained(this), base::BindRepeating(HandleExternalProtocolHelper, base::Unretained(this),
web_contents_getter, frame_tree_node_id, web_contents_getter, frame_tree_node_id,
navigation_data, sandbox_flags, resource_request)); navigation_data, sandbox_flags, resource_request,
initiating_origin,
std::move(weak_initiator_document)));
net_service::ProxyURLLoaderFactory::CreateProxy( net_service::ProxyURLLoaderFactory::CreateProxy(
web_contents_getter, std::move(receiver), std::move(request_handler)); web_contents_getter, std::move(receiver), std::move(request_handler));

View File

@@ -10,7 +10,6 @@
#include "libcef/browser/request_context_impl.h" #include "libcef/browser/request_context_impl.h"
#include "base/macros.h"
#include "chrome/browser/chrome_content_browser_client.h" #include "chrome/browser/chrome_content_browser_client.h"
class ChromeBrowserMainExtraPartsCef; class ChromeBrowserMainExtraPartsCef;
@@ -19,11 +18,16 @@ class ChromeBrowserMainExtraPartsCef;
class ChromeContentBrowserClientCef : public ChromeContentBrowserClient { class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
public: public:
ChromeContentBrowserClientCef(); ChromeContentBrowserClientCef();
ChromeContentBrowserClientCef(const ChromeContentBrowserClientCef&) = delete;
ChromeContentBrowserClientCef& operator=(
const ChromeContentBrowserClientCef&) = delete;
~ChromeContentBrowserClientCef() override; ~ChromeContentBrowserClientCef() override;
// ChromeContentBrowserClient overrides. // ChromeContentBrowserClient overrides.
std::unique_ptr<content::BrowserMainParts> CreateBrowserMainParts( std::unique_ptr<content::BrowserMainParts> CreateBrowserMainParts(
const content::MainFunctionParams& parameters) override; content::MainFunctionParams parameters) override;
void AppendExtraCommandLineSwitches(base::CommandLine* command_line, void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
int child_process_id) override; int child_process_id) override;
void RenderProcessWillLaunch(content::RenderProcessHost* host) override; void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
@@ -67,6 +71,7 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
ui::PageTransition page_transition, ui::PageTransition page_transition,
bool has_user_gesture, bool has_user_gesture,
const absl::optional<url::Origin>& initiating_origin, const absl::optional<url::Origin>& initiating_origin,
content::RenderFrameHost* initiator_document,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
override; override;
bool HandleExternalProtocol( bool HandleExternalProtocol(
@@ -75,6 +80,8 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
content::NavigationUIData* navigation_data, content::NavigationUIData* navigation_data,
network::mojom::WebSandboxFlags sandbox_flags, network::mojom::WebSandboxFlags sandbox_flags,
const network::ResourceRequest& request, const network::ResourceRequest& request,
const absl::optional<url::Origin>& initiating_origin,
content::RenderFrameHost* initiator_document,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
override; override;
std::vector<std::unique_ptr<content::NavigationThrottle>> std::vector<std::unique_ptr<content::NavigationThrottle>>
@@ -114,8 +121,6 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
private: private:
ChromeBrowserMainExtraPartsCef* browser_main_parts_ = nullptr; ChromeBrowserMainExtraPartsCef* browser_main_parts_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(ChromeContentBrowserClientCef);
}; };
#endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_CONTENT_BROWSER_CLIENT_CEF_ #endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_CONTENT_BROWSER_CLIENT_CEF_

View File

@@ -23,6 +23,9 @@ class CefContextMenuObserver : public RenderViewContextMenuObserver,
CefRefPtr<CefContextMenuHandler> handler) CefRefPtr<CefContextMenuHandler> handler)
: context_menu_(context_menu), browser_(browser), handler_(handler) {} : context_menu_(context_menu), browser_(browser), handler_(handler) {}
CefContextMenuObserver(const CefContextMenuObserver&) = delete;
CefContextMenuObserver& operator=(const CefContextMenuObserver&) = delete;
// RenderViewContextMenuObserver methods: // RenderViewContextMenuObserver methods:
void InitMenu(const content::ContextMenuParams& params) override { void InitMenu(const content::ContextMenuParams& params) override {
@@ -177,8 +180,6 @@ class CefContextMenuObserver : public RenderViewContextMenuObserver,
// Map of command_id to ItemInfo. // Map of command_id to ItemInfo.
using ItemInfoMap = std::map<int, ItemInfo>; using ItemInfoMap = std::map<int, ItemInfo>;
ItemInfoMap iteminfomap_; ItemInfoMap iteminfomap_;
DISALLOW_COPY_AND_ASSIGN(CefContextMenuObserver);
}; };
std::unique_ptr<RenderViewContextMenuObserver> MenuCreatedCallback( std::unique_ptr<RenderViewContextMenuObserver> MenuCreatedCallback(

View File

@@ -17,6 +17,9 @@ class PopupWindowDelegate : public CefWindowDelegate {
explicit PopupWindowDelegate(CefRefPtr<CefBrowserView> browser_view) explicit PopupWindowDelegate(CefRefPtr<CefBrowserView> browser_view)
: browser_view_(browser_view) {} : browser_view_(browser_view) {}
PopupWindowDelegate(const PopupWindowDelegate&) = delete;
PopupWindowDelegate& operator=(const PopupWindowDelegate&) = delete;
void OnWindowCreated(CefRefPtr<CefWindow> window) override { void OnWindowCreated(CefRefPtr<CefWindow> window) override {
window->AddChildView(browser_view_); window->AddChildView(browser_view_);
window->Show(); window->Show();
@@ -38,7 +41,6 @@ class PopupWindowDelegate : public CefWindowDelegate {
CefRefPtr<CefBrowserView> browser_view_; CefRefPtr<CefBrowserView> browser_view_;
IMPLEMENT_REFCOUNTING(PopupWindowDelegate); IMPLEMENT_REFCOUNTING(PopupWindowDelegate);
DISALLOW_COPY_AND_ASSIGN(PopupWindowDelegate);
}; };
} // namespace } // namespace

View File

@@ -32,6 +32,9 @@ class ChromeBrowserView
ChromeBrowserView(CefBrowserViewDelegate* cef_delegate, ChromeBrowserView(CefBrowserViewDelegate* cef_delegate,
Delegate* browser_view_delegate); Delegate* browser_view_delegate);
ChromeBrowserView(const ChromeBrowserView&) = delete;
ChromeBrowserView& operator=(const ChromeBrowserView&) = delete;
// Called by ChromeBrowserHostImpl. // Called by ChromeBrowserHostImpl.
void InitBrowser(std::unique_ptr<Browser> browser, void InitBrowser(std::unique_ptr<Browser> browser,
CefRefPtr<CefBrowserView> browser_view); CefRefPtr<CefBrowserView> browser_view);
@@ -59,8 +62,6 @@ class ChromeBrowserView
bool destroyed_ = false; bool destroyed_ = false;
CefRefPtr<CefToolbarViewImpl> cef_toolbar_; CefRefPtr<CefToolbarViewImpl> cef_toolbar_;
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserView);
}; };
#endif // CEF_LIBCEF_BROWSER_CHROME_VIEWS_CHROME_BROWSER_VIEW_H_ #endif // CEF_LIBCEF_BROWSER_CHROME_VIEWS_CHROME_BROWSER_VIEW_H_

View File

@@ -17,7 +17,10 @@ class BrowserView;
class CefToolbarViewImpl class CefToolbarViewImpl
: public CefViewImpl<CefToolbarViewView, CefView, CefViewDelegate> { : public CefViewImpl<CefToolbarViewView, CefView, CefViewDelegate> {
public: public:
typedef CefViewImpl<CefToolbarViewView, CefView, CefViewDelegate> ParentClass; using ParentClass = CefViewImpl<CefToolbarViewView, CefView, CefViewDelegate>;
CefToolbarViewImpl(const CefToolbarViewImpl&) = delete;
CefToolbarViewImpl& operator=(const CefToolbarViewImpl&) = delete;
// Create a new CefToolbarViewImpl instance. |delegate| may be nullptr. // Create a new CefToolbarViewImpl instance. |delegate| may be nullptr.
static CefRefPtr<CefToolbarViewImpl> Create( static CefRefPtr<CefToolbarViewImpl> Create(
@@ -49,7 +52,6 @@ class CefToolbarViewImpl
absl::optional<ToolbarView::DisplayMode> const display_mode_; absl::optional<ToolbarView::DisplayMode> const display_mode_;
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefToolbarViewImpl); IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefToolbarViewImpl);
DISALLOW_COPY_AND_ASSIGN(CefToolbarViewImpl);
}; };
#endif // CEF_LIBCEF_BROWSER_VIEWS_SCROLL_VIEW_IMPL_H_ #endif // CEF_LIBCEF_BROWSER_VIEWS_SCROLL_VIEW_IMPL_H_

View File

@@ -12,7 +12,7 @@
class CefToolbarViewView : public CefViewView<ToolbarView, CefViewDelegate> { class CefToolbarViewView : public CefViewView<ToolbarView, CefViewDelegate> {
public: public:
typedef CefViewView<ToolbarView, CefViewDelegate> ParentClass; using ParentClass = CefViewView<ToolbarView, CefViewDelegate>;
// |cef_delegate| may be nullptr. // |cef_delegate| may be nullptr.
explicit CefToolbarViewView(CefViewDelegate* cef_delegate, explicit CefToolbarViewView(CefViewDelegate* cef_delegate,
@@ -20,8 +20,8 @@ class CefToolbarViewView : public CefViewView<ToolbarView, CefViewDelegate> {
BrowserView* browser_view, BrowserView* browser_view,
absl::optional<DisplayMode> display_mode); absl::optional<DisplayMode> display_mode);
private: CefToolbarViewView(const CefToolbarViewView&) = delete;
DISALLOW_COPY_AND_ASSIGN(CefToolbarViewView); CefToolbarViewView& operator=(const CefToolbarViewView&) = delete;
}; };
#endif // CEF_LIBCEF_BROWSER_CHROME_VIEWS_TOOLBAR_VIEW_VIEW_H_ #endif // CEF_LIBCEF_BROWSER_CHROME_VIEWS_TOOLBAR_VIEW_VIEW_H_

View File

@@ -5,11 +5,11 @@
#include "build/build_config.h" #include "build/build_config.h"
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
#include "chrome/app/chrome_crash_reporter_client.h" #include "chrome/app/chrome_crash_reporter_client.h"
// Required due to https://crrev.com/1c9f89a06f // Required due to https://crrev.com/1c9f89a06f
void ChromeCrashReporterClient::Create() {} void ChromeCrashReporterClient::Create() {}
#endif // defined(OS_MAC) #endif // BUILDFLAG(IS_MAC)

View File

@@ -20,7 +20,7 @@
#include "content/public/browser/notification_types.h" #include "content/public/browser/notification_types.h"
#include "ui/base/ui_base_switches.h" #include "ui/base/ui_base_switches.h"
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/chrome_elf/chrome_elf_main.h" #include "chrome/chrome_elf/chrome_elf_main.h"
#include "chrome/install_static/initialize_from_primary_module.h" #include "chrome/install_static/initialize_from_primary_module.h"
@@ -38,7 +38,7 @@ class CefShutdownChecker {
} g_shutdown_checker; } g_shutdown_checker;
#endif // DCHECK_IS_ON() #endif // DCHECK_IS_ON()
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#if defined(ARCH_CPU_X86_64) #if defined(ARCH_CPU_X86_64)
// VS2013 only checks the existence of FMA3 instructions, not the enabled-ness // VS2013 only checks the existence of FMA3 instructions, not the enabled-ness
// of them at the OS level (this is fixed in VS2015). We force off usage of // of them at the OS level (this is fixed in VS2015). We force off usage of
@@ -72,7 +72,7 @@ void InitCrashReporter() {
initialized = true; initialized = true;
SignalInitializeCrashReporting(); SignalInitializeCrashReporting();
} }
#endif // defined(OS_WIN) #endif // BUILDFLAG(IS_WIN)
bool GetColor(const cef_color_t cef_in, bool is_windowless, SkColor* sk_out) { bool GetColor(const cef_color_t cef_in, bool is_windowless, SkColor* sk_out) {
// Windowed browser colors must be fully opaque. // Windowed browser colors must be fully opaque.
@@ -117,7 +117,7 @@ base::FilePath NormalizePath(const cef_string_t& path_str,
} }
void SetPath(cef_string_t& path_str, const base::FilePath& path) { void SetPath(cef_string_t& path_str, const base::FilePath& path) {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
CefString(&path_str).FromWString(path.value()); CefString(&path_str).FromWString(path.value());
#else #else
CefString(&path_str).FromString(path.value()); CefString(&path_str).FromString(path.value());
@@ -175,7 +175,7 @@ base::FilePath NormalizeCachePathAndSet(cef_string_t& path_str,
int CefExecuteProcess(const CefMainArgs& args, int CefExecuteProcess(const CefMainArgs& args,
CefRefPtr<CefApp> application, CefRefPtr<CefApp> application,
void* windows_sandbox_info) { void* windows_sandbox_info) {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#if defined(ARCH_CPU_X86_64) #if defined(ARCH_CPU_X86_64)
DisableFMA3(); DisableFMA3();
#endif #endif
@@ -191,7 +191,7 @@ bool CefInitialize(const CefMainArgs& args,
const CefSettings& settings, const CefSettings& settings,
CefRefPtr<CefApp> application, CefRefPtr<CefApp> application,
void* windows_sandbox_info) { void* windows_sandbox_info) {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#if defined(ARCH_CPU_X86_64) #if defined(ARCH_CPU_X86_64)
DisableFMA3(); DisableFMA3();
#endif #endif
@@ -287,7 +287,7 @@ void CefQuitMessageLoop() {
} }
void CefSetOSModalLoop(bool osModalLoop) { void CefSetOSModalLoop(bool osModalLoop) {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
// Verify that the context is in a valid state. // Verify that the context is in a valid state.
if (!CONTEXT_STATE_VALID()) { if (!CONTEXT_STATE_VALID()) {
NOTREACHED() << "context not valid"; NOTREACHED() << "context not valid";
@@ -300,7 +300,7 @@ void CefSetOSModalLoop(bool osModalLoop) {
} }
base::CurrentThread::Get()->set_os_modal_loop(osModalLoop); base::CurrentThread::Get()->set_os_modal_loop(osModalLoop);
#endif // defined(OS_WIN) #endif // BUILDFLAG(IS_WIN)
} }
// CefContext // CefContext
@@ -323,14 +323,14 @@ bool CefContext::Initialize(const CefMainArgs& args,
settings_ = settings; settings_ = settings;
application_ = application; application_ = application;
#if !(defined(OS_WIN) || defined(OS_LINUX)) #if !(BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX))
if (settings.multi_threaded_message_loop) { if (settings.multi_threaded_message_loop) {
NOTIMPLEMENTED() << "multi_threaded_message_loop is not supported."; NOTIMPLEMENTED() << "multi_threaded_message_loop is not supported.";
return false; return false;
} }
#endif #endif
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
// Signal Chrome Elf that Chrome has begun to start. // Signal Chrome Elf that Chrome has begun to start.
SignalChromeElf(); SignalChromeElf();
#endif #endif

View File

@@ -17,6 +17,9 @@ class CefContextMenuParamsImpl
public: public:
explicit CefContextMenuParamsImpl(content::ContextMenuParams* value); explicit CefContextMenuParamsImpl(content::ContextMenuParams* value);
CefContextMenuParamsImpl(const CefContextMenuParamsImpl&) = delete;
CefContextMenuParamsImpl& operator=(const CefContextMenuParamsImpl&) = delete;
// CefContextMenuParams methods. // CefContextMenuParams methods.
int GetXCoord() override; int GetXCoord() override;
int GetYCoord() override; int GetYCoord() override;
@@ -38,8 +41,6 @@ class CefContextMenuParamsImpl
bool IsSpellCheckEnabled() override; bool IsSpellCheckEnabled() override;
EditStateFlags GetEditStateFlags() override; EditStateFlags GetEditStateFlags() override;
bool IsCustomMenu() override; bool IsCustomMenu() override;
DISALLOW_COPY_AND_ASSIGN(CefContextMenuParamsImpl);
}; };
#endif // CEF_LIBCEF_BROWSER_CONTEXT_MENU_PARAMS_IMPL_H_ #endif // CEF_LIBCEF_BROWSER_CONTEXT_MENU_PARAMS_IMPL_H_

View File

@@ -41,6 +41,10 @@ class CefDevToolsController : public content::DevToolsAgentHostClient {
// |inspected_contents| will outlive this object. // |inspected_contents| will outlive this object.
explicit CefDevToolsController(content::WebContents* inspected_contents); explicit CefDevToolsController(content::WebContents* inspected_contents);
CefDevToolsController(const CefDevToolsController&) = delete;
CefDevToolsController& operator=(const CefDevToolsController&) = delete;
~CefDevToolsController() override; ~CefDevToolsController() override;
// See CefBrowserHost methods of the same name for documentation. // See CefBrowserHost methods of the same name for documentation.
@@ -72,8 +76,6 @@ class CefDevToolsController : public content::DevToolsAgentHostClient {
base::ObserverList<Observer> observers_; base::ObserverList<Observer> observers_;
base::WeakPtrFactory<CefDevToolsController> weak_ptr_factory_; base::WeakPtrFactory<CefDevToolsController> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(CefDevToolsController);
}; };
#endif // CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_CONTROLLER_H_ #endif // CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_CONTROLLER_H_

View File

@@ -77,8 +77,8 @@ void CefDevToolsFileManager::Save(const std::string& url,
return; return;
} }
const base::DictionaryValue* file_map = const base::DictionaryValue* file_map = &base::Value::AsDictionaryValue(
prefs_->GetDictionary(prefs::kDevToolsEditedFiles); *prefs_->GetDictionary(prefs::kDevToolsEditedFiles));
base::FilePath initial_path; base::FilePath initial_path;
const base::Value* path_value; const base::Value* path_value;
@@ -144,7 +144,7 @@ void CefDevToolsFileManager::SaveAsFileSelected(const std::string& url,
saved_files_[url] = path; saved_files_[url] = path;
DictionaryPrefUpdate update(prefs_, prefs::kDevToolsEditedFiles); DictionaryPrefUpdate update(prefs_, prefs::kDevToolsEditedFiles);
base::DictionaryValue* files_map = update.Get(); base::Value* files_map = update.Get();
files_map->SetKey(base::MD5String(url), base::FilePathToValue(path)); files_map->SetKey(base::MD5String(url), base::FilePathToValue(path));
std::string file_system_path = path.AsUTF8Unsafe(); std::string file_system_path = path.AsUTF8Unsafe();
std::move(callback).Run(file_system_path); std::move(callback).Run(file_system_path);

View File

@@ -6,7 +6,6 @@
#define CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_FILE_MANAGER_H_ #define CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_FILE_MANAGER_H_
#include "base/callback_forward.h" #include "base/callback_forward.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include <map> #include <map>
@@ -29,6 +28,9 @@ class CefDevToolsFileManager {
CefDevToolsFileManager(AlloyBrowserHostImpl* browser_impl, CefDevToolsFileManager(AlloyBrowserHostImpl* browser_impl,
PrefService* prefs); PrefService* prefs);
CefDevToolsFileManager(const CefDevToolsFileManager&) = delete;
CefDevToolsFileManager& operator=(const CefDevToolsFileManager&) = delete;
void SaveToFile(const std::string& url, void SaveToFile(const std::string& url,
const std::string& content, const std::string& content,
bool save_as); bool save_as);
@@ -36,8 +38,8 @@ class CefDevToolsFileManager {
private: private:
// SaveToFile implementation: // SaveToFile implementation:
typedef base::OnceCallback<void(const std::string&)> SaveCallback; using SaveCallback = base::OnceCallback<void(const std::string&)>;
typedef base::OnceCallback<void()> CancelCallback; using CancelCallback = base::OnceCallback<void()>;
void Save(const std::string& url, void Save(const std::string& url,
const std::string& content, const std::string& content,
bool save_as, bool save_as,
@@ -57,7 +59,7 @@ class CefDevToolsFileManager {
void CanceledFileSaveAs(const std::string& url); void CanceledFileSaveAs(const std::string& url);
// AppendToFile implementation: // AppendToFile implementation:
typedef base::OnceCallback<void(void)> AppendCallback; using AppendCallback = base::OnceCallback<void(void)>;
void Append(const std::string& url, void Append(const std::string& url,
const std::string& content, const std::string& content,
AppendCallback callback); AppendCallback callback);
@@ -72,12 +74,10 @@ class CefDevToolsFileManager {
AlloyBrowserHostImpl* browser_impl_; AlloyBrowserHostImpl* browser_impl_;
PrefService* prefs_; PrefService* prefs_;
typedef std::map<std::string, base::FilePath> PathsMap; using PathsMap = std::map<std::string, base::FilePath>;
PathsMap saved_files_; PathsMap saved_files_;
scoped_refptr<base::SequencedTaskRunner> file_task_runner_; scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
base::WeakPtrFactory<CefDevToolsFileManager> weak_factory_; base::WeakPtrFactory<CefDevToolsFileManager> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(CefDevToolsFileManager);
}; };
#endif // CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_FILE_MANAGER_H_ #endif // CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_FILE_MANAGER_H_

View File

@@ -22,7 +22,6 @@
#include "base/json/json_reader.h" #include "base/json/json_reader.h"
#include "base/json/json_writer.h" #include "base/json/json_writer.h"
#include "base/json/string_escape.h" #include "base/json/string_escape.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
@@ -58,9 +57,9 @@
#include "services/network/public/mojom/url_response_head.mojom.h" #include "services/network/public/mojom/url_response_head.mojom.h"
#include "storage/browser/file_system/native_file_util.h" #include "storage/browser/file_system/native_file_util.h"
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include <windows.h> #include <windows.h>
#elif defined(OS_POSIX) #elif BUILDFLAG(IS_POSIX)
#include <time.h> #include <time.h>
#endif #endif
@@ -107,7 +106,7 @@ base::DictionaryValue BuildObjectForResponse(const net::HttpResponseHeaders* rh,
} }
void WriteTimestamp(std::stringstream& stream) { void WriteTimestamp(std::stringstream& stream) {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
SYSTEMTIME local_time; SYSTEMTIME local_time;
GetLocalTime(&local_time); GetLocalTime(&local_time);
stream << std::setfill('0') << std::setw(2) << local_time.wMonth stream << std::setfill('0') << std::setw(2) << local_time.wMonth
@@ -115,7 +114,7 @@ void WriteTimestamp(std::stringstream& stream) {
<< local_time.wHour << std::setw(2) << local_time.wMinute << local_time.wHour << std::setw(2) << local_time.wMinute
<< std::setw(2) << local_time.wSecond << '.' << std::setw(3) << std::setw(2) << local_time.wSecond << '.' << std::setw(3)
<< local_time.wMilliseconds; << local_time.wMilliseconds;
#elif defined(OS_POSIX) #elif BUILDFLAG(IS_POSIX)
timeval tv; timeval tv;
gettimeofday(&tv, nullptr); gettimeofday(&tv, nullptr);
time_t t = tv.tv_sec; time_t t = tv.tv_sec;
@@ -188,6 +187,9 @@ class CefDevToolsFrontend::NetworkResourceLoader
loader_->DownloadAsStream(url_loader_factory, this); loader_->DownloadAsStream(url_loader_factory, this);
} }
NetworkResourceLoader(const NetworkResourceLoader&) = delete;
NetworkResourceLoader& operator=(const NetworkResourceLoader&) = delete;
private: private:
void OnResponseStarted(const GURL& final_url, void OnResponseStarted(const GURL& final_url,
const network::mojom::URLResponseHead& response_head) { const network::mojom::URLResponseHead& response_head) {
@@ -230,8 +232,6 @@ class CefDevToolsFrontend::NetworkResourceLoader
std::unique_ptr<network::SimpleURLLoader> loader_; std::unique_ptr<network::SimpleURLLoader> loader_;
int request_id_; int request_id_;
scoped_refptr<net::HttpResponseHeaders> response_headers_; scoped_refptr<net::HttpResponseHeaders> response_headers_;
DISALLOW_COPY_AND_ASSIGN(NetworkResourceLoader);
}; };
// static // static

View File

@@ -12,7 +12,6 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/values.h" #include "base/values.h"
@@ -41,6 +40,9 @@ enum class ProtocolMessageType {
class CefDevToolsFrontend : public content::WebContentsObserver, class CefDevToolsFrontend : public content::WebContentsObserver,
public content::DevToolsAgentHostClient { public content::DevToolsAgentHostClient {
public: public:
CefDevToolsFrontend(const CefDevToolsFrontend&) = delete;
CefDevToolsFrontend& operator=(const CefDevToolsFrontend&) = delete;
static CefDevToolsFrontend* Show( static CefDevToolsFrontend* Show(
AlloyBrowserHostImpl* inspected_browser, AlloyBrowserHostImpl* inspected_browser,
const CefWindowInfo& windowInfo, const CefWindowInfo& windowInfo,
@@ -109,8 +111,6 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
const base::FilePath protocol_log_file_; const base::FilePath protocol_log_file_;
base::WeakPtrFactory<CefDevToolsFrontend> weak_factory_; base::WeakPtrFactory<CefDevToolsFrontend> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(CefDevToolsFrontend);
}; };
#endif // CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_FRONTEND_H_ #endif // CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_FRONTEND_H_

View File

@@ -22,6 +22,10 @@ class CefDevToolsRegistrationImpl : public CefRegistration,
DCHECK(observer_); DCHECK(observer_);
} }
CefDevToolsRegistrationImpl(const CefDevToolsRegistrationImpl&) = delete;
CefDevToolsRegistrationImpl& operator=(const CefDevToolsRegistrationImpl&) =
delete;
~CefDevToolsRegistrationImpl() override { ~CefDevToolsRegistrationImpl() override {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
@@ -88,7 +92,6 @@ class CefDevToolsRegistrationImpl : public CefRegistration,
base::WeakPtr<CefDevToolsController> controller_; base::WeakPtr<CefDevToolsController> controller_;
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefDevToolsRegistrationImpl); IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefDevToolsRegistrationImpl);
DISALLOW_COPY_AND_ASSIGN(CefDevToolsRegistrationImpl);
}; };
} // namespace } // namespace

View File

@@ -24,6 +24,10 @@ class CefDevToolsManager {
public: public:
// |inspected_browser| will outlive this object. // |inspected_browser| will outlive this object.
explicit CefDevToolsManager(CefBrowserHostBase* inspected_browser); explicit CefDevToolsManager(CefBrowserHostBase* inspected_browser);
CefDevToolsManager(const CefDevToolsManager&) = delete;
CefDevToolsManager& operator=(const CefDevToolsManager&) = delete;
~CefDevToolsManager(); ~CefDevToolsManager();
// See CefBrowserHost methods of the same name for documentation. // See CefBrowserHost methods of the same name for documentation.
@@ -62,8 +66,6 @@ class CefDevToolsManager {
std::unique_ptr<CefDevToolsController> devtools_controller_; std::unique_ptr<CefDevToolsController> devtools_controller_;
base::WeakPtrFactory<CefDevToolsManager> weak_ptr_factory_; base::WeakPtrFactory<CefDevToolsManager> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(CefDevToolsManager);
}; };
#endif // CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_H_ #endif // CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_H_

View File

@@ -12,7 +12,6 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
@@ -44,6 +43,9 @@ class TCPServerSocketFactory : public content::DevToolsSocketFactory {
TCPServerSocketFactory(const std::string& address, uint16_t port) TCPServerSocketFactory(const std::string& address, uint16_t port)
: address_(address), port_(port) {} : address_(address), port_(port) {}
TCPServerSocketFactory(const TCPServerSocketFactory&) = delete;
TCPServerSocketFactory& operator=(const TCPServerSocketFactory&) = delete;
private: private:
// content::DevToolsSocketFactory. // content::DevToolsSocketFactory.
std::unique_ptr<net::ServerSocket> CreateForHttpServer() override { std::unique_ptr<net::ServerSocket> CreateForHttpServer() override {
@@ -61,8 +63,6 @@ class TCPServerSocketFactory : public content::DevToolsSocketFactory {
std::string address_; std::string address_;
uint16_t port_; uint16_t port_;
DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory);
}; };
std::unique_ptr<content::DevToolsSocketFactory> CreateSocketFactory() { std::unique_ptr<content::DevToolsSocketFactory> CreateSocketFactory() {

View File

@@ -6,7 +6,6 @@
#define CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_DELEGATE_H_ #define CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_DELEGATE_H_
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/macros.h"
#include "content/public/browser/devtools_manager_delegate.h" #include "content/public/browser/devtools_manager_delegate.h"
namespace content { namespace content {
@@ -19,6 +18,11 @@ class CefDevToolsManagerDelegate : public content::DevToolsManagerDelegate {
static void StopHttpHandler(); static void StopHttpHandler();
CefDevToolsManagerDelegate(); CefDevToolsManagerDelegate();
CefDevToolsManagerDelegate(const CefDevToolsManagerDelegate&) = delete;
CefDevToolsManagerDelegate& operator=(const CefDevToolsManagerDelegate&) =
delete;
~CefDevToolsManagerDelegate() override; ~CefDevToolsManagerDelegate() override;
// DevToolsManagerDelegate implementation. // DevToolsManagerDelegate implementation.
@@ -26,9 +30,6 @@ class CefDevToolsManagerDelegate : public content::DevToolsManagerDelegate {
const GURL& url) override; const GURL& url) override;
std::string GetDiscoveryPageHTML() override; std::string GetDiscoveryPageHTML() override;
bool HasBundledFrontendResources() override; bool HasBundledFrontendResources() override;
private:
DISALLOW_COPY_AND_ASSIGN(CefDevToolsManagerDelegate);
}; };
#endif // CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_DELEGATE_H_ #endif // CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_DELEGATE_H_

View File

@@ -19,6 +19,9 @@ class CefDownloadItemImpl
public: public:
explicit CefDownloadItemImpl(download::DownloadItem* value); explicit CefDownloadItemImpl(download::DownloadItem* value);
CefDownloadItemImpl(const CefDownloadItemImpl&) = delete;
CefDownloadItemImpl& operator=(const CefDownloadItemImpl&) = delete;
// CefDownloadItem methods. // CefDownloadItem methods.
bool IsValid() override; bool IsValid() override;
bool IsInProgress() override; bool IsInProgress() override;
@@ -37,9 +40,6 @@ class CefDownloadItemImpl
CefString GetSuggestedFileName() override; CefString GetSuggestedFileName() override;
CefString GetContentDisposition() override; CefString GetContentDisposition() override;
CefString GetMimeType() override; CefString GetMimeType() override;
private:
DISALLOW_COPY_AND_ASSIGN(CefDownloadItemImpl);
}; };
#endif // CEF_LIBCEF_BROWSER_DOWNLOAD_ITEM_IMPL_H_ #endif // CEF_LIBCEF_BROWSER_DOWNLOAD_ITEM_IMPL_H_

View File

@@ -4,6 +4,8 @@
#include "libcef/browser/download_manager_delegate.h" #include "libcef/browser/download_manager_delegate.h"
#include <tuple>
#include "include/cef_download_handler.h" #include "include/cef_download_handler.h"
#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/alloy/alloy_browser_host_impl.h"
#include "libcef/browser/context.h" #include "libcef/browser/context.h"
@@ -50,6 +52,10 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
suggested_name_(suggested_name), suggested_name_(suggested_name),
callback_(std::move(callback)) {} callback_(std::move(callback)) {}
CefBeforeDownloadCallbackImpl(const CefBeforeDownloadCallbackImpl&) = delete;
CefBeforeDownloadCallbackImpl& operator=(
const CefBeforeDownloadCallbackImpl&) = delete;
void Continue(const CefString& download_path, bool show_dialog) override { void Continue(const CefString& download_path, bool show_dialog) override {
if (CEF_CURRENTLY_ON_UIT()) { if (CEF_CURRENTLY_ON_UIT()) {
if (download_id_ <= 0) if (download_id_ <= 0)
@@ -182,7 +188,6 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
content::DownloadTargetCallback callback_; content::DownloadTargetCallback callback_;
IMPLEMENT_REFCOUNTING(CefBeforeDownloadCallbackImpl); IMPLEMENT_REFCOUNTING(CefBeforeDownloadCallbackImpl);
DISALLOW_COPY_AND_ASSIGN(CefBeforeDownloadCallbackImpl);
}; };
// CefDownloadItemCallback implementation. // CefDownloadItemCallback implementation.
@@ -193,6 +198,10 @@ class CefDownloadItemCallbackImpl : public CefDownloadItemCallback {
uint32 download_id) uint32 download_id)
: manager_(manager), download_id_(download_id) {} : manager_(manager), download_id_(download_id) {}
CefDownloadItemCallbackImpl(const CefDownloadItemCallbackImpl&) = delete;
CefDownloadItemCallbackImpl& operator=(const CefDownloadItemCallbackImpl&) =
delete;
void Cancel() override { void Cancel() override {
CEF_POST_TASK(CEF_UIT, CEF_POST_TASK(CEF_UIT,
base::BindOnce(&CefDownloadItemCallbackImpl::DoCancel, this)); base::BindOnce(&CefDownloadItemCallbackImpl::DoCancel, this));
@@ -248,7 +257,6 @@ class CefDownloadItemCallbackImpl : public CefDownloadItemCallback {
uint32 download_id_; uint32 download_id_;
IMPLEMENT_REFCOUNTING(CefDownloadItemCallbackImpl); IMPLEMENT_REFCOUNTING(CefDownloadItemCallbackImpl);
DISALLOW_COPY_AND_ASSIGN(CefDownloadItemCallbackImpl);
}; };
} // namespace } // namespace
@@ -289,7 +297,7 @@ void CefDownloadManagerDelegate::OnDownloadUpdated(DownloadItem* download) {
handler->OnDownloadUpdated(browser.get(), download_item.get(), callback); handler->OnDownloadUpdated(browser.get(), download_item.get(), callback);
ignore_result(download_item->Detach(nullptr)); std::ignore = download_item->Detach(nullptr);
} }
} }
@@ -384,7 +392,7 @@ bool CefDownloadManagerDelegate::DetermineDownloadTarget(
handler->OnBeforeDownload(browser.get(), download_item.get(), handler->OnBeforeDownload(browser.get(), download_item.get(),
suggested_name.value(), callbackObj); suggested_name.value(), callbackObj);
ignore_result(download_item->Detach(nullptr)); std::ignore = download_item->Detach(nullptr);
} }
return true; return true;

View File

@@ -24,6 +24,11 @@ class CefDownloadManagerDelegate : public download::DownloadItem::Observer,
public CefBrowserHostBase::Observer { public CefBrowserHostBase::Observer {
public: public:
explicit CefDownloadManagerDelegate(content::DownloadManager* manager); explicit CefDownloadManagerDelegate(content::DownloadManager* manager);
CefDownloadManagerDelegate(const CefDownloadManagerDelegate&) = delete;
CefDownloadManagerDelegate& operator=(const CefDownloadManagerDelegate&) =
delete;
~CefDownloadManagerDelegate() override; ~CefDownloadManagerDelegate() override;
private: private:
@@ -55,11 +60,9 @@ class CefDownloadManagerDelegate : public download::DownloadItem::Observer,
// Map of DownloadItem to originating AlloyBrowserHostImpl. Maintaining this // Map of DownloadItem to originating AlloyBrowserHostImpl. Maintaining this
// map is necessary because DownloadItem::GetWebContents() may return NULL if // map is necessary because DownloadItem::GetWebContents() may return NULL if
// the browser navigates while the download is in progress. // the browser navigates while the download is in progress.
typedef std::map<download::DownloadItem*, AlloyBrowserHostImpl*> using ItemBrowserMap =
ItemBrowserMap; std::map<download::DownloadItem*, AlloyBrowserHostImpl*>;
ItemBrowserMap item_browser_map_; ItemBrowserMap item_browser_map_;
DISALLOW_COPY_AND_ASSIGN(CefDownloadManagerDelegate);
}; };
#endif // CEF_LIBCEF_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ #endif // CEF_LIBCEF_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_

View File

@@ -23,6 +23,9 @@ class CefExtensionImpl : public CefExtension {
CefRequestContext* loader_context, CefRequestContext* loader_context,
CefRefPtr<CefExtensionHandler> handler); CefRefPtr<CefExtensionHandler> handler);
CefExtensionImpl(const CefExtensionImpl&) = delete;
CefExtensionImpl& operator=(const CefExtensionImpl&) = delete;
// CefExtension methods. // CefExtension methods.
CefString GetIdentifier() override; CefString GetIdentifier() override;
CefString GetPath() override; CefString GetPath() override;
@@ -52,7 +55,6 @@ class CefExtensionImpl : public CefExtension {
bool unloaded_ = false; bool unloaded_ = false;
IMPLEMENT_REFCOUNTING(CefExtensionImpl); IMPLEMENT_REFCOUNTING(CefExtensionImpl);
DISALLOW_COPY_AND_ASSIGN(CefExtensionImpl);
}; };
#endif // CEF_LIBCEF_BROWSER_EXTENSION_IMPL_H_ #endif // CEF_LIBCEF_BROWSER_EXTENSION_IMPL_H_

View File

@@ -0,0 +1,134 @@
// Copyright 2017 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/extensions/api/file_system/cef_file_system_delegate.h"
#include "libcef/browser/alloy/alloy_dialog_util.h"
#include "apps/saved_files_service.h"
#include "base/callback.h"
#include "base/callback_forward.h"
#include "base/files/file_path.h"
#include "chrome/grit/generated_resources.h"
#include "extensions/common/api/file_system.h"
#include "extensions/common/extension.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
using blink::mojom::FileChooserParams;
namespace extensions {
namespace cef {
CefFileSystemDelegate::CefFileSystemDelegate() = default;
CefFileSystemDelegate::~CefFileSystemDelegate() = default;
base::FilePath CefFileSystemDelegate::GetDefaultDirectory() {
return base::FilePath();
}
base::FilePath CefFileSystemDelegate::GetManagedSaveAsDirectory(
content::BrowserContext* browser_context,
const Extension& extension) {
return base::FilePath();
}
bool CefFileSystemDelegate::ShowSelectFileDialog(
scoped_refptr<ExtensionFunction> extension_function,
ui::SelectFileDialog::Type type,
const base::FilePath& default_path,
const ui::SelectFileDialog::FileTypeInfo* file_types,
FileSystemDelegate::FilesSelectedCallback files_selected_callback,
base::OnceClosure file_selection_canceled_callback) {
auto web_contents = extension_function->GetSenderWebContents();
if (!web_contents) {
return false;
}
absl::optional<FileChooserParams::Mode> mode;
switch (type) {
case ui::SelectFileDialog::Type::SELECT_UPLOAD_FOLDER:
mode = FileChooserParams::Mode::kUploadFolder;
break;
case ui::SelectFileDialog::Type::SELECT_SAVEAS_FILE:
mode = FileChooserParams::Mode::kSave;
break;
case ui::SelectFileDialog::Type::SELECT_OPEN_FILE:
mode = FileChooserParams::Mode::kOpen;
break;
case ui::SelectFileDialog::Type::SELECT_OPEN_MULTI_FILE:
mode = FileChooserParams::Mode::kOpenMultiple;
break;
default:
NOTIMPLEMENTED();
return false;
}
FileChooserParams params;
params.mode = *mode;
params.default_file_name = default_path;
if (file_types) {
// A list of allowed extensions. For example, it might be
// { { "htm", "html" }, { "txt" } }
for (auto& vec : file_types->extensions) {
for (auto& ext : vec) {
params.accept_types.push_back(
alloy::FilePathTypeToString16(FILE_PATH_LITERAL(".") + ext));
}
}
}
alloy::RunFileChooser(
web_contents, params,
base::BindOnce(&CefFileSystemDelegate::FileDialogDismissed,
weak_ptr_factory_.GetWeakPtr(),
std::move(files_selected_callback),
std::move(file_selection_canceled_callback)));
return true;
}
void CefFileSystemDelegate::FileDialogDismissed(
FileSystemDelegate::FilesSelectedCallback files_selected_callback,
base::OnceClosure file_selection_canceled_callback,
int selected_accept_filter,
const std::vector<base::FilePath>& file_paths) {
if (!file_paths.empty()) {
std::move(files_selected_callback).Run(file_paths);
} else {
std::move(file_selection_canceled_callback).Run();
}
}
void CefFileSystemDelegate::ConfirmSensitiveDirectoryAccess(
bool has_write_permission,
const std::u16string& app_name,
content::WebContents* web_contents,
base::OnceClosure on_accept,
base::OnceClosure on_cancel) {
NOTIMPLEMENTED();
// Run the cancel callback by default.
std::move(on_cancel).Run();
}
// Based on ChromeFileSystemDelegate::GetDescriptionIdForAcceptType.
int CefFileSystemDelegate::GetDescriptionIdForAcceptType(
const std::string& accept_type) {
if (accept_type == "image/*")
return IDS_IMAGE_FILES;
if (accept_type == "audio/*")
return IDS_AUDIO_FILES;
if (accept_type == "video/*")
return IDS_VIDEO_FILES;
return 0;
}
SavedFilesServiceInterface* CefFileSystemDelegate::GetSavedFilesService(
content::BrowserContext* browser_context) {
return apps::SavedFilesService::Get(browser_context);
}
} // namespace cef
} // namespace extensions

View File

@@ -0,0 +1,68 @@
// 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_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_DELEGATE_H_
#define CEF_LIBCEF_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_DELEGATE_H_
#include <memory>
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "extensions/browser/api/execute_code_function.h"
#include "extensions/browser/api/file_system/file_system_delegate.h"
#include "extensions/browser/extension_function.h"
namespace content {
class WebContents;
}
namespace extensions {
namespace cef {
class CefFileSystemDelegate : public FileSystemDelegate {
public:
CefFileSystemDelegate();
CefFileSystemDelegate(const CefFileSystemDelegate&) = delete;
CefFileSystemDelegate& operator=(const CefFileSystemDelegate&) = delete;
~CefFileSystemDelegate() override;
// FileSystemDelegate
base::FilePath GetDefaultDirectory() override;
base::FilePath GetManagedSaveAsDirectory(
content::BrowserContext* browser_context,
const Extension& extension) override;
bool ShowSelectFileDialog(
scoped_refptr<ExtensionFunction> extension_function,
ui::SelectFileDialog::Type type,
const base::FilePath& default_path,
const ui::SelectFileDialog::FileTypeInfo* file_types,
FileSystemDelegate::FilesSelectedCallback files_selected_callback,
base::OnceClosure file_selection_canceled_callback) override;
void ConfirmSensitiveDirectoryAccess(bool has_write_permission,
const std::u16string& app_name,
content::WebContents* web_contents,
base::OnceClosure on_accept,
base::OnceClosure on_cancel) override;
int GetDescriptionIdForAcceptType(const std::string& accept_type) override;
SavedFilesServiceInterface* GetSavedFilesService(
content::BrowserContext* browser_context) override;
private:
void FileDialogDismissed(
FileSystemDelegate::FilesSelectedCallback files_selected_callback,
base::OnceClosure file_selection_canceled_callback,
int selected_accept_filter,
const std::vector<base::FilePath>& file_paths);
base::WeakPtrFactory<CefFileSystemDelegate> weak_ptr_factory_{this};
};
} // namespace cef
} // namespace extensions
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_DELEGATE_H_

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