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/extension_impl.cc",
"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.h",
"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/mime_handler_view_guest_delegate.cc",
"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.h",
"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/web_contents_dialog_helper.cc",
"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.h",
"libcef/browser/x509_cert_principal_impl.cc",
@@ -848,6 +850,7 @@ static_library("libcef_static") {
"//components/content_settings/core/browser",
"//components/content_settings/core/common",
"//components/crx_file",
"//components/data_use_measurement/core",
"//components/google/core/common",
"//components/keyed_service/content:content",
"//components/keyed_service/core:core",
@@ -942,6 +945,10 @@ static_library("libcef_static") {
"libcef/browser/native/native_menu_win.h",
"libcef/browser/osr/browser_platform_delegate_osr_win.cc",
"libcef/browser/osr/browser_platform_delegate_osr_win.h",
# Part of //chrome/utility.
"//chrome/utility/printing_handler.cc",
"//chrome/utility/printing_handler.h",
]
deps += [
@@ -1330,7 +1337,7 @@ grit("cef_strings") {
outputs = [
"grit/cef_strings.h",
]
all_locales = platform_pak_locales + [ "fake-bidi" ]
all_locales = locales + [ "fake-bidi" ]
foreach(locale, all_locales) {
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/component_extension_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/components/grit/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:resources",
"//chrome/browser/resources:component_extension_resources",
"//chrome/browser/resources/pdf:resources",
"//chrome/common:resources",
"//chrome/renderer: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/extensions/strings/grit/extensions_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/ui/strings/grit/ui_strings.h",
]
@@ -1463,7 +1467,6 @@ make_pack_header("strings") {
"//extensions/strings",
"//services/strings",
"//third_party/blink/public/strings",
"//third_party/blink/public/strings:accessibility_strings",
"//ui/strings:app_locale_settings",
"//ui/strings:ui_strings",
]

View File

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

View File

@@ -1,2 +1,2 @@
#!/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
# more information.
#
# $hash=3d75809bdc9a72a0df9df727981f0796b7ddbbc8$
# $hash=872dedb7e5a2f36745446c3d0c9ad8bd5850adb7$
#
{
@@ -84,6 +84,7 @@
'include/cef_v8.h',
'include/cef_values.h',
'include/cef_waitable_event.h',
'include/cef_web_plugin.h',
'include/cef_x509_certificate.h',
'include/cef_xml_reader.h',
'include/cef_zip_reader.h',
@@ -182,6 +183,7 @@
'include/capi/cef_v8_capi.h',
'include/capi/cef_values_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_xml_reader_capi.h',
'include/capi/cef_zip_reader_capi.h',
@@ -498,6 +500,12 @@
'libcef_dll/ctocpp/views/view_delegate_ctocpp.h',
'libcef_dll/cpptoc/waitable_event_cpptoc.cc',
'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.h',
'libcef_dll/ctocpp/views/window_delegate_ctocpp.cc',
@@ -802,6 +810,12 @@
'libcef_dll/cpptoc/views/view_delegate_cpptoc.h',
'libcef_dll/ctocpp/waitable_event_ctocpp.cc',
'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.h',
'libcef_dll/cpptoc/views/window_delegate_cpptoc.cc',

View File

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

View File

@@ -32,7 +32,12 @@
#define CEF_INCLUDE_BASE_CEF_COMPILER_SPECIFIC_H_
#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.
#include "base/compiler_specific.h"
#else // !USING_CHROMIUM_INCLUDES
@@ -71,6 +76,23 @@
#define __has_attribute(x) 0
#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.
// Use like:
// NOINLINE void DoStuff() { ... }
@@ -131,6 +153,17 @@
#define ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment)))
#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
// 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
@@ -387,25 +420,4 @@ inline constexpr bool AnalyzerAssumeTrue(bool arg) {
#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_

View File

@@ -32,7 +32,11 @@
#define CEF_INCLUDE_BASE_CEF_MACROS_H_
#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.
// If the Chromium implementation diverges the below implementation should be
// updated to match.
@@ -58,6 +62,17 @@
TypeName() = delete; \
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 // CEF_INCLUDE_BASE_CEF_MACROS_H_

View File

@@ -113,7 +113,7 @@ template <typename T>
struct SupportsToString<T, decltype(void(std::declval<T>().ToString()))>
: 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
// templatzed iterators as input.
template <typename T, typename = void>
@@ -276,13 +276,8 @@ struct negation : bool_constant<!static_cast<bool>(B::value)> {};
// References:
// [1] https://en.cppreference.com/w/cpp/types/result_of
// [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>
using invoke_result = std::result_of<Functor && (Args && ...)>;
#endif
// 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
// more information.
//
// $hash=665709ecf3ebad59e85285d319eae72197b9766f$
// $hash=adfba3dd6479b96a95639c13ee1e07bed7b335d0$
//
#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
// 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
@@ -162,7 +162,7 @@ CEF_EXPORT void cef_shutdown(void);
// CefSettings.multi_threaded_message_loop value of false (0). This function
// 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-
@@ -172,14 +172,14 @@ CEF_EXPORT void cef_do_message_loop_work(void);
// CefSettings.multi_threaded_message_loop value of false (0). This function
// 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().
// This function should only be called on the main application thread and only
// 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
@@ -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
// 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
}

View File

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

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=ad0a78715daff99c1ec987800b7e5d62196e7100$
// $hash=8c97f9b58c642c144cc37824ad820192640307cb$
//
#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
// process UI thread when launching a render process and on the browser
// process IO thread when launching a GPU process. Provides an opportunity to
// modify the child process command line. Do not keep a reference to
// |command_line| outside of this function.
// process IO thread when launching a GPU or plugin process. Provides an
// opportunity to modify the child process command line. Do not keep a
// reference to |command_line| outside of this function.
///
void(CEF_CALLBACK* on_before_child_process_launch)(
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
// more information.
//
// $hash=3049c9960a95d32d61cc57ae998c0eba12820673$
// $hash=93f3d769c0d48ed6e1d91ad8a8e2f95d4ee54287$
//
#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.
///
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
// 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
}

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=d007b3dc26f3f049bf67623da8fae59dc75a193b$
// $hash=fd33ce439e4379d231b6be16bdc1786f314d98e4$
//
#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
// 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);
} cef_context_menu_params_t;

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=5d111a67218403f78737f2c4dc92d2fd96dc125d$
// $hash=0460e68eb7d1b1188706c42d14beafbf9a6f7126$
//
#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
// 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.

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=221973f3d5728478eeb0f8f5f55ca5e68b3afd8a$
// $hash=b6e3236a062cd25ec26c3daeb1940d1e1bf0d96a$
//
#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.
///
CEF_EXPORT cef_drag_data_t* cef_drag_data_create(void);
CEF_EXPORT cef_drag_data_t* cef_drag_data_create();
#ifdef __cplusplus
}

View File

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

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=c063e5f0e0c9fef71bdb56e7cc3ea775de17a3ea$
// $hash=b6168013910802cf6d7603892741385958026dcd$
//
#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.
///
CEF_EXPORT int cef_is_rtl(void);
CEF_EXPORT int cef_is_rtl();
#ifdef __cplusplus
}

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=bbc87eb4ecaf92c900193afef7059caedbe8ab3a$
// $hash=b5a36ef39ff250c9d3cb1e9a8c7ee38d7e0f8b3f$
//
#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
// 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
}

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=26fdd1f18f30d9e2a48aeeb5c69607d9d22d69ca$
// $hash=0939a44345bea8df7ca5f1dbd6afbe41972121f2$
//
#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)
// 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
}

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=1a9b9718367ec8d575fbb39b73b1085b17eb0a2b$
// $hash=fdbd26f9dd20dbd7813fc17a8c34650b2da19581$
//
#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.
///
CEF_EXPORT cef_print_settings_t* cef_print_settings_create(void);
CEF_EXPORT cef_print_settings_t* cef_print_settings_create();
#ifdef __cplusplus
}

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=246d07b9790ff6bd574c59b1c237c603deaf88bf$
// $hash=47b361878452f2a94e559782913d80beb0dba25a$
//
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CAPI_H_
@@ -219,7 +219,7 @@ typedef struct _cef_request_t {
///
// 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
@@ -278,7 +278,7 @@ typedef struct _cef_post_data_t {
///
// 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
@@ -344,7 +344,7 @@ typedef struct _cef_post_data_element_t {
///
// 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
}

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=dcff1eaa0563cfb48e0232bf78786bb0126c4255$
// $hash=89e64a2db658ad560e85ea5d3e564a6505d4e914$
//
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_CAPI_H_
@@ -357,7 +357,7 @@ typedef struct _cef_request_context_t {
///
// 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

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=b2657a441a701c5ddaca68dc604fd94153a3220f$
// $hash=b44d320d5cceb5022543e8154170b8d276628c76$
//
#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_request_capi.h"
#include "include/capi/cef_resource_request_handler_capi.h"
#include "include/capi/cef_web_plugin_capi.h"
#ifdef __cplusplus
extern "C" {

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=4e19e04de13949f20e63e44542bc0a0eeed46b43$
// $hash=4a05a0a7cd4a279ccf8455a3cb2f77de581b597a$
//
#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_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
// 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
// more information.
//
// $hash=6d8a7e3c0ed66cad10e8a0c59fed51431ec82ce5$
// $hash=a9e35ca17785f77666db7650208cacfd9a85c3e0$
//
#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.
///
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
}

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=ab8832420572dae95a601fb3170fcd3693473619$
// $hash=6ebf7adcdaee57772810c1528b27140ae95966d0$
//
#ifndef CEF_INCLUDE_CAPI_CEF_RESPONSE_CAPI_H_
@@ -168,7 +168,7 @@ typedef struct _cef_response_t {
///
// 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
}

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=83cbe91e85d7ab2413f733b75457ce6689d3d0ae$
// $hash=df8c46dd19ef6a3964c49d79e770de6e4245e208$
//
#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_
// handler_factories().
///
CEF_EXPORT int cef_clear_scheme_handler_factories(void);
CEF_EXPORT int cef_clear_scheme_handler_factories();
#ifdef __cplusplus
}

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=2502258e69820d070a9f094d5e587a38e96cc930$
// $hash=e943dd2af818e5a5f19f6cbd1648896684c666c6$
//
#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
// 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.

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=0a206b1c12637c8b04b2815cb3b50f212768ba01$
// $hash=a7b4410e0a35eb0aba747014665419fb6b6fcb67$
//
#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
// 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
}

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=b7dd2429f492a8f2dd978f9500c63dd0e01035d4$
// $hash=2bdcad7f8e3c03285a5e5ddb9a02a5a2182f254c$
//
#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.
///
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.
///
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.
///
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
@@ -733,12 +733,12 @@ typedef struct _cef_v8value_t {
///
// 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.
///
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.

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=ee899158c4f61cc3f85176174d6fd9cbe2a3db4c$
// $hash=c557496bdc1403b25b22ca9354a942478131c7ce$
//
#ifndef CEF_INCLUDE_CAPI_CEF_VALUES_CAPI_H_
@@ -219,7 +219,7 @@ typedef struct _cef_value_t {
///
// 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.
@@ -523,7 +523,7 @@ typedef struct _cef_dictionary_value_t {
///
// 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.
@@ -744,7 +744,7 @@ typedef struct _cef_list_value_t {
///
// 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
}

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
// more information.
//
// $hash=33a684b03178472bdf93e70043304cce8bc32d05$
// $hash=d70d5b74890e3ca91f01333ebdb4f3298caeb619$
//
#ifndef CEF_INCLUDE_CAPI_TEST_CEF_TRANSLATOR_TEST_CAPI_H_
@@ -530,7 +530,7 @@ typedef struct _cef_translator_test_t {
///
// 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.

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=5e383d792ce9dc1809d3d3fdeabb9c60fb9ff1ba$
// $hash=2fd0db428ce5902d59a7802c901e1c13b2367b5a$
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_DISPLAY_CAPI_H_
@@ -108,7 +108,7 @@ typedef struct _cef_display_t {
///
// 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
@@ -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
// 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

View File

@@ -42,13 +42,13 @@
// way that may cause binary incompatibility with other builds. The universal
// hash value will change if any platform is affected whereas the platform hash
// 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)
#define CEF_API_HASH_PLATFORM "cb1d823e15caa7e7b6074e3e612d111145b374d1"
#define CEF_API_HASH_PLATFORM "cb4f19f13d7a944d1cd0ea6fa3a5129d356cd9d5"
#elif defined(OS_MAC)
#define CEF_API_HASH_PLATFORM "7e3a768a3b73a514763ce9902afb85775ca8c83d"
#define CEF_API_HASH_PLATFORM "6c37c43a7f7d206a54297068fcbe3ca4905a17cb"
#elif defined(OS_LINUX)
#define CEF_API_HASH_PLATFORM "bc9260335c9493beb100645dbccd587e62925b9e"
#define CEF_API_HASH_PLATFORM "3572e1eca7185fdcdcff550f7b1759f4647e3e04"
#endif
#ifdef __cplusplus

View File

@@ -479,16 +479,19 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
CefRefPtr<CefPdfPrintCallback> callback) = 0;
///
// Search for |searchText|. |forward| indicates whether to search forward or
// backward within the page. |matchCase| indicates whether the search should
// be case-sensitive. |findNext| indicates whether this is the first request
// or a follow-up. The search will be restarted if |searchText| or |matchCase|
// change. The search will be stopped if |searchText| is empty. The
// CefFindHandler instance, if any, returned via CefClient::GetFindHandler
// will be called to report find results.
// Search for |searchText|. |identifier| must be a unique ID and these IDs
// must strictly increase so that newer requests always have greater IDs than
// older requests. If |identifier| is zero or less than the previous ID value
// then it will be automatically assigned a new valid ID. |forward| indicates
// whether to search forward or backward within the page. |matchCase|
// indicates whether the search should be case-sensitive. |findNext| indicates
// 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()--*/
virtual void Find(const CefString& searchText,
virtual void Find(int identifier,
const CefString& searchText,
bool forward,
bool matchCase,
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
// process UI thread when launching a render process and on the browser
// process IO thread when launching a GPU process. Provides an opportunity to
// modify the child process command line. Do not keep a reference to
// |command_line| outside of this method.
// process IO thread when launching a GPU or plugin process. Provides an
// opportunity to modify the child process command line. Do not keep a
// reference to |command_line| outside of this method.
///
/*--cef()--*/
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
// process.
// process (for example, plugin placeholder or pepper plugin menu items).
///
/*--cef()--*/
virtual bool IsCustomMenu() = 0;

View File

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

View File

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

View File

@@ -228,6 +228,14 @@ class CefRequestHandler : public virtual CefBaseRefCounted {
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
// with |browser| is ready to receive/handle IPC messages in the render

View File

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

View File

@@ -39,26 +39,26 @@
extern "C" {
#endif
// The sandbox is used to restrict sub-processes (renderer, GPU, etc) from
// directly accessing system resources. This helps to protect the user from
// untrusted and potentially malicious Web content. See
// http://www.chromium.org/developers/design-documents/sandbox for complete
// details.
// The sandbox is used to restrict sub-processes (renderer, plugin, GPU, etc)
// from directly accessing system resources. This helps to protect the user
// from untrusted and potentially malicious Web content.
// See http://www.chromium.org/developers/design-documents/sandbox for
// complete details.
//
// 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.
// 2. Link the executable with the cef_sandbox static library.
// 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
// CefExecuteProcess() and CefInitialize() functions via the
// CefExecutProcess() and CefInitialize() functions via the
// |windows_sandbox_info| parameter.
///
// 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
// 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.

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.
///
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

View File

@@ -46,7 +46,7 @@ typedef void* cef_string_list_t;
///
// 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.

View File

@@ -46,7 +46,7 @@ typedef void* cef_string_map_t;
///
// 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.

View File

@@ -47,7 +47,7 @@ typedef void* cef_string_multimap_t;
///
// 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.

View File

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

View File

@@ -584,16 +584,10 @@ class CefStringBase {
return NULL;
userfree_struct_type str = traits::userfree_alloc();
if (owner_) {
// 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);
}
memcpy(str, string_, sizeof(struct_type));
// Free this class' structure but not the data.
memset(string_, 0, sizeof(struct_type));
ClearAndFree();
return str;

View File

@@ -55,7 +55,7 @@ typedef pid_t cef_platform_thread_id_t;
///
// 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)
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.
///
CEF_EXPORT cef_platform_thread_handle_t
cef_get_current_platform_thread_handle(void);
cef_get_current_platform_thread_handle();
#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
// 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
// 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
// specified port. Also configurable using the "remote-debugging-port"
// command-line switch. Remote debugging can be accessed by loading the
// chrome://inspect page in Google Chrome. Port numbers 9222 and 9229 are
// discoverable by default. Other port numbers may need to be configured via
// "Discover network targets" on the Devices tab.
// specified port. For example, if 8080 is specified the remote debugging URL
// will be http://localhost:8080. CEF can be remotely debugged from any CEF or
// Chrome browser window. Also configurable using the "remote-debugging-port"
// command-line switch.
///
int remote_debugging_port;
@@ -577,6 +576,12 @@ typedef struct _cef_browser_settings_t {
///
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
// will still be rendered if requested. Also configurable using the
@@ -2466,6 +2471,32 @@ typedef enum {
SCALE_FACTOR_300P,
} 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.
// 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.
///
#if defined(CEF_X11)
CEF_EXPORT XDisplay* cef_get_xdisplay(void);
CEF_EXPORT XDisplay* cef_get_xdisplay();
#endif
///

View File

@@ -704,6 +704,7 @@ struct CefBrowserSettingsTraits {
target->javascript_close_windows = src->javascript_close_windows;
target->javascript_access_clipboard = src->javascript_access_clipboard;
target->javascript_dom_paste = src->javascript_dom_paste;
target->plugins = src->plugins;
target->image_loading = src->image_loading;
target->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)
// on success and false (0) on failure.
///
int cef_unload_library(void);
int cef_unload_library();
#ifdef __cplusplus
}

View File

@@ -78,7 +78,7 @@
// with an error code of -1.
//
// 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:
//
// A. The query is canceled in JavaScript using the |window.cefQueryCancel|

View File

@@ -9,7 +9,6 @@
#include <utility>
#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/browser_context.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 matchCase,
bool findNext) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::BindOnce(&AlloyBrowserHostImpl::Find, this, searchText,
forward, matchCase, findNext));
base::BindOnce(&AlloyBrowserHostImpl::Find, this, identifier,
searchText, forward, matchCase, findNext));
return;
}
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() {
#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()) {
CEF_POST_TASK(
CEF_UIT,
@@ -859,21 +860,13 @@ void AlloyBrowserHostImpl::FindReply(content::WebContents* web_contents,
const gfx::Rect& selection_rect,
int active_match_ordinal,
bool final_update) {
auto alloy_delegate =
static_cast<CefBrowserPlatformDelegateAlloy*>(platform_delegate());
if (alloy_delegate->HandleFindReply(request_id, number_of_matches,
selection_rect, active_match_ordinal,
final_update)) {
if (client_) {
if (auto handler = client_->GetFindHandler()) {
const auto& details = alloy_delegate->last_search_result();
CefRect rect(details.selection_rect().x(), details.selection_rect().y(),
details.selection_rect().width(),
details.selection_rect().height());
handler->OnFindResult(
this, details.request_id(), details.number_of_matches(), rect,
details.active_match_ordinal(), details.final_update());
}
if (client_.get()) {
CefRefPtr<CefFindHandler> handler = client_->GetFindHandler();
if (handler.get()) {
CefRect rect(selection_rect.x(), selection_rect.y(),
selection_rect.width(), selection_rect.height());
handler->OnFindResult(this, request_id, number_of_matches, rect,
active_match_ordinal, final_update);
}
}
}
@@ -1360,7 +1353,7 @@ bool AlloyBrowserHostImpl::HandleContextMenu(
void AlloyBrowserHostImpl::UpdatePreferredSize(content::WebContents* source,
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();
if (platform_delegate_)
platform_delegate_->SizeTo(pref_size.width(), pref_size.height());
@@ -1456,13 +1449,15 @@ bool AlloyBrowserHostImpl::IsNeverComposited(
}
content::PictureInPictureResult AlloyBrowserHostImpl::EnterPictureInPicture(
content::WebContents* web_contents) {
content::WebContents* web_contents,
const viz::SurfaceId& surface_id,
const gfx::Size& natural_size) {
if (!IsPictureInPictureSupported()) {
return content::PictureInPictureResult::kNotSupported;
}
return PictureInPictureWindowManager::GetInstance()
->EnterVideoPictureInPicture(web_contents);
return PictureInPictureWindowManager::GetInstance()->EnterPictureInPicture(
web_contents, surface_id, natural_size);
}
void AlloyBrowserHostImpl::ExitPictureInPicture() {
@@ -1475,8 +1470,7 @@ bool AlloyBrowserHostImpl::IsBackForwardCacheSupported() {
return false;
}
bool AlloyBrowserHostImpl::IsPrerender2Supported(
content::WebContents& web_contents) {
bool AlloyBrowserHostImpl::IsPrerender2Supported() {
return true;
}

View File

@@ -94,7 +94,8 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
void PrintToPDF(const CefString& path,
const CefPdfPrintSettings& settings,
CefRefPtr<CefPdfPrintCallback> callback) override;
void Find(const CefString& searchText,
void Find(int identifier,
const CefString& searchText,
bool forward,
bool matchCase,
bool findNext) override;
@@ -283,10 +284,12 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
blink::mojom::MediaStreamType type) override;
bool IsNeverComposited(content::WebContents* web_contents) override;
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;
bool IsBackForwardCacheSupported() override;
bool IsPrerender2Supported(content::WebContents& web_contents) override;
bool IsPrerender2Supported() override;
// content::WebContentsObserver methods.
using content::WebContentsObserver::BeforeUnloadFired;

View File

@@ -39,7 +39,7 @@
#include "third_party/widevine/cdm/buildflags.h"
#include "ui/base/resource/resource_bundle.h"
#if BUILDFLAG(IS_LINUX)
#if defined(OS_LINUX)
#include "ui/ozone/buildflags.h"
#if defined(USE_AURA) && BUILDFLAG(OZONE_PLATFORM_X11)
#include "ui/events/devices/x11/touch_factory_x11.h"
@@ -52,14 +52,15 @@
#include "ui/views/widget/desktop_aura/desktop_screen.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/win/parental_controls.h"
#include "components/os_crypt/os_crypt.h"
#endif
#endif // defined(USE_AURA)
#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_views_delegate.h"
#else
@@ -67,22 +68,13 @@
#endif
#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"
#endif
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_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"
#if defined(OS_LINUX)
#include "libcef/browser/printing/print_dialog_linux.h"
#include "ui/base/l10n/l10n_util.h"
#endif // BUILDFLAG(IS_LINUX)
#endif
#if BUILDFLAG(ENABLE_MEDIA_FOUNDATION_WIDEVINE_CDM)
#include "chrome/browser/component_updater/media_foundation_widevine_cdm_component_installer.h"
@@ -101,7 +93,7 @@ AlloyBrowserMainParts::~AlloyBrowserMainParts() {
}
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
// views::LinuxUI::SetInstance.
ui::InitializeInputMethodForTesting();
@@ -119,7 +111,7 @@ void AlloyBrowserMainParts::ToolkitInitialized() {
#endif // defined(USE_AURA)
#if defined(TOOLKIT_VIEWS)
#if BUILDFLAG(IS_MAC)
#if defined(OS_MAC)
views_delegate_ = std::make_unique<ChromeViewsDelegate>();
layout_provider_ = ChromeLayoutProvider::CreateLayoutProvider();
#else
@@ -129,13 +121,13 @@ void AlloyBrowserMainParts::ToolkitInitialized() {
}
void AlloyBrowserMainParts::PreCreateMainMessageLoop() {
#if BUILDFLAG(IS_LINUX)
#if defined(OS_LINUX)
#if defined(USE_AURA) && BUILDFLAG(OZONE_PLATFORM_X11)
ui::TouchFactory::SetTouchDeviceListFromCommandLine();
#endif
#endif
#if BUILDFLAG(IS_WIN)
#if defined(OS_WIN)
// Initialize the OSCrypt.
PrefService* local_state = g_browser_process->local_state();
DCHECK(local_state);
@@ -145,44 +137,22 @@ void AlloyBrowserMainParts::PreCreateMainMessageLoop() {
// installer_util references strings that are normally compiled into
// setup.exe. In Chrome, these strings are in the locale files.
ChromeBrowserMainPartsWin::SetupInstallerUtilStrings();
#endif // BUILDFLAG(IS_WIN)
#endif // defined(OS_WIN)
media_router::ChromeMediaRouterFactory::DoPlatformInit();
}
void AlloyBrowserMainParts::PostCreateMainMessageLoop() {
#if BUILDFLAG(IS_LINUX)
#if defined(OS_LINUX)
printing::PrintingContextLinux::SetCreatePrintDialogFunction(
&CefPrintDialogLinux::CreatePrintDialog);
printing::PrintingContextLinux::SetPdfPaperSizeFunction(
&CefPrintDialogLinux::GetPdfPaperSize);
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)
#endif
}
int AlloyBrowserMainParts::PreCreateThreads() {
#if BUILDFLAG(IS_WIN)
#if defined(OS_WIN)
PlatformInitialize();
#endif
@@ -235,7 +205,7 @@ int AlloyBrowserMainParts::PreMainMessageLoopRun() {
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
// that calculates this value off of the UI thread.
InitializeWinParentalControls();
@@ -279,7 +249,7 @@ void AlloyBrowserMainParts::PostMainMessageLoopRun() {
void AlloyBrowserMainParts::PostDestroyThreads() {
#if defined(TOOLKIT_VIEWS)
views_delegate_.reset();
#if BUILDFLAG(IS_MAC)
#if defined(OS_MAC)
layout_provider_.reset();
#endif
#endif // defined(TOOLKIT_VIEWS)

View File

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

View File

@@ -5,7 +5,6 @@
#include "libcef/browser/alloy/alloy_content_browser_client.h"
#include <algorithm>
#include <tuple>
#include <utility>
#include "include/cef_version.h"
@@ -47,6 +46,7 @@
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/ignore_result.h"
#include "base/json/json_reader.h"
#include "base/path_service.h"
#include "base/stl_util.h"
@@ -108,14 +108,13 @@
#include "content/public/common/storage_quota_params.h"
#include "content/public/common/url_constants.h"
#include "content/public/common/user_agent.h"
#include "crypto/crypto_buildflags.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_message_filter.h"
#include "extensions/browser/extension_protocols.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_web_contents_observer.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/info_map.h"
#include "extensions/browser/process_map.h"
@@ -143,7 +142,7 @@
#include "ui/base/ui_base_switches.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 "chrome/common/chrome_paths.h"
#include "components/crash/content/browser/crash_handler_host_linux.h"
@@ -151,17 +150,17 @@
#include "content/public/common/content_descriptors.h"
#endif
#if BUILDFLAG(IS_MAC)
#if defined(OS_MAC)
#include "net/ssl/client_cert_store_mac.h"
#include "services/video_capture/public/mojom/constants.mojom.h"
#endif
#if BUILDFLAG(IS_WIN)
#if defined(OS_WIN)
#include "net/ssl/client_cert_store_win.h"
#include "sandbox/win/src/sandbox_policy.h"
#endif
#if BUILDFLAG(USE_NSS_CERTS)
#if defined(USE_NSS_CERTS)
#include "net/ssl/client_cert_store_nss.h"
#endif
@@ -197,7 +196,7 @@ class CefQuotaCallbackImpl : public CefCallback {
void Cancel() override { ContinueNow(false); }
[[nodiscard]] CallbackType Disconnect() { return std::move(callback_); }
CallbackType Disconnect() WARN_UNUSED_RESULT { return std::move(callback_); }
private:
void ContinueNow(bool allow) {
@@ -255,7 +254,7 @@ class CefAllowCertificateErrorCallbackImpl : public CefCallback {
void Cancel() override { ContinueNow(false); }
[[nodiscard]] CallbackType Disconnect() { return std::move(callback_); }
CallbackType Disconnect() WARN_UNUSED_RESULT { return std::move(callback_); }
private:
void ContinueNow(bool allow) {
@@ -408,7 +407,7 @@ class CefQuotaPermissionContext : public content::QuotaPermissionContext {
~CefQuotaPermissionContext() override = default;
};
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
#if defined(OS_POSIX) && !defined(OS_MAC)
breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost(
const std::string& process_type) {
base::FilePath dumps_path;
@@ -463,7 +462,7 @@ int GetCrashSignalFD(const base::CommandLine& command_line) {
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.
void BindPluginInfoHost(
@@ -521,6 +520,8 @@ void AlloyContentBrowserClient::RenderProcessWillLaunch(
if (extensions::ExtensionsEnabled()) {
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
@@ -575,6 +576,18 @@ bool AlloyContentBrowserClient::DoesSiteRequireDedicatedProcess(
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(
base::StringPiece scheme,
bool is_embedded_origin_secure) {
@@ -631,7 +644,6 @@ void AlloyContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem(
additional_allowed_schemes);
additional_allowed_schemes->push_back(content::kChromeDevToolsScheme);
additional_allowed_schemes->push_back(content::kChromeUIScheme);
additional_allowed_schemes->push_back(content::kChromeUIUntrustedScheme);
}
bool AlloyContentBrowserClient::IsWebUIAllowedToMakeNetworkRequests(
@@ -728,7 +740,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
// associated values) if present in the browser command line.
static const char* const kSwitchNames[] = {
switches::kDisablePackLoading,
#if BUILDFLAG(IS_MAC)
#if defined(OS_MAC)
switches::kFrameworkDirPath,
switches::kMainBundlePath,
#endif
@@ -750,6 +762,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
static const char* const kSwitchNames[] = {
switches::kDisableExtensions,
switches::kDisablePdfExtension,
switches::kDisablePlugins,
switches::kDisablePrintPreview,
switches::kDisableScrollBounce,
switches::kDisableSpellChecking,
@@ -763,6 +776,14 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
if (extensions::ExtensionsEnabled()) {
content::RenderProcessHost* process =
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();
CefBrowserContext* cef_browser_context =
process ? CefBrowserContext::FromBrowserContext(browser_context)
@@ -797,7 +818,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir);
}
#if BUILDFLAG(IS_LINUX)
#if defined(OS_LINUX)
if (process_type == switches::kZygoteProcess) {
if (browser_cmd->HasSwitch(switches::kBrowserSubprocessPath)) {
// 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,
base::size(kSwitchNames));
}
#endif // BUILDFLAG(IS_LINUX)
#endif // defined(OS_LINUX)
CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication();
if (app.get()) {
@@ -825,7 +846,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
CefRefPtr<CefCommandLineImpl> commandLinePtr(
new CefCommandLineImpl(command_line, false, false));
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>();
}
void AlloyContentBrowserClient::
RegisterAssociatedInterfaceBindersForRenderFrameHost(
content::RenderFrameHost& render_frame_host,
blink::AssociatedInterfaceRegistry& associated_registry) {
associated_registry.AddInterface(base::BindRepeating(
[](content::RenderFrameHost* render_frame_host,
mojo::PendingAssociatedReceiver<extensions::mojom::LocalFrameHost>
receiver) {
extensions::ExtensionWebContentsObserver::BindLocalFrameHost(
std::move(receiver), render_frame_host);
},
&render_frame_host));
bool AlloyContentBrowserClient::BindAssociatedReceiverFromFrame(
content::RenderFrameHost* render_frame_host,
const std::string& interface_name,
mojo::ScopedInterfaceEndpointHandle* handle) {
if (interface_name == extensions::mojom::LocalFrameHost::Name_) {
extensions::ExtensionWebContentsObserver::BindLocalFrameHost(
mojo::PendingAssociatedReceiver<extensions::mojom::LocalFrameHost>(
std::move(*handle)),
render_frame_host);
return true;
}
if (interface_name == printing::mojom::PrintManagerHost::Name_) {
printing::CefPrintViewManager::BindPrintManagerHost(
mojo::PendingAssociatedReceiver<printing::mojom::PrintManagerHost>(
std::move(*handle)),
render_frame_host);
return true;
}
if (interface_name == pdf::mojom::PdfService::Name_) {
pdf::PDFWebContentsHelper::BindPdfService(
mojo::PendingAssociatedReceiver<pdf::mojom::PdfService>(
std::move(*handle)),
render_frame_host);
return true;
}
associated_registry.AddInterface(base::BindRepeating(
[](content::RenderFrameHost* render_frame_host,
mojo::PendingAssociatedReceiver<printing::mojom::PrintManagerHost>
receiver) {
printing::CefPrintViewManager::BindPrintManagerHost(std::move(receiver),
render_frame_host);
},
&render_frame_host));
associated_registry.AddInterface(base::BindRepeating(
[](content::RenderFrameHost* render_frame_host,
mojo::PendingAssociatedReceiver<pdf::mojom::PdfService> receiver) {
pdf::PDFWebContentsHelper::BindPdfService(std::move(receiver),
render_frame_host);
},
&render_frame_host));
return false;
}
std::vector<std::unique_ptr<content::NavigationThrottle>>
@@ -1132,7 +1151,7 @@ AlloyContentBrowserClient::WillCreateURLLoaderRequestInterceptors(
return interceptors;
}
#if BUILDFLAG(IS_LINUX)
#if defined(OS_LINUX)
void AlloyContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line,
int child_process_id,
@@ -1142,7 +1161,7 @@ void AlloyContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
mappings->Share(kCrashDumpSignal, crash_signal_fd);
}
}
#endif // BUILDFLAG(IS_LINUX)
#endif // defined(OS_LINUX)
void AlloyContentBrowserClient::ExposeInterfacesToRenderer(
service_manager::BinderRegistry* registry,
@@ -1154,10 +1173,6 @@ void AlloyContentBrowserClient::ExposeInterfacesToRenderer(
if (extensions::ExtensionsEnabled()) {
associated_registry->AddInterface(base::BindRepeating(
&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,
@@ -1168,13 +1183,13 @@ std::unique_ptr<net::ClientCertStore>
AlloyContentBrowserClient::CreateClientCertStore(
content::BrowserContext* browser_context) {
// 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.
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS(
net::ClientCertStoreNSS::PasswordDelegateFactory()));
#elif BUILDFLAG(IS_WIN)
#elif defined(OS_WIN)
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());
#else
#error Unknown platform.
@@ -1215,7 +1230,6 @@ void AlloyContentBrowserClient::RegisterNonNetworkNavigationURLLoaderFactories(
void AlloyContentBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories(
int render_process_id,
int render_frame_id,
const absl::optional<url::Origin>& request_initiator_origin,
NonNetworkURLLoaderFactoryMap* factories) {
if (!extensions::ExtensionsEnabled())
return;
@@ -1371,7 +1385,6 @@ bool AlloyContentBrowserClient::HandleExternalProtocol(
ui::PageTransition page_transition,
bool has_user_gesture,
const absl::optional<url::Origin>& initiating_origin,
content::RenderFrameHost* initiator_document,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
// Call the other HandleExternalProtocol variant.
return false;
@@ -1383,8 +1396,6 @@ bool AlloyContentBrowserClient::HandleExternalProtocol(
content::NavigationUIData* navigation_data,
network::mojom::WebSandboxFlags sandbox_flags,
const network::ResourceRequest& resource_request,
const absl::optional<url::Origin>& initiating_origin,
content::RenderFrameHost* initiator_document,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver =
out_factory->InitWithNewPipeAndPassReceiver();
@@ -1400,29 +1411,19 @@ bool AlloyContentBrowserClient::HandleExternalProtocol(
web_contents_getter, std::move(receiver), std::move(request_handler));
return true;
}
std::unique_ptr<content::VideoOverlayWindow>
AlloyContentBrowserClient::CreateWindowForVideoPictureInPicture(
content::VideoPictureInPictureWindowController* controller) {
// Note: content::VideoOverlayWindow::Create() is defined by platform-specific
std::unique_ptr<content::OverlayWindow>
AlloyContentBrowserClient::CreateWindowForPictureInPicture(
content::PictureInPictureWindowController* controller) {
// Note: content::OverlayWindow::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::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(
content::RenderFrameHost* render_frame_host,
mojo::BinderMapWithContext<content::RenderFrameHost*>* map) {
@@ -1470,10 +1471,6 @@ std::string AlloyContentBrowserClient::GetUserAgent() {
return embedder_support::GetUserAgent();
}
std::string AlloyContentBrowserClient::GetFullUserAgent() {
return embedder_support::GetFullUserAgent();
}
std::string AlloyContentBrowserClient::GetReducedUserAgent() {
return embedder_support::GetReducedUserAgent();
}

View File

@@ -43,6 +43,8 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
const GURL& site_url) override;
bool DoesSiteRequireDedicatedProcess(content::BrowserContext* browser_context,
const GURL& effective_site_url) override;
bool ShouldLockProcessToSite(content::BrowserContext* browser_context,
const GURL& effective_site_url) override;
bool ShouldTreatURLSchemeAsFirstPartyWhenTopLevel(
base::StringPiece scheme,
bool is_embedded_origin_secure) override;
@@ -117,9 +119,10 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
std::unique_ptr<content::DevToolsManagerDelegate>
CreateDevToolsManagerDelegate() override;
void RegisterAssociatedInterfaceBindersForRenderFrameHost(
content::RenderFrameHost& render_frame_host,
blink::AssociatedInterfaceRegistry& associated_registry) override;
bool BindAssociatedReceiverFromFrame(
content::RenderFrameHost* render_frame_host,
const std::string& interface_name,
mojo::ScopedInterfaceEndpointHandle* handle) override;
std::vector<std::unique_ptr<content::NavigationThrottle>>
CreateThrottlesForNavigation(
content::NavigationHandle* navigation_handle) override;
@@ -137,7 +140,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
const scoped_refptr<network::SharedURLLoaderFactory>&
network_loader_factory) override;
#if BUILDFLAG(IS_LINUX)
#if defined(OS_LINUX)
void GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line,
int child_process_id,
@@ -166,7 +169,6 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
void RegisterNonNetworkSubresourceURLLoaderFactories(
int render_process_id,
int render_frame_id,
const absl::optional<url::Origin>& request_initiator_origin,
NonNetworkURLLoaderFactoryMap* factories) override;
bool WillCreateURLLoaderFactory(
content::BrowserContext* browser_context,
@@ -203,7 +205,6 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
ui::PageTransition page_transition,
bool has_user_gesture,
const absl::optional<url::Origin>& initiating_origin,
content::RenderFrameHost* initiator_document,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
override;
bool HandleExternalProtocol(
@@ -212,16 +213,10 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
content::NavigationUIData* navigation_data,
network::mojom::WebSandboxFlags sandbox_flags,
const network::ResourceRequest& request,
const absl::optional<url::Origin>& initiating_origin,
content::RenderFrameHost* initiator_document,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
override;
std::unique_ptr<content::VideoOverlayWindow>
CreateWindowForVideoPictureInPicture(
content::VideoPictureInPictureWindowController* controller) override;
std::unique_ptr<content::DocumentOverlayWindow>
CreateWindowForDocumentPictureInPicture(
content::DocumentPictureInPictureWindowController* controller) override;
std::unique_ptr<content::OverlayWindow> CreateWindowForPictureInPicture(
content::PictureInPictureWindowController* controller) override;
void RegisterBrowserInterfaceBindersForFrame(
content::RenderFrameHost* render_frame_host,
mojo::BinderMapWithContext<content::RenderFrameHost*>* map) override;
@@ -229,7 +224,6 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
std::string GetProduct() override;
std::string GetChromeProduct() override;
std::string GetUserAgent() override;
std::string GetFullUserAgent() override;
std::string GetReducedUserAgent() override;
blink::UserAgentMetadata GetUserAgentMetadata() override;
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_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"
@@ -15,12 +13,9 @@ namespace alloy {
void RunFileChooser(content::WebContents* web_contents,
const blink::mojom::FileChooserParams& params,
RunFileChooserCallback callback) {
CefRefPtr<AlloyBrowserHostImpl> browser = static_cast<AlloyBrowserHostImpl*>(
extensions::GetOwnerBrowserForHost(web_contents->GetRenderViewHost(),
nullptr)
.get());
CefRefPtr<AlloyBrowserHostImpl> browser =
AlloyBrowserHostImpl::GetBrowserForContents(web_contents);
if (!browser) {
LOG(ERROR) << "Failed to identify browser; canceling file dialog";
std::move(callback).Run(-1, {});
return;
}
@@ -36,9 +31,9 @@ void RunFileChooser(content::WebContents* web_contents,
// Based on net/base/filename_util_internal.cc FilePathToString16().
std::u16string FilePathTypeToString16(const base::FilePath::StringType& str) {
std::u16string result;
#if BUILDFLAG(IS_WIN)
#if defined(OS_WIN)
result.assign(str.begin(), str.end());
#elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
#elif defined(OS_POSIX) || defined(OS_FUCHSIA)
if (!str.empty()) {
base::UTF8ToUTF16(str.c_str(), str.size(), &result);
}

View File

@@ -17,17 +17,13 @@
#include "base/logging.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 "components/find_in_page/find_tab_helper.h"
#include "components/find_in_page/find_types.h"
#include "components/zoom/zoom_controller.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "extensions/browser/process_manager.h"
#include "pdf/pdf_features.h"
#include "printing/mojom/print.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,
bool owned) {
CefBrowserPlatformDelegate::WebContentsCreated(web_contents, owned);
find_in_page::FindTabHelper::CreateForWebContents(web_contents);
if (owned) {
SetOwnedWebContents(web_contents);
@@ -259,13 +254,16 @@ void CefBrowserPlatformDelegateAlloy::SendCaptureLostEvent() {
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() {
if (!web_contents_)
if (!browser_)
return;
// Dismiss any existing popups.
web_contents_->ClearFocusedElement();
auto frame = browser_->GetMainFrame();
if (frame && frame->IsValid()) {
static_cast<CefFrameHostImpl*>(frame.get())->NotifyMoveOrResizeStarted();
}
}
#endif
@@ -340,30 +338,33 @@ void CefBrowserPlatformDelegateAlloy::SetAccessibilityState(
bool CefBrowserPlatformDelegateAlloy::IsPrintPreviewSupported() const {
REQUIRE_ALLOY_RUNTIME();
// Print preview is not currently supported with OSR.
if (IsWindowless())
auto actionable_contents = GetActionableWebContents();
if (!actionable_contents)
return false;
auto cef_browser_context =
CefBrowserContext::FromBrowserContext(web_contents_->GetBrowserContext());
return cef_browser_context->IsPrintPreviewSupported();
auto cef_browser_context = CefBrowserContext::FromBrowserContext(
actionable_contents->GetBrowserContext());
if (!cef_browser_context->IsPrintPreviewSupported()) {
return false;
}
// Print preview is not currently supported with OSR.
return !IsWindowless();
}
void CefBrowserPlatformDelegateAlloy::Print() {
REQUIRE_ALLOY_RUNTIME();
auto contents_to_use = printing::GetWebContentsToUse(web_contents_);
if (!contents_to_use)
auto actionable_contents = GetActionableWebContents();
if (!actionable_contents)
return;
auto rfh_to_use = printing::GetRenderFrameHostToUse(contents_to_use);
if (!rfh_to_use)
return;
auto rfh = actionable_contents->GetMainFrame();
if (IsPrintPreviewSupported()) {
GetPrintViewManager(contents_to_use)->PrintPreviewNow(rfh_to_use, false);
GetPrintViewManager(actionable_contents)->PrintPreviewNow(rfh, false);
} else {
GetPrintViewManager(contents_to_use)->PrintNow(rfh_to_use);
GetPrintViewManager(actionable_contents)->PrintNow(rfh);
}
}
@@ -373,65 +374,50 @@ void CefBrowserPlatformDelegateAlloy::PrintToPDF(
CefRefPtr<CefPdfPrintCallback> callback) {
REQUIRE_ALLOY_RUNTIME();
auto contents_to_use = printing::GetWebContentsToUse(web_contents_);
if (!contents_to_use)
content::WebContents* actionable_contents = GetActionableWebContents();
if (!actionable_contents)
return;
auto rfh_to_use = printing::GetRenderFrameHostToUse(contents_to_use);
if (!rfh_to_use)
return;
printing::CefPrintViewManager::PdfPrintCallback pdf_callback;
if (callback.get()) {
pdf_callback = base::BindOnce(&CefPdfPrintCallback::OnPdfPrintFinished,
callback.get(), path);
}
GetPrintViewManager(contents_to_use)
->PrintToPDF(rfh_to_use, base::FilePath(path), settings,
std::move(pdf_callback));
GetPrintViewManager(actionable_contents)
->PrintToPDF(actionable_contents->GetMainFrame(), base::FilePath(path),
settings, std::move(pdf_callback));
}
void CefBrowserPlatformDelegateAlloy::Find(const CefString& searchText,
void CefBrowserPlatformDelegateAlloy::Find(int identifier,
const CefString& searchText,
bool forward,
bool matchCase,
bool findNext) {
if (!web_contents_)
return;
find_in_page::FindTabHelper::FromWebContents(web_contents_)
->StartFinding(searchText.ToString16(), forward, matchCase, findNext,
/*run_synchronously_for_testing=*/false);
// Every find request must have a unique ID and these IDs must strictly
// increase so that newer requests always have greater IDs than older
// 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) {
if (!web_contents_)
return;
last_search_result_ = find_in_page::FindNotificationDetails();
find_in_page::FindTabHelper::FromWebContents(web_contents_)
->StopFinding(clearSelection ? find_in_page::SelectionAction::kClear
: find_in_page::SelectionAction::kKeep);
}
bool CefBrowserPlatformDelegateAlloy::HandleFindReply(
int request_id,
int number_of_matches,
const gfx::Rect& selection_rect,
int active_match_ordinal,
bool final_update) {
if (!web_contents_)
return false;
auto find_in_page =
find_in_page::FindTabHelper::FromWebContents(web_contents_);
find_in_page->HandleFindReply(request_id, number_of_matches, selection_rect,
active_match_ordinal, final_update);
if (!(find_in_page->find_result() == last_search_result_)) {
last_search_result_ = find_in_page->find_result();
return true;
}
return false;
content::StopFindAction action =
clearSelection ? content::STOP_FIND_ACTION_CLEAR_SELECTION
: content::STOP_FIND_ACTION_KEEP_SELECTION;
web_contents_->StopFinding(action);
}
base::RepeatingClosure
@@ -443,6 +429,17 @@ CefBrowserPlatformDelegateAlloy::GetBoundsChangedCallback() {
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(
content::WebContents* owned_contents) {
DCHECK(primary_);

View File

@@ -10,7 +10,6 @@
#include "libcef/browser/web_contents_dialog_helper.h"
#include "base/memory/weak_ptr.h"
#include "components/find_in_page/find_notification_details.h"
#include "content/public/browser/web_contents.h"
#include "ui/gfx/geometry/size.h"
@@ -44,7 +43,7 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
extensions::ExtensionHost* GetExtensionHost() const override;
void BrowserDestroyed(CefBrowserHostBase* browser) 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;
#endif
bool PreHandleGestureEvent(content::WebContents* source,
@@ -59,28 +58,24 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
void PrintToPDF(const CefString& path,
const CefPdfPrintSettings& settings,
CefRefPtr<CefPdfPrintCallback> callback) override;
void Find(const CefString& searchText,
void Find(int identifier,
const CefString& searchText,
bool forward,
bool matchCase,
bool findNext) 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:
CefBrowserPlatformDelegateAlloy();
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().
void set_as_secondary() { primary_ = false; }
@@ -101,9 +96,8 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
// Used for the print preview dialog.
std::unique_ptr<CefWebContentsDialogHelper> web_contents_dialog_helper_;
// The last find result. This object contains details about the number of
// matches, the find selection rectangle, etc.
find_in_page::FindNotificationDetails last_search_result_;
// Used to provide unique incremental IDs for each find request.
int find_request_id_counter_ = 0;
// Used when the browser is hosting an extension.
extensions::ExtensionHost* extension_host_ = nullptr;

View File

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

View File

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

View File

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

View File

@@ -331,7 +331,8 @@ void CefBrowserContentsDelegate::OnFrameFocused(
OnStateChanged(State::kFocusedFrame);
}
void CefBrowserContentsDelegate::PrimaryMainDocumentElementAvailable() {
void CefBrowserContentsDelegate::DocumentAvailableInMainFrame(
content::RenderFrameHost* render_frame_host) {
has_document_ = true;
OnStateChanged(State::kDocument);
@@ -440,6 +441,16 @@ void CefBrowserContentsDelegate::TitleWasSet(content::NavigationEntry* entry) {
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(
content::RenderFrameHost* render_frame_host,
const std::vector<blink::mojom::FaviconURLPtr>& candidates) {

View File

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

View File

@@ -4,8 +4,6 @@
#include "libcef/browser/browser_host_base.h"
#include <tuple>
#include "libcef/browser/browser_info_manager.h"
#include "libcef/browser/browser_platform_delegate.h"
#include "libcef/browser/context.h"
@@ -15,6 +13,7 @@
#include "libcef/common/frame_util.h"
#include "libcef/common/net/url_util.h"
#include "base/ignore_result.h"
#include "base/logging.h"
#include "chrome/browser/spellchecker/spellcheck_factory.h"
#include "chrome/browser/spellchecker/spellcheck_service.h"
@@ -26,7 +25,7 @@
#include "content/public/browser/navigation_entry.h"
#include "ui/gfx/image/image_skia.h"
#if BUILDFLAG(IS_MAC)
#if defined(OS_MAC)
#include "components/spellcheck/browser/spellcheck_platform.h"
#endif
@@ -347,7 +346,7 @@ void CefBrowserHostBase::GetNavigationEntries(
CefRefPtr<CefNavigationEntryImpl> entry =
new CefNavigationEntryImpl(controller.GetEntryAtIndex(current));
visitor->Visit(entry.get(), true, current, total);
std::ignore = entry->Detach(nullptr);
ignore_result(entry->Detach(nullptr));
} else {
// Visit all entries.
bool cont = true;
@@ -355,7 +354,7 @@ void CefBrowserHostBase::GetNavigationEntries(
CefRefPtr<CefNavigationEntryImpl> entry =
new CefNavigationEntryImpl(controller.GetEntryAtIndex(i));
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)
spellcheck->GetCustomDictionary()->AddWord(word);
}
#if BUILDFLAG(IS_MAC)
#if defined(OS_MAC)
if (spellcheck && spellcheck::UseBrowserSpellChecker()) {
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);
#if BUILDFLAG(IS_WIN)
#if defined(OS_WIN)
window_info->SetAsPopup(nullptr, CefString());
#endif
@@ -154,7 +154,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
CefPopupFeatures 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.
if (cef_features.xSet)
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_for_ui.h"
#if BUILDFLAG(IS_MAC)
#if defined(OS_MAC)
#include "base/mac/scoped_nsautorelease_pool.h"
#include "base/message_loop/message_pump_mac.h"
#endif
@@ -29,7 +29,7 @@ class MessagePumpExternal : public base::MessagePumpForUI {
void Run(Delegate* delegate) override {
base::TimeTicks start = base::TimeTicks::Now();
while (true) {
#if BUILDFLAG(IS_MAC)
#if defined(OS_MAC)
base::mac::ScopedNSAutoreleasePool autorelease_pool;
#endif
@@ -108,7 +108,7 @@ std::unique_ptr<base::MessagePump> MessagePumpFactoryForUI() {
return std::make_unique<MessagePumpExternal>(0.01f, handler);
}
#if BUILDFLAG(IS_MAC)
#if defined(OS_MAC)
return base::MessagePumpMac::Create();
#else
return std::make_unique<base::MessagePumpForUI>();

View File

@@ -180,7 +180,7 @@ void CefBrowserPlatformDelegate::SendCaptureLostEvent() {
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::SizeTo(int width, int height) {}
@@ -381,7 +381,8 @@ void CefBrowserPlatformDelegate::PrintToPDF(
NOTIMPLEMENTED();
}
void CefBrowserPlatformDelegate::Find(const CefString& searchText,
void CefBrowserPlatformDelegate::Find(int identifier,
const CefString& searchText,
bool forward,
bool matchCase,
bool findNext) {

View File

@@ -234,7 +234,7 @@ class CefBrowserPlatformDelegate {
// Send capture lost event.
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
// on Windows and Linux.
virtual void NotifyMoveOrResizeStarted();
@@ -353,7 +353,8 @@ class CefBrowserPlatformDelegate {
virtual void PrintToPDF(const CefString& path,
const CefPdfPrintSettings& settings,
CefRefPtr<CefPdfPrintCallback> callback);
virtual void Find(const CefString& searchText,
virtual void Find(int identifier,
const CefString& searchText,
bool forward,
bool matchCase,
bool findNext);

View File

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

View File

@@ -8,9 +8,9 @@
#include "base/threading/thread_restrictions.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/profile_keep_alive_types.h"
#include "chrome/browser/profiles/scoped_profile_keep_alive.h"
ChromeBrowserContext::ChromeBrowserContext(
const CefRequestContextSettings& settings)

View File

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

View File

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

View File

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

View File

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

View File

@@ -5,8 +5,6 @@
#include "libcef/browser/chrome/chrome_content_browser_client_cef.h"
#include <tuple>
#include "libcef/browser/browser_frame.h"
#include "libcef/browser/browser_info_manager.h"
#include "libcef/browser/browser_manager.h"
@@ -26,6 +24,7 @@
#include "libcef/common/command_line_impl.h"
#include "base/command_line.h"
#include "base/ignore_result.h"
#include "base/path_service.h"
#include "chrome/browser/chrome_browser_main.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_widget_host.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 "third_party/blink/public/common/web_preferences/web_preferences.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,
content::NavigationUIData* navigation_data,
network::mojom::WebSandboxFlags sandbox_flags,
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;
const network::ResourceRequest& resource_request) {
// Match the logic of the original call in
// NavigationURLLoaderImpl::PrepareForNonInterceptedRequest.
self->HandleExternalProtocol(
@@ -68,7 +58,7 @@ void HandleExternalProtocolHelper(
static_cast<int>(blink::mojom::ResourceType::kMainFrame),
sandbox_flags,
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);
}
@@ -127,6 +117,16 @@ void ChromeContentBrowserClientCef::AppendExtraCommandLineSwitches(
};
command_line->CopySwitchesFrom(*browser_cmd, 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();
@@ -137,7 +137,7 @@ void ChromeContentBrowserClientCef::AppendExtraCommandLineSwitches(
CefRefPtr<CefCommandLineImpl> commandLinePtr(
new CefCommandLineImpl(command_line, false, false));
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,
bool has_user_gesture,
const absl::optional<url::Origin>& initiating_origin,
content::RenderFrameHost* initiator_document,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
// |out_factory| will be non-nullptr when this method is initially called
// from NavigationURLLoaderImpl::PrepareForNonInterceptedRequest.
@@ -271,7 +270,7 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
return ChromeContentBrowserClient::HandleExternalProtocol(
url, web_contents_getter, child_id, frame_tree_node_id, navigation_data,
is_main_frame, sandbox_flags, page_transition, has_user_gesture,
initiating_origin, initiator_document, nullptr);
initiating_origin, nullptr);
}
bool ChromeContentBrowserClientCef::HandleExternalProtocol(
@@ -280,24 +279,16 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
content::NavigationUIData* navigation_data,
network::mojom::WebSandboxFlags sandbox_flags,
const network::ResourceRequest& resource_request,
const absl::optional<url::Origin>& initiating_origin,
content::RenderFrameHost* initiator_document,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver =
out_factory->InitWithNewPipeAndPassReceiver();
auto weak_initiator_document = initiator_document
? initiator_document->GetWeakDocumentPtr()
: content::WeakDocumentPtr();
// HandleExternalProtocolHelper may be called if nothing handles the request.
auto request_handler = net_service::CreateInterceptedRequestHandler(
web_contents_getter, frame_tree_node_id, resource_request,
base::BindRepeating(HandleExternalProtocolHelper, base::Unretained(this),
web_contents_getter, frame_tree_node_id,
navigation_data, sandbox_flags, resource_request,
initiating_origin,
std::move(weak_initiator_document)));
navigation_data, sandbox_flags, resource_request));
net_service::ProxyURLLoaderFactory::CreateProxy(
web_contents_getter, std::move(receiver), std::move(request_handler));

View File

@@ -71,7 +71,6 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
ui::PageTransition page_transition,
bool has_user_gesture,
const absl::optional<url::Origin>& initiating_origin,
content::RenderFrameHost* initiator_document,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
override;
bool HandleExternalProtocol(
@@ -80,8 +79,6 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
content::NavigationUIData* navigation_data,
network::mojom::WebSandboxFlags sandbox_flags,
const network::ResourceRequest& request,
const absl::optional<url::Origin>& initiating_origin,
content::RenderFrameHost* initiator_document,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
override;
std::vector<std::unique_ptr<content::NavigationThrottle>>

View File

@@ -5,11 +5,11 @@
#include "build/build_config.h"
#if BUILDFLAG(IS_MAC)
#if defined(OS_MAC)
#include "chrome/app/chrome_crash_reporter_client.h"
// Required due to https://crrev.com/1c9f89a06f
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 "ui/base/ui_base_switches.h"
#if BUILDFLAG(IS_WIN)
#if defined(OS_WIN)
#include "base/strings/utf_string_conversions.h"
#include "chrome/chrome_elf/chrome_elf_main.h"
#include "chrome/install_static/initialize_from_primary_module.h"
@@ -38,7 +38,7 @@ class CefShutdownChecker {
} g_shutdown_checker;
#endif // DCHECK_IS_ON()
#if BUILDFLAG(IS_WIN)
#if defined(OS_WIN)
#if defined(ARCH_CPU_X86_64)
// 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
@@ -72,7 +72,7 @@ void InitCrashReporter() {
initialized = true;
SignalInitializeCrashReporting();
}
#endif // BUILDFLAG(IS_WIN)
#endif // defined(OS_WIN)
bool GetColor(const cef_color_t cef_in, bool is_windowless, SkColor* sk_out) {
// 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) {
#if BUILDFLAG(IS_WIN)
#if defined(OS_WIN)
CefString(&path_str).FromWString(path.value());
#else
CefString(&path_str).FromString(path.value());
@@ -175,7 +175,7 @@ base::FilePath NormalizeCachePathAndSet(cef_string_t& path_str,
int CefExecuteProcess(const CefMainArgs& args,
CefRefPtr<CefApp> application,
void* windows_sandbox_info) {
#if BUILDFLAG(IS_WIN)
#if defined(OS_WIN)
#if defined(ARCH_CPU_X86_64)
DisableFMA3();
#endif
@@ -191,7 +191,7 @@ bool CefInitialize(const CefMainArgs& args,
const CefSettings& settings,
CefRefPtr<CefApp> application,
void* windows_sandbox_info) {
#if BUILDFLAG(IS_WIN)
#if defined(OS_WIN)
#if defined(ARCH_CPU_X86_64)
DisableFMA3();
#endif
@@ -287,7 +287,7 @@ void CefQuitMessageLoop() {
}
void CefSetOSModalLoop(bool osModalLoop) {
#if BUILDFLAG(IS_WIN)
#if defined(OS_WIN)
// Verify that the context is in a valid state.
if (!CONTEXT_STATE_VALID()) {
NOTREACHED() << "context not valid";
@@ -300,7 +300,7 @@ void CefSetOSModalLoop(bool osModalLoop) {
}
base::CurrentThread::Get()->set_os_modal_loop(osModalLoop);
#endif // BUILDFLAG(IS_WIN)
#endif // defined(OS_WIN)
}
// CefContext
@@ -323,14 +323,14 @@ bool CefContext::Initialize(const CefMainArgs& args,
settings_ = settings;
application_ = application;
#if !(BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX))
#if !(defined(OS_WIN) || defined(OS_LINUX))
if (settings.multi_threaded_message_loop) {
NOTIMPLEMENTED() << "multi_threaded_message_loop is not supported.";
return false;
}
#endif
#if BUILDFLAG(IS_WIN)
#if defined(OS_WIN)
// Signal Chrome Elf that Chrome has begun to start.
SignalChromeElf();
#endif

View File

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

View File

@@ -57,9 +57,9 @@
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "storage/browser/file_system/native_file_util.h"
#if BUILDFLAG(IS_WIN)
#if defined(OS_WIN)
#include <windows.h>
#elif BUILDFLAG(IS_POSIX)
#elif defined(OS_POSIX)
#include <time.h>
#endif
@@ -106,7 +106,7 @@ base::DictionaryValue BuildObjectForResponse(const net::HttpResponseHeaders* rh,
}
void WriteTimestamp(std::stringstream& stream) {
#if BUILDFLAG(IS_WIN)
#if defined(OS_WIN)
SYSTEMTIME local_time;
GetLocalTime(&local_time);
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
<< std::setw(2) << local_time.wSecond << '.' << std::setw(3)
<< local_time.wMilliseconds;
#elif BUILDFLAG(IS_POSIX)
#elif defined(OS_POSIX)
timeval tv;
gettimeofday(&tv, nullptr);
time_t t = tv.tv_sec;
@@ -339,7 +339,8 @@ void CefDevToolsFrontend::ReadyToCommitNavigation(
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.
// Otherwise it will call AgentHostClosed which closes the DevTools window.
// 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.
base::Value::ListStorage params;
if (params_value) {
params = std::move(*params_value).TakeListDeprecated();
params = std::move(*params_value).TakeList();
}
if (*method == "dispatchProtocolMessage") {

View File

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

View File

@@ -5,6 +5,7 @@
#ifndef 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"
namespace content {

View File

@@ -4,8 +4,6 @@
#include "libcef/browser/download_manager_delegate.h"
#include <tuple>
#include "include/cef_download_handler.h"
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
#include "libcef/browser/context.h"
@@ -14,6 +12,7 @@
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/ignore_result.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
@@ -297,7 +296,7 @@ void CefDownloadManagerDelegate::OnDownloadUpdated(DownloadItem* download) {
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(),
suggested_name.value(), callbackObj);
std::ignore = download_item->Detach(nullptr);
ignore_result(download_item->Detach(nullptr));
}
return true;

View File

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

View File

@@ -86,10 +86,10 @@ void CefExtensionImpl::Unload() {
// flag, so set it here.
unloaded_ = true;
[[maybe_unused]] const bool result =
static_cast<CefRequestContextImpl*>(loader_context_)
->GetBrowserContext()
->UnloadExtension(id_);
const bool result = static_cast<CefRequestContextImpl*>(loader_context_)
->GetBrowserContext()
->UnloadExtension(id_);
ALLOW_UNUSED_LOCAL(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 "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "extensions/browser/api/storage/settings_storage_quota_enforcer.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/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/web_contents/web_contents_impl.h"
#include "content/public/browser/browser_context.h"
@@ -35,6 +36,21 @@ bool InsertWebContents(std::vector<content::WebContents*>* vector,
} // 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,
std::vector<content::WebContents*>* guests) {
content::BrowserPluginGuestManager* plugin_guest_manager =

View File

@@ -26,6 +26,10 @@ namespace extensions {
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|.
void GetAllGuestsForOwnerContents(content::WebContents* owner,
std::vector<content::WebContents*>* guests);

View File

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

View File

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

View File

@@ -38,7 +38,9 @@ class CefExtensionHostDelegate : public ExtensionHostDelegate {
blink::mojom::MediaStreamType type,
const Extension* extension) override;
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;
};

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