mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
23 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
f38ce3409c | ||
|
bda9e30ec9 | ||
|
a8ffe4b9f1 | ||
|
9e254face2 | ||
|
f6bc8313a6 | ||
|
da15ac5867 | ||
|
293645e049 | ||
|
9117d6a394 | ||
|
3a8409fde7 | ||
|
860bf38e47 | ||
|
33482208b6 | ||
|
b4cf6e54de | ||
|
64221256a0 | ||
|
6a52098b62 | ||
|
5a0b3ea937 | ||
|
e747782ece | ||
|
2565243720 | ||
|
4994313a5b | ||
|
a20b5f35ef | ||
|
0ae112ea32 | ||
|
6ebdfec451 | ||
|
98fe2d01e1 | ||
|
2d46bb789e |
13
BUILD.gn
13
BUILD.gn
@@ -758,8 +758,6 @@ static_library("libcef_static") {
|
||||
"libcef/common/values_impl.h",
|
||||
"libcef/common/waitable_event_impl.cc",
|
||||
"libcef/common/waitable_event_impl.h",
|
||||
"libcef/common/widevine_loader.cc",
|
||||
"libcef/common/widevine_loader.h",
|
||||
"libcef/features/runtime.h",
|
||||
"libcef/features/runtime_checks.h",
|
||||
"libcef/renderer/alloy/alloy_content_renderer_client.cc",
|
||||
@@ -850,6 +848,7 @@ static_library("libcef_static") {
|
||||
"//chrome/services/printing:lib",
|
||||
"//components/cdm/renderer",
|
||||
"//components/certificate_transparency",
|
||||
"//components/component_updater",
|
||||
"//components/content_settings/core/browser",
|
||||
"//components/content_settings/core/common",
|
||||
"//components/crx_file",
|
||||
@@ -1732,6 +1731,10 @@ if (is_mac) {
|
||||
|
||||
info_plist_target = ":${app_name}_helper_plist"
|
||||
|
||||
if (defined(invoker.helper_frameworks)) {
|
||||
frameworks = invoker.helper_frameworks
|
||||
}
|
||||
|
||||
if (defined(invoker.helper_defines)) {
|
||||
defines = invoker.helper_defines
|
||||
}
|
||||
@@ -1747,6 +1750,9 @@ if (is_mac) {
|
||||
if (defined(invoker.helper_deps)) {
|
||||
helper_deps = invoker.helper_deps
|
||||
}
|
||||
if (defined(invoker.helper_frameworks)) {
|
||||
helper_frameworks = invoker.helper_frameworks
|
||||
}
|
||||
if (defined(invoker.helper_defines)) {
|
||||
helper_defines = invoker.helper_defines
|
||||
}
|
||||
@@ -2005,6 +2011,9 @@ if (is_mac) {
|
||||
":gtest_teamcity",
|
||||
"//testing/gtest",
|
||||
]
|
||||
helper_frameworks = [
|
||||
"AppKit.framework",
|
||||
]
|
||||
helper_defines = [
|
||||
"CEF_USE_SANDBOX",
|
||||
]
|
||||
|
@@ -7,5 +7,6 @@
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'refs/tags/93.0.4577.0'
|
||||
'chromium_checkout': 'refs/tags/93.0.4577.82',
|
||||
'depot_tools_checkout': '45d2afa080'
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
# by hand. See the translator.README.txt file in the tools directory for
|
||||
# more information.
|
||||
#
|
||||
# $hash=d723a9f6637cec523b158a6750d3a64698b407c3$
|
||||
# $hash=f6950d026a9c92fbb58da3fe0cbcf0050c12ecf0$
|
||||
#
|
||||
|
||||
{
|
||||
@@ -374,8 +374,6 @@
|
||||
'libcef_dll/cpptoc/process_message_cpptoc.h',
|
||||
'libcef_dll/ctocpp/read_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/read_handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/register_cdm_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/register_cdm_callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/registration_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/registration_cpptoc.h',
|
||||
'libcef_dll/ctocpp/render_handler_ctocpp.cc',
|
||||
@@ -686,8 +684,6 @@
|
||||
'libcef_dll/ctocpp/process_message_ctocpp.h',
|
||||
'libcef_dll/cpptoc/read_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/read_handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/register_cdm_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/register_cdm_callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/registration_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/registration_ctocpp.h',
|
||||
'libcef_dll/cpptoc/render_handler_cpptoc.cc',
|
||||
|
@@ -230,8 +230,6 @@
|
||||
'tests/cefclient/browser/client_types.h',
|
||||
'tests/cefclient/browser/dialog_test.cc',
|
||||
'tests/cefclient/browser/dialog_test.h',
|
||||
'tests/cefclient/browser/drm_test.cc',
|
||||
'tests/cefclient/browser/drm_test.h',
|
||||
'tests/cefclient/browser/image_cache.cc',
|
||||
'tests/cefclient/browser/image_cache.h',
|
||||
'tests/cefclient/browser/main_context.cc',
|
||||
@@ -296,7 +294,6 @@
|
||||
'tests/cefclient/resources/binding.html',
|
||||
'tests/cefclient/resources/dialogs.html',
|
||||
'tests/cefclient/resources/draggable.html',
|
||||
'tests/cefclient/resources/drm.html',
|
||||
'tests/cefclient/resources/localstorage.html',
|
||||
'tests/cefclient/resources/logo.png',
|
||||
'tests/cefclient/resources/media_router.html',
|
||||
|
@@ -486,7 +486,7 @@ struct FunctorTraits<R (^)(Args...)> {
|
||||
|
||||
template <typename BlockType, typename... RunArgs>
|
||||
static R Invoke(BlockType&& block, RunArgs&&... args) {
|
||||
// According to LLVM documentation (ยง 6.3), "local variables of automatic
|
||||
// According to LLVM documentation (6.3), "local variables of automatic
|
||||
// storage duration do not have precise lifetime." Use objc_precise_lifetime
|
||||
// to ensure that the Objective-C block is not deallocated until it has
|
||||
// finished executing even if the Callback<> is destroyed during the block
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=f74bf4d33914d56d760f1bf5aadcf2651740c711$
|
||||
// $hash=f51ad9ffc67d94b9cbfad154e7f224111c2a96fa$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_WEB_PLUGIN_CAPI_H_
|
||||
@@ -129,29 +129,6 @@ typedef struct _cef_web_plugin_unstable_callback_t {
|
||||
int unstable);
|
||||
} cef_web_plugin_unstable_callback_t;
|
||||
|
||||
///
|
||||
// Implement this structure to receive notification when CDM registration is
|
||||
// complete. The functions of this structure will be called on the browser
|
||||
// process UI thread.
|
||||
///
|
||||
typedef struct _cef_register_cdm_callback_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Method that will be called when CDM registration is complete. |result| will
|
||||
// be CEF_CDM_REGISTRATION_ERROR_NONE if registration completed successfully.
|
||||
// Otherwise, |result| and |error_message| will contain additional information
|
||||
// about why registration failed.
|
||||
///
|
||||
void(CEF_CALLBACK* on_cdm_registration_complete)(
|
||||
struct _cef_register_cdm_callback_t* self,
|
||||
cef_cdm_registration_error_t result,
|
||||
const cef_string_t* error_message);
|
||||
} cef_register_cdm_callback_t;
|
||||
|
||||
///
|
||||
// Visit web plugin information. Can be called on any thread in the browser
|
||||
// process.
|
||||
@@ -187,52 +164,6 @@ CEF_EXPORT void cef_is_web_plugin_unstable(
|
||||
const cef_string_t* path,
|
||||
cef_web_plugin_unstable_callback_t* callback);
|
||||
|
||||
///
|
||||
// Register the Widevine CDM plugin.
|
||||
//
|
||||
// The client application is responsible for downloading an appropriate
|
||||
// platform-specific CDM binary distribution from Google, extracting the
|
||||
// contents, and building the required directory structure on the local machine.
|
||||
// The cef_browser_host_t::StartDownload function and CefZipArchive structure
|
||||
// can be used to implement this functionality in CEF. Contact Google via
|
||||
// https://www.widevine.com/contact.html for details on CDM download.
|
||||
//
|
||||
// |path| is a directory that must contain the following files:
|
||||
// 1. manifest.json file from the CDM binary distribution (see below).
|
||||
// 2. widevinecdm file from the CDM binary distribution (e.g.
|
||||
// widevinecdm.dll on on Windows, libwidevinecdm.dylib on OS X,
|
||||
// libwidevinecdm.so on Linux).
|
||||
//
|
||||
// If any of these files are missing or if the manifest file has incorrect
|
||||
// contents the registration will fail and |callback| will receive a |result|
|
||||
// value of CEF_CDM_REGISTRATION_ERROR_INCORRECT_CONTENTS.
|
||||
//
|
||||
// The manifest.json file must contain the following keys:
|
||||
// A. "os": Supported OS (e.g. "mac", "win" or "linux").
|
||||
// B. "arch": Supported architecture (e.g. "ia32" or "x64").
|
||||
// C. "x-cdm-module-versions": Module API version (e.g. "4").
|
||||
// D. "x-cdm-interface-versions": Interface API version (e.g. "8").
|
||||
// E. "x-cdm-host-versions": Host API version (e.g. "8").
|
||||
// F. "version": CDM version (e.g. "1.4.8.903").
|
||||
// G. "x-cdm-codecs": List of supported codecs (e.g. "vp8,vp09,avc1").
|
||||
//
|
||||
// A through E are used to verify compatibility with the current Chromium
|
||||
// version. If the CDM is not compatible the registration will fail and
|
||||
// |callback| will receive a |result| value of
|
||||
// CEF_CDM_REGISTRATION_ERROR_INCOMPATIBLE.
|
||||
//
|
||||
// |callback| will be executed asynchronously once registration is complete.
|
||||
//
|
||||
// On Linux this function must be called before cef_initialize() and the
|
||||
// registration cannot be changed during runtime. If registration is not
|
||||
// supported at the time that cef_register_widevine_cdm() is called then
|
||||
// |callback| will receive a |result| value of
|
||||
// CEF_CDM_REGISTRATION_ERROR_NOT_SUPPORTED.
|
||||
///
|
||||
CEF_EXPORT void cef_register_widevine_cdm(
|
||||
const cef_string_t* path,
|
||||
cef_register_cdm_callback_t* callback);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -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 "6498b029e847331e85f7fa7a8fe82434e016e316"
|
||||
#define CEF_API_HASH_UNIVERSAL "5625e3ce80d2bbf5b5a39f8655d96c215f7685ee"
|
||||
#if defined(OS_WIN)
|
||||
#define CEF_API_HASH_PLATFORM "5beb166d25cb4aa70e15ff565a0268c60cab3e0c"
|
||||
#define CEF_API_HASH_PLATFORM "c20e4ffc24e6267b61774f49237d0f30a581f370"
|
||||
#elif defined(OS_MAC)
|
||||
#define CEF_API_HASH_PLATFORM "5fa684079bfafa70cc920a1ad4e694e38c46d737"
|
||||
#define CEF_API_HASH_PLATFORM "65731bc654ec6e1dbd48d6ff2336c4c8573f7d35"
|
||||
#elif defined(OS_LINUX)
|
||||
#define CEF_API_HASH_PLATFORM "1e0cc77dabf9058f0fc118b4605fbcccda14466f"
|
||||
#define CEF_API_HASH_PLATFORM "4e35b9cc9735c63ac9f16fbbb49a4b8e2307f23a"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -145,68 +145,4 @@ class CefWebPluginUnstableCallback : public virtual CefBaseRefCounted {
|
||||
void CefIsWebPluginUnstable(const CefString& path,
|
||||
CefRefPtr<CefWebPluginUnstableCallback> callback);
|
||||
|
||||
///
|
||||
// Implement this interface to receive notification when CDM registration is
|
||||
// complete. The methods of this class will be called on the browser process
|
||||
// UI thread.
|
||||
///
|
||||
/*--cef(source=client)--*/
|
||||
class CefRegisterCdmCallback : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Method that will be called when CDM registration is complete. |result|
|
||||
// will be CEF_CDM_REGISTRATION_ERROR_NONE if registration completed
|
||||
// successfully. Otherwise, |result| and |error_message| will contain
|
||||
// additional information about why registration failed.
|
||||
///
|
||||
/*--cef(optional_param=error_message)--*/
|
||||
virtual void OnCdmRegistrationComplete(cef_cdm_registration_error_t result,
|
||||
const CefString& error_message) = 0;
|
||||
};
|
||||
|
||||
///
|
||||
// Register the Widevine CDM plugin.
|
||||
//
|
||||
// The client application is responsible for downloading an appropriate
|
||||
// platform-specific CDM binary distribution from Google, extracting the
|
||||
// contents, and building the required directory structure on the local machine.
|
||||
// The CefBrowserHost::StartDownload method and CefZipArchive class can be used
|
||||
// to implement this functionality in CEF. Contact Google via
|
||||
// https://www.widevine.com/contact.html for details on CDM download.
|
||||
//
|
||||
// |path| is a directory that must contain the following files:
|
||||
// 1. manifest.json file from the CDM binary distribution (see below).
|
||||
// 2. widevinecdm file from the CDM binary distribution (e.g.
|
||||
// widevinecdm.dll on on Windows, libwidevinecdm.dylib on OS X,
|
||||
// libwidevinecdm.so on Linux).
|
||||
//
|
||||
// If any of these files are missing or if the manifest file has incorrect
|
||||
// contents the registration will fail and |callback| will receive a |result|
|
||||
// value of CEF_CDM_REGISTRATION_ERROR_INCORRECT_CONTENTS.
|
||||
//
|
||||
// The manifest.json file must contain the following keys:
|
||||
// A. "os": Supported OS (e.g. "mac", "win" or "linux").
|
||||
// B. "arch": Supported architecture (e.g. "ia32" or "x64").
|
||||
// C. "x-cdm-module-versions": Module API version (e.g. "4").
|
||||
// D. "x-cdm-interface-versions": Interface API version (e.g. "8").
|
||||
// E. "x-cdm-host-versions": Host API version (e.g. "8").
|
||||
// F. "version": CDM version (e.g. "1.4.8.903").
|
||||
// G. "x-cdm-codecs": List of supported codecs (e.g. "vp8,vp09,avc1").
|
||||
//
|
||||
// A through E are used to verify compatibility with the current Chromium
|
||||
// version. If the CDM is not compatible the registration will fail and
|
||||
// |callback| will receive a |result| value of
|
||||
// CEF_CDM_REGISTRATION_ERROR_INCOMPATIBLE.
|
||||
//
|
||||
// |callback| will be executed asynchronously once registration is complete.
|
||||
//
|
||||
// On Linux this function must be called before CefInitialize() and the
|
||||
// registration cannot be changed during runtime. If registration is not
|
||||
// supported at the time that CefRegisterWidevineCdm() is called then |callback|
|
||||
// will receive a |result| value of CEF_CDM_REGISTRATION_ERROR_NOT_SUPPORTED.
|
||||
///
|
||||
/*--cef(optional_param=callback)--*/
|
||||
void CefRegisterWidevineCdm(const CefString& path,
|
||||
CefRefPtr<CefRegisterCdmCallback> callback);
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_WEB_PLUGIN_H_
|
||||
|
@@ -260,14 +260,14 @@ typedef struct _cef_settings_t {
|
||||
cef_string_t root_cache_path;
|
||||
|
||||
///
|
||||
// The location where user data such as spell checking dictionary files will
|
||||
// be stored on disk. If this value is empty then the default
|
||||
// platform-specific user data directory will be used ("~/.cef_user_data"
|
||||
// directory on Linux, "~/Library/Application Support/CEF/User Data" directory
|
||||
// on Mac OS X, "Local Settings\Application Data\CEF\User Data" directory
|
||||
// under the user profile directory on Windows). If this value is non-empty
|
||||
// then it must be an absolute path. When using the Chrome runtime this value
|
||||
// will be ignored in favor of the |root_cache_path| value.
|
||||
// The location where user data such as the Widevine CDM module and spell
|
||||
// checking dictionary files will be stored on disk. If this value is empty
|
||||
// then the default platform-specific user data directory will be used
|
||||
// ("~/.config/cef_user_data" directory on Linux, "~/Library/Application
|
||||
// Support/CEF/User Data" directory on MacOS, "AppData\Local\CEF\User Data"
|
||||
// directory under the user profile directory on Windows). If this value is
|
||||
// non-empty then it must be an absolute path. When using the Chrome runtime
|
||||
// this value will be ignored in favor of the |root_cache_path| value.
|
||||
///
|
||||
cef_string_t user_data_path;
|
||||
|
||||
@@ -320,7 +320,7 @@ typedef struct _cef_settings_t {
|
||||
///
|
||||
// The directory and file name to use for the debug log. If empty a default
|
||||
// log file name and location will be used. On Windows and Linux a "debug.log"
|
||||
// file will be written in the main executable directory. On Mac OS X a
|
||||
// file will be written in the main executable directory. On MacOS a
|
||||
// "~/Library/Logs/<app name>_debug.log" file will be written where <app name>
|
||||
// is the name of the main app executable. Also configurable using the
|
||||
// "log-file" command-line switch.
|
||||
@@ -346,7 +346,7 @@ typedef struct _cef_settings_t {
|
||||
///
|
||||
// The fully qualified path for the resources directory. If this value is
|
||||
// empty the *.pak files must be located in the module directory on
|
||||
// Windows/Linux or the app bundle Resources directory on Mac OS X. If this
|
||||
// Windows/Linux or the app bundle Resources directory on MacOS. If this
|
||||
// value is non-empty then it must be an absolute path. Also configurable
|
||||
// using the "resources-dir-path" command-line switch.
|
||||
///
|
||||
@@ -356,9 +356,9 @@ typedef struct _cef_settings_t {
|
||||
// The fully qualified path for the locales directory. If this value is empty
|
||||
// the locales directory must be located in the module directory. If this
|
||||
// value is non-empty then it must be an absolute path. This value is ignored
|
||||
// on Mac OS X where pack files are always loaded from the app bundle
|
||||
// Resources directory. Also configurable using the "locales-dir-path"
|
||||
// command-line switch.
|
||||
// on MacOS where pack files are always loaded from the app bundle Resources
|
||||
// directory. Also configurable using the "locales-dir-path" command-line
|
||||
// switch.
|
||||
///
|
||||
cef_string_t locales_dir_path;
|
||||
|
||||
@@ -918,7 +918,7 @@ typedef enum {
|
||||
|
||||
///
|
||||
// "Application Data" directory under the user profile directory on Windows
|
||||
// and "~/Library/Application Support" directory on Mac OS X.
|
||||
// and "~/Library/Application Support" directory on MacOS.
|
||||
///
|
||||
PK_USER_DATA,
|
||||
|
||||
@@ -2948,31 +2948,6 @@ typedef enum {
|
||||
CEF_SCHEME_OPTION_FETCH_ENABLED = 1 << 6,
|
||||
} cef_scheme_options_t;
|
||||
|
||||
///
|
||||
// Error codes for CDM registration. See cef_web_plugin.h for details.
|
||||
///
|
||||
typedef enum {
|
||||
///
|
||||
// No error. Registration completed successfully.
|
||||
///
|
||||
CEF_CDM_REGISTRATION_ERROR_NONE,
|
||||
|
||||
///
|
||||
// Required files or manifest contents are missing.
|
||||
///
|
||||
CEF_CDM_REGISTRATION_ERROR_INCORRECT_CONTENTS,
|
||||
|
||||
///
|
||||
// The CDM is incompatible with the current Chromium version.
|
||||
///
|
||||
CEF_CDM_REGISTRATION_ERROR_INCOMPATIBLE,
|
||||
|
||||
///
|
||||
// CDM registration is not supported at this time.
|
||||
///
|
||||
CEF_CDM_REGISTRATION_ERROR_NOT_SUPPORTED,
|
||||
} cef_cdm_registration_error_t;
|
||||
|
||||
///
|
||||
// Composition underline style.
|
||||
///
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
#include "libcef/common/drag_data_impl.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
#include "libcef/common/net/url_util.h"
|
||||
#include "libcef/common/request_impl.h"
|
||||
#include "libcef/common/values_impl.h"
|
||||
@@ -288,21 +289,10 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::GetBrowserForContents(
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<AlloyBrowserHostImpl>
|
||||
AlloyBrowserHostImpl::GetBrowserForFrameTreeNode(int frame_tree_node_id) {
|
||||
CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::GetBrowserForGlobalId(
|
||||
const content::GlobalRenderFrameHostId& global_id) {
|
||||
REQUIRE_ALLOY_RUNTIME();
|
||||
auto browser =
|
||||
CefBrowserHostBase::GetBrowserForFrameTreeNode(frame_tree_node_id);
|
||||
return static_cast<AlloyBrowserHostImpl*>(browser.get());
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::GetBrowserForFrameRoute(
|
||||
int render_process_id,
|
||||
int render_routing_id) {
|
||||
REQUIRE_ALLOY_RUNTIME();
|
||||
auto browser = CefBrowserHostBase::GetBrowserForFrameRoute(render_process_id,
|
||||
render_routing_id);
|
||||
auto browser = CefBrowserHostBase::GetBrowserForGlobalId(global_id);
|
||||
return static_cast<AlloyBrowserHostImpl*>(browser.get());
|
||||
}
|
||||
|
||||
@@ -1279,8 +1269,10 @@ void AlloyBrowserHostImpl::GetCustomWebContentsView(
|
||||
content::WebContentsView** view,
|
||||
content::RenderViewHostDelegateView** delegate_view) {
|
||||
CefBrowserInfoManager::GetInstance()->GetCustomWebContentsView(
|
||||
target_url, opener_render_process_id, opener_render_frame_id, view,
|
||||
delegate_view);
|
||||
target_url,
|
||||
frame_util::MakeGlobalId(opener_render_process_id,
|
||||
opener_render_frame_id),
|
||||
view, delegate_view);
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::WebContentsCreated(
|
||||
@@ -1296,8 +1288,10 @@ void AlloyBrowserHostImpl::WebContentsCreated(
|
||||
CefRefPtr<CefDictionaryValue> extra_info;
|
||||
|
||||
CefBrowserInfoManager::GetInstance()->WebContentsCreated(
|
||||
target_url, opener_render_process_id, opener_render_frame_id, settings,
|
||||
client, platform_delegate, extra_info);
|
||||
target_url,
|
||||
frame_util::MakeGlobalId(opener_render_process_id,
|
||||
opener_render_frame_id),
|
||||
settings, client, platform_delegate, extra_info);
|
||||
|
||||
scoped_refptr<CefBrowserInfo> info =
|
||||
CefBrowserInfoManager::GetInstance()->CreatePopupBrowserInfo(
|
||||
|
@@ -72,13 +72,9 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
// Returns the browser associated with the specified WebContents.
|
||||
static CefRefPtr<AlloyBrowserHostImpl> GetBrowserForContents(
|
||||
const content::WebContents* contents);
|
||||
// Returns the browser associated with the specified FrameTreeNode ID.
|
||||
static CefRefPtr<AlloyBrowserHostImpl> GetBrowserForFrameTreeNode(
|
||||
int frame_tree_node_id);
|
||||
// Returns the browser associated with the specified frame routing IDs.
|
||||
static CefRefPtr<AlloyBrowserHostImpl> GetBrowserForFrameRoute(
|
||||
int render_process_id,
|
||||
int render_routing_id);
|
||||
// Returns the browser associated with the specified global ID.
|
||||
static CefRefPtr<AlloyBrowserHostImpl> GetBrowserForGlobalId(
|
||||
const content::GlobalRenderFrameHostId& global_id);
|
||||
|
||||
// CefBrowserHost methods.
|
||||
void CloseBrowser(bool force_close) override;
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include "chrome/browser/media/router/chrome_media_router_factory.h"
|
||||
#include "chrome/browser/net/system_network_context_manager.h"
|
||||
#include "chrome/browser/plugins/plugin_finder.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "components/constrained_window/constrained_window_views.h"
|
||||
#include "content/public/browser/gpu_data_manager.h"
|
||||
#include "content/public/browser/network_service_instance.h"
|
||||
@@ -37,6 +38,7 @@
|
||||
#include "extensions/browser/extension_system.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "net/base/net_module.h"
|
||||
#include "third_party/widevine/cdm/buildflags.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
|
||||
#if defined(USE_AURA) && defined(USE_X11)
|
||||
@@ -73,6 +75,14 @@
|
||||
#include "libcef/browser/printing/print_dialog_linux.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_MEDIA_FOUNDATION_WIDEVINE_CDM)
|
||||
#include "chrome/browser/component_updater/media_foundation_widevine_cdm_component_installer.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_WIDEVINE_CDM_COMPONENT)
|
||||
#include "chrome/browser/component_updater/widevine_cdm_component_installer.h"
|
||||
#endif
|
||||
|
||||
AlloyBrowserMainParts::AlloyBrowserMainParts(
|
||||
const content::MainFunctionParams& parameters)
|
||||
: BrowserMainParts(), devtools_delegate_(nullptr) {}
|
||||
@@ -207,6 +217,23 @@ int AlloyBrowserMainParts::PreMainMessageLoopRun() {
|
||||
|
||||
scheme::RegisterWebUIControllerFactory();
|
||||
|
||||
#if BUILDFLAG(ENABLE_MEDIA_FOUNDATION_WIDEVINE_CDM) || \
|
||||
BUILDFLAG(ENABLE_WIDEVINE_CDM_COMPONENT)
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
if (!command_line->HasSwitch(switches::kDisableComponentUpdate)) {
|
||||
auto* const cus = g_browser_process->component_updater();
|
||||
|
||||
#if BUILDFLAG(ENABLE_MEDIA_FOUNDATION_WIDEVINE_CDM)
|
||||
RegisterMediaFoundationWidevineCdmComponent(cus);
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_WIDEVINE_CDM_COMPONENT)
|
||||
RegisterWidevineCdmComponent(cus);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
return content::RESULT_CODE_NORMAL_EXIT;
|
||||
}
|
||||
|
||||
|
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "build/build_config.h"
|
||||
|
@@ -39,6 +39,7 @@
|
||||
#include "libcef/common/cef_switches.h"
|
||||
#include "libcef/common/command_line_impl.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
#include "libcef/common/net/scheme_registration.h"
|
||||
#include "libcef/common/request_impl.h"
|
||||
|
||||
@@ -123,16 +124,11 @@
|
||||
#include "third_party/blink/public/common/web_preferences/web_preferences.h"
|
||||
#include "third_party/blink/public/mojom/prerender/prerender.mojom.h"
|
||||
#include "third_party/blink/public/web/web_window_features.h"
|
||||
#include "third_party/widevine/cdm/buildflags.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
#include "ui/base/ui_base_switches.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
#include "libcef/common/widevine_loader.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_POSIX) && !defined(OS_MAC)
|
||||
#include "base/debug/leak_annotations.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
@@ -351,13 +347,11 @@ class CefQuotaPermissionContext : public content::QuotaPermissionContext {
|
||||
bool handled = false;
|
||||
|
||||
CefRefPtr<AlloyBrowserHostImpl> browser =
|
||||
AlloyBrowserHostImpl::GetBrowserForFrameRoute(render_process_id,
|
||||
params.render_frame_id);
|
||||
if (browser.get()) {
|
||||
CefRefPtr<CefClient> client = browser->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefRequestHandler> handler = client->GetRequestHandler();
|
||||
if (handler.get()) {
|
||||
AlloyBrowserHostImpl::GetBrowserForGlobalId(frame_util::MakeGlobalId(
|
||||
render_process_id, params.render_frame_id));
|
||||
if (browser) {
|
||||
if (auto client = browser->GetClient()) {
|
||||
if (auto handler = client->GetRequestHandler()) {
|
||||
CefRefPtr<CefQuotaCallbackImpl> callbackImpl(
|
||||
new CefQuotaCallbackImpl(std::move(callback)));
|
||||
handled = handler->OnQuotaRequest(
|
||||
@@ -675,7 +669,6 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
switches::kMainBundlePath,
|
||||
#endif
|
||||
switches::kLocalesDirPath,
|
||||
switches::kLogFile,
|
||||
switches::kLogSeverity,
|
||||
switches::kResourcesDirPath,
|
||||
embedder_support::kUserAgent,
|
||||
@@ -734,18 +727,15 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
base::size(kSwitchNames));
|
||||
}
|
||||
|
||||
// Necessary to populate DIR_USER_DATA in sub-processes.
|
||||
// See resource_util.cc GetUserDataPath.
|
||||
base::FilePath user_data_dir;
|
||||
if (base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) {
|
||||
command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir);
|
||||
}
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
if (process_type == switches::kZygoteProcess) {
|
||||
#if BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
if (!browser_cmd->HasSwitch(sandbox::policy::switches::kNoSandbox)) {
|
||||
// Pass the Widevine CDM path to the Zygote process. See comments in
|
||||
// CefWidevineLoader::AddContentDecryptionModules.
|
||||
const base::FilePath& cdm_path = CefWidevineLoader::GetInstance()->path();
|
||||
if (!cdm_path.empty())
|
||||
command_line->AppendSwitchPath(switches::kWidevineCdmPath, cdm_path);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (browser_cmd->HasSwitch(switches::kBrowserSubprocessPath)) {
|
||||
// Force use of the sub-process executable path for the zygote process.
|
||||
const base::FilePath& subprocess_path =
|
||||
@@ -753,6 +743,14 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
if (!subprocess_path.empty())
|
||||
command_line->SetProgram(subprocess_path);
|
||||
}
|
||||
|
||||
// Propagate the following switches to the zygote command line (along with
|
||||
// any associated values) if present in the browser command line.
|
||||
static const char* const kSwitchNames[] = {
|
||||
switches::kLogFile,
|
||||
};
|
||||
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
|
||||
base::size(kSwitchNames));
|
||||
}
|
||||
#endif // defined(OS_LINUX)
|
||||
|
||||
|
@@ -13,12 +13,15 @@
|
||||
#include "libcef/common/cef_switches.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "chrome/browser/component_updater/chrome_component_updater_configurator.h"
|
||||
#include "chrome/browser/net/system_network_context_manager.h"
|
||||
#include "chrome/browser/policy/chrome_browser_policy_connector.h"
|
||||
#include "chrome/browser/printing/background_printing_manager.h"
|
||||
#include "chrome/browser/printing/print_job_manager.h"
|
||||
#include "chrome/browser/printing/print_preview_dialog_controller.h"
|
||||
#include "chrome/browser/ui/prefs/pref_watcher.h"
|
||||
#include "components/component_updater/component_updater_service.h"
|
||||
#include "components/component_updater/timer_update_scheduler.h"
|
||||
#include "components/net_log/chrome_net_log.h"
|
||||
#include "components/prefs/pref_service.h"
|
||||
#include "content/browser/startup_helper.h"
|
||||
@@ -331,8 +334,23 @@ void ChromeBrowserProcessAlloy::StartAutoupdateTimer() {}
|
||||
|
||||
component_updater::ComponentUpdateService*
|
||||
ChromeBrowserProcessAlloy::component_updater() {
|
||||
NOTREACHED();
|
||||
return nullptr;
|
||||
if (component_updater_)
|
||||
return component_updater_.get();
|
||||
|
||||
if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<component_updater::UpdateScheduler> scheduler =
|
||||
std::make_unique<component_updater::TimerUpdateScheduler>();
|
||||
|
||||
component_updater_ = component_updater::ComponentUpdateServiceFactory(
|
||||
component_updater::MakeChromeComponentUpdaterConfigurator(
|
||||
base::CommandLine::ForCurrentProcess(),
|
||||
g_browser_process->local_state()),
|
||||
std::move(scheduler));
|
||||
|
||||
return component_updater_.get();
|
||||
}
|
||||
|
||||
MediaFileSystemRegistry*
|
||||
|
@@ -119,6 +119,8 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
|
||||
browser_policy_connector_;
|
||||
std::unique_ptr<base::FieldTrialList> field_trial_list_;
|
||||
|
||||
std::unique_ptr<component_updater::ComponentUpdateService> component_updater_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserProcessAlloy);
|
||||
};
|
||||
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#include "libcef/browser/browser_host_base.h"
|
||||
#include "libcef/browser/browser_platform_delegate.h"
|
||||
#include "libcef/browser/browser_util.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
|
||||
#include "content/public/browser/focused_node_details.h"
|
||||
#include "content/public/browser/keyboard_event_processing_result.h"
|
||||
@@ -252,7 +253,8 @@ void CefBrowserContentsDelegate::RenderFrameHostStateChanged(
|
||||
|
||||
void CefBrowserContentsDelegate::RenderFrameDeleted(
|
||||
content::RenderFrameHost* render_frame_host) {
|
||||
const auto frame_id = CefFrameHostImpl::MakeFrameId(render_frame_host);
|
||||
const auto frame_id =
|
||||
frame_util::MakeFrameId(render_frame_host->GetGlobalId());
|
||||
browser_info_->RemoveFrame(render_frame_host);
|
||||
|
||||
if (focused_frame_ && focused_frame_->GetIdentifier() == frame_id) {
|
||||
@@ -358,6 +360,7 @@ void CefBrowserContentsDelegate::DidFinishNavigation(
|
||||
return;
|
||||
|
||||
const bool is_main_frame = navigation_handle->IsInMainFrame();
|
||||
const auto global_id = frame_util::GetGlobalId(navigation_handle);
|
||||
const GURL& url =
|
||||
(error_code == net::OK ? navigation_handle->GetURL() : GURL());
|
||||
|
||||
@@ -365,14 +368,13 @@ void CefBrowserContentsDelegate::DidFinishNavigation(
|
||||
|
||||
// May return NULL when starting a new navigation if the previous navigation
|
||||
// caused the renderer process to crash during load.
|
||||
CefRefPtr<CefFrameHostImpl> frame = browser_info->GetFrameForFrameTreeNode(
|
||||
navigation_handle->GetFrameTreeNodeId());
|
||||
CefRefPtr<CefFrameHostImpl> frame =
|
||||
browser_info->GetFrameForGlobalId(global_id);
|
||||
if (!frame) {
|
||||
if (is_main_frame) {
|
||||
frame = browser_info->GetMainFrame();
|
||||
} else {
|
||||
frame =
|
||||
browser_info->CreateTempSubFrame(CefFrameHostImpl::kInvalidFrameId);
|
||||
frame = browser_info->CreateTempSubFrame(frame_util::InvalidGlobalId());
|
||||
}
|
||||
}
|
||||
frame->RefreshAttributes();
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
#include "libcef/features/runtime.h"
|
||||
|
||||
#include "base/files/file_util.h"
|
||||
@@ -67,15 +68,12 @@ class ImplManager {
|
||||
return GetImplPos(impl) != all_.end();
|
||||
}
|
||||
|
||||
CefBrowserContext* GetImplFromIDs(int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
bool require_frame_match) {
|
||||
CefBrowserContext* GetImplFromGlobalId(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool require_frame_match) {
|
||||
CEF_REQUIRE_UIT();
|
||||
for (const auto& context : all_) {
|
||||
if (context->IsAssociatedContext(render_process_id, render_frame_id,
|
||||
frame_tree_node_id,
|
||||
require_frame_match)) {
|
||||
if (context->IsAssociatedContext(global_id, require_frame_match)) {
|
||||
return context;
|
||||
}
|
||||
}
|
||||
@@ -242,13 +240,10 @@ CefBrowserContext* CefBrowserContext::FromCachePath(
|
||||
}
|
||||
|
||||
// static
|
||||
CefBrowserContext* CefBrowserContext::FromIDs(int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
bool require_frame_match) {
|
||||
return g_manager.Get().GetImplFromIDs(render_process_id, render_frame_id,
|
||||
frame_tree_node_id,
|
||||
require_frame_match);
|
||||
CefBrowserContext* CefBrowserContext::FromGlobalId(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool require_frame_match) {
|
||||
return g_manager.Get().GetImplFromGlobalId(global_id, require_frame_match);
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -283,100 +278,70 @@ std::vector<CefBrowserContext*> CefBrowserContext::GetAll() {
|
||||
|
||||
void CefBrowserContext::OnRenderFrameCreated(
|
||||
CefRequestContextImpl* request_context,
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool is_main_frame,
|
||||
bool is_guest_view) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK_GE(render_process_id, 0);
|
||||
DCHECK_GE(render_frame_id, 0);
|
||||
DCHECK_GE(frame_tree_node_id, 0);
|
||||
DCHECK(frame_util::IsValidGlobalId(global_id));
|
||||
|
||||
render_id_set_.insert(std::make_pair(render_process_id, render_frame_id));
|
||||
node_id_set_.insert(frame_tree_node_id);
|
||||
render_id_set_.insert(global_id);
|
||||
|
||||
CefRefPtr<CefRequestContextHandler> handler = request_context->GetHandler();
|
||||
if (handler) {
|
||||
handler_map_.AddHandler(render_process_id, render_frame_id,
|
||||
frame_tree_node_id, handler);
|
||||
handler_map_.AddHandler(global_id, handler);
|
||||
|
||||
CEF_POST_TASK(CEF_IOT,
|
||||
base::BindOnce(&CefIOThreadState::AddHandler, iothread_state_,
|
||||
render_process_id, render_frame_id,
|
||||
frame_tree_node_id, handler));
|
||||
CEF_POST_TASK(CEF_IOT, base::BindOnce(&CefIOThreadState::AddHandler,
|
||||
iothread_state_, global_id, handler));
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserContext::OnRenderFrameDeleted(
|
||||
CefRequestContextImpl* request_context,
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool is_main_frame,
|
||||
bool is_guest_view) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK_GE(render_process_id, 0);
|
||||
DCHECK_GE(render_frame_id, 0);
|
||||
DCHECK_GE(frame_tree_node_id, 0);
|
||||
DCHECK(frame_util::IsValidGlobalId(global_id));
|
||||
|
||||
auto it1 =
|
||||
render_id_set_.find(std::make_pair(render_process_id, render_frame_id));
|
||||
auto it1 = render_id_set_.find(global_id);
|
||||
if (it1 != render_id_set_.end())
|
||||
render_id_set_.erase(it1);
|
||||
|
||||
auto it2 = node_id_set_.find(frame_tree_node_id);
|
||||
if (it2 != node_id_set_.end())
|
||||
node_id_set_.erase(it2);
|
||||
|
||||
CefRefPtr<CefRequestContextHandler> handler = request_context->GetHandler();
|
||||
if (handler) {
|
||||
handler_map_.RemoveHandler(render_process_id, render_frame_id,
|
||||
frame_tree_node_id);
|
||||
handler_map_.RemoveHandler(global_id);
|
||||
|
||||
CEF_POST_TASK(CEF_IOT, base::BindOnce(&CefIOThreadState::RemoveHandler,
|
||||
iothread_state_, render_process_id,
|
||||
render_frame_id, frame_tree_node_id));
|
||||
iothread_state_, global_id));
|
||||
}
|
||||
|
||||
if (is_main_frame) {
|
||||
ClearPluginLoadDecision(render_process_id);
|
||||
ClearPluginLoadDecision(global_id.child_id);
|
||||
}
|
||||
}
|
||||
|
||||
CefRefPtr<CefRequestContextHandler> CefBrowserContext::GetHandler(
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool require_frame_match) const {
|
||||
CEF_REQUIRE_UIT();
|
||||
return handler_map_.GetHandler(render_process_id, render_frame_id,
|
||||
frame_tree_node_id, require_frame_match);
|
||||
return handler_map_.GetHandler(global_id, require_frame_match);
|
||||
}
|
||||
|
||||
bool CefBrowserContext::IsAssociatedContext(int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
bool require_frame_match) const {
|
||||
bool CefBrowserContext::IsAssociatedContext(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool require_frame_match) const {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
if (render_process_id >= 0 && render_frame_id >= 0) {
|
||||
const auto it1 =
|
||||
render_id_set_.find(std::make_pair(render_process_id, render_frame_id));
|
||||
if (frame_util::IsValidGlobalId(global_id)) {
|
||||
const auto it1 = render_id_set_.find(global_id);
|
||||
if (it1 != render_id_set_.end())
|
||||
return true;
|
||||
}
|
||||
|
||||
if (frame_tree_node_id >= 0) {
|
||||
const auto it2 = node_id_set_.find(frame_tree_node_id);
|
||||
if (it2 != node_id_set_.end())
|
||||
return true;
|
||||
}
|
||||
|
||||
if (render_process_id >= 0 && !require_frame_match) {
|
||||
if (frame_util::IsValidChildId(global_id.child_id) && !require_frame_match) {
|
||||
// Choose an arbitrary handler for the same process.
|
||||
for (const auto& render_ids : render_id_set_) {
|
||||
if (render_ids.first == render_process_id)
|
||||
if (render_ids.child_id == global_id.child_id)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -407,7 +372,7 @@ bool CefBrowserContext::HasPluginLoadDecision(
|
||||
const url::Origin& main_frame_origin,
|
||||
chrome::mojom::PluginStatus* status) const {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK_GE(render_process_id, 0);
|
||||
DCHECK(frame_util::IsValidChildId(render_process_id));
|
||||
DCHECK(!plugin_path.empty());
|
||||
|
||||
PluginLoadDecisionMap::const_iterator it = plugin_load_decision_map_.find(
|
||||
@@ -423,7 +388,7 @@ bool CefBrowserContext::HasPluginLoadDecision(
|
||||
void CefBrowserContext::ClearPluginLoadDecision(int render_process_id) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
if (render_process_id == -1) {
|
||||
if (!frame_util::IsValidChildId(render_process_id)) {
|
||||
plugin_load_decision_map_.clear();
|
||||
} else {
|
||||
PluginLoadDecisionMap::iterator it = plugin_load_decision_map_.begin();
|
||||
|
@@ -78,7 +78,8 @@
|
||||
|
||||
namespace content {
|
||||
class BrowserContext;
|
||||
}
|
||||
struct GlobalRenderFrameHostId;
|
||||
} // namespace content
|
||||
|
||||
class CefMediaRouterManager;
|
||||
class CefRequestContextImpl;
|
||||
@@ -96,10 +97,9 @@ class CefBrowserContext {
|
||||
|
||||
// Returns the existing instance, if any, associated with the specified IDs.
|
||||
// See comments on IsAssociatedContext() for usage.
|
||||
static CefBrowserContext* FromIDs(int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
bool require_frame_match);
|
||||
static CefBrowserContext* FromGlobalId(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool require_frame_match);
|
||||
|
||||
// Returns the underlying CefBrowserContext if any.
|
||||
static CefBrowserContext* FromBrowserContext(
|
||||
@@ -127,17 +127,13 @@ class CefBrowserContext {
|
||||
|
||||
// Called from CefRequestContextImpl::OnRenderFrameCreated.
|
||||
void OnRenderFrameCreated(CefRequestContextImpl* request_context,
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool is_main_frame,
|
||||
bool is_guest_view);
|
||||
|
||||
// Called from CefRequestContextImpl::OnRenderFrameDeleted.
|
||||
void OnRenderFrameDeleted(CefRequestContextImpl* request_context,
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool is_main_frame,
|
||||
bool is_guest_view);
|
||||
|
||||
@@ -147,18 +143,14 @@ class CefBrowserContext {
|
||||
// match, then the first handler for the same |render_process_id| will be
|
||||
// returned.
|
||||
CefRefPtr<CefRequestContextHandler> GetHandler(
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool require_frame_match) const;
|
||||
|
||||
// Returns true if this context is associated with the specified IDs. Pass -1
|
||||
// for unknown values. If |require_frame_match| is true only exact matches
|
||||
// will qualify. If |require_frame_match| is false, and there is not an exact
|
||||
// match, then any match for |render_process_id| will qualify.
|
||||
bool IsAssociatedContext(int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
bool IsAssociatedContext(const content::GlobalRenderFrameHostId& global_id,
|
||||
bool require_frame_match) const;
|
||||
|
||||
// Remember the plugin load decision for plugin status requests that arrive
|
||||
@@ -175,7 +167,8 @@ class CefBrowserContext {
|
||||
chrome::mojom::PluginStatus* status) const;
|
||||
|
||||
// Clear the plugin load decisions associated with |render_process_id|, or all
|
||||
// plugin load decisions if |render_process_id| is -1.
|
||||
// plugin load decisions if |render_process_id| is
|
||||
// content::ChildProcessHost::kInvalidUniqueID.
|
||||
void ClearPluginLoadDecision(int render_process_id);
|
||||
|
||||
// Called from CefRequestContextImpl methods of the same name.
|
||||
@@ -258,18 +251,10 @@ class CefBrowserContext {
|
||||
PluginLoadDecisionMap;
|
||||
PluginLoadDecisionMap plugin_load_decision_map_;
|
||||
|
||||
// Set of (render_process_id, render_frame_id) associated with this context.
|
||||
typedef std::set<std::pair<int, int>> RenderIdSet;
|
||||
// Set of global IDs associated with this context.
|
||||
typedef std::set<content::GlobalRenderFrameHostId> RenderIdSet;
|
||||
RenderIdSet render_id_set_;
|
||||
|
||||
// Set of frame_tree_node_id associated with this context. Keeping this list
|
||||
// is necessary because, when navigating the main frame, a new (pre-commit)
|
||||
// network request will be created before the RenderFrameHost. Consequently we
|
||||
// can't rely on valid render IDs. See https://crbug.com/776884 for
|
||||
// background.
|
||||
typedef std::set<int> NodeIdSet;
|
||||
NodeIdSet node_id_set_;
|
||||
|
||||
#if DCHECK_IS_ON()
|
||||
bool is_shutdown_ = false;
|
||||
#endif
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#include "libcef/browser/image_impl.h"
|
||||
#include "libcef/browser/navigation_entry_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
#include "libcef/common/net/url_util.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
@@ -101,52 +102,30 @@ CefRefPtr<CefBrowserHostBase> CefBrowserHostBase::GetBrowserForContents(
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<CefBrowserHostBase> CefBrowserHostBase::GetBrowserForFrameTreeNode(
|
||||
int frame_tree_node_id) {
|
||||
// Use the thread-safe approach.
|
||||
auto info =
|
||||
CefBrowserInfoManager::GetInstance()->GetBrowserInfoForFrameTreeNode(
|
||||
frame_tree_node_id);
|
||||
if (info) {
|
||||
auto browser = info->browser();
|
||||
if (!browser) {
|
||||
LOG(WARNING) << "Found browser id " << info->browser_id()
|
||||
<< " but no browser object matching frame tree node id "
|
||||
<< frame_tree_node_id;
|
||||
}
|
||||
return browser;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<CefBrowserHostBase> CefBrowserHostBase::GetBrowserForFrameRoute(
|
||||
int render_process_id,
|
||||
int render_routing_id) {
|
||||
if (render_process_id == -1 || render_routing_id == MSG_ROUTING_NONE)
|
||||
CefRefPtr<CefBrowserHostBase> CefBrowserHostBase::GetBrowserForGlobalId(
|
||||
const content::GlobalRenderFrameHostId& global_id) {
|
||||
if (!frame_util::IsValidGlobalId(global_id)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
// Use the non-thread-safe but potentially faster approach.
|
||||
content::RenderFrameHost* render_frame_host =
|
||||
content::RenderFrameHost::FromID(render_process_id, render_routing_id);
|
||||
content::RenderFrameHost::FromID(global_id);
|
||||
if (!render_frame_host)
|
||||
return nullptr;
|
||||
return GetBrowserForHost(render_frame_host);
|
||||
} else {
|
||||
// Use the thread-safe approach.
|
||||
bool is_guest_view = false;
|
||||
auto info =
|
||||
CefBrowserInfoManager::GetInstance()->GetBrowserInfoForFrameRoute(
|
||||
render_process_id, render_routing_id, &is_guest_view);
|
||||
auto info = CefBrowserInfoManager::GetInstance()->GetBrowserInfo(
|
||||
global_id, &is_guest_view);
|
||||
if (info && !is_guest_view) {
|
||||
auto browser = info->browser();
|
||||
if (!browser) {
|
||||
LOG(WARNING) << "Found browser id " << info->browser_id()
|
||||
<< " but no browser object matching frame process id "
|
||||
<< render_process_id << " and routing id "
|
||||
<< render_routing_id;
|
||||
<< " but no browser object matching frame "
|
||||
<< frame_util::GetFrameDebugString(global_id);
|
||||
}
|
||||
return browser;
|
||||
}
|
||||
@@ -644,7 +623,8 @@ CefRefPtr<CefFrame> CefBrowserHostBase::GetFrame(int64 identifier) {
|
||||
return focused_frame_;
|
||||
}
|
||||
|
||||
return browser_info_->GetFrameForId(identifier);
|
||||
return browser_info_->GetFrameForGlobalId(
|
||||
frame_util::MakeGlobalId(identifier));
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrame> CefBrowserHostBase::GetFrame(const CefString& name) {
|
||||
@@ -723,9 +703,9 @@ CefRefPtr<CefFrame> CefBrowserHostBase::GetFrameForHost(
|
||||
return browser_info_->GetFrameForHost(host);
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrame> CefBrowserHostBase::GetFrameForFrameTreeNode(
|
||||
int frame_tree_node_id) {
|
||||
return browser_info_->GetFrameForFrameTreeNode(frame_tree_node_id, nullptr);
|
||||
CefRefPtr<CefFrame> CefBrowserHostBase::GetFrameForGlobalId(
|
||||
const content::GlobalRenderFrameHostId& global_id) {
|
||||
return browser_info_->GetFrameForGlobalId(global_id, nullptr);
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::AddObserver(Observer* observer) {
|
||||
|
@@ -123,13 +123,9 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
// Returns the browser associated with the specified WebContents.
|
||||
static CefRefPtr<CefBrowserHostBase> GetBrowserForContents(
|
||||
const content::WebContents* contents);
|
||||
// Returns the browser associated with the specified FrameTreeNode ID.
|
||||
static CefRefPtr<CefBrowserHostBase> GetBrowserForFrameTreeNode(
|
||||
int frame_tree_node_id);
|
||||
// Returns the browser associated with the specified frame routing IDs.
|
||||
static CefRefPtr<CefBrowserHostBase> GetBrowserForFrameRoute(
|
||||
int render_process_id,
|
||||
int render_routing_id);
|
||||
// Returns the browser associated with the specified global ID.
|
||||
static CefRefPtr<CefBrowserHostBase> GetBrowserForGlobalId(
|
||||
const content::GlobalRenderFrameHostId& global_id);
|
||||
|
||||
CefBrowserHostBase(
|
||||
const CefBrowserSettings& settings,
|
||||
@@ -212,8 +208,11 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
// Returns the frame associated with the specified RenderFrameHost.
|
||||
CefRefPtr<CefFrame> GetFrameForHost(const content::RenderFrameHost* host);
|
||||
|
||||
// Returns the frame associated with the specified FrameTreeNode ID.
|
||||
CefRefPtr<CefFrame> GetFrameForFrameTreeNode(int frame_tree_node_id);
|
||||
// Returns the frame associated with the specified global ID. See
|
||||
// documentation on RenderFrameHost::GetFrameTreeNodeId() for why the global
|
||||
// ID is preferred.
|
||||
CefRefPtr<CefFrame> GetFrameForGlobalId(
|
||||
const content::GlobalRenderFrameHostId& global_id);
|
||||
|
||||
// Manage observer objects. The observer must either outlive this object or
|
||||
// be removed before destruction. Must be called on the UI thread.
|
||||
|
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "libcef/browser/browser_host_base.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
#include "libcef/common/values_impl.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
@@ -74,8 +75,7 @@ void CefBrowserInfo::MaybeCreateFrame(content::RenderFrameHost* host,
|
||||
bool is_guest_view) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
const auto frame_id = CefFrameHostImpl::MakeFrameId(host);
|
||||
const int frame_tree_node_id = host->GetFrameTreeNodeId();
|
||||
const auto global_id = host->GetGlobalId();
|
||||
const bool is_main_frame = (host->GetParent() == nullptr);
|
||||
|
||||
// A speculative RFH will be created in response to a browser-initiated
|
||||
@@ -93,14 +93,13 @@ void CefBrowserInfo::MaybeCreateFrame(content::RenderFrameHost* host,
|
||||
NotificationStateLock lock_scope(this);
|
||||
DCHECK(browser_);
|
||||
|
||||
const auto it = frame_id_map_.find(frame_id);
|
||||
const auto it = frame_id_map_.find(global_id);
|
||||
if (it != frame_id_map_.end()) {
|
||||
auto info = it->second;
|
||||
|
||||
#if DCHECK_IS_ON()
|
||||
// Check that the frame info hasn't changed unexpectedly.
|
||||
DCHECK_EQ(info->frame_id_, frame_id);
|
||||
DCHECK_EQ(info->frame_tree_node_id_, frame_tree_node_id);
|
||||
DCHECK_EQ(info->global_id_, global_id);
|
||||
DCHECK_EQ(info->is_guest_view_, is_guest_view);
|
||||
DCHECK_EQ(info->is_main_frame_, is_main_frame);
|
||||
#endif
|
||||
@@ -112,15 +111,13 @@ void CefBrowserInfo::MaybeCreateFrame(content::RenderFrameHost* host,
|
||||
SetMainFrame(browser_, info->frame_);
|
||||
}
|
||||
info->is_speculative_ = false;
|
||||
MaybeUpdateFrameTreeNodeIdMap(info);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
auto frame_info = new FrameInfo;
|
||||
frame_info->host_ = host;
|
||||
frame_info->frame_id_ = frame_id;
|
||||
frame_info->frame_tree_node_id_ = frame_tree_node_id;
|
||||
frame_info->global_id_ = global_id;
|
||||
frame_info->is_guest_view_ = is_guest_view;
|
||||
frame_info->is_main_frame_ = is_main_frame;
|
||||
frame_info->is_speculative_ = is_speculative;
|
||||
@@ -136,18 +133,17 @@ void CefBrowserInfo::MaybeCreateFrame(content::RenderFrameHost* host,
|
||||
|
||||
#if DCHECK_IS_ON()
|
||||
// Check that the frame info hasn't changed unexpectedly.
|
||||
DCHECK_EQ(frame_id, frame_info->frame_->GetIdentifier());
|
||||
DCHECK_EQ(frame_util::MakeFrameId(global_id),
|
||||
frame_info->frame_->GetIdentifier());
|
||||
DCHECK_EQ(frame_info->is_main_frame_, frame_info->frame_->IsMain());
|
||||
#endif
|
||||
}
|
||||
|
||||
browser_->request_context()->OnRenderFrameCreated(
|
||||
host->GetProcess()->GetID(), host->GetRoutingID(), frame_tree_node_id,
|
||||
is_main_frame, is_guest_view);
|
||||
browser_->request_context()->OnRenderFrameCreated(global_id, is_main_frame,
|
||||
is_guest_view);
|
||||
|
||||
// Populate the lookup maps.
|
||||
frame_id_map_.insert(std::make_pair(frame_id, frame_info));
|
||||
MaybeUpdateFrameTreeNodeIdMap(frame_info);
|
||||
frame_id_map_.insert(std::make_pair(global_id, frame_info));
|
||||
|
||||
// And finally set the ownership.
|
||||
frame_info_set_.insert(base::WrapUnique(frame_info));
|
||||
@@ -171,8 +167,7 @@ void CefBrowserInfo::FrameHostStateChanged(
|
||||
|
||||
base::AutoLock lock_scope(lock_);
|
||||
|
||||
const auto frame_id = CefFrameHostImpl::MakeFrameId(host);
|
||||
auto it = frame_id_map_.find(frame_id);
|
||||
auto it = frame_id_map_.find(host->GetGlobalId());
|
||||
DCHECK(it != frame_id_map_.end());
|
||||
DCHECK((!it->second->is_in_bfcache_ && added_to_bfcache) ||
|
||||
(it->second->is_in_bfcache_ && removed_from_bfcache));
|
||||
@@ -184,31 +179,18 @@ void CefBrowserInfo::RemoveFrame(content::RenderFrameHost* host) {
|
||||
|
||||
NotificationStateLock lock_scope(this);
|
||||
|
||||
const auto frame_id = CefFrameHostImpl::MakeFrameId(host);
|
||||
|
||||
auto it = frame_id_map_.find(frame_id);
|
||||
const auto global_id = host->GetGlobalId();
|
||||
auto it = frame_id_map_.find(global_id);
|
||||
DCHECK(it != frame_id_map_.end());
|
||||
|
||||
auto frame_info = it->second;
|
||||
|
||||
browser_->request_context()->OnRenderFrameDeleted(
|
||||
host->GetProcess()->GetID(), host->GetRoutingID(),
|
||||
frame_info->frame_tree_node_id_, frame_info->is_main_frame_,
|
||||
frame_info->is_guest_view_);
|
||||
global_id, frame_info->is_main_frame_, frame_info->is_guest_view_);
|
||||
|
||||
// Remove from the lookup maps.
|
||||
frame_id_map_.erase(it);
|
||||
|
||||
// A new RFH with the same node ID may be added before the old RFH is deleted,
|
||||
// or this might be a speculative RFH. Therefore only delete the map entry if
|
||||
// it's currently pointing to the to-be-deleted frame info object.
|
||||
{
|
||||
auto it2 = frame_tree_node_id_map_.find(frame_info->frame_tree_node_id_);
|
||||
if (it2 != frame_tree_node_id_map_.end() && it2->second == frame_info) {
|
||||
frame_tree_node_id_map_.erase(frame_info->frame_tree_node_id_);
|
||||
}
|
||||
}
|
||||
|
||||
// And finally delete the frame info.
|
||||
{
|
||||
auto it2 = frame_info_set_.find(frame_info);
|
||||
@@ -225,7 +207,7 @@ void CefBrowserInfo::RemoveFrame(content::RenderFrameHost* host) {
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetMainFrame() {
|
||||
NotificationStateLock lock_scope(this);
|
||||
base::AutoLock lock_scope(lock_);
|
||||
// Early exit if called post-destruction.
|
||||
if (!browser_)
|
||||
return nullptr;
|
||||
@@ -235,8 +217,8 @@ CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetMainFrame() {
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::CreateTempSubFrame(
|
||||
int64_t parent_frame_id) {
|
||||
CefRefPtr<CefFrameHostImpl> parent = GetFrameForId(parent_frame_id);
|
||||
const content::GlobalRenderFrameHostId& parent_global_id) {
|
||||
CefRefPtr<CefFrameHostImpl> parent = GetFrameForGlobalId(parent_global_id);
|
||||
if (!parent)
|
||||
parent = GetMainFrame();
|
||||
// Intentionally not notifying for temporary frames.
|
||||
@@ -253,39 +235,24 @@ CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForHost(
|
||||
if (!host)
|
||||
return nullptr;
|
||||
|
||||
return GetFrameForId(CefFrameHostImpl::MakeFrameId(host), is_guest_view,
|
||||
prefer_speculative);
|
||||
return GetFrameForGlobalId(
|
||||
const_cast<content::RenderFrameHost*>(host)->GetGlobalId(), is_guest_view,
|
||||
prefer_speculative);
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForRoute(
|
||||
int32_t render_process_id,
|
||||
int32_t render_routing_id,
|
||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForGlobalId(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool* is_guest_view,
|
||||
bool prefer_speculative) const {
|
||||
if (is_guest_view)
|
||||
*is_guest_view = false;
|
||||
|
||||
if (render_process_id < 0 || render_routing_id < 0)
|
||||
return nullptr;
|
||||
|
||||
return GetFrameForId(
|
||||
CefFrameHostImpl::MakeFrameId(render_process_id, render_routing_id),
|
||||
is_guest_view, prefer_speculative);
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForId(
|
||||
int64_t frame_id,
|
||||
bool* is_guest_view,
|
||||
bool prefer_speculative) const {
|
||||
if (is_guest_view)
|
||||
*is_guest_view = false;
|
||||
|
||||
if (frame_id < 0)
|
||||
if (!frame_util::IsValidGlobalId(global_id))
|
||||
return nullptr;
|
||||
|
||||
base::AutoLock lock_scope(lock_);
|
||||
|
||||
const auto it = frame_id_map_.find(frame_id);
|
||||
const auto it = frame_id_map_.find(global_id);
|
||||
if (it != frame_id_map_.end()) {
|
||||
const auto info = it->second;
|
||||
|
||||
@@ -299,21 +266,10 @@ CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForId(
|
||||
if (info->is_main_frame_ && main_frame_) {
|
||||
// Always prefer the non-speculative main frame.
|
||||
return main_frame_;
|
||||
} else {
|
||||
// Always prefer an existing non-speculative frame for the same node ID.
|
||||
bool is_guest_view_tmp;
|
||||
auto frame = GetFrameForFrameTreeNodeInternal(info->frame_tree_node_id_,
|
||||
&is_guest_view_tmp);
|
||||
if (is_guest_view_tmp) {
|
||||
if (is_guest_view)
|
||||
*is_guest_view = true;
|
||||
return nullptr;
|
||||
}
|
||||
if (frame)
|
||||
return frame;
|
||||
}
|
||||
|
||||
LOG(WARNING) << "Returning a speculative frame for frame id " << frame_id;
|
||||
LOG(WARNING) << "Returning a speculative frame for "
|
||||
<< frame_util::GetFrameDebugString(global_id);
|
||||
}
|
||||
|
||||
DCHECK(info->frame_);
|
||||
@@ -323,19 +279,6 @@ CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForId(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForFrameTreeNode(
|
||||
int frame_tree_node_id,
|
||||
bool* is_guest_view) const {
|
||||
if (is_guest_view)
|
||||
*is_guest_view = false;
|
||||
|
||||
if (frame_tree_node_id < 0)
|
||||
return nullptr;
|
||||
|
||||
base::AutoLock lock_scope(lock_);
|
||||
return GetFrameForFrameTreeNodeInternal(frame_tree_node_id, is_guest_view);
|
||||
}
|
||||
|
||||
CefBrowserInfo::FrameHostList CefBrowserInfo::GetAllFrames() const {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
FrameHostList frames;
|
||||
@@ -402,59 +345,6 @@ void CefBrowserInfo::MaybeExecuteFrameNotification(
|
||||
std::move(pending_action).Run(frame_handler);
|
||||
}
|
||||
|
||||
void CefBrowserInfo::MaybeUpdateFrameTreeNodeIdMap(FrameInfo* info) {
|
||||
lock_.AssertAcquired();
|
||||
|
||||
auto it = frame_tree_node_id_map_.find(info->frame_tree_node_id_);
|
||||
const bool has_entry = (it != frame_tree_node_id_map_.end());
|
||||
|
||||
if (has_entry && it->second == info) {
|
||||
// Already mapping to |info|.
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't replace an existing node ID entry with a speculative RFH, but do
|
||||
// add an entry if one doesn't already exist.
|
||||
if (!info->is_speculative_ || !has_entry) {
|
||||
// A new RFH with the same node ID may be added before the old RFH is
|
||||
// deleted. To avoid duplicate entries in the map remove the old entry, if
|
||||
// any, before adding the new entry.
|
||||
if (has_entry)
|
||||
frame_tree_node_id_map_.erase(it);
|
||||
|
||||
frame_tree_node_id_map_.insert(
|
||||
std::make_pair(info->frame_tree_node_id_, info));
|
||||
}
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForFrameTreeNodeInternal(
|
||||
int frame_tree_node_id,
|
||||
bool* is_guest_view) const {
|
||||
if (is_guest_view)
|
||||
*is_guest_view = false;
|
||||
|
||||
lock_.AssertAcquired();
|
||||
|
||||
const auto it = frame_tree_node_id_map_.find(frame_tree_node_id);
|
||||
if (it != frame_tree_node_id_map_.end()) {
|
||||
const auto info = it->second;
|
||||
|
||||
LOG_IF(WARNING, info->is_speculative_)
|
||||
<< "Returning a speculative frame for node id " << frame_tree_node_id;
|
||||
|
||||
if (info->is_guest_view_) {
|
||||
if (is_guest_view)
|
||||
*is_guest_view = true;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DCHECK(info->frame_);
|
||||
return info->frame_;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Passing in |browser| here because |browser_| may already be cleared.
|
||||
void CefBrowserInfo::SetMainFrame(CefRefPtr<CefBrowserHostBase> browser,
|
||||
CefRefPtr<CefFrameHostImpl> frame) {
|
||||
@@ -542,7 +432,6 @@ void CefBrowserInfo::RemoveAllFrames(
|
||||
|
||||
// Clear the lookup maps.
|
||||
frame_id_map_.clear();
|
||||
frame_tree_node_id_map_.clear();
|
||||
|
||||
// Explicitly Detach everything but the current main frame.
|
||||
for (auto& info : frame_info_set_) {
|
||||
@@ -562,6 +451,8 @@ void CefBrowserInfo::RemoveAllFrames(
|
||||
CefBrowserInfo::NotificationStateLock::NotificationStateLock(
|
||||
CefBrowserInfo* browser_info)
|
||||
: browser_info_(browser_info) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
// Take the navigation state lock.
|
||||
{
|
||||
base::AutoLock lock_scope_(browser_info_->notification_lock_);
|
||||
@@ -576,6 +467,8 @@ CefBrowserInfo::NotificationStateLock::NotificationStateLock(
|
||||
}
|
||||
|
||||
CefBrowserInfo::NotificationStateLock::~NotificationStateLock() {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
// Unlock in reverse order.
|
||||
browser_info_lock_scope_.reset();
|
||||
|
||||
@@ -588,11 +481,8 @@ CefBrowserInfo::NotificationStateLock::~NotificationStateLock() {
|
||||
if (!queue_.empty()) {
|
||||
DCHECK(frame_handler_);
|
||||
|
||||
scoped_refptr<NavigationLock> nav_lock;
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
// Don't navigate while inside callbacks.
|
||||
nav_lock = browser_info_->CreateNavigationLock();
|
||||
}
|
||||
// Don't navigate while inside callbacks.
|
||||
auto nav_lock = browser_info_->CreateNavigationLock();
|
||||
|
||||
// Empty the queue of pending actions. Any of these actions might result in
|
||||
// the acquisition of a new NotificationStateLock.
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/synchronization/lock.h"
|
||||
#include "base/values.h"
|
||||
#include "content/public/browser/global_routing_id.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
|
||||
class CefBrowserHostBase;
|
||||
@@ -85,7 +86,8 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
// is invalid the current main frame will be specified as the parent.
|
||||
// Temporary frame objects are not tracked but will be implicitly detached
|
||||
// on browser destruction.
|
||||
CefRefPtr<CefFrameHostImpl> CreateTempSubFrame(int64_t parent_frame_id);
|
||||
CefRefPtr<CefFrameHostImpl> CreateTempSubFrame(
|
||||
const content::GlobalRenderFrameHostId& parent_global_id);
|
||||
|
||||
// Returns the frame object matching the specified host or nullptr if no match
|
||||
// is found. Nullptr will also be returned if a guest view match is found
|
||||
@@ -97,36 +99,16 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
bool* is_guest_view = nullptr,
|
||||
bool prefer_speculative = false) const;
|
||||
|
||||
// Returns the frame object matching the specified IDs or nullptr if no match
|
||||
// is found. Nullptr will also be returned if a guest view match is found
|
||||
// because we don't create frame objects for guest views. If |is_guest_view|
|
||||
// is non-nullptr it will be set to true in this case. Safe to call from any
|
||||
// thread.
|
||||
CefRefPtr<CefFrameHostImpl> GetFrameForRoute(
|
||||
int32_t render_process_id,
|
||||
int32_t render_routing_id,
|
||||
bool* is_guest_view = nullptr,
|
||||
bool prefer_speculative = false) const;
|
||||
|
||||
// Returns the frame object matching the specified ID or nullptr if no match
|
||||
// is found. Nullptr will also be returned if a guest view match is found
|
||||
// because we don't create frame objects for guest views. If |is_guest_view|
|
||||
// is non-nullptr it will be set to true in this case. Safe to call from any
|
||||
// thread.
|
||||
CefRefPtr<CefFrameHostImpl> GetFrameForId(
|
||||
int64_t frame_id,
|
||||
CefRefPtr<CefFrameHostImpl> GetFrameForGlobalId(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool* is_guest_view = nullptr,
|
||||
bool prefer_speculative = false) const;
|
||||
|
||||
// Returns the frame object matching the specified ID or nullptr if no match
|
||||
// is found. Nullptr will also be returned if a guest view match is found
|
||||
// because we don't create frame objects for guest views. If |is_guest_view|
|
||||
// is non-nullptr it will be set to true in this case. Safe to call from any
|
||||
// thread.
|
||||
CefRefPtr<CefFrameHostImpl> GetFrameForFrameTreeNode(
|
||||
int frame_tree_node_id,
|
||||
bool* is_guest_view = nullptr) const;
|
||||
|
||||
// Returns all non-speculative frame objects that currently exist. Guest views
|
||||
// will be excluded because they don't have a frame object. Safe to call from
|
||||
// any thread.
|
||||
@@ -178,8 +160,7 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
}
|
||||
|
||||
content::RenderFrameHost* host_;
|
||||
int64_t frame_id_; // Combination of render_process_id + render_routing_id.
|
||||
int frame_tree_node_id_;
|
||||
content::GlobalRenderFrameHostId global_id_;
|
||||
bool is_guest_view_;
|
||||
bool is_main_frame_;
|
||||
bool is_speculative_;
|
||||
@@ -187,12 +168,6 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
CefRefPtr<CefFrameHostImpl> frame_;
|
||||
};
|
||||
|
||||
void MaybeUpdateFrameTreeNodeIdMap(FrameInfo* info);
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> GetFrameForFrameTreeNodeInternal(
|
||||
int frame_tree_node_id,
|
||||
bool* is_guest_view = nullptr) const;
|
||||
|
||||
void SetMainFrame(CefRefPtr<CefBrowserHostBase> browser,
|
||||
CefRefPtr<CefFrameHostImpl> frame);
|
||||
|
||||
@@ -217,7 +192,7 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
// Used instead of |base::AutoLock(lock_)| in situations that might generate
|
||||
// CefFrameHandler notifications. Any notifications passed to
|
||||
// MaybeExecuteFrameNotification() will be queued until the lock is released,
|
||||
// and then executed in order.
|
||||
// and then executed in order. Only accessed on the UI thread.
|
||||
class NotificationStateLock final {
|
||||
public:
|
||||
explicit NotificationStateLock(CefBrowserInfo* browser_info);
|
||||
@@ -244,18 +219,18 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
CefRefPtr<CefBrowserHostBase> browser_;
|
||||
|
||||
// Owner of FrameInfo structs.
|
||||
typedef std::set<std::unique_ptr<FrameInfo>, base::UniquePtrComparator>
|
||||
FrameInfoSet;
|
||||
using FrameInfoSet =
|
||||
std::set<std::unique_ptr<FrameInfo>, base::UniquePtrComparator>;
|
||||
FrameInfoSet frame_info_set_;
|
||||
|
||||
// Map a frame ID (e.g. MakeFrameId(process_id, routing_id)) to one frame.
|
||||
typedef std::unordered_map<int64_t, FrameInfo*> FrameIDMap;
|
||||
// Map a global ID to one frame. These IDs are guaranteed to uniquely
|
||||
// identify a RFH for its complete lifespan. See documentation on
|
||||
// RenderFrameHost::GetFrameTreeNodeId() for background.
|
||||
using FrameIDMap = std::unordered_map<content::GlobalRenderFrameHostId,
|
||||
FrameInfo*,
|
||||
content::GlobalRenderFrameHostIdHasher>;
|
||||
FrameIDMap frame_id_map_;
|
||||
|
||||
// Map a frame_tree_node_id to one frame.
|
||||
typedef std::unordered_map<int, FrameInfo*> FrameTreeNodeIDMap;
|
||||
FrameTreeNodeIDMap frame_tree_node_id_map_;
|
||||
|
||||
// The current main frame.
|
||||
CefRefPtr<CefFrameHostImpl> main_frame_;
|
||||
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
#include "libcef/common/values_impl.h"
|
||||
#include "libcef/features/runtime_checks.h"
|
||||
|
||||
@@ -85,19 +86,17 @@ scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreatePopupBrowserInfo(
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
|
||||
auto frame_host = new_contents->GetMainFrame();
|
||||
const int render_process_id = frame_host->GetProcess()->GetID();
|
||||
const auto frame_id = CefFrameHostImpl::MakeFrameId(frame_host);
|
||||
|
||||
scoped_refptr<CefBrowserInfo> browser_info =
|
||||
new CefBrowserInfo(++next_browser_id_, true, is_windowless, extra_info);
|
||||
browser_info_list_.push_back(browser_info);
|
||||
|
||||
// Continue any pending NewBrowserInfo request.
|
||||
auto it = pending_new_browser_info_map_.find(frame_id);
|
||||
auto it = pending_new_browser_info_map_.find(frame_host->GetGlobalId());
|
||||
if (it != pending_new_browser_info_map_.end()) {
|
||||
SendNewBrowserInfoResponse(
|
||||
render_process_id, browser_info, /*is_guest_view=*/false,
|
||||
std::move(it->second->callback), it->second->callback_runner);
|
||||
SendNewBrowserInfoResponse(browser_info, /*is_guest_view=*/false,
|
||||
std::move(it->second->callback),
|
||||
it->second->callback_runner);
|
||||
pending_new_browser_info_map_.erase(it);
|
||||
}
|
||||
|
||||
@@ -138,8 +137,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
||||
|
||||
auto pending_popup = std::make_unique<CefBrowserInfoManager::PendingPopup>();
|
||||
pending_popup->step = CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW;
|
||||
pending_popup->opener_render_process_id = opener->GetProcess()->GetID();
|
||||
pending_popup->opener_render_routing_id = opener->GetRoutingID();
|
||||
pending_popup->opener_global_id = opener->GetGlobalId();
|
||||
pending_popup->target_url = target_url;
|
||||
pending_popup->target_frame_name = frame_name;
|
||||
|
||||
@@ -210,8 +208,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
||||
|
||||
void CefBrowserInfoManager::GetCustomWebContentsView(
|
||||
const GURL& target_url,
|
||||
int opener_render_process_id,
|
||||
int opener_render_routing_id,
|
||||
const content::GlobalRenderFrameHostId& opener_global_id,
|
||||
content::WebContentsView** view,
|
||||
content::RenderViewHostDelegateView** delegate_view) {
|
||||
CEF_REQUIRE_UIT();
|
||||
@@ -219,8 +216,7 @@ void CefBrowserInfoManager::GetCustomWebContentsView(
|
||||
|
||||
std::unique_ptr<CefBrowserInfoManager::PendingPopup> pending_popup =
|
||||
PopPendingPopup(CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW,
|
||||
opener_render_process_id, opener_render_routing_id,
|
||||
target_url);
|
||||
opener_global_id, target_url);
|
||||
DCHECK(pending_popup.get());
|
||||
DCHECK(pending_popup->platform_delegate.get());
|
||||
|
||||
@@ -236,8 +232,7 @@ void CefBrowserInfoManager::GetCustomWebContentsView(
|
||||
|
||||
void CefBrowserInfoManager::WebContentsCreated(
|
||||
const GURL& target_url,
|
||||
int opener_render_process_id,
|
||||
int opener_render_routing_id,
|
||||
const content::GlobalRenderFrameHostId& opener_global_id,
|
||||
CefBrowserSettings& settings,
|
||||
CefRefPtr<CefClient>& client,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate>& platform_delegate,
|
||||
@@ -251,8 +246,7 @@ void CefBrowserInfoManager::WebContentsCreated(
|
||||
: CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW;
|
||||
|
||||
std::unique_ptr<CefBrowserInfoManager::PendingPopup> pending_popup =
|
||||
PopPendingPopup(previous_step, opener_render_process_id,
|
||||
opener_render_routing_id, target_url);
|
||||
PopPendingPopup(previous_step, opener_global_id, target_url);
|
||||
DCHECK(pending_popup.get());
|
||||
DCHECK(pending_popup->platform_delegate.get());
|
||||
|
||||
@@ -263,11 +257,9 @@ void CefBrowserInfoManager::WebContentsCreated(
|
||||
}
|
||||
|
||||
void CefBrowserInfoManager::OnGetNewBrowserInfo(
|
||||
int render_process_id,
|
||||
int render_routing_id,
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
cef::mojom::BrowserManager::GetNewBrowserInfoCallback callback) {
|
||||
DCHECK_NE(render_process_id, content::ChildProcessHost::kInvalidUniqueID);
|
||||
DCHECK_GT(render_routing_id, 0);
|
||||
DCHECK(frame_util::IsValidGlobalId(global_id));
|
||||
DCHECK(callback);
|
||||
|
||||
auto callback_runner = base::SequencedTaskRunnerHandle::Get();
|
||||
@@ -277,33 +269,29 @@ void CefBrowserInfoManager::OnGetNewBrowserInfo(
|
||||
bool is_guest_view = false;
|
||||
|
||||
scoped_refptr<CefBrowserInfo> browser_info =
|
||||
GetBrowserInfo(render_process_id, render_routing_id, &is_guest_view);
|
||||
GetBrowserInfoInternal(global_id, &is_guest_view);
|
||||
|
||||
if (browser_info.get()) {
|
||||
if (browser_info) {
|
||||
// Send the response immediately.
|
||||
SendNewBrowserInfoResponse(render_process_id, browser_info, is_guest_view,
|
||||
std::move(callback), callback_runner);
|
||||
SendNewBrowserInfoResponse(browser_info, is_guest_view, std::move(callback),
|
||||
callback_runner);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto frame_id =
|
||||
CefFrameHostImpl::MakeFrameId(render_process_id, render_routing_id);
|
||||
|
||||
// Verify that no request for the same route is currently queued.
|
||||
DCHECK(pending_new_browser_info_map_.find(frame_id) ==
|
||||
DCHECK(pending_new_browser_info_map_.find(global_id) ==
|
||||
pending_new_browser_info_map_.end());
|
||||
|
||||
const int timeout_id = ++next_timeout_id_;
|
||||
|
||||
// Queue the request.
|
||||
std::unique_ptr<PendingNewBrowserInfo> pending(new PendingNewBrowserInfo());
|
||||
pending->render_process_id = render_process_id;
|
||||
pending->render_routing_id = render_routing_id;
|
||||
pending->global_id = global_id;
|
||||
pending->timeout_id = timeout_id;
|
||||
pending->callback = std::move(callback);
|
||||
pending->callback_runner = callback_runner;
|
||||
pending_new_browser_info_map_.insert(
|
||||
std::make_pair(frame_id, std::move(pending)));
|
||||
std::make_pair(global_id, std::move(pending)));
|
||||
|
||||
// Register a timeout for the pending response so that the renderer process
|
||||
// doesn't hang forever.
|
||||
@@ -312,7 +300,7 @@ void CefBrowserInfoManager::OnGetNewBrowserInfo(
|
||||
CEF_POST_DELAYED_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefBrowserInfoManager::TimeoutNewBrowserInfoResponse,
|
||||
frame_id, timeout_id),
|
||||
global_id, timeout_id),
|
||||
kNewBrowserInfoResponseTimeoutMs);
|
||||
}
|
||||
}
|
||||
@@ -362,12 +350,11 @@ void CefBrowserInfoManager::DestroyAllBrowsers() {
|
||||
#endif
|
||||
}
|
||||
|
||||
scoped_refptr<CefBrowserInfo>
|
||||
CefBrowserInfoManager::GetBrowserInfoForFrameRoute(int render_process_id,
|
||||
int render_routing_id,
|
||||
bool* is_guest_view) {
|
||||
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::GetBrowserInfo(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool* is_guest_view) {
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
return GetBrowserInfo(render_process_id, render_routing_id, is_guest_view);
|
||||
return GetBrowserInfoInternal(global_id, is_guest_view);
|
||||
}
|
||||
|
||||
bool CefBrowserInfoManager::MaybeAllowNavigation(
|
||||
@@ -392,31 +379,6 @@ bool CefBrowserInfoManager::MaybeAllowNavigation(
|
||||
return true;
|
||||
}
|
||||
|
||||
scoped_refptr<CefBrowserInfo>
|
||||
CefBrowserInfoManager::GetBrowserInfoForFrameTreeNode(int frame_tree_node_id,
|
||||
bool* is_guest_view) {
|
||||
if (is_guest_view)
|
||||
*is_guest_view = false;
|
||||
|
||||
if (frame_tree_node_id < 0)
|
||||
return nullptr;
|
||||
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
|
||||
for (const auto& browser_info : browser_info_list_) {
|
||||
bool is_guest_view_tmp;
|
||||
auto frame = browser_info->GetFrameForFrameTreeNode(frame_tree_node_id,
|
||||
&is_guest_view_tmp);
|
||||
if (frame || is_guest_view_tmp) {
|
||||
if (is_guest_view)
|
||||
*is_guest_view = is_guest_view_tmp;
|
||||
return browser_info;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CefBrowserInfoManager::BrowserInfoList
|
||||
CefBrowserInfoManager::GetBrowserInfoList() {
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
@@ -442,7 +404,7 @@ void CefBrowserInfoManager::RenderProcessHostDestroyed(
|
||||
pending_new_browser_info_map_.begin();
|
||||
while (it != pending_new_browser_info_map_.end()) {
|
||||
const auto& info = it->second;
|
||||
if (info->render_process_id == render_process_id) {
|
||||
if (info->global_id.child_id == render_process_id) {
|
||||
CancelNewBrowserInfoResponse(info.get());
|
||||
it = pending_new_browser_info_map_.erase(it);
|
||||
} else {
|
||||
@@ -456,7 +418,7 @@ void CefBrowserInfoManager::RenderProcessHostDestroyed(
|
||||
PendingPopupList::iterator it = pending_popup_list_.begin();
|
||||
while (it != pending_popup_list_.end()) {
|
||||
PendingPopup* popup = it->get();
|
||||
if (popup->opener_render_process_id == render_process_id) {
|
||||
if (popup->opener_global_id.child_id == render_process_id) {
|
||||
it = pending_popup_list_.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
@@ -472,20 +434,17 @@ void CefBrowserInfoManager::PushPendingPopup(
|
||||
}
|
||||
|
||||
std::unique_ptr<CefBrowserInfoManager::PendingPopup>
|
||||
CefBrowserInfoManager::PopPendingPopup(PendingPopup::Step step,
|
||||
int opener_render_process_id,
|
||||
int opener_render_routing_id,
|
||||
const GURL& target_url) {
|
||||
CefBrowserInfoManager::PopPendingPopup(
|
||||
PendingPopup::Step step,
|
||||
const content::GlobalRenderFrameHostId& opener_global_id,
|
||||
const GURL& target_url) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK_GT(opener_render_process_id, 0);
|
||||
DCHECK_GT(opener_render_routing_id, 0);
|
||||
DCHECK(frame_util::IsValidGlobalId(opener_global_id));
|
||||
|
||||
PendingPopupList::iterator it = pending_popup_list_.begin();
|
||||
for (; it != pending_popup_list_.end(); ++it) {
|
||||
PendingPopup* popup = it->get();
|
||||
if (popup->step == step &&
|
||||
popup->opener_render_process_id == opener_render_process_id &&
|
||||
popup->opener_render_routing_id == opener_render_routing_id &&
|
||||
if (popup->step == step && popup->opener_global_id == opener_global_id &&
|
||||
popup->target_url == target_url) {
|
||||
// Transfer ownership of the pointer.
|
||||
it->release();
|
||||
@@ -497,22 +456,21 @@ CefBrowserInfoManager::PopPendingPopup(PendingPopup::Step step,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::GetBrowserInfo(
|
||||
int render_process_id,
|
||||
int render_routing_id,
|
||||
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::GetBrowserInfoInternal(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool* is_guest_view) {
|
||||
browser_info_lock_.AssertAcquired();
|
||||
|
||||
if (is_guest_view)
|
||||
*is_guest_view = false;
|
||||
|
||||
if (render_process_id < 0 || render_routing_id < 0)
|
||||
if (!frame_util::IsValidGlobalId(global_id))
|
||||
return nullptr;
|
||||
|
||||
for (const auto& browser_info : browser_info_list_) {
|
||||
bool is_guest_view_tmp;
|
||||
auto frame = browser_info->GetFrameForRoute(
|
||||
render_process_id, render_routing_id, &is_guest_view_tmp);
|
||||
auto frame =
|
||||
browser_info->GetFrameForGlobalId(global_id, &is_guest_view_tmp);
|
||||
if (frame || is_guest_view_tmp) {
|
||||
if (is_guest_view)
|
||||
*is_guest_view = is_guest_view_tmp;
|
||||
@@ -525,7 +483,6 @@ scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::GetBrowserInfo(
|
||||
|
||||
// static
|
||||
void CefBrowserInfoManager::SendNewBrowserInfoResponse(
|
||||
int render_process_id,
|
||||
scoped_refptr<CefBrowserInfo> browser_info,
|
||||
bool is_guest_view,
|
||||
cef::mojom::BrowserManager::GetNewBrowserInfoCallback callback,
|
||||
@@ -534,8 +491,8 @@ void CefBrowserInfoManager::SendNewBrowserInfoResponse(
|
||||
callback_runner->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(&CefBrowserInfoManager::SendNewBrowserInfoResponse,
|
||||
render_process_id, browser_info, is_guest_view,
|
||||
std::move(callback), callback_runner));
|
||||
browser_info, is_guest_view, std::move(callback),
|
||||
callback_runner));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -565,31 +522,30 @@ void CefBrowserInfoManager::SendNewBrowserInfoResponse(
|
||||
// static
|
||||
void CefBrowserInfoManager::CancelNewBrowserInfoResponse(
|
||||
PendingNewBrowserInfo* pending_info) {
|
||||
SendNewBrowserInfoResponse(pending_info->render_process_id,
|
||||
/*browser_info=*/nullptr, /*is_guest_view=*/false,
|
||||
SendNewBrowserInfoResponse(/*browser_info=*/nullptr, /*is_guest_view=*/false,
|
||||
std::move(pending_info->callback),
|
||||
pending_info->callback_runner);
|
||||
}
|
||||
|
||||
// static
|
||||
void CefBrowserInfoManager::TimeoutNewBrowserInfoResponse(int64_t frame_id,
|
||||
int timeout_id) {
|
||||
void CefBrowserInfoManager::TimeoutNewBrowserInfoResponse(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
int timeout_id) {
|
||||
if (!g_info_manager)
|
||||
return;
|
||||
|
||||
base::AutoLock lock_scope(g_info_manager->browser_info_lock_);
|
||||
|
||||
// Continue the NewBrowserInfo request if it's still pending.
|
||||
auto it = g_info_manager->pending_new_browser_info_map_.find(frame_id);
|
||||
auto it = g_info_manager->pending_new_browser_info_map_.find(global_id);
|
||||
if (it != g_info_manager->pending_new_browser_info_map_.end()) {
|
||||
const auto& pending_info = it->second;
|
||||
// Don't accidentally timeout a new request for the same frame.
|
||||
if (pending_info->timeout_id != timeout_id)
|
||||
return;
|
||||
|
||||
LOG(ERROR) << "Timeout of new browser info response for frame process id "
|
||||
<< pending_info->render_process_id << " and routing id "
|
||||
<< pending_info->render_routing_id;
|
||||
LOG(ERROR) << "Timeout of new browser info response for frame "
|
||||
<< frame_util::GetFrameDebugString(global_id);
|
||||
|
||||
CancelNewBrowserInfoResponse(pending_info.get());
|
||||
g_info_manager->pending_new_browser_info_map_.erase(it);
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#include "base/sequenced_task_runner.h"
|
||||
#include "base/synchronization/lock.h"
|
||||
#include "cef/libcef/common/mojom/cef.mojom.h"
|
||||
#include "content/public/browser/global_routing_id.h"
|
||||
#include "content/public/browser/render_process_host_observer.h"
|
||||
#include "third_party/blink/public/mojom/window_features/window_features.mojom.h"
|
||||
#include "ui/base/window_open_disposition.h"
|
||||
@@ -79,8 +80,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
// only). See comments on PendingPopup for more information.
|
||||
void GetCustomWebContentsView(
|
||||
const GURL& target_url,
|
||||
int opener_render_process_id,
|
||||
int opener_render_routing_id,
|
||||
const content::GlobalRenderFrameHostId& opener_global_id,
|
||||
content::WebContentsView** view,
|
||||
content::RenderViewHostDelegateView** delegate_view);
|
||||
|
||||
@@ -88,8 +88,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
// PendingPopup for more information.
|
||||
void WebContentsCreated(
|
||||
const GURL& target_url,
|
||||
int opener_render_process_id,
|
||||
int opener_render_routing_id,
|
||||
const content::GlobalRenderFrameHostId& opener_global_id,
|
||||
CefBrowserSettings& settings,
|
||||
CefRefPtr<CefClient>& client,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate>& platform_delegate,
|
||||
@@ -103,8 +102,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
// already exist for traditional popup browsers depending on timing. See
|
||||
// comments on PendingPopup for more information.
|
||||
void OnGetNewBrowserInfo(
|
||||
int render_process_id,
|
||||
int render_routing_id,
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
cef::mojom::BrowserManager::GetNewBrowserInfoCallback callback);
|
||||
|
||||
// Called from CefBrowserHostBase::DestroyBrowser() when a browser is
|
||||
@@ -114,25 +112,14 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
// Called from CefContext::FinishShutdownOnUIThread() to destroy all browsers.
|
||||
void DestroyAllBrowsers();
|
||||
|
||||
// Returns the CefBrowserInfo matching the specified IDs or nullptr if no
|
||||
// Returns the CefBrowserInfo matching the specified ID or nullptr if no
|
||||
// match is found. It is allowed to add new callers of this method but
|
||||
// consider using CefBrowserHostBase::GetBrowserForFrameRoute() or
|
||||
// extensions::GetOwnerBrowserForFrameRoute() instead. If |is_guest_view| is
|
||||
// non-nullptr it will be set to true if the IDs match a guest view associated
|
||||
// with the returned browser info instead of the browser itself.
|
||||
scoped_refptr<CefBrowserInfo> GetBrowserInfoForFrameRoute(
|
||||
int render_process_id,
|
||||
int render_routing_id,
|
||||
bool* is_guest_view = nullptr);
|
||||
|
||||
// Returns the CefBrowserInfo matching the specified ID or nullptr if no match
|
||||
// is found. It is allowed to add new callers of this method but consider
|
||||
// using CefBrowserHostBase::GetBrowserForFrameTreeNode() instead. If
|
||||
// |is_guest_view| is non-nullptr it will be set to true if the IDs match a
|
||||
// guest view associated with the returned browser info instead of the browser
|
||||
// itself.
|
||||
scoped_refptr<CefBrowserInfo> GetBrowserInfoForFrameTreeNode(
|
||||
int frame_tree_node_id,
|
||||
// consider using CefBrowserHostBase::GetBrowserForGlobalId() or
|
||||
// extensions::GetOwnerBrowserForGlobalId() instead. If |is_guest_view| is
|
||||
// non-nullptr it will be set to true if the ID matches a guest view
|
||||
// associated with the returned browser info instead of the browser itself.
|
||||
scoped_refptr<CefBrowserInfo> GetBrowserInfo(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool* is_guest_view = nullptr);
|
||||
|
||||
// Returns all existing CefBrowserInfo objects.
|
||||
@@ -176,8 +163,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
// Initial state from ViewHostMsg_CreateWindow.
|
||||
// |target_url| will be empty if a popup is created via window.open() and
|
||||
// never navigated. For example: javascript:window.open();
|
||||
int opener_render_process_id;
|
||||
int opener_render_routing_id;
|
||||
content::GlobalRenderFrameHostId opener_global_id;
|
||||
GURL target_url;
|
||||
std::string target_frame_name;
|
||||
|
||||
@@ -192,20 +178,18 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
|
||||
// Manage pending popups. Only called on the UI thread.
|
||||
void PushPendingPopup(std::unique_ptr<PendingPopup> popup);
|
||||
std::unique_ptr<PendingPopup> PopPendingPopup(PendingPopup::Step step,
|
||||
int opener_process_id,
|
||||
int opener_routing_id,
|
||||
const GURL& target_url);
|
||||
std::unique_ptr<PendingPopup> PopPendingPopup(
|
||||
PendingPopup::Step step,
|
||||
const content::GlobalRenderFrameHostId& opener_global_id,
|
||||
const GURL& target_url);
|
||||
|
||||
// Retrieves the BrowserInfo matching the specified IDs. If both sets are
|
||||
// valid then this method makes sure both sets have been registered.
|
||||
scoped_refptr<CefBrowserInfo> GetBrowserInfo(int render_process_id,
|
||||
int render_routing_id,
|
||||
bool* is_guest_view);
|
||||
// Retrieves the BrowserInfo matching the specified ID.
|
||||
scoped_refptr<CefBrowserInfo> GetBrowserInfoInternal(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool* is_guest_view);
|
||||
|
||||
// Send the response for a pending OnGetNewBrowserInfo request.
|
||||
static void SendNewBrowserInfoResponse(
|
||||
int render_process_id,
|
||||
scoped_refptr<CefBrowserInfo> browser_info,
|
||||
bool is_guest_view,
|
||||
cef::mojom::BrowserManager::GetNewBrowserInfoCallback callback,
|
||||
@@ -213,8 +197,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
|
||||
// Pending request for OnGetNewBrowserInfo.
|
||||
struct PendingNewBrowserInfo {
|
||||
int render_process_id;
|
||||
int render_routing_id;
|
||||
content::GlobalRenderFrameHostId global_id;
|
||||
int timeout_id;
|
||||
cef::mojom::BrowserManager::GetNewBrowserInfoCallback callback;
|
||||
scoped_refptr<base::SequencedTaskRunner> callback_runner;
|
||||
@@ -224,7 +207,9 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
static void CancelNewBrowserInfoResponse(PendingNewBrowserInfo* pending_info);
|
||||
|
||||
// Time out a response if it's still pending.
|
||||
static void TimeoutNewBrowserInfoResponse(int64_t frame_id, int timeout_id);
|
||||
static void TimeoutNewBrowserInfoResponse(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
int timeout_id);
|
||||
|
||||
mutable base::Lock browser_info_lock_;
|
||||
|
||||
@@ -233,9 +218,12 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
BrowserInfoList browser_info_list_;
|
||||
int next_browser_id_ = 0;
|
||||
|
||||
// Map of frame ID to info.
|
||||
// Map of global ID to info. These IDs are guaranteed to uniquely
|
||||
// identify a RFH for its complete lifespan. See documentation on
|
||||
// RenderFrameHost::GetFrameTreeNodeId() for background.
|
||||
using PendingNewBrowserInfoMap =
|
||||
std::map<int64_t, std::unique_ptr<PendingNewBrowserInfo>>;
|
||||
std::map<content::GlobalRenderFrameHostId,
|
||||
std::unique_ptr<PendingNewBrowserInfo>>;
|
||||
PendingNewBrowserInfoMap pending_new_browser_info_map_;
|
||||
|
||||
// Only accessed on the UI thread.
|
||||
|
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "libcef/browser/browser_info_manager.h"
|
||||
#include "libcef/browser/origin_whitelist_impl.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||
@@ -52,5 +53,6 @@ void CefBrowserManager::GetNewBrowserInfo(
|
||||
int32_t render_frame_routing_id,
|
||||
cef::mojom::BrowserManager::GetNewBrowserInfoCallback callback) {
|
||||
CefBrowserInfoManager::GetInstance()->OnGetNewBrowserInfo(
|
||||
render_process_id_, render_frame_routing_id, std::move(callback));
|
||||
frame_util::MakeGlobalId(render_process_id_, render_frame_routing_id),
|
||||
std::move(callback));
|
||||
}
|
||||
|
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/browser/profiles/off_the_record_profile_impl.h"
|
||||
#include "chrome/browser/profiles/profile_keep_alive_types.h"
|
||||
@@ -105,6 +106,9 @@ void ChromeBrowserContext::ProfileCreated(Profile* profile,
|
||||
CHECK(!profile);
|
||||
CHECK(!profile_);
|
||||
|
||||
// Profile creation may access the filesystem.
|
||||
base::ScopedAllowBlockingForTesting allow_blocking;
|
||||
|
||||
// Creation of a disk-based profile failed for some reason. Create a
|
||||
// new/unique OffTheRecord profile instead.
|
||||
const auto& profile_id = Profile::OTRProfileID::CreateUniqueForCEF();
|
||||
|
@@ -13,10 +13,12 @@
|
||||
#include "libcef/browser/chrome/chrome_browser_host_impl.h"
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
#include "libcef/common/app_manager.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/ui/browser.h"
|
||||
#include "chrome/browser/ui/browser_tabstrip.h"
|
||||
#include "content/public/browser/global_routing_id.h"
|
||||
#include "content/public/browser/keyboard_event_processing_result.h"
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
|
||||
@@ -83,8 +85,10 @@ void ChromeBrowserDelegate::WebContentsCreated(
|
||||
CefRefPtr<CefDictionaryValue> extra_info;
|
||||
|
||||
CefBrowserInfoManager::GetInstance()->WebContentsCreated(
|
||||
target_url, opener_render_process_id, opener_render_frame_id, settings,
|
||||
client, platform_delegate, extra_info);
|
||||
target_url,
|
||||
frame_util::MakeGlobalId(opener_render_process_id,
|
||||
opener_render_frame_id),
|
||||
settings, client, platform_delegate, extra_info);
|
||||
|
||||
auto opener = ChromeBrowserHostImpl::GetBrowserForContents(source_contents);
|
||||
if (!opener) {
|
||||
|
@@ -86,21 +86,10 @@ CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserHostImpl::GetBrowserForContents(
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<ChromeBrowserHostImpl>
|
||||
ChromeBrowserHostImpl::GetBrowserForFrameTreeNode(int frame_tree_node_id) {
|
||||
CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserHostImpl::GetBrowserForGlobalId(
|
||||
const content::GlobalRenderFrameHostId& global_id) {
|
||||
REQUIRE_CHROME_RUNTIME();
|
||||
auto browser =
|
||||
CefBrowserHostBase::GetBrowserForFrameTreeNode(frame_tree_node_id);
|
||||
return static_cast<ChromeBrowserHostImpl*>(browser.get());
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserHostImpl::GetBrowserForFrameRoute(
|
||||
int render_process_id,
|
||||
int render_routing_id) {
|
||||
REQUIRE_CHROME_RUNTIME();
|
||||
auto browser = CefBrowserHostBase::GetBrowserForFrameRoute(render_process_id,
|
||||
render_routing_id);
|
||||
auto browser = CefBrowserHostBase::GetBrowserForGlobalId(global_id);
|
||||
return static_cast<ChromeBrowserHostImpl*>(browser.get());
|
||||
}
|
||||
|
||||
|
@@ -44,13 +44,9 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
|
||||
// Returns the browser associated with the specified WebContents.
|
||||
static CefRefPtr<ChromeBrowserHostImpl> GetBrowserForContents(
|
||||
const content::WebContents* contents);
|
||||
// Returns the browser associated with the specified FrameTreeNode ID.
|
||||
static CefRefPtr<ChromeBrowserHostImpl> GetBrowserForFrameTreeNode(
|
||||
int frame_tree_node_id);
|
||||
// Returns the browser associated with the specified frame routing IDs.
|
||||
static CefRefPtr<ChromeBrowserHostImpl> GetBrowserForFrameRoute(
|
||||
int render_process_id,
|
||||
int render_routing_id);
|
||||
// Returns the browser associated with the specified global ID.
|
||||
static CefRefPtr<ChromeBrowserHostImpl> GetBrowserForGlobalId(
|
||||
const content::GlobalRenderFrameHostId& global_id);
|
||||
|
||||
~ChromeBrowserHostImpl() override;
|
||||
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#include "libcef/browser/browser_info_manager.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
#include "libcef/features/runtime_checks.h"
|
||||
|
||||
#include "chrome/browser/browser_process.h"
|
||||
@@ -73,29 +74,27 @@ content::WebContents* GetOwnerForGuestContents(content::WebContents* guest) {
|
||||
return print_preview_controller->GetInitiator(guest);
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowserHostBase> GetOwnerBrowserForFrameRoute(
|
||||
int render_process_id,
|
||||
int render_routing_id,
|
||||
CefRefPtr<CefBrowserHostBase> GetOwnerBrowserForGlobalId(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool* is_guest_view) {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
// Use the non-thread-safe but potentially faster approach.
|
||||
content::RenderFrameHost* host =
|
||||
content::RenderFrameHost::FromID(render_process_id, render_routing_id);
|
||||
content::RenderFrameHost::FromID(global_id);
|
||||
if (host)
|
||||
return GetOwnerBrowserForHost(host, is_guest_view);
|
||||
return nullptr;
|
||||
} else {
|
||||
// Use the thread-safe approach.
|
||||
scoped_refptr<CefBrowserInfo> info =
|
||||
CefBrowserInfoManager::GetInstance()->GetBrowserInfoForFrameRoute(
|
||||
render_process_id, render_routing_id, is_guest_view);
|
||||
CefBrowserInfoManager::GetInstance()->GetBrowserInfo(global_id,
|
||||
is_guest_view);
|
||||
if (info.get()) {
|
||||
CefRefPtr<CefBrowserHostBase> browser = info->browser();
|
||||
if (!browser.get()) {
|
||||
LOG(WARNING) << "Found browser id " << info->browser_id()
|
||||
<< " but no browser object matching view process id "
|
||||
<< render_process_id << " and frame routing id "
|
||||
<< render_routing_id;
|
||||
<< " but no browser object matching frame "
|
||||
<< frame_util::GetFrameDebugString(global_id);
|
||||
}
|
||||
return browser;
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@
|
||||
|
||||
namespace content {
|
||||
class BrowserContext;
|
||||
struct GlobalRenderFrameHostId;
|
||||
class RenderFrameHost;
|
||||
class RenderViewHost;
|
||||
class WebContents;
|
||||
@@ -37,12 +38,11 @@ void GetAllGuestsForOwnerContents(content::WebContents* owner,
|
||||
content::WebContents* GetOwnerForGuestContents(content::WebContents* guest);
|
||||
|
||||
// Returns the CefBrowserHostBase that owns the host identified by the specified
|
||||
// routing IDs, if any. |is_guest_view| will be set to true if the IDs
|
||||
// match a guest view associated with the returned browser instead of the
|
||||
// global ID, if any. |is_guest_view| will be set to true if the ID
|
||||
// matches a guest view associated with the returned browser instead of the
|
||||
// browser itself.
|
||||
CefRefPtr<CefBrowserHostBase> GetOwnerBrowserForFrameRoute(
|
||||
int render_process_id,
|
||||
int render_routing_id,
|
||||
CefRefPtr<CefBrowserHostBase> GetOwnerBrowserForGlobalId(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool* is_guest_view);
|
||||
|
||||
// Returns the CefBrowserHostBase that owns the specified |host|, if any.
|
||||
|
@@ -68,14 +68,15 @@ CefFrameHostImpl::CefFrameHostImpl(scoped_refptr<CefBrowserInfo> browser_info,
|
||||
CefFrameHostImpl::CefFrameHostImpl(scoped_refptr<CefBrowserInfo> browser_info,
|
||||
content::RenderFrameHost* render_frame_host)
|
||||
: is_main_frame_(render_frame_host->GetParent() == nullptr),
|
||||
frame_id_(MakeFrameId(render_frame_host)),
|
||||
frame_id_(frame_util::MakeFrameId(render_frame_host->GetGlobalId())),
|
||||
browser_info_(browser_info),
|
||||
is_focused_(is_main_frame_), // The main frame always starts focused.
|
||||
url_(render_frame_host->GetLastCommittedURL().spec()),
|
||||
name_(render_frame_host->GetFrameName()),
|
||||
parent_frame_id_(is_main_frame_
|
||||
? kInvalidFrameId
|
||||
: MakeFrameId(render_frame_host->GetParent())),
|
||||
parent_frame_id_(
|
||||
is_main_frame_ ? kInvalidFrameId
|
||||
: frame_util::MakeFrameId(
|
||||
render_frame_host->GetParent()->GetGlobalId())),
|
||||
render_frame_host_(render_frame_host) {
|
||||
DCHECK(browser_info_);
|
||||
}
|
||||
@@ -276,8 +277,10 @@ void CefFrameHostImpl::RefreshAttributes() {
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_main_frame_)
|
||||
parent_frame_id_ = MakeFrameId(render_frame_host_->GetParent());
|
||||
if (!is_main_frame_) {
|
||||
parent_frame_id_ =
|
||||
frame_util::MakeFrameId(render_frame_host_->GetParent()->GetGlobalId());
|
||||
}
|
||||
}
|
||||
|
||||
void CefFrameHostImpl::NotifyMoveOrResizeStarted() {
|
||||
@@ -457,20 +460,6 @@ bool CefFrameHostImpl::Detach() {
|
||||
return first_detach;
|
||||
}
|
||||
|
||||
// static
|
||||
int64_t CefFrameHostImpl::MakeFrameId(const content::RenderFrameHost* host) {
|
||||
CEF_REQUIRE_UIT();
|
||||
auto host_nonconst = const_cast<content::RenderFrameHost*>(host);
|
||||
return MakeFrameId(host_nonconst->GetProcess()->GetID(),
|
||||
host_nonconst->GetRoutingID());
|
||||
}
|
||||
|
||||
// static
|
||||
int64_t CefFrameHostImpl::MakeFrameId(int32_t render_process_id,
|
||||
int32_t render_routing_id) {
|
||||
return frame_util::MakeFrameId(render_process_id, render_routing_id);
|
||||
}
|
||||
|
||||
// kMainFrameId must be -1 to align with renderer expectations.
|
||||
const int64_t CefFrameHostImpl::kMainFrameId = -1;
|
||||
const int64_t CefFrameHostImpl::kFocusedFrameId = -2;
|
||||
|
@@ -128,10 +128,6 @@ class CefFrameHostImpl : public CefFrame, public cef::mojom::BrowserFrame {
|
||||
absl::optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions)
|
||||
override;
|
||||
|
||||
static int64_t MakeFrameId(const content::RenderFrameHost* host);
|
||||
static int64_t MakeFrameId(int32_t render_process_id,
|
||||
int32_t render_routing_id);
|
||||
|
||||
static const int64_t kMainFrameId;
|
||||
static const int64_t kFocusedFrameId;
|
||||
static const int64_t kUnspecifiedFrameId;
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "content/browser/resource_context_impl.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/global_routing_id.h"
|
||||
|
||||
CefIOThreadState::CefIOThreadState() {
|
||||
// Using base::Unretained() is safe because both this callback and possible
|
||||
@@ -27,31 +28,24 @@ CefIOThreadState::~CefIOThreadState() {
|
||||
CEF_REQUIRE_IOT();
|
||||
}
|
||||
|
||||
void CefIOThreadState::AddHandler(int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
CefRefPtr<CefRequestContextHandler> handler) {
|
||||
void CefIOThreadState::AddHandler(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
CefRefPtr<CefRequestContextHandler> handler) {
|
||||
CEF_REQUIRE_IOT();
|
||||
handler_map_.AddHandler(render_process_id, render_frame_id,
|
||||
frame_tree_node_id, handler);
|
||||
handler_map_.AddHandler(global_id, handler);
|
||||
}
|
||||
|
||||
void CefIOThreadState::RemoveHandler(int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id) {
|
||||
void CefIOThreadState::RemoveHandler(
|
||||
const content::GlobalRenderFrameHostId& global_id) {
|
||||
CEF_REQUIRE_IOT();
|
||||
handler_map_.RemoveHandler(render_process_id, render_frame_id,
|
||||
frame_tree_node_id);
|
||||
handler_map_.RemoveHandler(global_id);
|
||||
}
|
||||
|
||||
CefRefPtr<CefRequestContextHandler> CefIOThreadState::GetHandler(
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool require_frame_match) const {
|
||||
CEF_REQUIRE_IOT();
|
||||
return handler_map_.GetHandler(render_process_id, render_frame_id,
|
||||
frame_tree_node_id, require_frame_match);
|
||||
return handler_map_.GetHandler(global_id, require_frame_match);
|
||||
}
|
||||
|
||||
void CefIOThreadState::RegisterSchemeHandlerFactory(
|
||||
|
@@ -14,6 +14,10 @@
|
||||
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
|
||||
namespace content {
|
||||
struct GlobalRenderFrameHostId;
|
||||
}
|
||||
|
||||
class GURL;
|
||||
|
||||
// Stores state that will be accessed on the IO thread. Life span is controlled
|
||||
@@ -26,17 +30,11 @@ class CefIOThreadState : public base::RefCountedThreadSafe<
|
||||
CefIOThreadState();
|
||||
|
||||
// See comments in CefRequestContextHandlerMap.
|
||||
void AddHandler(int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
void AddHandler(const content::GlobalRenderFrameHostId& global_id,
|
||||
CefRefPtr<CefRequestContextHandler> handler);
|
||||
void RemoveHandler(int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id);
|
||||
void RemoveHandler(const content::GlobalRenderFrameHostId& global_id);
|
||||
CefRefPtr<CefRequestContextHandler> GetHandler(
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool require_frame_match) const;
|
||||
|
||||
// Manage scheme handler factories associated with this context.
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#include "libcef/browser/browser_host_base.h"
|
||||
#include "libcef/browser/browser_info_manager.h"
|
||||
#include "libcef/browser/frame_host_impl.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
#include "libcef/common/request_impl.h"
|
||||
|
||||
#include "components/navigation_interception/intercept_navigation_throttle.h"
|
||||
@@ -25,9 +26,8 @@ namespace {
|
||||
// |is_main_frame| argument once this problem is fixed.
|
||||
bool NavigationOnUIThread(
|
||||
bool is_main_frame,
|
||||
int64_t frame_id,
|
||||
int64_t parent_frame_id,
|
||||
int frame_tree_node_id,
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
const content::GlobalRenderFrameHostId& parent_global_id,
|
||||
content::WebContents* source,
|
||||
const navigation_interception::NavigationParams& params) {
|
||||
CEF_REQUIRE_UIT();
|
||||
@@ -53,16 +53,13 @@ bool NavigationOnUIThread(
|
||||
CefRefPtr<CefFrame> frame;
|
||||
if (is_main_frame) {
|
||||
frame = browser->GetMainFrame();
|
||||
} else if (frame_id >= 0) {
|
||||
frame = browser->GetFrame(frame_id);
|
||||
}
|
||||
if (!frame && frame_tree_node_id >= 0) {
|
||||
frame = browser->GetFrameForFrameTreeNode(frame_tree_node_id);
|
||||
} else {
|
||||
frame = browser->GetFrameForGlobalId(global_id);
|
||||
}
|
||||
if (!frame) {
|
||||
// Create a temporary frame object for navigation of sub-frames that
|
||||
// don't yet exist.
|
||||
frame = browser->browser_info()->CreateTempSubFrame(parent_frame_id);
|
||||
frame = browser->browser_info()->CreateTempSubFrame(parent_global_id);
|
||||
}
|
||||
|
||||
CefRefPtr<CefRequestImpl> request = new CefRequestImpl();
|
||||
@@ -90,26 +87,20 @@ void CreateThrottlesForNavigation(content::NavigationHandle* navigation_handle,
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
const bool is_main_frame = navigation_handle->IsInMainFrame();
|
||||
const auto global_id = frame_util::GetGlobalId(navigation_handle);
|
||||
|
||||
// Identify the RenderFrameHost that originated the navigation.
|
||||
const int64_t parent_frame_id =
|
||||
!is_main_frame
|
||||
? CefFrameHostImpl::MakeFrameId(navigation_handle->GetParentFrame())
|
||||
: CefFrameHostImpl::kInvalidFrameId;
|
||||
|
||||
const int64_t frame_id = !is_main_frame && navigation_handle->HasCommitted()
|
||||
? CefFrameHostImpl::MakeFrameId(
|
||||
navigation_handle->GetRenderFrameHost())
|
||||
: CefFrameHostImpl::kInvalidFrameId;
|
||||
const auto parent_global_id =
|
||||
!is_main_frame ? navigation_handle->GetParentFrame()->GetGlobalId()
|
||||
: frame_util::InvalidGlobalId();
|
||||
|
||||
// Must use SynchronyMode::kSync to ensure that OnBeforeBrowse is always
|
||||
// called before OnBeforeResourceLoad.
|
||||
std::unique_ptr<content::NavigationThrottle> throttle =
|
||||
std::make_unique<navigation_interception::InterceptNavigationThrottle>(
|
||||
navigation_handle,
|
||||
base::BindRepeating(&NavigationOnUIThread, is_main_frame, frame_id,
|
||||
parent_frame_id,
|
||||
navigation_handle->GetFrameTreeNodeId()),
|
||||
base::BindRepeating(&NavigationOnUIThread, is_main_frame, global_id,
|
||||
parent_global_id),
|
||||
navigation_interception::SynchronyMode::kSync);
|
||||
throttles.push_back(std::move(throttle));
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "components/language/core/browser/pref_names.h"
|
||||
#include "components/prefs/pref_service.h"
|
||||
#include "content/browser/renderer_host/frame_tree_node.h"
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
@@ -228,8 +229,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
void Initialize(content::BrowserContext* browser_context,
|
||||
CefRefPtr<CefBrowserHostBase> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
int render_process_id,
|
||||
int frame_tree_node_id,
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool is_navigation,
|
||||
bool is_download,
|
||||
const url::Origin& request_initiator,
|
||||
@@ -256,8 +256,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
frame_ = frame;
|
||||
}
|
||||
|
||||
render_process_id_ = render_process_id;
|
||||
frame_tree_node_id_ = frame_tree_node_id;
|
||||
global_id_ = global_id;
|
||||
is_navigation_ = is_navigation;
|
||||
is_download_ = is_download;
|
||||
request_initiator_ = request_initiator.Serialize();
|
||||
@@ -292,8 +291,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
CefRefPtr<CefFrame> frame_;
|
||||
scoped_refptr<CefIOThreadState> iothread_state_;
|
||||
CefBrowserContext::CookieableSchemes cookieable_schemes_;
|
||||
int render_process_id_ = 0;
|
||||
int frame_tree_node_id_ = -1;
|
||||
content::GlobalRenderFrameHostId global_id_;
|
||||
bool is_navigation_ = true;
|
||||
bool is_download_ = false;
|
||||
CefString request_initiator_;
|
||||
@@ -1052,8 +1050,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
// Maybe the request context wants to handle it?
|
||||
CefRefPtr<CefRequestContextHandler> context_handler =
|
||||
init_state_->iothread_state_->GetHandler(
|
||||
init_state_->render_process_id_, MSG_ROUTING_NONE,
|
||||
init_state_->frame_tree_node_id_, /*require_frame_match=*/false);
|
||||
init_state_->global_id_, /*require_frame_match=*/false);
|
||||
if (context_handler) {
|
||||
if (!requestPtr)
|
||||
requestPtr = MakeRequest(request, request_id, true);
|
||||
@@ -1174,80 +1171,6 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
DISALLOW_COPY_AND_ASSIGN(InterceptedRequestHandlerWrapper);
|
||||
};
|
||||
|
||||
void InitOnUIThread(
|
||||
scoped_refptr<InterceptedRequestHandlerWrapper::InitHelper> init_helper,
|
||||
content::WebContents::Getter web_contents_getter,
|
||||
int frame_tree_node_id,
|
||||
const network::ResourceRequest& request,
|
||||
const base::RepeatingClosure& unhandled_request_callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
// May return nullptr if the WebContents was destroyed while this callback was
|
||||
// in-flight.
|
||||
content::WebContents* web_contents = web_contents_getter.Run();
|
||||
if (!web_contents) {
|
||||
return;
|
||||
}
|
||||
|
||||
content::BrowserContext* browser_context = web_contents->GetBrowserContext();
|
||||
DCHECK(browser_context);
|
||||
|
||||
const int render_process_id =
|
||||
web_contents->GetRenderViewHost()->GetProcess()->GetID();
|
||||
|
||||
content::RenderFrameHost* frame = nullptr;
|
||||
|
||||
if (request.is_main_frame ||
|
||||
static_cast<blink::mojom::ResourceType>(request.resource_type) ==
|
||||
blink::mojom::ResourceType::kMainFrame) {
|
||||
frame = web_contents->GetMainFrame();
|
||||
DCHECK(frame);
|
||||
} else {
|
||||
if (frame_tree_node_id >= 0) {
|
||||
// May return null for frames in inner WebContents.
|
||||
frame = web_contents->FindFrameByFrameTreeNodeId(frame_tree_node_id,
|
||||
render_process_id);
|
||||
}
|
||||
if (!frame) {
|
||||
// Use the main frame for the CefBrowserHost.
|
||||
frame = web_contents->GetMainFrame();
|
||||
DCHECK(frame);
|
||||
}
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowserHostBase> browserPtr;
|
||||
CefRefPtr<CefFrame> framePtr;
|
||||
|
||||
// |frame| may be null for service worker requests.
|
||||
if (frame) {
|
||||
// May return nullptr for requests originating from guest views.
|
||||
browserPtr = CefBrowserHostBase::GetBrowserForHost(frame);
|
||||
if (browserPtr) {
|
||||
framePtr = browserPtr->GetFrameForHost(frame);
|
||||
if (frame_tree_node_id < 0)
|
||||
frame_tree_node_id = frame->GetFrameTreeNodeId();
|
||||
DCHECK(framePtr);
|
||||
}
|
||||
}
|
||||
|
||||
const bool is_navigation = ui::PageTransitionIsNewNavigation(
|
||||
static_cast<ui::PageTransition>(request.transition_type));
|
||||
// TODO(navigation): Can we determine the |is_download| value?
|
||||
const bool is_download = false;
|
||||
url::Origin request_initiator;
|
||||
if (request.request_initiator.has_value())
|
||||
request_initiator = *request.request_initiator;
|
||||
|
||||
auto init_state =
|
||||
std::make_unique<InterceptedRequestHandlerWrapper::InitState>();
|
||||
init_state->Initialize(browser_context, browserPtr, framePtr,
|
||||
render_process_id, frame_tree_node_id, is_navigation,
|
||||
is_download, request_initiator,
|
||||
unhandled_request_callback);
|
||||
|
||||
init_helper->MaybeSetInitialized(std::move(init_state));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
std::unique_ptr<InterceptedRequestHandler> CreateInterceptedRequestHandler(
|
||||
@@ -1258,27 +1181,31 @@ std::unique_ptr<InterceptedRequestHandler> CreateInterceptedRequestHandler(
|
||||
bool is_download,
|
||||
const url::Origin& request_initiator) {
|
||||
CEF_REQUIRE_UIT();
|
||||
CHECK(browser_context);
|
||||
|
||||
CefRefPtr<CefBrowserHostBase> browserPtr;
|
||||
CefRefPtr<CefFrame> framePtr;
|
||||
int frame_tree_node_id = -1;
|
||||
|
||||
// |frame| may be null for service worker requests.
|
||||
// Default to handlers for the same process in case |frame| doesn't have an
|
||||
// associated CefBrowserHost.
|
||||
content::GlobalRenderFrameHostId global_id(render_process_id,
|
||||
MSG_ROUTING_NONE);
|
||||
|
||||
// |frame| may be nullptr for service worker requests.
|
||||
if (frame) {
|
||||
frame_tree_node_id = frame->GetFrameTreeNodeId();
|
||||
|
||||
// May return nullptr for requests originating from guest views.
|
||||
browserPtr = CefBrowserHostBase::GetBrowserForHost(frame);
|
||||
if (browserPtr) {
|
||||
framePtr = browserPtr->GetFrameForHost(frame);
|
||||
DCHECK(framePtr);
|
||||
CHECK(framePtr);
|
||||
global_id = frame->GetGlobalId();
|
||||
}
|
||||
}
|
||||
|
||||
auto init_state =
|
||||
std::make_unique<InterceptedRequestHandlerWrapper::InitState>();
|
||||
init_state->Initialize(browser_context, browserPtr, framePtr,
|
||||
render_process_id, frame_tree_node_id, is_navigation,
|
||||
is_download, request_initiator,
|
||||
init_state->Initialize(browser_context, browserPtr, framePtr, global_id,
|
||||
is_navigation, is_download, request_initiator,
|
||||
base::RepeatingClosure());
|
||||
|
||||
auto wrapper = std::make_unique<InterceptedRequestHandlerWrapper>();
|
||||
@@ -1292,10 +1219,74 @@ std::unique_ptr<InterceptedRequestHandler> CreateInterceptedRequestHandler(
|
||||
int frame_tree_node_id,
|
||||
const network::ResourceRequest& request,
|
||||
const base::RepeatingClosure& unhandled_request_callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
content::WebContents* web_contents = web_contents_getter.Run();
|
||||
CHECK(web_contents);
|
||||
|
||||
content::BrowserContext* browser_context = web_contents->GetBrowserContext();
|
||||
CHECK(browser_context);
|
||||
|
||||
content::RenderFrameHost* frame = nullptr;
|
||||
|
||||
if (request.is_main_frame ||
|
||||
static_cast<blink::mojom::ResourceType>(request.resource_type) ==
|
||||
blink::mojom::ResourceType::kMainFrame) {
|
||||
frame = web_contents->GetMainFrame();
|
||||
CHECK(frame);
|
||||
} else {
|
||||
// May return nullptr for frames in inner WebContents.
|
||||
auto node = content::FrameTreeNode::GloballyFindByID(frame_tree_node_id);
|
||||
if (node) {
|
||||
frame = node->current_frame_host();
|
||||
|
||||
// RFHs can move between FrameTreeNodes. Make sure this one hasn't. See
|
||||
// documentation on RenderFrameHost::GetFrameTreeNodeId() for background.
|
||||
if (content::WebContents::FromRenderFrameHost(frame) != web_contents) {
|
||||
frame = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (!frame) {
|
||||
// Use the main frame for the CefBrowserHost.
|
||||
frame = web_contents->GetMainFrame();
|
||||
CHECK(frame);
|
||||
}
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowserHostBase> browserPtr;
|
||||
CefRefPtr<CefFrame> framePtr;
|
||||
|
||||
// Default to handlers for the same process in case |frame| doesn't have an
|
||||
// associated CefBrowserHost.
|
||||
content::GlobalRenderFrameHostId global_id(frame->GetProcess()->GetID(),
|
||||
MSG_ROUTING_NONE);
|
||||
|
||||
// May return nullptr for requests originating from guest views.
|
||||
browserPtr = CefBrowserHostBase::GetBrowserForHost(frame);
|
||||
if (browserPtr) {
|
||||
framePtr = browserPtr->GetFrameForHost(frame);
|
||||
DCHECK(framePtr);
|
||||
global_id = frame->GetGlobalId();
|
||||
}
|
||||
|
||||
const bool is_navigation = ui::PageTransitionIsNewNavigation(
|
||||
static_cast<ui::PageTransition>(request.transition_type));
|
||||
// TODO(navigation): Can we determine the |is_download| value?
|
||||
const bool is_download = false;
|
||||
url::Origin request_initiator;
|
||||
if (request.request_initiator.has_value())
|
||||
request_initiator = *request.request_initiator;
|
||||
|
||||
auto init_state =
|
||||
std::make_unique<InterceptedRequestHandlerWrapper::InitState>();
|
||||
init_state->Initialize(browser_context, browserPtr, framePtr, global_id,
|
||||
is_navigation, is_download, request_initiator,
|
||||
unhandled_request_callback);
|
||||
|
||||
auto wrapper = std::make_unique<InterceptedRequestHandlerWrapper>();
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(InitOnUIThread, wrapper->init_helper(),
|
||||
web_contents_getter, frame_tree_node_id,
|
||||
request, unhandled_request_callback));
|
||||
wrapper->init_helper()->MaybeSetInitialized(std::move(init_state));
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
|
@@ -38,7 +38,7 @@ std::unique_ptr<InterceptedRequestHandler> CreateInterceptedRequestHandler(
|
||||
|
||||
// Create an InterceptedRequestHandler that will delegate to a
|
||||
// CefResourceRequestHandler. The resulting object should be passed to
|
||||
// ProxyURLLoaderFactory::CreateProxy. Called on the IO thread only.
|
||||
// ProxyURLLoaderFactory::CreateProxy. Called on the UI thread only.
|
||||
std::unique_ptr<InterceptedRequestHandler> CreateInterceptedRequestHandler(
|
||||
content::WebContents::Getter web_contents_getter,
|
||||
int frame_tree_node_id,
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/browser/web_plugin_impl.h"
|
||||
#include "libcef/common/alloy/alloy_content_client.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
|
||||
#include "extensions/common/constants.h"
|
||||
|
||||
@@ -88,12 +89,12 @@ bool CefPluginServiceFilter::IsPluginAvailable(
|
||||
return true;
|
||||
}
|
||||
|
||||
auto browser_context =
|
||||
CefBrowserContext::FromIDs(render_process_id, render_frame_id, -1, false);
|
||||
const auto global_id = frame_util::MakeGlobalId(
|
||||
render_process_id, render_frame_id, /*allow_invalid_frame_id=*/true);
|
||||
auto browser_context = CefBrowserContext::FromGlobalId(global_id, false);
|
||||
CefRefPtr<CefRequestContextHandler> handler;
|
||||
if (browser_context) {
|
||||
handler = browser_context->GetHandler(render_process_id, render_frame_id,
|
||||
-1, false);
|
||||
handler = browser_context->GetHandler(global_id, false);
|
||||
}
|
||||
|
||||
if (!handler) {
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include "base/task/thread_pool.h"
|
||||
#include "base/values.h"
|
||||
#include "chrome/browser/accessibility/accessibility_ui.h"
|
||||
#include "chrome/browser/component_updater/chrome_component_updater_configurator.h"
|
||||
#include "chrome/browser/download/download_prefs.h"
|
||||
#include "chrome/browser/media/media_device_id_salt.h"
|
||||
#include "chrome/browser/media/router/media_router_feature.h"
|
||||
@@ -230,6 +231,8 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
||||
update_client::RegisterPrefs(registry.get());
|
||||
|
||||
if (!profile) {
|
||||
component_updater::RegisterPrefsForChromeComponentUpdaterConfigurator(
|
||||
registry.get());
|
||||
SystemNetworkContextManager::RegisterPrefs(registry.get());
|
||||
#if defined(OS_WIN)
|
||||
OSCrypt::RegisterLocalPrefs(registry.get());
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include "libcef/browser/print_settings_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/app_manager.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/files/file_util.h"
|
||||
@@ -19,6 +20,7 @@
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/values.h"
|
||||
#include "content/public/browser/global_routing_id.h"
|
||||
#include "printing/metafile.h"
|
||||
#include "printing/print_job_constants.h"
|
||||
#include "printing/print_settings.h"
|
||||
@@ -106,8 +108,10 @@ gfx::Size CefPrintDialogLinux::GetPdfPaperSize(
|
||||
|
||||
gfx::Size size;
|
||||
|
||||
auto browser = extensions::GetOwnerBrowserForFrameRoute(
|
||||
context->render_process_id(), context->render_frame_id(), nullptr);
|
||||
auto browser = extensions::GetOwnerBrowserForGlobalId(
|
||||
frame_util::MakeGlobalId(context->render_process_id(),
|
||||
context->render_frame_id()),
|
||||
nullptr);
|
||||
DCHECK(browser);
|
||||
if (browser && browser->GetClient()) {
|
||||
if (auto handler = browser->GetClient()->GetPrintHandler()) {
|
||||
@@ -139,8 +143,10 @@ void CefPrintDialogLinux::OnPrintStart(CefRefPtr<CefBrowserHostBase> browser) {
|
||||
CefPrintDialogLinux::CefPrintDialogLinux(PrintingContextLinux* context)
|
||||
: context_(context) {
|
||||
DCHECK(context_);
|
||||
browser_ = extensions::GetOwnerBrowserForFrameRoute(
|
||||
context_->render_process_id(), context_->render_frame_id(), nullptr);
|
||||
browser_ = extensions::GetOwnerBrowserForGlobalId(
|
||||
frame_util::MakeGlobalId(context_->render_process_id(),
|
||||
context_->render_frame_id()),
|
||||
nullptr);
|
||||
DCHECK(browser_);
|
||||
}
|
||||
|
||||
|
@@ -4,63 +4,42 @@
|
||||
|
||||
#include "libcef/browser/request_context_handler_map.h"
|
||||
|
||||
#include "libcef/common/frame_util.h"
|
||||
|
||||
CefRequestContextHandlerMap::CefRequestContextHandlerMap() = default;
|
||||
CefRequestContextHandlerMap::~CefRequestContextHandlerMap() = default;
|
||||
|
||||
void CefRequestContextHandlerMap::AddHandler(
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
CefRefPtr<CefRequestContextHandler> handler) {
|
||||
DCHECK_GE(render_process_id, 0);
|
||||
DCHECK_GE(render_frame_id, 0);
|
||||
DCHECK_GE(frame_tree_node_id, 0);
|
||||
DCHECK(frame_util::IsValidGlobalId(global_id));
|
||||
DCHECK(handler);
|
||||
|
||||
render_id_handler_map_.insert(std::make_pair(
|
||||
std::make_pair(render_process_id, render_frame_id), handler));
|
||||
node_id_handler_map_.insert(std::make_pair(frame_tree_node_id, handler));
|
||||
render_id_handler_map_.insert(std::make_pair(global_id, handler));
|
||||
}
|
||||
|
||||
void CefRequestContextHandlerMap::RemoveHandler(int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id) {
|
||||
DCHECK_GE(render_process_id, 0);
|
||||
DCHECK_GE(render_frame_id, 0);
|
||||
DCHECK_GE(frame_tree_node_id, 0);
|
||||
void CefRequestContextHandlerMap::RemoveHandler(
|
||||
const content::GlobalRenderFrameHostId& global_id) {
|
||||
DCHECK(frame_util::IsValidGlobalId(global_id));
|
||||
|
||||
auto it1 = render_id_handler_map_.find(
|
||||
std::make_pair(render_process_id, render_frame_id));
|
||||
auto it1 = render_id_handler_map_.find(global_id);
|
||||
if (it1 != render_id_handler_map_.end())
|
||||
render_id_handler_map_.erase(it1);
|
||||
|
||||
auto it2 = node_id_handler_map_.find(frame_tree_node_id);
|
||||
if (it2 != node_id_handler_map_.end())
|
||||
node_id_handler_map_.erase(it2);
|
||||
}
|
||||
|
||||
CefRefPtr<CefRequestContextHandler> CefRequestContextHandlerMap::GetHandler(
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool require_frame_match) const {
|
||||
if (render_process_id >= 0 && render_frame_id >= 0) {
|
||||
const auto it1 = render_id_handler_map_.find(
|
||||
std::make_pair(render_process_id, render_frame_id));
|
||||
if (frame_util::IsValidGlobalId(global_id)) {
|
||||
const auto it1 = render_id_handler_map_.find(global_id);
|
||||
if (it1 != render_id_handler_map_.end())
|
||||
return it1->second;
|
||||
}
|
||||
|
||||
if (frame_tree_node_id >= 0) {
|
||||
const auto it2 = node_id_handler_map_.find(frame_tree_node_id);
|
||||
if (it2 != node_id_handler_map_.end())
|
||||
return it2->second;
|
||||
}
|
||||
|
||||
if (render_process_id >= 0 && !require_frame_match) {
|
||||
if (frame_util::IsValidChildId(global_id.child_id) && !require_frame_match) {
|
||||
// Choose an arbitrary handler for the same process.
|
||||
for (auto& kv : render_id_handler_map_) {
|
||||
if (kv.first.first == render_process_id)
|
||||
if (kv.first.child_id == global_id.child_id)
|
||||
return kv.second;
|
||||
}
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include "include/cef_request_context_handler.h"
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "content/public/browser/global_routing_id.h"
|
||||
|
||||
// Tracks CefRequestContextHandler associations on a single thread.
|
||||
class CefRequestContextHandlerMap {
|
||||
@@ -23,38 +24,26 @@ class CefRequestContextHandlerMap {
|
||||
// originates from frame create/delete notifications in
|
||||
// CefBrowserContentsDelegate or CefMimeHandlerViewGuestDelegate which are
|
||||
// forwarded via CefRequestContextImpl and CefBrowserContext.
|
||||
void AddHandler(int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
void AddHandler(const content::GlobalRenderFrameHostId& global_id,
|
||||
CefRefPtr<CefRequestContextHandler> handler);
|
||||
void RemoveHandler(int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id);
|
||||
void RemoveHandler(const content::GlobalRenderFrameHostId& global_id);
|
||||
|
||||
// Returns the handler that matches the specified IDs. Pass -1 for unknown
|
||||
// values. If |require_frame_match| is true only exact matches will be
|
||||
// returned. If |require_frame_match| is false, and there is not an exact
|
||||
// match, then the first handler for the same |render_process_id| will be
|
||||
// returned.
|
||||
// Returns the handler that matches the specified IDs. If
|
||||
// |require_frame_match| is true only exact matches will be returned. If
|
||||
// |require_frame_match| is false, and there is not an exact match, then the
|
||||
// first handler for the same |global_id.child_id| will be returned.
|
||||
CefRefPtr<CefRequestContextHandler> GetHandler(
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool require_frame_match) const;
|
||||
|
||||
private:
|
||||
// Map of (render_process_id, render_frame_id) to handler.
|
||||
typedef std::map<std::pair<int, int>, CefRefPtr<CefRequestContextHandler>>
|
||||
RenderIdHandlerMap;
|
||||
// Map of global ID to handler. These IDs are guaranteed to uniquely
|
||||
// identify a RFH for its complete lifespan. See documentation on
|
||||
// RenderFrameHost::GetFrameTreeNodeId() for background.
|
||||
using RenderIdHandlerMap = std::map<content::GlobalRenderFrameHostId,
|
||||
CefRefPtr<CefRequestContextHandler>>;
|
||||
RenderIdHandlerMap render_id_handler_map_;
|
||||
|
||||
// Map of frame_tree_node_id to handler. Keeping this map is necessary
|
||||
// because, when navigating the main frame, a new (pre-commit) network request
|
||||
// will be created before the RenderFrameHost. Consequently we can't rely
|
||||
// on valid render IDs. See https://crbug.com/776884 for background.
|
||||
typedef std::map<int, CefRefPtr<CefRequestContextHandler>> NodeIdHandlerMap;
|
||||
NodeIdHandlerMap node_id_handler_map_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefRequestContextHandlerMap);
|
||||
};
|
||||
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include "content/public/browser/browser_task_traits.h"
|
||||
#include "content/public/browser/plugin_service.h"
|
||||
#include "content/public/browser/ssl_host_state_delegate.h"
|
||||
#include "content/public/common/child_process_host.h"
|
||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
#include "services/network/public/cpp/resolve_host_client_base.h"
|
||||
@@ -589,24 +590,20 @@ CefRefPtr<CefMediaRouter> CefRequestContextImpl::GetMediaRouter(
|
||||
return media_router.get();
|
||||
}
|
||||
|
||||
void CefRequestContextImpl::OnRenderFrameCreated(int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
bool is_main_frame,
|
||||
bool is_guest_view) {
|
||||
browser_context_->OnRenderFrameCreated(this, render_process_id,
|
||||
render_frame_id, frame_tree_node_id,
|
||||
is_main_frame, is_guest_view);
|
||||
void CefRequestContextImpl::OnRenderFrameCreated(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool is_main_frame,
|
||||
bool is_guest_view) {
|
||||
browser_context_->OnRenderFrameCreated(this, global_id, is_main_frame,
|
||||
is_guest_view);
|
||||
}
|
||||
|
||||
void CefRequestContextImpl::OnRenderFrameDeleted(int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
bool is_main_frame,
|
||||
bool is_guest_view) {
|
||||
browser_context_->OnRenderFrameDeleted(this, render_process_id,
|
||||
render_frame_id, frame_tree_node_id,
|
||||
is_main_frame, is_guest_view);
|
||||
void CefRequestContextImpl::OnRenderFrameDeleted(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool is_main_frame,
|
||||
bool is_guest_view) {
|
||||
browser_context_->OnRenderFrameDeleted(this, global_id, is_main_frame,
|
||||
is_guest_view);
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -714,7 +711,8 @@ void CefRequestContextImpl::PurgePluginListCacheInternal(
|
||||
if (!browser_context)
|
||||
return;
|
||||
|
||||
browser_context->ClearPluginLoadDecision(-1);
|
||||
browser_context->ClearPluginLoadDecision(
|
||||
content::ChildProcessHost::kInvalidUniqueID);
|
||||
content::PluginService::GetInstance()->PurgePluginListCache(
|
||||
browser_context->AsBrowserContext(), false);
|
||||
}
|
||||
|
@@ -12,6 +12,10 @@
|
||||
#include "libcef/browser/net_service/cookie_manager_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
namespace content {
|
||||
struct GlobalRenderFrameHostId;
|
||||
}
|
||||
|
||||
class CefBrowserContext;
|
||||
|
||||
// Implementation of the CefRequestContext interface. All methods are thread-
|
||||
@@ -95,18 +99,14 @@ class CefRequestContextImpl : public CefRequestContext {
|
||||
// Called from CefBrowserContentsDelegate::RenderFrameCreated or
|
||||
// CefMimeHandlerViewGuestDelegate::OnGuestAttached when a render frame is
|
||||
// created.
|
||||
void OnRenderFrameCreated(int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
void OnRenderFrameCreated(const content::GlobalRenderFrameHostId& global_id,
|
||||
bool is_main_frame,
|
||||
bool is_guest_view);
|
||||
|
||||
// Called from CefBrowserContentsDelegate::RenderFrameDeleted or
|
||||
// CefMimeHandlerViewGuestDelegate::OnGuestDetached when a render frame is
|
||||
// deleted.
|
||||
void OnRenderFrameDeleted(int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
void OnRenderFrameDeleted(const content::GlobalRenderFrameHostId& global_id,
|
||||
bool is_main_frame,
|
||||
bool is_guest_view);
|
||||
|
||||
|
@@ -182,6 +182,7 @@ class CaptionlessFrameView : public views::NonClientFrameView {
|
||||
|
||||
void Layout() override {
|
||||
client_view_bounds_.SetRect(0, 0, width(), height());
|
||||
views::NonClientFrameView::Layout();
|
||||
}
|
||||
|
||||
gfx::Size CalculatePreferredSize() const override {
|
||||
|
@@ -6,7 +6,6 @@
|
||||
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/widevine_loader.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/files/file_path.h"
|
||||
@@ -30,23 +29,6 @@ void PluginsCallbackImpl(
|
||||
}
|
||||
}
|
||||
|
||||
#if !(BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)) || \
|
||||
defined(OS_LINUX)
|
||||
|
||||
void DeliverWidevineCdmError(const std::string& error_message,
|
||||
CefRefPtr<CefRegisterCdmCallback> callback) {
|
||||
LOG(ERROR) << error_message;
|
||||
if (callback.get()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefRegisterCdmCallback::OnCdmRegistrationComplete,
|
||||
callback.get(), CEF_CDM_REGISTRATION_ERROR_NOT_SUPPORTED,
|
||||
error_message));
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
||||
// CefWebPluginInfoImpl
|
||||
@@ -166,24 +148,3 @@ void CefIsWebPluginUnstable(const CefString& path,
|
||||
base::BindOnce(CefIsWebPluginUnstable, path, callback));
|
||||
}
|
||||
}
|
||||
|
||||
void CefRegisterWidevineCdm(const CefString& path,
|
||||
CefRefPtr<CefRegisterCdmCallback> callback) {
|
||||
#if BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
#if defined(OS_LINUX)
|
||||
// Enforce the requirement that CefRegisterWidevineCdm() is called before
|
||||
// CefInitialize() on Linux. See comments in
|
||||
// CefWidevineLoader::AddPepperPlugins for details.
|
||||
if (CONTEXT_STATE_VALID()) {
|
||||
DeliverWidevineCdmError(
|
||||
"Widevine registration is not supported after context initialization",
|
||||
callback);
|
||||
return;
|
||||
}
|
||||
#endif // defined(OS_LINUX)
|
||||
|
||||
CefWidevineLoader::GetInstance()->LoadWidevineCdm(path, callback);
|
||||
#else
|
||||
DeliverWidevineCdmError("Widevine registration is not supported", callback);
|
||||
#endif // BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
}
|
||||
|
@@ -27,6 +27,8 @@
|
||||
#include "chrome/common/chrome_constants.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/common/media/cdm_registration.h"
|
||||
#include "content/public/common/cdm_info.h"
|
||||
#include "content/public/common/content_constants.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "content/public/common/pepper_plugin_info.h"
|
||||
@@ -35,8 +37,8 @@
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
#include "libcef/common/widevine_loader.h"
|
||||
#if BUILDFLAG(ENABLE_CDM_HOST_VERIFICATION)
|
||||
#include "chrome/common/media/cdm_host_file_path.h"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
@@ -95,10 +97,12 @@ void AlloyContentClient::AddPepperPlugins(
|
||||
void AlloyContentClient::AddContentDecryptionModules(
|
||||
std::vector<content::CdmInfo>* cdms,
|
||||
std::vector<media::CdmHostFilePath>* cdm_host_file_paths) {
|
||||
#if defined(OS_LINUX)
|
||||
#if BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
CefWidevineLoader::AddContentDecryptionModules(cdms, cdm_host_file_paths);
|
||||
#endif
|
||||
if (cdms)
|
||||
RegisterCdmInfo(cdms);
|
||||
|
||||
#if BUILDFLAG(ENABLE_CDM_HOST_VERIFICATION)
|
||||
if (cdm_host_file_paths)
|
||||
AddCdmHostFilePaths(cdm_host_file_paths);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -29,6 +29,7 @@
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/utility/chrome_content_utility_client.h"
|
||||
#include "components/component_updater/component_updater_paths.h"
|
||||
#include "components/content_settings/core/common/content_settings_pattern.h"
|
||||
#include "components/embedder_support/switches.h"
|
||||
#include "components/viz/common/features.h"
|
||||
@@ -369,9 +370,10 @@ void AlloyMainDelegate::PreSandboxStartup() {
|
||||
#endif
|
||||
|
||||
resource_util::OverrideDefaultDownloadDir();
|
||||
resource_util::OverrideUserDataDir(settings_, command_line);
|
||||
}
|
||||
|
||||
resource_util::OverrideUserDataDir(settings_, command_line);
|
||||
|
||||
if (command_line->HasSwitch(switches::kDisablePackLoading))
|
||||
resource_bundle_delegate_.set_pack_loading_disabled(true);
|
||||
|
||||
@@ -379,6 +381,11 @@ void AlloyMainDelegate::PreSandboxStartup() {
|
||||
// chrome::DIR_CRASH_DUMPS must be configured before calling this function.
|
||||
crash_reporting::PreSandboxStartup(*command_line, process_type);
|
||||
|
||||
// Register the component_updater PathProvider.
|
||||
component_updater::RegisterPathProvider(chrome::DIR_COMPONENTS,
|
||||
chrome::DIR_INTERNAL_PLUGINS,
|
||||
chrome::DIR_USER_DATA);
|
||||
|
||||
InitializeResourceBundle();
|
||||
MaybeInitializeGDI();
|
||||
}
|
||||
|
@@ -7,7 +7,6 @@
|
||||
|
||||
#include "libcef/browser/alloy/chrome_browser_process_alloy.h"
|
||||
#include "libcef/common/alloy/alloy_main_delegate.h"
|
||||
#include "libcef/common/widevine_loader.h"
|
||||
#include "libcef/renderer/alloy/alloy_content_renderer_client.h"
|
||||
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
@@ -38,10 +37,6 @@ void AlloyMainRunnerDelegate::BeforeMainThreadRun() {
|
||||
}
|
||||
|
||||
void AlloyMainRunnerDelegate::AfterUIThreadInitialize() {
|
||||
#if BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
CefWidevineLoader::GetInstance()->OnContextInitialized();
|
||||
#endif
|
||||
|
||||
static_cast<ChromeBrowserProcessAlloy*>(g_browser_process)
|
||||
->OnContextInitialized();
|
||||
}
|
||||
|
@@ -94,9 +94,6 @@ const char kDisableScrollBounce[] = "disable-scroll-bounce";
|
||||
// Disable the PDF extension.
|
||||
const char kDisablePdfExtension[] = "disable-pdf-extension";
|
||||
|
||||
// Path to Widevine CDM binaries.
|
||||
const char kWidevineCdmPath[] = "widevine-cdm-path";
|
||||
|
||||
// Default plugin policy action.
|
||||
const char kPluginPolicy[] = "plugin-policy";
|
||||
// Allow the content. This is the default value.
|
||||
|
@@ -44,7 +44,6 @@ extern const char kEnableSpellingService[];
|
||||
extern const char kOverrideSpellCheckLang[];
|
||||
extern const char kDisableScrollBounce[];
|
||||
extern const char kDisablePdfExtension[];
|
||||
extern const char kWidevineCdmPath[];
|
||||
extern const char kPluginPolicy[];
|
||||
extern const char kPluginPolicy_Allow[];
|
||||
extern const char kPluginPolicy_Detect[];
|
||||
|
@@ -4,14 +4,22 @@
|
||||
|
||||
#include "libcef/common/frame_util.h"
|
||||
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
|
||||
#include "content/public/browser/navigation_handle.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
|
||||
namespace frame_util {
|
||||
|
||||
int64_t MakeFrameId(int32_t render_process_id, int32_t render_routing_id) {
|
||||
return (static_cast<uint64_t>(render_process_id) << 32) |
|
||||
static_cast<uint64_t>(render_routing_id);
|
||||
content::GlobalRenderFrameHostId GetGlobalId(
|
||||
content::NavigationHandle* navigation_handle) {
|
||||
CEF_REQUIRE_UIT();
|
||||
return navigation_handle->HasCommitted()
|
||||
? navigation_handle->GetRenderFrameHost()->GetGlobalId()
|
||||
: navigation_handle->GetPreviousRenderFrameHostId();
|
||||
}
|
||||
|
||||
std::string GetFrameDebugString(int64_t frame_id) {
|
||||
@@ -23,4 +31,9 @@ std::string GetFrameDebugString(int64_t frame_id) {
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
std::string GetFrameDebugString(
|
||||
const content::GlobalRenderFrameHostId& global_id) {
|
||||
return GetFrameDebugString(MakeFrameId(global_id));
|
||||
}
|
||||
|
||||
} // namespace frame_util
|
||||
|
@@ -8,14 +8,76 @@
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "content/public/browser/global_routing_id.h"
|
||||
#include "content/public/common/child_process_host.h"
|
||||
|
||||
namespace content {
|
||||
class NavigationHandle;
|
||||
}
|
||||
|
||||
namespace frame_util {
|
||||
|
||||
// Returns the frame ID, which is a 64-bit combination of |render_process_id|
|
||||
// and |render_routing_id|.
|
||||
int64_t MakeFrameId(int32_t render_process_id, int32_t render_routing_id);
|
||||
// Create a frame ID in the format exposed by the CEF API.
|
||||
inline int64_t MakeFrameId(int child_id, int frame_routing_id) {
|
||||
return (static_cast<uint64_t>(child_id) << 32) |
|
||||
static_cast<uint64_t>(frame_routing_id);
|
||||
}
|
||||
|
||||
// Returns a human-readable version of |frame_id|.
|
||||
// Create a frame ID in the format exposed by the CEF API.
|
||||
inline int64_t MakeFrameId(const content::GlobalRenderFrameHostId& global_id) {
|
||||
return MakeFrameId(global_id.child_id, global_id.frame_routing_id);
|
||||
}
|
||||
|
||||
// Returns true if |child_id| is valid.
|
||||
inline bool IsValidChildId(int child_id) {
|
||||
// See comments in ChildProcessHostImpl::GenerateChildProcessUniqueId().
|
||||
return child_id != content::ChildProcessHost::kInvalidUniqueID &&
|
||||
child_id != 0;
|
||||
}
|
||||
|
||||
// Returns true if |frame_routing_id| is valid.
|
||||
inline bool IsValidRoutingId(int frame_routing_id) {
|
||||
return frame_routing_id != MSG_ROUTING_NONE;
|
||||
}
|
||||
|
||||
// Returns true if |global_id| is valid.
|
||||
inline bool IsValidGlobalId(const content::GlobalRenderFrameHostId& global_id) {
|
||||
return IsValidChildId(global_id.child_id) &&
|
||||
IsValidRoutingId(global_id.frame_routing_id);
|
||||
}
|
||||
|
||||
// Create a global ID from components.
|
||||
inline content::GlobalRenderFrameHostId MakeGlobalId(
|
||||
int child_id,
|
||||
int frame_routing_id,
|
||||
bool allow_invalid_frame_id = false) {
|
||||
DCHECK(IsValidChildId(child_id));
|
||||
DCHECK(allow_invalid_frame_id || IsValidRoutingId(frame_routing_id));
|
||||
return content::GlobalRenderFrameHostId(child_id, frame_routing_id);
|
||||
}
|
||||
|
||||
// Create a global ID from a frame ID.
|
||||
inline content::GlobalRenderFrameHostId MakeGlobalId(int64_t frame_id) {
|
||||
uint32_t child_id = frame_id >> 32;
|
||||
uint32_t frame_routing_id = std::numeric_limits<uint32_t>::max() & frame_id;
|
||||
return MakeGlobalId(child_id, frame_routing_id);
|
||||
}
|
||||
|
||||
// Returns an invalid global ID value.
|
||||
inline content::GlobalRenderFrameHostId InvalidGlobalId() {
|
||||
return content::GlobalRenderFrameHostId();
|
||||
}
|
||||
|
||||
// Returns the best match of global ID for |navigation_handle|. For pre-commit
|
||||
// navigations this will return the current RFH, if any, or an invalid ID.
|
||||
content::GlobalRenderFrameHostId GetGlobalId(
|
||||
content::NavigationHandle* navigation_handle);
|
||||
|
||||
// Returns a human-readable version of the ID.
|
||||
std::string GetFrameDebugString(int64_t frame_id);
|
||||
std::string GetFrameDebugString(
|
||||
const content::GlobalRenderFrameHostId& global_id);
|
||||
|
||||
} // namespace frame_util
|
||||
|
||||
|
@@ -43,10 +43,8 @@ namespace {
|
||||
|
||||
// Based on chrome/common/chrome_paths_linux.cc.
|
||||
// See http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||
// for a spec on where config files go. The net effect for most
|
||||
// systems is we use ~/.config/chromium/ for Chromium and
|
||||
// ~/.config/google-chrome/ for official builds.
|
||||
// (This also helps us sidestep issues with other apps grabbing ~/.chromium .)
|
||||
// for a spec on where config files go. The net result on most systems is that
|
||||
// we use "~/.config/cef_user_data".
|
||||
bool GetDefaultUserDataDirectory(base::FilePath* result) {
|
||||
std::unique_ptr<base::Environment> env(base::Environment::Create());
|
||||
base::FilePath config_dir(base::nix::GetXDGDirectory(
|
||||
@@ -214,7 +212,8 @@ void OverrideUserDataDir(CefSettings* settings,
|
||||
|
||||
// Path used for spell checking dictionary files.
|
||||
base::PathService::OverrideAndCreateIfNeeded(
|
||||
chrome::DIR_APP_DICTIONARIES, user_data_path.AppendASCII("Dictionaries"),
|
||||
chrome::DIR_APP_DICTIONARIES,
|
||||
user_data_path.Append(FILE_PATH_LITERAL("Dictionaries")),
|
||||
false, // May not be an absolute path.
|
||||
true); // Create if necessary.
|
||||
}
|
||||
|
@@ -1,513 +0,0 @@
|
||||
// Copyright 2016 The Chromium Embedded Framework Authors. Portions copyright
|
||||
// 2013 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/common/widevine_loader.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/json/json_string_value_serializer.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/native_library.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "content/browser/plugin_service_impl.h"
|
||||
#include "content/public/browser/cdm_registry.h"
|
||||
#include "content/public/common/cdm_info.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "media/cdm/cdm_host_file.h"
|
||||
#include "media/cdm/supported_cdm_versions.h"
|
||||
#include "sandbox/policy/switches.h"
|
||||
#include "third_party/widevine/cdm/widevine_cdm_common.h" // nogncheck
|
||||
|
||||
namespace {
|
||||
|
||||
base::LazyInstance<CefWidevineLoader>::Leaky g_widevine_loader =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// Based on chrome/browser/component_updater/widevine_cdm_component_installer.cc
|
||||
|
||||
// Name of the Widevine CDM OS in the component manifest.
|
||||
const char kWidevineCdmOs[] =
|
||||
#if defined(OS_MAC)
|
||||
"mac";
|
||||
#elif defined(OS_WIN)
|
||||
"win";
|
||||
#else // OS_LINUX, etc. TODO(viettrungluu): Separate out Chrome OS and Android?
|
||||
"linux";
|
||||
#endif
|
||||
|
||||
// Name of the Widevine CDM architecture in the component manifest.
|
||||
const char kWidevineCdmArch[] =
|
||||
#if defined(ARCH_CPU_X86)
|
||||
"ia32"; // This differs from the component updater which uses "x86".
|
||||
#elif defined(ARCH_CPU_X86_64)
|
||||
"x64";
|
||||
#elif defined(ARCH_CPU_ARM64)
|
||||
"arm64";
|
||||
#else
|
||||
"???";
|
||||
#endif
|
||||
|
||||
// The CDM OS and architecture.
|
||||
const char kCdmOsName[] = "os";
|
||||
const char kCdmArchName[] = "arch";
|
||||
|
||||
// The CDM version (e.g. "1.4.8.903").
|
||||
const char kCdmVersionName[] = "version";
|
||||
|
||||
// The CDM manifest includes several custom values, all beginning with "x-cdm-".
|
||||
// All values are strings.
|
||||
// All values that are lists are delimited by commas. No trailing commas.
|
||||
// For example, "1,2,4".
|
||||
const char kCdmValueDelimiter[] = ",";
|
||||
// The following entries are required.
|
||||
// Interface versions are lists of integers (e.g. "1" or "1,2,4").
|
||||
// These are checked in this file before registering the CDM.
|
||||
// All match the interface versions from content_decryption_module.h that the
|
||||
// CDM supports.
|
||||
// Matches CDM_MODULE_VERSION.
|
||||
const char kCdmModuleVersionsName[] = "x-cdm-module-versions";
|
||||
// Matches supported ContentDecryptionModule_* version(s).
|
||||
const char kCdmInterfaceVersionsName[] = "x-cdm-interface-versions";
|
||||
// Matches supported Host_* version(s).
|
||||
const char kCdmHostVersionsName[] = "x-cdm-host-versions";
|
||||
// The codecs list is a list of simple codec names (e.g. "vp8,vorbis").
|
||||
// The list is passed to other parts of Chrome.
|
||||
const char kCdmCodecsListName[] = "x-cdm-codecs";
|
||||
// Whether persistent license is supported by the CDM: "true" or "false".
|
||||
const char kCdmPersistentLicenseSupportName[] =
|
||||
"x-cdm-persistent-license-support";
|
||||
const char kCdmSupportedEncryptionSchemesName[] =
|
||||
"x-cdm-supported-encryption-schemes";
|
||||
|
||||
// The following strings are used to specify supported codecs in the
|
||||
// parameter |kCdmCodecsListName|.
|
||||
const char kCdmSupportedCodecVp8[] = "vp8";
|
||||
const char kCdmSupportedCodecVp9[] = "vp09";
|
||||
const char kCdmSupportedCodecAv1[] = "av01";
|
||||
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
|
||||
const char kCdmSupportedCodecAvc1[] = "avc1";
|
||||
#endif
|
||||
|
||||
// The following strings are used to specify supported encryption schemes in
|
||||
// the parameter |kCdmSupportedEncryptionSchemesName|.
|
||||
const char kCdmSupportedEncryptionSchemeCenc[] = "cenc";
|
||||
const char kCdmSupportedEncryptionSchemeCbcs[] = "cbcs";
|
||||
|
||||
// Arguments passed to MakeCdmInfo.
|
||||
struct CdmInfoArgs {
|
||||
base::FilePath path;
|
||||
std::string version;
|
||||
media::CdmCapability capability;
|
||||
};
|
||||
|
||||
std::unique_ptr<base::DictionaryValue> ParseManifestFile(
|
||||
const base::FilePath& manifest_path) {
|
||||
CEF_REQUIRE_BLOCKING();
|
||||
|
||||
// Manifest file should be < 1kb. Read at most 2kb.
|
||||
std::string manifest_contents;
|
||||
if (!base::ReadFileToStringWithMaxSize(manifest_path, &manifest_contents,
|
||||
2048)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JSONStringValueDeserializer deserializer(manifest_contents);
|
||||
std::unique_ptr<base::Value> manifest(
|
||||
deserializer.Deserialize(nullptr, nullptr));
|
||||
|
||||
if (!manifest.get() || !manifest->is_dict())
|
||||
return nullptr;
|
||||
|
||||
// Transfer ownership to the caller.
|
||||
return base::WrapUnique(
|
||||
static_cast<base::DictionaryValue*>(manifest.release()));
|
||||
}
|
||||
|
||||
std::string GetManifestValue(const base::DictionaryValue& manifest,
|
||||
const std::string& key,
|
||||
std::string* error_message) {
|
||||
std::stringstream ss;
|
||||
std::string value;
|
||||
if (!manifest.GetString(key, &value)) {
|
||||
ss << "Manifest missing " << key;
|
||||
*error_message = ss.str();
|
||||
} else if (value.empty()) {
|
||||
ss << "Manifest has empty " << key;
|
||||
*error_message = ss.str();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
typedef bool (*VersionCheckFunc)(int version);
|
||||
|
||||
bool CheckForCompatibleVersion(const base::DictionaryValue& manifest,
|
||||
const std::string version_name,
|
||||
VersionCheckFunc version_check_func,
|
||||
std::string* error_message) {
|
||||
std::string versions_string =
|
||||
GetManifestValue(manifest, version_name, error_message);
|
||||
if (versions_string.empty())
|
||||
return false;
|
||||
|
||||
for (const base::StringPiece& ver_str :
|
||||
base::SplitStringPiece(versions_string, kCdmValueDelimiter,
|
||||
base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
|
||||
int version = 0;
|
||||
if (base::StringToInt(ver_str, &version))
|
||||
if (version_check_func(version))
|
||||
return true;
|
||||
}
|
||||
|
||||
std::stringstream ss;
|
||||
ss << "Manifest has no supported " << version_name << " in '"
|
||||
<< versions_string << "'";
|
||||
*error_message = ss.str();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Returns whether the CDM's OS/platform and module/interface/host API versions,
|
||||
// as specified in the manifest, are compatible with this Chromium binary.
|
||||
bool IsCompatibleWithChrome(const base::DictionaryValue& manifest,
|
||||
std::string* error_message) {
|
||||
return GetManifestValue(manifest, kCdmOsName, error_message) ==
|
||||
kWidevineCdmOs &&
|
||||
GetManifestValue(manifest, kCdmArchName, error_message) ==
|
||||
kWidevineCdmArch &&
|
||||
CheckForCompatibleVersion(manifest, kCdmModuleVersionsName,
|
||||
media::IsSupportedCdmModuleVersion,
|
||||
error_message) &&
|
||||
CheckForCompatibleVersion(manifest, kCdmInterfaceVersionsName,
|
||||
media::IsSupportedCdmInterfaceVersion,
|
||||
error_message) &&
|
||||
CheckForCompatibleVersion(manifest, kCdmHostVersionsName,
|
||||
media::IsSupportedCdmHostVersion,
|
||||
error_message);
|
||||
}
|
||||
|
||||
// Returns true and updates |video_codecs| if the appropriate manifest entry is
|
||||
// valid. Returns false and does not modify |video_codecs| if the manifest entry
|
||||
// is incorrectly formatted.
|
||||
bool GetCodecs(const base::DictionaryValue& manifest,
|
||||
media::CdmCapability::VideoCodecMap* video_codecs,
|
||||
std::string* error_message) {
|
||||
DCHECK(video_codecs);
|
||||
|
||||
const base::Value* value = manifest.FindKey(kCdmCodecsListName);
|
||||
if (!value) {
|
||||
std::stringstream ss;
|
||||
ss << "Widevine CDM component manifest is missing codecs.";
|
||||
*error_message = ss.str();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!value->is_string()) {
|
||||
std::stringstream ss;
|
||||
ss << "Manifest entry " << kCdmCodecsListName << " is not a string.";
|
||||
*error_message = ss.str();
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::string& codecs = value->GetString();
|
||||
if (codecs.empty()) {
|
||||
std::stringstream ss;
|
||||
ss << "Widevine CDM component manifest has empty codecs list.";
|
||||
*error_message = ss.str();
|
||||
return true;
|
||||
}
|
||||
|
||||
media::CdmCapability::VideoCodecMap result;
|
||||
const std::vector<media::VideoCodecProfile> kAllProfiles = {};
|
||||
const std::vector<base::StringPiece> supported_codecs =
|
||||
base::SplitStringPiece(codecs, kCdmValueDelimiter, base::TRIM_WHITESPACE,
|
||||
base::SPLIT_WANT_NONEMPTY);
|
||||
|
||||
for (const auto& codec : supported_codecs) {
|
||||
if (codec == kCdmSupportedCodecVp8)
|
||||
result.emplace(media::VideoCodec::kCodecVP8, kAllProfiles);
|
||||
else if (codec == kCdmSupportedCodecVp9)
|
||||
result.emplace(media::VideoCodec::kCodecVP9, kAllProfiles);
|
||||
else if (codec == kCdmSupportedCodecAv1)
|
||||
result.emplace(media::VideoCodec::kCodecAV1, kAllProfiles);
|
||||
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
|
||||
else if (codec == kCdmSupportedCodecAvc1)
|
||||
result.emplace(media::VideoCodec::kCodecH264, kAllProfiles);
|
||||
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
|
||||
}
|
||||
|
||||
video_codecs->swap(result);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Returns true and updates |encryption_schemes| if the appropriate manifest
|
||||
// entry is valid. Returns false and does not modify |encryption_schemes| if the
|
||||
// manifest entry is incorrectly formatted. It is assumed that all CDMs support
|
||||
// 'cenc', so if the manifest entry is missing, the result will indicate support
|
||||
// for 'cenc' only. Incorrect types in the manifest entry will log the error and
|
||||
// fail. Unrecognized values will be reported but otherwise ignored.
|
||||
bool GetEncryptionSchemes(
|
||||
const base::DictionaryValue& manifest,
|
||||
base::flat_set<media::EncryptionScheme>* encryption_schemes,
|
||||
std::string* error_message) {
|
||||
DCHECK(encryption_schemes);
|
||||
|
||||
const base::Value* value =
|
||||
manifest.FindKey(kCdmSupportedEncryptionSchemesName);
|
||||
if (!value) {
|
||||
// No manifest entry found, so assume only 'cenc' supported for backwards
|
||||
// compatibility.
|
||||
encryption_schemes->insert(media::EncryptionScheme::kCenc);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!value->is_list()) {
|
||||
std::stringstream ss;
|
||||
ss << "Manifest entry " << kCdmSupportedEncryptionSchemesName
|
||||
<< " is not a list.";
|
||||
*error_message = ss.str();
|
||||
return false;
|
||||
}
|
||||
|
||||
const base::span<const base::Value> list = value->GetList();
|
||||
base::flat_set<media::EncryptionScheme> result;
|
||||
for (const auto& item : list) {
|
||||
if (!item.is_string()) {
|
||||
std::stringstream ss;
|
||||
ss << "Unrecognized item type in manifest entry "
|
||||
<< kCdmSupportedEncryptionSchemesName;
|
||||
*error_message = ss.str();
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::string& scheme = item.GetString();
|
||||
if (scheme == kCdmSupportedEncryptionSchemeCenc) {
|
||||
result.insert(media::EncryptionScheme::kCenc);
|
||||
} else if (scheme == kCdmSupportedEncryptionSchemeCbcs) {
|
||||
result.insert(media::EncryptionScheme::kCbcs);
|
||||
} else {
|
||||
std::stringstream ss;
|
||||
ss << "Unrecognized encryption scheme " << scheme << " in manifest entry "
|
||||
<< kCdmSupportedEncryptionSchemesName;
|
||||
*error_message = ss.str();
|
||||
}
|
||||
}
|
||||
|
||||
// As the manifest entry exists, it must specify at least one valid value.
|
||||
if (result.empty())
|
||||
return false;
|
||||
|
||||
encryption_schemes->swap(result);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Returns true and updates |session_types| if the appropriate manifest entry is
|
||||
// valid. Returns false if the manifest entry is incorrectly formatted.
|
||||
bool GetSessionTypes(const base::DictionaryValue& manifest,
|
||||
base::flat_set<media::CdmSessionType>* session_types,
|
||||
std::string* error_message) {
|
||||
DCHECK(session_types);
|
||||
|
||||
bool is_persistent_license_supported = false;
|
||||
const base::Value* value = manifest.FindKey(kCdmPersistentLicenseSupportName);
|
||||
if (value) {
|
||||
if (!value->is_bool())
|
||||
return false;
|
||||
is_persistent_license_supported = value->GetBool();
|
||||
}
|
||||
|
||||
// Temporary session is always supported.
|
||||
session_types->insert(media::CdmSessionType::kTemporary);
|
||||
if (is_persistent_license_supported)
|
||||
session_types->insert(media::CdmSessionType::kPersistentLicense);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Verify and load the contents of |base_path|.
|
||||
cef_cdm_registration_error_t LoadWidevineCdmInfo(
|
||||
const base::FilePath& base_path,
|
||||
CdmInfoArgs* args,
|
||||
std::string* error_message) {
|
||||
std::stringstream ss;
|
||||
|
||||
args->path = base_path.AppendASCII(
|
||||
base::GetNativeLibraryName(kWidevineCdmLibraryName));
|
||||
if (!base::PathExists(args->path)) {
|
||||
ss << "Missing file " << args->path.value();
|
||||
*error_message = ss.str();
|
||||
return CEF_CDM_REGISTRATION_ERROR_INCORRECT_CONTENTS;
|
||||
}
|
||||
|
||||
base::FilePath manifest_path = base_path.AppendASCII("manifest.json");
|
||||
if (!base::PathExists(manifest_path)) {
|
||||
ss << "Missing manifest file " << manifest_path.value();
|
||||
*error_message = ss.str();
|
||||
return CEF_CDM_REGISTRATION_ERROR_INCORRECT_CONTENTS;
|
||||
}
|
||||
|
||||
std::unique_ptr<base::DictionaryValue> manifest =
|
||||
ParseManifestFile(manifest_path);
|
||||
if (!manifest) {
|
||||
ss << "Failed to parse manifest file " << manifest_path.value();
|
||||
*error_message = ss.str();
|
||||
return CEF_CDM_REGISTRATION_ERROR_INCORRECT_CONTENTS;
|
||||
}
|
||||
|
||||
if (!IsCompatibleWithChrome(*manifest, error_message))
|
||||
return CEF_CDM_REGISTRATION_ERROR_INCOMPATIBLE;
|
||||
|
||||
args->version = GetManifestValue(*manifest, kCdmVersionName, error_message);
|
||||
if (args->version.empty())
|
||||
return CEF_CDM_REGISTRATION_ERROR_INCORRECT_CONTENTS;
|
||||
|
||||
if (!GetCodecs(*manifest, &args->capability.video_codecs, error_message) ||
|
||||
!GetEncryptionSchemes(*manifest, &args->capability.encryption_schemes,
|
||||
error_message) ||
|
||||
!GetSessionTypes(*manifest, &args->capability.session_types,
|
||||
error_message)) {
|
||||
return CEF_CDM_REGISTRATION_ERROR_INCORRECT_CONTENTS;
|
||||
}
|
||||
|
||||
return CEF_CDM_REGISTRATION_ERROR_NONE;
|
||||
}
|
||||
|
||||
void DeliverWidevineCdmCallback(cef_cdm_registration_error_t result,
|
||||
const std::string& error_message,
|
||||
CefRefPtr<CefRegisterCdmCallback> callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
if (result != CEF_CDM_REGISTRATION_ERROR_NONE)
|
||||
LOG(ERROR) << "Widevine CDM registration failed; " << error_message;
|
||||
else if (!error_message.empty())
|
||||
LOG(WARNING) << "Widevine CDM registration warning; " << error_message;
|
||||
|
||||
if (callback)
|
||||
callback->OnCdmRegistrationComplete(result, error_message);
|
||||
}
|
||||
|
||||
content::CdmInfo MakeCdmInfo(const CdmInfoArgs& args) {
|
||||
return content::CdmInfo(
|
||||
kWidevineKeySystem, content::CdmInfo::Robustness::kSoftwareSecure,
|
||||
std::move(args.capability), /*supports_sub_key_systems=*/false,
|
||||
kWidevineCdmDisplayName, kWidevineCdmGuid, base::Version(args.version),
|
||||
args.path, kWidevineCdmFileSystemId);
|
||||
}
|
||||
|
||||
void RegisterWidevineCdmOnUIThread(std::unique_ptr<CdmInfoArgs> args,
|
||||
CefRefPtr<CefRegisterCdmCallback> callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
// Register Widevine with the CdmRegistry.
|
||||
content::CdmRegistry::GetInstance()->RegisterCdm(MakeCdmInfo(*args));
|
||||
|
||||
DeliverWidevineCdmCallback(CEF_CDM_REGISTRATION_ERROR_NONE, std::string(),
|
||||
callback);
|
||||
}
|
||||
|
||||
void LoadWidevineCdmInfoOnBlockingThread(
|
||||
const base::FilePath& base_path,
|
||||
CefRefPtr<CefRegisterCdmCallback> callback) {
|
||||
CEF_REQUIRE_BLOCKING();
|
||||
|
||||
std::unique_ptr<CdmInfoArgs> args = std::make_unique<CdmInfoArgs>();
|
||||
std::string error_message;
|
||||
cef_cdm_registration_error_t result =
|
||||
LoadWidevineCdmInfo(base_path, args.get(), &error_message);
|
||||
if (result != CEF_CDM_REGISTRATION_ERROR_NONE) {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(DeliverWidevineCdmCallback, result,
|
||||
error_message, callback));
|
||||
return;
|
||||
}
|
||||
|
||||
// Continue execution on the UI thread.
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(RegisterWidevineCdmOnUIThread,
|
||||
std::move(args), callback));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// static
|
||||
CefWidevineLoader* CefWidevineLoader::GetInstance() {
|
||||
return &g_widevine_loader.Get();
|
||||
}
|
||||
|
||||
void CefWidevineLoader::LoadWidevineCdm(
|
||||
const base::FilePath& path,
|
||||
CefRefPtr<CefRegisterCdmCallback> callback) {
|
||||
if (!CONTEXT_STATE_VALID()) {
|
||||
// Loading will proceed from OnContextInitialized().
|
||||
load_pending_ = true;
|
||||
path_ = path;
|
||||
callback_ = callback;
|
||||
return;
|
||||
}
|
||||
|
||||
CEF_POST_USER_VISIBLE_TASK(
|
||||
base::BindOnce(LoadWidevineCdmInfoOnBlockingThread, path, callback));
|
||||
}
|
||||
|
||||
void CefWidevineLoader::OnContextInitialized() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (load_pending_) {
|
||||
load_pending_ = false;
|
||||
LoadWidevineCdm(path_, callback_);
|
||||
callback_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
|
||||
// static
|
||||
void CefWidevineLoader::AddContentDecryptionModules(
|
||||
std::vector<content::CdmInfo>* cdms,
|
||||
std::vector<media::CdmHostFilePath>* cdm_host_file_paths) {
|
||||
const base::CommandLine& command_line =
|
||||
*base::CommandLine::ForCurrentProcess();
|
||||
|
||||
// Perform early plugin registration in the zygote process when the sandbox is
|
||||
// enabled to avoid "cannot open shared object file: Operation not permitted"
|
||||
// errors during plugin loading. This is because the Zygote process must pre-
|
||||
// load all plugins before initializing the sandbox.
|
||||
if (command_line.GetSwitchValueASCII(switches::kProcessType) !=
|
||||
switches::kZygoteProcess ||
|
||||
command_line.HasSwitch(sandbox::policy::switches::kNoSandbox)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The Widevine CDM path is passed to the zygote process via
|
||||
// AlloyContentBrowserClient::AppendExtraCommandLineSwitches.
|
||||
const base::FilePath& base_path =
|
||||
command_line.GetSwitchValuePath(switches::kWidevineCdmPath);
|
||||
if (base_path.empty())
|
||||
return;
|
||||
|
||||
// Load contents of the plugin directory synchronously. This only occurs once
|
||||
// on zygote process startup so should not have a huge performance penalty.
|
||||
CdmInfoArgs args;
|
||||
std::string error_message;
|
||||
cef_cdm_registration_error_t result =
|
||||
LoadWidevineCdmInfo(base_path, &args, &error_message);
|
||||
if (result != CEF_CDM_REGISTRATION_ERROR_NONE) {
|
||||
LOG(ERROR) << "Widevine CDM registration failed; " << error_message;
|
||||
return;
|
||||
}
|
||||
|
||||
cdms->push_back(MakeCdmInfo(args));
|
||||
}
|
||||
|
||||
#endif // defined(OS_LINUX)
|
||||
|
||||
CefWidevineLoader::CefWidevineLoader() {}
|
||||
|
||||
CefWidevineLoader::~CefWidevineLoader() {}
|
||||
|
||||
#endif // BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
@@ -1,70 +0,0 @@
|
||||
// Copyright 2016 The Chromium Embedded Framework 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_COMMON_WIDEVINE_LOADER_H_
|
||||
#define CEF_LIBCEF_COMMON_WIDEVINE_LOADER_H_
|
||||
#pragma once
|
||||
|
||||
#include "build/build_config.h"
|
||||
#include "media/media_buildflags.h"
|
||||
#include "third_party/widevine/cdm/buildflags.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "include/cef_web_plugin.h"
|
||||
|
||||
#include "base/lazy_instance.h"
|
||||
|
||||
namespace content {
|
||||
struct CdmInfo;
|
||||
}
|
||||
|
||||
namespace media {
|
||||
struct CdmHostFilePath;
|
||||
}
|
||||
|
||||
class CefWidevineLoader {
|
||||
public:
|
||||
// Returns the singleton instance of this object.
|
||||
static CefWidevineLoader* GetInstance();
|
||||
|
||||
// Load the Widevine CDM. May be called before or after context creation. See
|
||||
// comments in cef_web_plugin.h.
|
||||
void LoadWidevineCdm(const base::FilePath& path,
|
||||
CefRefPtr<CefRegisterCdmCallback> callback);
|
||||
|
||||
// Plugin registration is triggered here if LoadWidevineCdm() was called
|
||||
// before context creation.
|
||||
void OnContextInitialized();
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
// The zygote process which is used when the sandbox is enabled on Linux
|
||||
// requires early loading of CDM modules. Other processes will receive
|
||||
// load notification in the usual way.
|
||||
// Called from AlloyContentClient::AddContentDecryptionModules.
|
||||
static void AddContentDecryptionModules(
|
||||
std::vector<content::CdmInfo>* cdms,
|
||||
std::vector<media::CdmHostFilePath>* cdm_host_file_paths);
|
||||
|
||||
const base::FilePath& path() { return path_; }
|
||||
#endif
|
||||
|
||||
private:
|
||||
friend struct base::LazyInstanceTraitsBase<CefWidevineLoader>;
|
||||
|
||||
// Members are only accessed before context initialization or on the UI
|
||||
// thread.
|
||||
bool load_pending_ = false;
|
||||
base::FilePath path_;
|
||||
CefRefPtr<CefRegisterCdmCallback> callback_;
|
||||
|
||||
CefWidevineLoader();
|
||||
~CefWidevineLoader();
|
||||
};
|
||||
|
||||
#endif // BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
|
||||
#endif // CEF_LIBCEF_COMMON_WIDEVINE_LOADER_H_
|
@@ -53,7 +53,6 @@
|
||||
#include "chrome/renderer/chrome_content_renderer_client.h"
|
||||
#include "chrome/renderer/extensions/chrome_extensions_renderer_client.h"
|
||||
#include "chrome/renderer/loadtimes_extension_bindings.h"
|
||||
#include "chrome/renderer/media/chrome_key_systems.h"
|
||||
#include "chrome/renderer/pepper/chrome_pdf_print_client.h"
|
||||
#include "chrome/renderer/pepper/pepper_helper.h"
|
||||
#include "chrome/renderer/plugins/chrome_plugin_placeholder.h"
|
||||
@@ -412,7 +411,11 @@ bool AlloyContentRendererClient::IsOriginIsolatedPepperPlugin(
|
||||
|
||||
void AlloyContentRendererClient::AddSupportedKeySystems(
|
||||
std::vector<std::unique_ptr<::media::KeySystemProperties>>* key_systems) {
|
||||
AddChromeKeySystems(key_systems);
|
||||
key_systems_provider_.AddSupportedKeySystems(key_systems);
|
||||
}
|
||||
|
||||
bool AlloyContentRendererClient::IsKeySystemsUpdateNeeded() {
|
||||
return key_systems_provider_.IsKeySystemsUpdateNeeded();
|
||||
}
|
||||
|
||||
void AlloyContentRendererClient::RunScriptsAtDocumentStart(
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#include "base/single_thread_task_runner.h"
|
||||
#include "base/task/current_thread.h"
|
||||
#include "chrome/common/plugin.mojom.h"
|
||||
#include "chrome/renderer/media/chrome_key_systems_provider.h"
|
||||
#include "content/public/renderer/content_renderer_client.h"
|
||||
#include "content/public/renderer/render_thread.h"
|
||||
#include "mojo/public/cpp/bindings/generic_pending_receiver.h"
|
||||
@@ -99,6 +100,7 @@ class AlloyContentRendererClient
|
||||
void AddSupportedKeySystems(
|
||||
std::vector<std::unique_ptr<::media::KeySystemProperties>>* key_systems)
|
||||
override;
|
||||
bool IsKeySystemsUpdateNeeded() override;
|
||||
void RunScriptsAtDocumentStart(content::RenderFrame* render_frame) override;
|
||||
void RunScriptsAtDocumentEnd(content::RenderFrame* render_frame) override;
|
||||
void RunScriptsAtDocumentIdle(content::RenderFrame* render_frame) override;
|
||||
@@ -140,6 +142,10 @@ class AlloyContentRendererClient
|
||||
std::unique_ptr<extensions::CefExtensionsRendererClient>
|
||||
extensions_renderer_client_;
|
||||
|
||||
// Used to refresh the list of supported key systems after Widevine is
|
||||
// installed as a component update.
|
||||
ChromeKeySystemsProvider key_systems_provider_;
|
||||
|
||||
// Used in single-process mode to test when cleanup is complete.
|
||||
// Access must be protected by |single_process_cleanup_lock_|.
|
||||
bool single_process_cleanup_complete_ = false;
|
||||
|
@@ -50,7 +50,9 @@ void AlloyRenderThreadObserver::UnregisterMojoInterfaces(
|
||||
|
||||
void AlloyRenderThreadObserver::SetInitialConfiguration(
|
||||
bool is_incognito_process,
|
||||
mojo::PendingReceiver<chrome::mojom::ChromeOSListener> chromeos_listener) {
|
||||
mojo::PendingReceiver<chrome::mojom::ChromeOSListener> chromeos_listener,
|
||||
mojo::PendingRemote<content_settings::mojom::ContentSettingsManager>
|
||||
content_settings_manager) {
|
||||
is_incognito_process_ = is_incognito_process;
|
||||
}
|
||||
|
||||
|
@@ -37,8 +37,9 @@ class AlloyRenderThreadObserver : public content::RenderThreadObserver,
|
||||
// chrome::mojom::RendererConfiguration:
|
||||
void SetInitialConfiguration(
|
||||
bool is_incognito_process,
|
||||
mojo::PendingReceiver<chrome::mojom::ChromeOSListener> chromeos_listener)
|
||||
override;
|
||||
mojo::PendingReceiver<chrome::mojom::ChromeOSListener> chromeos_listener,
|
||||
mojo::PendingRemote<content_settings::mojom::ContentSettingsManager>
|
||||
content_settings_manager) override;
|
||||
void SetConfiguration(chrome::mojom::DynamicParamsPtr params) override;
|
||||
void SetContentSettingRules(
|
||||
const RendererContentSettingRules& rules) override;
|
||||
|
@@ -126,20 +126,20 @@ void CefRenderFrameObserver::DidCreateScriptContext(
|
||||
CefRefPtr<CefApp> application = CefAppManager::Get()->GetApplication();
|
||||
if (application)
|
||||
handler = application->GetRenderProcessHandler();
|
||||
if (!handler)
|
||||
return;
|
||||
|
||||
CefRefPtr<CefFrameImpl> framePtr = browserPtr->GetWebFrameImpl(frame);
|
||||
|
||||
v8::Isolate* isolate = blink::MainThreadIsolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
v8::Context::Scope scope(context);
|
||||
v8::MicrotasksScope microtasks_scope(isolate,
|
||||
v8::MicrotasksScope::kRunMicrotasks);
|
||||
if (handler) {
|
||||
v8::Isolate* isolate = blink::MainThreadIsolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
v8::Context::Scope scope(context);
|
||||
v8::MicrotasksScope microtasks_scope(isolate,
|
||||
v8::MicrotasksScope::kRunMicrotasks);
|
||||
|
||||
CefRefPtr<CefV8Context> contextPtr(new CefV8ContextImpl(isolate, context));
|
||||
CefRefPtr<CefV8Context> contextPtr(new CefV8ContextImpl(isolate, context));
|
||||
|
||||
handler->OnContextCreated(browserPtr.get(), framePtr.get(), contextPtr);
|
||||
handler->OnContextCreated(browserPtr.get(), framePtr.get(), contextPtr);
|
||||
}
|
||||
|
||||
// Do this last, in case the client callback modified the window object.
|
||||
framePtr->OnContextCreated();
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.chromium.ContentShell.framework</string>
|
||||
<string>org.cef.framework</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
|
@@ -1,70 +0,0 @@
|
||||
// Copyright (c) 2021 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=5f7db6dda8ac868e8ec94b93e3ae7d2dd7d0cf64$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/register_cdm_callback_cpptoc.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
void CEF_CALLBACK register_cdm_callback_on_cdm_registration_complete(
|
||||
struct _cef_register_cdm_callback_t* self,
|
||||
cef_cdm_registration_error_t result,
|
||||
const cef_string_t* error_message) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Unverified params: error_message
|
||||
|
||||
// Execute
|
||||
CefRegisterCdmCallbackCppToC::Get(self)->OnCdmRegistrationComplete(
|
||||
result, CefString(error_message));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefRegisterCdmCallbackCppToC::CefRegisterCdmCallbackCppToC() {
|
||||
GetStruct()->on_cdm_registration_complete =
|
||||
register_cdm_callback_on_cdm_registration_complete;
|
||||
}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefRegisterCdmCallbackCppToC::~CefRegisterCdmCallbackCppToC() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
CefRefPtr<CefRegisterCdmCallback> CefCppToCRefCounted<
|
||||
CefRegisterCdmCallbackCppToC,
|
||||
CefRegisterCdmCallback,
|
||||
cef_register_cdm_callback_t>::UnwrapDerived(CefWrapperType type,
|
||||
cef_register_cdm_callback_t*
|
||||
s) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType CefCppToCRefCounted<CefRegisterCdmCallbackCppToC,
|
||||
CefRegisterCdmCallback,
|
||||
cef_register_cdm_callback_t>::kWrapperType =
|
||||
WT_REGISTER_CDM_CALLBACK;
|
@@ -1,40 +0,0 @@
|
||||
// Copyright (c) 2021 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=9817a192fb9476a843c3ccd0467e781adf426b91$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CPPTOC_REGISTER_CDM_CALLBACK_CPPTOC_H_
|
||||
#define CEF_LIBCEF_DLL_CPPTOC_REGISTER_CDM_CALLBACK_CPPTOC_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(WRAPPING_CEF_SHARED)
|
||||
#error This file can be included wrapper-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_browser_capi.h"
|
||||
#include "include/capi/cef_web_plugin_capi.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_web_plugin.h"
|
||||
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
|
||||
|
||||
// Wrap a C++ class with a C structure.
|
||||
// This class may be instantiated and accessed wrapper-side only.
|
||||
class CefRegisterCdmCallbackCppToC
|
||||
: public CefCppToCRefCounted<CefRegisterCdmCallbackCppToC,
|
||||
CefRegisterCdmCallback,
|
||||
cef_register_cdm_callback_t> {
|
||||
public:
|
||||
CefRegisterCdmCallbackCppToC();
|
||||
virtual ~CefRegisterCdmCallbackCppToC();
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CPPTOC_REGISTER_CDM_CALLBACK_CPPTOC_H_
|
@@ -1,63 +0,0 @@
|
||||
// Copyright (c) 2021 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=cf53fb30f47eeda9354fa60731d554ea757a47ac$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/register_cdm_callback_ctocpp.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefRegisterCdmCallbackCToCpp::OnCdmRegistrationComplete(
|
||||
cef_cdm_registration_error_t result,
|
||||
const CefString& error_message) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_register_cdm_callback_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_cdm_registration_complete))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Unverified params: error_message
|
||||
|
||||
// Execute
|
||||
_struct->on_cdm_registration_complete(_struct, result,
|
||||
error_message.GetStruct());
|
||||
}
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefRegisterCdmCallbackCToCpp::CefRegisterCdmCallbackCToCpp() {}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefRegisterCdmCallbackCToCpp::~CefRegisterCdmCallbackCToCpp() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
cef_register_cdm_callback_t* CefCToCppRefCounted<
|
||||
CefRegisterCdmCallbackCToCpp,
|
||||
CefRegisterCdmCallback,
|
||||
cef_register_cdm_callback_t>::UnwrapDerived(CefWrapperType type,
|
||||
CefRegisterCdmCallback* c) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType CefCToCppRefCounted<CefRegisterCdmCallbackCToCpp,
|
||||
CefRegisterCdmCallback,
|
||||
cef_register_cdm_callback_t>::kWrapperType =
|
||||
WT_REGISTER_CDM_CALLBACK;
|
@@ -1,44 +0,0 @@
|
||||
// Copyright (c) 2021 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=202e9ab7dd5d4dc53daa2f716e0dd74c623ecd8c$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_REGISTER_CDM_CALLBACK_CTOCPP_H_
|
||||
#define CEF_LIBCEF_DLL_CTOCPP_REGISTER_CDM_CALLBACK_CTOCPP_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(BUILDING_CEF_SHARED)
|
||||
#error This file can be included DLL-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_browser_capi.h"
|
||||
#include "include/capi/cef_web_plugin_capi.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_web_plugin.h"
|
||||
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
|
||||
|
||||
// Wrap a C structure with a C++ class.
|
||||
// This class may be instantiated and accessed DLL-side only.
|
||||
class CefRegisterCdmCallbackCToCpp
|
||||
: public CefCToCppRefCounted<CefRegisterCdmCallbackCToCpp,
|
||||
CefRegisterCdmCallback,
|
||||
cef_register_cdm_callback_t> {
|
||||
public:
|
||||
CefRegisterCdmCallbackCToCpp();
|
||||
virtual ~CefRegisterCdmCallbackCToCpp();
|
||||
|
||||
// CefRegisterCdmCallback methods.
|
||||
void OnCdmRegistrationComplete(cef_cdm_registration_error_t result,
|
||||
const CefString& error_message) override;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_REGISTER_CDM_CALLBACK_CTOCPP_H_
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=b2f22315d4021be203ececa54d5bb8c651f60dfc$
|
||||
// $hash=232cd54c28334b9a3d98ebfb5a291643f0a7db62$
|
||||
//
|
||||
|
||||
#include "include/capi/cef_app_capi.h"
|
||||
@@ -47,7 +47,6 @@
|
||||
#include "libcef_dll/ctocpp/app_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/completion_callback_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/end_tracing_callback_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/register_cdm_callback_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/scheme_handler_factory_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/task_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/v8handler_ctocpp.h"
|
||||
@@ -892,22 +891,6 @@ CEF_EXPORT void cef_is_web_plugin_unstable(
|
||||
CefWebPluginUnstableCallbackCToCpp::Wrap(callback));
|
||||
}
|
||||
|
||||
CEF_EXPORT void cef_register_widevine_cdm(
|
||||
const cef_string_t* path,
|
||||
struct _cef_register_cdm_callback_t* callback) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: path; type: string_byref_const
|
||||
DCHECK(path);
|
||||
if (!path)
|
||||
return;
|
||||
// Unverified params: callback
|
||||
|
||||
// Execute
|
||||
CefRegisterWidevineCdm(CefString(path),
|
||||
CefRegisterCdmCallbackCToCpp::Wrap(callback));
|
||||
}
|
||||
|
||||
CEF_EXPORT void cef_execute_java_script_with_user_gesture_for_tests(
|
||||
struct _cef_frame_t* frame,
|
||||
const cef_string_t* javascript) {
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=85426bf2da9016443939636319265fff616f1cb4$
|
||||
// $hash=01fb8dd98e44b937595c1e1f987f5e4850bff64d$
|
||||
//
|
||||
|
||||
#include <dlfcn.h>
|
||||
@@ -177,9 +177,6 @@ typedef void (*cef_register_web_plugin_crash_ptr)(const cef_string_t*);
|
||||
typedef void (*cef_is_web_plugin_unstable_ptr)(
|
||||
const cef_string_t*,
|
||||
struct _cef_web_plugin_unstable_callback_t*);
|
||||
typedef void (*cef_register_widevine_cdm_ptr)(
|
||||
const cef_string_t*,
|
||||
struct _cef_register_cdm_callback_t*);
|
||||
typedef void (*cef_execute_java_script_with_user_gesture_for_tests_ptr)(
|
||||
struct _cef_frame_t*,
|
||||
const cef_string_t*);
|
||||
@@ -570,7 +567,6 @@ struct libcef_pointers {
|
||||
cef_unregister_internal_web_plugin_ptr cef_unregister_internal_web_plugin;
|
||||
cef_register_web_plugin_crash_ptr cef_register_web_plugin_crash;
|
||||
cef_is_web_plugin_unstable_ptr cef_is_web_plugin_unstable;
|
||||
cef_register_widevine_cdm_ptr cef_register_widevine_cdm;
|
||||
cef_execute_java_script_with_user_gesture_for_tests_ptr
|
||||
cef_execute_java_script_with_user_gesture_for_tests;
|
||||
cef_browser_host_create_browser_ptr cef_browser_host_create_browser;
|
||||
@@ -787,7 +783,6 @@ int libcef_init_pointers(const char* path) {
|
||||
INIT_ENTRY(cef_unregister_internal_web_plugin);
|
||||
INIT_ENTRY(cef_register_web_plugin_crash);
|
||||
INIT_ENTRY(cef_is_web_plugin_unstable);
|
||||
INIT_ENTRY(cef_register_widevine_cdm);
|
||||
INIT_ENTRY(cef_execute_java_script_with_user_gesture_for_tests);
|
||||
INIT_ENTRY(cef_browser_host_create_browser);
|
||||
INIT_ENTRY(cef_browser_host_create_browser_sync);
|
||||
@@ -1255,12 +1250,6 @@ void cef_is_web_plugin_unstable(
|
||||
g_libcef_pointers.cef_is_web_plugin_unstable(path, callback);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void cef_register_widevine_cdm(const cef_string_t* path,
|
||||
struct _cef_register_cdm_callback_t* callback) {
|
||||
g_libcef_pointers.cef_register_widevine_cdm(path, callback);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void cef_execute_java_script_with_user_gesture_for_tests(
|
||||
struct _cef_frame_t* frame,
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=b43931d8bb81fbfd7a55c011ac6e5b471b3a30ac$
|
||||
// $hash=7fef7aaa85b96ed7c7fc82542cd393210e1d89ee$
|
||||
//
|
||||
|
||||
#include "include/capi/cef_app_capi.h"
|
||||
@@ -44,7 +44,6 @@
|
||||
#include "libcef_dll/cpptoc/app_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/completion_callback_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/end_tracing_callback_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/register_cdm_callback_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/task_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/v8handler_cpptoc.h"
|
||||
@@ -167,7 +166,7 @@ NO_SANITIZE("cfi-icall") CEF_GLOBAL bool CefCrashReportingEnabled() {
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CEF_GLOBAL
|
||||
void CefSetCrashKeyValue(const CefString& key, const CefString& value) {
|
||||
void CefSetCrashKeyValue(const CefString& key, const CefString& value) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: key; type: string_byref_const
|
||||
@@ -312,10 +311,10 @@ CEF_GLOBAL void CefLoadCRLSetsFile(const CefString& path) {
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CEF_GLOBAL
|
||||
bool CefAddCrossOriginWhitelistEntry(const CefString& source_origin,
|
||||
const CefString& target_protocol,
|
||||
const CefString& target_domain,
|
||||
bool allow_target_subdomains) {
|
||||
bool CefAddCrossOriginWhitelistEntry(const CefString& source_origin,
|
||||
const CefString& target_protocol,
|
||||
const CefString& target_domain,
|
||||
bool allow_target_subdomains) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: source_origin; type: string_byref_const
|
||||
@@ -339,10 +338,10 @@ CEF_GLOBAL
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CEF_GLOBAL
|
||||
bool CefRemoveCrossOriginWhitelistEntry(const CefString& source_origin,
|
||||
const CefString& target_protocol,
|
||||
const CefString& target_domain,
|
||||
bool allow_target_subdomains) {
|
||||
bool CefRemoveCrossOriginWhitelistEntry(const CefString& source_origin,
|
||||
const CefString& target_protocol,
|
||||
const CefString& target_domain,
|
||||
bool allow_target_subdomains) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: source_origin; type: string_byref_const
|
||||
@@ -403,7 +402,7 @@ CEF_GLOBAL bool CefCreateURL(const CefURLParts& parts, CefString& url) {
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CEF_GLOBAL CefString
|
||||
CefFormatUrlForSecurityDisplay(const CefString& origin_url) {
|
||||
CefFormatUrlForSecurityDisplay(const CefString& origin_url) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: origin_url; type: string_byref_const
|
||||
@@ -441,8 +440,8 @@ CEF_GLOBAL CefString CefGetMimeType(const CefString& extension) {
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CEF_GLOBAL
|
||||
void CefGetExtensionsForMimeType(const CefString& mime_type,
|
||||
std::vector<CefString>& extensions) {
|
||||
void CefGetExtensionsForMimeType(const CefString& mime_type,
|
||||
std::vector<CefString>& extensions) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: mime_type; type: string_byref_const
|
||||
@@ -596,8 +595,8 @@ CEF_GLOBAL CefRefPtr<CefValue> CefParseJSONAndReturnError(
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CEF_GLOBAL CefString
|
||||
CefWriteJSON(CefRefPtr<CefValue> node, cef_json_writer_options_t options) {
|
||||
CEF_GLOBAL CefString CefWriteJSON(CefRefPtr<CefValue> node,
|
||||
cef_json_writer_options_t options) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: node; type: refptr_same
|
||||
@@ -797,7 +796,7 @@ CEF_GLOBAL bool CefRegisterExtension(const CefString& extension_name,
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CEF_GLOBAL
|
||||
void CefVisitWebPluginInfo(CefRefPtr<CefWebPluginInfoVisitor> visitor) {
|
||||
void CefVisitWebPluginInfo(CefRefPtr<CefWebPluginInfoVisitor> visitor) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: visitor; type: refptr_diff
|
||||
@@ -862,23 +861,6 @@ CEF_GLOBAL void CefIsWebPluginUnstable(
|
||||
path.GetStruct(), CefWebPluginUnstableCallbackCppToC::Wrap(callback));
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CEF_GLOBAL
|
||||
void CefRegisterWidevineCdm(const CefString& path,
|
||||
CefRefPtr<CefRegisterCdmCallback> callback) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: path; type: string_byref_const
|
||||
DCHECK(!path.empty());
|
||||
if (path.empty())
|
||||
return;
|
||||
// Unverified params: callback
|
||||
|
||||
// Execute
|
||||
cef_register_widevine_cdm(path.GetStruct(),
|
||||
CefRegisterCdmCallbackCppToC::Wrap(callback));
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CEF_GLOBAL void CefExecuteJavaScriptWithUserGestureForTests(
|
||||
CefRefPtr<CefFrame> frame,
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=8b8237eb5b789df29937eaf46a231e0ca83d86c6$
|
||||
// $hash=abd4c6d471c9ff3d7113b6125a6cfb2a26d58304$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_WRAPPER_TYPES_H_
|
||||
@@ -101,7 +101,6 @@ enum CefWrapperType {
|
||||
WT_PRINT_SETTINGS,
|
||||
WT_PROCESS_MESSAGE,
|
||||
WT_READ_HANDLER,
|
||||
WT_REGISTER_CDM_CALLBACK,
|
||||
WT_REGISTRATION,
|
||||
WT_RENDER_HANDLER,
|
||||
WT_RENDER_PROCESS_HANDLER,
|
||||
|
@@ -39,9 +39,6 @@ patches = [
|
||||
#
|
||||
# Support custom VS toolchain on Windows.
|
||||
# https://bugs.chromium.org/p/chromium/issues/detail?id=623342
|
||||
#
|
||||
# Update "py" wheel to a version that is compatible with pytest-6.2.2.
|
||||
# https://bugs.chromium.org/p/chromium/issues/detail?id=1231439
|
||||
'name': 'runhooks',
|
||||
},
|
||||
{
|
||||
@@ -189,13 +186,6 @@ patches = [
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/2102
|
||||
'name': 'views_1749_2102',
|
||||
},
|
||||
{
|
||||
# Fix chrome Widevine build on Linux.
|
||||
#
|
||||
# Remove incorrect assertion on Windows/macOS by cherry-picking this commit:
|
||||
# https://chromium.googlesource.com/chromium/src/+/ec992a43e7
|
||||
'name': 'chrome_widevine',
|
||||
},
|
||||
{
|
||||
# Support CEF changes in chrome/browser.
|
||||
'name': 'chrome_browser',
|
||||
@@ -405,6 +395,11 @@ patches = [
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/1936
|
||||
'name': 'linux_assets_path_1936',
|
||||
},
|
||||
{
|
||||
# Linux: Avoid usage of chrome::FILE_COMPONENT_WIDEVINE_CDM_HINT.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/3149
|
||||
'name': 'linux_chrome_widevine_3149',
|
||||
},
|
||||
{
|
||||
# Enhancements to NetworkService:
|
||||
# - Add support for calling CookieMonster::SetCookieableSchemes.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git base/BUILD.gn base/BUILD.gn
|
||||
index 576bd49a6198f..d5872f293f7cc 100644
|
||||
index 1c989c7e92216..b8b637397f616 100644
|
||||
--- base/BUILD.gn
|
||||
+++ base/BUILD.gn
|
||||
@@ -34,6 +34,7 @@ import("//build/config/ui.gni")
|
||||
@@ -10,7 +10,7 @@ index 576bd49a6198f..d5872f293f7cc 100644
|
||||
import("//testing/libfuzzer/fuzzer_test.gni")
|
||||
import("//testing/test.gni")
|
||||
import("//third_party/icu/config.gni")
|
||||
@@ -1731,7 +1732,11 @@ component("base") {
|
||||
@@ -1733,7 +1734,11 @@ component("base") {
|
||||
"hash/md5_constexpr_internal.h",
|
||||
"hash/sha1.h",
|
||||
]
|
||||
@@ -23,7 +23,7 @@ index 576bd49a6198f..d5872f293f7cc 100644
|
||||
sources += [
|
||||
"hash/md5_nacl.cc",
|
||||
"hash/md5_nacl.h",
|
||||
@@ -1978,6 +1983,12 @@ component("base") {
|
||||
@@ -1980,6 +1985,12 @@ component("base") {
|
||||
defines += [ "COM_INIT_CHECK_HOOK_DISABLED" ]
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,7 @@ index eefad1a677606..7318d223a63d0 100644
|
||||
|
||||
// TODO(wjmaclean): We should update the ProcessLock comparison API
|
||||
diff --git content/browser/renderer_host/navigation_request.cc content/browser/renderer_host/navigation_request.cc
|
||||
index 5b830ecbb4a47..39b32f681233e 100644
|
||||
index 986d27fc91a78..1a3f8a899cb7b 100644
|
||||
--- content/browser/renderer_host/navigation_request.cc
|
||||
+++ content/browser/renderer_host/navigation_request.cc
|
||||
@@ -5606,6 +5606,12 @@ url::Origin
|
||||
|
@@ -54,10 +54,10 @@ index 173582c7c4904..bbf57904b6de9 100644
|
||||
#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
|
||||
SupervisedUserSettingsService* supervised_service =
|
||||
diff --git components/content_settings/renderer/content_settings_agent_impl.cc components/content_settings/renderer/content_settings_agent_impl.cc
|
||||
index 610f6d942998c..f822df04ff07d 100644
|
||||
index f27839a59d049..6b5f43762c776 100644
|
||||
--- components/content_settings/renderer/content_settings_agent_impl.cc
|
||||
+++ components/content_settings/renderer/content_settings_agent_impl.cc
|
||||
@@ -170,7 +170,7 @@ ContentSetting GetContentSettingFromRulesImpl(
|
||||
@@ -171,7 +171,7 @@ ContentSetting GetContentSettingFromRulesImpl(
|
||||
return rule.GetContentSetting();
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
diff --git chrome/browser/renderer_context_menu/render_view_context_menu.cc chrome/browser/renderer_context_menu/render_view_context_menu.cc
|
||||
index 408566907e832..1266687ccd665 100644
|
||||
index f709ee1009830..fdfaf2048f39d 100644
|
||||
--- chrome/browser/renderer_context_menu/render_view_context_menu.cc
|
||||
+++ chrome/browser/renderer_context_menu/render_view_context_menu.cc
|
||||
@@ -273,6 +273,13 @@ base::OnceCallback<void(RenderViewContextMenu*)>* GetMenuShownCallback() {
|
||||
@@ -277,6 +277,13 @@ base::OnceCallback<void(RenderViewContextMenu*)>* GetMenuShownCallback() {
|
||||
return callback.get();
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ index 408566907e832..1266687ccd665 100644
|
||||
enum class UmaEnumIdLookupType {
|
||||
GeneralEnumId,
|
||||
ContextSpecificEnumId,
|
||||
@@ -484,6 +491,10 @@ int FindUMAEnumValueForCommand(int id, UmaEnumIdLookupType type) {
|
||||
@@ -488,6 +495,10 @@ int FindUMAEnumValueForCommand(int id, UmaEnumIdLookupType type) {
|
||||
if (ContextMenuMatcher::IsExtensionsCustomCommandId(id))
|
||||
return 1;
|
||||
|
||||
@@ -27,7 +27,7 @@ index 408566907e832..1266687ccd665 100644
|
||||
id = CollapseCommandsForUMA(id);
|
||||
const auto& map = GetIdcToUmaMap(type);
|
||||
auto it = map.find(id);
|
||||
@@ -656,6 +667,14 @@ RenderViewContextMenu::RenderViewContextMenu(
|
||||
@@ -660,6 +671,14 @@ RenderViewContextMenu::RenderViewContextMenu(
|
||||
system_app_type_ = GetBrowser() && GetBrowser()->app_controller()
|
||||
? GetBrowser()->app_controller()->system_app_type()
|
||||
: absl::nullopt;
|
||||
@@ -42,7 +42,7 @@ index 408566907e832..1266687ccd665 100644
|
||||
}
|
||||
|
||||
RenderViewContextMenu::~RenderViewContextMenu() = default;
|
||||
@@ -1022,6 +1041,12 @@ void RenderViewContextMenu::InitMenu() {
|
||||
@@ -1028,6 +1047,12 @@ void RenderViewContextMenu::InitMenu() {
|
||||
// menu, meaning that each menu item added/removed in this function will cause
|
||||
// it to visibly jump on the screen (see b/173569669).
|
||||
AppendQuickAnswersItems();
|
||||
@@ -55,7 +55,7 @@ index 408566907e832..1266687ccd665 100644
|
||||
}
|
||||
|
||||
Profile* RenderViewContextMenu::GetProfile() const {
|
||||
@@ -2742,6 +2767,12 @@ void RenderViewContextMenu::RegisterMenuShownCallbackForTesting(
|
||||
@@ -2761,6 +2786,12 @@ void RenderViewContextMenu::RegisterMenuShownCallbackForTesting(
|
||||
*GetMenuShownCallback() = std::move(cb);
|
||||
}
|
||||
|
||||
@@ -69,10 +69,10 @@ index 408566907e832..1266687ccd665 100644
|
||||
RenderViewContextMenu::GetHandlersForLinkUrl() {
|
||||
ProtocolHandlerRegistry::ProtocolHandlerList handlers =
|
||||
diff --git chrome/browser/renderer_context_menu/render_view_context_menu.h chrome/browser/renderer_context_menu/render_view_context_menu.h
|
||||
index 34b6152a222ec..b03c81bd076b8 100644
|
||||
index 3e75832061fd2..76ffd6b12bc84 100644
|
||||
--- chrome/browser/renderer_context_menu/render_view_context_menu.h
|
||||
+++ chrome/browser/renderer_context_menu/render_view_context_menu.h
|
||||
@@ -101,6 +101,12 @@ class RenderViewContextMenu : public RenderViewContextMenuBase,
|
||||
@@ -105,6 +105,12 @@ class RenderViewContextMenu : public RenderViewContextMenuBase,
|
||||
static void RegisterMenuShownCallbackForTesting(
|
||||
base::OnceCallback<void(RenderViewContextMenu*)> cb);
|
||||
|
||||
@@ -85,7 +85,7 @@ index 34b6152a222ec..b03c81bd076b8 100644
|
||||
protected:
|
||||
Profile* GetProfile() const;
|
||||
|
||||
@@ -296,6 +302,9 @@ class RenderViewContextMenu : public RenderViewContextMenuBase,
|
||||
@@ -301,6 +307,9 @@ class RenderViewContextMenu : public RenderViewContextMenuBase,
|
||||
// built.
|
||||
bool is_protocol_submenu_valid_ = false;
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn
|
||||
index ac4bc7b9021ee..fefdb822c5b71 100644
|
||||
index ef291e5fc39d9..7abde248d8064 100644
|
||||
--- chrome/browser/ui/BUILD.gn
|
||||
+++ chrome/browser/ui/BUILD.gn
|
||||
@@ -11,6 +11,7 @@ import("//build/config/features.gni")
|
||||
@@ -29,7 +29,7 @@ index ac4bc7b9021ee..fefdb822c5b71 100644
|
||||
"//chrome:extra_resources",
|
||||
"//chrome:resources",
|
||||
"//chrome:strings",
|
||||
@@ -4878,6 +4884,7 @@ static_library("ui") {
|
||||
@@ -4879,6 +4885,7 @@ static_library("ui") {
|
||||
if (enable_basic_printing) {
|
||||
deps += [
|
||||
"//components/printing/browser",
|
||||
|
@@ -85,10 +85,10 @@ index e3e819d9ecd87..ef8c6ebd1cf2e 100644
|
||||
virtual bool IsSignedIn() = 0;
|
||||
|
||||
diff --git chrome/browser/profiles/profile_impl.cc chrome/browser/profiles/profile_impl.cc
|
||||
index 5d87d4fff37ab..61d00177e036e 100644
|
||||
index 9a6b9dd9fe3c9..4c74e5995c16b 100644
|
||||
--- chrome/browser/profiles/profile_impl.cc
|
||||
+++ chrome/browser/profiles/profile_impl.cc
|
||||
@@ -929,7 +929,9 @@ Profile* ProfileImpl::GetOffTheRecordProfile(const OTRProfileID& otr_profile_id,
|
||||
@@ -963,7 +963,9 @@ Profile* ProfileImpl::GetOffTheRecordProfile(const OTRProfileID& otr_profile_id,
|
||||
|
||||
otr_profiles_[otr_profile_id] = std::move(otr_profile);
|
||||
|
||||
@@ -100,7 +100,7 @@ index 5d87d4fff37ab..61d00177e036e 100644
|
||||
return raw_otr_profile;
|
||||
}
|
||||
diff --git chrome/browser/profiles/profile_manager.cc chrome/browser/profiles/profile_manager.cc
|
||||
index aef8964db423d..e15bc0dc20285 100644
|
||||
index 69c65075f3a27..5bbada14840be 100644
|
||||
--- chrome/browser/profiles/profile_manager.cc
|
||||
+++ chrome/browser/profiles/profile_manager.cc
|
||||
@@ -495,7 +495,7 @@ ProfileManager::ProfileManager(const base::FilePath& user_data_dir)
|
||||
@@ -135,7 +135,7 @@ index 915a95e287c58..0424e8bdd7d84 100644
|
||||
// Returns the directory where the first created profile is stored,
|
||||
// relative to the user data directory currently in use.
|
||||
diff --git chrome/browser/profiles/renderer_updater.cc chrome/browser/profiles/renderer_updater.cc
|
||||
index 5e71c1f56da15..db5c46cb5f85f 100644
|
||||
index c8771e1d5072b..4ce60104e0c61 100644
|
||||
--- chrome/browser/profiles/renderer_updater.cc
|
||||
+++ chrome/browser/profiles/renderer_updater.cc
|
||||
@@ -8,6 +8,7 @@
|
||||
@@ -143,10 +143,10 @@ index 5e71c1f56da15..db5c46cb5f85f 100644
|
||||
#include "base/bind.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
+#include "cef/libcef/features/runtime.h"
|
||||
#include "chrome/browser/content_settings/content_settings_manager_delegate.h"
|
||||
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/signin/identity_manager_factory.h"
|
||||
@@ -57,8 +58,12 @@ void GetGuestViewDefaultContentSettingRules(
|
||||
@@ -60,8 +61,12 @@ void GetGuestViewDefaultContentSettingRules(
|
||||
} // namespace
|
||||
|
||||
RendererUpdater::RendererUpdater(Profile* profile) : profile_(profile) {
|
||||
|
@@ -186,10 +186,10 @@ index 88a87fd4d74bb..2815c9897d636 100644
|
||||
// that the X-Frame-Options protection mechanism is set to either DENY or
|
||||
// SAMEORIGIN.
|
||||
diff --git chrome/renderer/chrome_content_renderer_client.cc chrome/renderer/chrome_content_renderer_client.cc
|
||||
index a6e34d86aa11c..1141f02719e9b 100644
|
||||
index 4cd049fba2741..c2129c7bd207a 100644
|
||||
--- chrome/renderer/chrome_content_renderer_client.cc
|
||||
+++ chrome/renderer/chrome_content_renderer_client.cc
|
||||
@@ -919,6 +919,7 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
|
||||
@@ -925,6 +925,7 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
|
||||
|
||||
if ((status == chrome::mojom::PluginStatus::kUnauthorized ||
|
||||
status == chrome::mojom::PluginStatus::kBlocked) &&
|
||||
@@ -197,7 +197,7 @@ index a6e34d86aa11c..1141f02719e9b 100644
|
||||
content_settings_agent_delegate->IsPluginTemporarilyAllowed(
|
||||
identifier)) {
|
||||
status = chrome::mojom::PluginStatus::kAllowed;
|
||||
@@ -1122,7 +1123,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
|
||||
@@ -1128,7 +1129,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
|
||||
render_frame->GetRemoteAssociatedInterfaces()->GetInterface(
|
||||
plugin_auth_host.BindNewEndpointAndPassReceiver());
|
||||
plugin_auth_host->BlockedUnauthorizedPlugin(group_name, identifier);
|
||||
@@ -207,7 +207,7 @@ index a6e34d86aa11c..1141f02719e9b 100644
|
||||
break;
|
||||
}
|
||||
case chrome::mojom::PluginStatus::kBlocked: {
|
||||
@@ -1131,7 +1133,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
|
||||
@@ -1137,7 +1139,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
|
||||
l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name));
|
||||
placeholder->AllowLoading();
|
||||
RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Blocked"));
|
||||
@@ -217,7 +217,7 @@ index a6e34d86aa11c..1141f02719e9b 100644
|
||||
break;
|
||||
}
|
||||
case chrome::mojom::PluginStatus::kBlockedByPolicy: {
|
||||
@@ -1141,7 +1144,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
|
||||
@@ -1147,7 +1150,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
|
||||
group_name));
|
||||
RenderThread::Get()->RecordAction(
|
||||
UserMetricsAction("Plugin_BlockedByPolicy"));
|
||||
@@ -227,7 +227,7 @@ index a6e34d86aa11c..1141f02719e9b 100644
|
||||
break;
|
||||
}
|
||||
case chrome::mojom::PluginStatus::kBlockedNoLoading: {
|
||||
@@ -1149,7 +1153,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
|
||||
@@ -1155,7 +1159,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
|
||||
IDR_BLOCKED_PLUGIN_HTML,
|
||||
l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED_NO_LOADING,
|
||||
group_name));
|
||||
|
@@ -205,7 +205,7 @@ index ab4c2b03755d3..8e813496f9df6 100644
|
||||
base::mac::ScopedMachSendRight exceptionPort(
|
||||
crash_reporter::GetCrashpadClient().GetHandlerMachPort());
|
||||
diff --git chrome/browser/prefs/browser_prefs.cc chrome/browser/prefs/browser_prefs.cc
|
||||
index 3de6df64935e3..78a2bf3896e72 100644
|
||||
index 73a940e67d22e..ba2611585d8e4 100644
|
||||
--- chrome/browser/prefs/browser_prefs.cc
|
||||
+++ chrome/browser/prefs/browser_prefs.cc
|
||||
@@ -10,6 +10,7 @@
|
||||
@@ -227,7 +227,7 @@ index 3de6df64935e3..78a2bf3896e72 100644
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
#include "chrome/browser/accessibility/animation_policy_prefs.h"
|
||||
#include "chrome/browser/apps/platform_apps/shortcut_manager.h"
|
||||
@@ -1134,6 +1139,10 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
|
||||
@@ -1135,6 +1140,10 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
|
||||
SessionDataService::RegisterProfilePrefs(registry);
|
||||
#endif
|
||||
|
||||
|
@@ -120,7 +120,7 @@ index 0ce7abdeb7d9f..8197a6bb7da98 100644
|
||||
|
||||
// Initialize the frame (creates the underlying native window).
|
||||
diff --git chrome/browser/ui/views/frame/browser_view.cc chrome/browser/ui/views/frame/browser_view.cc
|
||||
index f3239963d569a..2bee32af5a8dd 100644
|
||||
index 18c19c28cddd3..c073870194802 100644
|
||||
--- chrome/browser/ui/views/frame/browser_view.cc
|
||||
+++ chrome/browser/ui/views/frame/browser_view.cc
|
||||
@@ -589,11 +589,22 @@ class BrowserView::AccessibilityModeObserver : public ui::AXModeObserver {
|
||||
|
@@ -1,12 +0,0 @@
|
||||
diff --git third_party/widevine/cdm/BUILD.gn third_party/widevine/cdm/BUILD.gn
|
||||
index 91bcefa2f0698..9a5759239e590 100644
|
||||
--- third_party/widevine/cdm/BUILD.gn
|
||||
+++ third_party/widevine/cdm/BUILD.gn
|
||||
@@ -8,6 +8,7 @@ import("//build/config/chromeos/ui_mode.gni")
|
||||
import("//build/config/chromeos/ui_mode.gni")
|
||||
import("//build/config/features.gni")
|
||||
import("//build/toolchain/toolchain.gni")
|
||||
+import("//cef/libcef/features/features.gni")
|
||||
import("//media/cdm/library_cdm/cdm_paths.gni")
|
||||
import("//media/media_options.gni")
|
||||
import("//third_party/widevine/cdm/widevine.gni")
|
@@ -62,7 +62,7 @@ index 6e2d09885b457..da23a0211754b 100644
|
||||
#endif
|
||||
|
||||
diff --git content/browser/devtools/devtools_http_handler.cc content/browser/devtools/devtools_http_handler.cc
|
||||
index 38f24359a5a25..3c724e29facbd 100644
|
||||
index dc4db573977d6..489ed518257c3 100644
|
||||
--- content/browser/devtools/devtools_http_handler.cc
|
||||
+++ content/browser/devtools/devtools_http_handler.cc
|
||||
@@ -575,7 +575,7 @@ void DevToolsHttpHandler::OnJsonRequest(
|
||||
@@ -188,10 +188,10 @@ index 632ae86c6fd69..55b749ec12421 100644
|
||||
const std::vector<WebPluginInfo>& all_plugins);
|
||||
|
||||
diff --git content/browser/renderer_host/render_frame_host_impl.cc content/browser/renderer_host/render_frame_host_impl.cc
|
||||
index d3401f43eadaf..582486dad6500 100644
|
||||
index ce755a8ee754a..d7cdea91dbb6e 100644
|
||||
--- content/browser/renderer_host/render_frame_host_impl.cc
|
||||
+++ content/browser/renderer_host/render_frame_host_impl.cc
|
||||
@@ -11827,6 +11827,7 @@ void RenderFrameHostImpl::BindHungDetectorHost(
|
||||
@@ -12059,6 +12059,7 @@ void RenderFrameHostImpl::BindHungDetectorHost(
|
||||
}
|
||||
|
||||
void RenderFrameHostImpl::GetPluginInfo(const GURL& url,
|
||||
@@ -199,7 +199,7 @@ index d3401f43eadaf..582486dad6500 100644
|
||||
const url::Origin& main_frame_origin,
|
||||
const std::string& mime_type,
|
||||
GetPluginInfoCallback callback) {
|
||||
@@ -11834,7 +11835,8 @@ void RenderFrameHostImpl::GetPluginInfo(const GURL& url,
|
||||
@@ -12066,7 +12067,8 @@ void RenderFrameHostImpl::GetPluginInfo(const GURL& url,
|
||||
WebPluginInfo info;
|
||||
std::string actual_mime_type;
|
||||
bool found = PluginServiceImpl::GetInstance()->GetPluginInfo(
|
||||
@@ -210,10 +210,10 @@ index d3401f43eadaf..582486dad6500 100644
|
||||
std::move(callback).Run(found, info, actual_mime_type);
|
||||
}
|
||||
diff --git content/browser/renderer_host/render_frame_host_impl.h content/browser/renderer_host/render_frame_host_impl.h
|
||||
index 275239e659e11..514bfa186c70b 100644
|
||||
index f679024417988..c5a0be030b00f 100644
|
||||
--- content/browser/renderer_host/render_frame_host_impl.h
|
||||
+++ content/browser/renderer_host/render_frame_host_impl.h
|
||||
@@ -2530,6 +2530,7 @@ class CONTENT_EXPORT RenderFrameHostImpl
|
||||
@@ -2535,6 +2535,7 @@ class CONTENT_EXPORT RenderFrameHostImpl
|
||||
int32_t plugin_child_id,
|
||||
const base::FilePath& path) override;
|
||||
void GetPluginInfo(const GURL& url,
|
||||
@@ -334,10 +334,10 @@ index 7ec0901cf6ba2..db5b5529a4cda 100644
|
||||
// started.
|
||||
virtual void SetRuntimeFeaturesDefaultsBeforeBlinkInitialization() {}
|
||||
diff --git content/renderer/render_frame_impl.cc content/renderer/render_frame_impl.cc
|
||||
index 21a03f22e32f6..e550d97161ee4 100644
|
||||
index 14016f782e3b9..d7cb4973a2a04 100644
|
||||
--- content/renderer/render_frame_impl.cc
|
||||
+++ content/renderer/render_frame_impl.cc
|
||||
@@ -3304,7 +3304,8 @@ blink::WebPlugin* RenderFrameImpl::CreatePlugin(
|
||||
@@ -3319,7 +3319,8 @@ blink::WebPlugin* RenderFrameImpl::CreatePlugin(
|
||||
WebPluginInfo info;
|
||||
std::string mime_type;
|
||||
bool found = false;
|
||||
|
58
patch/patches/linux_chrome_widevine_3149.patch
Normal file
58
patch/patches/linux_chrome_widevine_3149.patch
Normal file
@@ -0,0 +1,58 @@
|
||||
diff --git chrome/common/media/component_widevine_cdm_hint_file_linux.cc chrome/common/media/component_widevine_cdm_hint_file_linux.cc
|
||||
index 44a89a2e7f6e4..447c1a635eadd 100644
|
||||
--- chrome/common/media/component_widevine_cdm_hint_file_linux.cc
|
||||
+++ chrome/common/media/component_widevine_cdm_hint_file_linux.cc
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "base/path_service.h"
|
||||
#include "base/values.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
+#include "third_party/widevine/cdm/widevine_cdm_common.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -37,14 +38,33 @@ base::FilePath GetPath(const base::Value& dict) {
|
||||
return path;
|
||||
}
|
||||
|
||||
+// On Linux the Widevine CDM is loaded into the zygote at startup. When the
|
||||
+// component updater runs sometime later and finds a newer version of the
|
||||
+// Widevine CDM, don't register it as the newer version can't be used. Instead,
|
||||
+// save the path to the new Widevine CDM in this file. Next time at startup this
|
||||
+// file will be checked, and if it references a usable Widevine CDM, use this
|
||||
+// version instead of the old (potentially bundled) CDM.
|
||||
+// Add this method instead of using chrome::FILE_COMPONENT_WIDEVINE_CDM_HINT
|
||||
+// because only directories (not files) can be configured via
|
||||
+// base::PathService::Override.
|
||||
+bool GetHintFilePath(base::FilePath* hint_file_path) {
|
||||
+ base::FilePath user_data_dir;
|
||||
+ if (!base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir))
|
||||
+ return false;
|
||||
+ // Match the file name in chrome/common/chrome_paths.cc
|
||||
+ *hint_file_path = user_data_dir
|
||||
+ .AppendASCII(kWidevineCdmBaseDirectory)
|
||||
+ .Append(FILE_PATH_LITERAL("latest-component-updated-widevine-cdm"));
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
} // namespace
|
||||
|
||||
bool UpdateWidevineCdmHintFile(const base::FilePath& cdm_base_path) {
|
||||
DCHECK(!cdm_base_path.empty());
|
||||
|
||||
base::FilePath hint_file_path;
|
||||
- CHECK(base::PathService::Get(chrome::FILE_COMPONENT_WIDEVINE_CDM_HINT,
|
||||
- &hint_file_path));
|
||||
+ CHECK(GetHintFilePath(&hint_file_path));
|
||||
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
dict.SetStringPath(kPath, cdm_base_path.value());
|
||||
@@ -62,8 +82,7 @@ bool UpdateWidevineCdmHintFile(const base::FilePath& cdm_base_path) {
|
||||
|
||||
base::FilePath GetLatestComponentUpdatedWidevineCdmDirectory() {
|
||||
base::FilePath hint_file_path;
|
||||
- CHECK(base::PathService::Get(chrome::FILE_COMPONENT_WIDEVINE_CDM_HINT,
|
||||
- &hint_file_path));
|
||||
+ CHECK(GetHintFilePath(&hint_file_path));
|
||||
|
||||
if (!base::PathExists(hint_file_path)) {
|
||||
DVLOG(2) << "CDM hint file at " << hint_file_path << " does not exist.";
|
@@ -10,10 +10,10 @@ index 96d1a51ec1078..e8120a818b1f2 100644
|
||||
+// This load will not send any cookies. For CEF usage.
|
||||
+LOAD_FLAG(DO_NOT_SEND_COOKIES, 1 << 17)
|
||||
diff --git net/url_request/url_request_http_job.cc net/url_request/url_request_http_job.cc
|
||||
index 3f7b5bb32fa27..2c092b62f3ce4 100644
|
||||
index 596e93a136054..1750f1c936dd2 100644
|
||||
--- net/url_request/url_request_http_job.cc
|
||||
+++ net/url_request/url_request_http_job.cc
|
||||
@@ -566,7 +566,8 @@ void URLRequestHttpJob::AddCookieHeaderAndStart() {
|
||||
@@ -565,7 +565,8 @@ void URLRequestHttpJob::AddCookieHeaderAndStart() {
|
||||
// Read cookies whenever allow_credentials() is true, even if the PrivacyMode
|
||||
// is being overridden by NetworkDelegate and will eventually block them, as
|
||||
// blocked cookies still need to be logged in that case.
|
||||
|
@@ -58,7 +58,7 @@ index 4ff73fd2d9ec3..d56686d8284ba 100644
|
||||
// Add an entry to the map.
|
||||
preview_dialog_map_[preview_dialog] = initiator;
|
||||
diff --git chrome/browser/printing/print_view_manager_base.cc chrome/browser/printing/print_view_manager_base.cc
|
||||
index 867227684ddba..98986fdad1e7f 100644
|
||||
index e345c611cac05..373b1b92cc559 100644
|
||||
--- chrome/browser/printing/print_view_manager_base.cc
|
||||
+++ chrome/browser/printing/print_view_manager_base.cc
|
||||
@@ -21,6 +21,7 @@
|
||||
@@ -97,10 +97,10 @@ index 867227684ddba..98986fdad1e7f 100644
|
||||
|
||||
void NotifySystemDialogCancelled(int render_process_id, int routing_id) {
|
||||
diff --git chrome/browser/printing/print_view_manager_base.h chrome/browser/printing/print_view_manager_base.h
|
||||
index 48e2baa05cdf6..b4da112845d86 100644
|
||||
index eaa0e162a339b..8e030d2ab3995 100644
|
||||
--- chrome/browser/printing/print_view_manager_base.h
|
||||
+++ chrome/browser/printing/print_view_manager_base.h
|
||||
@@ -124,9 +124,6 @@ class PrintViewManagerBase : public content::NotificationObserver,
|
||||
@@ -126,9 +126,6 @@ class PrintViewManagerBase : public content::NotificationObserver,
|
||||
// Manages the low-level talk to the printer.
|
||||
scoped_refptr<PrintJob> print_job_;
|
||||
|
||||
@@ -304,7 +304,7 @@ index e326047aef5e9..4fc8898e95b6f 100644
|
||||
base::FilePath GetSaveLocation() const;
|
||||
|
||||
diff --git chrome/browser/ui/webui/print_preview/print_preview_handler.cc chrome/browser/ui/webui/print_preview/print_preview_handler.cc
|
||||
index 5cebaa1d75b74..3c2fae113c678 100644
|
||||
index 83707d6c0c68d..3c17f84d0fa75 100644
|
||||
--- chrome/browser/ui/webui/print_preview/print_preview_handler.cc
|
||||
+++ chrome/browser/ui/webui/print_preview/print_preview_handler.cc
|
||||
@@ -25,6 +25,7 @@
|
||||
@@ -315,7 +315,7 @@ index 5cebaa1d75b74..3c2fae113c678 100644
|
||||
#include "chrome/browser/account_manager_facade_factory.h"
|
||||
#include "chrome/browser/app_mode/app_mode_utils.h"
|
||||
#include "chrome/browser/bad_message.h"
|
||||
@@ -1151,6 +1152,7 @@ PrinterHandler* PrintPreviewHandler::GetPrinterHandler(
|
||||
@@ -1154,6 +1155,7 @@ PrinterHandler* PrintPreviewHandler::GetPrinterHandler(
|
||||
}
|
||||
#if BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
|
||||
if (printer_type == mojom::PrinterType::kPrivet &&
|
||||
@@ -323,7 +323,7 @@ index 5cebaa1d75b74..3c2fae113c678 100644
|
||||
GetPrefs()->GetBoolean(prefs::kForceEnablePrivetPrinting)) {
|
||||
if (!privet_printer_handler_) {
|
||||
privet_printer_handler_ =
|
||||
@@ -1158,6 +1160,9 @@ PrinterHandler* PrintPreviewHandler::GetPrinterHandler(
|
||||
@@ -1161,6 +1163,9 @@ PrinterHandler* PrintPreviewHandler::GetPrinterHandler(
|
||||
}
|
||||
return privet_printer_handler_.get();
|
||||
}
|
||||
|
@@ -1,16 +1,3 @@
|
||||
diff --git .vpython3 .vpython3
|
||||
index 14faab39343e8..0aeeb03f79bdd 100644
|
||||
--- .vpython3
|
||||
+++ .vpython3
|
||||
@@ -204,7 +204,7 @@ wheel <
|
||||
|
||||
wheel <
|
||||
name: "infra/python/wheels/py-py2_py3"
|
||||
- version: "version:1.5.3"
|
||||
+ version: "version:1.10.0"
|
||||
>
|
||||
|
||||
wheel <
|
||||
diff --git build/toolchain/win/setup_toolchain.py build/toolchain/win/setup_toolchain.py
|
||||
index c1d2fa2ce0aa2..d1d215f35ac12 100644
|
||||
--- build/toolchain/win/setup_toolchain.py
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git chrome/browser/net/profile_network_context_service.cc chrome/browser/net/profile_network_context_service.cc
|
||||
index bae294fef1f8b..06d2dfcecc956 100644
|
||||
index 74b51886d2b3b..86c4ae54e2ffb 100644
|
||||
--- chrome/browser/net/profile_network_context_service.cc
|
||||
+++ chrome/browser/net/profile_network_context_service.cc
|
||||
@@ -21,6 +21,7 @@
|
||||
@@ -10,7 +10,7 @@ index bae294fef1f8b..06d2dfcecc956 100644
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/browser/content_settings/cookie_settings_factory.h"
|
||||
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
|
||||
@@ -670,7 +671,19 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
|
||||
@@ -669,7 +670,19 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
|
||||
|
||||
// Configure on-disk storage for non-OTR profiles. OTR profiles just use
|
||||
// default behavior (in memory storage, default sizes).
|
||||
@@ -31,7 +31,7 @@ index bae294fef1f8b..06d2dfcecc956 100644
|
||||
PrefService* local_state = g_browser_process->local_state();
|
||||
// Configure the HTTP cache path and size.
|
||||
base::FilePath base_cache_path;
|
||||
@@ -683,7 +696,9 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
|
||||
@@ -682,7 +695,9 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
|
||||
base_cache_path.Append(chrome::kCacheDirname);
|
||||
network_context_params->http_cache_max_size =
|
||||
local_state->GetInteger(prefs::kDiskCacheSize);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git content/browser/storage_partition_impl.cc content/browser/storage_partition_impl.cc
|
||||
index a7584ed4201ec..7cf54d07d0954 100644
|
||||
index ba5ab2ff3ef43..de29e2f77abda 100644
|
||||
--- content/browser/storage_partition_impl.cc
|
||||
+++ content/browser/storage_partition_impl.cc
|
||||
@@ -494,10 +494,6 @@ class LoginHandlerDelegate {
|
||||
@@ -26,7 +26,7 @@ index a7584ed4201ec..7cf54d07d0954 100644
|
||||
new LoginHandlerDelegate(std::move(auth_challenge_responder),
|
||||
std::move(web_contents_getter), auth_info,
|
||||
is_request_for_main_frame, process_id, routing_id,
|
||||
@@ -2598,8 +2588,12 @@ void StoragePartitionImpl::GetQuotaSettings(
|
||||
@@ -2606,8 +2596,12 @@ void StoragePartitionImpl::GetQuotaSettings(
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ index a7584ed4201ec..7cf54d07d0954 100644
|
||||
storage::GetDefaultDeviceInfoHelper(), std::move(callback));
|
||||
}
|
||||
|
||||
@@ -2612,6 +2606,11 @@ void StoragePartitionImpl::InitNetworkContext() {
|
||||
@@ -2620,6 +2614,11 @@ void StoragePartitionImpl::InitNetworkContext() {
|
||||
GetContentClient()->browser()->ConfigureNetworkContextParams(
|
||||
browser_context_, is_in_memory_, relative_partition_path_,
|
||||
context_params.get(), cert_verifier_creation_params.get());
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git base/trace_event/builtin_categories.h base/trace_event/builtin_categories.h
|
||||
index a9616406d4d37..178e4bdad971c 100644
|
||||
index bb47926b3d3ee..84a9e6b9d9538 100644
|
||||
--- base/trace_event/builtin_categories.h
|
||||
+++ base/trace_event/builtin_categories.h
|
||||
@@ -61,6 +61,8 @@
|
||||
|
@@ -130,10 +130,10 @@ index 2486758e79114..3ef43f47b62e3 100644
|
||||
// Set the view's active state (i.e., tint state of controls).
|
||||
virtual void SetActive(bool active) = 0;
|
||||
diff --git ui/platform_window/x11/x11_window.cc ui/platform_window/x11/x11_window.cc
|
||||
index 21f7e7bfc0e75..11163b3ef0144 100644
|
||||
index 68358cb74bdcb..3262fe9ea50bf 100644
|
||||
--- ui/platform_window/x11/x11_window.cc
|
||||
+++ ui/platform_window/x11/x11_window.cc
|
||||
@@ -1665,7 +1665,8 @@ void X11Window::CreateXWindow(const PlatformWindowInitProperties& properties) {
|
||||
@@ -1668,7 +1668,8 @@ void X11Window::CreateXWindow(const PlatformWindowInitProperties& properties) {
|
||||
req.border_pixel = 0;
|
||||
|
||||
bounds_in_pixels_ = SanitizeBounds(bounds);
|
||||
@@ -272,7 +272,7 @@ index 20bcac8ebadfa..f36e48dbf6549 100644
|
||||
// a reference.
|
||||
corewm::TooltipWin* tooltip_;
|
||||
diff --git ui/views/widget/widget.cc ui/views/widget/widget.cc
|
||||
index a742d7d7f5d56..ac66f0cb18006 100644
|
||||
index 4b7f2bbe19abf..2ddfa798af91b 100644
|
||||
--- ui/views/widget/widget.cc
|
||||
+++ ui/views/widget/widget.cc
|
||||
@@ -332,7 +332,8 @@ void Widget::Init(InitParams params) {
|
||||
@@ -317,7 +317,7 @@ index a742d7d7f5d56..ac66f0cb18006 100644
|
||||
}
|
||||
|
||||
diff --git ui/views/widget/widget.h ui/views/widget/widget.h
|
||||
index d6ce8c4934ed1..773125ba2dd5f 100644
|
||||
index 4a1527951ae36..893682be9bfff 100644
|
||||
--- ui/views/widget/widget.h
|
||||
+++ ui/views/widget/widget.h
|
||||
@@ -326,6 +326,8 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
|
||||
|
@@ -184,10 +184,10 @@ index 72e214c315acf..c89b578f7d6d5 100644
|
||||
Member<ValidationMessageClient> validation_message_client_;
|
||||
|
||||
diff --git third_party/blink/renderer/core/page/plugin_data.cc third_party/blink/renderer/core/page/plugin_data.cc
|
||||
index 89beb74dae8a9..63bfa84b45b72 100644
|
||||
index a7a72fb87a672..84a07fc6f0413 100644
|
||||
--- third_party/blink/renderer/core/page/plugin_data.cc
|
||||
+++ third_party/blink/renderer/core/page/plugin_data.cc
|
||||
@@ -91,10 +91,12 @@ void PluginData::RefreshBrowserSidePluginCache() {
|
||||
@@ -92,10 +92,12 @@ void PluginData::RefreshBrowserSidePluginCache() {
|
||||
Platform::Current()->GetBrowserInterfaceBroker()->GetInterface(
|
||||
registry.BindNewPipeAndPassReceiver());
|
||||
Vector<mojom::blink::PluginInfoPtr> plugins;
|
||||
@@ -199,10 +199,10 @@ index 89beb74dae8a9..63bfa84b45b72 100644
|
||||
-void PluginData::UpdatePluginList(const SecurityOrigin* main_frame_origin) {
|
||||
+void PluginData::UpdatePluginList(bool is_main_frame,
|
||||
+ const SecurityOrigin* main_frame_origin) {
|
||||
SCOPED_UMA_HISTOGRAM_TIMER("Blink.Plugin.UpdateTime");
|
||||
ResetPluginData();
|
||||
main_frame_origin_ = main_frame_origin;
|
||||
|
||||
@@ -102,7 +104,7 @@ void PluginData::UpdatePluginList(const SecurityOrigin* main_frame_origin) {
|
||||
@@ -104,7 +106,7 @@ void PluginData::UpdatePluginList(const SecurityOrigin* main_frame_origin) {
|
||||
Platform::Current()->GetBrowserInterfaceBroker()->GetInterface(
|
||||
registry.BindNewPipeAndPassReceiver());
|
||||
Vector<mojom::blink::PluginInfoPtr> plugins;
|
||||
|
@@ -11,7 +11,7 @@ index f54b993e9fb9f..ec081f68adddb 100644
|
||||
// Cancels and hides the current popup (datetime, select...) if any.
|
||||
virtual void CancelPagePopup() = 0;
|
||||
diff --git third_party/blink/renderer/core/exported/web_view_impl.cc third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
index 2f9022d37ab98..5637137cafc50 100644
|
||||
index a97620b76953e..21e693f52052c 100644
|
||||
--- third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
+++ third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
@@ -244,8 +244,13 @@ void WebView::SetUseExternalPopupMenus(bool use_external_popup_menus) {
|
||||
|
@@ -1,8 +1,8 @@
|
||||
diff --git chrome/app/generated_resources.grd chrome/app/generated_resources.grd
|
||||
index 381fd664557d6..a9171702c5683 100644
|
||||
index d8488d90dc966..2401d987baaec 100644
|
||||
--- chrome/app/generated_resources.grd
|
||||
+++ chrome/app/generated_resources.grd
|
||||
@@ -5279,7 +5279,7 @@ Keep your key file in a safe place. You will need it to create new versions of y
|
||||
@@ -5287,7 +5287,7 @@ Keep your key file in a safe place. You will need it to create new versions of y
|
||||
</message>
|
||||
</if>
|
||||
<message name="IDS_PLUGIN_BLOCKED_BY_POLICY" desc="The placeholder text for a plugin blocked by enterprise policy.">
|
||||
|
@@ -1,120 +0,0 @@
|
||||
// Copyright (c) 2016 The Chromium Embedded Framework 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 "tests/cefclient/browser/drm_test.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
#include "include/cef_parser.h"
|
||||
#include "include/cef_web_plugin.h"
|
||||
#include "tests/cefclient/browser/test_runner.h"
|
||||
|
||||
namespace client {
|
||||
namespace drm_test {
|
||||
|
||||
namespace {
|
||||
|
||||
// Application-specific error codes.
|
||||
const int kMessageFormatError = 1;
|
||||
const int kCdmLoadError = 2;
|
||||
|
||||
const char kTestUrlPath[] = "/drm";
|
||||
const char kWidevineCdmPathKey[] = "widevine_cdm_path";
|
||||
|
||||
// Callback executed once CDM registration is complete.
|
||||
class CdmCallback : public CefRegisterCdmCallback {
|
||||
public:
|
||||
CdmCallback(CefRefPtr<CefMessageRouterBrowserSide::Callback> callback)
|
||||
: callback_(callback) {}
|
||||
|
||||
void OnCdmRegistrationComplete(cef_cdm_registration_error_t result,
|
||||
const CefString& error_message) override {
|
||||
if (result == CEF_CDM_REGISTRATION_ERROR_NONE)
|
||||
callback_->Success("");
|
||||
else
|
||||
callback_->Failure(kCdmLoadError, error_message);
|
||||
callback_ = nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
CefRefPtr<CefMessageRouterBrowserSide::Callback> callback_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CdmCallback);
|
||||
DISALLOW_COPY_AND_ASSIGN(CdmCallback);
|
||||
};
|
||||
|
||||
// Handle messages in the browser process.
|
||||
class Handler : public CefMessageRouterBrowserSide::Handler {
|
||||
public:
|
||||
Handler() {}
|
||||
|
||||
// Called due to cefQuery execution in drm.html.
|
||||
virtual bool OnQuery(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
int64 query_id,
|
||||
const CefString& request,
|
||||
bool persistent,
|
||||
CefRefPtr<Callback> callback) override {
|
||||
// Only handle messages from the test URL.
|
||||
const std::string& url = frame->GetURL();
|
||||
if (!test_runner::IsTestURL(url, kTestUrlPath))
|
||||
return false;
|
||||
|
||||
// Parse |request| as a JSON dictionary.
|
||||
CefRefPtr<CefDictionaryValue> request_dict = ParseJSON(request);
|
||||
if (!request_dict) {
|
||||
callback->Failure(kMessageFormatError, "Incorrect message format");
|
||||
return true;
|
||||
}
|
||||
|
||||
// Verify the "widevine_cdm_path" key.
|
||||
if (!VerifyKey(request_dict, kWidevineCdmPathKey, VTYPE_STRING, callback))
|
||||
return true;
|
||||
|
||||
const std::string& widevine_cdm_path =
|
||||
request_dict->GetString(kWidevineCdmPathKey);
|
||||
if (widevine_cdm_path.empty()) {
|
||||
callback->Failure(kMessageFormatError, "Empty widevine CDM path");
|
||||
return true;
|
||||
}
|
||||
|
||||
// Register the Widvine CDM.
|
||||
CefRegisterWidevineCdm(widevine_cdm_path, new CdmCallback(callback));
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
// Convert a JSON string to a dictionary value.
|
||||
static CefRefPtr<CefDictionaryValue> ParseJSON(const CefString& string) {
|
||||
CefRefPtr<CefValue> value = CefParseJSON(string, JSON_PARSER_RFC);
|
||||
if (value.get() && value->GetType() == VTYPE_DICTIONARY)
|
||||
return value->GetDictionary();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Verify that |key| exists in |dictionary| and has type |value_type|. Fails
|
||||
// |callback| and returns false on failure.
|
||||
static bool VerifyKey(CefRefPtr<CefDictionaryValue> dictionary,
|
||||
const char* key,
|
||||
cef_value_type_t value_type,
|
||||
CefRefPtr<Callback> callback) {
|
||||
if (!dictionary->HasKey(key) || dictionary->GetType(key) != value_type) {
|
||||
callback->Failure(
|
||||
kMessageFormatError,
|
||||
"Missing or incorrectly formatted message key: " + std::string(key));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers) {
|
||||
handlers.insert(new Handler());
|
||||
}
|
||||
|
||||
} // namespace drm_test
|
||||
} // namespace client
|
@@ -1,20 +0,0 @@
|
||||
// Copyright (c) 2016 The Chromium Embedded Framework 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_TESTS_CEFCLIENT_BROWSER_DRM_TEST_H_
|
||||
#define CEF_TESTS_CEFCLIENT_BROWSER_DRM_TEST_H_
|
||||
#pragma once
|
||||
|
||||
#include "tests/cefclient/browser/test_runner.h"
|
||||
|
||||
namespace client {
|
||||
namespace drm_test {
|
||||
|
||||
// Create message handlers. Called from test_runner.cc.
|
||||
void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers);
|
||||
|
||||
} // namespace drm_test
|
||||
} // namespace client
|
||||
|
||||
#endif // CEF_TESTS_CEFCLIENT_BROWSER_DRM_TEST_H_
|
@@ -7,7 +7,6 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "include/cef_parser.h"
|
||||
#include "include/cef_web_plugin.h"
|
||||
#include "tests/shared/browser/client_app_browser.h"
|
||||
#include "tests/shared/common/client_switches.h"
|
||||
|
||||
@@ -144,16 +143,6 @@ MainContextImpl::MainContextImpl(CefRefPtr<CefCommandLine> command_line,
|
||||
if (!use_transparent_painting) {
|
||||
browser_background_color_ = background_color_;
|
||||
}
|
||||
|
||||
const std::string& cdm_path =
|
||||
command_line_->GetSwitchValue(switches::kWidevineCdmPath);
|
||||
if (!cdm_path.empty()) {
|
||||
// Register the Widevine CDM at the specified path. See comments in
|
||||
// cef_web_plugin.h for details. It's safe to call this method before
|
||||
// CefInitialize(), and calling it before CefInitialize() is required on
|
||||
// Linux.
|
||||
CefRegisterWidevineCdm(cdm_path, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
MainContextImpl::~MainContextImpl() {
|
||||
|
@@ -47,28 +47,27 @@
|
||||
#define IDS_BINDING_HTML 1000
|
||||
#define IDS_DIALOGS_HTML 1001
|
||||
#define IDS_DRAGGABLE_HTML 1002
|
||||
#define IDS_DRM_HTML 1003
|
||||
#define IDS_LOCALSTORAGE_HTML 1004
|
||||
#define IDS_LOGO_PNG 1005
|
||||
#define IDS_MEDIA_ROUTER_HTML 1006
|
||||
#define IDS_MENU_ICON_1X_PNG 1007
|
||||
#define IDS_MENU_ICON_2X_PNG 1008
|
||||
#define IDS_OSRTEST_HTML 1009
|
||||
#define IDS_OTHER_TESTS_HTML 1010
|
||||
#define IDS_PDF_HTML 1011
|
||||
#define IDS_PDF_PDF 1012
|
||||
#define IDS_PERFORMANCE_HTML 1013
|
||||
#define IDS_PERFORMANCE2_HTML 1014
|
||||
#define IDS_PREFERENCES_HTML 1015
|
||||
#define IDS_RESPONSE_FILTER_HTML 1016
|
||||
#define IDS_SERVER_HTML 1017
|
||||
#define IDS_TRANSPARENCY_HTML 1018
|
||||
#define IDS_URLREQUEST_HTML 1019
|
||||
#define IDS_WEBSOCKET_HTML 1020
|
||||
#define IDS_WINDOW_HTML 1021
|
||||
#define IDS_WINDOW_ICON_1X_PNG 1022
|
||||
#define IDS_WINDOW_ICON_2X_PNG 1023
|
||||
#define IDS_XMLHTTPREQUEST_HTML 1024
|
||||
#define IDS_LOCALSTORAGE_HTML 1003
|
||||
#define IDS_LOGO_PNG 1004
|
||||
#define IDS_MEDIA_ROUTER_HTML 1005
|
||||
#define IDS_MENU_ICON_1X_PNG 1006
|
||||
#define IDS_MENU_ICON_2X_PNG 1007
|
||||
#define IDS_OSRTEST_HTML 1008
|
||||
#define IDS_OTHER_TESTS_HTML 1009
|
||||
#define IDS_PDF_HTML 1010
|
||||
#define IDS_PDF_PDF 1011
|
||||
#define IDS_PERFORMANCE_HTML 1012
|
||||
#define IDS_PERFORMANCE2_HTML 1013
|
||||
#define IDS_PREFERENCES_HTML 1014
|
||||
#define IDS_RESPONSE_FILTER_HTML 1015
|
||||
#define IDS_SERVER_HTML 1016
|
||||
#define IDS_TRANSPARENCY_HTML 1017
|
||||
#define IDS_URLREQUEST_HTML 1018
|
||||
#define IDS_WEBSOCKET_HTML 1019
|
||||
#define IDS_WINDOW_HTML 1020
|
||||
#define IDS_WINDOW_ICON_1X_PNG 1021
|
||||
#define IDS_WINDOW_ICON_2X_PNG 1022
|
||||
#define IDS_XMLHTTPREQUEST_HTML 1023
|
||||
|
||||
#define IDS_EXTENSIONS_SET_PAGE_COLOR_ICON_PNG 1030
|
||||
#define IDS_EXTENSIONS_SET_PAGE_COLOR_MANIFEST_JSON 1031
|
||||
|
@@ -17,7 +17,6 @@ int GetResourceId(const char* resource_name) {
|
||||
{"binding.html", IDS_BINDING_HTML},
|
||||
{"dialogs.html", IDS_DIALOGS_HTML},
|
||||
{"draggable.html", IDS_DRAGGABLE_HTML},
|
||||
{"drm.html", IDS_DRM_HTML},
|
||||
{"extensions/set_page_color/icon.png",
|
||||
IDS_EXTENSIONS_SET_PAGE_COLOR_ICON_PNG},
|
||||
{"extensions/set_page_color/manifest.json",
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user