mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
46 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
071d1c1653 | ||
|
143bd4d425 | ||
|
86eb141c53 | ||
|
1ad5e2a261 | ||
|
36e4511b03 | ||
|
449f1bef66 | ||
|
5bd3361a6a | ||
|
735b74619e | ||
|
585cb1a434 | ||
|
1728ce6627 | ||
|
89a6ca1e6b | ||
|
4d4fcde2fa | ||
|
dba68c026c | ||
|
85f637afcf | ||
|
093cae4c85 | ||
|
7e1e1d0d0a | ||
|
49a64fa360 | ||
|
cd33baaff6 | ||
|
f6d6dfc859 | ||
|
8e694795d0 | ||
|
e9b47cb6ea | ||
|
0e1cda7e04 | ||
|
68fddaef3c | ||
|
385b2d4fb7 | ||
|
ab289f8c21 | ||
|
8f2fa9905f | ||
|
39f8ab63f3 | ||
|
41192da2df | ||
|
9b0d05362e | ||
|
ddfc3edc4e | ||
|
29d23fad6a | ||
|
5a69704c47 | ||
|
d360639327 | ||
|
6f5973b172 | ||
|
c9d6700b30 | ||
|
90cce6787e | ||
|
be1919cd6d | ||
|
f4d6298737 | ||
|
c32f283647 | ||
|
4b39753c41 | ||
|
39e689d80a | ||
|
bd91a91b94 | ||
|
5493b3dc2c | ||
|
e93622f514 | ||
|
8e3630ccad | ||
|
4cab649aac |
38
BUILD.gn
38
BUILD.gn
@@ -269,7 +269,6 @@ if (is_win) {
|
||||
"//chrome/common:features",
|
||||
"//ppapi/features:features",
|
||||
"//printing/features:features",
|
||||
"//ui/base:ui_features",
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -281,8 +280,6 @@ static_library("libcef_static") {
|
||||
"libcef/browser/browser_context.h",
|
||||
"libcef/browser/browser_context_impl.cc",
|
||||
"libcef/browser/browser_context_impl.h",
|
||||
"libcef/browser/browser_context_keyed_service_factories.cc",
|
||||
"libcef/browser/browser_context_keyed_service_factories.h",
|
||||
"libcef/browser/browser_context_proxy.cc",
|
||||
"libcef/browser/browser_context_proxy.h",
|
||||
"libcef/browser/browser_host_impl.cc",
|
||||
@@ -332,6 +329,8 @@ static_library("libcef_static") {
|
||||
"libcef/browser/extensions/api/storage/sync_value_store_cache.h",
|
||||
"libcef/browser/extensions/api/tabs/tabs_api.cc",
|
||||
"libcef/browser/extensions/api/tabs/tabs_api.h",
|
||||
"libcef/browser/extensions/browser_context_keyed_service_factories.cc",
|
||||
"libcef/browser/extensions/browser_context_keyed_service_factories.h",
|
||||
"libcef/browser/extensions/browser_extensions_util.cc",
|
||||
"libcef/browser/extensions/browser_extensions_util.h",
|
||||
"libcef/browser/extensions/browser_platform_delegate_background.cc",
|
||||
@@ -442,12 +441,16 @@ static_library("libcef_static") {
|
||||
"libcef/browser/osr/web_contents_view_osr.cc",
|
||||
"libcef/browser/osr/web_contents_view_osr.h",
|
||||
"libcef/browser/path_util_impl.cc",
|
||||
"libcef/browser/pepper/browser_pepper_host_factory.cc",
|
||||
"libcef/browser/pepper/browser_pepper_host_factory.h",
|
||||
"libcef/browser/permissions/permission_context.cc",
|
||||
"libcef/browser/permissions/permission_context.h",
|
||||
"libcef/browser/permissions/permission_manager.cc",
|
||||
"libcef/browser/permissions/permission_manager.h",
|
||||
"libcef/browser/permissions/permission_util.cc",
|
||||
"libcef/browser/permissions/permission_util.h",
|
||||
"libcef/browser/plugins/plugin_info_message_filter.cc",
|
||||
"libcef/browser/plugins/plugin_info_message_filter.h",
|
||||
"libcef/browser/plugins/plugin_service_filter.cc",
|
||||
"libcef/browser/plugins/plugin_service_filter.h",
|
||||
"libcef/browser/prefs/browser_prefs.cc",
|
||||
@@ -589,6 +592,16 @@ static_library("libcef_static") {
|
||||
"libcef/renderer/extensions/print_render_frame_helper_delegate.h",
|
||||
"libcef/renderer/frame_impl.cc",
|
||||
"libcef/renderer/frame_impl.h",
|
||||
"libcef/renderer/media/cef_key_systems.cc",
|
||||
"libcef/renderer/media/cef_key_systems.h",
|
||||
"libcef/renderer/pepper/pepper_helper.cc",
|
||||
"libcef/renderer/pepper/pepper_helper.h",
|
||||
"libcef/renderer/pepper/renderer_pepper_host_factory.cc",
|
||||
"libcef/renderer/pepper/renderer_pepper_host_factory.h",
|
||||
"libcef/renderer/plugins/cef_plugin_placeholder.cc",
|
||||
"libcef/renderer/plugins/cef_plugin_placeholder.h",
|
||||
"libcef/renderer/plugins/plugin_preroller.cc",
|
||||
"libcef/renderer/plugins/plugin_preroller.h",
|
||||
"libcef/renderer/render_frame_observer.cc",
|
||||
"libcef/renderer/render_frame_observer.h",
|
||||
"libcef/renderer/render_frame_util.cc",
|
||||
@@ -691,13 +704,12 @@ static_library("libcef_static") {
|
||||
"//content/public/child",
|
||||
"//content/public/common",
|
||||
"//content/public/gpu",
|
||||
"//content/public/network",
|
||||
"//content/public/renderer",
|
||||
"//content/public/utility",
|
||||
"//crypto",
|
||||
"//device/base",
|
||||
"//device/geolocation",
|
||||
"//device/geolocation/public/interfaces",
|
||||
"//device/hid",
|
||||
"//extensions/browser",
|
||||
"//extensions/browser/api:api_registration",
|
||||
"//extensions/common/api",
|
||||
@@ -721,7 +733,7 @@ static_library("libcef_static") {
|
||||
"//skia",
|
||||
"//storage/browser",
|
||||
"//third_party/brotli:dec",
|
||||
"//third_party/cld_3/src/src:cld_3",
|
||||
"//third_party/cld",
|
||||
"//third_party/hunspell",
|
||||
"//third_party/leveldatabase",
|
||||
"//third_party/libxml",
|
||||
@@ -825,7 +837,7 @@ static_library("libcef_static") {
|
||||
}
|
||||
|
||||
if (is_win || is_mac) {
|
||||
deps += [ "//third_party/crashpad/crashpad/handler" ]
|
||||
deps += [ "//third_party/crashpad/crashpad/handler:handler_lib" ]
|
||||
}
|
||||
|
||||
if (use_x11) {
|
||||
@@ -930,11 +942,6 @@ static_library("libcef_static") {
|
||||
if (is_win) {
|
||||
sources += [
|
||||
# Support for UI input events.
|
||||
# Part of //base/test:test_config which is testingonly.
|
||||
"//base/test/test_switches.cc",
|
||||
"//base/test/test_switches.h",
|
||||
"//base/test/test_timeouts.cc",
|
||||
"//base/test/test_timeouts.h",
|
||||
# Part of //ui/aura:test_support which is testingonly.
|
||||
"//ui/aura/test/ui_controls_factory_aurawin.cc",
|
||||
# Part of //ui/base:test_support which is testingonly.
|
||||
@@ -1022,8 +1029,6 @@ if (is_win) {
|
||||
#
|
||||
|
||||
cef_packaged_services = [
|
||||
"//chrome/app:chrome_manifest", # For spell checking.
|
||||
"//services/metrics:manifest",
|
||||
"//services/proxy_resolver:proxy_resolver_manifest",
|
||||
]
|
||||
|
||||
@@ -1142,7 +1147,6 @@ repack("pak_extensions") {
|
||||
"$root_gen_dir/chrome/component_extension_resources.pak",
|
||||
"$root_gen_dir/extensions/extensions_renderer_resources.pak",
|
||||
"$root_gen_dir/extensions/extensions_resources.pak",
|
||||
"$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
|
||||
"$root_gen_dir/ui/resources/webui_resources.pak",
|
||||
]
|
||||
|
||||
@@ -1153,7 +1157,6 @@ repack("pak_extensions") {
|
||||
"//chrome/browser/resources:component_extension_resources",
|
||||
"//extensions:extensions_renderer_resources",
|
||||
"//extensions:extensions_resources_grd",
|
||||
"//mojo/public/js:resources",
|
||||
"//ui/resources:webui_resources_grd",
|
||||
]
|
||||
|
||||
@@ -1850,6 +1853,9 @@ if (is_mac) {
|
||||
deps += [
|
||||
":cef_sandbox",
|
||||
"//build/win:default_exe_manifest",
|
||||
|
||||
# Tool that can be used for testing crash reporting.
|
||||
"//content/shell:content_shell_crash_service",
|
||||
]
|
||||
|
||||
libs = [
|
||||
|
@@ -7,5 +7,5 @@
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'refs/tags/64.0.3282.119',
|
||||
'chromium_checkout': 'refs/tags/63.0.3239.132',
|
||||
}
|
||||
|
@@ -42,7 +42,7 @@ The CEF project is an extension of the Chromium project. CEF maintains developme
|
||||
|
||||
The base CEF framework includes support for the C and C++ programming languages. Thanks to the hard work of external maintainers CEF can integrate with a number of other programming languages and frameworks. These external projects are not maintained by CEF so please contact the respective project maintainer if you have any questions or issues.
|
||||
|
||||
* .Net (CEF3) - https://github.com/cefsharp/CefSharp
|
||||
* .Net - https://github.com/chillitom/CefSharp
|
||||
* .Net (CEF1) - https://bitbucket.org/fddima/cefglue
|
||||
* .Net/Mono (CEF3) - https://bitbucket.org/xilium/xilium.cefglue
|
||||
* .Net (CEF3) - https://bitbucket.org/chromiumfx/chromiumfx
|
||||
@@ -82,4 +82,4 @@ If you would like to contribute source code changes to CEF please follow the bel
|
||||
* Be submitted against the current [CEF master branch](https://bitbucket.org/chromiumembedded/cef/src/?at=master) unless explicitly fixing a bug in a CEF release branch.
|
||||
* Follow the style of existing CEF source files. In general CEF uses the [Chromium coding style](http://www.chromium.org/developers/coding-style).
|
||||
* Include new or modified unit tests as appropriate to the functionality.
|
||||
* Not include unnecessary or unrelated changes.
|
||||
* Not include unnecessary or unrelated changes.
|
@@ -86,7 +86,6 @@ if(OS_LINUX)
|
||||
-Werror # Treat warnings as errors
|
||||
-Wno-missing-field-initializers # Don't warn about missing field initializers
|
||||
-Wno-unused-parameter # Don't warn about unused parameters
|
||||
-Wno-error=comment # Don't complain about code in ascii art
|
||||
)
|
||||
list(APPEND CEF_C_COMPILER_FLAGS
|
||||
-std=c99 # Use the C99 language standard
|
||||
@@ -198,12 +197,9 @@ if(OS_LINUX)
|
||||
set(CEF_BINARY_FILES
|
||||
chrome-sandbox
|
||||
libcef.so
|
||||
libEGL.so
|
||||
libGLESv2.so
|
||||
natives_blob.bin
|
||||
snapshot_blob.bin
|
||||
v8_context_snapshot.bin
|
||||
swiftshader
|
||||
)
|
||||
|
||||
# List of CEF resource files.
|
||||
@@ -353,13 +349,6 @@ if(OS_WINDOWS)
|
||||
# Consumers who run into LNK4099 warnings can pass /Z7 instead (see issue #385).
|
||||
set(CEF_DEBUG_INFO_FLAG "/Zi" CACHE STRING "Optional flag specifying specific /Z flag to use")
|
||||
|
||||
# Consumers using different runtime types may want to pass different flags
|
||||
set(CEF_RUNTIME_LIBRARY_FLAG "/MT" CACHE STRING "Optional flag specifying which runtime to use")
|
||||
if (CEF_RUNTIME_LIBRARY_FLAG)
|
||||
list(APPEND CEF_COMPILER_FLAGS_DEBUG ${CEF_RUNTIME_LIBRARY_FLAG}d)
|
||||
list(APPEND CEF_COMPILER_FLAGS_RELEASE ${CEF_RUNTIME_LIBRARY_FLAG})
|
||||
endif()
|
||||
|
||||
# Platform-specific compiler/linker flags.
|
||||
set(CEF_LIBTYPE STATIC)
|
||||
list(APPEND CEF_COMPILER_FLAGS
|
||||
@@ -379,10 +368,12 @@ if(OS_WINDOWS)
|
||||
${CEF_DEBUG_INFO_FLAG}
|
||||
)
|
||||
list(APPEND CEF_COMPILER_FLAGS_DEBUG
|
||||
/MTd # Multithreaded debug runtime
|
||||
/RTC1 # Disable optimizations
|
||||
/Od # Enable basic run-time checks
|
||||
)
|
||||
list(APPEND CEF_COMPILER_FLAGS_RELEASE
|
||||
/MT # Multithreaded release runtime
|
||||
/O2 # Optimize for maximum speed
|
||||
/Ob2 # Inline any suitable function
|
||||
/GF # Enable string pooling
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=ab31ef5d72b4b1c9809698e5fbbdae21918af713$
|
||||
// $hash=68988be0c2e0a1481ee6b27930391976c7041317$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_DISPLAY_HANDLER_CAPI_H_
|
||||
@@ -118,7 +118,6 @@ typedef struct _cef_display_handler_t {
|
||||
///
|
||||
int(CEF_CALLBACK* on_console_message)(struct _cef_display_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_log_severity_t level,
|
||||
const cef_string_t* message,
|
||||
const cef_string_t* source,
|
||||
int line);
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=b8b5a62b11dbc48f0733c0522864e4dbda8b4f59$
|
||||
// $hash=52ba75e5a733ed0be9a064b9794c0181e714c090$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_
|
||||
@@ -247,29 +247,6 @@ typedef struct _cef_request_handler_t {
|
||||
const cef_string_t* scheme,
|
||||
struct _cef_auth_callback_t* callback);
|
||||
|
||||
///
|
||||
// Called on the IO thread before sending a network request with a "Cookie"
|
||||
// request header. Return true (1) to allow cookies to be included in the
|
||||
// network request or false (0) to block cookies. The |request| object should
|
||||
// not be modified in this callback.
|
||||
///
|
||||
int(CEF_CALLBACK* can_get_cookies)(struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request);
|
||||
|
||||
///
|
||||
// Called on the IO thread when receiving a network request with a "Set-
|
||||
// Cookie" response header value represented by |cookie|. Return true (1) to
|
||||
// allow the cookie to be stored or false (0) to block the cookie. The
|
||||
// |request| object should not be modified in this callback.
|
||||
///
|
||||
int(CEF_CALLBACK* can_set_cookie)(struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request,
|
||||
const struct _cef_cookie_t* cookie);
|
||||
|
||||
///
|
||||
// Called on the IO thread when JavaScript requests a specific storage quota
|
||||
// size via the webkitStorageInfo.requestQuota function. |origin_url| is the
|
||||
|
@@ -109,7 +109,6 @@ class CefDisplayHandler : public virtual CefBaseRefCounted {
|
||||
///
|
||||
/*--cef(optional_param=message,optional_param=source)--*/
|
||||
virtual bool OnConsoleMessage(CefRefPtr<CefBrowser> browser,
|
||||
cef_log_severity_t level,
|
||||
const CefString& message,
|
||||
const CefString& source,
|
||||
int line) {
|
||||
|
@@ -252,33 +252,6 @@ class CefRequestHandler : public virtual CefBaseRefCounted {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the IO thread before sending a network request with a "Cookie"
|
||||
// request header. Return true to allow cookies to be included in the network
|
||||
// request or false to block cookies. The |request| object should not be
|
||||
// modified in this callback.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool CanGetCookies(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request) {
|
||||
return true;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the IO thread when receiving a network request with a
|
||||
// "Set-Cookie" response header value represented by |cookie|. Return true to
|
||||
// allow the cookie to be stored or false to block the cookie. The |request|
|
||||
// object should not be modified in this callback.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool CanSetCookie(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
const CefCookie& cookie) {
|
||||
return true;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the IO thread when JavaScript requests a specific storage quota
|
||||
// size via the webkitStorageInfo.requestQuota function. |origin_url| is the
|
||||
|
@@ -94,11 +94,6 @@ typedef enum {
|
||||
///
|
||||
LOGSEVERITY_VERBOSE,
|
||||
|
||||
///
|
||||
// DEBUG logging.
|
||||
///
|
||||
LOGSEVERITY_DEBUG = LOGSEVERITY_VERBOSE,
|
||||
|
||||
///
|
||||
// INFO logging.
|
||||
///
|
||||
|
@@ -9,7 +9,6 @@
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "chrome/browser/plugins/chrome_plugin_service_filter.h"
|
||||
#include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
|
||||
#include "components/keyed_service/content/browser_context_dependency_manager.h"
|
||||
#include "components/user_prefs/user_prefs.h"
|
||||
@@ -69,9 +68,6 @@ void CefBrowserContext::PostInitialize() {
|
||||
const bool extensions_enabled = extensions::ExtensionsEnabled();
|
||||
if (extensions_enabled && !is_proxy_)
|
||||
extension_system_->Init();
|
||||
|
||||
ChromePluginServiceFilter::GetInstance()->RegisterResourceContext(
|
||||
this, resource_context_.get());
|
||||
}
|
||||
|
||||
void CefBrowserContext::Shutdown() {
|
||||
@@ -80,9 +76,6 @@ void CefBrowserContext::Shutdown() {
|
||||
// Send notifications to clean up objects associated with this Profile.
|
||||
MaybeSendDestroyedNotification();
|
||||
|
||||
ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext(
|
||||
resource_context_.get());
|
||||
|
||||
// Remove any BrowserContextKeyedServiceFactory associations. This must be
|
||||
// called before the ProxyService owned by CefBrowserContextImpl is destroyed.
|
||||
BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(
|
||||
|
@@ -1583,7 +1583,7 @@ void CefBrowserHostImpl::CancelContextMenu() {
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrame> CefBrowserHostImpl::GetFrameForRequest(
|
||||
const net::URLRequest* request) {
|
||||
net::URLRequest* request) {
|
||||
CEF_REQUIRE_IOT();
|
||||
const content::ResourceRequestInfo* info =
|
||||
content::ResourceRequestInfo::ForRequest(request);
|
||||
@@ -2276,24 +2276,8 @@ bool CefBrowserHostImpl::DidAddMessageToConsole(
|
||||
const base::string16& source_id) {
|
||||
if (client_.get()) {
|
||||
CefRefPtr<CefDisplayHandler> handler = client_->GetDisplayHandler();
|
||||
if (handler.get()) {
|
||||
// Use LOGSEVERITY_DEBUG for unrecognized |level| values.
|
||||
cef_log_severity_t log_level = LOGSEVERITY_DEBUG;
|
||||
switch (level) {
|
||||
case 0:
|
||||
log_level = LOGSEVERITY_INFO;
|
||||
break;
|
||||
case 1:
|
||||
log_level = LOGSEVERITY_WARNING;
|
||||
break;
|
||||
case 2:
|
||||
log_level = LOGSEVERITY_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
return handler->OnConsoleMessage(this, log_level, message, source_id,
|
||||
line_no);
|
||||
}
|
||||
if (handler.get())
|
||||
return handler->OnConsoleMessage(this, message, source_id, line_no);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@@ -303,7 +303,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
#endif
|
||||
|
||||
// Returns the frame associated with the specified URLRequest.
|
||||
CefRefPtr<CefFrame> GetFrameForRequest(const net::URLRequest* request);
|
||||
CefRefPtr<CefFrame> GetFrameForRequest(net::URLRequest* request);
|
||||
|
||||
// Navigate as specified by the |params| argument.
|
||||
void Navigate(const CefNavigateParams& params);
|
||||
|
@@ -9,11 +9,12 @@
|
||||
#include <string>
|
||||
|
||||
#include "libcef/browser/browser_context_impl.h"
|
||||
#include "libcef/browser/browser_context_keyed_service_factories.h"
|
||||
#include "libcef/browser/browser_context_proxy.h"
|
||||
#include "libcef/browser/browser_message_loop.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/devtools_manager_delegate.h"
|
||||
#include "libcef/browser/extensions/browser_context_keyed_service_factories.h"
|
||||
#include "libcef/browser/extensions/extension_system_factory.h"
|
||||
#include "libcef/browser/extensions/extensions_browser_client.h"
|
||||
#include "libcef/browser/net/chrome_scheme_handler.h"
|
||||
@@ -24,10 +25,16 @@
|
||||
#include "libcef/common/net/net_resource_provider.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "chrome/browser/plugins/plugin_finder.h"
|
||||
#include "content/public/browser/child_process_security_policy.h"
|
||||
#include "content/public/browser/gpu_data_manager.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "device/geolocation/access_token_store.h"
|
||||
#include "device/geolocation/geolocation_delegate.h"
|
||||
#include "device/geolocation/geolocation_provider.h"
|
||||
#include "extensions/browser/extension_system.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "net/base/net_module.h"
|
||||
@@ -126,13 +133,12 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
|
||||
new extensions::CefExtensionsBrowserClient);
|
||||
extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get());
|
||||
|
||||
// Register additional KeyedService factories here. See
|
||||
// ChromeBrowserMainExtraPartsProfiles for details.
|
||||
extensions::cef::EnsureBrowserContextKeyedServiceFactoriesBuilt();
|
||||
extensions::CefExtensionSystemFactory::GetInstance();
|
||||
}
|
||||
|
||||
// Register additional KeyedService factories here. See
|
||||
// ChromeBrowserMainExtraPartsProfiles for details.
|
||||
cef::EnsureBrowserContextKeyedServiceFactoriesBuilt();
|
||||
|
||||
printing::CefPrintingMessageFilter::EnsureShutdownNotifierFactoryBuilt();
|
||||
|
||||
CefRequestContextSettings settings;
|
||||
|
@@ -96,7 +96,12 @@ metrics::MetricsService* ChromeBrowserProcessStub::metrics_service() {
|
||||
}
|
||||
|
||||
rappor::RapporServiceImpl* ChromeBrowserProcessStub::rappor_service() {
|
||||
// Called from PluginInfoHostImpl::ReportMetrics.
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ukm::UkmRecorder* ChromeBrowserProcessStub::ukm_recorder() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -110,12 +115,6 @@ ChromeBrowserProcessStub::system_network_context_manager() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content::NetworkConnectionTracker*
|
||||
ChromeBrowserProcessStub::network_connection_tracker() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
WatchDogThread* ChromeBrowserProcessStub::watchdog_thread() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
@@ -286,12 +285,6 @@ ChromeBrowserProcessStub::subresource_filter_ruleset_service() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
optimization_guide::OptimizationGuideService*
|
||||
ChromeBrowserProcessStub::optimization_guide_service() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
|
||||
void ChromeBrowserProcessStub::StartAutoupdateTimer() {}
|
||||
#endif
|
||||
@@ -318,6 +311,11 @@ ChromeBrowserProcessStub::component_updater() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CRLSetFetcher* ChromeBrowserProcessStub::crl_set_fetcher() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
component_updater::SupervisedUserWhitelistInstaller*
|
||||
ChromeBrowserProcessStub::supervised_user_whitelist_installer() {
|
||||
NOTREACHED();
|
||||
|
@@ -47,9 +47,9 @@ class ChromeBrowserProcessStub : public BrowserProcess,
|
||||
override;
|
||||
metrics::MetricsService* metrics_service() override;
|
||||
rappor::RapporServiceImpl* rappor_service() override;
|
||||
ukm::UkmRecorder* ukm_recorder() override;
|
||||
IOThread* io_thread() override;
|
||||
SystemNetworkContextManager* system_network_context_manager() override;
|
||||
content::NetworkConnectionTracker* network_connection_tracker() override;
|
||||
WatchDogThread* watchdog_thread() override;
|
||||
ProfileManager* profile_manager() override;
|
||||
PrefService* local_state() override;
|
||||
@@ -87,8 +87,6 @@ class ChromeBrowserProcessStub : public BrowserProcess,
|
||||
override;
|
||||
subresource_filter::ContentRulesetService*
|
||||
subresource_filter_ruleset_service() override;
|
||||
optimization_guide::OptimizationGuideService* optimization_guide_service()
|
||||
override;
|
||||
|
||||
#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
|
||||
void StartAutoupdateTimer() override;
|
||||
@@ -96,6 +94,7 @@ class ChromeBrowserProcessStub : public BrowserProcess,
|
||||
|
||||
net_log::ChromeNetLog* net_log() override;
|
||||
component_updater::ComponentUpdateService* component_updater() override;
|
||||
CRLSetFetcher* crl_set_fetcher() override;
|
||||
component_updater::SupervisedUserWhitelistInstaller*
|
||||
supervised_user_whitelist_installer() override;
|
||||
MediaFileSystemRegistry* media_file_system_registry() override;
|
||||
|
@@ -33,6 +33,7 @@ void ChromeProfileStub::DestroyOffTheRecordProfile() {
|
||||
}
|
||||
|
||||
bool ChromeProfileStub::HasOffTheRecordProfile() {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -40,10 +41,6 @@ Profile* ChromeProfileStub::GetOriginalProfile() {
|
||||
return this;
|
||||
}
|
||||
|
||||
const Profile* ChromeProfileStub::GetOriginalProfile() const {
|
||||
return this;
|
||||
}
|
||||
|
||||
bool ChromeProfileStub::IsSupervised() const {
|
||||
return false;
|
||||
}
|
||||
@@ -110,6 +107,12 @@ chrome_browser_net::Predictor* ChromeProfileStub::GetNetworkPredictor() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ChromeProfileStub::ClearNetworkingHistorySince(
|
||||
base::Time time,
|
||||
const base::Closure& completion) {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
GURL ChromeProfileStub::GetHomePage() {
|
||||
NOTREACHED();
|
||||
return GURL();
|
||||
|
@@ -27,7 +27,6 @@ class ChromeProfileStub : public Profile {
|
||||
void DestroyOffTheRecordProfile() override;
|
||||
bool HasOffTheRecordProfile() override;
|
||||
Profile* GetOriginalProfile() override;
|
||||
const Profile* GetOriginalProfile() const override;
|
||||
bool IsSupervised() const override;
|
||||
bool IsChild() const override;
|
||||
bool IsLegacySupervised() const override;
|
||||
@@ -41,6 +40,8 @@ class ChromeProfileStub : public Profile {
|
||||
void set_last_selected_directory(const base::FilePath& path) override;
|
||||
PrefProxyConfigTracker* GetProxyConfigTracker() override;
|
||||
chrome_browser_net::Predictor* GetNetworkPredictor() override;
|
||||
void ClearNetworkingHistorySince(base::Time time,
|
||||
const base::Closure& completion) override;
|
||||
GURL GetHomePage() override;
|
||||
bool WasCreatedByVersionOrLater(const std::string& version) override;
|
||||
void SetExitType(ExitType exit_type) override;
|
||||
|
@@ -19,6 +19,8 @@
|
||||
#include "libcef/browser/extensions/extension_system.h"
|
||||
#include "libcef/browser/media_capture_devices_dispatcher.h"
|
||||
#include "libcef/browser/net/chrome_scheme_handler.h"
|
||||
#include "libcef/browser/pepper/browser_pepper_host_factory.h"
|
||||
#include "libcef/browser/plugins/plugin_info_message_filter.h"
|
||||
#include "libcef/browser/plugins/plugin_service_filter.h"
|
||||
#include "libcef/browser/prefs/renderer_prefs.h"
|
||||
#include "libcef/browser/printing/printing_message_filter.h"
|
||||
@@ -41,12 +43,9 @@
|
||||
#include "base/json/json_reader.h"
|
||||
#include "base/path_service.h"
|
||||
#include "cef/grit/cef_resources.h"
|
||||
#include "chrome/browser/chrome_service.h"
|
||||
#include "chrome/browser/plugins/plugin_info_host_impl.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
|
||||
#include "chrome/browser/spellchecker/spell_check_host_impl.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/common/constants.mojom.h"
|
||||
#include "chrome/grit/browser_resources.h"
|
||||
#include "chrome/grit/generated_resources.h"
|
||||
#include "components/navigation_interception/intercept_navigation_throttle.h"
|
||||
@@ -83,8 +82,6 @@
|
||||
#include "extensions/common/switches.h"
|
||||
#include "net/ssl/ssl_cert_request_info.h"
|
||||
#include "ppapi/host/ppapi_host.h"
|
||||
#include "services/metrics/metrics_mojo_service.h"
|
||||
#include "services/metrics/public/interfaces/constants.mojom.h"
|
||||
#include "services/proxy_resolver/public/interfaces/proxy_resolver.mojom.h"
|
||||
#include "storage/browser/quota/quota_settings.h"
|
||||
#include "third_party/WebKit/public/web/WebWindowFeatures.h"
|
||||
@@ -477,6 +474,9 @@ void CefContentBrowserClient::RenderProcessWillLaunch(
|
||||
}
|
||||
#endif
|
||||
|
||||
host->AddFilter(new CefPluginInfoMessageFilter(
|
||||
id, static_cast<CefBrowserContext*>(profile)));
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
host->AddFilter(new extensions::ExtensionMessageFilter(id, profile));
|
||||
host->AddFilter(
|
||||
@@ -590,22 +590,6 @@ void CefContentBrowserClient::SiteInstanceDeleting(
|
||||
site_instance->GetId()));
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::RegisterInProcessServices(
|
||||
StaticServiceMap* services) {
|
||||
{
|
||||
// For spell checking.
|
||||
service_manager::EmbeddedServiceInfo info;
|
||||
info.factory = base::Bind(&ChromeService::Create);
|
||||
services->insert(std::make_pair(chrome::mojom::kServiceName, info));
|
||||
}
|
||||
{
|
||||
// For metrics.
|
||||
service_manager::EmbeddedServiceInfo info;
|
||||
info.factory = base::Bind(&metrics::CreateMetricsService);
|
||||
services->emplace(metrics::mojom::kMetricsServiceName, info);
|
||||
}
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::RegisterOutOfProcessServices(
|
||||
OutOfProcessServiceMap* services) {
|
||||
(*services)[printing::mojom::kServiceName] =
|
||||
@@ -680,17 +664,11 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
// Propagate the following switches to the renderer command line (along with
|
||||
// any associated values) if present in the browser command line.
|
||||
static const char* const kSwitchNames[] = {
|
||||
switches::kDisableExtensions,
|
||||
switches::kDisablePdfExtension,
|
||||
switches::kDisablePlugins,
|
||||
switches::kDisableScrollBounce,
|
||||
switches::kDisableSpellChecking,
|
||||
switches::kEnableSpeechInput,
|
||||
switches::kEnableSystemFlash,
|
||||
switches::kPpapiFlashArgs,
|
||||
switches::kPpapiFlashPath,
|
||||
switches::kPpapiFlashVersion,
|
||||
switches::kUncaughtExceptionStackSize,
|
||||
switches::kDisableExtensions, switches::kDisablePdfExtension,
|
||||
switches::kDisableScrollBounce, switches::kDisableSpellChecking,
|
||||
switches::kEnableSpeechInput, switches::kEnableSystemFlash,
|
||||
switches::kPpapiFlashArgs, switches::kPpapiFlashPath,
|
||||
switches::kPpapiFlashVersion, switches::kUncaughtExceptionStackSize,
|
||||
};
|
||||
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
|
||||
arraysize(kSwitchNames));
|
||||
@@ -920,7 +898,7 @@ void CefContentBrowserClient::DidCreatePpapiPlugin(
|
||||
content::BrowserPpapiHost* browser_host) {
|
||||
browser_host->GetPpapiHost()->AddHostFactoryFilter(
|
||||
std::unique_ptr<ppapi::host::HostFactory>(
|
||||
new ChromeBrowserPepperHostFactory(browser_host)));
|
||||
new CefBrowserPepperHostFactory(browser_host)));
|
||||
}
|
||||
|
||||
content::DevToolsManagerDelegate*
|
||||
@@ -965,7 +943,7 @@ CefContentBrowserClient::CreateThrottlesForNavigation(
|
||||
return throttles;
|
||||
}
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
||||
void CefContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
|
||||
const base::CommandLine& command_line,
|
||||
int child_process_id,
|
||||
@@ -975,7 +953,7 @@ void CefContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
|
||||
mappings->Share(kCrashDumpSignal, crash_signal_fd);
|
||||
}
|
||||
}
|
||||
#endif // defined(OS_LINUX)
|
||||
#endif // defined(OS_POSIX) && !defined(OS_MACOSX)
|
||||
|
||||
#if defined(OS_WIN)
|
||||
const wchar_t* CefContentBrowserClient::GetResourceDllName() {
|
||||
@@ -1001,12 +979,18 @@ bool CefContentBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy) {
|
||||
|
||||
void CefContentBrowserClient::ExposeInterfacesToRenderer(
|
||||
service_manager::BinderRegistry* registry,
|
||||
blink::AssociatedInterfaceRegistry* associated_registry,
|
||||
content::RenderProcessHost* host) {
|
||||
Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
|
||||
host->GetChannel()->AddAssociatedInterfaceForIOThread(base::Bind(
|
||||
&PluginInfoHostImpl::OnPluginInfoHostRequest,
|
||||
base::MakeRefCounted<PluginInfoHostImpl>(host->GetID(), profile)));
|
||||
content::AssociatedInterfaceRegistry* associated_registry,
|
||||
content::RenderProcessHost* render_process_host) {
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner =
|
||||
content::BrowserThread::GetTaskRunnerForThread(
|
||||
content::BrowserThread::UI);
|
||||
if (!command_line->HasSwitch(switches::kDisableSpellChecking)) {
|
||||
registry->AddInterface(
|
||||
base::Bind(&SpellCheckHostImpl::Create, render_process_host->GetID()),
|
||||
ui_task_runner);
|
||||
}
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::RegisterCustomScheme(const std::string& scheme) {
|
||||
|
@@ -49,7 +49,6 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
bool IsHandledURL(const GURL& url) override;
|
||||
void SiteInstanceGotProcess(content::SiteInstance* site_instance) override;
|
||||
void SiteInstanceDeleting(content::SiteInstance* site_instance) override;
|
||||
void RegisterInProcessServices(StaticServiceMap* services) override;
|
||||
void RegisterOutOfProcessServices(OutOfProcessServiceMap* services) override;
|
||||
std::unique_ptr<base::Value> GetServiceManifestOverlay(
|
||||
base::StringPiece name) override;
|
||||
@@ -105,7 +104,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
CreateThrottlesForNavigation(
|
||||
content::NavigationHandle* navigation_handle) override;
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
||||
void GetAdditionalMappedFilesForChildProcess(
|
||||
const base::CommandLine& command_line,
|
||||
int child_process_id,
|
||||
@@ -119,7 +118,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
|
||||
void ExposeInterfacesToRenderer(
|
||||
service_manager::BinderRegistry* registry,
|
||||
blink::AssociatedInterfaceRegistry* associated_registry,
|
||||
content::AssociatedInterfaceRegistry* associated_registry,
|
||||
content::RenderProcessHost* render_process_host) override;
|
||||
|
||||
// Perform browser process registration for the custom scheme.
|
||||
|
@@ -564,15 +564,13 @@ void CefCookieManagerImpl::SetCookieInternal(
|
||||
if (cookie.has_expires)
|
||||
cef_time_to_basetime(cookie.expires, expiration_time);
|
||||
|
||||
cookie_store->SetCanonicalCookieAsync(
|
||||
net::CanonicalCookie::CreateSanitizedCookie(
|
||||
url, name, value, domain, path,
|
||||
base::Time(), // Creation time.
|
||||
expiration_time,
|
||||
base::Time(), // Last access time.
|
||||
cookie.secure ? true : false, cookie.httponly ? true : false,
|
||||
net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT),
|
||||
cookie_store->SetCookieWithDetailsAsync(
|
||||
url, name, value, domain, path,
|
||||
base::Time(), // Creation time.
|
||||
expiration_time,
|
||||
base::Time(), // Last access time.
|
||||
cookie.secure ? true : false, cookie.httponly ? true : false,
|
||||
net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT,
|
||||
base::Bind(SetCookieCallbackImpl, callback));
|
||||
}
|
||||
|
||||
|
@@ -455,7 +455,8 @@ void CefDevToolsFrontend::SendMessageAck(int request_id,
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::AgentHostClosed(
|
||||
content::DevToolsAgentHost* agent_host) {
|
||||
content::DevToolsAgentHost* agent_host,
|
||||
bool replaced) {
|
||||
DCHECK(agent_host == agent_host_.get());
|
||||
agent_host_ = nullptr;
|
||||
Close();
|
||||
|
@@ -65,7 +65,8 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
|
||||
~CefDevToolsFrontend() override;
|
||||
|
||||
// content::DevToolsAgentHostClient implementation.
|
||||
void AgentHostClosed(content::DevToolsAgentHost* agent_host) override;
|
||||
void AgentHostClosed(content::DevToolsAgentHost* agent_host,
|
||||
bool replaced) override;
|
||||
void DispatchProtocolMessage(content::DevToolsAgentHost* agent_host,
|
||||
const std::string& message) override;
|
||||
void SetPreferences(const std::string& json);
|
||||
|
@@ -107,11 +107,6 @@ void CefDevToolsManagerDelegate::StartHttpHandler(
|
||||
content::DevToolsAgentHost::StartRemoteDebuggingServer(
|
||||
std::move(socket_factory), std::string(), browser_context->GetPath(),
|
||||
base::FilePath());
|
||||
|
||||
const base::CommandLine& command_line =
|
||||
*base::CommandLine::ForCurrentProcess();
|
||||
if (command_line.HasSwitch(switches::kRemoteDebuggingPipe))
|
||||
content::DevToolsAgentHost::StartRemoteDebuggingPipeHandler();
|
||||
}
|
||||
|
||||
// static
|
||||
|
@@ -231,8 +231,7 @@ bool ExecuteCodeInTabFunction::LoadFile(const std::string& file) {
|
||||
void ExecuteCodeInTabFunction::LoadFileComplete(
|
||||
const std::string& file,
|
||||
std::unique_ptr<std::string> data) {
|
||||
const bool success = !!data.get();
|
||||
DidLoadAndLocalizeFile(file, success, std::move(data));
|
||||
DidLoadAndLocalizeFile(file, !!data.get(), std::move(data));
|
||||
}
|
||||
|
||||
bool TabsExecuteScriptFunction::ShouldInsertCSS() const {
|
||||
|
@@ -2,34 +2,26 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be found
|
||||
// in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/browser_context_keyed_service_factories.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
#include "libcef/browser/extensions/browser_context_keyed_service_factories.h"
|
||||
|
||||
#include "chrome/browser/content_settings/cookie_settings_factory.h"
|
||||
#include "chrome/browser/extensions/api/streams_private/streams_private_api.h"
|
||||
#include "chrome/browser/plugins/plugin_prefs_factory.h"
|
||||
#include "chrome/browser/spellchecker/spellcheck_factory.h"
|
||||
#include "chrome/browser/themes/theme_service_factory.h"
|
||||
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
|
||||
#include "extensions/browser/api/alarms/alarm_manager.h"
|
||||
#include "extensions/browser/api/storage/storage_frontend.h"
|
||||
#include "extensions/browser/renderer_startup_helper.h"
|
||||
|
||||
namespace extensions {
|
||||
namespace cef {
|
||||
|
||||
void EnsureBrowserContextKeyedServiceFactoriesBuilt() {
|
||||
AlarmManager::GetFactoryInstance();
|
||||
CookieSettingsFactory::GetInstance();
|
||||
PluginPrefsFactory::GetInstance();
|
||||
PrefsTabHelper::GetServiceInstance();
|
||||
SpellcheckServiceFactory::GetInstance();
|
||||
ThemeServiceFactory::GetInstance();
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
extensions::AlarmManager::GetFactoryInstance();
|
||||
extensions::RendererStartupHelperFactory::GetInstance();
|
||||
extensions::StorageFrontend::GetFactoryInstance();
|
||||
extensions::StreamsPrivateAPI::GetFactoryInstance();
|
||||
}
|
||||
RendererStartupHelperFactory::GetInstance();
|
||||
StorageFrontend::GetFactoryInstance();
|
||||
StreamsPrivateAPI::GetFactoryInstance();
|
||||
}
|
||||
|
||||
} // namespace cef
|
||||
} // namespace extensions
|
@@ -2,9 +2,10 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be found
|
||||
// in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_
|
||||
#define CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_
|
||||
#ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_
|
||||
#define CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_
|
||||
|
||||
namespace extensions {
|
||||
namespace cef {
|
||||
|
||||
// Ensures the existence of any BrowserContextKeyedServiceFactory provided by
|
||||
@@ -13,5 +14,6 @@ namespace cef {
|
||||
void EnsureBrowserContextKeyedServiceFactoriesBuilt();
|
||||
|
||||
} // namespace cef
|
||||
} // namespace extensions
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_
|
||||
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_
|
@@ -92,7 +92,7 @@ class CefGetExtensionLoadFileCallbackImpl
|
||||
static std::unique_ptr<std::string> LoadFileFromStream(
|
||||
const std::string& file,
|
||||
CefRefPtr<CefStreamReader> stream) {
|
||||
base::AssertBlockingAllowed();
|
||||
base::ThreadRestrictions::AssertIOAllowed();
|
||||
|
||||
// Move to the end of the stream.
|
||||
stream->Seek(0, SEEK_END);
|
||||
|
@@ -112,7 +112,7 @@ void LoadExtensionWithManifest(base::WeakPtr<CefExtensionSystem> context,
|
||||
bool internal,
|
||||
CefRefPtr<CefRequestContext> loader_context,
|
||||
CefRefPtr<CefExtensionHandler> handler) {
|
||||
base::AssertBlockingAllowed();
|
||||
base::ThreadRestrictions::AssertIOAllowed();
|
||||
|
||||
std::unique_ptr<base::DictionaryValue> manifest =
|
||||
ParseManifest(manifest_contents);
|
||||
@@ -131,7 +131,7 @@ void LoadExtensionFromDisk(base::WeakPtr<CefExtensionSystem> context,
|
||||
bool internal,
|
||||
CefRefPtr<CefRequestContext> loader_context,
|
||||
CefRefPtr<CefExtensionHandler> handler) {
|
||||
base::AssertBlockingAllowed();
|
||||
base::ThreadRestrictions::AssertIOAllowed();
|
||||
|
||||
base::FilePath manifest_path = root_directory.AppendASCII("manifest.json");
|
||||
std::string manifest_contents;
|
||||
|
@@ -36,8 +36,8 @@ void CefExtensionWebContentsObserver::RenderFrameCreated(
|
||||
// are allowed to use chrome://resources/ URLs.
|
||||
if ((extension->is_extension() || extension->is_platform_app()) &&
|
||||
Manifest::IsComponentLocation(extension->location())) {
|
||||
policy->GrantOrigin(
|
||||
process_id, url::Origin::Create(GURL(content::kChromeUIResourcesURL)));
|
||||
policy->GrantOrigin(process_id,
|
||||
url::Origin(GURL(content::kChromeUIResourcesURL)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -124,14 +124,10 @@ CefExtensionsBrowserClient::MaybeCreateResourceBundleRequestJob(
|
||||
}
|
||||
|
||||
bool CefExtensionsBrowserClient::AllowCrossRendererResourceLoad(
|
||||
const GURL& url,
|
||||
content::ResourceType resource_type,
|
||||
ui::PageTransition page_transition,
|
||||
int child_id,
|
||||
net::URLRequest* request,
|
||||
bool is_incognito,
|
||||
const Extension* extension,
|
||||
const ExtensionSet& extensions,
|
||||
const ProcessMap& process_map) {
|
||||
InfoMap* extension_info_map) {
|
||||
// TODO(cef): This bypasses additional checks added to
|
||||
// AllowCrossRendererResourceLoad() in https://crrev.com/5cf9d45c. Figure out
|
||||
// why permission is not being granted based on "web_accessible_resources"
|
||||
@@ -141,8 +137,7 @@ bool CefExtensionsBrowserClient::AllowCrossRendererResourceLoad(
|
||||
|
||||
bool allowed = false;
|
||||
if (url_request_util::AllowCrossRendererResourceLoad(
|
||||
url, resource_type, page_transition, child_id, is_incognito,
|
||||
extension, extensions, process_map, &allowed)) {
|
||||
request, is_incognito, extension, extension_info_map, &allowed)) {
|
||||
return allowed;
|
||||
}
|
||||
|
||||
|
@@ -51,14 +51,10 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
|
||||
const base::FilePath& directory_path,
|
||||
const std::string& content_security_policy,
|
||||
bool send_cors_header) override;
|
||||
bool AllowCrossRendererResourceLoad(const GURL& url,
|
||||
content::ResourceType resource_type,
|
||||
ui::PageTransition page_transition,
|
||||
int child_id,
|
||||
bool AllowCrossRendererResourceLoad(net::URLRequest* request,
|
||||
bool is_incognito,
|
||||
const Extension* extension,
|
||||
const ExtensionSet& extensions,
|
||||
const ProcessMap& process_map) override;
|
||||
InfoMap* extension_info_map) override;
|
||||
PrefService* GetPrefServiceForContext(
|
||||
content::BrowserContext* context) override;
|
||||
void GetEarlyExtensionPrefsObservers(
|
||||
|
@@ -10,26 +10,10 @@
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
|
||||
namespace {
|
||||
|
||||
const char kGenericErrorMessage[] = "CefValueStore configured to error";
|
||||
|
||||
// Having this utility function allows ValueStore::Status to not have a copy
|
||||
// constructor.
|
||||
ValueStore::Status CreateStatusCopy(const ValueStore::Status& status) {
|
||||
return ValueStore::Status(status.code, status.restore_status, status.message);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefValueStore::CefValueStore() : read_count_(0), write_count_(0) {}
|
||||
|
||||
CefValueStore::~CefValueStore() {}
|
||||
|
||||
void CefValueStore::set_status_code(StatusCode status_code) {
|
||||
status_ = ValueStore::Status(status_code, kGenericErrorMessage);
|
||||
}
|
||||
|
||||
size_t CefValueStore::GetBytesInUse(const std::string& key) {
|
||||
// Let SettingsStorageQuotaEnforcer implement this.
|
||||
NOTREACHED();
|
||||
@@ -55,10 +39,7 @@ ValueStore::ReadResult CefValueStore::Get(const std::string& key) {
|
||||
ValueStore::ReadResult CefValueStore::Get(
|
||||
const std::vector<std::string>& keys) {
|
||||
read_count_++;
|
||||
if (!status_.ok())
|
||||
return ReadResult(CreateStatusCopy(status_));
|
||||
|
||||
auto settings = std::make_unique<base::DictionaryValue>();
|
||||
base::DictionaryValue* settings = new base::DictionaryValue();
|
||||
for (std::vector<std::string>::const_iterator it = keys.begin();
|
||||
it != keys.end(); ++it) {
|
||||
base::Value* value = NULL;
|
||||
@@ -66,14 +47,12 @@ ValueStore::ReadResult CefValueStore::Get(
|
||||
settings->SetWithoutPathExpansion(*it, value->CreateDeepCopy());
|
||||
}
|
||||
}
|
||||
return ReadResult(std::move(settings), CreateStatusCopy(status_));
|
||||
return MakeReadResult(base::WrapUnique(settings), status_);
|
||||
}
|
||||
|
||||
ValueStore::ReadResult CefValueStore::Get() {
|
||||
read_count_++;
|
||||
if (!status_.ok())
|
||||
return ReadResult(CreateStatusCopy(status_));
|
||||
return ReadResult(storage_.CreateDeepCopy(), CreateStatusCopy(status_));
|
||||
return MakeReadResult(storage_.CreateDeepCopy(), status_);
|
||||
}
|
||||
|
||||
ValueStore::WriteResult CefValueStore::Set(WriteOptions options,
|
||||
@@ -88,9 +67,6 @@ ValueStore::WriteResult CefValueStore::Set(
|
||||
WriteOptions options,
|
||||
const base::DictionaryValue& settings) {
|
||||
write_count_++;
|
||||
if (!status_.ok())
|
||||
return WriteResult(CreateStatusCopy(status_));
|
||||
|
||||
std::unique_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
|
||||
for (base::DictionaryValue::Iterator it(settings); !it.IsAtEnd();
|
||||
it.Advance()) {
|
||||
@@ -103,7 +79,7 @@ ValueStore::WriteResult CefValueStore::Set(
|
||||
storage_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy());
|
||||
}
|
||||
}
|
||||
return WriteResult(std::move(changes), CreateStatusCopy(status_));
|
||||
return MakeWriteResult(std::move(changes), status_);
|
||||
}
|
||||
|
||||
ValueStore::WriteResult CefValueStore::Remove(const std::string& key) {
|
||||
@@ -113,9 +89,6 @@ ValueStore::WriteResult CefValueStore::Remove(const std::string& key) {
|
||||
ValueStore::WriteResult CefValueStore::Remove(
|
||||
const std::vector<std::string>& keys) {
|
||||
write_count_++;
|
||||
if (!status_.ok())
|
||||
return WriteResult(CreateStatusCopy(status_));
|
||||
|
||||
std::unique_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
|
||||
for (std::vector<std::string>::const_iterator it = keys.begin();
|
||||
it != keys.end(); ++it) {
|
||||
@@ -124,7 +97,7 @@ ValueStore::WriteResult CefValueStore::Remove(
|
||||
changes->push_back(ValueStoreChange(*it, std::move(old_value), nullptr));
|
||||
}
|
||||
}
|
||||
return WriteResult(std::move(changes), CreateStatusCopy(status_));
|
||||
return MakeWriteResult(std::move(changes), status_);
|
||||
}
|
||||
|
||||
ValueStore::WriteResult CefValueStore::Clear() {
|
||||
@@ -134,4 +107,4 @@ ValueStore::WriteResult CefValueStore::Clear() {
|
||||
keys.push_back(it.key());
|
||||
}
|
||||
return Remove(keys);
|
||||
}
|
||||
}
|
||||
|
@@ -31,10 +31,6 @@ class CefValueStore : public ValueStore {
|
||||
int read_count() const { return read_count_; }
|
||||
int write_count() const { return write_count_; }
|
||||
|
||||
// Sets the error code for requests. If OK, errors won't be thrown.
|
||||
// Defaults to OK.
|
||||
void set_status_code(StatusCode status_code);
|
||||
|
||||
// ValueStore implementation.
|
||||
size_t GetBytesInUse(const std::string& key) override;
|
||||
size_t GetBytesInUse(const std::vector<std::string>& keys) override;
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "device/geolocation/geolocation_provider.h"
|
||||
#include "device/geolocation/public/interfaces/geoposition.mojom.h"
|
||||
#include "device/geolocation/geoposition.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -31,7 +31,7 @@ class CefLocationRequest
|
||||
|
||||
~CefLocationRequest() {}
|
||||
|
||||
void OnLocationUpdate(const device::mojom::Geoposition& position) {
|
||||
void OnLocationUpdate(const device::Geoposition& position) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (callback_.get()) {
|
||||
CefGeoposition cef_position;
|
||||
@@ -43,8 +43,7 @@ class CefLocationRequest
|
||||
geo_callback_.Reset();
|
||||
}
|
||||
|
||||
void SetPosition(const device::mojom::Geoposition& source,
|
||||
CefGeoposition& target) {
|
||||
void SetPosition(const device::Geoposition& source, CefGeoposition& target) {
|
||||
target.latitude = source.latitude;
|
||||
target.longitude = source.longitude;
|
||||
target.altitude = source.altitude;
|
||||
@@ -55,16 +54,16 @@ class CefLocationRequest
|
||||
cef_time_from_basetime(source.timestamp, target.timestamp);
|
||||
|
||||
switch (source.error_code) {
|
||||
case device::mojom::Geoposition::ErrorCode::NONE:
|
||||
case device::Geoposition::ERROR_CODE_NONE:
|
||||
target.error_code = GEOPOSITON_ERROR_NONE;
|
||||
break;
|
||||
case device::mojom::Geoposition::ErrorCode::PERMISSION_DENIED:
|
||||
case device::Geoposition::ERROR_CODE_PERMISSION_DENIED:
|
||||
target.error_code = GEOPOSITON_ERROR_PERMISSION_DENIED;
|
||||
break;
|
||||
case device::mojom::Geoposition::ErrorCode::POSITION_UNAVAILABLE:
|
||||
case device::Geoposition::ERROR_CODE_POSITION_UNAVAILABLE:
|
||||
target.error_code = GEOPOSITON_ERROR_POSITION_UNAVAILABLE;
|
||||
break;
|
||||
case device::mojom::Geoposition::ErrorCode::TIMEOUT:
|
||||
case device::Geoposition::ERROR_CODE_TIMEOUT:
|
||||
target.error_code = GEOPOSITON_ERROR_TIMEOUT;
|
||||
break;
|
||||
}
|
||||
|
@@ -138,7 +138,6 @@ void CefJavaScriptDialogManager::RunJavaScriptDialog(
|
||||
|
||||
void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
|
||||
content::WebContents* web_contents,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
bool is_reload,
|
||||
DialogClosedCallback callback) {
|
||||
if (browser_->destruction_state() >=
|
||||
|
@@ -36,7 +36,6 @@ class CefJavaScriptDialogManager : public content::JavaScriptDialogManager {
|
||||
DialogClosedCallback callback,
|
||||
bool* did_suppress_message) override;
|
||||
void RunBeforeUnloadDialog(content::WebContents* web_contents,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
bool is_reload,
|
||||
DialogClosedCallback callback) override;
|
||||
void CancelDialogs(content::WebContents* web_contents,
|
||||
|
@@ -389,6 +389,4 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateMouseEvent(
|
||||
|
||||
// timestamp
|
||||
result.SetTimeStampSeconds(GetSystemUptime());
|
||||
|
||||
result.pointer_type = blink::WebPointerProperties::PointerType::kMouse;
|
||||
}
|
||||
|
@@ -474,6 +474,4 @@ void CefBrowserPlatformDelegateNativeMac::TranslateMouseEvent(
|
||||
|
||||
// timestamp - Mac OSX specific
|
||||
result.SetTimeStampSeconds(currentEventTimestamp());
|
||||
|
||||
result.pointer_type = blink::WebPointerProperties::PointerType::kMouse;
|
||||
}
|
||||
|
@@ -20,7 +20,6 @@
|
||||
#include "base/memory/ref_counted_memory.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/win/registry.h"
|
||||
#include "base/win/win_util.h"
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
#include "third_party/WebKit/public/platform/WebMouseEvent.h"
|
||||
#include "third_party/WebKit/public/platform/WebMouseWheelEvent.h"
|
||||
@@ -96,29 +95,21 @@ void ExecuteExternalProtocol(const GURL& url) {
|
||||
ShellExecuteA(NULL, "open", address.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
}
|
||||
|
||||
// DPI value for 1x scale factor.
|
||||
#define DPI_1X 96.0f
|
||||
WORD KeyStatesToWord() {
|
||||
static const USHORT kHighBitMaskShort = 0x8000;
|
||||
WORD result = 0;
|
||||
|
||||
float GetWindowScaleFactor(HWND hwnd) {
|
||||
DCHECK(hwnd);
|
||||
|
||||
if (base::win::IsProcessPerMonitorDpiAware()) {
|
||||
// Let Windows tell us the correct DPI.
|
||||
static auto get_dpi_for_window_func = []() {
|
||||
return reinterpret_cast<decltype(::GetDpiForWindow)*>(
|
||||
GetProcAddress(GetModuleHandle(L"user32.dll"), "GetDpiForWindow"));
|
||||
}();
|
||||
if (get_dpi_for_window_func)
|
||||
return static_cast<float>(get_dpi_for_window_func(hwnd)) / DPI_1X;
|
||||
}
|
||||
|
||||
// Fallback to the monitor that contains the window center point.
|
||||
RECT cr;
|
||||
GetWindowRect(hwnd, &cr);
|
||||
return display::Screen::GetScreen()
|
||||
->GetDisplayNearestPoint(
|
||||
gfx::Point((cr.right - cr.left) / 2, (cr.bottom - cr.top) / 2))
|
||||
.device_scale_factor();
|
||||
if (GetKeyState(VK_CONTROL) & kHighBitMaskShort)
|
||||
result |= MK_CONTROL;
|
||||
if (GetKeyState(VK_SHIFT) & kHighBitMaskShort)
|
||||
result |= MK_SHIFT;
|
||||
if (GetKeyState(VK_LBUTTON) & kHighBitMaskShort)
|
||||
result |= MK_LBUTTON;
|
||||
if (GetKeyState(VK_MBUTTON) & kHighBitMaskShort)
|
||||
result |= MK_MBUTTON;
|
||||
if (GetKeyState(VK_RBUTTON) & kHighBitMaskShort)
|
||||
result |= MK_RBUTTON;
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -143,49 +134,40 @@ void CefBrowserPlatformDelegateNativeWin::BrowserDestroyed(
|
||||
bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() {
|
||||
RegisterWindowClass();
|
||||
|
||||
has_frame_ = !(window_info_.style & WS_CHILD);
|
||||
|
||||
std::wstring windowName(CefString(&window_info_.window_name));
|
||||
|
||||
// Create the new browser window.
|
||||
CreateWindowEx(window_info_.ex_style, GetWndClass(), windowName.c_str(),
|
||||
window_info_.style, window_info_.x, window_info_.y,
|
||||
window_info_.width, window_info_.height,
|
||||
window_info_.parent_window, window_info_.menu,
|
||||
::GetModuleHandle(NULL), this);
|
||||
window_info_.window = CreateWindowEx(
|
||||
window_info_.ex_style, GetWndClass(), windowName.c_str(),
|
||||
window_info_.style, window_info_.x, window_info_.y, window_info_.width,
|
||||
window_info_.height, window_info_.parent_window, window_info_.menu,
|
||||
::GetModuleHandle(NULL), NULL);
|
||||
|
||||
// It's possible for CreateWindowEx to fail if the parent window was
|
||||
// destroyed between the call to CreateBrowser and the above one.
|
||||
DCHECK(window_info_.window);
|
||||
DCHECK(window_info_.window != NULL);
|
||||
if (!window_info_.window)
|
||||
return false;
|
||||
|
||||
host_window_created_ = true;
|
||||
|
||||
// Set window user data to this object for future reference from the window
|
||||
// procedure.
|
||||
gfx::SetWindowUserData(window_info_.window, this);
|
||||
|
||||
// Add a reference that will later be released in DestroyBrowser().
|
||||
browser_->AddRef();
|
||||
|
||||
if (!called_enable_non_client_dpi_scaling_ && has_frame_ &&
|
||||
base::win::IsProcessPerMonitorDpiAware()) {
|
||||
// This call gets Windows to scale the non-client area when WM_DPICHANGED
|
||||
// is fired on Windows versions < 10.0.14393.0.
|
||||
// Derived signature; not available in headers.
|
||||
static auto enable_child_window_dpi_message_func = []() {
|
||||
using EnableChildWindowDpiMessagePtr = LRESULT(WINAPI*)(HWND, BOOL);
|
||||
return reinterpret_cast<EnableChildWindowDpiMessagePtr>(GetProcAddress(
|
||||
GetModuleHandle(L"user32.dll"), "EnableChildWindowDpiMessage"));
|
||||
}();
|
||||
if (enable_child_window_dpi_message_func)
|
||||
enable_child_window_dpi_message_func(window_info_.window, TRUE);
|
||||
}
|
||||
RECT cr;
|
||||
GetClientRect(window_info_.window, &cr);
|
||||
|
||||
DCHECK(!window_widget_);
|
||||
|
||||
// Convert from device coordinates to logical coordinates.
|
||||
RECT cr;
|
||||
GetClientRect(window_info_.window, &cr);
|
||||
// Adjust for potential display scaling.
|
||||
gfx::Point point = gfx::Point(cr.right, cr.bottom);
|
||||
const float scale = GetWindowScaleFactor(window_info_.window);
|
||||
float scale = display::Screen::GetScreen()
|
||||
->GetDisplayNearestPoint(point)
|
||||
.device_scale_factor();
|
||||
point =
|
||||
gfx::ToFlooredPoint(gfx::ScalePoint(gfx::PointF(point), 1.0f / scale));
|
||||
|
||||
@@ -305,19 +287,19 @@ gfx::Point CefBrowserPlatformDelegateNativeWin::GetScreenPoint(
|
||||
if (windowless_handler_)
|
||||
return windowless_handler_->GetParentScreenPoint(view);
|
||||
|
||||
if (!window_info_.window)
|
||||
if (!window_widget_)
|
||||
return view;
|
||||
|
||||
// Convert from logical coordinates to device coordinates.
|
||||
const float scale = GetWindowScaleFactor(window_info_.window);
|
||||
const gfx::Point& device_pt =
|
||||
gfx::ToFlooredPoint(gfx::ScalePoint(gfx::PointF(view), scale));
|
||||
aura::Window* window = window_widget_->GetNativeView();
|
||||
const gfx::Rect& bounds_in_screen = window->GetBoundsInScreen();
|
||||
const gfx::Point& screen_point = gfx::Point(bounds_in_screen.x() + view.x(),
|
||||
bounds_in_screen.y() + view.y());
|
||||
|
||||
// Convert from client coordinates to screen coordinates.
|
||||
POINT screen_pt = {device_pt.x(), device_pt.y()};
|
||||
ClientToScreen(window_info_.window, &screen_pt);
|
||||
|
||||
return gfx::Point(screen_pt.x, screen_pt.y);
|
||||
// Adjust for potential display scaling.
|
||||
float scale = display::Screen::GetScreen()
|
||||
->GetDisplayNearestPoint(screen_point)
|
||||
.device_scale_factor();
|
||||
return gfx::ToFlooredPoint(gfx::ScalePoint(gfx::PointF(screen_point), scale));
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateNativeWin::ViewText(const std::string& text) {
|
||||
@@ -405,9 +387,8 @@ void CefBrowserPlatformDelegateNativeWin::TranslateKeyEvent(
|
||||
// TODO(cef): CefKeyEvent does not currently pass extended key status (see
|
||||
// WM_KEYDOWN docs) which would be necessary to pass EF_IS_EXTENDED_KEY as
|
||||
// the |flags| parameter to DomKeyFromKeyboardCode().
|
||||
int flags = 0;
|
||||
result.dom_key = ui::PlatformKeyMap::DomKeyFromKeyboardCode(
|
||||
ui::KeyboardCodeForWindowsKeyCode(key_event.windows_key_code), &flags);
|
||||
ui::KeyboardCodeForWindowsKeyCode(key_event.windows_key_code), 0);
|
||||
}
|
||||
|
||||
if (result.GetType() == blink::WebInputEvent::kChar ||
|
||||
@@ -559,8 +540,6 @@ void CefBrowserPlatformDelegateNativeWin::TranslateMouseEvent(
|
||||
|
||||
// timestamp
|
||||
result.SetTimeStampSeconds(GetMessageTime() / 1000.0);
|
||||
|
||||
result.pointer_type = blink::WebPointerProperties::PointerType::kMouse;
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -599,15 +578,12 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam) {
|
||||
CefBrowserPlatformDelegateNativeWin* platform_delegate = nullptr;
|
||||
CefBrowserPlatformDelegateNativeWin* platform_delegate =
|
||||
static_cast<CefBrowserPlatformDelegateNativeWin*>(
|
||||
gfx::GetWindowUserData(hwnd));
|
||||
CefBrowserHostImpl* browser = nullptr;
|
||||
|
||||
if (message != WM_NCCREATE) {
|
||||
platform_delegate = static_cast<CefBrowserPlatformDelegateNativeWin*>(
|
||||
gfx::GetWindowUserData(hwnd));
|
||||
if (platform_delegate)
|
||||
browser = platform_delegate->browser_;
|
||||
}
|
||||
if (platform_delegate)
|
||||
browser = platform_delegate->browser_;
|
||||
|
||||
switch (message) {
|
||||
case WM_CLOSE:
|
||||
@@ -619,31 +595,6 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
|
||||
// Allow the close.
|
||||
break;
|
||||
|
||||
case WM_NCCREATE: {
|
||||
CREATESTRUCT* cs = reinterpret_cast<CREATESTRUCT*>(lParam);
|
||||
platform_delegate =
|
||||
reinterpret_cast<CefBrowserPlatformDelegateNativeWin*>(
|
||||
cs->lpCreateParams);
|
||||
DCHECK(platform_delegate);
|
||||
// Associate |platform_delegate| with the window handle.
|
||||
gfx::SetWindowUserData(hwnd, platform_delegate);
|
||||
platform_delegate->window_info_.window = hwnd;
|
||||
|
||||
if (platform_delegate->has_frame_ &&
|
||||
base::win::IsProcessPerMonitorDpiAware()) {
|
||||
// This call gets Windows to scale the non-client area when
|
||||
// WM_DPICHANGED is fired on Windows versions >= 10.0.14393.0.
|
||||
static auto enable_non_client_dpi_scaling_func = []() {
|
||||
return reinterpret_cast<decltype(::EnableNonClientDpiScaling)*>(
|
||||
GetProcAddress(GetModuleHandle(L"user32.dll"),
|
||||
"EnableNonClientDpiScaling"));
|
||||
}();
|
||||
platform_delegate->called_enable_non_client_dpi_scaling_ =
|
||||
!!(enable_non_client_dpi_scaling_func &&
|
||||
enable_non_client_dpi_scaling_func(hwnd));
|
||||
}
|
||||
} break;
|
||||
|
||||
case WM_NCDESTROY:
|
||||
if (platform_delegate) {
|
||||
// Clear the user data pointer.
|
||||
@@ -682,17 +633,6 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
return 0;
|
||||
|
||||
case WM_DPICHANGED:
|
||||
if (platform_delegate && platform_delegate->has_frame_) {
|
||||
// Suggested size and position of the current window scaled for the
|
||||
// new DPI.
|
||||
const RECT* rect = reinterpret_cast<RECT*>(lParam);
|
||||
SetWindowPos(platform_delegate->GetHostWindowHandle(), NULL, rect->left,
|
||||
rect->top, rect->right - rect->left,
|
||||
rect->bottom - rect->top, SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
||||
|
@@ -68,9 +68,6 @@ class CefBrowserPlatformDelegateNativeWin
|
||||
// Widget hosting the web contents. It will be deleted automatically when the
|
||||
// associated root window is destroyed.
|
||||
views::Widget* window_widget_;
|
||||
|
||||
bool has_frame_ = false;
|
||||
bool called_enable_non_client_dpi_scaling_ = false;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_WIN_H_
|
||||
|
@@ -7,7 +7,6 @@
|
||||
|
||||
#include <commdlg.h>
|
||||
#include <shlobj.h>
|
||||
#include <wrl/client.h>
|
||||
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
|
||||
@@ -16,6 +15,7 @@
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/win/registry.h"
|
||||
#include "base/win/scoped_comptr.h"
|
||||
#include "cef/grit/cef_strings.h"
|
||||
#include "chrome/grit/generated_resources.h"
|
||||
#include "net/base/mime_util.h"
|
||||
@@ -395,7 +395,7 @@ bool RunOpenFolderDialog(const CefFileDialogRunner::FileChooserParams& params,
|
||||
STRRET out_dir_buffer;
|
||||
ZeroMemory(&out_dir_buffer, sizeof(out_dir_buffer));
|
||||
out_dir_buffer.uType = STRRET_WSTR;
|
||||
Microsoft::WRL::ComPtr<IShellFolder> shell_folder;
|
||||
base::win::ScopedComPtr<IShellFolder> shell_folder;
|
||||
if (SHGetDesktopFolder(shell_folder.GetAddressOf()) == NOERROR) {
|
||||
HRESULT hr = shell_folder->GetDisplayNameOf(list, SHGDN_FORPARSING,
|
||||
&out_dir_buffer);
|
||||
|
@@ -11,9 +11,9 @@
|
||||
#include "base/mac/scoped_nsobject.h"
|
||||
|
||||
#if __OBJC__
|
||||
@class MenuControllerCocoa;
|
||||
@class MenuController;
|
||||
#else
|
||||
class MenuControllerCocoa;
|
||||
class MenuController;
|
||||
#endif
|
||||
|
||||
class CefMenuRunnerMac : public CefMenuRunner {
|
||||
@@ -28,7 +28,7 @@ class CefMenuRunnerMac : public CefMenuRunner {
|
||||
void CancelContextMenu() override;
|
||||
|
||||
private:
|
||||
base::scoped_nsobject<MenuControllerCocoa> menu_controller_;
|
||||
base::scoped_nsobject<MenuController> menu_controller_;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_NATIVE_MENU_RUNNER_MAC_H_
|
||||
|
@@ -21,16 +21,14 @@ bool CefMenuRunnerMac::RunContextMenu(
|
||||
CefMenuModelImpl* model,
|
||||
const content::ContextMenuParams& params) {
|
||||
// Create a menu controller based on the model.
|
||||
menu_controller_.reset([[MenuControllerCocoa alloc]
|
||||
initWithModel:model->model()
|
||||
useWithPopUpButtonCell:NO]);
|
||||
menu_controller_.reset([[MenuController alloc] initWithModel:model->model()
|
||||
useWithPopUpButtonCell:NO]);
|
||||
|
||||
// Keep the menu controller alive (by adding an additional retain) until after
|
||||
// the menu has been dismissed. Otherwise it will crash if the browser is
|
||||
// destroyed (and consequently the menu controller is destroyed) while the
|
||||
// menu is still pending.
|
||||
base::scoped_nsobject<MenuControllerCocoa> menu_controller_ref(
|
||||
menu_controller_);
|
||||
base::scoped_nsobject<MenuController> menu_controller_ref(menu_controller_);
|
||||
|
||||
// Make sure events can be pumped while the menu is up.
|
||||
base::MessageLoop::ScopedNestableTaskAllower allow(
|
||||
|
@@ -109,7 +109,7 @@ static CefNativeMenuWin* GetCefNativeMenuWinFromHMENU(HMENU hmenu) {
|
||||
// structure we have constructed in CefNativeMenuWin.
|
||||
class CefNativeMenuWin::MenuHostWindow {
|
||||
public:
|
||||
MenuHostWindow() {
|
||||
explicit MenuHostWindow(CefNativeMenuWin* parent) : parent_(parent) {
|
||||
RegisterClass();
|
||||
hwnd_ = CreateWindowEx(l10n_util::GetExtendedStyles(), kWindowClassName,
|
||||
L"", 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL);
|
||||
@@ -389,6 +389,7 @@ class CefNativeMenuWin::MenuHostWindow {
|
||||
}
|
||||
|
||||
HWND hwnd_;
|
||||
CefNativeMenuWin* parent_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(MenuHostWindow);
|
||||
};
|
||||
@@ -774,7 +775,7 @@ void CefNativeMenuWin::CreateHostWindow() {
|
||||
// host window per menu hierarchy, no matter how many CefNativeMenuWin objects
|
||||
// exist wrapping submenus.
|
||||
if (!host_window_.get())
|
||||
host_window_.reset(new MenuHostWindow());
|
||||
host_window_.reset(new MenuHostWindow(this));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@@ -38,7 +38,7 @@ const char kXdndProxy[] = "XdndProxy";
|
||||
::Window root;
|
||||
::Window parent;
|
||||
::Window* children;
|
||||
::Window child_window = x11::None;
|
||||
::Window child_window = None;
|
||||
unsigned int nchildren;
|
||||
if (XQueryTree(display, window, &root, &parent, &children, &nchildren)) {
|
||||
DCHECK_EQ(1U, nchildren);
|
||||
@@ -50,8 +50,8 @@ const char kXdndProxy[] = "XdndProxy";
|
||||
|
||||
::Window FindToplevelParent(::Display* display, ::Window window) {
|
||||
::Window top_level_window = window;
|
||||
::Window root = x11::None;
|
||||
::Window parent = x11::None;
|
||||
::Window root = None;
|
||||
::Window parent = None;
|
||||
::Window* children = NULL;
|
||||
unsigned int nchildren = 0;
|
||||
// Enumerate all parents of "window" to find the highest level window
|
||||
@@ -91,12 +91,12 @@ CefWindowX11::CefWindowX11(CefRefPtr<CefBrowserHostImpl> browser,
|
||||
bounds_(bounds),
|
||||
focus_pending_(false),
|
||||
weak_ptr_factory_(this) {
|
||||
if (parent_xwindow_ == x11::None)
|
||||
if (parent_xwindow_ == None)
|
||||
parent_xwindow_ = DefaultRootWindow(xdisplay_);
|
||||
|
||||
XSetWindowAttributes swa;
|
||||
memset(&swa, 0, sizeof(swa));
|
||||
swa.background_pixmap = x11::None;
|
||||
swa.background_pixmap = None;
|
||||
swa.override_redirect = false;
|
||||
xwindow_ = XCreateWindow(xdisplay_, parent_xwindow_, bounds.x(), bounds.y(),
|
||||
bounds.width(), bounds.height(),
|
||||
@@ -148,12 +148,12 @@ void CefWindowX11::Close() {
|
||||
ev.xclient.message_type = gfx::GetAtom(kWMProtocols);
|
||||
ev.xclient.format = 32;
|
||||
ev.xclient.data.l[0] = gfx::GetAtom(kWMDeleteWindow);
|
||||
ev.xclient.data.l[1] = x11::CurrentTime;
|
||||
XSendEvent(xdisplay_, xwindow_, false, NoEventMask, &ev);
|
||||
ev.xclient.data.l[1] = CurrentTime;
|
||||
XSendEvent(xdisplay_, xwindow_, False, NoEventMask, &ev);
|
||||
}
|
||||
|
||||
void CefWindowX11::Show() {
|
||||
if (xwindow_ == x11::None)
|
||||
if (xwindow_ == None)
|
||||
return;
|
||||
|
||||
if (!window_mapped_) {
|
||||
@@ -205,7 +205,7 @@ void CefWindowX11::Show() {
|
||||
}
|
||||
|
||||
void CefWindowX11::Hide() {
|
||||
if (xwindow_ == x11::None)
|
||||
if (xwindow_ == None)
|
||||
return;
|
||||
|
||||
if (window_mapped_) {
|
||||
@@ -215,22 +215,22 @@ void CefWindowX11::Hide() {
|
||||
}
|
||||
|
||||
void CefWindowX11::Focus() {
|
||||
if (xwindow_ == x11::None || !window_mapped_)
|
||||
if (xwindow_ == None || !window_mapped_)
|
||||
return;
|
||||
|
||||
if (browser_.get()) {
|
||||
::Window child = FindChild(xdisplay_, xwindow_);
|
||||
if (child && ui::IsWindowVisible(child)) {
|
||||
// Give focus to the child DesktopWindowTreeHostX11.
|
||||
XSetInputFocus(xdisplay_, child, RevertToParent, x11::CurrentTime);
|
||||
XSetInputFocus(xdisplay_, child, RevertToParent, CurrentTime);
|
||||
}
|
||||
} else {
|
||||
XSetInputFocus(xdisplay_, xwindow_, RevertToParent, x11::CurrentTime);
|
||||
XSetInputFocus(xdisplay_, xwindow_, RevertToParent, CurrentTime);
|
||||
}
|
||||
}
|
||||
|
||||
void CefWindowX11::SetBounds(const gfx::Rect& bounds) {
|
||||
if (xwindow_ == x11::None)
|
||||
if (xwindow_ == None)
|
||||
return;
|
||||
|
||||
bool origin_changed = bounds_.origin() != bounds.origin();
|
||||
@@ -315,7 +315,7 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
|
||||
// Allow the close.
|
||||
XDestroyWindow(xdisplay_, xwindow_);
|
||||
|
||||
xwindow_ = x11::None;
|
||||
xwindow_ = None;
|
||||
|
||||
if (browser_.get()) {
|
||||
// Force the browser to be destroyed and release the reference
|
||||
@@ -329,7 +329,7 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
|
||||
XEvent reply_event = *xev;
|
||||
reply_event.xclient.window = parent_xwindow_;
|
||||
|
||||
XSendEvent(xdisplay_, reply_event.xclient.window, false,
|
||||
XSendEvent(xdisplay_, reply_event.xclient.window, False,
|
||||
SubstructureRedirectMask | SubstructureNotifyMask,
|
||||
&reply_event);
|
||||
XFlush(xdisplay_);
|
||||
|
@@ -37,7 +37,6 @@
|
||||
#include "content/browser/webui/content_web_ui_controller_factory.h"
|
||||
#include "content/public/browser/browser_url_handler.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "content/public/common/url_utils.h"
|
||||
#include "content/public/common/user_agent.h"
|
||||
#include "ipc/ipc_channel.h"
|
||||
#include "net/url_request/url_request.h"
|
||||
@@ -170,7 +169,7 @@ bool IsDebugURL(const GURL& url) {
|
||||
|
||||
// Also include URLs handled by the browser process in
|
||||
// content/browser/frame_host/debug_urls.cc HandleDebugURL().
|
||||
for (size_t i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) {
|
||||
for (int i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) {
|
||||
GURL host(chrome::kChromeDebugURLs[i]);
|
||||
if (url.GetOrigin() == host.GetOrigin())
|
||||
return true;
|
||||
@@ -187,7 +186,7 @@ bool IsDebugURL(const GURL& url) {
|
||||
}
|
||||
|
||||
void GetDebugURLs(std::vector<std::string>* urls) {
|
||||
for (size_t i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) {
|
||||
for (int i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) {
|
||||
urls->push_back(chrome::kChromeDebugURLs[i]);
|
||||
}
|
||||
|
||||
|
@@ -36,6 +36,29 @@ void CefCookieStoreProxy::SetCookieWithOptionsAsync(
|
||||
}
|
||||
}
|
||||
|
||||
void CefCookieStoreProxy::SetCookieWithDetailsAsync(
|
||||
const GURL& url,
|
||||
const std::string& name,
|
||||
const std::string& value,
|
||||
const std::string& domain,
|
||||
const std::string& path,
|
||||
base::Time creation_time,
|
||||
base::Time expiration_time,
|
||||
base::Time last_access_time,
|
||||
bool secure,
|
||||
bool http_only,
|
||||
net::CookieSameSite same_site,
|
||||
net::CookiePriority priority,
|
||||
SetCookiesCallback callback) {
|
||||
net::CookieStore* cookie_store = GetCookieStore();
|
||||
if (cookie_store) {
|
||||
cookie_store->SetCookieWithDetailsAsync(
|
||||
url, name, value, domain, path, creation_time, expiration_time,
|
||||
last_access_time, secure, http_only, same_site, priority,
|
||||
std::move(callback));
|
||||
}
|
||||
}
|
||||
|
||||
void CefCookieStoreProxy::SetCanonicalCookieAsync(
|
||||
std::unique_ptr<net::CanonicalCookie> cookie,
|
||||
bool secure_source,
|
||||
|
@@ -26,6 +26,19 @@ class CefCookieStoreProxy : public net::CookieStore {
|
||||
const std::string& cookie_line,
|
||||
const net::CookieOptions& options,
|
||||
SetCookiesCallback callback) override;
|
||||
void SetCookieWithDetailsAsync(const GURL& url,
|
||||
const std::string& name,
|
||||
const std::string& value,
|
||||
const std::string& domain,
|
||||
const std::string& path,
|
||||
base::Time creation_time,
|
||||
base::Time expiration_time,
|
||||
base::Time last_access_time,
|
||||
bool secure,
|
||||
bool http_only,
|
||||
net::CookieSameSite same_site,
|
||||
net::CookiePriority priority,
|
||||
SetCookiesCallback callback) override;
|
||||
void SetCanonicalCookieAsync(std::unique_ptr<net::CanonicalCookie> cookie,
|
||||
bool secure_source,
|
||||
bool modify_http_only,
|
||||
|
@@ -21,11 +21,19 @@ namespace {
|
||||
|
||||
void SetCRLSetIfNewer(scoped_refptr<net::CRLSet> crl_set) {
|
||||
CEF_REQUIRE_IOT();
|
||||
net::SSLConfigService::SetCRLSetIfNewer(crl_set);
|
||||
|
||||
scoped_refptr<net::CRLSet> old_crl_set(net::SSLConfigService::GetCRLSet());
|
||||
if (old_crl_set.get() && old_crl_set->sequence() > crl_set->sequence()) {
|
||||
LOG(WARNING) << "Refusing to downgrade CRL set from #"
|
||||
<< old_crl_set->sequence() << "to #" << crl_set->sequence();
|
||||
} else {
|
||||
net::SSLConfigService::SetCRLSet(crl_set);
|
||||
VLOG(1) << "Installed CRL set #" << crl_set->sequence();
|
||||
}
|
||||
}
|
||||
|
||||
void LoadFromDisk(const base::FilePath& path) {
|
||||
base::AssertBlockingAllowed();
|
||||
base::ThreadRestrictions::AssertIOAllowed();
|
||||
|
||||
std::string crl_set_bytes;
|
||||
if (!base::ReadFileToString(path, &crl_set_bytes)) {
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace net_util {
|
||||
|
||||
bool IsInternalRequest(const net::URLRequest* request) {
|
||||
bool IsInternalRequest(net::URLRequest* request) {
|
||||
// With PlzNavigate we now receive blob URLs. Ignore these URLs.
|
||||
// See https://crbug.com/776884 for details.
|
||||
if (request->url().SchemeIs(url::kBlobScheme)) {
|
||||
|
@@ -14,7 +14,7 @@ namespace net_util {
|
||||
|
||||
// Returns true if |request| is handled internally and should not be exposed via
|
||||
// the CEF API.
|
||||
bool IsInternalRequest(const net::URLRequest* request);
|
||||
bool IsInternalRequest(net::URLRequest* request);
|
||||
|
||||
}; // namespace net_util
|
||||
|
||||
|
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "include/cef_urlrequest.h"
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/cookie_manager_impl.h"
|
||||
#include "libcef/browser/net/net_util.h"
|
||||
#include "libcef/browser/net/source_stream.h"
|
||||
#include "libcef/browser/net/url_request_user_data.h"
|
||||
@@ -441,64 +440,6 @@ net::NetworkDelegate::AuthRequiredResponse CefNetworkDelegate::OnAuthRequired(
|
||||
return AUTH_REQUIRED_RESPONSE_NO_ACTION;
|
||||
}
|
||||
|
||||
bool CefNetworkDelegate::OnCanGetCookies(const net::URLRequest& request,
|
||||
const net::CookieList& cookie_list) {
|
||||
if (net_util::IsInternalRequest(&request))
|
||||
return true;
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
CefBrowserHostImpl::GetBrowserForRequest(&request);
|
||||
if (browser.get()) {
|
||||
CefRefPtr<CefClient> client = browser->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefRequestHandler> handler = client->GetRequestHandler();
|
||||
if (handler.get()) {
|
||||
CefRefPtr<CefFrame> frame = browser->GetFrameForRequest(&request);
|
||||
|
||||
CefRefPtr<CefRequestImpl> cefRequest = new CefRequestImpl();
|
||||
cefRequest->Set(&request);
|
||||
cefRequest->SetReadOnly(true);
|
||||
|
||||
return handler->CanGetCookies(browser.get(), frame, cefRequest.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefNetworkDelegate::OnCanSetCookie(const net::URLRequest& request,
|
||||
const net::CanonicalCookie& cookie,
|
||||
net::CookieOptions* options) {
|
||||
if (net_util::IsInternalRequest(&request))
|
||||
return true;
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
CefBrowserHostImpl::GetBrowserForRequest(&request);
|
||||
if (browser.get()) {
|
||||
CefRefPtr<CefClient> client = browser->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefRequestHandler> handler = client->GetRequestHandler();
|
||||
if (handler.get()) {
|
||||
CefRefPtr<CefFrame> frame = browser->GetFrameForRequest(&request);
|
||||
|
||||
CefRefPtr<CefRequestImpl> cefRequest = new CefRequestImpl();
|
||||
cefRequest->Set(&request);
|
||||
cefRequest->SetReadOnly(true);
|
||||
|
||||
CefCookie cefCookie;
|
||||
if (!CefCookieManagerImpl::GetCefCookie(cookie, cefCookie))
|
||||
return true;
|
||||
|
||||
return handler->CanSetCookie(browser.get(), frame, cefRequest.get(),
|
||||
cefCookie);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefNetworkDelegate::OnCanAccessFile(
|
||||
const net::URLRequest& request,
|
||||
const base::FilePath& original_path,
|
||||
|
@@ -38,11 +38,6 @@ class CefNetworkDelegate : public net::NetworkDelegateImpl {
|
||||
const AuthCallback& callback,
|
||||
net::AuthCredentials* credentials) override;
|
||||
void OnCompleted(net::URLRequest* request, bool started) override;
|
||||
bool OnCanGetCookies(const net::URLRequest& request,
|
||||
const net::CookieList& cookie_list) override;
|
||||
bool OnCanSetCookie(const net::URLRequest& request,
|
||||
const net::CanonicalCookie& cookie,
|
||||
net::CookieOptions* options) override;
|
||||
bool OnCanAccessFile(const net::URLRequest& request,
|
||||
const base::FilePath& original_path,
|
||||
const base::FilePath& absolute_path) const override;
|
||||
|
@@ -328,14 +328,6 @@ bool CefResourceRequestJob::GetMimeType(std::string* mime_type) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefResourceRequestJob::GetCharset(std::string* charset) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
if (net::HttpResponseHeaders *headers = GetResponseHeaders())
|
||||
return headers->GetCharset(charset);
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefResourceRequestJob::SendHeaders() {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
@@ -419,7 +411,7 @@ void CefResourceRequestJob::DoLoadCookies() {
|
||||
|
||||
void CefResourceRequestJob::CheckCookiePolicyAndLoad(
|
||||
const net::CookieList& cookie_list) {
|
||||
bool can_get_cookies = !cookie_list.empty() && CanGetCookies(cookie_list);
|
||||
bool can_get_cookies = CanGetCookies(cookie_list);
|
||||
if (can_get_cookies) {
|
||||
net::CookieList::const_iterator it = cookie_list.begin();
|
||||
for (; it != cookie_list.end(); ++it) {
|
||||
@@ -508,29 +500,25 @@ void CefResourceRequestJob::SaveNextCookie() {
|
||||
return;
|
||||
}
|
||||
|
||||
const std::string& cookie_line =
|
||||
response_cookies_[response_cookies_save_index_];
|
||||
|
||||
net::CookieOptions options;
|
||||
options.set_include_httponly();
|
||||
std::unique_ptr<net::CanonicalCookie> cookie = net::CanonicalCookie::Create(
|
||||
request_->url(), cookie_line, base::Time::Now(), options);
|
||||
|
||||
bool can_set_cookie = cookie && CanSetCookie(*cookie, &options);
|
||||
bool can_set_cookie =
|
||||
CanSetCookie(response_cookies_[response_cookies_save_index_], &options);
|
||||
if (can_set_cookie) {
|
||||
CefCookie cef_cookie;
|
||||
if (CefCookieManagerImpl::GetCefCookie(request_->url(), cookie_line,
|
||||
cef_cookie)) {
|
||||
can_set_cookie = handler_->CanSetCookie(cef_cookie);
|
||||
CefCookie cookie;
|
||||
if (CefCookieManagerImpl::GetCefCookie(
|
||||
request_->url(), response_cookies_[response_cookies_save_index_],
|
||||
cookie)) {
|
||||
can_set_cookie = handler_->CanSetCookie(cookie);
|
||||
} else {
|
||||
can_set_cookie = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (can_set_cookie) {
|
||||
request_->context()->cookie_store()->SetCanonicalCookieAsync(
|
||||
std::move(cookie), request_->url().SchemeIsCryptographic(),
|
||||
!options.exclude_httponly(),
|
||||
request_->context()->cookie_store()->SetCookieWithOptionsAsync(
|
||||
request_->url(), response_cookies_[response_cookies_save_index_],
|
||||
options,
|
||||
base::Bind(&CefResourceRequestJob::OnCookieSaved,
|
||||
weak_factory_.GetWeakPtr()));
|
||||
return;
|
||||
|
@@ -40,7 +40,6 @@ class CefResourceRequestJob : public net::URLRequestJob {
|
||||
void GetLoadTimingInfo(net::LoadTimingInfo* load_timing_info) const override;
|
||||
bool IsRedirectResponse(GURL* location, int* http_status_code) override;
|
||||
bool GetMimeType(std::string* mime_type) const override;
|
||||
bool GetCharset(std::string* charset) override;
|
||||
|
||||
void SendHeaders();
|
||||
|
||||
|
@@ -136,9 +136,9 @@ std::unique_ptr<net::ProxyService> CreateProxyService(
|
||||
dhcp_proxy_script_fetcher = dhcp_factory.Create(context);
|
||||
|
||||
proxy_service = content::CreateProxyServiceUsingMojoFactory(
|
||||
ChromeMojoProxyResolverFactory::CreateWithStrongBinding(),
|
||||
ChromeMojoProxyResolverFactory::GetInstance(),
|
||||
std::move(proxy_config_service),
|
||||
base::MakeUnique<net::ProxyScriptFetcherImpl>(context),
|
||||
new net::ProxyScriptFetcherImpl(context),
|
||||
std::move(dhcp_proxy_script_fetcher), context->host_resolver(), net_log,
|
||||
network_delegate);
|
||||
} else {
|
||||
@@ -536,11 +536,11 @@ void CefURLRequestContextGetterImpl::CreateProxyConfigService() {
|
||||
}
|
||||
|
||||
void CefURLRequestContextGetterImpl::UpdateServerWhitelist() {
|
||||
io_state_->http_auth_preferences_->SetServerWhitelist(
|
||||
io_state_->http_auth_preferences_->set_server_whitelist(
|
||||
auth_server_whitelist_.GetValue());
|
||||
}
|
||||
|
||||
void CefURLRequestContextGetterImpl::UpdateDelegateWhitelist() {
|
||||
io_state_->http_auth_preferences_->SetDelegateWhitelist(
|
||||
io_state_->http_auth_preferences_->set_delegate_whitelist(
|
||||
auth_negotiate_delegate_whitelist_.GetValue());
|
||||
}
|
||||
|
@@ -275,12 +275,12 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragEnter(
|
||||
DragTargetDragLeave();
|
||||
|
||||
const gfx::Point client_pt(event.x, event.y);
|
||||
gfx::PointF transformed_pt;
|
||||
gfx::Point transformed_pt;
|
||||
current_rwh_for_drag_ =
|
||||
web_contents->GetInputEventRouter()
|
||||
->GetRenderWidgetHostAtPoint(
|
||||
web_contents->GetRenderViewHost()->GetWidget()->GetView(),
|
||||
gfx::PointF(client_pt), &transformed_pt)
|
||||
client_pt, &transformed_pt)
|
||||
->GetWeakPtr();
|
||||
current_rvh_for_drag_ = web_contents->GetRenderViewHost();
|
||||
|
||||
@@ -304,8 +304,8 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragEnter(
|
||||
return;
|
||||
}
|
||||
|
||||
current_rwh_for_drag_->DragTargetDragEnter(
|
||||
*drop_data, transformed_pt, gfx::PointF(screen_pt), ops, modifiers);
|
||||
current_rwh_for_drag_->DragTargetDragEnter(*drop_data, transformed_pt,
|
||||
screen_pt, ops, modifiers);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateOsr::DragTargetDragOver(
|
||||
@@ -322,27 +322,27 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragOver(
|
||||
const gfx::Point client_pt(event.x, event.y);
|
||||
const gfx::Point& screen_pt = GetScreenPoint(client_pt);
|
||||
|
||||
gfx::PointF transformed_pt;
|
||||
gfx::Point transformed_pt;
|
||||
content::RenderWidgetHostImpl* target_rwh =
|
||||
web_contents->GetInputEventRouter()->GetRenderWidgetHostAtPoint(
|
||||
web_contents->GetRenderViewHost()->GetWidget()->GetView(),
|
||||
gfx::PointF(client_pt), &transformed_pt);
|
||||
web_contents->GetRenderViewHost()->GetWidget()->GetView(), client_pt,
|
||||
&transformed_pt);
|
||||
|
||||
if (target_rwh != current_rwh_for_drag_.get()) {
|
||||
if (current_rwh_for_drag_) {
|
||||
gfx::PointF transformed_leave_point(client_pt);
|
||||
gfx::PointF transformed_screen_point(screen_pt);
|
||||
gfx::Point transformed_leave_point = client_pt;
|
||||
gfx::Point transformed_screen_point = screen_pt;
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
web_contents->GetRenderWidgetHostView())
|
||||
->TransformPointToCoordSpaceForView(
|
||||
gfx::PointF(client_pt),
|
||||
client_pt,
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
current_rwh_for_drag_->GetView()),
|
||||
&transformed_leave_point);
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
web_contents->GetRenderWidgetHostView())
|
||||
->TransformPointToCoordSpaceForView(
|
||||
gfx::PointF(screen_pt),
|
||||
screen_pt,
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
current_rwh_for_drag_->GetView()),
|
||||
&transformed_screen_point);
|
||||
@@ -359,8 +359,7 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragOver(
|
||||
static_cast<blink::WebDragOperationsMask>(allowed_ops);
|
||||
int modifiers = TranslateModifiers(event.modifiers);
|
||||
|
||||
target_rwh->DragTargetDragOver(transformed_pt, gfx::PointF(screen_pt), ops,
|
||||
modifiers);
|
||||
target_rwh->DragTargetDragOver(transformed_pt, screen_pt, ops, modifiers);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateOsr::DragTargetDragLeave() {
|
||||
@@ -370,7 +369,7 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragLeave() {
|
||||
}
|
||||
|
||||
if (current_rwh_for_drag_) {
|
||||
current_rwh_for_drag_->DragTargetDragLeave(gfx::PointF(), gfx::PointF());
|
||||
current_rwh_for_drag_->DragTargetDragLeave(gfx::Point(), gfx::Point());
|
||||
current_rwh_for_drag_.reset();
|
||||
}
|
||||
|
||||
@@ -389,27 +388,27 @@ void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) {
|
||||
gfx::Point client_pt(event.x, event.y);
|
||||
const gfx::Point& screen_pt = GetScreenPoint(client_pt);
|
||||
|
||||
gfx::PointF transformed_pt;
|
||||
gfx::Point transformed_pt;
|
||||
content::RenderWidgetHostImpl* target_rwh =
|
||||
web_contents->GetInputEventRouter()->GetRenderWidgetHostAtPoint(
|
||||
web_contents->GetRenderViewHost()->GetWidget()->GetView(),
|
||||
gfx::PointF(client_pt), &transformed_pt);
|
||||
web_contents->GetRenderViewHost()->GetWidget()->GetView(), client_pt,
|
||||
&transformed_pt);
|
||||
|
||||
if (target_rwh != current_rwh_for_drag_.get()) {
|
||||
if (current_rwh_for_drag_) {
|
||||
gfx::PointF transformed_leave_point(client_pt);
|
||||
gfx::PointF transformed_screen_point(screen_pt);
|
||||
gfx::Point transformed_leave_point = client_pt;
|
||||
gfx::Point transformed_screen_point = screen_pt;
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
web_contents->GetRenderWidgetHostView())
|
||||
->TransformPointToCoordSpaceForView(
|
||||
gfx::PointF(client_pt),
|
||||
client_pt,
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
current_rwh_for_drag_->GetView()),
|
||||
&transformed_leave_point);
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
web_contents->GetRenderWidgetHostView())
|
||||
->TransformPointToCoordSpaceForView(
|
||||
gfx::PointF(screen_pt),
|
||||
screen_pt,
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
current_rwh_for_drag_->GetView()),
|
||||
&transformed_screen_point);
|
||||
@@ -429,8 +428,8 @@ void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) {
|
||||
content::DropData* drop_data = data_impl->drop_data();
|
||||
int modifiers = TranslateModifiers(event.modifiers);
|
||||
|
||||
target_rwh->DragTargetDrop(*drop_data, transformed_pt,
|
||||
gfx::PointF(screen_pt), modifiers);
|
||||
target_rwh->DragTargetDrop(*drop_data, transformed_pt, screen_pt,
|
||||
modifiers);
|
||||
}
|
||||
|
||||
drag_data_ = nullptr;
|
||||
@@ -496,20 +495,20 @@ void CefBrowserPlatformDelegateOsr::DragSourceEndedAt(
|
||||
|
||||
// |client_loc| and |screen_loc| are in the root coordinate space, for
|
||||
// non-root RenderWidgetHosts they need to be transformed.
|
||||
gfx::PointF transformed_point(client_loc);
|
||||
gfx::PointF transformed_screen_point(screen_loc);
|
||||
gfx::Point transformed_point = client_loc;
|
||||
gfx::Point transformed_screen_point = screen_loc;
|
||||
if (source_rwh && web_contents->GetRenderWidgetHostView()) {
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
web_contents->GetRenderWidgetHostView())
|
||||
->TransformPointToCoordSpaceForView(
|
||||
gfx::PointF(client_loc),
|
||||
client_loc,
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
source_rwh->GetView()),
|
||||
&transformed_point);
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
web_contents->GetRenderWidgetHostView())
|
||||
->TransformPointToCoordSpaceForView(
|
||||
gfx::PointF(screen_loc),
|
||||
screen_loc,
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
source_rwh->GetView()),
|
||||
&transformed_screen_point);
|
||||
|
@@ -21,7 +21,6 @@
|
||||
#include "components/viz/common/frame_sinks/copy_output_request.h"
|
||||
#include "components/viz/common/frame_sinks/delay_based_time_source.h"
|
||||
#include "components/viz/common/gl_helper.h"
|
||||
#include "components/viz/common/switches.h"
|
||||
#include "content/browser/bad_message.h"
|
||||
#include "content/browser/compositor/image_transport_factory.h"
|
||||
#include "content/browser/frame_host/render_widget_host_view_guest.h"
|
||||
@@ -239,8 +238,7 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||
#if !defined(OS_MACOSX)
|
||||
delegated_frame_host_ = base::MakeUnique<content::DelegatedFrameHost>(
|
||||
AllocateFrameSinkId(is_guest_view_hack), this,
|
||||
false /* enable_surface_synchronization */,
|
||||
base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableViz));
|
||||
false /* enable_surface_synchronization */);
|
||||
|
||||
root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
|
||||
#endif
|
||||
@@ -445,8 +443,7 @@ void CefRenderWidgetHostViewOSR::DidCreateNewRendererCompositorFrameSink(
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SubmitCompositorFrame(
|
||||
const viz::LocalSurfaceId& local_surface_id,
|
||||
viz::CompositorFrame frame,
|
||||
viz::mojom::HitTestRegionListPtr hit_test_region_list) {
|
||||
viz::CompositorFrame frame) {
|
||||
TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::OnSwapCompositorFrame");
|
||||
|
||||
if (frame.metadata.root_scroll_offset != last_scroll_offset_) {
|
||||
@@ -475,8 +472,8 @@ void CefRenderWidgetHostViewOSR::SubmitCompositorFrame(
|
||||
// We would normally call BrowserCompositorMac::SubmitCompositorFrame on
|
||||
// macOS, however it contains compositor resize logic that we don't want.
|
||||
// Consequently we instead call the SwapDelegatedFrame method directly.
|
||||
GetDelegatedFrameHost()->SubmitCompositorFrame(
|
||||
local_surface_id, std::move(frame), std::move(hit_test_region_list));
|
||||
GetDelegatedFrameHost()->SubmitCompositorFrame(local_surface_id,
|
||||
std::move(frame));
|
||||
} else {
|
||||
if (!copy_frame_generator_.get()) {
|
||||
copy_frame_generator_.reset(
|
||||
@@ -494,8 +491,8 @@ void CefRenderWidgetHostViewOSR::SubmitCompositorFrame(
|
||||
// We would normally call BrowserCompositorMac::SubmitCompositorFrame on
|
||||
// macOS, however it contains compositor resize logic that we don't want.
|
||||
// Consequently we instead call the SwapDelegatedFrame method directly.
|
||||
GetDelegatedFrameHost()->SubmitCompositorFrame(
|
||||
local_surface_id, std::move(frame), std::move(hit_test_region_list));
|
||||
GetDelegatedFrameHost()->SubmitCompositorFrame(local_surface_id,
|
||||
std::move(frame));
|
||||
|
||||
// Request a copy of the last compositor frame which will eventually call
|
||||
// OnPaint asynchronously.
|
||||
@@ -830,12 +827,12 @@ void CefRenderWidgetHostViewOSR::ProcessGestureEvent(
|
||||
}
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::TransformPointToLocalCoordSpace(
|
||||
const gfx::PointF& point,
|
||||
const gfx::Point& point,
|
||||
const viz::SurfaceId& original_surface,
|
||||
gfx::PointF* transformed_point) {
|
||||
gfx::Point* transformed_point) {
|
||||
// Transformations use physical pixels rather than DIP, so conversion
|
||||
// is necessary.
|
||||
gfx::PointF point_in_pixels =
|
||||
gfx::Point point_in_pixels =
|
||||
gfx::ConvertPointToPixel(current_device_scale_factor_, point);
|
||||
if (!GetDelegatedFrameHost()->TransformPointToLocalCoordSpace(
|
||||
point_in_pixels, original_surface, transformed_point)) {
|
||||
@@ -848,9 +845,9 @@ bool CefRenderWidgetHostViewOSR::TransformPointToLocalCoordSpace(
|
||||
}
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::TransformPointToCoordSpaceForView(
|
||||
const gfx::PointF& point,
|
||||
const gfx::Point& point,
|
||||
RenderWidgetHostViewBase* target_view,
|
||||
gfx::PointF* transformed_point) {
|
||||
gfx::Point* transformed_point) {
|
||||
if (target_view == this) {
|
||||
*transformed_point = point;
|
||||
return true;
|
||||
@@ -929,10 +926,6 @@ bool CefRenderWidgetHostViewOSR::IsAutoResizeEnabled() const {
|
||||
return render_widget_host_->auto_resize_enabled();
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::OnFrameTokenChanged(uint32_t frame_token) {
|
||||
render_widget_host_->DidProcessFrame(frame_token);
|
||||
}
|
||||
|
||||
std::unique_ptr<ui::CompositorLock>
|
||||
CefRenderWidgetHostViewOSR::GetCompositorLock(
|
||||
ui::CompositorLockClient* client) {
|
||||
@@ -1301,11 +1294,16 @@ void CefRenderWidgetHostViewOSR::SetDeviceScaleFactor() {
|
||||
|
||||
current_device_scale_factor_ = new_scale_factor;
|
||||
|
||||
if (render_widget_host_ && render_widget_host_->delegate())
|
||||
render_widget_host_->delegate()->UpdateDeviceScaleFactor(new_scale_factor);
|
||||
|
||||
// Notify the guest hosts if any.
|
||||
for (auto guest_host_view : guest_host_views_) {
|
||||
content::RenderWidgetHostImpl* rwhi = guest_host_view->render_widget_host();
|
||||
if (!rwhi)
|
||||
continue;
|
||||
if (rwhi->delegate())
|
||||
rwhi->delegate()->UpdateDeviceScaleFactor(new_scale_factor);
|
||||
if (rwhi->GetView())
|
||||
rwhi->GetView()->set_current_device_scale_factor(new_scale_factor);
|
||||
}
|
||||
|
@@ -86,7 +86,7 @@ class MacHelper;
|
||||
class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
public ui::CompositorDelegate
|
||||
#if !defined(OS_MACOSX)
|
||||
,
|
||||
,
|
||||
public content::DelegatedFrameHostClient,
|
||||
public content::CompositorResizeLockClient
|
||||
#endif
|
||||
@@ -132,10 +132,8 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
void DidCreateNewRendererCompositorFrameSink(
|
||||
viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink)
|
||||
override;
|
||||
void SubmitCompositorFrame(
|
||||
const viz::LocalSurfaceId& local_surface_id,
|
||||
viz::CompositorFrame frame,
|
||||
viz::mojom::HitTestRegionListPtr hit_test_region_list) override;
|
||||
void SubmitCompositorFrame(const viz::LocalSurfaceId& local_surface_id,
|
||||
viz::CompositorFrame frame) override;
|
||||
void ClearCompositorFrame() override;
|
||||
void InitAsPopup(content::RenderWidgetHostView* parent_host_view,
|
||||
const gfx::Rect& pos) override;
|
||||
@@ -190,13 +188,13 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
const ui::LatencyInfo& latency) override;
|
||||
void ProcessGestureEvent(const blink::WebGestureEvent& event,
|
||||
const ui::LatencyInfo& latency) override;
|
||||
bool TransformPointToLocalCoordSpace(const gfx::PointF& point,
|
||||
bool TransformPointToLocalCoordSpace(const gfx::Point& point,
|
||||
const viz::SurfaceId& original_surface,
|
||||
gfx::PointF* transformed_point) override;
|
||||
gfx::Point* transformed_point) override;
|
||||
bool TransformPointToCoordSpaceForView(
|
||||
const gfx::PointF& point,
|
||||
const gfx::Point& point,
|
||||
RenderWidgetHostViewBase* target_view,
|
||||
gfx::PointF* transformed_point) override;
|
||||
gfx::Point* transformed_point) override;
|
||||
|
||||
// ui::CompositorDelegate implementation.
|
||||
std::unique_ptr<viz::SoftwareOutputDevice> CreateSoftwareOutputDevice(
|
||||
@@ -214,7 +212,6 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
viz::LocalSurfaceId GetLocalSurfaceId() const override;
|
||||
void OnBeginFrame() override;
|
||||
bool IsAutoResizeEnabled() const override;
|
||||
void OnFrameTokenChanged(uint32_t frame_token) override;
|
||||
|
||||
// CompositorResizeLockClient implementation.
|
||||
std::unique_ptr<ui::CompositorLock> GetCompositorLock(
|
||||
|
@@ -65,10 +65,6 @@ class MacHelper : public content::BrowserCompositorMacClient,
|
||||
|
||||
void AcceleratedWidgetSwapCompleted() override {}
|
||||
|
||||
void OnFrameTokenChanged(uint32_t frame_token) override {
|
||||
view_->render_widget_host()->DidProcessFrame(frame_token);
|
||||
}
|
||||
|
||||
private:
|
||||
// Guaranteed to outlive this object.
|
||||
CefRenderWidgetHostViewOSR* view_;
|
||||
|
@@ -127,8 +127,6 @@ LPCWSTR ToCursorID(WebCursorInfo::Type type) {
|
||||
return MAKEINTRESOURCE(IDC_HAND_GRAB);
|
||||
case WebCursorInfo::kTypeGrabbing:
|
||||
return MAKEINTRESOURCE(IDC_HAND_GRABBING);
|
||||
case WebCursorInfo::kTypeCustom:
|
||||
break;
|
||||
}
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
|
@@ -63,8 +63,6 @@ void CefWebContentsViewOSR::StoreFocus() {}
|
||||
|
||||
void CefWebContentsViewOSR::RestoreFocus() {}
|
||||
|
||||
void CefWebContentsViewOSR::FocusThroughTabTraversal(bool reverse) {}
|
||||
|
||||
void CefWebContentsViewOSR::GotFocus(
|
||||
content::RenderWidgetHostImpl* render_widget_host) {
|
||||
if (web_contents_) {
|
||||
@@ -135,10 +133,9 @@ CefWebContentsViewOSR::CreateViewForPopupWidget(
|
||||
void CefWebContentsViewOSR::SetPageTitle(const base::string16& title) {}
|
||||
|
||||
void CefWebContentsViewOSR::RenderViewCreated(content::RenderViewHost* host) {
|
||||
if (!host)
|
||||
return;
|
||||
CefRenderWidgetHostViewOSR* view =
|
||||
static_cast<CefRenderWidgetHostViewOSR*>(host->GetWidget()->GetView());
|
||||
// |view| will be nullptr the first time this method is called for popup
|
||||
// browsers.
|
||||
CefRenderWidgetHostViewOSR* view = GetView();
|
||||
if (view)
|
||||
view->InstallTransparency();
|
||||
}
|
||||
|
@@ -40,7 +40,6 @@ class CefWebContentsViewOSR : public content::WebContentsView,
|
||||
void SetInitialFocus() override;
|
||||
void StoreFocus() override;
|
||||
void RestoreFocus() override;
|
||||
void FocusThroughTabTraversal(bool reverse) override;
|
||||
content::DropData* GetDropData() const override;
|
||||
gfx::Rect GetViewBounds() const override;
|
||||
void CreateView(const gfx::Size& initial_size,
|
||||
|
107
libcef/browser/pepper/browser_pepper_host_factory.cc
Normal file
107
libcef/browser/pepper/browser_pepper_host_factory.cc
Normal file
@@ -0,0 +1,107 @@
|
||||
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/pepper/browser_pepper_host_factory.h"
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/browser/renderer_host/pepper/pepper_broker_message_filter.h"
|
||||
#include "chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h"
|
||||
#include "chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.h"
|
||||
#include "chrome/browser/renderer_host/pepper/pepper_flash_drm_host.h"
|
||||
#include "chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h"
|
||||
#include "chrome/browser/renderer_host/pepper/pepper_output_protection_message_filter.h"
|
||||
#include "chrome/browser/renderer_host/pepper/pepper_platform_verification_message_filter.h"
|
||||
#include "content/public/browser/browser_ppapi_host.h"
|
||||
#include "ppapi/host/message_filter_host.h"
|
||||
#include "ppapi/host/ppapi_host.h"
|
||||
#include "ppapi/host/resource_host.h"
|
||||
#include "ppapi/proxy/ppapi_messages.h"
|
||||
#include "ppapi/shared_impl/ppapi_permissions.h"
|
||||
|
||||
using ppapi::host::MessageFilterHost;
|
||||
using ppapi::host::ResourceHost;
|
||||
using ppapi::host::ResourceMessageFilter;
|
||||
|
||||
CefBrowserPepperHostFactory::CefBrowserPepperHostFactory(
|
||||
content::BrowserPpapiHost* host)
|
||||
: host_(host) {}
|
||||
|
||||
CefBrowserPepperHostFactory::~CefBrowserPepperHostFactory() {}
|
||||
|
||||
std::unique_ptr<ResourceHost> CefBrowserPepperHostFactory::CreateResourceHost(
|
||||
ppapi::host::PpapiHost* host,
|
||||
PP_Resource resource,
|
||||
PP_Instance instance,
|
||||
const IPC::Message& message) {
|
||||
DCHECK(host == host_->GetPpapiHost());
|
||||
|
||||
// Make sure the plugin is giving us a valid instance for this resource.
|
||||
if (!host_->IsValidInstance(instance))
|
||||
return nullptr;
|
||||
|
||||
// Private interfaces.
|
||||
if (host_->GetPpapiHost()->permissions().HasPermission(
|
||||
ppapi::PERMISSION_PRIVATE)) {
|
||||
switch (message.type()) {
|
||||
case PpapiHostMsg_Broker_Create::ID: {
|
||||
scoped_refptr<ResourceMessageFilter> broker_filter(
|
||||
new chrome::PepperBrokerMessageFilter(instance, host_));
|
||||
return std::unique_ptr<ResourceHost>(new MessageFilterHost(
|
||||
host_->GetPpapiHost(), instance, resource, broker_filter));
|
||||
}
|
||||
case PpapiHostMsg_PlatformVerification_Create::ID: {
|
||||
scoped_refptr<ResourceMessageFilter> pv_filter(
|
||||
new chrome::PepperPlatformVerificationMessageFilter(host_,
|
||||
instance));
|
||||
return std::unique_ptr<ResourceHost>(new MessageFilterHost(
|
||||
host_->GetPpapiHost(), instance, resource, pv_filter));
|
||||
}
|
||||
case PpapiHostMsg_OutputProtection_Create::ID: {
|
||||
scoped_refptr<ResourceMessageFilter> output_protection_filter(
|
||||
new chrome::PepperOutputProtectionMessageFilter(host_, instance));
|
||||
return std::unique_ptr<ResourceHost>(
|
||||
new MessageFilterHost(host_->GetPpapiHost(), instance, resource,
|
||||
output_protection_filter));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Flash interfaces.
|
||||
if (host_->GetPpapiHost()->permissions().HasPermission(
|
||||
ppapi::PERMISSION_FLASH)) {
|
||||
switch (message.type()) {
|
||||
case PpapiHostMsg_Flash_Create::ID:
|
||||
return base::MakeUnique<chrome::PepperFlashBrowserHost>(host_, instance,
|
||||
resource);
|
||||
case PpapiHostMsg_FlashClipboard_Create::ID: {
|
||||
scoped_refptr<ResourceMessageFilter> clipboard_filter(
|
||||
new chrome::PepperFlashClipboardMessageFilter);
|
||||
return base::MakeUnique<MessageFilterHost>(
|
||||
host_->GetPpapiHost(), instance, resource, clipboard_filter);
|
||||
}
|
||||
case PpapiHostMsg_FlashDRM_Create::ID:
|
||||
return base::MakeUnique<chrome::PepperFlashDRMHost>(host_, instance,
|
||||
resource);
|
||||
}
|
||||
}
|
||||
|
||||
// Permissions for the following interfaces will be checked at the
|
||||
// time of the corresponding instance's methods calls (because
|
||||
// permission check can be performed only on the UI
|
||||
// thread). Currently these interfaces are available only for
|
||||
// whitelisted apps which may not have access to the other private
|
||||
// interfaces.
|
||||
if (message.type() == PpapiHostMsg_IsolatedFileSystem_Create::ID) {
|
||||
chrome::PepperIsolatedFileSystemMessageFilter* isolated_fs_filter =
|
||||
chrome::PepperIsolatedFileSystemMessageFilter::Create(instance, host_);
|
||||
if (!isolated_fs_filter)
|
||||
return nullptr;
|
||||
return base::MakeUnique<MessageFilterHost>(host, instance, resource,
|
||||
isolated_fs_filter);
|
||||
}
|
||||
|
||||
NOTREACHED() << "Unhandled message type: " << message.type();
|
||||
return nullptr;
|
||||
}
|
35
libcef/browser/pepper/browser_pepper_host_factory.h
Normal file
35
libcef/browser/pepper/browser_pepper_host_factory.h
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_PEPPER_BROWSER_PEPPER_HOST_FACTORY_H_
|
||||
#define CEF_LIBCEF_BROWSER_PEPPER_BROWSER_PEPPER_HOST_FACTORY_H_
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/macros.h"
|
||||
#include "ppapi/host/host_factory.h"
|
||||
|
||||
namespace content {
|
||||
class BrowserPpapiHost;
|
||||
} // namespace content
|
||||
|
||||
class CefBrowserPepperHostFactory : public ppapi::host::HostFactory {
|
||||
public:
|
||||
// Non-owning pointer to the filter must outlive this class.
|
||||
explicit CefBrowserPepperHostFactory(content::BrowserPpapiHost* host);
|
||||
~CefBrowserPepperHostFactory() override;
|
||||
|
||||
std::unique_ptr<ppapi::host::ResourceHost> CreateResourceHost(
|
||||
ppapi::host::PpapiHost* host,
|
||||
PP_Resource resource,
|
||||
PP_Instance instance,
|
||||
const IPC::Message& message) override;
|
||||
|
||||
private:
|
||||
// Non-owning pointer.
|
||||
content::BrowserPpapiHost* host_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserPepperHostFactory);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_PEPPER_BROWSER_PEPPER_HOST_FACTORY_H_
|
@@ -10,13 +10,11 @@ using content::PermissionType;
|
||||
|
||||
namespace permission_util {
|
||||
|
||||
// Copied from chrome/browser/permissions/permission_manager.cc.
|
||||
ContentSettingsType PermissionTypeToContentSetting(PermissionType permission) {
|
||||
switch (permission) {
|
||||
case PermissionType::MIDI:
|
||||
return CONTENT_SETTINGS_TYPE_MIDI;
|
||||
case PermissionType::MIDI_SYSEX:
|
||||
return CONTENT_SETTINGS_TYPE_MIDI_SYSEX;
|
||||
case PermissionType::PUSH_MESSAGING:
|
||||
case PermissionType::NOTIFICATIONS:
|
||||
return CONTENT_SETTINGS_TYPE_NOTIFICATIONS;
|
||||
case PermissionType::GEOLOCATION:
|
||||
@@ -30,6 +28,9 @@ ContentSettingsType PermissionTypeToContentSetting(PermissionType permission) {
|
||||
#endif
|
||||
case PermissionType::DURABLE_STORAGE:
|
||||
return CONTENT_SETTINGS_TYPE_DURABLE_STORAGE;
|
||||
case PermissionType::MIDI:
|
||||
// This will hit the NOTREACHED below.
|
||||
break;
|
||||
case PermissionType::AUDIO_CAPTURE:
|
||||
return CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC;
|
||||
case PermissionType::VIDEO_CAPTURE:
|
||||
@@ -42,10 +43,6 @@ ContentSettingsType PermissionTypeToContentSetting(PermissionType permission) {
|
||||
return CONTENT_SETTINGS_TYPE_SENSORS;
|
||||
case PermissionType::ACCESSIBILITY_EVENTS:
|
||||
return CONTENT_SETTINGS_TYPE_ACCESSIBILITY_EVENTS;
|
||||
case PermissionType::CLIPBOARD_READ:
|
||||
return CONTENT_SETTINGS_TYPE_CLIPBOARD_READ;
|
||||
case PermissionType::CLIPBOARD_WRITE:
|
||||
return CONTENT_SETTINGS_TYPE_CLIPBOARD_WRITE;
|
||||
case PermissionType::NUM:
|
||||
// This will hit the NOTREACHED below.
|
||||
break;
|
||||
|
514
libcef/browser/plugins/plugin_info_message_filter.cc
Normal file
514
libcef/browser/plugins/plugin_info_message_filter.cc
Normal file
@@ -0,0 +1,514 @@
|
||||
// Copyright 2015 The Chromium Embedded Framework Authors.
|
||||
// Portions copyright 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/plugins/plugin_info_message_filter.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/plugins/plugin_service_filter.h"
|
||||
#include "libcef/browser/web_plugin_impl.h"
|
||||
#include "libcef/common/cef_messages.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/metrics/histogram_macros.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/threading/thread_task_runner_handle.h"
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/browser/plugins/plugin_finder.h"
|
||||
#include "chrome/browser/plugins/plugins_field_trial.h"
|
||||
#include "chrome/common/features.h"
|
||||
#include "chrome/common/pref_names.h"
|
||||
#include "components/content_settings/core/common/content_settings_utils.h"
|
||||
#include "components/keyed_service/content/browser_context_keyed_service_shutdown_notifier_factory.h"
|
||||
#include "components/nacl/common/features.h"
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/plugin_service.h"
|
||||
#include "content/public/browser/plugin_service_filter.h"
|
||||
#include "content/public/common/content_constants.h"
|
||||
#include "content/public/common/webplugininfo.h"
|
||||
#include "extensions/browser/extension_registry.h"
|
||||
#include "extensions/browser/guest_view/web_view/web_view_renderer_state.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "extensions/common/extension.h"
|
||||
#include "extensions/common/manifest_handlers/webview_info.h"
|
||||
#include "url/gurl.h"
|
||||
#include "url/origin.h"
|
||||
|
||||
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
|
||||
|
||||
#if BUILDFLAG(ENABLE_NACL)
|
||||
#include "components/nacl/common/nacl_constants.h"
|
||||
#endif
|
||||
|
||||
using content::PluginService;
|
||||
using content::WebPluginInfo;
|
||||
|
||||
namespace {
|
||||
|
||||
// There's a race condition between deletion of the CefPluginInfoMessageFilter
|
||||
// object on the UI thread and deletion of the PrefService (owned by Profile)
|
||||
// on the UI thread. If the PrefService will be deleted first then
|
||||
// PrefMember::Destroy() must be called from ShutdownOnUIThread() to avoid
|
||||
// heap-use-after-free on CefPluginInfoMessageFilter destruction (due to
|
||||
// ~PrefMember trying to access the already-deleted PrefService).
|
||||
// ShutdownNotifierFactory makes sure that ShutdownOnUIThread() is called in
|
||||
// this case.
|
||||
class ShutdownNotifierFactory
|
||||
: public BrowserContextKeyedServiceShutdownNotifierFactory {
|
||||
public:
|
||||
static ShutdownNotifierFactory* GetInstance();
|
||||
|
||||
private:
|
||||
friend struct base::LazyInstanceTraitsBase<ShutdownNotifierFactory>;
|
||||
|
||||
ShutdownNotifierFactory()
|
||||
: BrowserContextKeyedServiceShutdownNotifierFactory(
|
||||
"CefPluginInfoMessageFilter") {}
|
||||
~ShutdownNotifierFactory() override {}
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ShutdownNotifierFactory);
|
||||
};
|
||||
|
||||
base::LazyInstance<ShutdownNotifierFactory>::Leaky g_shutdown_notifier_factory =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// static
|
||||
ShutdownNotifierFactory* ShutdownNotifierFactory::GetInstance() {
|
||||
return g_shutdown_notifier_factory.Pointer();
|
||||
}
|
||||
|
||||
// For certain sandboxed Pepper plugins, use the JavaScript Content Settings.
|
||||
bool ShouldUseJavaScriptSettingForPlugin(const WebPluginInfo& plugin) {
|
||||
if (plugin.type != WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS &&
|
||||
plugin.type != WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_NACL)
|
||||
// Treat Native Client invocations like JavaScript.
|
||||
if (plugin.name == base::ASCIIToUTF16(nacl::kNaClPluginName))
|
||||
return true;
|
||||
#endif
|
||||
|
||||
#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
// Treat CDM invocations like JavaScript.
|
||||
if (plugin.name == base::ASCIIToUTF16(kWidevineCdmDisplayName)) {
|
||||
DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS);
|
||||
return true;
|
||||
}
|
||||
#endif // defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
|
||||
enum PluginAvailabilityStatusForUMA {
|
||||
PLUGIN_NOT_REGISTERED,
|
||||
PLUGIN_AVAILABLE,
|
||||
PLUGIN_DISABLED,
|
||||
PLUGIN_AVAILABILITY_STATUS_MAX
|
||||
};
|
||||
|
||||
static void SendPluginAvailabilityUMA(const std::string& mime_type,
|
||||
PluginAvailabilityStatusForUMA status) {
|
||||
#if defined(WIDEVINE_CDM_AVAILABLE)
|
||||
// Only report results for Widevine CDM.
|
||||
if (mime_type != kWidevineCdmPluginMimeType)
|
||||
return;
|
||||
|
||||
UMA_HISTOGRAM_ENUMERATION("Plugin.AvailabilityStatus.WidevineCdm", status,
|
||||
PLUGIN_AVAILABILITY_STATUS_MAX);
|
||||
#endif // defined(WIDEVINE_CDM_AVAILABLE)
|
||||
}
|
||||
|
||||
#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
|
||||
void ReportMetrics(const std::string& mime_type,
|
||||
const GURL& url,
|
||||
const url::Origin& main_frame_origin) {}
|
||||
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
// Returns whether a request from a plugin to load |resource| from a renderer
|
||||
// with process id |process_id| is a request for an internal resource by an app
|
||||
// listed in |accessible_resources| in its manifest.
|
||||
bool IsPluginLoadingAccessibleResourceInWebView(
|
||||
extensions::ExtensionRegistry* extension_registry,
|
||||
int process_id,
|
||||
const GURL& resource) {
|
||||
extensions::WebViewRendererState* renderer_state =
|
||||
extensions::WebViewRendererState::GetInstance();
|
||||
std::string partition_id;
|
||||
if (!renderer_state->IsGuest(process_id) ||
|
||||
!renderer_state->GetPartitionID(process_id, &partition_id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::string extension_id = resource.host();
|
||||
const extensions::Extension* extension = extension_registry->GetExtensionById(
|
||||
extension_id, extensions::ExtensionRegistry::ENABLED);
|
||||
if (!extension || !extensions::WebviewInfo::IsResourceWebviewAccessible(
|
||||
extension, partition_id, resource.path())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make sure the renderer making the request actually belongs to the
|
||||
// same extension.
|
||||
std::string owner_extension;
|
||||
return renderer_state->GetOwnerInfo(process_id, nullptr, &owner_extension) &&
|
||||
owner_extension == extension_id;
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
|
||||
} // namespace
|
||||
|
||||
CefPluginInfoMessageFilter::Context::Context(int render_process_id,
|
||||
CefBrowserContext* profile)
|
||||
: render_process_id_(render_process_id),
|
||||
resource_context_(
|
||||
static_cast<CefResourceContext*>(profile->GetResourceContext())),
|
||||
host_content_settings_map_(profile->GetHostContentSettingsMap()) {
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
if (extensions::ExtensionsEnabled())
|
||||
extension_registry_ = extensions::ExtensionRegistry::Get(profile);
|
||||
#endif
|
||||
|
||||
allow_outdated_plugins_.Init(prefs::kPluginsAllowOutdated,
|
||||
profile->GetPrefs());
|
||||
allow_outdated_plugins_.MoveToThread(
|
||||
content::BrowserThread::GetTaskRunnerForThread(
|
||||
content::BrowserThread::IO));
|
||||
always_authorize_plugins_.Init(prefs::kPluginsAlwaysAuthorize,
|
||||
profile->GetPrefs());
|
||||
always_authorize_plugins_.MoveToThread(
|
||||
content::BrowserThread::GetTaskRunnerForThread(
|
||||
content::BrowserThread::IO));
|
||||
}
|
||||
|
||||
CefPluginInfoMessageFilter::Context::~Context() {}
|
||||
|
||||
void CefPluginInfoMessageFilter::Context::ShutdownOnUIThread() {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
always_authorize_plugins_.Destroy();
|
||||
allow_outdated_plugins_.Destroy();
|
||||
}
|
||||
|
||||
CefPluginInfoMessageFilter::CefPluginInfoMessageFilter(
|
||||
int render_process_id,
|
||||
CefBrowserContext* profile)
|
||||
: BrowserMessageFilter(ExtensionMsgStart),
|
||||
context_(render_process_id, profile),
|
||||
main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
|
||||
weak_ptr_factory_(this) {
|
||||
shutdown_notifier_ =
|
||||
ShutdownNotifierFactory::GetInstance()->Get(profile)->Subscribe(
|
||||
base::Bind(&CefPluginInfoMessageFilter::ShutdownOnUIThread,
|
||||
base::Unretained(this)));
|
||||
}
|
||||
|
||||
void CefPluginInfoMessageFilter::ShutdownOnUIThread() {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
context_.ShutdownOnUIThread();
|
||||
shutdown_notifier_.reset();
|
||||
}
|
||||
|
||||
bool CefPluginInfoMessageFilter::OnMessageReceived(
|
||||
const IPC::Message& message) {
|
||||
IPC_BEGIN_MESSAGE_MAP(CefPluginInfoMessageFilter, message)
|
||||
IPC_MESSAGE_HANDLER_DELAY_REPLY(CefViewHostMsg_GetPluginInfo,
|
||||
OnGetPluginInfo)
|
||||
#if BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
IPC_MESSAGE_HANDLER(CefViewHostMsg_IsInternalPluginAvailableForMimeType,
|
||||
OnIsInternalPluginAvailableForMimeType)
|
||||
#endif
|
||||
IPC_MESSAGE_UNHANDLED(return false)
|
||||
IPC_END_MESSAGE_MAP()
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefPluginInfoMessageFilter::OnDestruct() const {
|
||||
const_cast<CefPluginInfoMessageFilter*>(this)
|
||||
->weak_ptr_factory_.InvalidateWeakPtrs();
|
||||
|
||||
// Destroy on the UI thread because we contain a |PrefMember|.
|
||||
content::BrowserThread::DeleteOnUIThread::Destruct(this);
|
||||
}
|
||||
|
||||
CefPluginInfoMessageFilter::~CefPluginInfoMessageFilter() {}
|
||||
|
||||
struct CefPluginInfoMessageFilter::GetPluginInfo_Params {
|
||||
int render_frame_id;
|
||||
GURL url;
|
||||
bool is_main_frame;
|
||||
url::Origin main_frame_origin;
|
||||
std::string mime_type;
|
||||
};
|
||||
|
||||
void CefPluginInfoMessageFilter::OnGetPluginInfo(
|
||||
int render_frame_id,
|
||||
const GURL& url,
|
||||
bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
const std::string& mime_type,
|
||||
IPC::Message* reply_msg) {
|
||||
GetPluginInfo_Params params = {render_frame_id, url, is_main_frame,
|
||||
main_frame_origin, mime_type};
|
||||
PluginService::GetInstance()->GetPlugins(
|
||||
base::Bind(&CefPluginInfoMessageFilter::PluginsLoaded,
|
||||
weak_ptr_factory_.GetWeakPtr(), params, reply_msg));
|
||||
}
|
||||
|
||||
void CefPluginInfoMessageFilter::PluginsLoaded(
|
||||
const GetPluginInfo_Params& params,
|
||||
IPC::Message* reply_msg,
|
||||
const std::vector<WebPluginInfo>& plugins) {
|
||||
CefViewHostMsg_GetPluginInfo_Output output;
|
||||
|
||||
// This also fills in |actual_mime_type|.
|
||||
std::unique_ptr<PluginMetadata> plugin_metadata;
|
||||
context_.FindEnabledPlugin(params, &output.status, &output.plugin,
|
||||
&output.actual_mime_type, &plugin_metadata);
|
||||
|
||||
if (plugin_metadata) {
|
||||
output.group_identifier = plugin_metadata->identifier();
|
||||
output.group_name = plugin_metadata->name();
|
||||
}
|
||||
|
||||
CefViewHostMsg_GetPluginInfo::WriteReplyParams(reply_msg, output);
|
||||
Send(reply_msg);
|
||||
if (output.status != CefViewHostMsg_GetPluginInfo_Status::kNotFound) {
|
||||
main_thread_task_runner_->PostTask(
|
||||
FROM_HERE, base::Bind(&ReportMetrics, output.actual_mime_type,
|
||||
params.url, params.main_frame_origin));
|
||||
}
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
|
||||
void CefPluginInfoMessageFilter::OnIsInternalPluginAvailableForMimeType(
|
||||
const std::string& mime_type,
|
||||
bool* is_available,
|
||||
std::vector<base::string16>* additional_param_names,
|
||||
std::vector<base::string16>* additional_param_values) {
|
||||
std::vector<WebPluginInfo> plugins;
|
||||
PluginService::GetInstance()->GetInternalPlugins(&plugins);
|
||||
|
||||
bool is_plugin_disabled = false;
|
||||
for (size_t i = 0; i < plugins.size(); ++i) {
|
||||
const WebPluginInfo& plugin = plugins[i];
|
||||
const std::vector<content::WebPluginMimeType>& mime_types =
|
||||
plugin.mime_types;
|
||||
for (size_t j = 0; j < mime_types.size(); ++j) {
|
||||
if (mime_types[j].mime_type == mime_type) {
|
||||
if (!context_.IsPluginEnabled(plugin)) {
|
||||
is_plugin_disabled = true;
|
||||
break;
|
||||
}
|
||||
|
||||
*is_available = true;
|
||||
*additional_param_names = mime_types[j].additional_param_names;
|
||||
*additional_param_values = mime_types[j].additional_param_values;
|
||||
SendPluginAvailabilityUMA(mime_type, PLUGIN_AVAILABLE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*is_available = false;
|
||||
SendPluginAvailabilityUMA(
|
||||
mime_type, is_plugin_disabled ? PLUGIN_DISABLED : PLUGIN_NOT_REGISTERED);
|
||||
}
|
||||
|
||||
#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
|
||||
void CefPluginInfoMessageFilter::Context::DecidePluginStatus(
|
||||
const GetPluginInfo_Params& params,
|
||||
const WebPluginInfo& plugin,
|
||||
const PluginMetadata* plugin_metadata,
|
||||
CefViewHostMsg_GetPluginInfo_Status* status) const {
|
||||
PluginMetadata::SecurityStatus plugin_status =
|
||||
plugin_metadata->GetSecurityStatus(plugin);
|
||||
|
||||
if (plugin_status == PluginMetadata::SECURITY_STATUS_FULLY_TRUSTED) {
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kAllowed;
|
||||
return;
|
||||
}
|
||||
|
||||
ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT;
|
||||
bool uses_default_content_setting = true;
|
||||
bool is_managed = false;
|
||||
// Check plugin content settings. The primary URL is the top origin URL and
|
||||
// the secondary URL is the plugin URL.
|
||||
GetPluginContentSetting(plugin, params.main_frame_origin.GetURL(), params.url,
|
||||
plugin_metadata->identifier(), &plugin_setting,
|
||||
&uses_default_content_setting, &is_managed);
|
||||
|
||||
// TODO(tommycli): Remove once we deprecate the plugin ASK policy.
|
||||
bool legacy_ask_user = plugin_setting == CONTENT_SETTING_ASK;
|
||||
plugin_setting = PluginsFieldTrial::EffectiveContentSetting(
|
||||
host_content_settings_map_, CONTENT_SETTINGS_TYPE_PLUGINS,
|
||||
plugin_setting);
|
||||
|
||||
DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT);
|
||||
DCHECK(plugin_setting != CONTENT_SETTING_ASK);
|
||||
|
||||
// Check if the plugin is crashing too much.
|
||||
if (PluginService::GetInstance()->IsPluginUnstable(plugin.path) &&
|
||||
!always_authorize_plugins_.GetValue() &&
|
||||
plugin_setting != CONTENT_SETTING_BLOCK && uses_default_content_setting) {
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kUnauthorized;
|
||||
return;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
// If an app has explicitly made internal resources available by listing them
|
||||
// in |accessible_resources| in the manifest, then allow them to be loaded by
|
||||
// plugins inside a guest-view.
|
||||
if (extensions::ExtensionsEnabled() &&
|
||||
params.url.SchemeIs(extensions::kExtensionScheme) && !is_managed &&
|
||||
plugin_setting == CONTENT_SETTING_BLOCK &&
|
||||
IsPluginLoadingAccessibleResourceInWebView(
|
||||
extension_registry_, render_process_id_, params.url)) {
|
||||
plugin_setting = CONTENT_SETTING_ALLOW;
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
|
||||
if (plugin_setting == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT) {
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kPlayImportantContent;
|
||||
} else if (plugin_setting == CONTENT_SETTING_BLOCK) {
|
||||
// For managed users with the ASK policy, we allow manually running plugins
|
||||
// via context menu. This is the closest to admin intent.
|
||||
*status = is_managed && !legacy_ask_user
|
||||
? CefViewHostMsg_GetPluginInfo_Status::kBlockedByPolicy
|
||||
: CefViewHostMsg_GetPluginInfo_Status::kBlocked;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
// Allow an embedder of <webview> to block a plugin from being loaded inside
|
||||
// the guest. In order to do this, set the status to 'Unauthorized' here,
|
||||
// and update the status as appropriate depending on the response from the
|
||||
// embedder.
|
||||
if (*status == CefViewHostMsg_GetPluginInfo_Status::kAllowed ||
|
||||
*status == CefViewHostMsg_GetPluginInfo_Status::kBlocked ||
|
||||
*status == CefViewHostMsg_GetPluginInfo_Status::kPlayImportantContent) {
|
||||
if (extensions::WebViewRendererState::GetInstance()->IsGuest(
|
||||
render_process_id_)) {
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kUnauthorized;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CefPluginInfoMessageFilter::Context::FindEnabledPlugin(
|
||||
const GetPluginInfo_Params& params,
|
||||
CefViewHostMsg_GetPluginInfo_Status* status,
|
||||
WebPluginInfo* plugin,
|
||||
std::string* actual_mime_type,
|
||||
std::unique_ptr<PluginMetadata>* plugin_metadata) const {
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kAllowed;
|
||||
|
||||
bool allow_wildcard = true;
|
||||
std::vector<WebPluginInfo> matching_plugins;
|
||||
std::vector<std::string> mime_types;
|
||||
PluginService::GetInstance()->GetPluginInfoArray(
|
||||
params.url, params.mime_type, allow_wildcard, &matching_plugins,
|
||||
&mime_types);
|
||||
if (matching_plugins.empty()) {
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kNotFound;
|
||||
return false;
|
||||
}
|
||||
|
||||
CefPluginServiceFilter* filter = static_cast<CefPluginServiceFilter*>(
|
||||
PluginService::GetInstance()->GetFilter());
|
||||
DCHECK(filter);
|
||||
|
||||
CefViewHostMsg_GetPluginInfo_Status first_status = *status;
|
||||
|
||||
size_t i = 0;
|
||||
for (; i < matching_plugins.size(); ++i) {
|
||||
*plugin = matching_plugins[i];
|
||||
*actual_mime_type = mime_types[i];
|
||||
*plugin_metadata = PluginFinder::GetInstance()->GetPluginMetadata(*plugin);
|
||||
|
||||
DecidePluginStatus(params, *plugin, (*plugin_metadata).get(), status);
|
||||
if (filter->IsPluginAvailable(render_process_id_, resource_context_,
|
||||
params.url, params.is_main_frame,
|
||||
params.main_frame_origin, plugin, status)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == 0)
|
||||
first_status = *status;
|
||||
}
|
||||
|
||||
// If we broke out of the loop, we have found an enabled plugin.
|
||||
bool enabled = i < matching_plugins.size();
|
||||
if (!enabled) {
|
||||
// Otherwise, we only found disabled/not-found plugins, so we take the first
|
||||
// one.
|
||||
*plugin = matching_plugins[0];
|
||||
*actual_mime_type = mime_types[0];
|
||||
*plugin_metadata = PluginFinder::GetInstance()->GetPluginMetadata(*plugin);
|
||||
*status = first_status;
|
||||
}
|
||||
|
||||
return enabled;
|
||||
}
|
||||
|
||||
void CefPluginInfoMessageFilter::Context::GetPluginContentSetting(
|
||||
const WebPluginInfo& plugin,
|
||||
const GURL& policy_url,
|
||||
const GURL& plugin_url,
|
||||
const std::string& resource,
|
||||
ContentSetting* setting,
|
||||
bool* uses_default_content_setting,
|
||||
bool* is_managed) const {
|
||||
std::unique_ptr<base::Value> value;
|
||||
content_settings::SettingInfo info;
|
||||
bool uses_plugin_specific_setting = false;
|
||||
if (ShouldUseJavaScriptSettingForPlugin(plugin)) {
|
||||
value = host_content_settings_map_->GetWebsiteSetting(
|
||||
policy_url, policy_url, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string(),
|
||||
&info);
|
||||
} else {
|
||||
content_settings::SettingInfo specific_info;
|
||||
std::unique_ptr<base::Value> specific_setting =
|
||||
host_content_settings_map_->GetWebsiteSetting(
|
||||
policy_url, plugin_url, CONTENT_SETTINGS_TYPE_PLUGINS, resource,
|
||||
&specific_info);
|
||||
content_settings::SettingInfo general_info;
|
||||
std::unique_ptr<base::Value> general_setting =
|
||||
host_content_settings_map_->GetWebsiteSetting(
|
||||
policy_url, plugin_url, CONTENT_SETTINGS_TYPE_PLUGINS,
|
||||
std::string(), &general_info);
|
||||
|
||||
// If there is a plugin-specific setting, we use it, unless the general
|
||||
// setting was set by policy, in which case it takes precedence.
|
||||
uses_plugin_specific_setting =
|
||||
specific_setting &&
|
||||
general_info.source != content_settings::SETTING_SOURCE_POLICY;
|
||||
if (uses_plugin_specific_setting) {
|
||||
value = std::move(specific_setting);
|
||||
info = specific_info;
|
||||
} else {
|
||||
value = std::move(general_setting);
|
||||
info = general_info;
|
||||
}
|
||||
}
|
||||
*setting = content_settings::ValueToContentSetting(value.get());
|
||||
*uses_default_content_setting =
|
||||
!uses_plugin_specific_setting &&
|
||||
info.primary_pattern == ContentSettingsPattern::Wildcard() &&
|
||||
info.secondary_pattern == ContentSettingsPattern::Wildcard();
|
||||
*is_managed = info.source == content_settings::SETTING_SOURCE_POLICY;
|
||||
}
|
||||
|
||||
bool CefPluginInfoMessageFilter::Context::IsPluginEnabled(
|
||||
const content::WebPluginInfo& plugin) const {
|
||||
return true;
|
||||
}
|
139
libcef/browser/plugins/plugin_info_message_filter.h
Normal file
139
libcef/browser/plugins/plugin_info_message_filter.h
Normal file
@@ -0,0 +1,139 @@
|
||||
// Copyright 2015 The Chromium Embedded Framework Authors.
|
||||
// Portions copyright 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_PLUGINS_PLUGIN_INFO_MESSAGE_FILTER_H_
|
||||
#define CEF_LIBCEF_BROWSER_PLUGINS_PLUGIN_INFO_MESSAGE_FILTER_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/sequenced_task_runner_helpers.h"
|
||||
#include "chrome/browser/plugins/plugin_metadata.h"
|
||||
#include "components/content_settings/core/browser/host_content_settings_map.h"
|
||||
#include "components/content_settings/core/common/content_settings.h"
|
||||
#include "components/keyed_service/core/keyed_service_shutdown_notifier.h"
|
||||
#include "components/prefs/pref_member.h"
|
||||
#include "content/public/browser/browser_message_filter.h"
|
||||
#include "extensions/features/features.h"
|
||||
#include "media/media_features.h"
|
||||
|
||||
class CefBrowserContext;
|
||||
class CefResourceContext;
|
||||
struct CefViewHostMsg_GetPluginInfo_Output;
|
||||
enum class CefViewHostMsg_GetPluginInfo_Status;
|
||||
class GURL;
|
||||
|
||||
namespace content {
|
||||
struct WebPluginInfo;
|
||||
}
|
||||
|
||||
namespace extensions {
|
||||
class ExtensionRegistry;
|
||||
}
|
||||
|
||||
namespace url {
|
||||
class Origin;
|
||||
}
|
||||
|
||||
// This class filters out incoming IPC messages requesting plugin information.
|
||||
class CefPluginInfoMessageFilter : public content::BrowserMessageFilter {
|
||||
public:
|
||||
struct GetPluginInfo_Params;
|
||||
|
||||
// Contains all the information needed by the CefPluginInfoMessageFilter.
|
||||
class Context {
|
||||
public:
|
||||
Context(int render_process_id, CefBrowserContext* profile);
|
||||
|
||||
~Context();
|
||||
void ShutdownOnUIThread();
|
||||
|
||||
void DecidePluginStatus(const GetPluginInfo_Params& params,
|
||||
const content::WebPluginInfo& plugin,
|
||||
const PluginMetadata* plugin_metadata,
|
||||
CefViewHostMsg_GetPluginInfo_Status* status) const;
|
||||
bool FindEnabledPlugin(
|
||||
const GetPluginInfo_Params& params,
|
||||
CefViewHostMsg_GetPluginInfo_Status* status,
|
||||
content::WebPluginInfo* plugin,
|
||||
std::string* actual_mime_type,
|
||||
std::unique_ptr<PluginMetadata>* plugin_metadata) const;
|
||||
void GetPluginContentSetting(const content::WebPluginInfo& plugin,
|
||||
const GURL& policy_url,
|
||||
const GURL& plugin_url,
|
||||
const std::string& resource,
|
||||
ContentSetting* setting,
|
||||
bool* is_default,
|
||||
bool* is_managed) const;
|
||||
bool IsPluginEnabled(const content::WebPluginInfo& plugin) const;
|
||||
|
||||
private:
|
||||
int render_process_id_;
|
||||
CefResourceContext* resource_context_;
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
extensions::ExtensionRegistry* extension_registry_;
|
||||
#endif
|
||||
const HostContentSettingsMap* host_content_settings_map_;
|
||||
|
||||
BooleanPrefMember allow_outdated_plugins_;
|
||||
BooleanPrefMember always_authorize_plugins_;
|
||||
};
|
||||
|
||||
CefPluginInfoMessageFilter(int render_process_id, CefBrowserContext* profile);
|
||||
|
||||
// content::BrowserMessageFilter methods:
|
||||
bool OnMessageReceived(const IPC::Message& message) override;
|
||||
void OnDestruct() const override;
|
||||
|
||||
private:
|
||||
friend struct content::BrowserThread::DeleteOnThread<
|
||||
content::BrowserThread::UI>;
|
||||
friend class base::DeleteHelper<CefPluginInfoMessageFilter>;
|
||||
|
||||
void ShutdownOnUIThread();
|
||||
~CefPluginInfoMessageFilter() override;
|
||||
|
||||
void OnGetPluginInfo(int render_frame_id,
|
||||
const GURL& url,
|
||||
bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
const std::string& mime_type,
|
||||
IPC::Message* reply_msg);
|
||||
|
||||
// |params| wraps the parameters passed to |OnGetPluginInfo|, because
|
||||
// |base::Bind| doesn't support the required arity <http://crbug.com/98542>.
|
||||
void PluginsLoaded(const GetPluginInfo_Params& params,
|
||||
IPC::Message* reply_msg,
|
||||
const std::vector<content::WebPluginInfo>& plugins);
|
||||
|
||||
#if BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
// Returns whether any internal plugin supporting |mime_type| is registered
|
||||
// and enabled. Does not determine whether the plugin can actually be
|
||||
// instantiated (e.g. whether it has all its dependencies).
|
||||
// When the returned *|is_available| is true, |additional_param_names| and
|
||||
// |additional_param_values| contain the name-value pairs, if any, specified
|
||||
// for the *first* non-disabled plugin found that is registered for
|
||||
// |mime_type|.
|
||||
void OnIsInternalPluginAvailableForMimeType(
|
||||
const std::string& mime_type,
|
||||
bool* is_available,
|
||||
std::vector<base::string16>* additional_param_names,
|
||||
std::vector<base::string16>* additional_param_values);
|
||||
#endif
|
||||
|
||||
Context context_;
|
||||
std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
|
||||
shutdown_notifier_;
|
||||
|
||||
scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
|
||||
base::WeakPtrFactory<CefPluginInfoMessageFilter> weak_ptr_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefPluginInfoMessageFilter);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_PLUGINS_PLUGIN_INFO_MESSAGE_FILTER_H_
|
@@ -9,6 +9,7 @@
|
||||
#include "libcef/browser/resource_context.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/browser/web_plugin_impl.h"
|
||||
#include "libcef/common/cef_messages.h"
|
||||
#include "libcef/common/content_client.h"
|
||||
|
||||
#include "extensions/common/constants.h"
|
||||
@@ -29,7 +30,8 @@ bool CefPluginServiceFilter::IsPluginAvailable(
|
||||
|
||||
CefResourceContext* resource_context = const_cast<CefResourceContext*>(
|
||||
reinterpret_cast<const CefResourceContext*>(context));
|
||||
chrome::mojom::PluginStatus status = chrome::mojom::PluginStatus::kAllowed;
|
||||
CefViewHostMsg_GetPluginInfo_Status status =
|
||||
CefViewHostMsg_GetPluginInfo_Status::kAllowed;
|
||||
|
||||
// Perform origin check here because we're passing an empty origin value to
|
||||
// IsPluginAvailable() below.
|
||||
@@ -52,8 +54,8 @@ bool CefPluginServiceFilter::IsPluginAvailable(
|
||||
// retrieve the actual load decision with a non-empty origin. That will
|
||||
// determine whether the plugin load is allowed or the plugin placeholder is
|
||||
// displayed.
|
||||
return IsPluginAvailable(render_process_id, render_frame_id, resource_context,
|
||||
url, is_main_frame, url::Origin(), plugin, &status);
|
||||
return IsPluginAvailable(render_process_id, resource_context, url,
|
||||
is_main_frame, url::Origin(), plugin, &status);
|
||||
}
|
||||
|
||||
bool CefPluginServiceFilter::CanLoadPlugin(int render_process_id,
|
||||
@@ -63,24 +65,21 @@ bool CefPluginServiceFilter::CanLoadPlugin(int render_process_id,
|
||||
|
||||
bool CefPluginServiceFilter::IsPluginAvailable(
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
content::ResourceContext* content_resource_context,
|
||||
CefResourceContext* resource_context,
|
||||
const GURL& url,
|
||||
bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
content::WebPluginInfo* plugin,
|
||||
chrome::mojom::PluginStatus* status) {
|
||||
CefResourceContext* resource_context =
|
||||
static_cast<CefResourceContext*>(content_resource_context);
|
||||
|
||||
if (*status == chrome::mojom::PluginStatus::kNotFound) {
|
||||
CefViewHostMsg_GetPluginInfo_Status* status) {
|
||||
if (*status == CefViewHostMsg_GetPluginInfo_Status::kNotFound ||
|
||||
*status == CefViewHostMsg_GetPluginInfo_Status::kNPAPINotSupported) {
|
||||
// The plugin does not exist so no need to query the handler.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (plugin->path == CefString(CefContentClient::kPDFPluginPath)) {
|
||||
// Always allow the internal PDF plugin to load.
|
||||
*status = chrome::mojom::PluginStatus::kAllowed;
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kAllowed;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -90,41 +89,41 @@ bool CefPluginServiceFilter::IsPluginAvailable(
|
||||
// Always allow extension origins to load plugins.
|
||||
// TODO(extensions): Revisit this decision once CEF supports more than just
|
||||
// the PDF extension.
|
||||
*status = chrome::mojom::PluginStatus::kAllowed;
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kAllowed;
|
||||
return true;
|
||||
}
|
||||
|
||||
CefRefPtr<CefRequestContextHandler> handler = resource_context->GetHandler();
|
||||
if (!handler) {
|
||||
// No handler so go with the default plugin load decision.
|
||||
return *status != chrome::mojom::PluginStatus::kDisabled;
|
||||
return *status != CefViewHostMsg_GetPluginInfo_Status::kDisabled;
|
||||
}
|
||||
|
||||
// Check for a cached plugin load decision.
|
||||
if (resource_context->HasPluginLoadDecision(render_process_id, plugin->path,
|
||||
is_main_frame, main_frame_origin,
|
||||
status)) {
|
||||
return *status != chrome::mojom::PluginStatus::kDisabled;
|
||||
return *status != CefViewHostMsg_GetPluginInfo_Status::kDisabled;
|
||||
}
|
||||
|
||||
CefRefPtr<CefWebPluginInfoImpl> pluginInfo(new CefWebPluginInfoImpl(*plugin));
|
||||
|
||||
cef_plugin_policy_t plugin_policy = PLUGIN_POLICY_ALLOW;
|
||||
switch (*status) {
|
||||
case chrome::mojom::PluginStatus::kAllowed:
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kAllowed:
|
||||
plugin_policy = PLUGIN_POLICY_ALLOW;
|
||||
break;
|
||||
case chrome::mojom::PluginStatus::kBlocked:
|
||||
case chrome::mojom::PluginStatus::kBlockedByPolicy:
|
||||
case chrome::mojom::PluginStatus::kOutdatedBlocked:
|
||||
case chrome::mojom::PluginStatus::kOutdatedDisallowed:
|
||||
case chrome::mojom::PluginStatus::kUnauthorized:
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kBlocked:
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kBlockedByPolicy:
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kOutdatedBlocked:
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kOutdatedDisallowed:
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kUnauthorized:
|
||||
plugin_policy = PLUGIN_POLICY_BLOCK;
|
||||
break;
|
||||
case chrome::mojom::PluginStatus::kDisabled:
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kDisabled:
|
||||
plugin_policy = PLUGIN_POLICY_DISABLE;
|
||||
break;
|
||||
case chrome::mojom::PluginStatus::kPlayImportantContent:
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kPlayImportantContent:
|
||||
plugin_policy = PLUGIN_POLICY_DETECT_IMPORTANT;
|
||||
break;
|
||||
default:
|
||||
@@ -138,16 +137,16 @@ bool CefPluginServiceFilter::IsPluginAvailable(
|
||||
pluginInfo.get(), &plugin_policy)) {
|
||||
switch (plugin_policy) {
|
||||
case PLUGIN_POLICY_ALLOW:
|
||||
*status = chrome::mojom::PluginStatus::kAllowed;
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kAllowed;
|
||||
break;
|
||||
case PLUGIN_POLICY_DETECT_IMPORTANT:
|
||||
*status = chrome::mojom::PluginStatus::kPlayImportantContent;
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kPlayImportantContent;
|
||||
break;
|
||||
case PLUGIN_POLICY_BLOCK:
|
||||
*status = chrome::mojom::PluginStatus::kBlocked;
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kBlocked;
|
||||
break;
|
||||
case PLUGIN_POLICY_DISABLE:
|
||||
*status = chrome::mojom::PluginStatus::kDisabled;
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kDisabled;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -157,5 +156,5 @@ bool CefPluginServiceFilter::IsPluginAvailable(
|
||||
is_main_frame, main_frame_origin,
|
||||
*status);
|
||||
|
||||
return *status != chrome::mojom::PluginStatus::kDisabled;
|
||||
return *status != CefViewHostMsg_GetPluginInfo_Status::kDisabled;
|
||||
}
|
||||
|
@@ -5,16 +5,14 @@
|
||||
#ifndef CEF_LIBCEF_BROWSER_PLUGINS_PLUGIN_SERVICE_FILTER_H_
|
||||
#define CEF_LIBCEF_BROWSER_PLUGINS_PLUGIN_SERVICE_FILTER_H_
|
||||
|
||||
#include "chrome/common/plugin.mojom.h"
|
||||
#include "content/public/browser/plugin_service_filter.h"
|
||||
|
||||
#include "include/internal/cef_types.h"
|
||||
|
||||
#include "base/macros.h"
|
||||
|
||||
namespace content {
|
||||
class ResourceContext;
|
||||
}
|
||||
class CefResourceContext;
|
||||
enum class CefViewHostMsg_GetPluginInfo_Status;
|
||||
|
||||
class CefPluginServiceFilter : public content::PluginServiceFilter {
|
||||
public:
|
||||
@@ -34,19 +32,16 @@ class CefPluginServiceFilter : public content::PluginServiceFilter {
|
||||
bool CanLoadPlugin(int render_process_id,
|
||||
const base::FilePath& path) override;
|
||||
|
||||
// Called from the above IsPluginAvailable method and from
|
||||
// PluginInfoHostImpl::Context::FindEnabledPlugin.
|
||||
// Returns false if the plugin is not found or disabled. May call
|
||||
// CefRequestContextHandler::OnBeforePluginLoad if possible/necessary.
|
||||
// See related discussion in issue #2015.
|
||||
bool IsPluginAvailable(int render_process_id,
|
||||
int render_frame_id,
|
||||
content::ResourceContext* resource_context,
|
||||
CefResourceContext* resource_context,
|
||||
const GURL& url,
|
||||
bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
content::WebPluginInfo* plugin,
|
||||
chrome::mojom::PluginStatus* status);
|
||||
CefViewHostMsg_GetPluginInfo_Status* status);
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(CefPluginServiceFilter);
|
||||
|
@@ -16,9 +16,7 @@
|
||||
#include "base/task_scheduler/post_task.h"
|
||||
#include "base/values.h"
|
||||
#include "chrome/browser/net/prediction_options.h"
|
||||
#include "chrome/browser/plugins/plugin_info_host_impl.h"
|
||||
#include "chrome/browser/prefs/chrome_command_line_pref_store.h"
|
||||
#include "chrome/browser/renderer_host/pepper/device_id_fetcher.h"
|
||||
#include "chrome/browser/supervised_user/supervised_user_pref_store.h"
|
||||
#include "chrome/browser/supervised_user/supervised_user_settings_service.h"
|
||||
#include "chrome/browser/supervised_user/supervised_user_settings_service_factory.h"
|
||||
@@ -29,7 +27,6 @@
|
||||
#include "components/content_settings/core/browser/cookie_settings.h"
|
||||
#include "components/content_settings/core/browser/host_content_settings_map.h"
|
||||
#include "components/google/core/browser/google_url_tracker.h"
|
||||
#include "components/keyed_service/content/browser_context_dependency_manager.h"
|
||||
#include "components/pref_registry/pref_registry_syncable.h"
|
||||
#include "components/prefs/json_pref_store.h"
|
||||
#include "components/prefs/pref_filter.h"
|
||||
@@ -48,6 +45,55 @@
|
||||
|
||||
namespace browser_prefs {
|
||||
|
||||
namespace {
|
||||
|
||||
// A helper function for registering localized values.
|
||||
// Based on CreateLocaleDefaultValue from
|
||||
// components/pref_registry/pref_registry_syncable.cc.
|
||||
void RegisterLocalizedValue(PrefRegistrySimple* registry,
|
||||
const char* path,
|
||||
base::Value::Type type,
|
||||
int message_id) {
|
||||
const std::string resource_string = l10n_util::GetStringUTF8(message_id);
|
||||
DCHECK(!resource_string.empty());
|
||||
switch (type) {
|
||||
case base::Value::Type::BOOLEAN: {
|
||||
if ("true" == resource_string)
|
||||
registry->RegisterBooleanPref(path, true);
|
||||
else if ("false" == resource_string)
|
||||
registry->RegisterBooleanPref(path, false);
|
||||
return;
|
||||
}
|
||||
|
||||
case base::Value::Type::INTEGER: {
|
||||
int val;
|
||||
base::StringToInt(resource_string, &val);
|
||||
registry->RegisterIntegerPref(path, val);
|
||||
return;
|
||||
}
|
||||
|
||||
case base::Value::Type::DOUBLE: {
|
||||
double val;
|
||||
base::StringToDouble(resource_string, &val);
|
||||
registry->RegisterDoublePref(path, val);
|
||||
return;
|
||||
}
|
||||
|
||||
case base::Value::Type::STRING: {
|
||||
registry->RegisterStringPref(path, resource_string);
|
||||
return;
|
||||
}
|
||||
|
||||
default: {
|
||||
NOTREACHED()
|
||||
<< "list and dictionary types cannot have default locale values";
|
||||
}
|
||||
}
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
const char kUserPrefsFileName[] = "UserPrefs.json";
|
||||
|
||||
std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
||||
@@ -119,70 +165,71 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
||||
scoped_refptr<user_prefs::PrefRegistrySyncable> registry(
|
||||
new user_prefs::PrefRegistrySyncable());
|
||||
|
||||
// Some preferences are specific to CEF and others are defined in Chromium.
|
||||
// The preferred approach for registering preferences defined in Chromium is
|
||||
// as follows:
|
||||
//
|
||||
// 1. If a non-static RegisterProfilePrefs() method exists in a *Factory
|
||||
// class then add a *Factory::GetInstance() call in
|
||||
// EnsureBrowserContextKeyedServiceFactoriesBuilt().
|
||||
// 2. If a static RegisterPrefs() method exists then call that method in the
|
||||
// "Default preferences" section below.
|
||||
// 3. If the default values are not appropriate but the set of registered
|
||||
// preferences is otherwise fine then change the defaults by calling
|
||||
// SetDefaultPrefValue after calling the existing registration method.
|
||||
// 4. If the original registration method contains many unused preferences or
|
||||
// otherwise inappropiate logic (e.g. calls to objects that CEF doesn't
|
||||
// use) then register the preferences directly instead of calling the
|
||||
// existing registration method.
|
||||
|
||||
// Call RegisterProfilePrefs() for all services listed by
|
||||
// EnsureBrowserContextKeyedServiceFactoriesBuilt().
|
||||
BrowserContextDependencyManager::GetInstance()
|
||||
->RegisterProfilePrefsForServices(profile, registry.get());
|
||||
|
||||
// Default preferences.
|
||||
CefMediaCaptureDevicesDispatcher::RegisterPrefs(registry.get());
|
||||
CefURLRequestContextGetterImpl::RegisterPrefs(registry.get());
|
||||
chrome_browser_net::RegisterPredictionOptionsProfilePrefs(registry.get());
|
||||
DeviceIDFetcher::RegisterProfilePrefs(registry.get());
|
||||
extensions::ExtensionPrefs::RegisterProfilePrefs(registry.get());
|
||||
GoogleURLTracker::RegisterProfilePrefs(registry.get());
|
||||
HostContentSettingsMap::RegisterProfilePrefs(registry.get());
|
||||
PluginInfoHostImpl::RegisterUserPrefs(registry.get());
|
||||
PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get());
|
||||
extensions::ExtensionPrefs::RegisterProfilePrefs(registry.get());
|
||||
HostContentSettingsMap::RegisterProfilePrefs(registry.get());
|
||||
CefURLRequestContextGetterImpl::RegisterPrefs(registry.get());
|
||||
renderer_prefs::RegisterProfilePrefs(registry.get());
|
||||
update_client::RegisterPrefs(registry.get());
|
||||
content_settings::CookieSettings::RegisterProfilePrefs(registry.get());
|
||||
chrome_browser_net::RegisterPredictionOptionsProfilePrefs(registry.get());
|
||||
GoogleURLTracker::RegisterProfilePrefs(registry.get());
|
||||
|
||||
// Print preferences.
|
||||
// Based on ProfileImpl::RegisterProfilePrefs.
|
||||
registry->RegisterBooleanPref(prefs::kPrintingEnabled, true);
|
||||
|
||||
// Spell checking preferences.
|
||||
// Modify defaults from SpellcheckServiceFactory::RegisterProfilePrefs.
|
||||
// Based on SpellcheckServiceFactory::RegisterProfilePrefs.
|
||||
registry->RegisterListPref(spellcheck::prefs::kSpellCheckDictionaries,
|
||||
base::MakeUnique<base::ListValue>());
|
||||
std::string spellcheck_lang =
|
||||
command_line->GetSwitchValueASCII(switches::kOverrideSpellCheckLang);
|
||||
if (!spellcheck_lang.empty()) {
|
||||
registry->SetDefaultPrefValue(spellcheck::prefs::kSpellCheckDictionary,
|
||||
base::Value(spellcheck_lang));
|
||||
registry->RegisterStringPref(spellcheck::prefs::kSpellCheckDictionary,
|
||||
spellcheck_lang);
|
||||
} else {
|
||||
RegisterLocalizedValue(
|
||||
registry.get(), spellcheck::prefs::kSpellCheckDictionary,
|
||||
base::Value::Type::STRING, IDS_SPELLCHECK_DICTIONARY);
|
||||
}
|
||||
const bool enable_spelling_service_ =
|
||||
command_line->HasSwitch(switches::kEnableSpellingService);
|
||||
registry->SetDefaultPrefValue(
|
||||
registry->RegisterBooleanPref(
|
||||
spellcheck::prefs::kSpellCheckUseSpellingService,
|
||||
base::Value(enable_spelling_service_));
|
||||
registry->SetDefaultPrefValue(spellcheck::prefs::kEnableSpellcheck,
|
||||
base::Value(!enable_spelling_service_));
|
||||
command_line->HasSwitch(switches::kEnableSpellingService));
|
||||
registry->RegisterBooleanPref(
|
||||
spellcheck::prefs::kEnableSpellcheck,
|
||||
!command_line->HasSwitch(switches::kDisableSpellChecking));
|
||||
|
||||
// Pepper flash preferences.
|
||||
// Modify defaults from DeviceIDFetcher::RegisterProfilePrefs.
|
||||
registry->SetDefaultPrefValue(prefs::kEnableDRM, base::Value(false));
|
||||
// Based on DeviceIDFetcher::RegisterProfilePrefs.
|
||||
registry->RegisterBooleanPref(prefs::kEnableDRM, false);
|
||||
registry->RegisterStringPref(prefs::kDRMSalt, "");
|
||||
|
||||
// Authentication preferences.
|
||||
// Based on IOThread::RegisterPrefs.
|
||||
registry->RegisterStringPref(prefs::kAuthServerWhitelist, "");
|
||||
registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, "");
|
||||
|
||||
// Plugin preferences.
|
||||
// Based on chrome::RegisterBrowserUserPrefs.
|
||||
registry->RegisterBooleanPref(prefs::kPluginsAllowOutdated, false);
|
||||
registry->RegisterBooleanPref(prefs::kPluginsAlwaysAuthorize, false);
|
||||
|
||||
// Theme preferences.
|
||||
// Based on ThemeServiceFactory::RegisterProfilePrefs.
|
||||
// TODO(cef/chrome): Remove this once CEF supports ThemeService.
|
||||
#if defined(USE_X11)
|
||||
registry->RegisterBooleanPref(prefs::kUsesSystemTheme, false);
|
||||
#endif
|
||||
registry->RegisterFilePathPref(prefs::kCurrentThemePackFilename,
|
||||
base::FilePath());
|
||||
registry->RegisterStringPref(prefs::kCurrentThemeID,
|
||||
ThemeService::kDefaultThemeID);
|
||||
registry->RegisterDictionaryPref(prefs::kCurrentThemeImages);
|
||||
registry->RegisterDictionaryPref(prefs::kCurrentThemeColors);
|
||||
registry->RegisterDictionaryPref(prefs::kCurrentThemeTints);
|
||||
registry->RegisterDictionaryPref(prefs::kCurrentThemeDisplayProperties);
|
||||
|
||||
// Browser UI preferences.
|
||||
// Based on chrome/browser/ui/browser_ui_prefs.cc RegisterBrowserPrefs.
|
||||
registry->RegisterBooleanPref(prefs::kAllowFileSelectionDialogs, true);
|
||||
|
@@ -288,8 +288,6 @@ void SetCommandLinePrefDefaults(CommandLinePrefStore* prefs) {
|
||||
SetBool(prefs, prefs::kWebKitLoadsImagesAutomatically, false);
|
||||
if (command_line->HasSwitch(switches::kDisableTabToLinks))
|
||||
SetBool(prefs, prefs::kWebkitTabsToLinks, false);
|
||||
if (command_line->HasSwitch(switches::kDisablePlugins))
|
||||
SetBool(prefs, prefs::kWebKitPluginsEnabled, false);
|
||||
}
|
||||
|
||||
void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
|
||||
|
@@ -9,9 +9,9 @@
|
||||
|
||||
#include "base/auto_reset.h"
|
||||
#include "base/bind.h"
|
||||
#include "base/feature_list.h"
|
||||
#include "base/location.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/memory/shared_memory.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/run_loop.h"
|
||||
#include "base/single_thread_task_runner.h"
|
||||
@@ -25,13 +25,11 @@
|
||||
#include "chrome/browser/printing/print_job_manager.h"
|
||||
#include "chrome/browser/printing/printer_query.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/common/chrome_features.h"
|
||||
#include "chrome/common/pref_names.h"
|
||||
#include "chrome/grit/generated_resources.h"
|
||||
#include "components/prefs/pref_service.h"
|
||||
#include "components/printing/browser/print_composite_client.h"
|
||||
#include "components/printing/browser/print_manager_utils.h"
|
||||
#include "components/printing/common/print_messages.h"
|
||||
#include "components/printing/service/public/cpp/pdf_service_mojo_utils.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/notification_details.h"
|
||||
#include "content/public/browser/notification_service.h"
|
||||
@@ -39,16 +37,14 @@
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "mojo/public/cpp/system/buffer.h"
|
||||
#include "printing/features/features.h"
|
||||
#include "printing/pdf_metafile_skia.h"
|
||||
#include "printing/print_settings.h"
|
||||
#include "printing/printed_document.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "base/command_line.h"
|
||||
#include "chrome/common/chrome_features.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#endif
|
||||
|
||||
using base::TimeDelta;
|
||||
@@ -62,9 +58,10 @@ CefPrintViewManagerBase::CefPrintViewManagerBase(
|
||||
printing_rfh_(nullptr),
|
||||
printing_succeeded_(false),
|
||||
inside_inner_message_loop_(false),
|
||||
#if !defined(OS_MACOSX)
|
||||
expecting_first_page_(true),
|
||||
queue_(g_browser_process->print_job_manager()->queue()),
|
||||
weak_ptr_factory_(this) {
|
||||
#endif
|
||||
queue_(g_browser_process->print_job_manager()->queue()) {
|
||||
DCHECK(queue_.get());
|
||||
Profile* profile =
|
||||
Profile::FromBrowserContext(web_contents->GetBrowserContext());
|
||||
@@ -113,22 +110,8 @@ void CefPrintViewManagerBase::OnDidGetPrintedPagesCount(int cookie,
|
||||
OpportunisticallyCreatePrintJob(cookie);
|
||||
}
|
||||
|
||||
void CefPrintViewManagerBase::OnComposePdfDone(
|
||||
const PrintHostMsg_DidPrintPage_Params& params,
|
||||
mojom::PdfCompositor::Status status,
|
||||
mojo::ScopedSharedBufferHandle handle) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
if (status != mojom::PdfCompositor::Status::SUCCESS) {
|
||||
DLOG(ERROR) << "Compositing pdf failed with error " << status;
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateForPrintedPage(params, true, GetShmFromMojoHandle(std::move(handle)));
|
||||
}
|
||||
|
||||
void CefPrintViewManagerBase::OnDidPrintPage(
|
||||
const PrintHostMsg_DidPrintPage_Params& params) {
|
||||
// Ready to composite. Starting a print job.
|
||||
if (!OpportunisticallyCreatePrintJob(params.document_cookie))
|
||||
return;
|
||||
|
||||
@@ -139,8 +122,12 @@ void CefPrintViewManagerBase::OnDidPrintPage(
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
const bool metafile_must_be_valid = true;
|
||||
#else
|
||||
const bool metafile_must_be_valid = expecting_first_page_;
|
||||
expecting_first_page_ = false;
|
||||
#endif
|
||||
|
||||
// Only used when |metafile_must_be_valid| is true.
|
||||
std::unique_ptr<base::SharedMemory> shared_buf;
|
||||
@@ -150,18 +137,8 @@ void CefPrintViewManagerBase::OnDidPrintPage(
|
||||
web_contents()->Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
auto* client = PrintCompositeClient::FromWebContents(web_contents());
|
||||
if (IsOopifEnabled() && !client->for_preview() &&
|
||||
!document->settings().is_modifiable()) {
|
||||
client->DoComposite(
|
||||
params.metafile_data_handle, params.data_size,
|
||||
base::BindOnce(&CefPrintViewManagerBase::OnComposePdfDone,
|
||||
weak_ptr_factory_.GetWeakPtr(), params));
|
||||
return;
|
||||
}
|
||||
shared_buf =
|
||||
std::make_unique<base::SharedMemory>(params.metafile_data_handle, true);
|
||||
base::MakeUnique<base::SharedMemory>(params.metafile_data_handle, true);
|
||||
if (!shared_buf->Map(params.data_size)) {
|
||||
NOTREACHED() << "couldn't map";
|
||||
web_contents()->Stop();
|
||||
@@ -176,23 +153,22 @@ void CefPrintViewManagerBase::OnDidPrintPage(
|
||||
}
|
||||
}
|
||||
|
||||
UpdateForPrintedPage(params, metafile_must_be_valid, std::move(shared_buf));
|
||||
}
|
||||
|
||||
void CefPrintViewManagerBase::UpdateForPrintedPage(
|
||||
const PrintHostMsg_DidPrintPage_Params& params,
|
||||
bool has_valid_page_data,
|
||||
std::unique_ptr<base::SharedMemory> shared_buf) {
|
||||
PrintedDocument* document = print_job_->document();
|
||||
if (!document)
|
||||
return;
|
||||
std::unique_ptr<PdfMetafileSkia> metafile(
|
||||
new PdfMetafileSkia(SkiaDocumentType::PDF));
|
||||
if (metafile_must_be_valid) {
|
||||
if (!metafile->InitFromData(shared_buf->memory(), params.data_size)) {
|
||||
NOTREACHED() << "Invalid metafile header";
|
||||
web_contents()->Stop();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(OS_WIN)
|
||||
print_job_->AppendPrintedPage(params.page_number);
|
||||
if (has_valid_page_data) {
|
||||
scoped_refptr<base::RefCountedBytes> bytes(new base::RefCountedBytes(
|
||||
if (metafile_must_be_valid) {
|
||||
scoped_refptr<base::RefCountedBytes> bytes = new base::RefCountedBytes(
|
||||
reinterpret_cast<const unsigned char*>(shared_buf->memory()),
|
||||
shared_buf->mapped_size()));
|
||||
params.data_size);
|
||||
|
||||
document->DebugDumpData(bytes.get(), FILE_PATH_LITERAL(".pdf"));
|
||||
|
||||
@@ -219,20 +195,12 @@ void CefPrintViewManagerBase::UpdateForPrintedPage(
|
||||
}
|
||||
}
|
||||
#else
|
||||
std::unique_ptr<PdfMetafileSkia> metafile =
|
||||
std::make_unique<PdfMetafileSkia>(SkiaDocumentType::PDF);
|
||||
if (has_valid_page_data) {
|
||||
if (!metafile->InitFromData(shared_buf->memory(),
|
||||
shared_buf->mapped_size())) {
|
||||
NOTREACHED() << "Invalid metafile header";
|
||||
web_contents()->Stop();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Update the rendered document. It will send notifications to the listener.
|
||||
document->SetPage(params.page_number, std::move(metafile), params.page_size,
|
||||
params.content_area);
|
||||
document->SetPage(params.page_number, std::move(metafile),
|
||||
#if defined(OS_WIN)
|
||||
0.0f /* dummy shrink_factor */,
|
||||
#endif
|
||||
params.page_size, params.content_area);
|
||||
|
||||
ShouldQuitFromInnerMessageLoop();
|
||||
#endif
|
||||
@@ -437,7 +405,9 @@ void CefPrintViewManagerBase::DisconnectFromCurrentPrintJob() {
|
||||
// DO NOT wait for the job to finish.
|
||||
ReleasePrintJob();
|
||||
}
|
||||
#if !defined(OS_MACOSX)
|
||||
expecting_first_page_ = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
void CefPrintViewManagerBase::TerminatePrintJob(bool cancel) {
|
||||
|
@@ -9,23 +9,16 @@
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/strings/string16.h"
|
||||
#include "build/build_config.h"
|
||||
#include "components/prefs/pref_member.h"
|
||||
#include "components/printing/browser/print_manager.h"
|
||||
#include "components/printing/service/public/interfaces/pdf_compositor.mojom.h"
|
||||
#include "content/public/browser/notification_observer.h"
|
||||
#include "content/public/browser/notification_registrar.h"
|
||||
#include "mojo/public/cpp/system/platform_handle.h"
|
||||
#include "printing/features/features.h"
|
||||
|
||||
struct PrintHostMsg_DidPrintPage_Params;
|
||||
|
||||
namespace base {
|
||||
class SharedMemory;
|
||||
}
|
||||
|
||||
namespace content {
|
||||
class RenderFrameHost;
|
||||
}
|
||||
@@ -33,6 +26,7 @@ class RenderFrameHost;
|
||||
namespace printing {
|
||||
|
||||
class JobEventDetails;
|
||||
class MetafilePlayer;
|
||||
class PrintJob;
|
||||
class PrintJobWorkerOwner;
|
||||
class PrintQueriesQueue;
|
||||
@@ -83,19 +77,9 @@ class CefPrintViewManagerBase : public content::NotificationObserver,
|
||||
|
||||
// IPC Message handlers.
|
||||
void OnDidGetPrintedPagesCount(int cookie, int number_pages) override;
|
||||
void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params);
|
||||
void OnPrintingFailed(int cookie) override;
|
||||
void OnShowInvalidPrinterSettingsError();
|
||||
void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params);
|
||||
|
||||
// Handle extra tasks once a page or doc is printed.
|
||||
void UpdateForPrintedPage(const PrintHostMsg_DidPrintPage_Params& params,
|
||||
bool has_valid_page_data,
|
||||
std::unique_ptr<base::SharedMemory> shared_buf);
|
||||
|
||||
// IPC message handlers for service.
|
||||
void OnComposePdfDone(const PrintHostMsg_DidPrintPage_Params& params,
|
||||
mojom::PdfCompositor::Status status,
|
||||
mojo::ScopedSharedBufferHandle handle);
|
||||
|
||||
// Processes a NOTIFY_PRINT_JOB_EVENT notification.
|
||||
void OnNotifyPrintJobEvent(const JobEventDetails& event_details);
|
||||
@@ -164,16 +148,16 @@ class CefPrintViewManagerBase : public content::NotificationObserver,
|
||||
// print settings are being loaded.
|
||||
bool inside_inner_message_loop_;
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
// Set to true when OnDidPrintPage() should be expecting the first page.
|
||||
bool expecting_first_page_;
|
||||
#endif // OS_MACOSX
|
||||
|
||||
// Whether printing is enabled.
|
||||
BooleanPrefMember printing_enabled_;
|
||||
|
||||
scoped_refptr<printing::PrintQueriesQueue> queue_;
|
||||
|
||||
base::WeakPtrFactory<CefPrintViewManagerBase> weak_ptr_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefPrintViewManagerBase);
|
||||
};
|
||||
|
||||
|
@@ -436,10 +436,10 @@ bool CefRequestContextImpl::SetPreference(const CefString& name,
|
||||
CefValueImpl::ScopedLockedValue scoped_locked_value(impl);
|
||||
base::Value* impl_value = impl->GetValueUnsafe();
|
||||
|
||||
if (pref->GetType() != impl_value->type()) {
|
||||
if (pref->GetType() != impl_value->GetType()) {
|
||||
error = base::StringPrintf(
|
||||
"Trying to set a preference of type %s to value of type %s",
|
||||
GetTypeString(pref->GetType()), GetTypeString(impl_value->type()));
|
||||
GetTypeString(pref->GetType()), GetTypeString(impl_value->GetType()));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -118,7 +118,7 @@ void CefResourceContext::AddPluginLoadDecision(
|
||||
const base::FilePath& plugin_path,
|
||||
bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
chrome::mojom::PluginStatus status) {
|
||||
CefViewHostMsg_GetPluginInfo_Status status) {
|
||||
CEF_REQUIRE_IOT();
|
||||
DCHECK_GE(render_process_id, 0);
|
||||
DCHECK(!plugin_path.empty());
|
||||
@@ -134,7 +134,7 @@ bool CefResourceContext::HasPluginLoadDecision(
|
||||
const base::FilePath& plugin_path,
|
||||
bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
chrome::mojom::PluginStatus* status) const {
|
||||
CefViewHostMsg_GetPluginInfo_Status* status) const {
|
||||
CEF_REQUIRE_IOT();
|
||||
DCHECK_GE(render_process_id, 0);
|
||||
DCHECK(!plugin_path.empty());
|
||||
|
@@ -10,13 +10,13 @@
|
||||
#include "include/cef_request_context_handler.h"
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
#include "chrome/common/plugin.mojom.h"
|
||||
#include "content/public/browser/resource_context.h"
|
||||
#include "extensions/browser/info_map.h"
|
||||
#include "net/ssl/client_cert_store.h"
|
||||
#include "url/origin.h"
|
||||
|
||||
class CefURLRequestContextGetter;
|
||||
enum class CefViewHostMsg_GetPluginInfo_Status;
|
||||
|
||||
// Acts as a bridge for resource loading. Life span is controlled by
|
||||
// CefBrowserContext. Created on the UI thread but accessed and destroyed on the
|
||||
@@ -53,12 +53,12 @@ class CefResourceContext : public content::ResourceContext {
|
||||
const base::FilePath& plugin_path,
|
||||
bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
chrome::mojom::PluginStatus status);
|
||||
CefViewHostMsg_GetPluginInfo_Status status);
|
||||
bool HasPluginLoadDecision(int render_process_id,
|
||||
const base::FilePath& plugin_path,
|
||||
bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
chrome::mojom::PluginStatus* status) const;
|
||||
CefViewHostMsg_GetPluginInfo_Status* status) const;
|
||||
|
||||
// Clear the plugin load decisions associated with |render_process_id|, or all
|
||||
// plugin load decisions if |render_process_id| is -1.
|
||||
@@ -88,7 +88,7 @@ class CefResourceContext : public content::ResourceContext {
|
||||
// plugin load decision.
|
||||
typedef std::map<
|
||||
std::pair<std::pair<int, base::FilePath>, std::pair<bool, url::Origin>>,
|
||||
chrome::mojom::PluginStatus>
|
||||
CefViewHostMsg_GetPluginInfo_Status>
|
||||
PluginLoadDecisionMap;
|
||||
PluginLoadDecisionMap plugin_load_decision_map_;
|
||||
|
||||
|
@@ -11,6 +11,13 @@ using content::SSLHostStateDelegate;
|
||||
|
||||
namespace internal {
|
||||
|
||||
net::SHA256HashValue getChainFingerprint256(const net::X509Certificate& cert) {
|
||||
net::SHA256HashValue fingerprint =
|
||||
net::X509Certificate::CalculateChainFingerprint256(
|
||||
cert.os_cert_handle(), cert.GetIntermediateCertificates());
|
||||
return fingerprint;
|
||||
}
|
||||
|
||||
CertPolicy::CertPolicy() {}
|
||||
CertPolicy::~CertPolicy() {}
|
||||
|
||||
@@ -19,7 +26,7 @@ CertPolicy::~CertPolicy() {}
|
||||
// in the saved CertStatus.
|
||||
bool CertPolicy::Check(const net::X509Certificate& cert,
|
||||
net::CertStatus error) const {
|
||||
net::SHA256HashValue fingerprint = cert.CalculateChainFingerprint256();
|
||||
net::SHA256HashValue fingerprint = getChainFingerprint256(cert);
|
||||
std::map<net::SHA256HashValue, net::CertStatus,
|
||||
net::SHA256HashValueLessThan>::const_iterator allowed_iter =
|
||||
allowed_.find(fingerprint);
|
||||
@@ -34,7 +41,7 @@ void CertPolicy::Allow(const net::X509Certificate& cert,
|
||||
net::CertStatus error) {
|
||||
// If this same cert had already been saved with a different error status,
|
||||
// this will replace it with the new error status.
|
||||
net::SHA256HashValue fingerprint = cert.CalculateChainFingerprint256();
|
||||
net::SHA256HashValue fingerprint = getChainFingerprint256(cert);
|
||||
allowed_[fingerprint] = error;
|
||||
}
|
||||
|
||||
|
@@ -125,9 +125,10 @@ void CefStoragePartitionProxy::ClearDataForOrigin(
|
||||
uint32_t remove_mask,
|
||||
uint32_t quota_storage_remove_mask,
|
||||
const GURL& storage_origin,
|
||||
net::URLRequestContextGetter* rq_context) {
|
||||
net::URLRequestContextGetter* rq_context,
|
||||
const base::Closure& callback) {
|
||||
parent_->ClearDataForOrigin(remove_mask, quota_storage_remove_mask,
|
||||
storage_origin, rq_context);
|
||||
storage_origin, rq_context, callback);
|
||||
}
|
||||
|
||||
void CefStoragePartitionProxy::ClearData(
|
||||
@@ -137,9 +138,9 @@ void CefStoragePartitionProxy::ClearData(
|
||||
const OriginMatcherFunction& origin_matcher,
|
||||
const base::Time begin,
|
||||
const base::Time end,
|
||||
base::OnceClosure callback) {
|
||||
const base::Closure& callback) {
|
||||
parent_->ClearData(remove_mask, quota_storage_remove_mask, storage_origin,
|
||||
origin_matcher, begin, end, std::move(callback));
|
||||
origin_matcher, begin, end, callback);
|
||||
}
|
||||
|
||||
void CefStoragePartitionProxy::ClearData(
|
||||
@@ -149,18 +150,17 @@ void CefStoragePartitionProxy::ClearData(
|
||||
const CookieMatcherFunction& cookie_matcher,
|
||||
const base::Time begin,
|
||||
const base::Time end,
|
||||
base::OnceClosure callback) {
|
||||
const base::Closure& callback) {
|
||||
parent_->ClearData(remove_mask, quota_storage_remove_mask, origin_matcher,
|
||||
cookie_matcher, begin, end, std::move(callback));
|
||||
cookie_matcher, begin, end, callback);
|
||||
}
|
||||
|
||||
void CefStoragePartitionProxy::ClearHttpAndMediaCaches(
|
||||
const base::Time begin,
|
||||
const base::Time end,
|
||||
const base::Callback<bool(const GURL&)>& url_matcher,
|
||||
base::OnceClosure callback) {
|
||||
parent_->ClearHttpAndMediaCaches(begin, end, url_matcher,
|
||||
std::move(callback));
|
||||
const base::Closure& callback) {
|
||||
parent_->ClearHttpAndMediaCaches(begin, end, url_matcher, callback);
|
||||
}
|
||||
|
||||
void CefStoragePartitionProxy::Flush() {
|
||||
@@ -171,11 +171,6 @@ void CefStoragePartitionProxy::ClearBluetoothAllowedDevicesMapForTesting() {
|
||||
parent_->ClearBluetoothAllowedDevicesMapForTesting();
|
||||
}
|
||||
|
||||
void CefStoragePartitionProxy::SetNetworkFactoryForTesting(
|
||||
content::mojom::URLLoaderFactory* test_factory) {
|
||||
parent_->SetNetworkFactoryForTesting(test_factory);
|
||||
}
|
||||
|
||||
content::URLLoaderFactoryGetter*
|
||||
CefStoragePartitionProxy::url_loader_factory_getter() {
|
||||
return parent_->url_loader_factory_getter();
|
||||
|
@@ -50,30 +50,29 @@ class CefStoragePartitionProxy : public content::StoragePartition {
|
||||
void ClearDataForOrigin(uint32_t remove_mask,
|
||||
uint32_t quota_storage_remove_mask,
|
||||
const GURL& storage_origin,
|
||||
net::URLRequestContextGetter* rq_context) override;
|
||||
net::URLRequestContextGetter* rq_context,
|
||||
const base::Closure& callback);
|
||||
void ClearData(uint32_t remove_mask,
|
||||
uint32_t quota_storage_remove_mask,
|
||||
const GURL& storage_origin,
|
||||
const OriginMatcherFunction& origin_matcher,
|
||||
const base::Time begin,
|
||||
const base::Time end,
|
||||
base::OnceClosure callback) override;
|
||||
const base::Closure& callback);
|
||||
void ClearData(uint32_t remove_mask,
|
||||
uint32_t quota_storage_remove_mask,
|
||||
const OriginMatcherFunction& origin_matcher,
|
||||
const CookieMatcherFunction& cookie_matcher,
|
||||
const base::Time begin,
|
||||
const base::Time end,
|
||||
base::OnceClosure callback) override;
|
||||
const base::Closure& callback) override;
|
||||
void ClearHttpAndMediaCaches(
|
||||
const base::Time begin,
|
||||
const base::Time end,
|
||||
const base::Callback<bool(const GURL&)>& url_matcher,
|
||||
base::OnceClosure callback) override;
|
||||
const base::Closure& callback) override;
|
||||
void Flush() override;
|
||||
void ClearBluetoothAllowedDevicesMapForTesting() override;
|
||||
void SetNetworkFactoryForTesting(
|
||||
content::mojom::URLLoaderFactory* test_factory) override;
|
||||
content::URLLoaderFactoryGetter* url_loader_factory_getter() override;
|
||||
content::BrowserContext* browser_context() const override;
|
||||
mojo::BindingId Bind(
|
||||
|
@@ -182,10 +182,8 @@ display::Display GetDisplayNearestPoint(const gfx::Point& point,
|
||||
bool input_pixel_coords) {
|
||||
gfx::Point find_point = point;
|
||||
#if defined(OS_WIN)
|
||||
if (input_pixel_coords) {
|
||||
find_point = gfx::ToFlooredPoint(
|
||||
display::win::ScreenWin::ScreenToDIPPoint(gfx::PointF(point)));
|
||||
}
|
||||
if (input_pixel_coords)
|
||||
find_point = display::win::ScreenWin::ScreenToDIPPoint(point);
|
||||
#endif
|
||||
return display::Screen::GetScreen()->GetDisplayNearestPoint(find_point);
|
||||
}
|
||||
|
@@ -4,6 +4,12 @@
|
||||
|
||||
#include "include/base/cef_build.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <windows.h>
|
||||
|
||||
#include <shellscalingapi.h>
|
||||
#endif
|
||||
|
||||
#include "include/internal/cef_logging_internal.h"
|
||||
#include "include/internal/cef_thread_internal.h"
|
||||
#include "include/internal/cef_trace_event_internal.h"
|
||||
@@ -13,8 +19,50 @@
|
||||
#include "base/trace_event/trace_event.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "base/win/win_util.h"
|
||||
#endif
|
||||
#include "base/win/windows_version.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// Implementation from chrome/app/chrome_exe_main_win.cc.
|
||||
|
||||
// Win8.1 supports monitor-specific DPI scaling.
|
||||
bool SetProcessDpiAwarenessWrapper(PROCESS_DPI_AWARENESS value) {
|
||||
typedef HRESULT(WINAPI * SetProcessDpiAwarenessPtr)(PROCESS_DPI_AWARENESS);
|
||||
SetProcessDpiAwarenessPtr set_process_dpi_awareness_func =
|
||||
reinterpret_cast<SetProcessDpiAwarenessPtr>(GetProcAddress(
|
||||
GetModuleHandleA("user32.dll"), "SetProcessDpiAwarenessInternal"));
|
||||
if (set_process_dpi_awareness_func) {
|
||||
HRESULT hr = set_process_dpi_awareness_func(value);
|
||||
if (SUCCEEDED(hr)) {
|
||||
VLOG(1) << "SetProcessDpiAwareness succeeded.";
|
||||
return true;
|
||||
} else if (hr == E_ACCESSDENIED) {
|
||||
LOG(ERROR) << "Access denied error from SetProcessDpiAwareness. "
|
||||
"Function called twice, or manifest was used.";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// This function works for Windows Vista through Win8. Win8.1 must use
|
||||
// SetProcessDpiAwareness[Wrapper].
|
||||
BOOL SetProcessDPIAwareWrapper() {
|
||||
typedef BOOL(WINAPI * SetProcessDPIAwarePtr)(VOID);
|
||||
SetProcessDPIAwarePtr set_process_dpi_aware_func =
|
||||
reinterpret_cast<SetProcessDPIAwarePtr>(
|
||||
GetProcAddress(GetModuleHandleA("user32.dll"), "SetProcessDPIAware"));
|
||||
return set_process_dpi_aware_func && set_process_dpi_aware_func();
|
||||
}
|
||||
|
||||
void EnableHighDPISupport() {
|
||||
if (!SetProcessDpiAwarenessWrapper(PROCESS_SYSTEM_DPI_AWARE)) {
|
||||
SetProcessDPIAwareWrapper();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // defined(OS_WIN)
|
||||
|
||||
// The contents of this file are a compilation unit that is not called by other
|
||||
// functions in the the library. Consiquently MSVS will exclude it during the
|
||||
@@ -351,6 +399,10 @@ cef_get_current_platform_thread_handle() {
|
||||
|
||||
void CefEnableHighDPISupport() {
|
||||
#if defined(OS_WIN)
|
||||
base::win::EnableHighDPISupport();
|
||||
// We don't want to set DPI awareness on pre-Win7 because we don't support
|
||||
// DirectWrite there. GDI fonts are kerned very badly, so better to leave
|
||||
// DPI-unaware and at effective 1.0. See also ShouldUseDirectWrite().
|
||||
if (base::win::GetVersion() >= base::win::VERSION_WIN7)
|
||||
EnableHighDPISupport();
|
||||
#endif
|
||||
}
|
||||
|
@@ -43,9 +43,15 @@ class CallRecordUploadAttempt {
|
||||
CefCrashReportUploadThread::CefCrashReportUploadThread(
|
||||
CrashReportDatabase* database,
|
||||
const std::string& url,
|
||||
const Options& options,
|
||||
bool watch_pending_reports,
|
||||
bool rate_limit,
|
||||
bool upload_gzip,
|
||||
int max_uploads)
|
||||
: CrashReportUploadThread(database, url, options),
|
||||
: CrashReportUploadThread(database,
|
||||
url,
|
||||
watch_pending_reports,
|
||||
rate_limit,
|
||||
upload_gzip),
|
||||
max_uploads_(max_uploads) {}
|
||||
|
||||
CefCrashReportUploadThread::~CefCrashReportUploadThread() {}
|
||||
@@ -167,7 +173,7 @@ bool CefCrashReportUploadThread::UploadsEnabled() const {
|
||||
}
|
||||
|
||||
bool CefCrashReportUploadThread::MaxUploadsEnabled() const {
|
||||
return options_.rate_limit && max_uploads_ > 0;
|
||||
return rate_limit_ && max_uploads_ > 0;
|
||||
}
|
||||
|
||||
bool CefCrashReportUploadThread::MaxUploadsExceeded() const {
|
||||
@@ -175,7 +181,7 @@ bool CefCrashReportUploadThread::MaxUploadsExceeded() const {
|
||||
}
|
||||
|
||||
bool CefCrashReportUploadThread::BackoffPending() const {
|
||||
if (!options_.rate_limit)
|
||||
if (!rate_limit_)
|
||||
return false;
|
||||
|
||||
Settings* const settings = database_->GetSettings();
|
||||
@@ -192,7 +198,7 @@ bool CefCrashReportUploadThread::BackoffPending() const {
|
||||
}
|
||||
|
||||
void CefCrashReportUploadThread::IncreaseBackoff() {
|
||||
if (!options_.rate_limit)
|
||||
if (!rate_limit_)
|
||||
return;
|
||||
|
||||
const int kHour = 60 * 60; // 1 hour
|
||||
@@ -230,7 +236,7 @@ void CefCrashReportUploadThread::IncreaseBackoff() {
|
||||
}
|
||||
|
||||
void CefCrashReportUploadThread::ResetBackoff() {
|
||||
if (!options_.rate_limit)
|
||||
if (!rate_limit_)
|
||||
return;
|
||||
|
||||
Settings* settings = database_->GetSettings();
|
||||
|
@@ -11,7 +11,9 @@ class CefCrashReportUploadThread : public crashpad::CrashReportUploadThread {
|
||||
public:
|
||||
CefCrashReportUploadThread(crashpad::CrashReportDatabase* database,
|
||||
const std::string& url,
|
||||
const Options& options,
|
||||
bool watch_pending_reports,
|
||||
bool rate_limit,
|
||||
bool upload_gzip,
|
||||
int max_uploads);
|
||||
~CefCrashReportUploadThread();
|
||||
|
||||
|
@@ -21,6 +21,20 @@
|
||||
#ifndef CEF_LIBCEF_COMMON_CEF_MESSAGES_H_
|
||||
#define CEF_LIBCEF_COMMON_CEF_MESSAGES_H_
|
||||
|
||||
// Based on ChromeViewHostMsg_GetPluginInfo_Status.
|
||||
enum class CefViewHostMsg_GetPluginInfo_Status {
|
||||
kAllowed,
|
||||
kBlocked,
|
||||
kBlockedByPolicy,
|
||||
kDisabled,
|
||||
kNotFound,
|
||||
kNPAPINotSupported,
|
||||
kOutdatedBlocked,
|
||||
kOutdatedDisallowed,
|
||||
kPlayImportantContent,
|
||||
kUnauthorized,
|
||||
};
|
||||
|
||||
namespace IPC {
|
||||
|
||||
// Extracted from chrome/common/automation_messages.h.
|
||||
@@ -193,6 +207,44 @@ IPC_SYNC_MESSAGE_CONTROL1_1(
|
||||
int /* render_frame_routing_id */,
|
||||
CefProcessHostMsg_GetNewBrowserInfo_Params /* params*/)
|
||||
|
||||
IPC_ENUM_TRAITS_MAX_VALUE(CefViewHostMsg_GetPluginInfo_Status,
|
||||
CefViewHostMsg_GetPluginInfo_Status::kUnauthorized)
|
||||
|
||||
// Output parameters for CefViewHostMsg_GetPluginInfo message.
|
||||
IPC_STRUCT_BEGIN(CefViewHostMsg_GetPluginInfo_Output)
|
||||
IPC_STRUCT_MEMBER(CefViewHostMsg_GetPluginInfo_Status, status)
|
||||
IPC_STRUCT_MEMBER(content::WebPluginInfo, plugin)
|
||||
IPC_STRUCT_MEMBER(std::string, actual_mime_type)
|
||||
IPC_STRUCT_MEMBER(std::string, group_identifier)
|
||||
IPC_STRUCT_MEMBER(base::string16, group_name)
|
||||
IPC_STRUCT_END()
|
||||
|
||||
// Return information about a plugin for the given URL and MIME type.
|
||||
// In contrast to ViewHostMsg_GetPluginInfo in content/, this IPC call knows
|
||||
// about specific reasons why a plugin can't be used, for example because it's
|
||||
// disabled. Based on ChromeViewHostMsg_GetPluginInfo.
|
||||
IPC_SYNC_MESSAGE_CONTROL5_1(CefViewHostMsg_GetPluginInfo,
|
||||
int /* render_frame_id */,
|
||||
GURL /* url */,
|
||||
bool /* is_main_frame */,
|
||||
url::Origin /* top_origin_url */,
|
||||
std::string /* mime_type */,
|
||||
CefViewHostMsg_GetPluginInfo_Output /* output */)
|
||||
|
||||
// Returns whether any internal plugin supporting |mime_type| is registered and
|
||||
// enabled. Does not determine whether the plugin can actually be instantiated
|
||||
// (e.g. whether it has all its dependencies).
|
||||
// When the returned *|is_available| is true, |additional_param_names| and
|
||||
// |additional_param_values| contain the name-value pairs, if any, specified
|
||||
// for the *first* non-disabled plugin found that is registered for |mime_type|.
|
||||
// Based on ChromeViewHostMsg_IsInternalPluginAvailableForMimeType.
|
||||
IPC_SYNC_MESSAGE_CONTROL1_3(
|
||||
CefViewHostMsg_IsInternalPluginAvailableForMimeType,
|
||||
std::string /* mime_type */,
|
||||
bool /* is_available */,
|
||||
std::vector<base::string16> /* additional_param_names */,
|
||||
std::vector<base::string16> /* additional_param_values */)
|
||||
|
||||
// Sent when a frame is identified for the first time.
|
||||
IPC_MESSAGE_ROUTED3(CefHostMsg_FrameIdentified,
|
||||
int64_t /* frame_id */,
|
||||
|
@@ -57,9 +57,6 @@ const char kDisableTextAreaResize[] = "disable-text-area-resize";
|
||||
// Disable using the tab key to advance focus to links.
|
||||
const char kDisableTabToLinks[] = "disable-tab-to-links";
|
||||
|
||||
// Disable plugins.
|
||||
const char kDisablePlugins[] = "disable-plugins";
|
||||
|
||||
// Persist session cookies.
|
||||
const char kPersistSessionCookies[] = "persist-session-cookies";
|
||||
|
||||
|
@@ -31,7 +31,6 @@ extern const char kDisableImageLoading[];
|
||||
extern const char kImageShrinkStandaloneToFit[];
|
||||
extern const char kDisableTextAreaResize[];
|
||||
extern const char kDisableTabToLinks[];
|
||||
extern const char kDisablePlugins[];
|
||||
extern const char kPersistSessionCookies[];
|
||||
extern const char kPersistUserPreferences[];
|
||||
extern const char kEnableMediaStream[];
|
||||
|
@@ -91,7 +91,7 @@ content::PepperPluginInfo CreatePepperFlashInfo(const base::FilePath& path,
|
||||
plugin.is_out_of_process = true;
|
||||
plugin.name = content::kFlashPluginName;
|
||||
plugin.path = path;
|
||||
plugin.permissions = kPepperFlashPermissions;
|
||||
plugin.permissions = chrome::kPepperFlashPermissions;
|
||||
|
||||
std::vector<std::string> flash_version_numbers = base::SplitString(
|
||||
version, ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
|
||||
@@ -170,7 +170,7 @@ bool GetSystemPepperFlash(content::PepperPluginInfo* plugin) {
|
||||
return false;
|
||||
|
||||
base::Version version;
|
||||
if (!CheckPepperFlashManifest(*manifest, &version))
|
||||
if (!chrome::CheckPepperFlashManifest(*manifest, &version))
|
||||
return false;
|
||||
|
||||
*plugin = CreatePepperFlashInfo(flash_filename, version.GetString());
|
||||
|
@@ -12,7 +12,6 @@
|
||||
#include "base/debug/crash_logging.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "chrome/common/crash_keys.h"
|
||||
#include "components/crash/core/common/crash_key.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
@@ -162,8 +161,6 @@ void PreSandboxStartup(const base::CommandLine& command_line,
|
||||
<< (process_type.empty() ? "browser" : process_type.c_str());
|
||||
}
|
||||
|
||||
crash_reporter::InitializeCrashKeys();
|
||||
|
||||
// After platform crash reporting have been initialized, store the command
|
||||
// line for crash reporting.
|
||||
crash_keys::SetSwitchesFromCommandLine(command_line, &IsBoringCEFSwitch);
|
||||
|
@@ -541,7 +541,7 @@ void CefMainDelegate::PreSandboxStartup() {
|
||||
crash_reporting::PreSandboxStartup(*command_line, process_type);
|
||||
|
||||
InitializeResourceBundle();
|
||||
InitializePDF();
|
||||
chrome::InitializePDF();
|
||||
}
|
||||
|
||||
void CefMainDelegate::SandboxInitialized(const std::string& process_type) {
|
||||
@@ -589,7 +589,7 @@ void CefMainDelegate::ProcessExiting(const std::string& process_type) {
|
||||
ui::ResourceBundle::CleanupSharedInstance();
|
||||
}
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
|
||||
void CefMainDelegate::ZygoteForked() {
|
||||
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
||||
const std::string& process_type =
|
||||
@@ -717,8 +717,7 @@ void CefMainDelegate::InitializeResourceBundle() {
|
||||
}
|
||||
}
|
||||
|
||||
if (extensions::ExtensionsEnabled() ||
|
||||
!command_line->HasSwitch(switches::kDisablePlugins)) {
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
if (base::PathExists(cef_extensions_pak_file)) {
|
||||
resource_bundle.AddDataPackFromPath(cef_extensions_pak_file,
|
||||
ui::SCALE_FACTOR_NONE);
|
||||
|
@@ -17,7 +17,7 @@
|
||||
namespace base {
|
||||
class CommandLine;
|
||||
class Thread;
|
||||
} // namespace base
|
||||
}
|
||||
|
||||
namespace content {
|
||||
class BrowserMainRunner;
|
||||
@@ -39,7 +39,7 @@ class CefMainDelegate : public content::ContentMainDelegate {
|
||||
const std::string& process_type,
|
||||
const content::MainFunctionParams& main_function_params) override;
|
||||
void ProcessExiting(const std::string& process_type) override;
|
||||
#if defined(OS_LINUX)
|
||||
#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
|
||||
void ZygoteForked() override;
|
||||
#endif
|
||||
content::ContentBrowserClient* CreateContentBrowserClient() override;
|
||||
|
@@ -33,12 +33,12 @@
|
||||
#include "net/http/http_util.h"
|
||||
#include "net/url_request/url_fetcher.h"
|
||||
#include "net/url_request/url_request.h"
|
||||
#include "third_party/WebKit/public/platform/WebCachePolicy.h"
|
||||
#include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h"
|
||||
#include "third_party/WebKit/public/platform/WebString.h"
|
||||
#include "third_party/WebKit/public/platform/WebURL.h"
|
||||
#include "third_party/WebKit/public/platform/WebURLError.h"
|
||||
#include "third_party/WebKit/public/platform/WebURLRequest.h"
|
||||
#include "third_party/WebKit/public/platform/modules/fetch/fetch_api_request.mojom-shared.h"
|
||||
#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
|
||||
|
||||
namespace {
|
||||
@@ -149,24 +149,24 @@ int GetCacheControlHeaderPolicy(CefRequest::HeaderMap headerMap) {
|
||||
}
|
||||
|
||||
// Convert cef_urlrequest_flags_t to blink::WebCachePolicy.
|
||||
blink::mojom::FetchCacheMode GetFetchCacheMode(int ur_flags) {
|
||||
blink::WebCachePolicy GetWebCachePolicy(int ur_flags) {
|
||||
if ((ur_flags & kURCachePolicyMask) == kURCachePolicyMask) {
|
||||
return blink::mojom::FetchCacheMode::kUnspecifiedForceCacheMiss;
|
||||
return blink::WebCachePolicy::kBypassCacheLoadOnlyFromCache;
|
||||
} else if (ur_flags & UR_FLAG_SKIP_CACHE) {
|
||||
return blink::mojom::FetchCacheMode::kBypassCache;
|
||||
return blink::WebCachePolicy::kBypassingCache;
|
||||
} else if (ur_flags & UR_FLAG_ONLY_FROM_CACHE) {
|
||||
return blink::mojom::FetchCacheMode::kOnlyIfCached;
|
||||
return blink::WebCachePolicy::kReturnCacheDataDontLoad;
|
||||
}
|
||||
return blink::mojom::FetchCacheMode::kDefault;
|
||||
return blink::WebCachePolicy::kUseProtocolCachePolicy;
|
||||
}
|
||||
|
||||
// Convert blink::WebCachePolicy to cef_urlrequest_flags_t.
|
||||
int GetURCachePolicy(blink::mojom::FetchCacheMode cache_mode) {
|
||||
if (cache_mode == blink::mojom::FetchCacheMode::kUnspecifiedForceCacheMiss) {
|
||||
int GetURCachePolicy(blink::WebCachePolicy web_policy) {
|
||||
if (web_policy == blink::WebCachePolicy::kBypassCacheLoadOnlyFromCache) {
|
||||
return kURCachePolicyMask;
|
||||
} else if (cache_mode == blink::mojom::FetchCacheMode::kBypassCache) {
|
||||
} else if (web_policy == blink::WebCachePolicy::kBypassingCache) {
|
||||
return UR_FLAG_SKIP_CACHE;
|
||||
} else if (cache_mode == blink::mojom::FetchCacheMode::kOnlyIfCached) {
|
||||
} else if (web_policy == blink::WebCachePolicy::kReturnCacheDataDontLoad) {
|
||||
return UR_FLAG_ONLY_FROM_CACHE;
|
||||
}
|
||||
return 0;
|
||||
@@ -445,7 +445,7 @@ uint64 CefRequestImpl::GetIdentifier() {
|
||||
return identifier_;
|
||||
}
|
||||
|
||||
void CefRequestImpl::Set(const net::URLRequest* request) {
|
||||
void CefRequestImpl::Set(net::URLRequest* request) {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
CHECK_READONLY_RETURN_VOID();
|
||||
|
||||
@@ -566,7 +566,7 @@ void CefRequestImpl::Set(const blink::WebURLRequest& request) {
|
||||
|
||||
site_for_cookies_ = request.SiteForCookies();
|
||||
|
||||
flags_ |= GetURCachePolicy(request.GetCacheMode());
|
||||
flags_ |= GetURCachePolicy(request.GetCachePolicy());
|
||||
if (request.AllowStoredCredentials())
|
||||
flags_ |= UR_FLAG_ALLOW_STORED_CREDENTIALS;
|
||||
if (request.ReportUploadProgress())
|
||||
@@ -621,7 +621,7 @@ void CefRequestImpl::Get(blink::WebURLRequest& request,
|
||||
// explicitly set on the request.
|
||||
flags |= GetCacheControlHeaderPolicy(headermap_);
|
||||
}
|
||||
request.SetCacheMode(GetFetchCacheMode(flags));
|
||||
request.SetCachePolicy(GetWebCachePolicy(flags));
|
||||
|
||||
SETBOOLFLAG(request, flags_, SetAllowStoredCredentials,
|
||||
UR_FLAG_ALLOW_STORED_CREDENTIALS);
|
||||
@@ -706,7 +706,7 @@ void CefRequestImpl::Get(const CefMsg_LoadRequest_Params& params,
|
||||
// explicitly set on the request.
|
||||
flags |= GetCacheControlHeaderPolicy(headerMap);
|
||||
}
|
||||
request.SetCacheMode(GetFetchCacheMode(flags));
|
||||
request.SetCachePolicy(GetWebCachePolicy(flags));
|
||||
|
||||
SETBOOLFLAG(request, params.load_flags, SetAllowStoredCredentials,
|
||||
UR_FLAG_ALLOW_STORED_CREDENTIALS);
|
||||
@@ -804,7 +804,7 @@ void CefRequestImpl::Get(net::URLFetcher& fetcher,
|
||||
}
|
||||
|
||||
if (!site_for_cookies_.is_empty())
|
||||
fetcher.SetInitiator(url::Origin::Create(site_for_cookies_));
|
||||
fetcher.SetInitiator(url::Origin(site_for_cookies_));
|
||||
|
||||
int flags = flags_;
|
||||
if (!(flags & kURCachePolicyMask)) {
|
||||
@@ -1415,7 +1415,8 @@ void CefPostDataElementImpl::Get(blink::WebHTTPBody::Element& element) const {
|
||||
data_.bytes.size);
|
||||
} else if (type_ == PDE_TYPE_FILE) {
|
||||
element.type = blink::WebHTTPBody::Element::kTypeFile;
|
||||
element.file_path = blink::WebString::FromUTF16(CefString(&data_.filename));
|
||||
element.file_path.Assign(
|
||||
blink::WebString::FromUTF16(CefString(&data_.filename)));
|
||||
} else {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
@@ -80,7 +80,7 @@ class CefRequestImpl : public CefRequest {
|
||||
uint64 GetIdentifier() override;
|
||||
|
||||
// Populate this object from the URLRequest object.
|
||||
void Set(const net::URLRequest* request);
|
||||
void Set(net::URLRequest* request);
|
||||
|
||||
// Populate the URLRequest object from this object.
|
||||
// If |changed_only| is true then only the changed fields will be updated.
|
||||
|
@@ -7,7 +7,9 @@
|
||||
"renderer": [
|
||||
"blink::mojom::BudgetService",
|
||||
"metrics::mojom::LeakDetector",
|
||||
"mojom::ModuleEventSink"
|
||||
"mojom::ModuleEventSink",
|
||||
"spellcheck::mojom::SpellCheckHost",
|
||||
"startup_metric_utils::mojom::StartupMetricHost"
|
||||
]
|
||||
},
|
||||
"requires": {
|
||||
|
@@ -6,9 +6,6 @@
|
||||
"browser": [
|
||||
"spellcheck::mojom::SpellChecker"
|
||||
]
|
||||
},
|
||||
"requires": {
|
||||
"chrome": [ "renderer" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -219,7 +219,7 @@ CefValueType CefValueImpl::GetType() {
|
||||
return VTYPE_LIST;
|
||||
|
||||
if (value_) {
|
||||
switch (value_->type()) {
|
||||
switch (value_->GetType()) {
|
||||
case base::Value::Type::NONE:
|
||||
return VTYPE_NULL;
|
||||
case base::Value::Type::BOOLEAN:
|
||||
@@ -345,7 +345,7 @@ void CefValueImpl::SetValueInternal(base::Value* value) {
|
||||
list_value_ = NULL;
|
||||
|
||||
if (value) {
|
||||
switch (value->type()) {
|
||||
switch (value->GetType()) {
|
||||
case base::Value::Type::BINARY:
|
||||
binary_value_ = new CefBinaryValueImpl(value, true);
|
||||
return;
|
||||
@@ -731,7 +731,7 @@ CefValueType CefDictionaryValueImpl::GetType(const CefString& key) {
|
||||
const base::Value* out_value = NULL;
|
||||
if (const_value().GetWithoutPathExpansion(base::StringPiece(key),
|
||||
&out_value)) {
|
||||
switch (out_value->type()) {
|
||||
switch (out_value->GetType()) {
|
||||
case base::Value::Type::NONE:
|
||||
return VTYPE_NULL;
|
||||
case base::Value::Type::BOOLEAN:
|
||||
@@ -1140,7 +1140,7 @@ CefValueType CefListValueImpl::GetType(size_t index) {
|
||||
|
||||
const base::Value* out_value = NULL;
|
||||
if (const_value().Get(index, &out_value)) {
|
||||
switch (out_value->type()) {
|
||||
switch (out_value->GetType()) {
|
||||
case base::Value::Type::NONE:
|
||||
return VTYPE_NULL;
|
||||
case base::Value::Type::BOOLEAN:
|
||||
|
@@ -180,10 +180,10 @@ void GetPluginInfo(const base::FilePath& cdm_adapter_path,
|
||||
kWidevineCdmPluginMimeType, kWidevineCdmPluginExtension,
|
||||
kWidevineCdmPluginMimeTypeDescription);
|
||||
|
||||
widevine_cdm_mime_type.additional_params.emplace_back(
|
||||
content::WebPluginMimeType::Param(
|
||||
base::ASCIIToUTF16(kCdmSupportedCodecsParamName),
|
||||
base::ASCIIToUTF16(cdm_codecs)));
|
||||
widevine_cdm_mime_type.additional_param_names.push_back(
|
||||
base::ASCIIToUTF16(kCdmSupportedCodecsParamName));
|
||||
widevine_cdm_mime_type.additional_param_values.push_back(
|
||||
base::ASCIIToUTF16(cdm_codecs));
|
||||
|
||||
widevine_cdm->mime_types.push_back(widevine_cdm_mime_type);
|
||||
widevine_cdm->permissions = kWidevineCdmPluginPermissions;
|
||||
|
@@ -718,9 +718,9 @@ void CefBrowserImpl::OnLoadError(blink::WebLocalFrame* frame,
|
||||
if (load_handler.get()) {
|
||||
CefRefPtr<CefFrameImpl> cef_frame = GetWebFrameImpl(frame);
|
||||
const cef_errorcode_t errorCode =
|
||||
static_cast<cef_errorcode_t>(error.reason());
|
||||
const std::string& errorText = net::ErrorToString(error.reason());
|
||||
const GURL& failedUrl = error.url();
|
||||
static_cast<cef_errorcode_t>(error.reason);
|
||||
const std::string& errorText = error.localized_description.Utf8();
|
||||
const GURL& failedUrl = error.unreachable_url;
|
||||
load_handler->OnLoadError(this, cef_frame.get(), errorCode, errorText,
|
||||
failedUrl.spec());
|
||||
}
|
||||
|
@@ -26,6 +26,10 @@
|
||||
#include "libcef/renderer/browser_impl.h"
|
||||
#include "libcef/renderer/extensions/extensions_renderer_client.h"
|
||||
#include "libcef/renderer/extensions/print_render_frame_helper_delegate.h"
|
||||
#include "libcef/renderer/media/cef_key_systems.h"
|
||||
#include "libcef/renderer/pepper/pepper_helper.h"
|
||||
#include "libcef/renderer/plugins/cef_plugin_placeholder.h"
|
||||
#include "libcef/renderer/plugins/plugin_preroller.h"
|
||||
#include "libcef/renderer/render_frame_observer.h"
|
||||
#include "libcef/renderer/render_message_filter.h"
|
||||
#include "libcef/renderer/render_thread_observer.h"
|
||||
@@ -43,14 +47,14 @@
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/common/constants.mojom.h"
|
||||
#include "chrome/common/pepper_permission_util.h"
|
||||
#include "chrome/common/url_constants.h"
|
||||
#include "chrome/renderer/chrome_content_renderer_client.h"
|
||||
#include "chrome/grit/generated_resources.h"
|
||||
#include "chrome/grit/renderer_resources.h"
|
||||
#include "chrome/renderer/content_settings_observer.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"
|
||||
#include "chrome/renderer/plugins/power_saver_info.h"
|
||||
#include "components/content_settings/core/common/content_settings_types.h"
|
||||
#include "components/nacl/common/nacl_constants.h"
|
||||
#include "components/printing/renderer/print_render_frame_helper.h"
|
||||
@@ -66,6 +70,7 @@
|
||||
#include "content/public/common/content_paths.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "content/public/renderer/plugin_instance_throttler.h"
|
||||
#include "content/public/renderer/render_thread.h"
|
||||
#include "content/public/renderer/render_view.h"
|
||||
#include "content/public/renderer/render_view_visitor.h"
|
||||
#include "content/renderer/render_widget.h"
|
||||
@@ -74,10 +79,6 @@
|
||||
#include "ipc/ipc_sync_channel.h"
|
||||
#include "media/base/media.h"
|
||||
#include "printing/print_settings.h"
|
||||
#include "services/service_manager/public/cpp/connector.h"
|
||||
#include "services/service_manager/public/cpp/interface_provider.h"
|
||||
#include "third_party/WebKit/common/associated_interfaces/associated_interface_provider.h"
|
||||
#include "third_party/WebKit/public/platform/Platform.h"
|
||||
#include "third_party/WebKit/public/platform/URLConversion.h"
|
||||
#include "third_party/WebKit/public/platform/WebPrerenderingSupport.h"
|
||||
#include "third_party/WebKit/public/platform/WebRuntimeFeatures.h"
|
||||
@@ -130,6 +131,34 @@ class CefPrerendererClient : public content::RenderViewObserver,
|
||||
bool IsPrefetchOnly() override { return false; }
|
||||
};
|
||||
|
||||
void AppendParams(const std::vector<base::string16>& additional_names,
|
||||
const std::vector<base::string16>& additional_values,
|
||||
blink::WebVector<blink::WebString>* existing_names,
|
||||
blink::WebVector<blink::WebString>* existing_values) {
|
||||
DCHECK(additional_names.size() == additional_values.size());
|
||||
DCHECK(existing_names->size() == existing_values->size());
|
||||
|
||||
size_t existing_size = existing_names->size();
|
||||
size_t total_size = existing_size + additional_names.size();
|
||||
|
||||
blink::WebVector<blink::WebString> names(total_size);
|
||||
blink::WebVector<blink::WebString> values(total_size);
|
||||
|
||||
for (size_t i = 0; i < existing_size; ++i) {
|
||||
names[i] = (*existing_names)[i];
|
||||
values[i] = (*existing_values)[i];
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < additional_names.size(); ++i) {
|
||||
names[existing_size + i] = blink::WebString::FromUTF16(additional_names[i]);
|
||||
values[existing_size + i] =
|
||||
blink::WebString::FromUTF16(additional_values[i]);
|
||||
}
|
||||
|
||||
existing_names->Swap(names);
|
||||
existing_values->Swap(values);
|
||||
}
|
||||
|
||||
bool IsStandaloneExtensionProcess() {
|
||||
return extensions::ExtensionsEnabled() &&
|
||||
extensions::CefExtensionsRendererClient::
|
||||
@@ -290,9 +319,6 @@ void CefContentRendererClient::WebKitInitialized() {
|
||||
}
|
||||
}
|
||||
|
||||
url_loader_factory_ =
|
||||
blink::Platform::Current()->CreateDefaultURLLoaderFactory();
|
||||
|
||||
// Notify the render process handler.
|
||||
CefRefPtr<CefApp> application = CefContentClient::Get()->application();
|
||||
if (application.get()) {
|
||||
@@ -303,6 +329,21 @@ void CefContentRendererClient::WebKitInitialized() {
|
||||
}
|
||||
}
|
||||
|
||||
void CefContentRendererClient::DevToolsAgentAttached() {
|
||||
CEF_REQUIRE_RT();
|
||||
++devtools_agent_count_;
|
||||
}
|
||||
|
||||
void CefContentRendererClient::DevToolsAgentDetached() {
|
||||
CEF_REQUIRE_RT();
|
||||
--devtools_agent_count_;
|
||||
if (devtools_agent_count_ == 0 && uncaught_exception_stack_size_ > 0) {
|
||||
// When the last DevToolsAgent is detached the stack size is set to 0.
|
||||
// Restore the user-specified stack size here.
|
||||
CefV8SetUncaughtExceptionStackSize(uncaught_exception_stack_size_);
|
||||
}
|
||||
}
|
||||
|
||||
scoped_refptr<base::SingleThreadTaskRunner>
|
||||
CefContentRendererClient::GetCurrentTaskRunner() {
|
||||
// Check if currently on the render thread.
|
||||
@@ -360,7 +401,7 @@ void CefContentRendererClient::RenderThreadStarted() {
|
||||
thread->GetChannel()->AddFilter(new CefRenderMessageFilter);
|
||||
|
||||
if (!command_line->HasSwitch(switches::kDisableSpellChecking)) {
|
||||
spellcheck_.reset(new SpellCheck(this));
|
||||
spellcheck_.reset(new SpellCheck());
|
||||
thread->AddObserver(spellcheck_.get());
|
||||
}
|
||||
|
||||
@@ -433,7 +474,7 @@ void CefContentRendererClient::RenderFrameCreated(
|
||||
new CefRenderFrameObserver(render_frame);
|
||||
service_manager::BinderRegistry* registry = render_frame_observer->registry();
|
||||
|
||||
new PepperHelper(render_frame);
|
||||
new CefPepperHelper(render_frame);
|
||||
new printing::PrintRenderFrameHelper(
|
||||
render_frame,
|
||||
base::WrapUnique(new extensions::CefPrintRenderFrameHelperDelegate()));
|
||||
@@ -445,15 +486,16 @@ void CefContentRendererClient::RenderFrameCreated(
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
if (!command_line->HasSwitch(switches::kDisableSpellChecking)) {
|
||||
SpellCheckProvider* spell_check_provider =
|
||||
new SpellCheckProvider(render_frame, spellcheck_.get(), this);
|
||||
new SpellCheckProvider(render_frame, spellcheck_.get());
|
||||
// TODO(xiaochengh): Design better way to sync between Chrome-side and
|
||||
// Blink-side spellcheck enabled states. See crbug.com/710097.
|
||||
//
|
||||
// TODO(alexmos): Do this for all frames so that this works properly for
|
||||
// OOPIFs. See https://crbug.com/789273.
|
||||
if (render_frame->IsMainFrame())
|
||||
if (render_frame->IsMainFrame()) {
|
||||
spell_check_provider->EnableSpellcheck(
|
||||
spellcheck_->IsSpellcheckEnabled());
|
||||
}
|
||||
}
|
||||
|
||||
BrowserCreated(render_frame->GetRenderView(), render_frame);
|
||||
@@ -463,6 +505,9 @@ void CefContentRendererClient::RenderViewCreated(
|
||||
content::RenderView* render_view) {
|
||||
new CefPrerendererClient(render_view);
|
||||
|
||||
if (extensions::ExtensionsEnabled())
|
||||
extensions_renderer_client_->RenderViewCreated(render_view);
|
||||
|
||||
BrowserCreated(render_view, render_view->GetMainRenderFrame());
|
||||
}
|
||||
|
||||
@@ -478,13 +523,13 @@ bool CefContentRendererClient::OverrideCreatePlugin(
|
||||
}
|
||||
|
||||
GURL url(params.url);
|
||||
chrome::mojom::PluginInfoPtr plugin_info = chrome::mojom::PluginInfo::New();
|
||||
ChromeContentRendererClient::GetPluginInfoHost()->GetPluginInfo(
|
||||
CefViewHostMsg_GetPluginInfo_Output output;
|
||||
render_frame->Send(new CefViewHostMsg_GetPluginInfo(
|
||||
render_frame->GetRoutingID(), url,
|
||||
render_frame->GetWebFrame()->Parent() == nullptr,
|
||||
render_frame->GetWebFrame()->Top()->GetSecurityOrigin(), orig_mime_type,
|
||||
&plugin_info);
|
||||
*plugin = ChromeContentRendererClient::CreatePlugin(render_frame, params,
|
||||
*plugin_info);
|
||||
&output));
|
||||
*plugin = CreatePlugin(render_frame, params, output);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -610,7 +655,7 @@ CefContentRendererClient::CreateBrowserPluginDelegate(
|
||||
|
||||
void CefContentRendererClient::AddSupportedKeySystems(
|
||||
std::vector<std::unique_ptr<::media::KeySystemProperties>>* key_systems) {
|
||||
AddChromeKeySystems(key_systems);
|
||||
AddCefKeySystems(key_systems);
|
||||
}
|
||||
|
||||
void CefContentRendererClient::RunScriptsAtDocumentStart(
|
||||
@@ -631,38 +676,158 @@ void CefContentRendererClient::RunScriptsAtDocumentIdle(
|
||||
extensions_renderer_client_->RunScriptsAtDocumentIdle(render_frame);
|
||||
}
|
||||
|
||||
void CefContentRendererClient::DevToolsAgentAttached(
|
||||
content::RenderFrame* render_frame,
|
||||
int session_id) {
|
||||
CEF_REQUIRE_RT();
|
||||
++devtools_agent_count_;
|
||||
}
|
||||
|
||||
void CefContentRendererClient::DevToolsAgentDetached(
|
||||
content::RenderFrame* render_frame,
|
||||
int session_id) {
|
||||
CEF_REQUIRE_RT();
|
||||
--devtools_agent_count_;
|
||||
if (devtools_agent_count_ == 0 && uncaught_exception_stack_size_ > 0) {
|
||||
// When the last DevToolsAgent is detached the stack size is set to 0.
|
||||
// Restore the user-specified stack size here.
|
||||
CefV8SetUncaughtExceptionStackSize(uncaught_exception_stack_size_);
|
||||
}
|
||||
}
|
||||
|
||||
void CefContentRendererClient::GetInterface(
|
||||
const std::string& interface_name,
|
||||
mojo::ScopedMessagePipeHandle interface_pipe) {
|
||||
content::RenderThread::Get()->GetConnector()->BindInterface(
|
||||
service_manager::Identity(chrome::mojom::kServiceName), interface_name,
|
||||
std::move(interface_pipe));
|
||||
}
|
||||
|
||||
void CefContentRendererClient::WillDestroyCurrentMessageLoop() {
|
||||
base::AutoLock lock_scope(single_process_cleanup_lock_);
|
||||
single_process_cleanup_complete_ = true;
|
||||
}
|
||||
|
||||
// static
|
||||
blink::WebPlugin* CefContentRendererClient::CreatePlugin(
|
||||
content::RenderFrame* render_frame,
|
||||
const blink::WebPluginParams& original_params,
|
||||
const CefViewHostMsg_GetPluginInfo_Output& output) {
|
||||
const content::WebPluginInfo& info = output.plugin;
|
||||
const std::string& actual_mime_type = output.actual_mime_type;
|
||||
const base::string16& group_name = output.group_name;
|
||||
const std::string& identifier = output.group_identifier;
|
||||
CefViewHostMsg_GetPluginInfo_Status status = output.status;
|
||||
GURL url(original_params.url);
|
||||
std::string orig_mime_type = original_params.mime_type.Utf8();
|
||||
CefPluginPlaceholder* placeholder = NULL;
|
||||
|
||||
// If the browser plugin is to be enabled, this should be handled by the
|
||||
// renderer, so the code won't reach here due to the early exit in
|
||||
// OverrideCreatePlugin.
|
||||
if (status == CefViewHostMsg_GetPluginInfo_Status::kNotFound ||
|
||||
orig_mime_type == content::kBrowserPluginMimeType) {
|
||||
placeholder = CefPluginPlaceholder::CreateLoadableMissingPlugin(
|
||||
render_frame, original_params);
|
||||
} else {
|
||||
// TODO(bauerb): This should be in content/.
|
||||
blink::WebPluginParams params(original_params);
|
||||
for (const auto& mime_type : info.mime_types) {
|
||||
if (mime_type.mime_type == actual_mime_type) {
|
||||
AppendParams(mime_type.additional_param_names,
|
||||
mime_type.additional_param_values, ¶ms.attribute_names,
|
||||
¶ms.attribute_values);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (params.mime_type.IsNull() && (actual_mime_type.size() > 0)) {
|
||||
// Webkit might say that mime type is null while we already know the
|
||||
// actual mime type via CefViewHostMsg_GetPluginInfo. In that case
|
||||
// we should use what we know since WebpluginDelegateProxy does some
|
||||
// specific initializations based on this information.
|
||||
params.mime_type = blink::WebString::FromUTF8(actual_mime_type);
|
||||
}
|
||||
|
||||
auto create_blocked_plugin = [&render_frame, ¶ms, &info, &identifier,
|
||||
&group_name](int template_id,
|
||||
const base::string16& message) {
|
||||
return CefPluginPlaceholder::CreateBlockedPlugin(
|
||||
render_frame, params, info, identifier, group_name, template_id,
|
||||
message, PowerSaverInfo());
|
||||
};
|
||||
blink::WebLocalFrame* frame = render_frame->GetWebFrame();
|
||||
switch (status) {
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kNotFound: {
|
||||
NOTREACHED();
|
||||
break;
|
||||
}
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kAllowed:
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kPlayImportantContent: {
|
||||
// Delay loading plugins if prerendering.
|
||||
// TODO(mmenke): In the case of prerendering, feed into
|
||||
// CefContentRendererClient::CreatePlugin instead, to
|
||||
// reduce the chance of future regressions.
|
||||
bool is_prerendering = false;
|
||||
bool power_saver_setting_on =
|
||||
status ==
|
||||
CefViewHostMsg_GetPluginInfo_Status::kPlayImportantContent;
|
||||
|
||||
PowerSaverInfo power_saver_info =
|
||||
PowerSaverInfo::Get(render_frame, power_saver_setting_on, params,
|
||||
info, frame->GetDocument().Url());
|
||||
if (power_saver_info.blocked_for_background_tab || is_prerendering ||
|
||||
!power_saver_info.poster_attribute.empty()) {
|
||||
placeholder = CefPluginPlaceholder::CreateBlockedPlugin(
|
||||
render_frame, params, info, identifier, group_name,
|
||||
power_saver_info.poster_attribute.empty()
|
||||
? IDR_BLOCKED_PLUGIN_HTML
|
||||
: IDR_PLUGIN_POSTER_HTML,
|
||||
l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name),
|
||||
power_saver_info);
|
||||
placeholder->set_blocked_for_prerendering(is_prerendering);
|
||||
placeholder->AllowLoading();
|
||||
break;
|
||||
}
|
||||
|
||||
std::unique_ptr<content::PluginInstanceThrottler> throttler;
|
||||
if (power_saver_info.power_saver_enabled) {
|
||||
throttler = content::PluginInstanceThrottler::Create(
|
||||
content::RenderFrame::DONT_RECORD_DECISION);
|
||||
// PluginPreroller manages its own lifetime.
|
||||
new CefPluginPreroller(
|
||||
render_frame, params, info, identifier, group_name,
|
||||
l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name),
|
||||
throttler.get());
|
||||
}
|
||||
|
||||
return render_frame->CreatePlugin(info, params, std::move(throttler));
|
||||
}
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kDisabled: {
|
||||
// Intentionally using the blocked plugin resources instead of the
|
||||
// disabled plugin resources. This provides better messaging (no link to
|
||||
// chrome://plugins) and adds testing support.
|
||||
placeholder = create_blocked_plugin(
|
||||
IDR_BLOCKED_PLUGIN_HTML,
|
||||
l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED_BY_POLICY,
|
||||
group_name));
|
||||
break;
|
||||
}
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kOutdatedBlocked: {
|
||||
NOTREACHED() << "Plugin installation is not supported.";
|
||||
break;
|
||||
}
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kOutdatedDisallowed: {
|
||||
placeholder = create_blocked_plugin(
|
||||
IDR_BLOCKED_PLUGIN_HTML,
|
||||
l10n_util::GetStringFUTF16(IDS_PLUGIN_OUTDATED, group_name));
|
||||
break;
|
||||
}
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kUnauthorized: {
|
||||
placeholder = create_blocked_plugin(
|
||||
IDR_BLOCKED_PLUGIN_HTML,
|
||||
l10n_util::GetStringFUTF16(IDS_PLUGIN_NOT_AUTHORIZED, group_name));
|
||||
placeholder->AllowLoading();
|
||||
break;
|
||||
}
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kBlocked: {
|
||||
placeholder = create_blocked_plugin(
|
||||
IDR_BLOCKED_PLUGIN_HTML,
|
||||
l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name));
|
||||
placeholder->AllowLoading();
|
||||
content::RenderThread::Get()->RecordAction(
|
||||
base::UserMetricsAction("Plugin_Blocked"));
|
||||
break;
|
||||
}
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kBlockedByPolicy: {
|
||||
placeholder = create_blocked_plugin(
|
||||
IDR_BLOCKED_PLUGIN_HTML,
|
||||
l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED_BY_POLICY,
|
||||
group_name));
|
||||
content::RenderThread::Get()->RecordAction(
|
||||
base::UserMetricsAction("Plugin_BlockedByPolicy"));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
placeholder->SetStatus(status);
|
||||
return placeholder->plugin();
|
||||
}
|
||||
|
||||
void CefContentRendererClient::BrowserCreated(
|
||||
content::RenderView* render_view,
|
||||
content::RenderFrame* render_frame) {
|
||||
|
@@ -18,14 +18,7 @@
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/sequenced_task_runner.h"
|
||||
#include "chrome/common/plugin.mojom.h"
|
||||
#include "content/public/renderer/content_renderer_client.h"
|
||||
#include "content/public/renderer/render_thread.h"
|
||||
#include "services/service_manager/public/cpp/local_interface_provider.h"
|
||||
|
||||
namespace blink {
|
||||
class WebURLLoaderFactory;
|
||||
}
|
||||
|
||||
namespace extensions {
|
||||
class CefExtensionsRendererClient;
|
||||
@@ -44,11 +37,11 @@ class WebCacheImpl;
|
||||
class CefGuestView;
|
||||
class CefRenderThreadObserver;
|
||||
struct Cef_CrossOriginWhiteListEntry_Params;
|
||||
struct CefViewHostMsg_GetPluginInfo_Output;
|
||||
class ChromePDFPrintClient;
|
||||
class SpellCheck;
|
||||
|
||||
class CefContentRendererClient : public content::ContentRendererClient,
|
||||
public service_manager::LocalInterfaceProvider,
|
||||
public base::MessageLoop::DestructionObserver {
|
||||
public:
|
||||
CefContentRendererClient();
|
||||
@@ -81,13 +74,11 @@ class CefContentRendererClient : public content::ContentRendererClient,
|
||||
return uncaught_exception_stack_size_;
|
||||
}
|
||||
|
||||
// Used by CefRenderURLRequest to create WebURLLoaders.
|
||||
blink::WebURLLoaderFactory* url_loader_factory() const {
|
||||
return url_loader_factory_.get();
|
||||
}
|
||||
|
||||
void WebKitInitialized();
|
||||
|
||||
void DevToolsAgentAttached();
|
||||
void DevToolsAgentDetached();
|
||||
|
||||
// Returns the task runner for the current thread. Returns NULL if the current
|
||||
// thread is not the main render process thread.
|
||||
scoped_refptr<base::SingleThreadTaskRunner> GetCurrentTaskRunner();
|
||||
@@ -137,18 +128,15 @@ class CefContentRendererClient : public content::ContentRendererClient,
|
||||
void RunScriptsAtDocumentStart(content::RenderFrame* render_frame) override;
|
||||
void RunScriptsAtDocumentEnd(content::RenderFrame* render_frame) override;
|
||||
void RunScriptsAtDocumentIdle(content::RenderFrame* render_frame) override;
|
||||
void DevToolsAgentAttached(content::RenderFrame* render_frame,
|
||||
int session_id) override;
|
||||
void DevToolsAgentDetached(content::RenderFrame* render_frame,
|
||||
int session_id) override;
|
||||
|
||||
// service_manager::LocalInterfaceProvider implementation.
|
||||
void GetInterface(const std::string& name,
|
||||
mojo::ScopedMessagePipeHandle request_handle) override;
|
||||
|
||||
// MessageLoop::DestructionObserver implementation.
|
||||
void WillDestroyCurrentMessageLoop() override;
|
||||
|
||||
static blink::WebPlugin* CreatePlugin(
|
||||
content::RenderFrame* render_frame,
|
||||
const blink::WebPluginParams& params,
|
||||
const CefViewHostMsg_GetPluginInfo_Output& output);
|
||||
|
||||
private:
|
||||
void BrowserCreated(content::RenderView* render_view,
|
||||
content::RenderFrame* render_frame);
|
||||
@@ -160,7 +148,6 @@ class CefContentRendererClient : public content::ContentRendererClient,
|
||||
std::unique_ptr<CefRenderThreadObserver> observer_;
|
||||
std::unique_ptr<web_cache::WebCacheImpl> web_cache_impl_;
|
||||
std::unique_ptr<SpellCheck> spellcheck_;
|
||||
std::unique_ptr<blink::WebURLLoaderFactory> url_loader_factory_;
|
||||
|
||||
// Map of RenderView pointers to CefBrowserImpl references.
|
||||
typedef std::map<content::RenderView*, CefRefPtr<CefBrowserImpl>> BrowserMap;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user