Compare commits

..

25 Commits
4896 ... 4758

Author SHA1 Message Date
Marshall Greenblatt
29d6e22fe4 Update to Chromium version 98.0.4758.109 2022-02-25 14:51:39 +00:00
Marshall Greenblatt
78c653a2ed Update context menu type enums to match Chromium (fixes issue #3257) 2022-02-18 16:47:20 -05:00
Marshall Greenblatt
9782362fea 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-15 15:56:03 -05:00
Marshall Greenblatt
0e8702df26 Update to Chromium version 98.0.4758.102 2022-02-15 16:55:12 +00:00
Marshall Greenblatt
57be9e2aba Update to Chromium version 98.0.4758.80 2022-02-09 20:17:27 -05:00
Marshall Greenblatt
856e56194e Fix includes path for Linux ARM cross-compile (see issue #2926) 2022-02-09 16:53:31 -05:00
Marshall Greenblatt
63805e69e3 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:13:05 -05:00
Marshall Greenblatt
358ca263f4 Remove cef_config.h from cef_paths2.gypi (see issue #2926) 2022-02-05 00:50:07 +00:00
Marshall Greenblatt
42d1b7e0f9 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:15:56 -05:00
Marshall Greenblatt
7fe84d02b3 alloy: Fix extension function registration for print preview dialog (fixes issue #3167) 2022-02-02 14:48:25 -05:00
Marshall Greenblatt
f1a0035c82 Generate cef_config.h as a build-time step (fixes issue #2926) 2022-02-02 12:31:20 -05:00
Marshall Greenblatt
d87e3f41f6 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:41:25 -05:00
Marshall Greenblatt
eb2c682768 alloy: Fix shutdown assert if OneShotTimer is deleted on the wrong thread 2022-01-28 12:25:07 -05:00
Marshall Greenblatt
f07ce7b357 Fix notification for focused frame (fixes issue #3248) 2022-01-24 11:33:03 -05:00
Marshall Greenblatt
b2f0f54fdd chrome: Fix crash when clicking Reading List sidebar link (fixes issue #3128) 2022-01-14 13:54:39 -05:00
Marshall Greenblatt
4d42a6c31a cefclient: Disable alert on space bar press (see issue #3184)
This will be reverted after issue #3184 is resolved.
2022-01-14 12:17:43 -05:00
Nick Mueller
0e3b3bb110 Fix OSR resize issue when multiple monitors have different scale factors (fixes issue #3240) 2022-01-14 12:01:03 -05:00
Marshall Greenblatt
0cc7a7bdab chrome: Fix crashes when toggling full-screen mode (fixes issue #3182) 2022-01-13 12:40:12 -05:00
Marshall Greenblatt
a8dbe5cae2 Update to Chromium version 98.0.4758.55 2022-01-13 13:07:07 +00:00
Marshall Greenblatt
16dbbdc695 Update to Chromium version 98.0.4758.48 2022-01-12 16:45:07 +00:00
Marshall Greenblatt
657697d8dd Fix possible use after shutdown of BrowserContext (fixes issue #3193) 2022-01-10 17:20:37 -05:00
Marshall Greenblatt
7a5a4c683a 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 19:56:49 -05:00
Marshall Greenblatt
24e09fef3e alloy: Disable bfcache in M98 (see issue #3237)
This will be reverted if the bfcache issue is fixed before M98 becomes the
stable channel.
2022-01-06 14:18:14 -05:00
Marshall Greenblatt
419264812d Update copyright year in generated files 2022-01-06 13:40:21 -05:00
Marshall Greenblatt
5a865afa07 Update to Chromium version 98.0.4758.9 2021-12-18 20:30:37 -05:00
336 changed files with 3535 additions and 2530 deletions

View File

@@ -489,8 +489,6 @@ 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",
@@ -527,6 +525,8 @@ 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",
@@ -659,6 +659,8 @@ static_library("libcef_static") {
"libcef/browser/thread_util.h", "libcef/browser/thread_util.h",
"libcef/browser/web_contents_dialog_helper.cc", "libcef/browser/web_contents_dialog_helper.cc",
"libcef/browser/web_contents_dialog_helper.h", "libcef/browser/web_contents_dialog_helper.h",
"libcef/browser/web_plugin_impl.cc",
"libcef/browser/web_plugin_impl.h",
"libcef/browser/x509_certificate_impl.cc", "libcef/browser/x509_certificate_impl.cc",
"libcef/browser/x509_certificate_impl.h", "libcef/browser/x509_certificate_impl.h",
"libcef/browser/x509_cert_principal_impl.cc", "libcef/browser/x509_cert_principal_impl.cc",
@@ -848,6 +850,7 @@ static_library("libcef_static") {
"//components/content_settings/core/browser", "//components/content_settings/core/browser",
"//components/content_settings/core/common", "//components/content_settings/core/common",
"//components/crx_file", "//components/crx_file",
"//components/data_use_measurement/core",
"//components/google/core/common", "//components/google/core/common",
"//components/keyed_service/content:content", "//components/keyed_service/content:content",
"//components/keyed_service/core:core", "//components/keyed_service/core:core",
@@ -942,6 +945,10 @@ 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 += [
@@ -1330,7 +1337,7 @@ grit("cef_strings") {
outputs = [ outputs = [
"grit/cef_strings.h", "grit/cef_strings.h",
] ]
all_locales = platform_pak_locales + [ "fake-bidi" ] all_locales = locales + [ "fake-bidi" ]
foreach(locale, all_locales) { foreach(locale, all_locales) {
outputs += [ "cef_strings_${locale}.pak" ] outputs += [ "cef_strings_${locale}.pak" ]
} }
@@ -1378,7 +1385,6 @@ 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",
@@ -1404,7 +1410,6 @@ 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",
@@ -1445,7 +1450,6 @@ 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",
] ]
@@ -1463,7 +1467,6 @@ 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",
] ]

View File

@@ -7,6 +7,6 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding # https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{ {
'chromium_checkout': 'refs/tags/100.0.4896.127', 'chromium_checkout': 'refs/tags/98.0.4758.109',
'depot_tools_checkout': '32645dfee9' 'depot_tools_checkout': 'db41eed6b7'
} }

View File

@@ -1,2 +1,2 @@
#!/bin/sh #!/bin/sh
python3 tools/gclient_hook.py python tools/gclient_hook.py

View File

@@ -8,7 +8,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=3d75809bdc9a72a0df9df727981f0796b7ddbbc8$ # $hash=872dedb7e5a2f36745446c3d0c9ad8bd5850adb7$
# #
{ {
@@ -84,6 +84,7 @@
'include/cef_v8.h', 'include/cef_v8.h',
'include/cef_values.h', 'include/cef_values.h',
'include/cef_waitable_event.h', 'include/cef_waitable_event.h',
'include/cef_web_plugin.h',
'include/cef_x509_certificate.h', 'include/cef_x509_certificate.h',
'include/cef_xml_reader.h', 'include/cef_xml_reader.h',
'include/cef_zip_reader.h', 'include/cef_zip_reader.h',
@@ -182,6 +183,7 @@
'include/capi/cef_v8_capi.h', 'include/capi/cef_v8_capi.h',
'include/capi/cef_values_capi.h', 'include/capi/cef_values_capi.h',
'include/capi/cef_waitable_event_capi.h', 'include/capi/cef_waitable_event_capi.h',
'include/capi/cef_web_plugin_capi.h',
'include/capi/cef_x509_certificate_capi.h', 'include/capi/cef_x509_certificate_capi.h',
'include/capi/cef_xml_reader_capi.h', 'include/capi/cef_xml_reader_capi.h',
'include/capi/cef_zip_reader_capi.h', 'include/capi/cef_zip_reader_capi.h',
@@ -498,6 +500,12 @@
'libcef_dll/ctocpp/views/view_delegate_ctocpp.h', 'libcef_dll/ctocpp/views/view_delegate_ctocpp.h',
'libcef_dll/cpptoc/waitable_event_cpptoc.cc', 'libcef_dll/cpptoc/waitable_event_cpptoc.cc',
'libcef_dll/cpptoc/waitable_event_cpptoc.h', 'libcef_dll/cpptoc/waitable_event_cpptoc.h',
'libcef_dll/cpptoc/web_plugin_info_cpptoc.cc',
'libcef_dll/cpptoc/web_plugin_info_cpptoc.h',
'libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.cc',
'libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.h',
'libcef_dll/ctocpp/web_plugin_unstable_callback_ctocpp.cc',
'libcef_dll/ctocpp/web_plugin_unstable_callback_ctocpp.h',
'libcef_dll/cpptoc/views/window_cpptoc.cc', 'libcef_dll/cpptoc/views/window_cpptoc.cc',
'libcef_dll/cpptoc/views/window_cpptoc.h', 'libcef_dll/cpptoc/views/window_cpptoc.h',
'libcef_dll/ctocpp/views/window_delegate_ctocpp.cc', 'libcef_dll/ctocpp/views/window_delegate_ctocpp.cc',
@@ -802,6 +810,12 @@
'libcef_dll/cpptoc/views/view_delegate_cpptoc.h', 'libcef_dll/cpptoc/views/view_delegate_cpptoc.h',
'libcef_dll/ctocpp/waitable_event_ctocpp.cc', 'libcef_dll/ctocpp/waitable_event_ctocpp.cc',
'libcef_dll/ctocpp/waitable_event_ctocpp.h', 'libcef_dll/ctocpp/waitable_event_ctocpp.h',
'libcef_dll/ctocpp/web_plugin_info_ctocpp.cc',
'libcef_dll/ctocpp/web_plugin_info_ctocpp.h',
'libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.cc',
'libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.h',
'libcef_dll/cpptoc/web_plugin_unstable_callback_cpptoc.cc',
'libcef_dll/cpptoc/web_plugin_unstable_callback_cpptoc.h',
'libcef_dll/ctocpp/views/window_ctocpp.cc', 'libcef_dll/ctocpp/views/window_ctocpp.cc',
'libcef_dll/ctocpp/views/window_ctocpp.h', 'libcef_dll/ctocpp/views/window_ctocpp.h',
'libcef_dll/cpptoc/views/window_delegate_cpptoc.cc', 'libcef_dll/cpptoc/views/window_delegate_cpptoc.cc',

View File

@@ -112,7 +112,6 @@
'libcef_dll/resource.h', 'libcef_dll/resource.h',
'libcef_dll/shutdown_checker.cc', 'libcef_dll/shutdown_checker.cc',
'libcef_dll/shutdown_checker.h', 'libcef_dll/shutdown_checker.h',
'libcef_dll/template_util.h',
'libcef_dll/transfer_util.cc', 'libcef_dll/transfer_util.cc',
'libcef_dll/transfer_util.h', 'libcef_dll/transfer_util.h',
'libcef_dll/wrapper_types.h', 'libcef_dll/wrapper_types.h',
@@ -139,7 +138,6 @@
'libcef_dll/ctocpp/ctocpp_scoped.h', 'libcef_dll/ctocpp/ctocpp_scoped.h',
'libcef_dll/shutdown_checker.cc', 'libcef_dll/shutdown_checker.cc',
'libcef_dll/shutdown_checker.h', 'libcef_dll/shutdown_checker.h',
'libcef_dll/template_util.h',
'libcef_dll/transfer_util.cc', 'libcef_dll/transfer_util.cc',
'libcef_dll/transfer_util.h', 'libcef_dll/transfer_util.h',
'libcef_dll/wrapper_types.h', 'libcef_dll/wrapper_types.h',

View File

@@ -32,7 +32,12 @@
#define CEF_INCLUDE_BASE_CEF_COMPILER_SPECIFIC_H_ #define CEF_INCLUDE_BASE_CEF_COMPILER_SPECIFIC_H_
#pragma once #pragma once
#if defined(USING_CHROMIUM_INCLUDES) #if defined(BASE_COMPILER_SPECIFIC_H_)
// Do nothing if the Chromium header has already been included.
// This can happen in cases where Chromium code is used directly by the
// client application. When using Chromium code directly always include
// the Chromium header first to avoid type conflicts.
#elif defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly. // When building CEF include the Chromium header directly.
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#else // !USING_CHROMIUM_INCLUDES #else // !USING_CHROMIUM_INCLUDES
@@ -71,6 +76,23 @@
#define __has_attribute(x) 0 #define __has_attribute(x) 0
#endif // !defined(__has_attribute) #endif // !defined(__has_attribute)
// Annotate a variable indicating it's ok if the variable is not used.
// (Typically used to silence a compiler warning when the assignment
// is important for some other reason.)
// Use like:
// int x = ...;
// ALLOW_UNUSED_LOCAL(x);
#define ALLOW_UNUSED_LOCAL(x) (void)x
// Annotate a typedef or function indicating it's ok if it's not used.
// Use like:
// typedef Foo Bar ALLOW_UNUSED_TYPE;
#if defined(COMPILER_GCC) || defined(__clang__)
#define ALLOW_UNUSED_TYPE __attribute__((unused))
#else
#define ALLOW_UNUSED_TYPE
#endif
// Annotate a function indicating it should not be inlined. // Annotate a function indicating it should not be inlined.
// Use like: // Use like:
// NOINLINE void DoStuff() { ... } // NOINLINE void DoStuff() { ... }
@@ -131,6 +153,17 @@
#define ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment))) #define ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment)))
#endif #endif
// Annotate a function indicating the caller must examine the return value.
// Use like:
// int foo() WARN_UNUSED_RESULT;
// To explicitly ignore a result, see |ignore_result()| in base/macros.h.
#undef WARN_UNUSED_RESULT
#if defined(COMPILER_GCC) || defined(__clang__)
#define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#else
#define WARN_UNUSED_RESULT
#endif
// In case the compiler supports it NO_UNIQUE_ADDRESS evaluates to the C++20 // In case the compiler supports it NO_UNIQUE_ADDRESS evaluates to the C++20
// attribute [[no_unique_address]]. This allows annotating data members so that // attribute [[no_unique_address]]. This allows annotating data members so that
// they need not have an address distinct from all other non-static data members // they need not have an address distinct from all other non-static data members
@@ -387,25 +420,4 @@ inline constexpr bool AnalyzerAssumeTrue(bool arg) {
#endif // !USING_CHROMIUM_INCLUDES #endif // !USING_CHROMIUM_INCLUDES
// Annotate a function indicating the caller must examine the return value.
// Use like:
// int foo() WARN_UNUSED_RESULT;
// To explicitly ignore a result, use std::ignore from <tuple>.
// Alternately use `[[nodiscard]]` with code that supports C++17.
#undef WARN_UNUSED_RESULT
#if defined(COMPILER_GCC) || defined(__clang__)
#define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#else
#define WARN_UNUSED_RESULT
#endif
// Annotate a variable indicating it's ok if the variable is not used.
// (Typically used to silence a compiler warning when the assignment
// is important for some other reason.)
// Use like:
// int x = ...;
// ALLOW_UNUSED_LOCAL(x);
// Alternately use `[[maybe_unused]]` with code that supports C++17.
#define ALLOW_UNUSED_LOCAL(x) (void)x
#endif // CEF_INCLUDE_BASE_CEF_COMPILER_SPECIFIC_H_ #endif // CEF_INCLUDE_BASE_CEF_COMPILER_SPECIFIC_H_

View File

@@ -32,7 +32,11 @@
#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/ignore_result.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.
@@ -58,6 +62,17 @@
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

@@ -113,7 +113,7 @@ template <typename T>
struct SupportsToString<T, decltype(void(std::declval<T>().ToString()))> struct SupportsToString<T, decltype(void(std::declval<T>().ToString()))>
: std::true_type {}; : std::true_type {};
// Used to detect whether the given type is an iterator. This is normally used // Used to detech whether the given type is an iterator. This is normally used
// with std::enable_if to provide disambiguation for functions that take // with std::enable_if to provide disambiguation for functions that take
// templatzed iterators as input. // templatzed iterators as input.
template <typename T, typename = void> template <typename T, typename = void>
@@ -276,13 +276,8 @@ 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

@@ -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=665709ecf3ebad59e85285d319eae72197b9766f$ // $hash=adfba3dd6479b96a95639c13ee1e07bed7b335d0$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_APP_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_APP_CAPI_H_
@@ -145,7 +145,7 @@ CEF_EXPORT int cef_initialize(const struct _cef_main_args_t* args,
// This function should be called on the main application thread to shut down // This function should be called on the main application thread to shut down
// the CEF browser process before the application exits. // the CEF browser process before the application exits.
/// ///
CEF_EXPORT void cef_shutdown(void); CEF_EXPORT void cef_shutdown();
/// ///
// Perform a single iteration of CEF message loop processing. This function is // Perform a single iteration of CEF message loop processing. This function is
@@ -162,7 +162,7 @@ CEF_EXPORT void cef_shutdown(void);
// CefSettings.multi_threaded_message_loop value of false (0). This function // CefSettings.multi_threaded_message_loop value of false (0). This function
// will not block. // will not block.
/// ///
CEF_EXPORT void cef_do_message_loop_work(void); CEF_EXPORT void cef_do_message_loop_work();
/// ///
// Run the CEF message loop. Use this function instead of an application- // Run the CEF message loop. Use this function instead of an application-
@@ -172,14 +172,14 @@ CEF_EXPORT void cef_do_message_loop_work(void);
// CefSettings.multi_threaded_message_loop value of false (0). This function // CefSettings.multi_threaded_message_loop value of false (0). This function
// will block until a quit message is received by the system. // will block until a quit message is received by the system.
/// ///
CEF_EXPORT void cef_run_message_loop(void); CEF_EXPORT void cef_run_message_loop();
/// ///
// Quit the CEF message loop that was started by calling cef_run_message_loop(). // Quit the CEF message loop that was started by calling cef_run_message_loop().
// This function should only be called on the main application thread and only // This function should only be called on the main application thread and only
// if cef_run_message_loop() was used. // if cef_run_message_loop() was used.
/// ///
CEF_EXPORT void cef_quit_message_loop(void); CEF_EXPORT void cef_quit_message_loop();
/// ///
// Set to true (1) before calling Windows APIs like TrackPopupMenu that enter a // Set to true (1) before calling Windows APIs like TrackPopupMenu that enter a
@@ -192,7 +192,7 @@ CEF_EXPORT void cef_set_osmodal_loop(int osModalLoop);
// Older versions of Windows should be left DPI-unaware because they do not // Older versions of Windows should be left DPI-unaware because they do not
// support DirectWrite and GDI fonts are kerned very badly. // support DirectWrite and GDI fonts are kerned very badly.
/// ///
CEF_EXPORT void cef_enable_highdpi_support(void); CEF_EXPORT void cef_enable_highdpi_support();
#ifdef __cplusplus #ifdef __cplusplus
} }

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=b80e84c0039ab45d5c4562d64b67a84766c0dab3$ // $hash=8af93d03e0b2a6b50d7612b145599600285b76d4$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_
@@ -450,15 +450,18 @@ typedef struct _cef_browser_host_t {
struct _cef_pdf_print_callback_t* callback); struct _cef_pdf_print_callback_t* callback);
/// ///
// Search for |searchText|. |forward| indicates whether to search forward or // Search for |searchText|. |identifier| must be a unique ID and these IDs
// backward within the page. |matchCase| indicates whether the search should // must strictly increase so that newer requests always have greater IDs than
// be case-sensitive. |findNext| indicates whether this is the first request // older requests. If |identifier| is zero or less than the previous ID value
// or a follow-up. The search will be restarted if |searchText| or |matchCase| // then it will be automatically assigned a new valid ID. |forward| indicates
// change. The search will be stopped if |searchText| is NULL. The // whether to search forward or backward within the page. |matchCase|
// cef_find_handler_t instance, if any, returned via // indicates whether the search should be case-sensitive. |findNext| indicates
// cef_client_t::GetFindHandler will be called to report find results. // whether this is the first request or a follow-up. The cef_find_handler_t
// 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=ad0a78715daff99c1ec987800b7e5d62196e7100$ // $hash=8c97f9b58c642c144cc37824ad820192640307cb$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_PROCESS_HANDLER_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_PROCESS_HANDLER_CAPI_H_
@@ -70,9 +70,9 @@ typedef struct _cef_browser_process_handler_t {
/// ///
// Called before a child process is launched. Will be called on the browser // Called before a child process is launched. Will be called on the browser
// process UI thread when launching a render process and on the browser // process UI thread when launching a render process and on the browser
// process IO thread when launching a GPU process. Provides an opportunity to // process IO thread when launching a GPU or plugin process. Provides an
// modify the child process command line. Do not keep a reference to // opportunity to modify the child process command line. Do not keep a
// |command_line| outside of this function. // reference to |command_line| outside of this function.
/// ///
void(CEF_CALLBACK* on_before_child_process_launch)( void(CEF_CALLBACK* on_before_child_process_launch)(
struct _cef_browser_process_handler_t* self, struct _cef_browser_process_handler_t* self,

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=3049c9960a95d32d61cc57ae998c0eba12820673$ // $hash=93f3d769c0d48ed6e1d91ad8a8e2f95d4ee54287$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_COMMAND_LINE_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_COMMAND_LINE_CAPI_H_
@@ -200,13 +200,13 @@ typedef struct _cef_command_line_t {
/// ///
// Create a new cef_command_line_t instance. // Create a new cef_command_line_t instance.
/// ///
CEF_EXPORT cef_command_line_t* cef_command_line_create(void); CEF_EXPORT cef_command_line_t* cef_command_line_create();
/// ///
// Returns the singleton global cef_command_line_t object. The returned object // Returns the singleton global cef_command_line_t object. The returned object
// will be read-only. // will be read-only.
/// ///
CEF_EXPORT cef_command_line_t* cef_command_line_get_global(void); CEF_EXPORT cef_command_line_t* cef_command_line_get_global();
#ifdef __cplusplus #ifdef __cplusplus
} }

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=d007b3dc26f3f049bf67623da8fae59dc75a193b$ // $hash=fd33ce439e4379d231b6be16bdc1786f314d98e4$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_CONTEXT_MENU_HANDLER_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_CONTEXT_MENU_HANDLER_CAPI_H_
@@ -290,7 +290,8 @@ typedef struct _cef_context_menu_params_t {
/// ///
// Returns true (1) if the context menu contains items specified by the // Returns true (1) if the context menu contains items specified by the
// renderer process. // renderer process (for example, plugin placeholder or pepper plugin menu
// items).
/// ///
int(CEF_CALLBACK* is_custom_menu)(struct _cef_context_menu_params_t* self); int(CEF_CALLBACK* is_custom_menu)(struct _cef_context_menu_params_t* self);
} cef_context_menu_params_t; } cef_context_menu_params_t;

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=5d111a67218403f78737f2c4dc92d2fd96dc125d$ // $hash=0460e68eb7d1b1188706c42d14beafbf9a6f7126$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_CRASH_UTIL_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_CRASH_UTIL_CAPI_H_
@@ -136,7 +136,7 @@ extern "C" {
// CefSetCrashKeyValue function. These key/value pairs will be sent to the crash // CefSetCrashKeyValue function. These key/value pairs will be sent to the crash
// server along with the crash dump file. // server along with the crash dump file.
/// ///
CEF_EXPORT int cef_crash_reporting_enabled(void); CEF_EXPORT int cef_crash_reporting_enabled();
/// ///
// Sets or clears a specific key-value pair from the crash metadata. // Sets or clears a specific key-value pair from the crash metadata.

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=221973f3d5728478eeb0f8f5f55ca5e68b3afd8a$ // $hash=b6e3236a062cd25ec26c3daeb1940d1e1bf0d96a$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_DRAG_DATA_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_DRAG_DATA_CAPI_H_
@@ -219,7 +219,7 @@ typedef struct _cef_drag_data_t {
/// ///
// Create a new cef_drag_data_t object. // Create a new cef_drag_data_t object.
/// ///
CEF_EXPORT cef_drag_data_t* cef_drag_data_create(void); CEF_EXPORT cef_drag_data_t* cef_drag_data_create();
#ifdef __cplusplus #ifdef __cplusplus
} }

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=f2e80b8637b07f19adea666e554269de4627e399$ // $hash=b1fe7f7db5ab92c6ae64dc1288b6fd47c80f9423$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_FIND_HANDLER_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_FIND_HANDLER_CAPI_H_
@@ -59,12 +59,11 @@ 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 a unique incremental identifier for the currently active // |identifer| is the identifier passed to find(), |count| is the number of
// search, |count| is the number of matches currently identified, // matches currently identified, |selectionRect| is the location of where the
// |selectionRect| is the location of where the match was found (in window // match was found (in window coordinates), |activeMatchOrdinal| is the
// coordinates), |activeMatchOrdinal| is the current position in the search // current position in the search results, and |finalUpdate| is true (1) if
// results, and |finalUpdate| is true (1) if this is the last find // this is the last find notification.
// 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

@@ -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=c063e5f0e0c9fef71bdb56e7cc3ea775de17a3ea$ // $hash=b6168013910802cf6d7603892741385958026dcd$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_I18N_UTIL_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_I18N_UTIL_CAPI_H_
@@ -49,7 +49,7 @@ extern "C" {
/// ///
// Returns true (1) if the application text direction is right-to-left. // Returns true (1) if the application text direction is right-to-left.
/// ///
CEF_EXPORT int cef_is_rtl(void); CEF_EXPORT int cef_is_rtl();
#ifdef __cplusplus #ifdef __cplusplus
} }

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=bbc87eb4ecaf92c900193afef7059caedbe8ab3a$ // $hash=b5a36ef39ff250c9d3cb1e9a8c7ee38d7e0f8b3f$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_IMAGE_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_IMAGE_CAPI_H_
@@ -196,7 +196,7 @@ typedef struct _cef_image_t {
// Create a new cef_image_t. It will initially be NULL. Use the Add*() functions // Create a new cef_image_t. It will initially be NULL. Use the Add*() functions
// to add representations at different scale factors. // to add representations at different scale factors.
/// ///
CEF_EXPORT cef_image_t* cef_image_create(void); CEF_EXPORT cef_image_t* cef_image_create();
#ifdef __cplusplus #ifdef __cplusplus
} }

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=26fdd1f18f30d9e2a48aeeb5c69607d9d22d69ca$ // $hash=0939a44345bea8df7ca5f1dbd6afbe41972121f2$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_ORIGIN_WHITELIST_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_ORIGIN_WHITELIST_CAPI_H_
@@ -102,7 +102,7 @@ CEF_EXPORT int cef_remove_cross_origin_whitelist_entry(
// Remove all entries from the cross-origin access whitelist. Returns false (0) // Remove all entries from the cross-origin access whitelist. Returns false (0)
// if the whitelist cannot be accessed. // if the whitelist cannot be accessed.
/// ///
CEF_EXPORT int cef_clear_cross_origin_whitelist(void); CEF_EXPORT int cef_clear_cross_origin_whitelist();
#ifdef __cplusplus #ifdef __cplusplus
} }

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=1a9b9718367ec8d575fbb39b73b1085b17eb0a2b$ // $hash=fdbd26f9dd20dbd7813fc17a8c34650b2da19581$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_PRINT_SETTINGS_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_PRINT_SETTINGS_CAPI_H_
@@ -193,7 +193,7 @@ typedef struct _cef_print_settings_t {
/// ///
// Create a new cef_print_settings_t object. // Create a new cef_print_settings_t object.
/// ///
CEF_EXPORT cef_print_settings_t* cef_print_settings_create(void); CEF_EXPORT cef_print_settings_t* cef_print_settings_create();
#ifdef __cplusplus #ifdef __cplusplus
} }

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=246d07b9790ff6bd574c59b1c237c603deaf88bf$ // $hash=47b361878452f2a94e559782913d80beb0dba25a$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CAPI_H_
@@ -219,7 +219,7 @@ typedef struct _cef_request_t {
/// ///
// Create a new cef_request_t object. // Create a new cef_request_t object.
/// ///
CEF_EXPORT cef_request_t* cef_request_create(void); CEF_EXPORT cef_request_t* cef_request_create();
/// ///
// Structure used to represent post data for a web request. The functions of // Structure used to represent post data for a web request. The functions of
@@ -278,7 +278,7 @@ typedef struct _cef_post_data_t {
/// ///
// Create a new cef_post_data_t object. // Create a new cef_post_data_t object.
/// ///
CEF_EXPORT cef_post_data_t* cef_post_data_create(void); CEF_EXPORT cef_post_data_t* cef_post_data_create();
/// ///
// Structure used to represent a single element in the request post data. The // Structure used to represent a single element in the request post data. The
@@ -344,7 +344,7 @@ typedef struct _cef_post_data_element_t {
/// ///
// Create a new cef_post_data_element_t object. // Create a new cef_post_data_element_t object.
/// ///
CEF_EXPORT cef_post_data_element_t* cef_post_data_element_create(void); CEF_EXPORT cef_post_data_element_t* cef_post_data_element_create();
#ifdef __cplusplus #ifdef __cplusplus
} }

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=dcff1eaa0563cfb48e0232bf78786bb0126c4255$ // $hash=89e64a2db658ad560e85ea5d3e564a6505d4e914$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_CAPI_H_
@@ -357,7 +357,7 @@ typedef struct _cef_request_context_t {
/// ///
// Returns the global context object. // Returns the global context object.
/// ///
CEF_EXPORT cef_request_context_t* cef_request_context_get_global_context(void); CEF_EXPORT cef_request_context_t* cef_request_context_get_global_context();
/// ///
// Creates a new context object with the specified |settings| and optional // Creates a new context object with the specified |settings| and optional

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=b2657a441a701c5ddaca68dc604fd94153a3220f$ // $hash=b44d320d5cceb5022543e8154170b8d276628c76$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_HANDLER_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_HANDLER_CAPI_H_
@@ -45,6 +45,7 @@
#include "include/capi/cef_frame_capi.h" #include "include/capi/cef_frame_capi.h"
#include "include/capi/cef_request_capi.h" #include "include/capi/cef_request_capi.h"
#include "include/capi/cef_resource_request_handler_capi.h" #include "include/capi/cef_resource_request_handler_capi.h"
#include "include/capi/cef_web_plugin_capi.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

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=4e19e04de13949f20e63e44542bc0a0eeed46b43$ // $hash=4a05a0a7cd4a279ccf8455a3cb2f77de581b597a$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_
@@ -228,6 +228,14 @@ typedef struct _cef_request_handler_t {
struct _cef_x509certificate_t* const* certificates, struct _cef_x509certificate_t* const* certificates,
struct _cef_select_client_certificate_callback_t* callback); struct _cef_select_client_certificate_callback_t* callback);
///
// Called on the browser process UI thread when a plugin has crashed.
// |plugin_path| is the path of the plugin that crashed.
///
void(CEF_CALLBACK* on_plugin_crashed)(struct _cef_request_handler_t* self,
struct _cef_browser_t* browser,
const cef_string_t* plugin_path);
/// ///
// Called on the browser process UI thread when the render view associated // Called on the browser process UI thread when the render view associated
// with |browser| is ready to receive/handle IPC messages in the render // with |browser| is ready to receive/handle IPC messages in the render

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=6d8a7e3c0ed66cad10e8a0c59fed51431ec82ce5$ // $hash=a9e35ca17785f77666db7650208cacfd9a85c3e0$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_RESOURCE_BUNDLE_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_RESOURCE_BUNDLE_CAPI_H_
@@ -95,7 +95,7 @@ typedef struct _cef_resource_bundle_t {
/// ///
// Returns the global resource bundle instance. // Returns the global resource bundle instance.
/// ///
CEF_EXPORT cef_resource_bundle_t* cef_resource_bundle_get_global(void); CEF_EXPORT cef_resource_bundle_t* cef_resource_bundle_get_global();
#ifdef __cplusplus #ifdef __cplusplus
} }

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=ab8832420572dae95a601fb3170fcd3693473619$ // $hash=6ebf7adcdaee57772810c1528b27140ae95966d0$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_RESPONSE_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_RESPONSE_CAPI_H_
@@ -168,7 +168,7 @@ typedef struct _cef_response_t {
/// ///
// Create a new cef_response_t object. // Create a new cef_response_t object.
/// ///
CEF_EXPORT cef_response_t* cef_response_create(void); CEF_EXPORT cef_response_t* cef_response_create();
#ifdef __cplusplus #ifdef __cplusplus
} }

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=83cbe91e85d7ab2413f733b75457ce6689d3d0ae$ // $hash=df8c46dd19ef6a3964c49d79e770de6e4245e208$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_SCHEME_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_SCHEME_CAPI_H_
@@ -131,7 +131,7 @@ CEF_EXPORT int cef_register_scheme_handler_factory(
// ef_request_context_t::cef_request_context_get_global_context()->clear_scheme_ // ef_request_context_t::cef_request_context_get_global_context()->clear_scheme_
// handler_factories(). // handler_factories().
/// ///
CEF_EXPORT int cef_clear_scheme_handler_factories(void); CEF_EXPORT int cef_clear_scheme_handler_factories();
#ifdef __cplusplus #ifdef __cplusplus
} }

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=2502258e69820d070a9f094d5e587a38e96cc930$ // $hash=e943dd2af818e5a5f19f6cbd1648896684c666c6$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_TASK_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_TASK_CAPI_H_
@@ -122,7 +122,7 @@ typedef struct _cef_task_runner_t {
// task runners. An NULL reference will be returned if this function is called // task runners. An NULL reference will be returned if this function is called
// on an invalid thread. // on an invalid thread.
/// ///
CEF_EXPORT cef_task_runner_t* cef_task_runner_get_for_current_thread(void); CEF_EXPORT cef_task_runner_t* cef_task_runner_get_for_current_thread();
/// ///
// Returns the task runner for the specified CEF thread. // Returns the task runner for the specified CEF thread.

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=0a206b1c12637c8b04b2815cb3b50f212768ba01$ // $hash=a7b4410e0a35eb0aba747014665419fb6b6fcb67$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_TRACE_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_TRACE_CAPI_H_
@@ -109,7 +109,7 @@ CEF_EXPORT int cef_end_tracing(const cef_string_t* tracing_file,
// high-res time. Can be used by clients to synchronize with the time // high-res time. Can be used by clients to synchronize with the time
// information in trace events. // information in trace events.
/// ///
CEF_EXPORT int64 cef_now_from_system_trace_time(void); CEF_EXPORT int64 cef_now_from_system_trace_time();
#ifdef __cplusplus #ifdef __cplusplus
} }

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=b7dd2429f492a8f2dd978f9500c63dd0e01035d4$ // $hash=2bdcad7f8e3c03285a5e5ddb9a02a5a2182f254c$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_V8_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_V8_CAPI_H_
@@ -143,17 +143,17 @@ typedef struct _cef_v8context_t {
/// ///
// Returns the current (top) context object in the V8 context stack. // Returns the current (top) context object in the V8 context stack.
/// ///
CEF_EXPORT cef_v8context_t* cef_v8context_get_current_context(void); CEF_EXPORT cef_v8context_t* cef_v8context_get_current_context();
/// ///
// Returns the entered (bottom) context object in the V8 context stack. // Returns the entered (bottom) context object in the V8 context stack.
/// ///
CEF_EXPORT cef_v8context_t* cef_v8context_get_entered_context(void); CEF_EXPORT cef_v8context_t* cef_v8context_get_entered_context();
/// ///
// Returns true (1) if V8 is currently inside a context. // Returns true (1) if V8 is currently inside a context.
/// ///
CEF_EXPORT int cef_v8context_in_context(void); CEF_EXPORT int cef_v8context_in_context();
/// ///
// Structure that should be implemented to handle V8 function calls. The // Structure that should be implemented to handle V8 function calls. The
@@ -733,12 +733,12 @@ typedef struct _cef_v8value_t {
/// ///
// Create a new cef_v8value_t object of type undefined. // Create a new cef_v8value_t object of type undefined.
/// ///
CEF_EXPORT cef_v8value_t* cef_v8value_create_undefined(void); CEF_EXPORT cef_v8value_t* cef_v8value_create_undefined();
/// ///
// Create a new cef_v8value_t object of type null. // Create a new cef_v8value_t object of type null.
/// ///
CEF_EXPORT cef_v8value_t* cef_v8value_create_null(void); CEF_EXPORT cef_v8value_t* cef_v8value_create_null();
/// ///
// Create a new cef_v8value_t object of type bool. // Create a new cef_v8value_t object of type bool.

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=ee899158c4f61cc3f85176174d6fd9cbe2a3db4c$ // $hash=c557496bdc1403b25b22ca9354a942478131c7ce$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_VALUES_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_VALUES_CAPI_H_
@@ -219,7 +219,7 @@ typedef struct _cef_value_t {
/// ///
// Creates a new object. // Creates a new object.
/// ///
CEF_EXPORT cef_value_t* cef_value_create(void); CEF_EXPORT cef_value_t* cef_value_create();
/// ///
// Structure representing a binary value. Can be used on any process and thread. // Structure representing a binary value. Can be used on any process and thread.
@@ -523,7 +523,7 @@ typedef struct _cef_dictionary_value_t {
/// ///
// Creates a new object that is not owned by any other object. // Creates a new object that is not owned by any other object.
/// ///
CEF_EXPORT cef_dictionary_value_t* cef_dictionary_value_create(void); CEF_EXPORT cef_dictionary_value_t* cef_dictionary_value_create();
/// ///
// Structure representing a list value. Can be used on any process and thread. // Structure representing a list value. Can be used on any process and thread.
@@ -744,7 +744,7 @@ typedef struct _cef_list_value_t {
/// ///
// Creates a new object that is not owned by any other object. // Creates a new object that is not owned by any other object.
/// ///
CEF_EXPORT cef_list_value_t* cef_list_value_create(void); CEF_EXPORT cef_list_value_t* cef_list_value_create();
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -0,0 +1,171 @@
// Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=51060280dee57104eaef7b774e4b4895970c0057$
//
#ifndef CEF_INCLUDE_CAPI_CEF_WEB_PLUGIN_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_WEB_PLUGIN_CAPI_H_
#pragma once
#include "include/capi/cef_base_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _cef_browser_t;
///
// Information about a specific web plugin.
///
typedef struct _cef_web_plugin_info_t {
///
// Base structure.
///
cef_base_ref_counted_t base;
///
// Returns the plugin name.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_name)(
struct _cef_web_plugin_info_t* self);
///
// Returns the plugin file path (DLL/bundle/library).
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_path)(
struct _cef_web_plugin_info_t* self);
///
// Returns the version of the plugin (may be OS-specific).
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_version)(
struct _cef_web_plugin_info_t* self);
///
// Returns a description of the plugin from the version information.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_description)(
struct _cef_web_plugin_info_t* self);
} cef_web_plugin_info_t;
///
// Structure to implement for visiting web plugin information. The functions of
// this structure will be called on the browser process UI thread.
///
typedef struct _cef_web_plugin_info_visitor_t {
///
// Base structure.
///
cef_base_ref_counted_t base;
///
// Method that will be called once for each plugin. |count| is the 0-based
// index for the current plugin. |total| is the total number of plugins.
// Return false (0) to stop visiting plugins. This function may never be
// called if no plugins are found.
///
int(CEF_CALLBACK* visit)(struct _cef_web_plugin_info_visitor_t* self,
struct _cef_web_plugin_info_t* info,
int count,
int total);
} cef_web_plugin_info_visitor_t;
///
// Structure to implement for receiving unstable plugin information. The
// functions of this structure will be called on the browser process IO thread.
///
typedef struct _cef_web_plugin_unstable_callback_t {
///
// Base structure.
///
cef_base_ref_counted_t base;
///
// Method that will be called for the requested plugin. |unstable| will be
// true (1) if the plugin has reached the crash count threshold of 3 times in
// 120 seconds.
///
void(CEF_CALLBACK* is_unstable)(
struct _cef_web_plugin_unstable_callback_t* self,
const cef_string_t* path,
int unstable);
} cef_web_plugin_unstable_callback_t;
///
// Visit web plugin information. Can be called on any thread in the browser
// process.
///
CEF_EXPORT void cef_visit_web_plugin_info(
cef_web_plugin_info_visitor_t* visitor);
///
// Cause the plugin list to refresh the next time it is accessed regardless of
// whether it has already been loaded. Can be called on any thread in the
// browser process.
///
CEF_EXPORT void cef_refresh_web_plugins();
///
// Unregister an internal plugin. This may be undone the next time
// cef_refresh_web_plugins() is called. Can be called on any thread in the
// browser process.
///
CEF_EXPORT void cef_unregister_internal_web_plugin(const cef_string_t* path);
///
// Register a plugin crash. Can be called on any thread in the browser process
// but will be executed on the IO thread.
///
CEF_EXPORT void cef_register_web_plugin_crash(const cef_string_t* path);
///
// Query if a plugin is unstable. Can be called on any thread in the browser
// process.
///
CEF_EXPORT void cef_is_web_plugin_unstable(
const cef_string_t* path,
cef_web_plugin_unstable_callback_t* callback);
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_WEB_PLUGIN_CAPI_H_

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=33a684b03178472bdf93e70043304cce8bc32d05$ // $hash=d70d5b74890e3ca91f01333ebdb4f3298caeb619$
// //
#ifndef CEF_INCLUDE_CAPI_TEST_CEF_TRANSLATOR_TEST_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_TEST_CEF_TRANSLATOR_TEST_CAPI_H_
@@ -530,7 +530,7 @@ typedef struct _cef_translator_test_t {
/// ///
// Create the test object. // Create the test object.
/// ///
CEF_EXPORT cef_translator_test_t* cef_translator_test_create(void); CEF_EXPORT cef_translator_test_t* cef_translator_test_create();
/// ///
// Library-side test object for RefPtr. // Library-side test object for RefPtr.

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=5e383d792ce9dc1809d3d3fdeabb9c60fb9ff1ba$ // $hash=2fd0db428ce5902d59a7802c901e1c13b2367b5a$
// //
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_DISPLAY_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_DISPLAY_CAPI_H_
@@ -108,7 +108,7 @@ typedef struct _cef_display_t {
/// ///
// Returns the primary Display. // Returns the primary Display.
/// ///
CEF_EXPORT cef_display_t* cef_display_get_primary(void); CEF_EXPORT cef_display_t* cef_display_get_primary();
/// ///
// Returns the Display nearest |point|. Set |input_pixel_coords| to true (1) if // Returns the Display nearest |point|. Set |input_pixel_coords| to true (1) if
@@ -131,7 +131,7 @@ CEF_EXPORT cef_display_t* cef_display_get_matching_bounds(
// Returns the total number of Displays. Mirrored displays are excluded; this // Returns the total number of Displays. Mirrored displays are excluded; this
// function is intended to return the number of distinct, usable displays. // function is intended to return the number of distinct, usable displays.
/// ///
CEF_EXPORT size_t cef_display_get_count(void); CEF_EXPORT size_t cef_display_get_count();
/// ///
// Returns all Displays. Mirrored displays are excluded; this function is // Returns all Displays. Mirrored displays are excluded; this function is

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 "c32d3ae315c5991d1bd81c412635d95a3fd353f8" #define CEF_API_HASH_UNIVERSAL "bce1c03dd10e25bb5b1c4130297486205e7a8e56"
#if defined(OS_WIN) #if defined(OS_WIN)
#define CEF_API_HASH_PLATFORM "cb1d823e15caa7e7b6074e3e612d111145b374d1" #define CEF_API_HASH_PLATFORM "cb4f19f13d7a944d1cd0ea6fa3a5129d356cd9d5"
#elif defined(OS_MAC) #elif defined(OS_MAC)
#define CEF_API_HASH_PLATFORM "7e3a768a3b73a514763ce9902afb85775ca8c83d" #define CEF_API_HASH_PLATFORM "6c37c43a7f7d206a54297068fcbe3ca4905a17cb"
#elif defined(OS_LINUX) #elif defined(OS_LINUX)
#define CEF_API_HASH_PLATFORM "bc9260335c9493beb100645dbccd587e62925b9e" #define CEF_API_HASH_PLATFORM "3572e1eca7185fdcdcff550f7b1759f4647e3e04"
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

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

View File

@@ -60,9 +60,9 @@ class CefBrowserProcessHandler : public virtual CefBaseRefCounted {
/// ///
// Called before a child process is launched. Will be called on the browser // Called before a child process is launched. Will be called on the browser
// process UI thread when launching a render process and on the browser // process UI thread when launching a render process and on the browser
// process IO thread when launching a GPU process. Provides an opportunity to // process IO thread when launching a GPU or plugin process. Provides an
// modify the child process command line. Do not keep a reference to // opportunity to modify the child process command line. Do not keep a
// |command_line| outside of this method. // reference to |command_line| outside of this method.
/// ///
/*--cef()--*/ /*--cef()--*/
virtual void OnBeforeChildProcessLaunch( virtual void OnBeforeChildProcessLaunch(

View File

@@ -277,7 +277,7 @@ class CefContextMenuParams : public virtual CefBaseRefCounted {
/// ///
// Returns true if the context menu contains items specified by the renderer // Returns true if the context menu contains items specified by the renderer
// process. // process (for example, plugin placeholder or pepper plugin menu items).
/// ///
/*--cef()--*/ /*--cef()--*/
virtual bool IsCustomMenu() = 0; virtual bool IsCustomMenu() = 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 a unique incremental identifier for the currently active // |identifer| is the identifier passed to Find(), |count| is the number of
// search, |count| is the number of matches currently identified, // matches currently identified, |selectionRect| is the location of where the
// |selectionRect| is the location of where the match was found (in window // match was found (in window coordinates), |activeMatchOrdinal| is the
// coordinates), |activeMatchOrdinal| is the current position in the search // current position in the search results, and |finalUpdate| is true if this
// results, and |finalUpdate| is true if this is the last find notification. // is the last find notification.
/// ///
/*--cef()--*/ /*--cef()--*/
virtual void OnFindResult(CefRefPtr<CefBrowser> browser, virtual void OnFindResult(CefRefPtr<CefBrowser> browser,

View File

@@ -43,6 +43,7 @@
#include "include/cef_frame.h" #include "include/cef_frame.h"
#include "include/cef_request.h" #include "include/cef_request.h"
#include "include/cef_resource_request_handler.h" #include "include/cef_resource_request_handler.h"
#include "include/cef_web_plugin.h"
/// ///
// Implement this interface to provide handler implementations. The handler // Implement this interface to provide handler implementations. The handler
@@ -52,6 +53,8 @@
/*--cef(source=client,no_debugct_check)--*/ /*--cef(source=client,no_debugct_check)--*/
class CefRequestContextHandler : public virtual CefBaseRefCounted { class CefRequestContextHandler : public virtual CefBaseRefCounted {
public: public:
typedef cef_plugin_policy_t PluginPolicy;
/// ///
// Called on the browser process UI thread immediately after the request // Called on the browser process UI thread immediately after the request
// context has been initialized. // context has been initialized.

View File

@@ -228,6 +228,14 @@ class CefRequestHandler : public virtual CefBaseRefCounted {
return false; return false;
} }
///
// Called on the browser process UI thread when a plugin has crashed.
// |plugin_path| is the path of the plugin that crashed.
///
/*--cef()--*/
virtual void OnPluginCrashed(CefRefPtr<CefBrowser> browser,
const CefString& plugin_path) {}
/// ///
// Called on the browser process UI thread when the render view associated // Called on the browser process UI thread when the render view associated
// with |browser| is ready to receive/handle IPC messages in the render // with |browser| is ready to receive/handle IPC messages in the render

View File

@@ -40,11 +40,11 @@
extern "C" { extern "C" {
#endif #endif
// The sandbox is used to restrict sub-processes (renderer, GPU, etc) from // The sandbox is used to restrict sub-processes (renderer, plugin, GPU, etc)
// directly accessing system resources. This helps to protect the user from // from directly accessing system resources. This helps to protect the user
// untrusted and potentially malicious Web content. See // from untrusted and potentially malicious Web content.
// http://www.chromium.org/developers/design-documents/sandbox for complete // See http://www.chromium.org/developers/design-documents/sandbox for
// details. // complete details.
// //
// To enable the sandbox on macOS the following requirements must be met: // To enable the sandbox on macOS the following requirements must be met:
// 1. Link the helper process executable with the cef_sandbox static library. // 1. Link the helper process executable with the cef_sandbox static library.

View File

@@ -39,26 +39,26 @@
extern "C" { extern "C" {
#endif #endif
// The sandbox is used to restrict sub-processes (renderer, GPU, etc) from // The sandbox is used to restrict sub-processes (renderer, plugin, GPU, etc)
// directly accessing system resources. This helps to protect the user from // from directly accessing system resources. This helps to protect the user
// untrusted and potentially malicious Web content. See // from untrusted and potentially malicious Web content.
// http://www.chromium.org/developers/design-documents/sandbox for complete // See http://www.chromium.org/developers/design-documents/sandbox for
// details. // complete details.
// //
// To enable the sandbox on Windows the following requirements must be met: // To enable the sandbox on Windows the following requirements must be met:
// 1. Use the same executable for the browser process and all sub-processes. // 1. Use the same executable for the browser process and all sub-processes.
// 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
// CefExecuteProcess() and CefInitialize() functions via the // CefExecutProcess() 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 CefExecuteProcess() and/or CefInitialize() functions. // into the CefExecutProcess() and/or CefInitialize() functions.
/// ///
void* cef_sandbox_info_create(void); void* cef_sandbox_info_create();
/// ///
// Destroy the specified sandbox information object. // Destroy the specified sandbox information object.

148
include/cef_web_plugin.h Normal file
View File

@@ -0,0 +1,148 @@
// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_CEF_WEB_PLUGIN_H_
#define CEF_INCLUDE_CEF_WEB_PLUGIN_H_
#include "include/cef_base.h"
class CefBrowser;
///
// Information about a specific web plugin.
///
/*--cef(source=library)--*/
class CefWebPluginInfo : public virtual CefBaseRefCounted {
public:
///
// Returns the plugin name.
///
/*--cef()--*/
virtual CefString GetName() = 0;
///
// Returns the plugin file path (DLL/bundle/library).
///
/*--cef()--*/
virtual CefString GetPath() = 0;
///
// Returns the version of the plugin (may be OS-specific).
///
/*--cef()--*/
virtual CefString GetVersion() = 0;
///
// Returns a description of the plugin from the version information.
///
/*--cef()--*/
virtual CefString GetDescription() = 0;
};
///
// Interface to implement for visiting web plugin information. The methods of
// this class will be called on the browser process UI thread.
///
/*--cef(source=client)--*/
class CefWebPluginInfoVisitor : public virtual CefBaseRefCounted {
public:
///
// Method that will be called once for each plugin. |count| is the 0-based
// index for the current plugin. |total| is the total number of plugins.
// Return false to stop visiting plugins. This method may never be called if
// no plugins are found.
///
/*--cef()--*/
virtual bool Visit(CefRefPtr<CefWebPluginInfo> info,
int count,
int total) = 0;
};
///
// Visit web plugin information. Can be called on any thread in the browser
// process.
///
/*--cef()--*/
void CefVisitWebPluginInfo(CefRefPtr<CefWebPluginInfoVisitor> visitor);
///
// Cause the plugin list to refresh the next time it is accessed regardless
// of whether it has already been loaded. Can be called on any thread in the
// browser process.
///
/*--cef()--*/
void CefRefreshWebPlugins();
///
// Unregister an internal plugin. This may be undone the next time
// CefRefreshWebPlugins() is called. Can be called on any thread in the browser
// process.
///
/*--cef()--*/
void CefUnregisterInternalWebPlugin(const CefString& path);
///
// Register a plugin crash. Can be called on any thread in the browser process
// but will be executed on the IO thread.
///
/*--cef()--*/
void CefRegisterWebPluginCrash(const CefString& path);
///
// Interface to implement for receiving unstable plugin information. The methods
// of this class will be called on the browser process IO thread.
///
/*--cef(source=client)--*/
class CefWebPluginUnstableCallback : public virtual CefBaseRefCounted {
public:
///
// Method that will be called for the requested plugin. |unstable| will be
// true if the plugin has reached the crash count threshold of 3 times in 120
// seconds.
///
/*--cef()--*/
virtual void IsUnstable(const CefString& path, bool unstable) = 0;
};
///
// Query if a plugin is unstable. Can be called on any thread in the browser
// process.
///
/*--cef()--*/
void CefIsWebPluginUnstable(const CefString& path,
CefRefPtr<CefWebPluginUnstableCallback> callback);
#endif // CEF_INCLUDE_CEF_WEB_PLUGIN_H_

View File

@@ -44,7 +44,7 @@ extern "C" {
/// ///
// Gets the current log level. // Gets the current log level.
/// ///
CEF_EXPORT int cef_get_min_log_level(void); CEF_EXPORT int cef_get_min_log_level();
/// ///
// Gets the current vlog level for the given file (usually taken from // Gets the current vlog level for the given file (usually taken from

View File

@@ -46,7 +46,7 @@ typedef void* cef_string_list_t;
/// ///
// Allocate a new string map. // Allocate a new string map.
/// ///
CEF_EXPORT cef_string_list_t cef_string_list_alloc(void); CEF_EXPORT cef_string_list_t cef_string_list_alloc();
/// ///
// Return the number of elements in the string list. // Return the number of elements in the string list.

View File

@@ -46,7 +46,7 @@ typedef void* cef_string_map_t;
/// ///
// Allocate a new string map. // Allocate a new string map.
/// ///
CEF_EXPORT cef_string_map_t cef_string_map_alloc(void); CEF_EXPORT cef_string_map_t cef_string_map_alloc();
/// ///
// Return the number of elements in the string map. // Return the number of elements in the string map.

View File

@@ -47,7 +47,7 @@ typedef void* cef_string_multimap_t;
/// ///
// Allocate a new string multimap. // Allocate a new string multimap.
/// ///
CEF_EXPORT cef_string_multimap_t cef_string_multimap_alloc(void); CEF_EXPORT cef_string_multimap_t cef_string_multimap_alloc();
/// ///
// Return the number of elements in the string multimap. // Return the number of elements in the string multimap.

View File

@@ -175,9 +175,9 @@ typedef cef_string_utf16_t* cef_string_userfree_utf16_t;
// calling the associated free function. // calling the associated free function.
/// ///
CEF_EXPORT cef_string_userfree_wide_t cef_string_userfree_wide_alloc(void); CEF_EXPORT cef_string_userfree_wide_t cef_string_userfree_wide_alloc();
CEF_EXPORT cef_string_userfree_utf8_t cef_string_userfree_utf8_alloc(void); CEF_EXPORT cef_string_userfree_utf8_t cef_string_userfree_utf8_alloc();
CEF_EXPORT cef_string_userfree_utf16_t cef_string_userfree_utf16_alloc(void); CEF_EXPORT cef_string_userfree_utf16_t cef_string_userfree_utf16_alloc();
/// ///
// These functions free the string structure allocated by the associated // These functions free the string structure allocated by the associated

View File

@@ -584,16 +584,10 @@ class CefStringBase {
return NULL; return NULL;
userfree_struct_type str = traits::userfree_alloc(); userfree_struct_type str = traits::userfree_alloc();
if (owner_) { memcpy(str, string_, sizeof(struct_type));
// Transfer ownership of the data to |str|.
memcpy(str, string_, sizeof(struct_type));
// Free this class' structure but not the data.
memset(string_, 0, sizeof(struct_type));
} else {
// Copy the data to |str|.
traits::set(string_->str, string_->length, str, /*copy=*/true);
}
// Free this class' structure but not the data.
memset(string_, 0, sizeof(struct_type));
ClearAndFree(); ClearAndFree();
return str; return str;

View File

@@ -55,7 +55,7 @@ typedef pid_t cef_platform_thread_id_t;
/// ///
// Returns the current platform thread ID. // Returns the current platform thread ID.
/// ///
CEF_EXPORT cef_platform_thread_id_t cef_get_current_platform_thread_id(void); CEF_EXPORT cef_platform_thread_id_t cef_get_current_platform_thread_id();
#if defined(OS_WIN) #if defined(OS_WIN)
typedef DWORD cef_platform_thread_handle_t; typedef DWORD cef_platform_thread_handle_t;
@@ -69,7 +69,7 @@ typedef pthread_t cef_platform_thread_handle_t;
// Returns the current platform thread handle. // Returns the current platform thread handle.
/// ///
CEF_EXPORT cef_platform_thread_handle_t CEF_EXPORT cef_platform_thread_handle_t
cef_get_current_platform_thread_handle(void); cef_get_current_platform_thread_handle();
#ifdef __cplusplus #ifdef __cplusplus
} }

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) then the CefDoMessageLoopWork() function must be // thread. If false (0) than 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.
/// ///
@@ -374,11 +374,10 @@ typedef struct _cef_settings_t {
/// ///
// Set to a value between 1024 and 65535 to enable remote debugging on the // Set to a value between 1024 and 65535 to enable remote debugging on the
// specified port. Also configurable using the "remote-debugging-port" // specified port. For example, if 8080 is specified the remote debugging URL
// command-line switch. Remote debugging can be accessed by loading the // will be http://localhost:8080. CEF can be remotely debugged from any CEF or
// chrome://inspect page in Google Chrome. Port numbers 9222 and 9229 are // Chrome browser window. Also configurable using the "remote-debugging-port"
// discoverable by default. Other port numbers may need to be configured via // command-line switch.
// "Discover network targets" on the Devices tab.
/// ///
int remote_debugging_port; int remote_debugging_port;
@@ -577,6 +576,12 @@ typedef struct _cef_browser_settings_t {
/// ///
cef_state_t javascript_dom_paste; cef_state_t javascript_dom_paste;
///
// Controls whether any plugins will be loaded. Also configurable using the
// "disable-plugins" command-line switch.
///
cef_state_t plugins;
/// ///
// Controls whether image URLs will be loaded from the network. A cached image // Controls whether image URLs will be loaded from the network. A cached image
// will still be rendered if requested. Also configurable using the // will still be rendered if requested. Also configurable using the
@@ -2466,6 +2471,32 @@ typedef enum {
SCALE_FACTOR_300P, SCALE_FACTOR_300P,
} cef_scale_factor_t; } cef_scale_factor_t;
///
// Plugin policies supported by CefRequestContextHandler::OnBeforePluginLoad.
///
typedef enum {
///
// Allow the content.
///
PLUGIN_POLICY_ALLOW,
///
// Allow important content and block unimportant content based on heuristics.
// The user can manually load blocked content.
///
PLUGIN_POLICY_DETECT_IMPORTANT,
///
// Block the content. The user can manually load blocked content.
///
PLUGIN_POLICY_BLOCK,
///
// Disable the content. The user cannot load disabled content.
///
PLUGIN_POLICY_DISABLE,
} cef_plugin_policy_t;
/// ///
// Policy for how the Referrer HTTP header value will be sent during navigation. // Policy for how the Referrer HTTP header value will be sent during navigation.
// If the `--no-referrers` command-line flag is specified then the policy value // If the `--no-referrers` command-line flag is specified then the policy value

View File

@@ -69,7 +69,7 @@ extern "C" {
// thread-safe and must only be accessed on the browser process UI thread. // thread-safe and must only be accessed on the browser process UI thread.
/// ///
#if defined(CEF_X11) #if defined(CEF_X11)
CEF_EXPORT XDisplay* cef_get_xdisplay(void); CEF_EXPORT XDisplay* cef_get_xdisplay();
#endif #endif
/// ///

View File

@@ -704,6 +704,7 @@ struct CefBrowserSettingsTraits {
target->javascript_close_windows = src->javascript_close_windows; target->javascript_close_windows = src->javascript_close_windows;
target->javascript_access_clipboard = src->javascript_access_clipboard; target->javascript_access_clipboard = src->javascript_access_clipboard;
target->javascript_dom_paste = src->javascript_dom_paste; target->javascript_dom_paste = src->javascript_dom_paste;
target->plugins = src->plugins;
target->image_loading = src->image_loading; target->image_loading = src->image_loading;
target->image_shrink_standalone_to_fit = target->image_shrink_standalone_to_fit =
src->image_shrink_standalone_to_fit; src->image_shrink_standalone_to_fit;

View File

@@ -49,7 +49,7 @@ int cef_load_library(const char* path);
// Unload the CEF library that was previously loaded. Returns true (1) // Unload the CEF library that was previously loaded. Returns true (1)
// on success and false (0) on failure. // on success and false (0) on failure.
/// ///
int cef_unload_library(void); int cef_unload_library();
#ifdef __cplusplus #ifdef __cplusplus
} }

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 then the callbacks will remain registered until one of the // persistent than 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|

View File

@@ -9,7 +9,6 @@
#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"
@@ -451,19 +450,21 @@ void AlloyBrowserHostImpl::PrintToPDF(const CefString& path,
} }
} }
void AlloyBrowserHostImpl::Find(const CefString& searchText, void AlloyBrowserHostImpl::Find(int identifier,
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, searchText, base::BindOnce(&AlloyBrowserHostImpl::Find, this, identifier,
forward, matchCase, findNext)); searchText, forward, matchCase, findNext));
return; return;
} }
if (platform_delegate_) { if (platform_delegate_) {
platform_delegate_->Find(searchText, forward, matchCase, findNext); platform_delegate_->Find(identifier, searchText, forward, matchCase,
findNext);
} }
} }
@@ -665,7 +666,7 @@ void AlloyBrowserHostImpl::SendCaptureLostEvent() {
} }
void AlloyBrowserHostImpl::NotifyMoveOrResizeStarted() { void AlloyBrowserHostImpl::NotifyMoveOrResizeStarted() {
#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)) #if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC))
if (!CEF_CURRENTLY_ON_UIT()) { if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK( CEF_POST_TASK(
CEF_UIT, CEF_UIT,
@@ -859,21 +860,13 @@ 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) {
auto alloy_delegate = if (client_.get()) {
static_cast<CefBrowserPlatformDelegateAlloy*>(platform_delegate()); CefRefPtr<CefFindHandler> handler = client_->GetFindHandler();
if (alloy_delegate->HandleFindReply(request_id, number_of_matches, if (handler.get()) {
selection_rect, active_match_ordinal, CefRect rect(selection_rect.x(), selection_rect.y(),
final_update)) { selection_rect.width(), selection_rect.height());
if (client_) { handler->OnFindResult(this, request_id, number_of_matches, rect,
if (auto handler = client_->GetFindHandler()) { active_match_ordinal, final_update);
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());
}
} }
} }
} }
@@ -1360,7 +1353,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 BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)) #if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_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());
@@ -1456,13 +1449,15 @@ bool AlloyBrowserHostImpl::IsNeverComposited(
} }
content::PictureInPictureResult AlloyBrowserHostImpl::EnterPictureInPicture( content::PictureInPictureResult AlloyBrowserHostImpl::EnterPictureInPicture(
content::WebContents* web_contents) { content::WebContents* web_contents,
const viz::SurfaceId& surface_id,
const gfx::Size& natural_size) {
if (!IsPictureInPictureSupported()) { if (!IsPictureInPictureSupported()) {
return content::PictureInPictureResult::kNotSupported; return content::PictureInPictureResult::kNotSupported;
} }
return PictureInPictureWindowManager::GetInstance() return PictureInPictureWindowManager::GetInstance()->EnterPictureInPicture(
->EnterVideoPictureInPicture(web_contents); web_contents, surface_id, natural_size);
} }
void AlloyBrowserHostImpl::ExitPictureInPicture() { void AlloyBrowserHostImpl::ExitPictureInPicture() {
@@ -1475,8 +1470,7 @@ bool AlloyBrowserHostImpl::IsBackForwardCacheSupported() {
return false; return false;
} }
bool AlloyBrowserHostImpl::IsPrerender2Supported( bool AlloyBrowserHostImpl::IsPrerender2Supported() {
content::WebContents& web_contents) {
return true; return true;
} }

View File

@@ -94,7 +94,8 @@ 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(const CefString& searchText, void Find(int identifier,
const CefString& searchText,
bool forward, bool forward,
bool matchCase, bool matchCase,
bool findNext) override; bool findNext) override;
@@ -283,10 +284,12 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
blink::mojom::MediaStreamType type) override; blink::mojom::MediaStreamType type) override;
bool IsNeverComposited(content::WebContents* web_contents) override; bool IsNeverComposited(content::WebContents* web_contents) override;
content::PictureInPictureResult EnterPictureInPicture( content::PictureInPictureResult EnterPictureInPicture(
content::WebContents* web_contents) override; content::WebContents* web_contents,
const viz::SurfaceId& surface_id,
const gfx::Size& natural_size) override;
void ExitPictureInPicture() override; void ExitPictureInPicture() override;
bool IsBackForwardCacheSupported() override; bool IsBackForwardCacheSupported() override;
bool IsPrerender2Supported(content::WebContents& web_contents) override; bool IsPrerender2Supported() override;
// content::WebContentsObserver methods. // content::WebContentsObserver methods.
using content::WebContentsObserver::BeforeUnloadFired; using content::WebContentsObserver::BeforeUnloadFired;

View File

@@ -39,7 +39,7 @@
#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 BUILDFLAG(IS_LINUX) #if defined(OS_LINUX)
#include "ui/ozone/buildflags.h" #include "ui/ozone/buildflags.h"
#if defined(USE_AURA) && BUILDFLAG(OZONE_PLATFORM_X11) #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"
@@ -52,14 +52,15 @@
#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 BUILDFLAG(IS_WIN) #if defined(OS_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 BUILDFLAG(IS_MAC) #if defined(OS_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
@@ -67,22 +68,13 @@
#endif #endif
#endif // defined(TOOLKIT_VIEWS) #endif // defined(TOOLKIT_VIEWS)
#if defined(USE_AURA) && BUILDFLAG(IS_LINUX) #if defined(USE_AURA) && defined(OS_LINUX)
#include "ui/base/ime/init/input_method_initializer.h" #include "ui/base/ime/init/input_method_initializer.h"
#endif #endif
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) #if defined(OS_LINUX)
#include "components/os_crypt/os_crypt.h"
#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 "libcef/browser/printing/print_dialog_linux.h"
#include "ui/base/l10n/l10n_util.h" #endif
#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"
@@ -101,7 +93,7 @@ AlloyBrowserMainParts::~AlloyBrowserMainParts() {
} }
int AlloyBrowserMainParts::PreEarlyInitialization() { int AlloyBrowserMainParts::PreEarlyInitialization() {
#if defined(USE_AURA) && BUILDFLAG(IS_LINUX) #if defined(USE_AURA) && defined(OS_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();
@@ -119,7 +111,7 @@ void AlloyBrowserMainParts::ToolkitInitialized() {
#endif // defined(USE_AURA) #endif // defined(USE_AURA)
#if defined(TOOLKIT_VIEWS) #if defined(TOOLKIT_VIEWS)
#if BUILDFLAG(IS_MAC) #if defined(OS_MAC)
views_delegate_ = std::make_unique<ChromeViewsDelegate>(); views_delegate_ = std::make_unique<ChromeViewsDelegate>();
layout_provider_ = ChromeLayoutProvider::CreateLayoutProvider(); layout_provider_ = ChromeLayoutProvider::CreateLayoutProvider();
#else #else
@@ -129,13 +121,13 @@ void AlloyBrowserMainParts::ToolkitInitialized() {
} }
void AlloyBrowserMainParts::PreCreateMainMessageLoop() { void AlloyBrowserMainParts::PreCreateMainMessageLoop() {
#if BUILDFLAG(IS_LINUX) #if defined(OS_LINUX)
#if defined(USE_AURA) && BUILDFLAG(OZONE_PLATFORM_X11) #if defined(USE_AURA) && BUILDFLAG(OZONE_PLATFORM_X11)
ui::TouchFactory::SetTouchDeviceListFromCommandLine(); ui::TouchFactory::SetTouchDeviceListFromCommandLine();
#endif #endif
#endif #endif
#if BUILDFLAG(IS_WIN) #if defined(OS_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);
@@ -145,44 +137,22 @@ 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 // BUILDFLAG(IS_WIN) #endif // defined(OS_WIN)
media_router::ChromeMediaRouterFactory::DoPlatformInit(); media_router::ChromeMediaRouterFactory::DoPlatformInit();
} }
void AlloyBrowserMainParts::PostCreateMainMessageLoop() { void AlloyBrowserMainParts::PostCreateMainMessageLoop() {
#if BUILDFLAG(IS_LINUX) #if defined(OS_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 BUILDFLAG(IS_WIN) #if defined(OS_WIN)
PlatformInitialize(); PlatformInitialize();
#endif #endif
@@ -235,7 +205,7 @@ int AlloyBrowserMainParts::PreMainMessageLoopRun() {
CefDevToolsManagerDelegate::StartHttpHandler(browser_context); CefDevToolsManagerDelegate::StartHttpHandler(browser_context);
#if BUILDFLAG(IS_WIN) #if defined(OS_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();
@@ -279,7 +249,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 BUILDFLAG(IS_MAC) #if defined(OS_MAC)
layout_provider_.reset(); layout_provider_.reset();
#endif #endif
#endif // defined(TOOLKIT_VIEWS) #endif // defined(TOOLKIT_VIEWS)

View File

@@ -27,7 +27,7 @@ class WMState;
#if defined(TOOLKIT_VIEWS) #if defined(TOOLKIT_VIEWS)
namespace views { namespace views {
class ViewsDelegate; class ViewsDelegate;
#if BUILDFLAG(IS_MAC) #if defined(OS_MAC)
class LayoutProvider; class LayoutProvider;
#endif #endif
} // namespace views } // namespace views
@@ -70,9 +70,9 @@ class AlloyBrowserMainParts : public content::BrowserMainParts {
} }
private: private:
#if BUILDFLAG(IS_WIN) #if defined(OS_WIN)
void PlatformInitialize(); void PlatformInitialize();
#endif // BUILDFLAG(IS_WIN) #endif // defined(OS_WIN)
content::MainFunctionParams parameters_; content::MainFunctionParams parameters_;
@@ -94,7 +94,7 @@ 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 BUILDFLAG(IS_MAC) #if defined(OS_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)

View File

@@ -5,7 +5,6 @@
#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"
@@ -47,6 +46,7 @@
#include "base/base_switches.h" #include "base/base_switches.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/ignore_result.h"
#include "base/json/json_reader.h" #include "base/json/json_reader.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "base/stl_util.h" #include "base/stl_util.h"
@@ -108,14 +108,13 @@
#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"
#include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_web_contents_observer.h" #include "extensions/browser/extension_web_contents_observer.h"
#include "extensions/browser/extensions_browser_client.h" #include "extensions/browser/extensions_browser_client.h"
#include "extensions/browser/guest_view/extensions_guest_view.h" #include "extensions/browser/guest_view/extensions_guest_view_message_filter.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h" #include "extensions/browser/guest_view/web_view/web_view_guest.h"
#include "extensions/browser/info_map.h" #include "extensions/browser/info_map.h"
#include "extensions/browser/process_map.h" #include "extensions/browser/process_map.h"
@@ -143,7 +142,7 @@
#include "ui/base/ui_base_switches.h" #include "ui/base/ui_base_switches.h"
#include "url/gurl.h" #include "url/gurl.h"
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) #if defined(OS_POSIX) && !defined(OS_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"
@@ -151,17 +150,17 @@
#include "content/public/common/content_descriptors.h" #include "content/public/common/content_descriptors.h"
#endif #endif
#if BUILDFLAG(IS_MAC) #if defined(OS_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 BUILDFLAG(IS_WIN) #if defined(OS_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 BUILDFLAG(USE_NSS_CERTS) #if defined(USE_NSS_CERTS)
#include "net/ssl/client_cert_store_nss.h" #include "net/ssl/client_cert_store_nss.h"
#endif #endif
@@ -197,7 +196,7 @@ class CefQuotaCallbackImpl : public CefCallback {
void Cancel() override { ContinueNow(false); } void Cancel() override { ContinueNow(false); }
[[nodiscard]] CallbackType Disconnect() { return std::move(callback_); } CallbackType Disconnect() WARN_UNUSED_RESULT { return std::move(callback_); }
private: private:
void ContinueNow(bool allow) { void ContinueNow(bool allow) {
@@ -255,7 +254,7 @@ class CefAllowCertificateErrorCallbackImpl : public CefCallback {
void Cancel() override { ContinueNow(false); } void Cancel() override { ContinueNow(false); }
[[nodiscard]] CallbackType Disconnect() { return std::move(callback_); } CallbackType Disconnect() WARN_UNUSED_RESULT { return std::move(callback_); }
private: private:
void ContinueNow(bool allow) { void ContinueNow(bool allow) {
@@ -408,7 +407,7 @@ class CefQuotaPermissionContext : public content::QuotaPermissionContext {
~CefQuotaPermissionContext() override = default; ~CefQuotaPermissionContext() override = default;
}; };
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) #if defined(OS_POSIX) && !defined(OS_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;
@@ -463,7 +462,7 @@ int GetCrashSignalFD(const base::CommandLine& command_line) {
return -1; return -1;
} }
#endif // BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) #endif // defined(OS_POSIX) && !defined(OS_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(
@@ -521,6 +520,8 @@ void AlloyContentBrowserClient::RenderProcessWillLaunch(
if (extensions::ExtensionsEnabled()) { if (extensions::ExtensionsEnabled()) {
host->AddFilter(new extensions::ExtensionMessageFilter(id, profile)); host->AddFilter(new extensions::ExtensionMessageFilter(id, profile));
host->AddFilter(
new extensions::ExtensionsGuestViewMessageFilter(id, profile));
} }
// If the renderer process crashes then the host may already have // If the renderer process crashes then the host may already have
@@ -575,6 +576,18 @@ 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,7 +644,6 @@ 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(
@@ -728,7 +740,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 BUILDFLAG(IS_MAC) #if defined(OS_MAC)
switches::kFrameworkDirPath, switches::kFrameworkDirPath,
switches::kMainBundlePath, switches::kMainBundlePath,
#endif #endif
@@ -750,6 +762,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
static const char* const kSwitchNames[] = { static const char* const kSwitchNames[] = {
switches::kDisableExtensions, switches::kDisableExtensions,
switches::kDisablePdfExtension, switches::kDisablePdfExtension,
switches::kDisablePlugins,
switches::kDisablePrintPreview, switches::kDisablePrintPreview,
switches::kDisableScrollBounce, switches::kDisableScrollBounce,
switches::kDisableSpellChecking, switches::kDisableSpellChecking,
@@ -763,6 +776,14 @@ 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)
@@ -797,7 +818,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir); command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir);
} }
#if BUILDFLAG(IS_LINUX) #if defined(OS_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.
@@ -815,7 +836,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames, command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
base::size(kSwitchNames)); base::size(kSwitchNames));
} }
#endif // BUILDFLAG(IS_LINUX) #endif // defined(OS_LINUX)
CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication(); CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication();
if (app.get()) { if (app.get()) {
@@ -825,7 +846,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());
std::ignore = commandLinePtr->Detach(nullptr); ignore_result(commandLinePtr->Detach(nullptr));
} }
} }
} }
@@ -1034,35 +1055,33 @@ AlloyContentBrowserClient::CreateDevToolsManagerDelegate() {
return std::make_unique<CefDevToolsManagerDelegate>(); return std::make_unique<CefDevToolsManagerDelegate>();
} }
void AlloyContentBrowserClient:: bool AlloyContentBrowserClient::BindAssociatedReceiverFromFrame(
RegisterAssociatedInterfaceBindersForRenderFrameHost( content::RenderFrameHost* render_frame_host,
content::RenderFrameHost& render_frame_host, const std::string& interface_name,
blink::AssociatedInterfaceRegistry& associated_registry) { mojo::ScopedInterfaceEndpointHandle* handle) {
associated_registry.AddInterface(base::BindRepeating( if (interface_name == extensions::mojom::LocalFrameHost::Name_) {
[](content::RenderFrameHost* render_frame_host, extensions::ExtensionWebContentsObserver::BindLocalFrameHost(
mojo::PendingAssociatedReceiver<extensions::mojom::LocalFrameHost> mojo::PendingAssociatedReceiver<extensions::mojom::LocalFrameHost>(
receiver) { std::move(*handle)),
extensions::ExtensionWebContentsObserver::BindLocalFrameHost( render_frame_host);
std::move(receiver), render_frame_host); return true;
}, }
&render_frame_host)); 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;
}
associated_registry.AddInterface(base::BindRepeating( return false;
[](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>>
@@ -1132,7 +1151,7 @@ AlloyContentBrowserClient::WillCreateURLLoaderRequestInterceptors(
return interceptors; return interceptors;
} }
#if BUILDFLAG(IS_LINUX) #if defined(OS_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,
@@ -1142,7 +1161,7 @@ void AlloyContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
mappings->Share(kCrashDumpSignal, crash_signal_fd); mappings->Share(kCrashDumpSignal, crash_signal_fd);
} }
} }
#endif // BUILDFLAG(IS_LINUX) #endif // defined(OS_LINUX)
void AlloyContentBrowserClient::ExposeInterfacesToRenderer( void AlloyContentBrowserClient::ExposeInterfacesToRenderer(
service_manager::BinderRegistry* registry, service_manager::BinderRegistry* registry,
@@ -1154,10 +1173,6 @@ void AlloyContentBrowserClient::ExposeInterfacesToRenderer(
if (extensions::ExtensionsEnabled()) { if (extensions::ExtensionsEnabled()) {
associated_registry->AddInterface(base::BindRepeating( associated_registry->AddInterface(base::BindRepeating(
&extensions::EventRouter::BindForRenderer, host->GetID())); &extensions::EventRouter::BindForRenderer, host->GetID()));
associated_registry->AddInterface(base::BindRepeating(
&extensions::ExtensionsGuestView::CreateForComponents, host->GetID()));
associated_registry->AddInterface(base::BindRepeating(
&extensions::ExtensionsGuestView::CreateForExtensions, host->GetID()));
} }
CefBrowserManager::ExposeInterfacesToRenderer(registry, associated_registry, CefBrowserManager::ExposeInterfacesToRenderer(registry, associated_registry,
@@ -1168,13 +1183,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 BUILDFLAG(USE_NSS_CERTS) #if defined(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 BUILDFLAG(IS_WIN) #elif defined(OS_WIN)
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreWin()); return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreWin());
#elif BUILDFLAG(IS_MAC) #elif defined(OS_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.
@@ -1215,7 +1230,6 @@ 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;
@@ -1371,7 +1385,6 @@ 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,8 +1396,6 @@ 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();
@@ -1400,29 +1411,19 @@ bool AlloyContentBrowserClient::HandleExternalProtocol(
web_contents_getter, std::move(receiver), std::move(request_handler)); web_contents_getter, std::move(receiver), std::move(request_handler));
return true; return true;
} }
std::unique_ptr<content::VideoOverlayWindow>
AlloyContentBrowserClient::CreateWindowForVideoPictureInPicture( std::unique_ptr<content::OverlayWindow>
content::VideoPictureInPictureWindowController* controller) { AlloyContentBrowserClient::CreateWindowForPictureInPicture(
// Note: content::VideoOverlayWindow::Create() is defined by platform-specific content::PictureInPictureWindowController* controller) {
// Note: content::OverlayWindow::Create() is defined by platform-specific
// implementation in chrome/browser/ui/views. This layering hack, which goes // implementation in chrome/browser/ui/views. This layering hack, which goes
// through //content and ContentBrowserClient, allows us to work around the // through //content and ContentBrowserClient, allows us to work around the
// dependency constraints that disallow directly calling // dependency constraints that disallow directly calling
// chrome/browser/ui/views code either from here or from other code in // chrome/browser/ui/views code either from here or from other code in
// chrome/browser. // chrome/browser.
return content::VideoOverlayWindow::Create(controller); return content::OverlayWindow::Create(controller);
} }
std::unique_ptr<content::DocumentOverlayWindow>
AlloyContentBrowserClient::CreateWindowForDocumentPictureInPicture(
content::DocumentPictureInPictureWindowController* controller) {
// Note: content::DocumentOverlayWindow::Create() is defined by
// platform-specific implementation in chrome/browser/ui/views. This layering
// hack, which goes through //content and ContentBrowserClient, allows us to
// work around the dependency constraints that disallow directly calling
// chrome/browser/ui/views code either from here or from other code in
// chrome/browser.
return content::DocumentOverlayWindow::Create(controller);
}
void AlloyContentBrowserClient::RegisterBrowserInterfaceBindersForFrame( void AlloyContentBrowserClient::RegisterBrowserInterfaceBindersForFrame(
content::RenderFrameHost* render_frame_host, content::RenderFrameHost* render_frame_host,
mojo::BinderMapWithContext<content::RenderFrameHost*>* map) { mojo::BinderMapWithContext<content::RenderFrameHost*>* map) {
@@ -1470,10 +1471,6 @@ std::string AlloyContentBrowserClient::GetUserAgent() {
return embedder_support::GetUserAgent(); return embedder_support::GetUserAgent();
} }
std::string AlloyContentBrowserClient::GetFullUserAgent() {
return embedder_support::GetFullUserAgent();
}
std::string AlloyContentBrowserClient::GetReducedUserAgent() { std::string AlloyContentBrowserClient::GetReducedUserAgent() {
return embedder_support::GetReducedUserAgent(); return embedder_support::GetReducedUserAgent();
} }

View File

@@ -43,6 +43,8 @@ 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;
@@ -117,9 +119,10 @@ 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;
void RegisterAssociatedInterfaceBindersForRenderFrameHost( bool BindAssociatedReceiverFromFrame(
content::RenderFrameHost& render_frame_host, content::RenderFrameHost* render_frame_host,
blink::AssociatedInterfaceRegistry& associated_registry) override; const std::string& interface_name,
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;
@@ -137,7 +140,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 BUILDFLAG(IS_LINUX) #if defined(OS_LINUX)
void GetAdditionalMappedFilesForChildProcess( void GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line, const base::CommandLine& command_line,
int child_process_id, int child_process_id,
@@ -166,7 +169,6 @@ 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,
@@ -203,7 +205,6 @@ 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(
@@ -212,16 +213,10 @@ 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::VideoOverlayWindow> std::unique_ptr<content::OverlayWindow> CreateWindowForPictureInPicture(
CreateWindowForVideoPictureInPicture( content::PictureInPictureWindowController* controller) override;
content::VideoPictureInPictureWindowController* controller) override;
std::unique_ptr<content::DocumentOverlayWindow>
CreateWindowForDocumentPictureInPicture(
content::DocumentPictureInPictureWindowController* controller) override;
void RegisterBrowserInterfaceBindersForFrame( void RegisterBrowserInterfaceBindersForFrame(
content::RenderFrameHost* render_frame_host, content::RenderFrameHost* render_frame_host,
mojo::BinderMapWithContext<content::RenderFrameHost*>* map) override; mojo::BinderMapWithContext<content::RenderFrameHost*>* map) override;
@@ -229,7 +224,6 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
std::string GetProduct() override; std::string GetProduct() override;
std::string GetChromeProduct() override; std::string GetChromeProduct() override;
std::string GetUserAgent() override; std::string GetUserAgent() override;
std::string GetFullUserAgent() override;
std::string GetReducedUserAgent() override; std::string GetReducedUserAgent() override;
blink::UserAgentMetadata GetUserAgentMetadata() override; blink::UserAgentMetadata GetUserAgentMetadata() override;
base::flat_set<std::string> GetPluginMimeTypesWithExternalHandlers( base::flat_set<std::string> GetPluginMimeTypesWithExternalHandlers(

View File

@@ -5,8 +5,6 @@
#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"
@@ -15,12 +13,9 @@ 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 = static_cast<AlloyBrowserHostImpl*>( CefRefPtr<AlloyBrowserHostImpl> browser =
extensions::GetOwnerBrowserForHost(web_contents->GetRenderViewHost(), AlloyBrowserHostImpl::GetBrowserForContents(web_contents);
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;
} }
@@ -36,9 +31,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 BUILDFLAG(IS_WIN) #if defined(OS_WIN)
result.assign(str.begin(), str.end()); result.assign(str.begin(), str.end());
#elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA) #elif defined(OS_POSIX) || defined(OS_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,17 +17,13 @@
#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"
@@ -112,7 +108,6 @@ 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);
@@ -259,13 +254,16 @@ void CefBrowserPlatformDelegateAlloy::SendCaptureLostEvent() {
widget->LostCapture(); widget->LostCapture();
} }
#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)) #if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC))
void CefBrowserPlatformDelegateAlloy::NotifyMoveOrResizeStarted() { void CefBrowserPlatformDelegateAlloy::NotifyMoveOrResizeStarted() {
if (!web_contents_) if (!browser_)
return; return;
// Dismiss any existing popups. // Dismiss any existing popups.
web_contents_->ClearFocusedElement(); auto frame = browser_->GetMainFrame();
if (frame && frame->IsValid()) {
static_cast<CefFrameHostImpl*>(frame.get())->NotifyMoveOrResizeStarted();
}
} }
#endif #endif
@@ -340,30 +338,33 @@ void CefBrowserPlatformDelegateAlloy::SetAccessibilityState(
bool CefBrowserPlatformDelegateAlloy::IsPrintPreviewSupported() const { bool CefBrowserPlatformDelegateAlloy::IsPrintPreviewSupported() const {
REQUIRE_ALLOY_RUNTIME(); REQUIRE_ALLOY_RUNTIME();
// Print preview is not currently supported with OSR. auto actionable_contents = GetActionableWebContents();
if (IsWindowless()) if (!actionable_contents)
return false; return false;
auto cef_browser_context = auto cef_browser_context = CefBrowserContext::FromBrowserContext(
CefBrowserContext::FromBrowserContext(web_contents_->GetBrowserContext()); actionable_contents->GetBrowserContext());
return cef_browser_context->IsPrintPreviewSupported(); if (!cef_browser_context->IsPrintPreviewSupported()) {
return false;
}
// Print preview is not currently supported with OSR.
return !IsWindowless();
} }
void CefBrowserPlatformDelegateAlloy::Print() { void CefBrowserPlatformDelegateAlloy::Print() {
REQUIRE_ALLOY_RUNTIME(); REQUIRE_ALLOY_RUNTIME();
auto contents_to_use = printing::GetWebContentsToUse(web_contents_); auto actionable_contents = GetActionableWebContents();
if (!contents_to_use) if (!actionable_contents)
return; return;
auto rfh_to_use = printing::GetRenderFrameHostToUse(contents_to_use); auto rfh = actionable_contents->GetMainFrame();
if (!rfh_to_use)
return;
if (IsPrintPreviewSupported()) { if (IsPrintPreviewSupported()) {
GetPrintViewManager(contents_to_use)->PrintPreviewNow(rfh_to_use, false); GetPrintViewManager(actionable_contents)->PrintPreviewNow(rfh, false);
} else { } else {
GetPrintViewManager(contents_to_use)->PrintNow(rfh_to_use); GetPrintViewManager(actionable_contents)->PrintNow(rfh);
} }
} }
@@ -373,65 +374,50 @@ void CefBrowserPlatformDelegateAlloy::PrintToPDF(
CefRefPtr<CefPdfPrintCallback> callback) { CefRefPtr<CefPdfPrintCallback> callback) {
REQUIRE_ALLOY_RUNTIME(); REQUIRE_ALLOY_RUNTIME();
auto contents_to_use = printing::GetWebContentsToUse(web_contents_); content::WebContents* actionable_contents = GetActionableWebContents();
if (!contents_to_use) if (!actionable_contents)
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(contents_to_use) GetPrintViewManager(actionable_contents)
->PrintToPDF(rfh_to_use, base::FilePath(path), settings, ->PrintToPDF(actionable_contents->GetMainFrame(), base::FilePath(path),
std::move(pdf_callback)); settings, std::move(pdf_callback));
} }
void CefBrowserPlatformDelegateAlloy::Find(const CefString& searchText, void CefBrowserPlatformDelegateAlloy::Find(int identifier,
const CefString& searchText,
bool forward, bool forward,
bool matchCase, bool matchCase,
bool findNext) { bool findNext) {
if (!web_contents_) if (!web_contents_)
return; return;
find_in_page::FindTabHelper::FromWebContents(web_contents_) // Every find request must have a unique ID and these IDs must strictly
->StartFinding(searchText.ToString16(), forward, matchCase, findNext, // increase so that newer requests always have greater IDs than older
/*run_synchronously_for_testing=*/false); // requests.
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;
last_search_result_ = find_in_page::FindNotificationDetails(); content::StopFindAction action =
find_in_page::FindTabHelper::FromWebContents(web_contents_) clearSelection ? content::STOP_FIND_ACTION_CLEAR_SELECTION
->StopFinding(clearSelection ? find_in_page::SelectionAction::kClear : content::STOP_FIND_ACTION_KEEP_SELECTION;
: find_in_page::SelectionAction::kKeep); web_contents_->StopFinding(action);
}
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
@@ -443,6 +429,17 @@ 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,7 +10,6 @@
#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"
@@ -44,7 +43,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 BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)) #if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC))
void NotifyMoveOrResizeStarted() override; void NotifyMoveOrResizeStarted() override;
#endif #endif
bool PreHandleGestureEvent(content::WebContents* source, bool PreHandleGestureEvent(content::WebContents* source,
@@ -59,28 +58,24 @@ 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(const CefString& searchText, void Find(int identifier,
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; }
@@ -101,9 +96,8 @@ 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_;
// The last find result. This object contains details about the number of // Used to provide unique incremental IDs for each find request.
// matches, the find selection rectangle, etc. int find_request_id_counter_ = 0;
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;

View File

@@ -329,12 +329,18 @@ ChromeBrowserProcessAlloy::subresource_filter_ruleset_service() {
return nullptr; return nullptr;
} }
federated_learning::FlocSortingLshClustersService*
ChromeBrowserProcessAlloy::floc_sorting_lsh_clusters_service() {
NOTREACHED();
return nullptr;
}
StartupData* ChromeBrowserProcessAlloy::startup_data() { StartupData* ChromeBrowserProcessAlloy::startup_data() {
NOTREACHED(); NOTREACHED();
return nullptr; return nullptr;
} }
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) #if defined(OS_WIN) || defined(OS_LINUX)
void ChromeBrowserProcessAlloy::StartAutoupdateTimer() {} void ChromeBrowserProcessAlloy::StartAutoupdateTimer() {}
#endif #endif
@@ -403,12 +409,6 @@ ChromeBrowserProcessAlloy::serial_policy_allowed_ports() {
return nullptr; return nullptr;
} }
HidPolicyAllowedDevices*
ChromeBrowserProcessAlloy::hid_policy_allowed_devices() {
NOTREACHED();
return nullptr;
}
breadcrumbs::BreadcrumbPersistentStorageManager* breadcrumbs::BreadcrumbPersistentStorageManager*
ChromeBrowserProcessAlloy::GetBreadcrumbPersistentStorageManager() { ChromeBrowserProcessAlloy::GetBreadcrumbPersistentStorageManager() {
NOTREACHED(); NOTREACHED();

View File

@@ -12,6 +12,7 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include "base/compiler_specific.h"
#include "base/metrics/field_trial.h" #include "base/metrics/field_trial.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/event_router_forwarder.h" #include "chrome/browser/extensions/event_router_forwarder.h"
@@ -90,9 +91,11 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
safe_browsing::SafeBrowsingService* safe_browsing_service() override; safe_browsing::SafeBrowsingService* safe_browsing_service() override;
subresource_filter::RulesetService* subresource_filter_ruleset_service() subresource_filter::RulesetService* subresource_filter_ruleset_service()
override; override;
federated_learning::FlocSortingLshClustersService*
floc_sorting_lsh_clusters_service() override;
StartupData* startup_data() override; StartupData* startup_data() override;
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) #if defined(OS_WIN) || defined(OS_LINUX)
void StartAutoupdateTimer() override; void StartAutoupdateTimer() override;
#endif #endif
@@ -106,7 +109,6 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
override; override;
BuildState* GetBuildState() override; BuildState* GetBuildState() override;
SerialPolicyAllowedPorts* serial_policy_allowed_ports() override; SerialPolicyAllowedPorts* serial_policy_allowed_ports() override;
HidPolicyAllowedDevices* hid_policy_allowed_devices() override;
breadcrumbs::BreadcrumbPersistentStorageManager* breadcrumbs::BreadcrumbPersistentStorageManager*
GetBreadcrumbPersistentStorageManager() override; GetBreadcrumbPersistentStorageManager() override;

View File

@@ -83,8 +83,7 @@ void CreateSystemWideLoopbackStreamHelper(
const bool enable_agc = false; const bool enable_agc = false;
factory->CreateInputStream( factory->CreateInputStream(
-1, -1, media::AudioDeviceDescription::kLoopbackWithMuteDeviceId, params, -1, -1, media::AudioDeviceDescription::kLoopbackWithMuteDeviceId, params,
total_segments, enable_agc, media::mojom::AudioProcessingConfigPtr(), total_segments, enable_agc, std::move(client_remote));
std::move(client_remote));
} }
} // namespace } // namespace

View File

@@ -331,7 +331,8 @@ void CefBrowserContentsDelegate::OnFrameFocused(
OnStateChanged(State::kFocusedFrame); OnStateChanged(State::kFocusedFrame);
} }
void CefBrowserContentsDelegate::PrimaryMainDocumentElementAvailable() { void CefBrowserContentsDelegate::DocumentAvailableInMainFrame(
content::RenderFrameHost* render_frame_host) {
has_document_ = true; has_document_ = true;
OnStateChanged(State::kDocument); OnStateChanged(State::kDocument);
@@ -440,6 +441,16 @@ void CefBrowserContentsDelegate::TitleWasSet(content::NavigationEntry* entry) {
OnTitleChange(web_contents()->GetTitle()); OnTitleChange(web_contents()->GetTitle());
} }
void CefBrowserContentsDelegate::PluginCrashed(
const base::FilePath& plugin_path,
base::ProcessId plugin_pid) {
if (auto c = client()) {
if (auto handler = c->GetRequestHandler()) {
handler->OnPluginCrashed(browser(), plugin_path.value());
}
}
}
void CefBrowserContentsDelegate::DidUpdateFaviconURL( void CefBrowserContentsDelegate::DidUpdateFaviconURL(
content::RenderFrameHost* render_frame_host, content::RenderFrameHost* render_frame_host,
const std::vector<blink::mojom::FaviconURLPtr>& candidates) { const std::vector<blink::mojom::FaviconURLPtr>& candidates) {

View File

@@ -121,7 +121,8 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
void PrimaryMainFrameRenderProcessGone( void PrimaryMainFrameRenderProcessGone(
base::TerminationStatus status) override; base::TerminationStatus status) override;
void OnFrameFocused(content::RenderFrameHost* render_frame_host) override; void OnFrameFocused(content::RenderFrameHost* render_frame_host) override;
void PrimaryMainDocumentElementAvailable() override; void DocumentAvailableInMainFrame(
content::RenderFrameHost* render_frame_host) override;
void LoadProgressChanged(double progress) override; void LoadProgressChanged(double progress) override;
void DidStopLoading() override; void DidStopLoading() override;
void DidFinishNavigation( void DidFinishNavigation(
@@ -130,6 +131,8 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
const GURL& validated_url, const GURL& validated_url,
int error_code) override; int error_code) override;
void TitleWasSet(content::NavigationEntry* entry) override; void TitleWasSet(content::NavigationEntry* entry) override;
void PluginCrashed(const base::FilePath& plugin_path,
base::ProcessId plugin_pid) override;
void DidUpdateFaviconURL( void DidUpdateFaviconURL(
content::RenderFrameHost* render_frame_host, content::RenderFrameHost* render_frame_host,
const std::vector<blink::mojom::FaviconURLPtr>& candidates) override; const std::vector<blink::mojom::FaviconURLPtr>& candidates) override;

View File

@@ -4,8 +4,6 @@
#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"
@@ -15,6 +13,7 @@
#include "libcef/common/frame_util.h" #include "libcef/common/frame_util.h"
#include "libcef/common/net/url_util.h" #include "libcef/common/net/url_util.h"
#include "base/ignore_result.h"
#include "base/logging.h" #include "base/logging.h"
#include "chrome/browser/spellchecker/spellcheck_factory.h" #include "chrome/browser/spellchecker/spellcheck_factory.h"
#include "chrome/browser/spellchecker/spellcheck_service.h" #include "chrome/browser/spellchecker/spellcheck_service.h"
@@ -26,7 +25,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 BUILDFLAG(IS_MAC) #if defined(OS_MAC)
#include "components/spellcheck/browser/spellcheck_platform.h" #include "components/spellcheck/browser/spellcheck_platform.h"
#endif #endif
@@ -347,7 +346,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);
std::ignore = entry->Detach(nullptr); ignore_result(entry->Detach(nullptr));
} else { } else {
// Visit all entries. // Visit all entries.
bool cont = true; bool cont = true;
@@ -355,7 +354,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);
std::ignore = entry->Detach(nullptr); ignore_result(entry->Detach(nullptr));
} }
} }
} }
@@ -409,7 +408,7 @@ void CefBrowserHostBase::AddWordToDictionary(const CefString& word) {
if (spellcheck) if (spellcheck)
spellcheck->GetCustomDictionary()->AddWord(word); spellcheck->GetCustomDictionary()->AddWord(word);
} }
#if BUILDFLAG(IS_MAC) #if defined(OS_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

@@ -131,7 +131,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
std::unique_ptr<CefWindowInfo> window_info(new CefWindowInfo); std::unique_ptr<CefWindowInfo> window_info(new CefWindowInfo);
#if BUILDFLAG(IS_WIN) #if defined(OS_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 (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)) #if (defined(OS_WIN) || defined(OS_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

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

View File

@@ -234,7 +234,7 @@ class CefBrowserPlatformDelegate {
// Send capture lost event. // Send capture lost event.
virtual void SendCaptureLostEvent(); virtual void SendCaptureLostEvent();
#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)) #if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_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();
@@ -353,7 +353,8 @@ 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(const CefString& searchText, virtual void Find(int identifier,
const CefString& searchText,
bool forward, bool forward,
bool matchCase, bool matchCase,
bool findNext); bool findNext);

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 BUILDFLAG(IS_WIN) #if defined(OS_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 BUILDFLAG(IS_MAC) #elif defined(OS_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 BUILDFLAG(IS_LINUX) #elif defined(OS_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 BUILDFLAG(IS_WIN) #if defined(OS_WIN)
return std::make_unique<CefBrowserPlatformDelegateNativeWin>( return std::make_unique<CefBrowserPlatformDelegateNativeWin>(
window_info, background_color); window_info, background_color);
#elif BUILDFLAG(IS_MAC) #elif defined(OS_MAC)
return std::make_unique<CefBrowserPlatformDelegateNativeMac>( return std::make_unique<CefBrowserPlatformDelegateNativeMac>(
window_info, background_color); window_info, background_color);
#elif BUILDFLAG(IS_LINUX) #elif defined(OS_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 BUILDFLAG(IS_WIN) #if defined(OS_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 BUILDFLAG(IS_MAC) #elif defined(OS_MAC)
return std::make_unique<CefBrowserPlatformDelegateOsrMac>( return std::make_unique<CefBrowserPlatformDelegateOsrMac>(
std::move(native_delegate)); std::move(native_delegate));
#elif BUILDFLAG(IS_LINUX) #elif defined(OS_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

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

View File

@@ -74,7 +74,8 @@ 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(const CefString& searchText, void Find(int identifier,
const CefString& searchText,
bool forward, bool forward,
bool matchCase, bool matchCase,
bool findNext) override; bool findNext) override;

View File

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

View File

@@ -41,7 +41,7 @@ class ChromeBrowserMainExtraPartsCef : public ChromeBrowserMainExtraParts {
private: private:
// ChromeBrowserMainExtraParts overrides. // ChromeBrowserMainExtraParts overrides.
void PostProfileInit(Profile* profile, bool is_initial_profile) override; void PostProfileInit() override;
void PreMainMessageLoopRun() override; void PreMainMessageLoopRun() override;
CefRefPtr<CefRequestContextImpl> global_request_context_; CefRefPtr<CefRequestContextImpl> global_request_context_;

View File

@@ -5,8 +5,6 @@
#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"
@@ -26,6 +24,7 @@
#include "libcef/common/command_line_impl.h" #include "libcef/common/command_line_impl.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/ignore_result.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "chrome/browser/chrome_browser_main.h" #include "chrome/browser/chrome_browser_main.h"
#include "chrome/browser/net/system_network_context_manager.h" #include "chrome/browser/net/system_network_context_manager.h"
@@ -36,7 +35,6 @@
#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"
@@ -49,15 +47,7 @@ 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(
@@ -68,7 +58,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, initiating_origin, initiator_rfh, resource_request.has_user_gesture, resource_request.request_initiator,
nullptr); nullptr);
} }
@@ -127,6 +117,16 @@ 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();
@@ -137,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());
std::ignore = commandLinePtr->Detach(nullptr); ignore_result(commandLinePtr->Detach(nullptr));
} }
} }
} }
@@ -256,7 +256,6 @@ 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.
@@ -271,7 +270,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, initiator_document, nullptr); initiating_origin, nullptr);
} }
bool ChromeContentBrowserClientCef::HandleExternalProtocol( bool ChromeContentBrowserClientCef::HandleExternalProtocol(
@@ -280,24 +279,16 @@ 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

@@ -71,7 +71,6 @@ 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(
@@ -80,8 +79,6 @@ 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>>

View File

@@ -5,11 +5,11 @@
#include "build/build_config.h" #include "build/build_config.h"
#if BUILDFLAG(IS_MAC) #if defined(OS_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 // BUILDFLAG(IS_MAC) #endif // defined(OS_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 BUILDFLAG(IS_WIN) #if defined(OS_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 BUILDFLAG(IS_WIN) #if defined(OS_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 // BUILDFLAG(IS_WIN) #endif // defined(OS_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 BUILDFLAG(IS_WIN) #if defined(OS_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 BUILDFLAG(IS_WIN) #if defined(OS_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 BUILDFLAG(IS_WIN) #if defined(OS_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 BUILDFLAG(IS_WIN) #if defined(OS_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 // BUILDFLAG(IS_WIN) #endif // defined(OS_WIN)
} }
// CefContext // CefContext
@@ -323,14 +323,14 @@ bool CefContext::Initialize(const CefMainArgs& args,
settings_ = settings; settings_ = settings;
application_ = application; application_ = application;
#if !(BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)) #if !(defined(OS_WIN) || defined(OS_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 BUILDFLAG(IS_WIN) #if defined(OS_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

@@ -77,8 +77,8 @@ void CefDevToolsFileManager::Save(const std::string& url,
return; return;
} }
const base::DictionaryValue* file_map = &base::Value::AsDictionaryValue( const base::DictionaryValue* file_map =
*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::Value* files_map = update.Get(); base::DictionaryValue* 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

@@ -57,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 BUILDFLAG(IS_WIN) #if defined(OS_WIN)
#include <windows.h> #include <windows.h>
#elif BUILDFLAG(IS_POSIX) #elif defined(OS_POSIX)
#include <time.h> #include <time.h>
#endif #endif
@@ -106,7 +106,7 @@ base::DictionaryValue BuildObjectForResponse(const net::HttpResponseHeaders* rh,
} }
void WriteTimestamp(std::stringstream& stream) { void WriteTimestamp(std::stringstream& stream) {
#if BUILDFLAG(IS_WIN) #if defined(OS_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
@@ -114,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 BUILDFLAG(IS_POSIX) #elif defined(OS_POSIX)
timeval tv; timeval tv;
gettimeofday(&tv, nullptr); gettimeofday(&tv, nullptr);
time_t t = tv.tv_sec; time_t t = tv.tv_sec;
@@ -339,7 +339,8 @@ void CefDevToolsFrontend::ReadyToCommitNavigation(
content::DevToolsFrontendHost::SetupExtensionsAPI(frame, script); content::DevToolsFrontendHost::SetupExtensionsAPI(frame, script);
} }
void CefDevToolsFrontend::PrimaryMainDocumentElementAvailable() { void CefDevToolsFrontend::DocumentAvailableInMainFrame(
content::RenderFrameHost* render_frame_host) {
// Don't call AttachClient multiple times for the same DevToolsAgentHost. // Don't call AttachClient multiple times for the same DevToolsAgentHost.
// Otherwise it will call AgentHostClosed which closes the DevTools window. // Otherwise it will call AgentHostClosed which closes the DevTools window.
// This may happen in cases where the DevTools content fails to load. // This may happen in cases where the DevTools content fails to load.
@@ -380,7 +381,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
// Since we've received message by value, we can take the list. // Since we've received message by value, we can take the list.
base::Value::ListStorage params; base::Value::ListStorage params;
if (params_value) { if (params_value) {
params = std::move(*params_value).TakeListDeprecated(); params = std::move(*params_value).TakeList();
} }
if (*method == "dispatchProtocolMessage") { if (*method == "dispatchProtocolMessage") {

View File

@@ -10,6 +10,7 @@
#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/alloy/alloy_browser_host_impl.h"
#include "libcef/browser/devtools/devtools_file_manager.h" #include "libcef/browser/devtools/devtools_file_manager.h"
#include "base/compiler_specific.h"
#include "base/files/file_path.h" #include "base/files/file_path.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"
@@ -80,7 +81,8 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
// WebContentsObserver overrides // WebContentsObserver overrides
void ReadyToCommitNavigation( void ReadyToCommitNavigation(
content::NavigationHandle* navigation_handle) override; content::NavigationHandle* navigation_handle) override;
void PrimaryMainDocumentElementAvailable() override; void DocumentAvailableInMainFrame(
content::RenderFrameHost* render_frame_host) override;
void WebContentsDestroyed() override; void WebContentsDestroyed() override;
void SendMessageAck(int request_id, base::Value arg); void SendMessageAck(int request_id, base::Value arg);

View File

@@ -5,6 +5,7 @@
#ifndef CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_DELEGATE_H_ #ifndef CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_DELEGATE_H_
#define CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_DELEGATE_H_ #define CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_DELEGATE_H_
#include "base/compiler_specific.h"
#include "content/public/browser/devtools_manager_delegate.h" #include "content/public/browser/devtools_manager_delegate.h"
namespace content { namespace content {

View File

@@ -4,8 +4,6 @@
#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"
@@ -14,6 +12,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/ignore_result.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
@@ -297,7 +296,7 @@ void CefDownloadManagerDelegate::OnDownloadUpdated(DownloadItem* download) {
handler->OnDownloadUpdated(browser.get(), download_item.get(), callback); handler->OnDownloadUpdated(browser.get(), download_item.get(), callback);
std::ignore = download_item->Detach(nullptr); ignore_result(download_item->Detach(nullptr));
} }
} }
@@ -392,7 +391,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);
std::ignore = download_item->Detach(nullptr); ignore_result(download_item->Detach(nullptr));
} }
return true; return true;

View File

@@ -10,6 +10,7 @@
#include "libcef/browser/browser_host_base.h" #include "libcef/browser/browser_host_base.h"
#include "base/compiler_specific.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "components/download/public/common/download_item.h" #include "components/download/public/common/download_item.h"
#include "content/public/browser/download_manager.h" #include "content/public/browser/download_manager.h"

View File

@@ -86,10 +86,10 @@ void CefExtensionImpl::Unload() {
// flag, so set it here. // flag, so set it here.
unloaded_ = true; unloaded_ = true;
[[maybe_unused]] const bool result = const bool result = static_cast<CefRequestContextImpl*>(loader_context_)
static_cast<CefRequestContextImpl*>(loader_context_) ->GetBrowserContext()
->GetBrowserContext() ->UnloadExtension(id_);
->UnloadExtension(id_); ALLOW_UNUSED_LOCAL(result);
DCHECK(result); DCHECK(result);
} }

View File

@@ -1,134 +0,0 @@
// 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

@@ -1,68 +0,0 @@
// 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_

View File

@@ -8,6 +8,7 @@
#include <memory> #include <memory>
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "extensions/browser/api/storage/settings_storage_quota_enforcer.h" #include "extensions/browser/api/storage/settings_storage_quota_enforcer.h"
#include "extensions/browser/api/storage/value_store_cache.h" #include "extensions/browser/api/storage/value_store_cache.h"

View File

@@ -15,6 +15,7 @@
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/printing/print_preview_dialog_controller.h" #include "chrome/browser/printing/print_preview_dialog_controller.h"
#include "content/browser/browser_plugin/browser_plugin_embedder.h"
#include "content/browser/browser_plugin/browser_plugin_guest.h" #include "content/browser/browser_plugin/browser_plugin_guest.h"
#include "content/browser/web_contents/web_contents_impl.h" #include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
@@ -35,6 +36,21 @@ bool InsertWebContents(std::vector<content::WebContents*>* vector,
} // namespace } // namespace
content::WebContents* GetFullPageGuestForOwnerContents(
content::WebContents* owner) {
content::WebContentsImpl* owner_impl =
static_cast<content::WebContentsImpl*>(owner);
content::BrowserPluginEmbedder* plugin_embedder =
owner_impl->GetBrowserPluginEmbedder();
if (plugin_embedder) {
content::BrowserPluginGuest* plugin_guest =
plugin_embedder->GetFullPageGuest();
if (plugin_guest)
return plugin_guest->web_contents();
}
return nullptr;
}
void GetAllGuestsForOwnerContents(content::WebContents* owner, void GetAllGuestsForOwnerContents(content::WebContents* owner,
std::vector<content::WebContents*>* guests) { std::vector<content::WebContents*>* guests) {
content::BrowserPluginGuestManager* plugin_guest_manager = content::BrowserPluginGuestManager* plugin_guest_manager =

View File

@@ -26,6 +26,10 @@ namespace extensions {
class Extension; class Extension;
// Returns the full-page guest WebContents for the specified |owner|, if any.
content::WebContents* GetFullPageGuestForOwnerContents(
content::WebContents* owner);
// Populates |guests| with all guest WebContents with the specified |owner|. // Populates |guests| with all guest WebContents with the specified |owner|.
void GetAllGuestsForOwnerContents(content::WebContents* owner, void GetAllGuestsForOwnerContents(content::WebContents* owner,
std::vector<content::WebContents*>* guests); std::vector<content::WebContents*>* guests);

View File

@@ -361,7 +361,7 @@ base::DictionaryValue* CefExtensionFunctionDetails::OpenTab(
create_params.request_context = request_context; create_params.request_context = request_context;
create_params.window_info.reset(new CefWindowInfo); create_params.window_info.reset(new CefWindowInfo);
#if BUILDFLAG(IS_WIN) #if defined(OS_WIN)
create_params.window_info->SetAsPopup(nullptr, CefString()); create_params.window_info->SetAsPopup(nullptr, CefString());
#endif #endif

View File

@@ -60,7 +60,9 @@ bool CefExtensionHostDelegate::CheckMediaAccessPermission(
} }
content::PictureInPictureResult CefExtensionHostDelegate::EnterPictureInPicture( content::PictureInPictureResult CefExtensionHostDelegate::EnterPictureInPicture(
content::WebContents* web_contents) { content::WebContents* web_contents,
const viz::SurfaceId& surface_id,
const gfx::Size& natural_size) {
NOTREACHED(); NOTREACHED();
return content::PictureInPictureResult::kNotSupported; return content::PictureInPictureResult::kNotSupported;
} }

View File

@@ -38,7 +38,9 @@ class CefExtensionHostDelegate : public ExtensionHostDelegate {
blink::mojom::MediaStreamType type, blink::mojom::MediaStreamType type,
const Extension* extension) override; const Extension* extension) override;
content::PictureInPictureResult EnterPictureInPicture( content::PictureInPictureResult EnterPictureInPicture(
content::WebContents* web_contents) override; content::WebContents* web_contents,
const viz::SurfaceId& surface_id,
const gfx::Size& natural_size) override;
void ExitPictureInPicture() override; void ExitPictureInPicture() override;
}; };

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