mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update to Chromium revision 5fdc0fab (#520840)
- Windows now builds with clang by default.
This commit is contained in:
93
BUILD.gn
93
BUILD.gn
@ -105,6 +105,8 @@ import("//media/media_options.gni")
|
||||
import("//mojo/public/tools/bindings/mojom.gni")
|
||||
import("//ppapi/features/features.gni")
|
||||
import("//printing/features/features.gni")
|
||||
import("//services/catalog/public/tools/catalog.gni")
|
||||
import("//services/service_manager/public/service_manifest.gni")
|
||||
import("//third_party/icu/config.gni")
|
||||
import("//third_party/widevine/cdm/widevine.gni")
|
||||
import("//tools/grit/repack.gni")
|
||||
@ -229,17 +231,6 @@ group("cef") {
|
||||
# libcef static target.
|
||||
#
|
||||
|
||||
# Configuration that will be applied to all targets that depend on
|
||||
# libcef_static.
|
||||
config("libcef_static_config") {
|
||||
# CEF targets use includes relative to the CEF root directory.
|
||||
include_dirs = [ "." ]
|
||||
defines = [
|
||||
"BUILDING_CEF_SHARED",
|
||||
"USING_CHROMIUM_INCLUDES",
|
||||
]
|
||||
}
|
||||
|
||||
# Target for building code that accesses Blink internals. Included from the
|
||||
# //third_party/WebKit/Source/web target.
|
||||
source_set("webkit_set") {
|
||||
@ -249,7 +240,7 @@ source_set("webkit_set") {
|
||||
]
|
||||
|
||||
configs += [
|
||||
":libcef_static_config",
|
||||
"libcef/features:config",
|
||||
"//build/config:precompiled_headers",
|
||||
|
||||
# Blink-internal include paths.
|
||||
@ -301,7 +292,7 @@ if (is_win) {
|
||||
]
|
||||
|
||||
configs += [
|
||||
":libcef_static_config",
|
||||
"libcef/features:config",
|
||||
"//build/config:precompiled_headers",
|
||||
]
|
||||
|
||||
@ -491,16 +482,12 @@ 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",
|
||||
@ -642,16 +629,6 @@ 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",
|
||||
@ -675,7 +652,7 @@ static_library("libcef_static") {
|
||||
]
|
||||
|
||||
configs += [
|
||||
":libcef_static_config",
|
||||
"libcef/features:config",
|
||||
"//build/config:precompiled_headers",
|
||||
|
||||
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
|
||||
@ -683,7 +660,7 @@ static_library("libcef_static") {
|
||||
]
|
||||
|
||||
public_configs = [
|
||||
":libcef_static_config",
|
||||
"libcef/features:config",
|
||||
]
|
||||
|
||||
include_dirs = [
|
||||
@ -754,12 +731,13 @@ 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/hid",
|
||||
"//device/geolocation/public/interfaces",
|
||||
"//extensions/browser",
|
||||
"//extensions/browser/api:api_registration",
|
||||
"//extensions/common/api",
|
||||
@ -783,7 +761,7 @@ static_library("libcef_static") {
|
||||
"//skia",
|
||||
"//storage/browser",
|
||||
"//third_party/brotli:dec",
|
||||
"//third_party/cld",
|
||||
"//third_party/cld_3/src/src:cld_3",
|
||||
"//third_party/hunspell",
|
||||
"//third_party/leveldatabase",
|
||||
"//third_party/libxml",
|
||||
@ -887,7 +865,7 @@ static_library("libcef_static") {
|
||||
}
|
||||
|
||||
if (is_win || is_mac) {
|
||||
deps += [ "//third_party/crashpad/crashpad/handler:handler_lib" ]
|
||||
deps += [ "//third_party/crashpad/crashpad/handler" ]
|
||||
}
|
||||
|
||||
if (use_x11) {
|
||||
@ -992,6 +970,11 @@ 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.
|
||||
@ -1074,6 +1057,42 @@ if (is_win) {
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Service manifests.
|
||||
#
|
||||
|
||||
cef_packaged_services = [
|
||||
"//chrome/app:chrome_manifest", # For spell checking.
|
||||
"//services/metrics:manifest",
|
||||
]
|
||||
|
||||
service_manifest("cef_packaged_services_manifest_overlay") {
|
||||
source = "libcef/common/service_manifests/packaged_services_manifest_overlay.json"
|
||||
packaged_services = cef_packaged_services
|
||||
}
|
||||
|
||||
service_manifest("cef_browser_manifest_overlay") {
|
||||
source = "libcef/common/service_manifests/browser_manifest_overlay.json"
|
||||
}
|
||||
|
||||
service_manifest("cef_renderer_manifest_overlay") {
|
||||
source = "libcef/common/service_manifests/renderer_manifest_overlay.json"
|
||||
}
|
||||
|
||||
service_manifest("cef_utility_manifest_overlay") {
|
||||
source = "libcef/common/service_manifests/utility_manifest_overlay.json"
|
||||
}
|
||||
|
||||
group("cef_manifest_overlays") {
|
||||
deps = [
|
||||
":cef_packaged_services_manifest_overlay",
|
||||
":cef_browser_manifest_overlay",
|
||||
":cef_renderer_manifest_overlay",
|
||||
":cef_utility_manifest_overlay",
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Resource grit/pack targets.
|
||||
#
|
||||
@ -1162,6 +1181,7 @@ 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",
|
||||
]
|
||||
|
||||
@ -1172,6 +1192,7 @@ 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",
|
||||
]
|
||||
|
||||
@ -1212,6 +1233,11 @@ grit("cef_resources") {
|
||||
"grit/cef_resources.h",
|
||||
"cef_resources.pak",
|
||||
]
|
||||
grit_flags = [
|
||||
"-E",
|
||||
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
|
||||
]
|
||||
deps = [ ":cef_manifest_overlays" ]
|
||||
}
|
||||
|
||||
# Generate cef.pak.
|
||||
@ -1863,9 +1889,6 @@ 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': 'adb61db19020ed8ecee5e91b1a0ea4c924ae2988',
|
||||
'chromium_checkout': '5fdc0fab22ce7efd32532ee989b223fa12f8171e',
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
#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"
|
||||
@ -68,6 +69,9 @@ 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() {
|
||||
@ -76,6 +80,9 @@ 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(
|
||||
|
@ -389,10 +389,11 @@ bool CefBrowserContextImpl::IsOffTheRecord() const {
|
||||
|
||||
content::DownloadManagerDelegate*
|
||||
CefBrowserContextImpl::GetDownloadManagerDelegate() {
|
||||
DCHECK(!download_manager_delegate_.get());
|
||||
|
||||
content::DownloadManager* manager = BrowserContext::GetDownloadManager(this);
|
||||
if (!download_manager_delegate_) {
|
||||
content::DownloadManager* manager =
|
||||
BrowserContext::GetDownloadManager(this);
|
||||
download_manager_delegate_.reset(new CefDownloadManagerDelegate(manager));
|
||||
}
|
||||
return download_manager_delegate_.get();
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,7 @@
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/render_widget_host.h"
|
||||
#include "content/public/browser/resource_request_info.h"
|
||||
#include "content/public/common/browser_side_navigation_policy.h"
|
||||
#include "content/public/common/favicon_url.h"
|
||||
#include "extensions/browser/process_manager.h"
|
||||
#include "net/base/net_errors.h"
|
||||
@ -2727,8 +2728,12 @@ void CefBrowserHostImpl::DidFinishNavigation(
|
||||
|
||||
// With PlzNavigate the RenderFrameHost will only be nullptr if the
|
||||
// provisional load fails, in which case |error_code| will be ERR_ABORTED.
|
||||
// Without PlzNavigate the RenderFrameHost may be nullptr and |error_code|
|
||||
// may be OK when a pending navigation is canceled (e.g. by calling LoadURL
|
||||
// from OnCertificateError).
|
||||
DCHECK(navigation_handle->GetRenderFrameHost() ||
|
||||
error_code == net::ERR_ABORTED);
|
||||
error_code == net::ERR_ABORTED ||
|
||||
!content::IsBrowserSideNavigationEnabled());
|
||||
|
||||
const int64 frame_id =
|
||||
navigation_handle->GetRenderFrameHost()
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include <string>
|
||||
|
||||
#include "libcef/browser/browser_context_impl.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"
|
||||
@ -25,16 +24,10 @@
|
||||
#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"
|
||||
|
@ -96,12 +96,7 @@ metrics::MetricsService* ChromeBrowserProcessStub::metrics_service() {
|
||||
}
|
||||
|
||||
rappor::RapporServiceImpl* ChromeBrowserProcessStub::rappor_service() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ukm::UkmRecorder* ChromeBrowserProcessStub::ukm_recorder() {
|
||||
NOTREACHED();
|
||||
// Called from PluginInfoHostImpl::ReportMetrics.
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -115,6 +110,12 @@ ChromeBrowserProcessStub::system_network_context_manager() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content::NetworkConnectionTracker*
|
||||
ChromeBrowserProcessStub::network_connection_tracker() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
WatchDogThread* ChromeBrowserProcessStub::watchdog_thread() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
@ -285,6 +286,12 @@ 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
|
||||
@ -311,11 +318,6 @@ 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,6 +87,8 @@ 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;
|
||||
@ -94,7 +96,6 @@ 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,7 +33,6 @@ void ChromeProfileStub::DestroyOffTheRecordProfile() {
|
||||
}
|
||||
|
||||
bool ChromeProfileStub::HasOffTheRecordProfile() {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -41,6 +40,10 @@ Profile* ChromeProfileStub::GetOriginalProfile() {
|
||||
return this;
|
||||
}
|
||||
|
||||
const Profile* ChromeProfileStub::GetOriginalProfile() const {
|
||||
return this;
|
||||
}
|
||||
|
||||
bool ChromeProfileStub::IsSupervised() const {
|
||||
return false;
|
||||
}
|
||||
@ -107,12 +110,6 @@ 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,6 +27,7 @@ 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;
|
||||
@ -40,8 +41,6 @@ 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,8 +19,6 @@
|
||||
#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"
|
||||
@ -43,9 +41,12 @@
|
||||
#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/spellchecker/spell_check_host_impl.h"
|
||||
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/common/constants.mojom.h"
|
||||
#include "chrome/grit/browser_resources.h"
|
||||
#include "components/navigation_interception/intercept_navigation_throttle.h"
|
||||
#include "components/navigation_interception/navigation_params.h"
|
||||
@ -81,6 +82,8 @@
|
||||
#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 "storage/browser/quota/quota_settings.h"
|
||||
#include "third_party/WebKit/public/web/WebWindowFeatures.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
@ -471,9 +474,6 @@ 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(
|
||||
@ -587,6 +587,21 @@ 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] =
|
||||
@ -598,6 +613,8 @@ std::unique_ptr<base::Value> CefContentBrowserClient::GetServiceManifestOverlay(
|
||||
int id = -1;
|
||||
if (name == content::mojom::kBrowserServiceName)
|
||||
id = IDR_CEF_BROWSER_MANIFEST_OVERLAY;
|
||||
else if (name == content::mojom::kPackagedServicesServiceName)
|
||||
id = IDR_CEF_PACKAGED_SERVICES_MANIFEST_OVERLAY;
|
||||
else if (name == content::mojom::kRendererServiceName)
|
||||
id = IDR_CEF_RENDERER_MANIFEST_OVERLAY;
|
||||
else if (name == content::mojom::kUtilityServiceName)
|
||||
@ -890,7 +907,7 @@ void CefContentBrowserClient::DidCreatePpapiPlugin(
|
||||
content::BrowserPpapiHost* browser_host) {
|
||||
browser_host->GetPpapiHost()->AddHostFactoryFilter(
|
||||
std::unique_ptr<ppapi::host::HostFactory>(
|
||||
new CefBrowserPepperHostFactory(browser_host)));
|
||||
new ChromeBrowserPepperHostFactory(browser_host)));
|
||||
}
|
||||
|
||||
content::DevToolsManagerDelegate*
|
||||
@ -935,7 +952,7 @@ CefContentBrowserClient::CreateThrottlesForNavigation(
|
||||
return throttles;
|
||||
}
|
||||
|
||||
#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
||||
#if defined(OS_LINUX)
|
||||
void CefContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
|
||||
const base::CommandLine& command_line,
|
||||
int child_process_id,
|
||||
@ -945,7 +962,7 @@ void CefContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
|
||||
mappings->Share(kCrashDumpSignal, crash_signal_fd);
|
||||
}
|
||||
}
|
||||
#endif // defined(OS_POSIX) && !defined(OS_MACOSX)
|
||||
#endif // defined(OS_LINUX)
|
||||
|
||||
#if defined(OS_WIN)
|
||||
const wchar_t* CefContentBrowserClient::GetResourceDllName() {
|
||||
@ -971,18 +988,12 @@ bool CefContentBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy) {
|
||||
|
||||
void CefContentBrowserClient::ExposeInterfacesToRenderer(
|
||||
service_manager::BinderRegistry* registry,
|
||||
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);
|
||||
}
|
||||
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)));
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::RegisterCustomScheme(const std::string& scheme) {
|
||||
|
@ -49,6 +49,7 @@ 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;
|
||||
@ -104,7 +105,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
CreateThrottlesForNavigation(
|
||||
content::NavigationHandle* navigation_handle) override;
|
||||
|
||||
#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
||||
#if defined(OS_LINUX)
|
||||
void GetAdditionalMappedFilesForChildProcess(
|
||||
const base::CommandLine& command_line,
|
||||
int child_process_id,
|
||||
@ -118,7 +119,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
|
||||
void ExposeInterfacesToRenderer(
|
||||
service_manager::BinderRegistry* registry,
|
||||
content::AssociatedInterfaceRegistry* associated_registry,
|
||||
blink::AssociatedInterfaceRegistry* associated_registry,
|
||||
content::RenderProcessHost* render_process_host) override;
|
||||
|
||||
// Perform browser process registration for the custom scheme.
|
||||
|
@ -564,13 +564,15 @@ void CefCookieManagerImpl::SetCookieInternal(
|
||||
if (cookie.has_expires)
|
||||
cef_time_to_basetime(cookie.expires, expiration_time);
|
||||
|
||||
cookie_store->SetCookieWithDetailsAsync(
|
||||
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,
|
||||
net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT),
|
||||
cookie.secure ? true : false, cookie.httponly ? true : false,
|
||||
base::Bind(SetCookieCallbackImpl, callback));
|
||||
}
|
||||
|
||||
|
@ -455,8 +455,7 @@ void CefDevToolsFrontend::SendMessageAck(int request_id,
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::AgentHostClosed(
|
||||
content::DevToolsAgentHost* agent_host,
|
||||
bool replaced) {
|
||||
content::DevToolsAgentHost* agent_host) {
|
||||
DCHECK(agent_host == agent_host_.get());
|
||||
agent_host_ = nullptr;
|
||||
Close();
|
||||
|
@ -65,8 +65,7 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
|
||||
~CefDevToolsFrontend() override;
|
||||
|
||||
// content::DevToolsAgentHostClient implementation.
|
||||
void AgentHostClosed(content::DevToolsAgentHost* agent_host,
|
||||
bool replaced) override;
|
||||
void AgentHostClosed(content::DevToolsAgentHost* agent_host) override;
|
||||
void DispatchProtocolMessage(content::DevToolsAgentHost* agent_host,
|
||||
const std::string& message) override;
|
||||
void SetPreferences(const std::string& json);
|
||||
|
@ -107,6 +107,11 @@ 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,7 +231,8 @@ bool ExecuteCodeInTabFunction::LoadFile(const std::string& file) {
|
||||
void ExecuteCodeInTabFunction::LoadFileComplete(
|
||||
const std::string& file,
|
||||
std::unique_ptr<std::string> data) {
|
||||
DidLoadAndLocalizeFile(file, !!data.get(), std::move(data));
|
||||
const bool success = !!data.get();
|
||||
DidLoadAndLocalizeFile(file, success, std::move(data));
|
||||
}
|
||||
|
||||
bool TabsExecuteScriptFunction::ShouldInsertCSS() const {
|
||||
|
@ -6,6 +6,9 @@
|
||||
|
||||
#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"
|
||||
@ -17,10 +20,13 @@ namespace cef {
|
||||
void EnsureBrowserContextKeyedServiceFactoriesBuilt() {
|
||||
AlarmManager::GetFactoryInstance();
|
||||
CookieSettingsFactory::GetInstance();
|
||||
PluginPrefsFactory::GetInstance();
|
||||
PrefsTabHelper::GetServiceInstance();
|
||||
RendererStartupHelperFactory::GetInstance();
|
||||
SpellcheckServiceFactory::GetInstance();
|
||||
StorageFrontend::GetFactoryInstance();
|
||||
StreamsPrivateAPI::GetFactoryInstance();
|
||||
ThemeServiceFactory::GetInstance();
|
||||
}
|
||||
|
||||
} // namespace cef
|
||||
|
@ -92,7 +92,7 @@ class CefGetExtensionLoadFileCallbackImpl
|
||||
static std::unique_ptr<std::string> LoadFileFromStream(
|
||||
const std::string& file,
|
||||
CefRefPtr<CefStreamReader> stream) {
|
||||
base::ThreadRestrictions::AssertIOAllowed();
|
||||
base::AssertBlockingAllowed();
|
||||
|
||||
// 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::ThreadRestrictions::AssertIOAllowed();
|
||||
base::AssertBlockingAllowed();
|
||||
|
||||
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::ThreadRestrictions::AssertIOAllowed();
|
||||
base::AssertBlockingAllowed();
|
||||
|
||||
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(GURL(content::kChromeUIResourcesURL)));
|
||||
policy->GrantOrigin(
|
||||
process_id, url::Origin::Create(GURL(content::kChromeUIResourcesURL)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,10 +124,14 @@ CefExtensionsBrowserClient::MaybeCreateResourceBundleRequestJob(
|
||||
}
|
||||
|
||||
bool CefExtensionsBrowserClient::AllowCrossRendererResourceLoad(
|
||||
net::URLRequest* request,
|
||||
const GURL& url,
|
||||
content::ResourceType resource_type,
|
||||
ui::PageTransition page_transition,
|
||||
int child_id,
|
||||
bool is_incognito,
|
||||
const Extension* extension,
|
||||
InfoMap* extension_info_map) {
|
||||
const ExtensionSet& extensions,
|
||||
const ProcessMap& process_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"
|
||||
@ -137,7 +141,8 @@ bool CefExtensionsBrowserClient::AllowCrossRendererResourceLoad(
|
||||
|
||||
bool allowed = false;
|
||||
if (url_request_util::AllowCrossRendererResourceLoad(
|
||||
request, is_incognito, extension, extension_info_map, &allowed)) {
|
||||
url, resource_type, page_transition, child_id, is_incognito,
|
||||
extension, extensions, process_map, &allowed)) {
|
||||
return allowed;
|
||||
}
|
||||
|
||||
|
@ -51,10 +51,14 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
|
||||
const base::FilePath& directory_path,
|
||||
const std::string& content_security_policy,
|
||||
bool send_cors_header) override;
|
||||
bool AllowCrossRendererResourceLoad(net::URLRequest* request,
|
||||
bool AllowCrossRendererResourceLoad(const GURL& url,
|
||||
content::ResourceType resource_type,
|
||||
ui::PageTransition page_transition,
|
||||
int child_id,
|
||||
bool is_incognito,
|
||||
const Extension* extension,
|
||||
InfoMap* extension_info_map) override;
|
||||
const ExtensionSet& extensions,
|
||||
const ProcessMap& process_map) override;
|
||||
PrefService* GetPrefServiceForContext(
|
||||
content::BrowserContext* context) override;
|
||||
void GetEarlyExtensionPrefsObservers(
|
||||
|
@ -10,10 +10,26 @@
|
||||
#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();
|
||||
@ -39,7 +55,10 @@ ValueStore::ReadResult CefValueStore::Get(const std::string& key) {
|
||||
ValueStore::ReadResult CefValueStore::Get(
|
||||
const std::vector<std::string>& keys) {
|
||||
read_count_++;
|
||||
base::DictionaryValue* settings = new base::DictionaryValue();
|
||||
if (!status_.ok())
|
||||
return ReadResult(CreateStatusCopy(status_));
|
||||
|
||||
auto settings = std::make_unique<base::DictionaryValue>();
|
||||
for (std::vector<std::string>::const_iterator it = keys.begin();
|
||||
it != keys.end(); ++it) {
|
||||
base::Value* value = NULL;
|
||||
@ -47,12 +66,14 @@ ValueStore::ReadResult CefValueStore::Get(
|
||||
settings->SetWithoutPathExpansion(*it, value->CreateDeepCopy());
|
||||
}
|
||||
}
|
||||
return MakeReadResult(base::WrapUnique(settings), status_);
|
||||
return ReadResult(std::move(settings), CreateStatusCopy(status_));
|
||||
}
|
||||
|
||||
ValueStore::ReadResult CefValueStore::Get() {
|
||||
read_count_++;
|
||||
return MakeReadResult(storage_.CreateDeepCopy(), status_);
|
||||
if (!status_.ok())
|
||||
return ReadResult(CreateStatusCopy(status_));
|
||||
return ReadResult(storage_.CreateDeepCopy(), CreateStatusCopy(status_));
|
||||
}
|
||||
|
||||
ValueStore::WriteResult CefValueStore::Set(WriteOptions options,
|
||||
@ -67,6 +88,9 @@ 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()) {
|
||||
@ -79,7 +103,7 @@ ValueStore::WriteResult CefValueStore::Set(
|
||||
storage_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy());
|
||||
}
|
||||
}
|
||||
return MakeWriteResult(std::move(changes), status_);
|
||||
return WriteResult(std::move(changes), CreateStatusCopy(status_));
|
||||
}
|
||||
|
||||
ValueStore::WriteResult CefValueStore::Remove(const std::string& key) {
|
||||
@ -89,6 +113,9 @@ 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) {
|
||||
@ -97,7 +124,7 @@ ValueStore::WriteResult CefValueStore::Remove(
|
||||
changes->push_back(ValueStoreChange(*it, std::move(old_value), nullptr));
|
||||
}
|
||||
}
|
||||
return MakeWriteResult(std::move(changes), status_);
|
||||
return WriteResult(std::move(changes), CreateStatusCopy(status_));
|
||||
}
|
||||
|
||||
ValueStore::WriteResult CefValueStore::Clear() {
|
||||
|
@ -31,6 +31,10 @@ 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/geoposition.h"
|
||||
#include "device/geolocation/public/interfaces/geoposition.mojom.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@ -31,7 +31,7 @@ class CefLocationRequest
|
||||
|
||||
~CefLocationRequest() {}
|
||||
|
||||
void OnLocationUpdate(const device::Geoposition& position) {
|
||||
void OnLocationUpdate(const device::mojom::Geoposition& position) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (callback_.get()) {
|
||||
CefGeoposition cef_position;
|
||||
@ -43,7 +43,8 @@ class CefLocationRequest
|
||||
geo_callback_.Reset();
|
||||
}
|
||||
|
||||
void SetPosition(const device::Geoposition& source, CefGeoposition& target) {
|
||||
void SetPosition(const device::mojom::Geoposition& source,
|
||||
CefGeoposition& target) {
|
||||
target.latitude = source.latitude;
|
||||
target.longitude = source.longitude;
|
||||
target.altitude = source.altitude;
|
||||
@ -54,16 +55,16 @@ class CefLocationRequest
|
||||
cef_time_from_basetime(source.timestamp, target.timestamp);
|
||||
|
||||
switch (source.error_code) {
|
||||
case device::Geoposition::ERROR_CODE_NONE:
|
||||
case device::mojom::Geoposition::ErrorCode::NONE:
|
||||
target.error_code = GEOPOSITON_ERROR_NONE;
|
||||
break;
|
||||
case device::Geoposition::ERROR_CODE_PERMISSION_DENIED:
|
||||
case device::mojom::Geoposition::ErrorCode::PERMISSION_DENIED:
|
||||
target.error_code = GEOPOSITON_ERROR_PERMISSION_DENIED;
|
||||
break;
|
||||
case device::Geoposition::ERROR_CODE_POSITION_UNAVAILABLE:
|
||||
case device::mojom::Geoposition::ErrorCode::POSITION_UNAVAILABLE:
|
||||
target.error_code = GEOPOSITON_ERROR_POSITION_UNAVAILABLE;
|
||||
break;
|
||||
case device::Geoposition::ERROR_CODE_TIMEOUT:
|
||||
case device::mojom::Geoposition::ErrorCode::TIMEOUT:
|
||||
target.error_code = GEOPOSITON_ERROR_TIMEOUT;
|
||||
break;
|
||||
}
|
||||
|
@ -137,6 +137,7 @@ 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,6 +36,7 @@ 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,
|
||||
|
@ -95,23 +95,6 @@ void ExecuteExternalProtocol(const GURL& url) {
|
||||
ShellExecuteA(NULL, "open", address.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
}
|
||||
|
||||
WORD KeyStatesToWord() {
|
||||
static const USHORT kHighBitMaskShort = 0x8000;
|
||||
WORD result = 0;
|
||||
|
||||
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
|
||||
|
||||
CefBrowserPlatformDelegateNativeWin::CefBrowserPlatformDelegateNativeWin(
|
||||
@ -387,8 +370,9 @@ 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), 0);
|
||||
ui::KeyboardCodeForWindowsKeyCode(key_event.windows_key_code), &flags);
|
||||
}
|
||||
|
||||
if (result.GetType() == blink::WebInputEvent::kChar ||
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include <commdlg.h>
|
||||
#include <shlobj.h>
|
||||
#include <wrl/client.h>
|
||||
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
|
||||
@ -15,7 +16,6 @@
|
||||
#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;
|
||||
base::win::ScopedComPtr<IShellFolder> shell_folder;
|
||||
Microsoft::WRL::ComPtr<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 MenuController;
|
||||
@class MenuControllerCocoa;
|
||||
#else
|
||||
class MenuController;
|
||||
class MenuControllerCocoa;
|
||||
#endif
|
||||
|
||||
class CefMenuRunnerMac : public CefMenuRunner {
|
||||
@ -28,7 +28,7 @@ class CefMenuRunnerMac : public CefMenuRunner {
|
||||
void CancelContextMenu() override;
|
||||
|
||||
private:
|
||||
base::scoped_nsobject<MenuController> menu_controller_;
|
||||
base::scoped_nsobject<MenuControllerCocoa> menu_controller_;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_NATIVE_MENU_RUNNER_MAC_H_
|
||||
|
@ -21,14 +21,16 @@ bool CefMenuRunnerMac::RunContextMenu(
|
||||
CefMenuModelImpl* model,
|
||||
const content::ContextMenuParams& params) {
|
||||
// Create a menu controller based on the model.
|
||||
menu_controller_.reset([[MenuController alloc] initWithModel:model->model()
|
||||
menu_controller_.reset([[MenuControllerCocoa 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<MenuController> menu_controller_ref(menu_controller_);
|
||||
base::scoped_nsobject<MenuControllerCocoa> 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:
|
||||
explicit MenuHostWindow(CefNativeMenuWin* parent) : parent_(parent) {
|
||||
MenuHostWindow() {
|
||||
RegisterClass();
|
||||
hwnd_ = CreateWindowEx(l10n_util::GetExtendedStyles(), kWindowClassName,
|
||||
L"", 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL);
|
||||
@ -389,7 +389,6 @@ class CefNativeMenuWin::MenuHostWindow {
|
||||
}
|
||||
|
||||
HWND hwnd_;
|
||||
CefNativeMenuWin* parent_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(MenuHostWindow);
|
||||
};
|
||||
@ -775,7 +774,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(this));
|
||||
host_window_.reset(new MenuHostWindow());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -38,7 +38,7 @@ const char kXdndProxy[] = "XdndProxy";
|
||||
::Window root;
|
||||
::Window parent;
|
||||
::Window* children;
|
||||
::Window child_window = None;
|
||||
::Window child_window = x11::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 = None;
|
||||
::Window parent = None;
|
||||
::Window root = x11::None;
|
||||
::Window parent = x11::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_ == None)
|
||||
if (parent_xwindow_ == x11::None)
|
||||
parent_xwindow_ = DefaultRootWindow(xdisplay_);
|
||||
|
||||
XSetWindowAttributes swa;
|
||||
memset(&swa, 0, sizeof(swa));
|
||||
swa.background_pixmap = None;
|
||||
swa.background_pixmap = x11::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] = CurrentTime;
|
||||
XSendEvent(xdisplay_, xwindow_, False, NoEventMask, &ev);
|
||||
ev.xclient.data.l[1] = x11::CurrentTime;
|
||||
XSendEvent(xdisplay_, xwindow_, false, NoEventMask, &ev);
|
||||
}
|
||||
|
||||
void CefWindowX11::Show() {
|
||||
if (xwindow_ == None)
|
||||
if (xwindow_ == x11::None)
|
||||
return;
|
||||
|
||||
if (!window_mapped_) {
|
||||
@ -205,7 +205,7 @@ void CefWindowX11::Show() {
|
||||
}
|
||||
|
||||
void CefWindowX11::Hide() {
|
||||
if (xwindow_ == None)
|
||||
if (xwindow_ == x11::None)
|
||||
return;
|
||||
|
||||
if (window_mapped_) {
|
||||
@ -215,22 +215,22 @@ void CefWindowX11::Hide() {
|
||||
}
|
||||
|
||||
void CefWindowX11::Focus() {
|
||||
if (xwindow_ == None || !window_mapped_)
|
||||
if (xwindow_ == x11::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, CurrentTime);
|
||||
XSetInputFocus(xdisplay_, child, RevertToParent, x11::CurrentTime);
|
||||
}
|
||||
} else {
|
||||
XSetInputFocus(xdisplay_, xwindow_, RevertToParent, CurrentTime);
|
||||
XSetInputFocus(xdisplay_, xwindow_, RevertToParent, x11::CurrentTime);
|
||||
}
|
||||
}
|
||||
|
||||
void CefWindowX11::SetBounds(const gfx::Rect& bounds) {
|
||||
if (xwindow_ == None)
|
||||
if (xwindow_ == x11::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_ = None;
|
||||
xwindow_ = x11::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,6 +37,7 @@
|
||||
#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"
|
||||
@ -169,7 +170,7 @@ bool IsDebugURL(const GURL& url) {
|
||||
|
||||
// Also include URLs handled by the browser process in
|
||||
// content/browser/frame_host/debug_urls.cc HandleDebugURL().
|
||||
for (int i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) {
|
||||
for (size_t i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) {
|
||||
GURL host(chrome::kChromeDebugURLs[i]);
|
||||
if (url.GetOrigin() == host.GetOrigin())
|
||||
return true;
|
||||
@ -186,7 +187,7 @@ bool IsDebugURL(const GURL& url) {
|
||||
}
|
||||
|
||||
void GetDebugURLs(std::vector<std::string>* urls) {
|
||||
for (int i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) {
|
||||
for (size_t i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) {
|
||||
urls->push_back(chrome::kChromeDebugURLs[i]);
|
||||
}
|
||||
|
||||
|
@ -36,29 +36,6 @@ 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,19 +26,6 @@ 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,19 +21,11 @@ namespace {
|
||||
|
||||
void SetCRLSetIfNewer(scoped_refptr<net::CRLSet> crl_set) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
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();
|
||||
}
|
||||
net::SSLConfigService::SetCRLSetIfNewer(crl_set);
|
||||
}
|
||||
|
||||
void LoadFromDisk(const base::FilePath& path) {
|
||||
base::ThreadRestrictions::AssertIOAllowed();
|
||||
base::AssertBlockingAllowed();
|
||||
|
||||
std::string crl_set_bytes;
|
||||
if (!base::ReadFileToString(path, &crl_set_bytes)) {
|
||||
|
@ -500,25 +500,29 @@ void CefResourceRequestJob::SaveNextCookie() {
|
||||
return;
|
||||
}
|
||||
|
||||
const std::string& cookie_line =
|
||||
response_cookies_[response_cookies_save_index_];
|
||||
|
||||
net::CookieOptions options;
|
||||
options.set_include_httponly();
|
||||
bool can_set_cookie =
|
||||
CanSetCookie(response_cookies_[response_cookies_save_index_], &options);
|
||||
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);
|
||||
if (can_set_cookie) {
|
||||
CefCookie cookie;
|
||||
if (CefCookieManagerImpl::GetCefCookie(
|
||||
request_->url(), response_cookies_[response_cookies_save_index_],
|
||||
cookie)) {
|
||||
can_set_cookie = handler_->CanSetCookie(cookie);
|
||||
CefCookie cef_cookie;
|
||||
if (CefCookieManagerImpl::GetCefCookie(request_->url(), cookie_line,
|
||||
cef_cookie)) {
|
||||
can_set_cookie = handler_->CanSetCookie(cef_cookie);
|
||||
} else {
|
||||
can_set_cookie = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (can_set_cookie) {
|
||||
request_->context()->cookie_store()->SetCookieWithOptionsAsync(
|
||||
request_->url(), response_cookies_[response_cookies_save_index_],
|
||||
options,
|
||||
request_->context()->cookie_store()->SetCanonicalCookieAsync(
|
||||
std::move(cookie), request_->url().SchemeIsCryptographic(),
|
||||
!options.exclude_httponly(),
|
||||
base::Bind(&CefResourceRequestJob::OnCookieSaved,
|
||||
weak_factory_.GetWeakPtr()));
|
||||
return;
|
||||
|
@ -136,9 +136,9 @@ std::unique_ptr<net::ProxyService> CreateProxyService(
|
||||
dhcp_proxy_script_fetcher = dhcp_factory.Create(context);
|
||||
|
||||
proxy_service = content::CreateProxyServiceUsingMojoFactory(
|
||||
ChromeMojoProxyResolverFactory::GetInstance(),
|
||||
ChromeMojoProxyResolverFactory::CreateWithStrongBinding(),
|
||||
std::move(proxy_config_service),
|
||||
new net::ProxyScriptFetcherImpl(context),
|
||||
base::MakeUnique<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_->set_server_whitelist(
|
||||
io_state_->http_auth_preferences_->SetServerWhitelist(
|
||||
auth_server_whitelist_.GetValue());
|
||||
}
|
||||
|
||||
void CefURLRequestContextGetterImpl::UpdateDelegateWhitelist() {
|
||||
io_state_->http_auth_preferences_->set_delegate_whitelist(
|
||||
io_state_->http_auth_preferences_->SetDelegateWhitelist(
|
||||
auth_negotiate_delegate_whitelist_.GetValue());
|
||||
}
|
||||
|
@ -275,12 +275,12 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragEnter(
|
||||
DragTargetDragLeave();
|
||||
|
||||
const gfx::Point client_pt(event.x, event.y);
|
||||
gfx::Point transformed_pt;
|
||||
gfx::PointF transformed_pt;
|
||||
current_rwh_for_drag_ =
|
||||
web_contents->GetInputEventRouter()
|
||||
->GetRenderWidgetHostAtPoint(
|
||||
web_contents->GetRenderViewHost()->GetWidget()->GetView(),
|
||||
client_pt, &transformed_pt)
|
||||
gfx::PointF(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,
|
||||
screen_pt, ops, modifiers);
|
||||
current_rwh_for_drag_->DragTargetDragEnter(
|
||||
*drop_data, transformed_pt, gfx::PointF(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::Point transformed_pt;
|
||||
gfx::PointF transformed_pt;
|
||||
content::RenderWidgetHostImpl* target_rwh =
|
||||
web_contents->GetInputEventRouter()->GetRenderWidgetHostAtPoint(
|
||||
web_contents->GetRenderViewHost()->GetWidget()->GetView(), client_pt,
|
||||
&transformed_pt);
|
||||
web_contents->GetRenderViewHost()->GetWidget()->GetView(),
|
||||
gfx::PointF(client_pt), &transformed_pt);
|
||||
|
||||
if (target_rwh != current_rwh_for_drag_.get()) {
|
||||
if (current_rwh_for_drag_) {
|
||||
gfx::Point transformed_leave_point = client_pt;
|
||||
gfx::Point transformed_screen_point = screen_pt;
|
||||
gfx::PointF transformed_leave_point(client_pt);
|
||||
gfx::PointF transformed_screen_point(screen_pt);
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
web_contents->GetRenderWidgetHostView())
|
||||
->TransformPointToCoordSpaceForView(
|
||||
client_pt,
|
||||
gfx::PointF(client_pt),
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
current_rwh_for_drag_->GetView()),
|
||||
&transformed_leave_point);
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
web_contents->GetRenderWidgetHostView())
|
||||
->TransformPointToCoordSpaceForView(
|
||||
screen_pt,
|
||||
gfx::PointF(screen_pt),
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
current_rwh_for_drag_->GetView()),
|
||||
&transformed_screen_point);
|
||||
@ -359,7 +359,8 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragOver(
|
||||
static_cast<blink::WebDragOperationsMask>(allowed_ops);
|
||||
int modifiers = TranslateModifiers(event.modifiers);
|
||||
|
||||
target_rwh->DragTargetDragOver(transformed_pt, screen_pt, ops, modifiers);
|
||||
target_rwh->DragTargetDragOver(transformed_pt, gfx::PointF(screen_pt), ops,
|
||||
modifiers);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateOsr::DragTargetDragLeave() {
|
||||
@ -369,7 +370,7 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragLeave() {
|
||||
}
|
||||
|
||||
if (current_rwh_for_drag_) {
|
||||
current_rwh_for_drag_->DragTargetDragLeave(gfx::Point(), gfx::Point());
|
||||
current_rwh_for_drag_->DragTargetDragLeave(gfx::PointF(), gfx::PointF());
|
||||
current_rwh_for_drag_.reset();
|
||||
}
|
||||
|
||||
@ -388,27 +389,27 @@ void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) {
|
||||
gfx::Point client_pt(event.x, event.y);
|
||||
const gfx::Point& screen_pt = GetScreenPoint(client_pt);
|
||||
|
||||
gfx::Point transformed_pt;
|
||||
gfx::PointF transformed_pt;
|
||||
content::RenderWidgetHostImpl* target_rwh =
|
||||
web_contents->GetInputEventRouter()->GetRenderWidgetHostAtPoint(
|
||||
web_contents->GetRenderViewHost()->GetWidget()->GetView(), client_pt,
|
||||
&transformed_pt);
|
||||
web_contents->GetRenderViewHost()->GetWidget()->GetView(),
|
||||
gfx::PointF(client_pt), &transformed_pt);
|
||||
|
||||
if (target_rwh != current_rwh_for_drag_.get()) {
|
||||
if (current_rwh_for_drag_) {
|
||||
gfx::Point transformed_leave_point = client_pt;
|
||||
gfx::Point transformed_screen_point = screen_pt;
|
||||
gfx::PointF transformed_leave_point(client_pt);
|
||||
gfx::PointF transformed_screen_point(screen_pt);
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
web_contents->GetRenderWidgetHostView())
|
||||
->TransformPointToCoordSpaceForView(
|
||||
client_pt,
|
||||
gfx::PointF(client_pt),
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
current_rwh_for_drag_->GetView()),
|
||||
&transformed_leave_point);
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
web_contents->GetRenderWidgetHostView())
|
||||
->TransformPointToCoordSpaceForView(
|
||||
screen_pt,
|
||||
gfx::PointF(screen_pt),
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
current_rwh_for_drag_->GetView()),
|
||||
&transformed_screen_point);
|
||||
@ -428,8 +429,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, screen_pt,
|
||||
modifiers);
|
||||
target_rwh->DragTargetDrop(*drop_data, transformed_pt,
|
||||
gfx::PointF(screen_pt), modifiers);
|
||||
}
|
||||
|
||||
drag_data_ = nullptr;
|
||||
@ -495,20 +496,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::Point transformed_point = client_loc;
|
||||
gfx::Point transformed_screen_point = screen_loc;
|
||||
gfx::PointF transformed_point(client_loc);
|
||||
gfx::PointF transformed_screen_point(screen_loc);
|
||||
if (source_rwh && web_contents->GetRenderWidgetHostView()) {
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
web_contents->GetRenderWidgetHostView())
|
||||
->TransformPointToCoordSpaceForView(
|
||||
client_loc,
|
||||
gfx::PointF(client_loc),
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
source_rwh->GetView()),
|
||||
&transformed_point);
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
web_contents->GetRenderWidgetHostView())
|
||||
->TransformPointToCoordSpaceForView(
|
||||
screen_loc,
|
||||
gfx::PointF(screen_loc),
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
source_rwh->GetView()),
|
||||
&transformed_screen_point);
|
||||
|
@ -21,6 +21,7 @@
|
||||
#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"
|
||||
@ -238,7 +239,8 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||
#if !defined(OS_MACOSX)
|
||||
delegated_frame_host_ = base::MakeUnique<content::DelegatedFrameHost>(
|
||||
AllocateFrameSinkId(is_guest_view_hack), this,
|
||||
false /* enable_surface_synchronization */);
|
||||
false /* enable_surface_synchronization */,
|
||||
base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableViz));
|
||||
|
||||
root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
|
||||
#endif
|
||||
@ -443,7 +445,8 @@ void CefRenderWidgetHostViewOSR::DidCreateNewRendererCompositorFrameSink(
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SubmitCompositorFrame(
|
||||
const viz::LocalSurfaceId& local_surface_id,
|
||||
viz::CompositorFrame frame) {
|
||||
viz::CompositorFrame frame,
|
||||
viz::mojom::HitTestRegionListPtr hit_test_region_list) {
|
||||
TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::OnSwapCompositorFrame");
|
||||
|
||||
if (frame.metadata.root_scroll_offset != last_scroll_offset_) {
|
||||
@ -472,8 +475,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));
|
||||
GetDelegatedFrameHost()->SubmitCompositorFrame(
|
||||
local_surface_id, std::move(frame), std::move(hit_test_region_list));
|
||||
} else {
|
||||
if (!copy_frame_generator_.get()) {
|
||||
copy_frame_generator_.reset(
|
||||
@ -491,8 +494,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));
|
||||
GetDelegatedFrameHost()->SubmitCompositorFrame(
|
||||
local_surface_id, std::move(frame), std::move(hit_test_region_list));
|
||||
|
||||
// Request a copy of the last compositor frame which will eventually call
|
||||
// OnPaint asynchronously.
|
||||
@ -827,12 +830,12 @@ void CefRenderWidgetHostViewOSR::ProcessGestureEvent(
|
||||
}
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::TransformPointToLocalCoordSpace(
|
||||
const gfx::Point& point,
|
||||
const gfx::PointF& point,
|
||||
const viz::SurfaceId& original_surface,
|
||||
gfx::Point* transformed_point) {
|
||||
gfx::PointF* transformed_point) {
|
||||
// Transformations use physical pixels rather than DIP, so conversion
|
||||
// is necessary.
|
||||
gfx::Point point_in_pixels =
|
||||
gfx::PointF point_in_pixels =
|
||||
gfx::ConvertPointToPixel(current_device_scale_factor_, point);
|
||||
if (!GetDelegatedFrameHost()->TransformPointToLocalCoordSpace(
|
||||
point_in_pixels, original_surface, transformed_point)) {
|
||||
@ -845,9 +848,9 @@ bool CefRenderWidgetHostViewOSR::TransformPointToLocalCoordSpace(
|
||||
}
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::TransformPointToCoordSpaceForView(
|
||||
const gfx::Point& point,
|
||||
const gfx::PointF& point,
|
||||
RenderWidgetHostViewBase* target_view,
|
||||
gfx::Point* transformed_point) {
|
||||
gfx::PointF* transformed_point) {
|
||||
if (target_view == this) {
|
||||
*transformed_point = point;
|
||||
return true;
|
||||
@ -926,6 +929,10 @@ 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) {
|
||||
@ -1294,16 +1301,11 @@ 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);
|
||||
}
|
||||
|
@ -132,8 +132,10 @@ 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) override;
|
||||
void SubmitCompositorFrame(
|
||||
const viz::LocalSurfaceId& local_surface_id,
|
||||
viz::CompositorFrame frame,
|
||||
viz::mojom::HitTestRegionListPtr hit_test_region_list) override;
|
||||
void ClearCompositorFrame() override;
|
||||
void InitAsPopup(content::RenderWidgetHostView* parent_host_view,
|
||||
const gfx::Rect& pos) override;
|
||||
@ -188,13 +190,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::Point& point,
|
||||
bool TransformPointToLocalCoordSpace(const gfx::PointF& point,
|
||||
const viz::SurfaceId& original_surface,
|
||||
gfx::Point* transformed_point) override;
|
||||
gfx::PointF* transformed_point) override;
|
||||
bool TransformPointToCoordSpaceForView(
|
||||
const gfx::Point& point,
|
||||
const gfx::PointF& point,
|
||||
RenderWidgetHostViewBase* target_view,
|
||||
gfx::Point* transformed_point) override;
|
||||
gfx::PointF* transformed_point) override;
|
||||
|
||||
// ui::CompositorDelegate implementation.
|
||||
std::unique_ptr<viz::SoftwareOutputDevice> CreateSoftwareOutputDevice(
|
||||
@ -212,6 +214,7 @@ 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,6 +65,10 @@ 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,6 +127,8 @@ 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,6 +63,8 @@ void CefWebContentsViewOSR::StoreFocus() {}
|
||||
|
||||
void CefWebContentsViewOSR::RestoreFocus() {}
|
||||
|
||||
void CefWebContentsViewOSR::FocusThroughTabTraversal(bool reverse) {}
|
||||
|
||||
void CefWebContentsViewOSR::GotFocus(
|
||||
content::RenderWidgetHostImpl* render_widget_host) {
|
||||
if (web_contents_) {
|
||||
|
@ -40,6 +40,7 @@ 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,
|
||||
|
@ -1,107 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#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;
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_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,11 +10,13 @@ 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:
|
||||
@ -28,9 +30,6 @@ 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:
|
||||
@ -43,6 +42,10 @@ 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;
|
||||
|
@ -1,514 +0,0 @@
|
||||
// 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;
|
||||
}
|
@ -1,139 +0,0 @@
|
||||
// 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,7 +9,6 @@
|
||||
#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"
|
||||
@ -30,8 +29,7 @@ bool CefPluginServiceFilter::IsPluginAvailable(
|
||||
|
||||
CefResourceContext* resource_context = const_cast<CefResourceContext*>(
|
||||
reinterpret_cast<const CefResourceContext*>(context));
|
||||
CefViewHostMsg_GetPluginInfo_Status status =
|
||||
CefViewHostMsg_GetPluginInfo_Status::kAllowed;
|
||||
chrome::mojom::PluginStatus status = chrome::mojom::PluginStatus::kAllowed;
|
||||
|
||||
// Perform origin check here because we're passing an empty origin value to
|
||||
// IsPluginAvailable() below.
|
||||
@ -54,8 +52,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, resource_context, url,
|
||||
is_main_frame, url::Origin(), plugin, &status);
|
||||
return IsPluginAvailable(render_process_id, render_frame_id, resource_context,
|
||||
url, is_main_frame, url::Origin(), plugin, &status);
|
||||
}
|
||||
|
||||
bool CefPluginServiceFilter::CanLoadPlugin(int render_process_id,
|
||||
@ -65,21 +63,24 @@ bool CefPluginServiceFilter::CanLoadPlugin(int render_process_id,
|
||||
|
||||
bool CefPluginServiceFilter::IsPluginAvailable(
|
||||
int render_process_id,
|
||||
CefResourceContext* resource_context,
|
||||
int render_frame_id,
|
||||
content::ResourceContext* content_resource_context,
|
||||
const GURL& url,
|
||||
bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
content::WebPluginInfo* plugin,
|
||||
CefViewHostMsg_GetPluginInfo_Status* status) {
|
||||
if (*status == CefViewHostMsg_GetPluginInfo_Status::kNotFound ||
|
||||
*status == CefViewHostMsg_GetPluginInfo_Status::kNPAPINotSupported) {
|
||||
chrome::mojom::PluginStatus* status) {
|
||||
CefResourceContext* resource_context =
|
||||
static_cast<CefResourceContext*>(content_resource_context);
|
||||
|
||||
if (*status == chrome::mojom::PluginStatus::kNotFound) {
|
||||
// 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 = CefViewHostMsg_GetPluginInfo_Status::kAllowed;
|
||||
*status = chrome::mojom::PluginStatus::kAllowed;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -89,41 +90,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 = CefViewHostMsg_GetPluginInfo_Status::kAllowed;
|
||||
*status = chrome::mojom::PluginStatus::kAllowed;
|
||||
return true;
|
||||
}
|
||||
|
||||
CefRefPtr<CefRequestContextHandler> handler = resource_context->GetHandler();
|
||||
if (!handler) {
|
||||
// No handler so go with the default plugin load decision.
|
||||
return *status != CefViewHostMsg_GetPluginInfo_Status::kDisabled;
|
||||
return *status != chrome::mojom::PluginStatus::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 != CefViewHostMsg_GetPluginInfo_Status::kDisabled;
|
||||
return *status != chrome::mojom::PluginStatus::kDisabled;
|
||||
}
|
||||
|
||||
CefRefPtr<CefWebPluginInfoImpl> pluginInfo(new CefWebPluginInfoImpl(*plugin));
|
||||
|
||||
cef_plugin_policy_t plugin_policy = PLUGIN_POLICY_ALLOW;
|
||||
switch (*status) {
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kAllowed:
|
||||
case chrome::mojom::PluginStatus::kAllowed:
|
||||
plugin_policy = PLUGIN_POLICY_ALLOW;
|
||||
break;
|
||||
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:
|
||||
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:
|
||||
plugin_policy = PLUGIN_POLICY_BLOCK;
|
||||
break;
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kDisabled:
|
||||
case chrome::mojom::PluginStatus::kDisabled:
|
||||
plugin_policy = PLUGIN_POLICY_DISABLE;
|
||||
break;
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kPlayImportantContent:
|
||||
case chrome::mojom::PluginStatus::kPlayImportantContent:
|
||||
plugin_policy = PLUGIN_POLICY_DETECT_IMPORTANT;
|
||||
break;
|
||||
default:
|
||||
@ -137,16 +138,16 @@ bool CefPluginServiceFilter::IsPluginAvailable(
|
||||
pluginInfo.get(), &plugin_policy)) {
|
||||
switch (plugin_policy) {
|
||||
case PLUGIN_POLICY_ALLOW:
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kAllowed;
|
||||
*status = chrome::mojom::PluginStatus::kAllowed;
|
||||
break;
|
||||
case PLUGIN_POLICY_DETECT_IMPORTANT:
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kPlayImportantContent;
|
||||
*status = chrome::mojom::PluginStatus::kPlayImportantContent;
|
||||
break;
|
||||
case PLUGIN_POLICY_BLOCK:
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kBlocked;
|
||||
*status = chrome::mojom::PluginStatus::kBlocked;
|
||||
break;
|
||||
case PLUGIN_POLICY_DISABLE:
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kDisabled;
|
||||
*status = chrome::mojom::PluginStatus::kDisabled;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -156,5 +157,5 @@ bool CefPluginServiceFilter::IsPluginAvailable(
|
||||
is_main_frame, main_frame_origin,
|
||||
*status);
|
||||
|
||||
return *status != CefViewHostMsg_GetPluginInfo_Status::kDisabled;
|
||||
return *status != chrome::mojom::PluginStatus::kDisabled;
|
||||
}
|
||||
|
@ -5,14 +5,16 @@
|
||||
#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"
|
||||
|
||||
class CefResourceContext;
|
||||
enum class CefViewHostMsg_GetPluginInfo_Status;
|
||||
namespace content {
|
||||
class ResourceContext;
|
||||
}
|
||||
|
||||
class CefPluginServiceFilter : public content::PluginServiceFilter {
|
||||
public:
|
||||
@ -32,16 +34,19 @@ 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,
|
||||
CefResourceContext* resource_context,
|
||||
int render_frame_id,
|
||||
content::ResourceContext* resource_context,
|
||||
const GURL& url,
|
||||
bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
content::WebPluginInfo* plugin,
|
||||
CefViewHostMsg_GetPluginInfo_Status* status);
|
||||
chrome::mojom::PluginStatus* status);
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(CefPluginServiceFilter);
|
||||
|
@ -16,7 +16,9 @@
|
||||
#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"
|
||||
@ -27,6 +29,7 @@
|
||||
#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"
|
||||
@ -45,55 +48,6 @@
|
||||
|
||||
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,
|
||||
@ -165,71 +119,70 @@ 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());
|
||||
PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get());
|
||||
extensions::ExtensionPrefs::RegisterProfilePrefs(registry.get());
|
||||
HostContentSettingsMap::RegisterProfilePrefs(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());
|
||||
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.
|
||||
// Based on SpellcheckServiceFactory::RegisterProfilePrefs.
|
||||
registry->RegisterListPref(spellcheck::prefs::kSpellCheckDictionaries,
|
||||
base::MakeUnique<base::ListValue>());
|
||||
// Modify defaults from SpellcheckServiceFactory::RegisterProfilePrefs.
|
||||
std::string spellcheck_lang =
|
||||
command_line->GetSwitchValueASCII(switches::kOverrideSpellCheckLang);
|
||||
if (!spellcheck_lang.empty()) {
|
||||
registry->RegisterStringPref(spellcheck::prefs::kSpellCheckDictionary,
|
||||
spellcheck_lang);
|
||||
} else {
|
||||
RegisterLocalizedValue(
|
||||
registry.get(), spellcheck::prefs::kSpellCheckDictionary,
|
||||
base::Value::Type::STRING, IDS_SPELLCHECK_DICTIONARY);
|
||||
registry->SetDefaultPrefValue(spellcheck::prefs::kSpellCheckDictionary,
|
||||
base::Value(spellcheck_lang));
|
||||
}
|
||||
registry->RegisterBooleanPref(
|
||||
const bool enable_spelling_service_ =
|
||||
command_line->HasSwitch(switches::kEnableSpellingService);
|
||||
registry->SetDefaultPrefValue(
|
||||
spellcheck::prefs::kSpellCheckUseSpellingService,
|
||||
command_line->HasSwitch(switches::kEnableSpellingService));
|
||||
registry->RegisterBooleanPref(
|
||||
spellcheck::prefs::kEnableSpellcheck,
|
||||
!command_line->HasSwitch(switches::kDisableSpellChecking));
|
||||
base::Value(enable_spelling_service_));
|
||||
registry->SetDefaultPrefValue(spellcheck::prefs::kEnableSpellcheck,
|
||||
base::Value(!enable_spelling_service_));
|
||||
|
||||
// Pepper flash preferences.
|
||||
// Based on DeviceIDFetcher::RegisterProfilePrefs.
|
||||
registry->RegisterBooleanPref(prefs::kEnableDRM, false);
|
||||
registry->RegisterStringPref(prefs::kDRMSalt, "");
|
||||
// Modify defaults from DeviceIDFetcher::RegisterProfilePrefs.
|
||||
registry->SetDefaultPrefValue(prefs::kEnableDRM, base::Value(false));
|
||||
|
||||
// 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);
|
||||
|
@ -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,11 +25,13 @@
|
||||
#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"
|
||||
@ -37,14 +39,16 @@
|
||||
#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_switches.h"
|
||||
#include "chrome/common/chrome_features.h"
|
||||
#endif
|
||||
|
||||
using base::TimeDelta;
|
||||
@ -58,10 +62,9 @@ CefPrintViewManagerBase::CefPrintViewManagerBase(
|
||||
printing_rfh_(nullptr),
|
||||
printing_succeeded_(false),
|
||||
inside_inner_message_loop_(false),
|
||||
#if !defined(OS_MACOSX)
|
||||
expecting_first_page_(true),
|
||||
#endif
|
||||
queue_(g_browser_process->print_job_manager()->queue()) {
|
||||
queue_(g_browser_process->print_job_manager()->queue()),
|
||||
weak_ptr_factory_(this) {
|
||||
DCHECK(queue_.get());
|
||||
Profile* profile =
|
||||
Profile::FromBrowserContext(web_contents->GetBrowserContext());
|
||||
@ -110,8 +113,22 @@ 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;
|
||||
|
||||
@ -122,12 +139,8 @@ 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;
|
||||
@ -137,8 +150,18 @@ 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 =
|
||||
base::MakeUnique<base::SharedMemory>(params.metafile_data_handle, true);
|
||||
std::make_unique<base::SharedMemory>(params.metafile_data_handle, true);
|
||||
if (!shared_buf->Map(params.data_size)) {
|
||||
NOTREACHED() << "couldn't map";
|
||||
web_contents()->Stop();
|
||||
@ -153,22 +176,23 @@ void CefPrintViewManagerBase::OnDidPrintPage(
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(OS_WIN)
|
||||
print_job_->AppendPrintedPage(params.page_number);
|
||||
if (metafile_must_be_valid) {
|
||||
scoped_refptr<base::RefCountedBytes> bytes = new base::RefCountedBytes(
|
||||
if (has_valid_page_data) {
|
||||
scoped_refptr<base::RefCountedBytes> bytes(new base::RefCountedBytes(
|
||||
reinterpret_cast<const unsigned char*>(shared_buf->memory()),
|
||||
params.data_size);
|
||||
shared_buf->mapped_size()));
|
||||
|
||||
document->DebugDumpData(bytes.get(), FILE_PATH_LITERAL(".pdf"));
|
||||
|
||||
@ -195,12 +219,20 @@ void CefPrintViewManagerBase::OnDidPrintPage(
|
||||
}
|
||||
}
|
||||
#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),
|
||||
#if defined(OS_WIN)
|
||||
0.0f /* dummy shrink_factor */,
|
||||
#endif
|
||||
params.page_size, params.content_area);
|
||||
document->SetPage(params.page_number, std::move(metafile), params.page_size,
|
||||
params.content_area);
|
||||
|
||||
ShouldQuitFromInnerMessageLoop();
|
||||
#endif
|
||||
@ -405,9 +437,7 @@ 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,16 +9,23 @@
|
||||
|
||||
#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;
|
||||
}
|
||||
@ -26,7 +33,6 @@ class RenderFrameHost;
|
||||
namespace printing {
|
||||
|
||||
class JobEventDetails;
|
||||
class MetafilePlayer;
|
||||
class PrintJob;
|
||||
class PrintJobWorkerOwner;
|
||||
class PrintQueriesQueue;
|
||||
@ -77,9 +83,19 @@ 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);
|
||||
@ -148,16 +164,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->GetType()) {
|
||||
if (pref->GetType() != impl_value->type()) {
|
||||
error = base::StringPrintf(
|
||||
"Trying to set a preference of type %s to value of type %s",
|
||||
GetTypeString(pref->GetType()), GetTypeString(impl_value->GetType()));
|
||||
GetTypeString(pref->GetType()), GetTypeString(impl_value->type()));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ void CefResourceContext::AddPluginLoadDecision(
|
||||
const base::FilePath& plugin_path,
|
||||
bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
CefViewHostMsg_GetPluginInfo_Status status) {
|
||||
chrome::mojom::PluginStatus 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,
|
||||
CefViewHostMsg_GetPluginInfo_Status* status) const {
|
||||
chrome::mojom::PluginStatus* 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,
|
||||
CefViewHostMsg_GetPluginInfo_Status status);
|
||||
chrome::mojom::PluginStatus status);
|
||||
bool HasPluginLoadDecision(int render_process_id,
|
||||
const base::FilePath& plugin_path,
|
||||
bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
CefViewHostMsg_GetPluginInfo_Status* status) const;
|
||||
chrome::mojom::PluginStatus* status) const;
|
||||
|
||||
// Clear the plugin load decisions associated with |render_process_id|, or all
|
||||
// plugin load decisions if |render_process_id| is -1.
|
||||
@ -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>>,
|
||||
CefViewHostMsg_GetPluginInfo_Status>
|
||||
chrome::mojom::PluginStatus>
|
||||
PluginLoadDecisionMap;
|
||||
PluginLoadDecisionMap plugin_load_decision_map_;
|
||||
|
||||
|
@ -11,13 +11,6 @@ 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() {}
|
||||
|
||||
@ -26,7 +19,7 @@ CertPolicy::~CertPolicy() {}
|
||||
// in the saved CertStatus.
|
||||
bool CertPolicy::Check(const net::X509Certificate& cert,
|
||||
net::CertStatus error) const {
|
||||
net::SHA256HashValue fingerprint = getChainFingerprint256(cert);
|
||||
net::SHA256HashValue fingerprint = cert.CalculateChainFingerprint256();
|
||||
std::map<net::SHA256HashValue, net::CertStatus,
|
||||
net::SHA256HashValueLessThan>::const_iterator allowed_iter =
|
||||
allowed_.find(fingerprint);
|
||||
@ -41,7 +34,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 = getChainFingerprint256(cert);
|
||||
net::SHA256HashValue fingerprint = cert.CalculateChainFingerprint256();
|
||||
allowed_[fingerprint] = error;
|
||||
}
|
||||
|
||||
|
@ -125,10 +125,9 @@ void CefStoragePartitionProxy::ClearDataForOrigin(
|
||||
uint32_t remove_mask,
|
||||
uint32_t quota_storage_remove_mask,
|
||||
const GURL& storage_origin,
|
||||
net::URLRequestContextGetter* rq_context,
|
||||
const base::Closure& callback) {
|
||||
net::URLRequestContextGetter* rq_context) {
|
||||
parent_->ClearDataForOrigin(remove_mask, quota_storage_remove_mask,
|
||||
storage_origin, rq_context, callback);
|
||||
storage_origin, rq_context);
|
||||
}
|
||||
|
||||
void CefStoragePartitionProxy::ClearData(
|
||||
@ -138,9 +137,9 @@ void CefStoragePartitionProxy::ClearData(
|
||||
const OriginMatcherFunction& origin_matcher,
|
||||
const base::Time begin,
|
||||
const base::Time end,
|
||||
const base::Closure& callback) {
|
||||
base::OnceClosure callback) {
|
||||
parent_->ClearData(remove_mask, quota_storage_remove_mask, storage_origin,
|
||||
origin_matcher, begin, end, callback);
|
||||
origin_matcher, begin, end, std::move(callback));
|
||||
}
|
||||
|
||||
void CefStoragePartitionProxy::ClearData(
|
||||
@ -150,17 +149,18 @@ void CefStoragePartitionProxy::ClearData(
|
||||
const CookieMatcherFunction& cookie_matcher,
|
||||
const base::Time begin,
|
||||
const base::Time end,
|
||||
const base::Closure& callback) {
|
||||
base::OnceClosure callback) {
|
||||
parent_->ClearData(remove_mask, quota_storage_remove_mask, origin_matcher,
|
||||
cookie_matcher, begin, end, callback);
|
||||
cookie_matcher, begin, end, std::move(callback));
|
||||
}
|
||||
|
||||
void CefStoragePartitionProxy::ClearHttpAndMediaCaches(
|
||||
const base::Time begin,
|
||||
const base::Time end,
|
||||
const base::Callback<bool(const GURL&)>& url_matcher,
|
||||
const base::Closure& callback) {
|
||||
parent_->ClearHttpAndMediaCaches(begin, end, url_matcher, callback);
|
||||
base::OnceClosure callback) {
|
||||
parent_->ClearHttpAndMediaCaches(begin, end, url_matcher,
|
||||
std::move(callback));
|
||||
}
|
||||
|
||||
void CefStoragePartitionProxy::Flush() {
|
||||
@ -171,6 +171,11 @@ 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,29 +50,30 @@ 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,
|
||||
const base::Closure& callback);
|
||||
net::URLRequestContextGetter* rq_context) override;
|
||||
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,
|
||||
const base::Closure& callback);
|
||||
base::OnceClosure callback) override;
|
||||
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,
|
||||
const base::Closure& callback) override;
|
||||
base::OnceClosure callback) override;
|
||||
void ClearHttpAndMediaCaches(
|
||||
const base::Time begin,
|
||||
const base::Time end,
|
||||
const base::Callback<bool(const GURL&)>& url_matcher,
|
||||
const base::Closure& callback) override;
|
||||
base::OnceClosure 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,8 +182,10 @@ 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 = display::win::ScreenWin::ScreenToDIPPoint(point);
|
||||
if (input_pixel_coords) {
|
||||
find_point = gfx::ToFlooredPoint(
|
||||
display::win::ScreenWin::ScreenToDIPPoint(gfx::PointF(point)));
|
||||
}
|
||||
#endif
|
||||
return display::Screen::GetScreen()->GetDisplayNearestPoint(find_point);
|
||||
}
|
||||
|
@ -43,15 +43,9 @@ class CallRecordUploadAttempt {
|
||||
CefCrashReportUploadThread::CefCrashReportUploadThread(
|
||||
CrashReportDatabase* database,
|
||||
const std::string& url,
|
||||
bool watch_pending_reports,
|
||||
bool rate_limit,
|
||||
bool upload_gzip,
|
||||
const Options& options,
|
||||
int max_uploads)
|
||||
: CrashReportUploadThread(database,
|
||||
url,
|
||||
watch_pending_reports,
|
||||
rate_limit,
|
||||
upload_gzip),
|
||||
: CrashReportUploadThread(database, url, options),
|
||||
max_uploads_(max_uploads) {}
|
||||
|
||||
CefCrashReportUploadThread::~CefCrashReportUploadThread() {}
|
||||
@ -173,7 +167,7 @@ bool CefCrashReportUploadThread::UploadsEnabled() const {
|
||||
}
|
||||
|
||||
bool CefCrashReportUploadThread::MaxUploadsEnabled() const {
|
||||
return rate_limit_ && max_uploads_ > 0;
|
||||
return options_.rate_limit && max_uploads_ > 0;
|
||||
}
|
||||
|
||||
bool CefCrashReportUploadThread::MaxUploadsExceeded() const {
|
||||
@ -181,7 +175,7 @@ bool CefCrashReportUploadThread::MaxUploadsExceeded() const {
|
||||
}
|
||||
|
||||
bool CefCrashReportUploadThread::BackoffPending() const {
|
||||
if (!rate_limit_)
|
||||
if (!options_.rate_limit)
|
||||
return false;
|
||||
|
||||
Settings* const settings = database_->GetSettings();
|
||||
@ -198,7 +192,7 @@ bool CefCrashReportUploadThread::BackoffPending() const {
|
||||
}
|
||||
|
||||
void CefCrashReportUploadThread::IncreaseBackoff() {
|
||||
if (!rate_limit_)
|
||||
if (!options_.rate_limit)
|
||||
return;
|
||||
|
||||
const int kHour = 60 * 60; // 1 hour
|
||||
@ -236,7 +230,7 @@ void CefCrashReportUploadThread::IncreaseBackoff() {
|
||||
}
|
||||
|
||||
void CefCrashReportUploadThread::ResetBackoff() {
|
||||
if (!rate_limit_)
|
||||
if (!options_.rate_limit)
|
||||
return;
|
||||
|
||||
Settings* settings = database_->GetSettings();
|
||||
|
@ -11,9 +11,7 @@ class CefCrashReportUploadThread : public crashpad::CrashReportUploadThread {
|
||||
public:
|
||||
CefCrashReportUploadThread(crashpad::CrashReportDatabase* database,
|
||||
const std::string& url,
|
||||
bool watch_pending_reports,
|
||||
bool rate_limit,
|
||||
bool upload_gzip,
|
||||
const Options& options,
|
||||
int max_uploads);
|
||||
~CefCrashReportUploadThread();
|
||||
|
||||
|
@ -21,20 +21,6 @@
|
||||
#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.
|
||||
@ -207,44 +193,6 @@ 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 */,
|
||||
|
@ -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 = chrome::kPepperFlashPermissions;
|
||||
plugin.permissions = 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 (!chrome::CheckPepperFlashManifest(*manifest, &version))
|
||||
if (!CheckPepperFlashManifest(*manifest, &version))
|
||||
return false;
|
||||
|
||||
*plugin = CreatePepperFlashInfo(flash_filename, version.GetString());
|
||||
|
@ -12,6 +12,7 @@
|
||||
#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)
|
||||
@ -161,6 +162,8 @@ 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();
|
||||
chrome::InitializePDF();
|
||||
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_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
|
||||
#if defined(OS_LINUX)
|
||||
void CefMainDelegate::ZygoteForked() {
|
||||
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
||||
const std::string& process_type =
|
||||
|
@ -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_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
|
||||
#if defined(OS_LINUX)
|
||||
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::WebCachePolicy GetWebCachePolicy(int ur_flags) {
|
||||
blink::mojom::FetchCacheMode GetFetchCacheMode(int ur_flags) {
|
||||
if ((ur_flags & kURCachePolicyMask) == kURCachePolicyMask) {
|
||||
return blink::WebCachePolicy::kBypassCacheLoadOnlyFromCache;
|
||||
return blink::mojom::FetchCacheMode::kUnspecifiedForceCacheMiss;
|
||||
} else if (ur_flags & UR_FLAG_SKIP_CACHE) {
|
||||
return blink::WebCachePolicy::kBypassingCache;
|
||||
return blink::mojom::FetchCacheMode::kBypassCache;
|
||||
} else if (ur_flags & UR_FLAG_ONLY_FROM_CACHE) {
|
||||
return blink::WebCachePolicy::kReturnCacheDataDontLoad;
|
||||
return blink::mojom::FetchCacheMode::kOnlyIfCached;
|
||||
}
|
||||
return blink::WebCachePolicy::kUseProtocolCachePolicy;
|
||||
return blink::mojom::FetchCacheMode::kDefault;
|
||||
}
|
||||
|
||||
// Convert blink::WebCachePolicy to cef_urlrequest_flags_t.
|
||||
int GetURCachePolicy(blink::WebCachePolicy web_policy) {
|
||||
if (web_policy == blink::WebCachePolicy::kBypassCacheLoadOnlyFromCache) {
|
||||
int GetURCachePolicy(blink::mojom::FetchCacheMode cache_mode) {
|
||||
if (cache_mode == blink::mojom::FetchCacheMode::kUnspecifiedForceCacheMiss) {
|
||||
return kURCachePolicyMask;
|
||||
} else if (web_policy == blink::WebCachePolicy::kBypassingCache) {
|
||||
} else if (cache_mode == blink::mojom::FetchCacheMode::kBypassCache) {
|
||||
return UR_FLAG_SKIP_CACHE;
|
||||
} else if (web_policy == blink::WebCachePolicy::kReturnCacheDataDontLoad) {
|
||||
} else if (cache_mode == blink::mojom::FetchCacheMode::kOnlyIfCached) {
|
||||
return UR_FLAG_ONLY_FROM_CACHE;
|
||||
}
|
||||
return 0;
|
||||
@ -566,7 +566,7 @@ void CefRequestImpl::Set(const blink::WebURLRequest& request) {
|
||||
|
||||
site_for_cookies_ = request.SiteForCookies();
|
||||
|
||||
flags_ |= GetURCachePolicy(request.GetCachePolicy());
|
||||
flags_ |= GetURCachePolicy(request.GetCacheMode());
|
||||
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.SetCachePolicy(GetWebCachePolicy(flags));
|
||||
request.SetCacheMode(GetFetchCacheMode(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.SetCachePolicy(GetWebCachePolicy(flags));
|
||||
request.SetCacheMode(GetFetchCacheMode(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(site_for_cookies_));
|
||||
fetcher.SetInitiator(url::Origin::Create(site_for_cookies_));
|
||||
|
||||
int flags = flags_;
|
||||
if (!(flags & kURCachePolicyMask)) {
|
||||
@ -1415,8 +1415,7 @@ 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.Assign(
|
||||
blink::WebString::FromUTF16(CefString(&data_.filename)));
|
||||
element.file_path = blink::WebString::FromUTF16(CefString(&data_.filename));
|
||||
} else {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
@ -7,9 +7,7 @@
|
||||
"renderer": [
|
||||
"blink::mojom::BudgetService",
|
||||
"metrics::mojom::LeakDetector",
|
||||
"mojom::ModuleEventSink",
|
||||
"spellcheck::mojom::SpellCheckHost",
|
||||
"startup_metric_utils::mojom::StartupMetricHost"
|
||||
"mojom::ModuleEventSink"
|
||||
]
|
||||
}
|
||||
},
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "content_packaged_services",
|
||||
"display_name": "CEF Packaged Services",
|
||||
"interface_provider_specs": {}
|
||||
}
|
@ -6,6 +6,9 @@
|
||||
"browser": [
|
||||
"spellcheck::mojom::SpellChecker"
|
||||
]
|
||||
},
|
||||
"requires": {
|
||||
"chrome": [ "renderer" ]
|
||||
}
|
||||
}
|
||||
}
|
@ -219,7 +219,7 @@ CefValueType CefValueImpl::GetType() {
|
||||
return VTYPE_LIST;
|
||||
|
||||
if (value_) {
|
||||
switch (value_->GetType()) {
|
||||
switch (value_->type()) {
|
||||
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->GetType()) {
|
||||
switch (value->type()) {
|
||||
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->GetType()) {
|
||||
switch (out_value->type()) {
|
||||
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->GetType()) {
|
||||
switch (out_value->type()) {
|
||||
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_param_names.push_back(
|
||||
base::ASCIIToUTF16(kCdmSupportedCodecsParamName));
|
||||
widevine_cdm_mime_type.additional_param_values.push_back(
|
||||
base::ASCIIToUTF16(cdm_codecs));
|
||||
widevine_cdm_mime_type.additional_params.emplace_back(
|
||||
content::WebPluginMimeType::Param(
|
||||
base::ASCIIToUTF16(kCdmSupportedCodecsParamName),
|
||||
base::ASCIIToUTF16(cdm_codecs)));
|
||||
|
||||
widevine_cdm->mime_types.push_back(widevine_cdm_mime_type);
|
||||
widevine_cdm->permissions = kWidevineCdmPluginPermissions;
|
||||
|
@ -8,7 +8,73 @@ import("//cef/libcef/features/features.gni")
|
||||
# This file is in a separate directory so all targets in the build can refer to
|
||||
# the buildflag header to get the necessary preprocessor defines without
|
||||
# bringing in any CEF targets. Other targets can depend on this target
|
||||
# regardless of whether CEF is being built.
|
||||
# regardless of whether CEF is being built. Set the `enable_cef=false` GN arg to
|
||||
# disable the CEF changes when building Chrome.
|
||||
#
|
||||
# Example usage:
|
||||
#
|
||||
# 1. An existing GN configuration file at path/to/foo/BUILD.gn:
|
||||
#
|
||||
# # Import the `enable_cef` arg.
|
||||
# import("//cef/libcef/features/features.gni")
|
||||
# ...
|
||||
#
|
||||
# # An existing target that is modified for CEF.
|
||||
# # The target type might instead be `component`, `source_set`, etc.
|
||||
# static_library("foo") {
|
||||
# sources = [ ... ]
|
||||
#
|
||||
# deps = [
|
||||
# # Always include the CEF features.
|
||||
# "//cef/libcef/features",
|
||||
# ...
|
||||
# ]
|
||||
#
|
||||
# if (enable_cef) {
|
||||
# # Actions to perform when the CEF build is enabled.
|
||||
#
|
||||
# # Optionally include CEF source files directly in this target. This
|
||||
# # approach is required for targets that are either directly or
|
||||
# # indirectly included in a `component` target (otherwise
|
||||
# # `is_component_build=true` builds will fail). Keep in mind that these
|
||||
# # files are part of this target instead of the `libcef_static` target
|
||||
# # and therefore subject to any target-specific configuration settings
|
||||
# # such as include paths, defines, compiler flags, etc.
|
||||
# sources += [
|
||||
# "//cef/libcef/browser/foo_helper.cc",
|
||||
# "//cef/libcef/browser/foo_helper.h",
|
||||
# ]
|
||||
#
|
||||
# # Always include the CEF configuration.
|
||||
# configs += [ "//cef/libcef/features:config" ]
|
||||
# }
|
||||
# ...
|
||||
# }
|
||||
#
|
||||
# 2. An existing C++ source file at path/to/foo/foo.cc:
|
||||
#
|
||||
# // Include the `BUILDFLAG(ENABLE_CEF)` definition.
|
||||
# #include "cef/libcef/features/features.h"
|
||||
# ...
|
||||
#
|
||||
# #if BUILDFLAG(ENABLE_CEF)
|
||||
# // CEF headers here...
|
||||
# #include "cef/libcef/browser/foo_helper.h"
|
||||
# #else
|
||||
# // Chrome headers here...
|
||||
# #endif
|
||||
#
|
||||
# // An existing function that is modified for CEF.
|
||||
# void DoFoo() {
|
||||
# #if BUILDFLAG(ENABLE_CEF)
|
||||
# // CEF implementation here...
|
||||
# cef_foo_helper::DoFoo();
|
||||
# #else
|
||||
# // Chrome implementation here...
|
||||
# #endif // !BUILDFLAG(ENABLE_CEF)
|
||||
# }
|
||||
# ...
|
||||
#
|
||||
|
||||
buildflag_header("features") {
|
||||
header = "features.h"
|
||||
@ -17,3 +83,13 @@ buildflag_header("features") {
|
||||
"ENABLE_CEF=$enable_cef",
|
||||
]
|
||||
}
|
||||
|
||||
# Configuration for all targets that include CEF source code library-side.
|
||||
config("config") {
|
||||
# CEF sources use includes relative to the CEF root directory.
|
||||
include_dirs = [ "//cef" ]
|
||||
defines = [
|
||||
"BUILDING_CEF_SHARED",
|
||||
"USING_CHROMIUM_INCLUDES",
|
||||
]
|
||||
}
|
||||
|
@ -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 = error.localized_description.Utf8();
|
||||
const GURL& failedUrl = error.unreachable_url;
|
||||
static_cast<cef_errorcode_t>(error.reason());
|
||||
const std::string& errorText = net::ErrorToString(error.reason());
|
||||
const GURL& failedUrl = error.url();
|
||||
load_handler->OnLoadError(this, cef_frame.get(), errorCode, errorText,
|
||||
failedUrl.spec());
|
||||
}
|
||||
|
@ -26,10 +26,6 @@
|
||||
#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"
|
||||
@ -47,14 +43,14 @@
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/common/pepper_permission_util.h"
|
||||
#include "chrome/common/constants.mojom.h"
|
||||
#include "chrome/common/url_constants.h"
|
||||
#include "chrome/grit/generated_resources.h"
|
||||
#include "chrome/grit/renderer_resources.h"
|
||||
#include "chrome/renderer/content_settings_observer.h"
|
||||
#include "chrome/renderer/chrome_content_renderer_client.h"
|
||||
#include "chrome/renderer/loadtimes_extension_bindings.h"
|
||||
#include "chrome/renderer/media/chrome_key_systems.h"
|
||||
#include "chrome/renderer/pepper/chrome_pdf_print_client.h"
|
||||
#include "chrome/renderer/plugins/power_saver_info.h"
|
||||
#include "chrome/renderer/pepper/pepper_helper.h"
|
||||
#include "chrome/renderer/plugins/chrome_plugin_placeholder.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"
|
||||
@ -70,7 +66,6 @@
|
||||
#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"
|
||||
@ -79,6 +74,10 @@
|
||||
#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"
|
||||
@ -131,34 +130,6 @@ 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::
|
||||
@ -319,6 +290,9 @@ void CefContentRendererClient::WebKitInitialized() {
|
||||
}
|
||||
}
|
||||
|
||||
url_loader_factory_ =
|
||||
blink::Platform::Current()->CreateDefaultURLLoaderFactory();
|
||||
|
||||
// Notify the render process handler.
|
||||
CefRefPtr<CefApp> application = CefContentClient::Get()->application();
|
||||
if (application.get()) {
|
||||
@ -329,21 +303,6 @@ 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.
|
||||
@ -401,7 +360,7 @@ void CefContentRendererClient::RenderThreadStarted() {
|
||||
thread->GetChannel()->AddFilter(new CefRenderMessageFilter);
|
||||
|
||||
if (!command_line->HasSwitch(switches::kDisableSpellChecking)) {
|
||||
spellcheck_.reset(new SpellCheck());
|
||||
spellcheck_.reset(new SpellCheck(this));
|
||||
thread->AddObserver(spellcheck_.get());
|
||||
}
|
||||
|
||||
@ -474,7 +433,7 @@ void CefContentRendererClient::RenderFrameCreated(
|
||||
new CefRenderFrameObserver(render_frame);
|
||||
service_manager::BinderRegistry* registry = render_frame_observer->registry();
|
||||
|
||||
new CefPepperHelper(render_frame);
|
||||
new PepperHelper(render_frame);
|
||||
new printing::PrintRenderFrameHelper(
|
||||
render_frame,
|
||||
base::WrapUnique(new extensions::CefPrintRenderFrameHelperDelegate()));
|
||||
@ -484,8 +443,18 @@ void CefContentRendererClient::RenderFrameCreated(
|
||||
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
if (!command_line->HasSwitch(switches::kDisableSpellChecking))
|
||||
new SpellCheckProvider(render_frame, spellcheck_.get());
|
||||
if (!command_line->HasSwitch(switches::kDisableSpellChecking)) {
|
||||
SpellCheckProvider* spell_check_provider =
|
||||
new SpellCheckProvider(render_frame, spellcheck_.get(), this);
|
||||
// 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())
|
||||
spell_check_provider->EnableSpellcheck(
|
||||
spellcheck_->IsSpellcheckEnabled());
|
||||
}
|
||||
|
||||
BrowserCreated(render_frame->GetRenderView(), render_frame);
|
||||
}
|
||||
@ -494,22 +463,6 @@ void CefContentRendererClient::RenderViewCreated(
|
||||
content::RenderView* render_view) {
|
||||
new CefPrerendererClient(render_view);
|
||||
|
||||
if (extensions::ExtensionsEnabled())
|
||||
extensions_renderer_client_->RenderViewCreated(render_view);
|
||||
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
if (!command_line->HasSwitch(switches::kDisableSpellChecking)) {
|
||||
// This is a workaround keeping the behavior that, the Blink side spellcheck
|
||||
// enabled state is initialized on RenderView creation.
|
||||
// TODO(xiaochengh): Design better way to sync between Chrome-side and
|
||||
// Blink-side spellcheck enabled states. See crbug.com/710097.
|
||||
if (SpellCheckProvider* provider =
|
||||
SpellCheckProvider::Get(render_view->GetMainRenderFrame())) {
|
||||
provider->EnableSpellcheck(spellcheck_->IsSpellcheckEnabled());
|
||||
}
|
||||
}
|
||||
|
||||
BrowserCreated(render_view, render_view->GetMainRenderFrame());
|
||||
}
|
||||
|
||||
@ -525,13 +478,13 @@ bool CefContentRendererClient::OverrideCreatePlugin(
|
||||
}
|
||||
|
||||
GURL url(params.url);
|
||||
CefViewHostMsg_GetPluginInfo_Output output;
|
||||
render_frame->Send(new CefViewHostMsg_GetPluginInfo(
|
||||
chrome::mojom::PluginInfoPtr plugin_info = chrome::mojom::PluginInfo::New();
|
||||
ChromeContentRendererClient::GetPluginInfoHost()->GetPluginInfo(
|
||||
render_frame->GetRoutingID(), url,
|
||||
render_frame->GetWebFrame()->Parent() == nullptr,
|
||||
render_frame->GetWebFrame()->Top()->GetSecurityOrigin(), orig_mime_type,
|
||||
&output));
|
||||
*plugin = CreatePlugin(render_frame, params, output);
|
||||
&plugin_info);
|
||||
*plugin = ChromeContentRendererClient::CreatePlugin(render_frame, params,
|
||||
*plugin_info);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -657,7 +610,7 @@ CefContentRendererClient::CreateBrowserPluginDelegate(
|
||||
|
||||
void CefContentRendererClient::AddSupportedKeySystems(
|
||||
std::vector<std::unique_ptr<::media::KeySystemProperties>>* key_systems) {
|
||||
AddCefKeySystems(key_systems);
|
||||
AddChromeKeySystems(key_systems);
|
||||
}
|
||||
|
||||
void CefContentRendererClient::RunScriptsAtDocumentStart(
|
||||
@ -678,158 +631,38 @@ 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,7 +18,14 @@
|
||||
#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;
|
||||
@ -37,11 +44,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();
|
||||
@ -74,10 +81,12 @@ class CefContentRendererClient : public content::ContentRendererClient,
|
||||
return uncaught_exception_stack_size_;
|
||||
}
|
||||
|
||||
void WebKitInitialized();
|
||||
// Used by CefRenderURLRequest to create WebURLLoaders.
|
||||
blink::WebURLLoaderFactory* url_loader_factory() const {
|
||||
return url_loader_factory_.get();
|
||||
}
|
||||
|
||||
void DevToolsAgentAttached();
|
||||
void DevToolsAgentDetached();
|
||||
void WebKitInitialized();
|
||||
|
||||
// Returns the task runner for the current thread. Returns NULL if the current
|
||||
// thread is not the main render process thread.
|
||||
@ -128,15 +137,18 @@ 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);
|
||||
@ -148,6 +160,7 @@ 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;
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "content/public/renderer/render_thread.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "extensions/common/switches.h"
|
||||
#include "extensions/renderer/api/automation/automation_api_helper.h"
|
||||
#include "extensions/renderer/dispatcher.h"
|
||||
#include "extensions/renderer/extension_frame_helper.h"
|
||||
#include "extensions/renderer/extensions_render_frame_observer.h"
|
||||
@ -150,12 +149,6 @@ void CefExtensionsRendererClient::RenderFrameCreated(
|
||||
extension_dispatcher_->OnRenderFrameCreated(render_frame);
|
||||
}
|
||||
|
||||
void CefExtensionsRendererClient::RenderViewCreated(
|
||||
content::RenderView* render_view) {
|
||||
// Manages its own lifetime.
|
||||
new extensions::AutomationApiHelper(render_view);
|
||||
}
|
||||
|
||||
bool CefExtensionsRendererClient::OverrideCreatePlugin(
|
||||
content::RenderFrame* render_frame,
|
||||
const blink::WebPluginParams& params) {
|
||||
|
@ -25,7 +25,6 @@ class WebURL;
|
||||
namespace content {
|
||||
class BrowserPluginDelegate;
|
||||
class RenderFrame;
|
||||
class RenderView;
|
||||
} // namespace content
|
||||
|
||||
namespace extensions {
|
||||
@ -52,7 +51,6 @@ class CefExtensionsRendererClient : public ExtensionsRendererClient {
|
||||
void RenderThreadStarted();
|
||||
void RenderFrameCreated(content::RenderFrame* render_frame,
|
||||
service_manager::BinderRegistry* registry);
|
||||
void RenderViewCreated(content::RenderView* render_view);
|
||||
bool OverrideCreatePlugin(content::RenderFrame* render_frame,
|
||||
const blink::WebPluginParams& params);
|
||||
bool WillSendRequest(blink::WebLocalFrame* frame,
|
||||
|
@ -1,145 +0,0 @@
|
||||
// Copyright 2013 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/renderer/media/cef_key_systems.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string16.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "components/cdm/renderer/widevine_key_system_properties.h"
|
||||
#include "content/public/renderer/render_thread.h"
|
||||
#include "libcef/common/cef_messages.h"
|
||||
#include "media/base/eme_constants.h"
|
||||
#include "media/base/key_system_properties.h"
|
||||
#include "media/media_features.h"
|
||||
|
||||
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
|
||||
|
||||
// The following must be after widevine_cdm_version.h.
|
||||
|
||||
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_MIN_GLIBC_VERSION)
|
||||
#include <gnu/libc-version.h>
|
||||
#include "base/version.h"
|
||||
#endif
|
||||
|
||||
using media::KeySystemProperties;
|
||||
using media::SupportedCodecs;
|
||||
|
||||
namespace {
|
||||
|
||||
#if BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
bool IsPepperCdmAvailable(
|
||||
const std::string& pepper_type,
|
||||
std::vector<base::string16>* additional_param_names,
|
||||
std::vector<base::string16>* additional_param_values) {
|
||||
bool is_available = false;
|
||||
content::RenderThread::Get()->Send(
|
||||
new CefViewHostMsg_IsInternalPluginAvailableForMimeType(
|
||||
pepper_type, &is_available, additional_param_names,
|
||||
additional_param_values));
|
||||
|
||||
return is_available;
|
||||
}
|
||||
|
||||
#if defined(WIDEVINE_CDM_AVAILABLE)
|
||||
// This function finds "codecs" and parses the value into the vector |codecs|.
|
||||
// Converts the codec strings to UTF-8 since we only expect ASCII strings and
|
||||
// this simplifies the rest of the code in this file.
|
||||
void GetSupportedCodecsForPepperCdm(
|
||||
const std::vector<base::string16>& additional_param_names,
|
||||
const std::vector<base::string16>& additional_param_values,
|
||||
std::vector<std::string>* codecs) {
|
||||
DCHECK(codecs->empty());
|
||||
DCHECK_EQ(additional_param_names.size(), additional_param_values.size());
|
||||
for (size_t i = 0; i < additional_param_names.size(); ++i) {
|
||||
if (additional_param_names[i] ==
|
||||
base::ASCIIToUTF16(kCdmSupportedCodecsParamName)) {
|
||||
const base::string16& codecs_string16 = additional_param_values[i];
|
||||
std::string codecs_string;
|
||||
if (!base::UTF16ToUTF8(codecs_string16.c_str(), codecs_string16.length(),
|
||||
&codecs_string)) {
|
||||
DLOG(WARNING) << "Non-UTF-8 codecs string.";
|
||||
// Continue using the best effort conversion.
|
||||
}
|
||||
*codecs = base::SplitString(
|
||||
codecs_string, std::string(1, kCdmSupportedCodecsValueDelimiter),
|
||||
base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AddPepperBasedWidevine(
|
||||
std::vector<std::unique_ptr<KeySystemProperties>>* concrete_key_systems) {
|
||||
#if defined(WIDEVINE_CDM_MIN_GLIBC_VERSION)
|
||||
base::Version glibc_version(gnu_get_libc_version());
|
||||
DCHECK(glibc_version.IsValid());
|
||||
if (glibc_version < base::Version(WIDEVINE_CDM_MIN_GLIBC_VERSION))
|
||||
return;
|
||||
#endif // defined(WIDEVINE_CDM_MIN_GLIBC_VERSION)
|
||||
|
||||
std::vector<base::string16> additional_param_names;
|
||||
std::vector<base::string16> additional_param_values;
|
||||
if (!IsPepperCdmAvailable(kWidevineCdmPluginMimeType, &additional_param_names,
|
||||
&additional_param_values)) {
|
||||
DVLOG(1) << "Widevine CDM is not currently available.";
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<std::string> codecs;
|
||||
GetSupportedCodecsForPepperCdm(additional_param_names,
|
||||
additional_param_values, &codecs);
|
||||
|
||||
SupportedCodecs supported_codecs = media::EME_CODEC_NONE;
|
||||
|
||||
// Audio codecs are always supported.
|
||||
// TODO(sandersd): Distinguish these from those that are directly supported,
|
||||
// as those may offer a higher level of protection.
|
||||
supported_codecs |= media::EME_CODEC_WEBM_OPUS;
|
||||
supported_codecs |= media::EME_CODEC_WEBM_VORBIS;
|
||||
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
|
||||
supported_codecs |= media::EME_CODEC_MP4_AAC;
|
||||
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
|
||||
|
||||
for (size_t i = 0; i < codecs.size(); ++i) {
|
||||
if (codecs[i] == kCdmSupportedCodecVp8)
|
||||
supported_codecs |= media::EME_CODEC_WEBM_VP8;
|
||||
if (codecs[i] == kCdmSupportedCodecVp9) {
|
||||
supported_codecs |= media::EME_CODEC_WEBM_VP9;
|
||||
supported_codecs |= media::EME_CODEC_COMMON_VP9;
|
||||
}
|
||||
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
|
||||
if (codecs[i] == kCdmSupportedCodecAvc1)
|
||||
supported_codecs |= media::EME_CODEC_MP4_AVC1;
|
||||
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
|
||||
}
|
||||
|
||||
using Robustness = cdm::WidevineKeySystemProperties::Robustness;
|
||||
concrete_key_systems->emplace_back(new cdm::WidevineKeySystemProperties(
|
||||
supported_codecs,
|
||||
Robustness::SW_SECURE_CRYPTO, // Maximum audio robustness.
|
||||
Robustness::SW_SECURE_DECODE, // Maximum video robustness.
|
||||
media::EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-license.
|
||||
media::EmeSessionTypeSupport::
|
||||
NOT_SUPPORTED, // persistent-release-message.
|
||||
media::EmeFeatureSupport::REQUESTABLE, // Persistent state.
|
||||
media::EmeFeatureSupport::NOT_SUPPORTED)); // Distinctive identifier.
|
||||
}
|
||||
#endif // defined(WIDEVINE_CDM_AVAILABLE)
|
||||
#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
|
||||
} // namespace
|
||||
|
||||
void AddCefKeySystems(
|
||||
std::vector<std::unique_ptr<KeySystemProperties>>* key_systems_properties) {
|
||||
#if BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
#if defined(WIDEVINE_CDM_AVAILABLE)
|
||||
AddPepperBasedWidevine(key_systems_properties);
|
||||
#endif // defined(WIDEVINE_CDM_AVAILABLE)
|
||||
#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
// Copyright 2013 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_RENDERER_MEDIA_CEF_KEY_SYSTEMS_H_
|
||||
#define CEF_LIBCEF_RENDERER_MEDIA_CEF_KEY_SYSTEMS_H_
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace media {
|
||||
class KeySystemProperties;
|
||||
}
|
||||
|
||||
// Register the key systems supported by populating |key_systems_properties|.
|
||||
void AddCefKeySystems(std::vector<std::unique_ptr<media::KeySystemProperties>>*
|
||||
key_systems_properties);
|
||||
|
||||
#endif // CEF_LIBCEF_RENDERER_MEDIA_CEF_KEY_SYSTEMS_H_
|
@ -1,29 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/renderer/pepper/pepper_helper.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "libcef/renderer/pepper/renderer_pepper_host_factory.h"
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "content/public/renderer/renderer_ppapi_host.h"
|
||||
#include "ppapi/host/ppapi_host.h"
|
||||
|
||||
CefPepperHelper::CefPepperHelper(content::RenderFrame* render_frame)
|
||||
: RenderFrameObserver(render_frame) {}
|
||||
|
||||
CefPepperHelper::~CefPepperHelper() {}
|
||||
|
||||
void CefPepperHelper::DidCreatePepperPlugin(content::RendererPpapiHost* host) {
|
||||
// TODO(brettw) figure out how to hook up the host factory. It needs some
|
||||
// kind of filter-like system to allow dynamic additions.
|
||||
host->GetPpapiHost()->AddHostFactoryFilter(
|
||||
base::MakeUnique<CefRendererPepperHostFactory>(host));
|
||||
}
|
||||
|
||||
void CefPepperHelper::OnDestruct() {
|
||||
delete this;
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_RENDERER_PEPPER_PEPPER_HELPER_H_
|
||||
#define CEF_LIBCEF_RENDERER_PEPPER_PEPPER_HELPER_H_
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "content/public/renderer/render_frame_observer.h"
|
||||
|
||||
// This class listens for Pepper creation events from the RenderFrame and
|
||||
// attaches the parts required for Chrome-specific plugin support.
|
||||
class CefPepperHelper : public content::RenderFrameObserver {
|
||||
public:
|
||||
explicit CefPepperHelper(content::RenderFrame* render_frame);
|
||||
~CefPepperHelper() override;
|
||||
|
||||
// RenderFrameObserver.
|
||||
void DidCreatePepperPlugin(content::RendererPpapiHost* host) override;
|
||||
void OnDestruct() override;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(CefPepperHelper);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_RENDERER_PEPPER_PEPPER_HELPER_H_
|
@ -1,110 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/renderer/pepper/renderer_pepper_host_factory.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "chrome/renderer/pepper/pepper_flash_drm_renderer_host.h"
|
||||
#include "chrome/renderer/pepper/pepper_flash_font_file_host.h"
|
||||
#include "chrome/renderer/pepper/pepper_flash_fullscreen_host.h"
|
||||
#include "chrome/renderer/pepper/pepper_flash_menu_host.h"
|
||||
#include "chrome/renderer/pepper/pepper_flash_renderer_host.h"
|
||||
#include "chrome/renderer/pepper/pepper_uma_host.h"
|
||||
#include "components/pdf/renderer/pepper_pdf_host.h"
|
||||
#include "content/public/renderer/renderer_ppapi_host.h"
|
||||
#include "ppapi/host/ppapi_host.h"
|
||||
#include "ppapi/host/resource_host.h"
|
||||
#include "ppapi/proxy/ppapi_message_utils.h"
|
||||
#include "ppapi/proxy/ppapi_messages.h"
|
||||
#include "ppapi/shared_impl/ppapi_permissions.h"
|
||||
|
||||
using ppapi::host::ResourceHost;
|
||||
|
||||
CefRendererPepperHostFactory::CefRendererPepperHostFactory(
|
||||
content::RendererPpapiHost* host)
|
||||
: host_(host) {}
|
||||
|
||||
CefRendererPepperHostFactory::~CefRendererPepperHostFactory() {}
|
||||
|
||||
std::unique_ptr<ResourceHost> CefRendererPepperHostFactory::CreateResourceHost(
|
||||
ppapi::host::PpapiHost* host,
|
||||
PP_Resource resource,
|
||||
PP_Instance instance,
|
||||
const IPC::Message& message) {
|
||||
DCHECK_EQ(host_->GetPpapiHost(), host);
|
||||
|
||||
// Make sure the plugin is giving us a valid instance for this resource.
|
||||
if (!host_->IsValidInstance(instance))
|
||||
return nullptr;
|
||||
|
||||
if (host_->GetPpapiHost()->permissions().HasPermission(
|
||||
ppapi::PERMISSION_FLASH)) {
|
||||
switch (message.type()) {
|
||||
case PpapiHostMsg_Flash_Create::ID: {
|
||||
return base::MakeUnique<PepperFlashRendererHost>(host_, instance,
|
||||
resource);
|
||||
}
|
||||
case PpapiHostMsg_FlashFullscreen_Create::ID: {
|
||||
return base::MakeUnique<PepperFlashFullscreenHost>(host_, instance,
|
||||
resource);
|
||||
}
|
||||
case PpapiHostMsg_FlashMenu_Create::ID: {
|
||||
ppapi::proxy::SerializedFlashMenu serialized_menu;
|
||||
if (ppapi::UnpackMessage<PpapiHostMsg_FlashMenu_Create>(
|
||||
message, &serialized_menu)) {
|
||||
return base::MakeUnique<PepperFlashMenuHost>(
|
||||
host_, instance, resource, serialized_menu);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(raymes): PDF also needs access to the FlashFontFileHost currently.
|
||||
// We should either rename PPB_FlashFont_File to PPB_FontFile_Private or get
|
||||
// rid of its use in PDF if possible.
|
||||
if (host_->GetPpapiHost()->permissions().HasPermission(
|
||||
ppapi::PERMISSION_FLASH) ||
|
||||
host_->GetPpapiHost()->permissions().HasPermission(
|
||||
ppapi::PERMISSION_PRIVATE)) {
|
||||
switch (message.type()) {
|
||||
case PpapiHostMsg_FlashFontFile_Create::ID: {
|
||||
ppapi::proxy::SerializedFontDescription description;
|
||||
PP_PrivateFontCharset charset;
|
||||
if (ppapi::UnpackMessage<PpapiHostMsg_FlashFontFile_Create>(
|
||||
message, &description, &charset)) {
|
||||
return base::MakeUnique<PepperFlashFontFileHost>(
|
||||
host_, instance, resource, description, charset);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PpapiHostMsg_FlashDRM_Create::ID:
|
||||
return base::MakeUnique<PepperFlashDRMRendererHost>(host_, instance,
|
||||
resource);
|
||||
}
|
||||
}
|
||||
|
||||
if (host_->GetPpapiHost()->permissions().HasPermission(
|
||||
ppapi::PERMISSION_PRIVATE)) {
|
||||
switch (message.type()) {
|
||||
case PpapiHostMsg_PDF_Create::ID: {
|
||||
return base::MakeUnique<pdf::PepperPDFHost>(host_, instance, resource);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Permissions for the following interfaces will be checked at the
|
||||
// time of the corresponding instance's method calls. Currently these
|
||||
// interfaces are available only for whitelisted apps which may not have
|
||||
// access to the other private interfaces.
|
||||
switch (message.type()) {
|
||||
case PpapiHostMsg_UMA_Create::ID: {
|
||||
return base::MakeUnique<PepperUMAHost>(host_, instance, resource);
|
||||
}
|
||||
}
|
||||
|
||||
NOTREACHED() << "Unhandled message type: " << message.type();
|
||||
return nullptr;
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef LIBCEF_RENDERER_PEPPER_RENDERER_PEPPER_HOST_FACTORY_H_
|
||||
#define LIBCEF_RENDERER_PEPPER_RENDERER_PEPPER_HOST_FACTORY_H_
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "ppapi/host/host_factory.h"
|
||||
|
||||
namespace content {
|
||||
class RendererPpapiHost;
|
||||
}
|
||||
|
||||
class CefRendererPepperHostFactory : public ppapi::host::HostFactory {
|
||||
public:
|
||||
explicit CefRendererPepperHostFactory(content::RendererPpapiHost* host);
|
||||
~CefRendererPepperHostFactory() override;
|
||||
|
||||
// HostFactory.
|
||||
std::unique_ptr<ppapi::host::ResourceHost> CreateResourceHost(
|
||||
ppapi::host::PpapiHost* host,
|
||||
PP_Resource resource,
|
||||
PP_Instance instance,
|
||||
const IPC::Message& message) override;
|
||||
|
||||
private:
|
||||
// Not owned by this object.
|
||||
content::RendererPpapiHost* host_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefRendererPepperHostFactory);
|
||||
};
|
||||
|
||||
#endif // LIBCEF_RENDERER_PEPPER_RENDERER_PEPPER_HOST_FACTORY_H_
|
@ -1,313 +0,0 @@
|
||||
// Copyright 2013 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/renderer/plugins/cef_plugin_placeholder.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/common/cef_messages.h"
|
||||
#include "libcef/renderer/content_renderer_client.h"
|
||||
#include "libcef/renderer/plugins/plugin_preroller.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/values.h"
|
||||
#include "chrome/grit/generated_resources.h"
|
||||
#include "chrome/grit/renderer_resources.h"
|
||||
#include "chrome/renderer/custom_menu_commands.h"
|
||||
#include "components/strings/grit/components_strings.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "content/public/common/context_menu_params.h"
|
||||
#include "content/public/renderer/render_frame.h"
|
||||
#include "content/public/renderer/render_thread.h"
|
||||
#include "gin/object_template_builder.h"
|
||||
#include "third_party/WebKit/public/platform/URLConversion.h"
|
||||
#include "third_party/WebKit/public/platform/WebInputEvent.h"
|
||||
#include "third_party/WebKit/public/platform/WebMouseEvent.h"
|
||||
#include "third_party/WebKit/public/web/WebDocument.h"
|
||||
#include "third_party/WebKit/public/web/WebLocalFrame.h"
|
||||
#include "third_party/WebKit/public/web/WebPluginContainer.h"
|
||||
#include "third_party/WebKit/public/web/WebScriptSource.h"
|
||||
#include "third_party/WebKit/public/web/WebView.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
#include "ui/base/webui/jstemplate_builder.h"
|
||||
#include "ui/gfx/geometry/size.h"
|
||||
#include "url/url_util.h"
|
||||
|
||||
using base::UserMetricsAction;
|
||||
using content::RenderThread;
|
||||
using content::RenderView;
|
||||
|
||||
namespace {
|
||||
const CefPluginPlaceholder* g_last_active_menu = NULL;
|
||||
} // namespace
|
||||
|
||||
gin::WrapperInfo CefPluginPlaceholder::kWrapperInfo = {gin::kEmbedderNativeGin};
|
||||
|
||||
CefPluginPlaceholder::CefPluginPlaceholder(content::RenderFrame* render_frame,
|
||||
const blink::WebPluginParams& params,
|
||||
const std::string& html_data,
|
||||
const base::string16& title)
|
||||
: plugins::LoadablePluginPlaceholder(render_frame, params, html_data),
|
||||
status_(CefViewHostMsg_GetPluginInfo_Status::kAllowed),
|
||||
title_(title),
|
||||
context_menu_request_id_(0) {
|
||||
RenderThread::Get()->AddObserver(this);
|
||||
}
|
||||
|
||||
CefPluginPlaceholder::~CefPluginPlaceholder() {
|
||||
RenderThread::Get()->RemoveObserver(this);
|
||||
if (context_menu_request_id_ && render_frame())
|
||||
render_frame()->CancelContextMenu(context_menu_request_id_);
|
||||
}
|
||||
|
||||
// static
|
||||
CefPluginPlaceholder* CefPluginPlaceholder::CreateLoadableMissingPlugin(
|
||||
content::RenderFrame* render_frame,
|
||||
const blink::WebPluginParams& params) {
|
||||
const base::StringPiece template_html(
|
||||
ui::ResourceBundle::GetSharedInstance().GetRawDataResource(
|
||||
IDR_BLOCKED_PLUGIN_HTML));
|
||||
|
||||
base::DictionaryValue values;
|
||||
values.SetString("message",
|
||||
l10n_util::GetStringUTF8(IDS_PLUGIN_NOT_SUPPORTED));
|
||||
|
||||
std::string html_data = webui::GetI18nTemplateHtml(template_html, &values);
|
||||
|
||||
// Will destroy itself when its WebViewPlugin is going away.
|
||||
return new CefPluginPlaceholder(render_frame, params, html_data,
|
||||
params.mime_type.Utf16());
|
||||
}
|
||||
|
||||
// static
|
||||
CefPluginPlaceholder* CefPluginPlaceholder::CreateBlockedPlugin(
|
||||
content::RenderFrame* render_frame,
|
||||
const blink::WebPluginParams& params,
|
||||
const content::WebPluginInfo& info,
|
||||
const std::string& identifier,
|
||||
const base::string16& name,
|
||||
int template_id,
|
||||
const base::string16& message,
|
||||
const PowerSaverInfo& power_saver_info) {
|
||||
base::DictionaryValue values;
|
||||
values.SetString("message", message);
|
||||
values.SetString("name", name);
|
||||
values.SetString("hide", l10n_util::GetStringUTF8(IDS_PLUGIN_HIDE));
|
||||
values.SetString(
|
||||
"pluginType",
|
||||
render_frame->IsMainFrame() &&
|
||||
render_frame->GetWebFrame()->GetDocument().IsPluginDocument()
|
||||
? "document"
|
||||
: "embedded");
|
||||
|
||||
if (!power_saver_info.poster_attribute.empty()) {
|
||||
values.SetString("poster", power_saver_info.poster_attribute);
|
||||
values.SetString("baseurl", power_saver_info.base_url.spec());
|
||||
|
||||
if (!power_saver_info.custom_poster_size.IsEmpty()) {
|
||||
float zoom_factor = blink::WebView::ZoomLevelToZoomFactor(
|
||||
render_frame->GetWebFrame()->View()->ZoomLevel());
|
||||
int width =
|
||||
roundf(power_saver_info.custom_poster_size.width() / zoom_factor);
|
||||
int height =
|
||||
roundf(power_saver_info.custom_poster_size.height() / zoom_factor);
|
||||
values.SetString("visibleWidth", base::IntToString(width) + "px");
|
||||
values.SetString("visibleHeight", base::IntToString(height) + "px");
|
||||
}
|
||||
}
|
||||
|
||||
const base::StringPiece template_html(
|
||||
ui::ResourceBundle::GetSharedInstance().GetRawDataResource(template_id));
|
||||
|
||||
DCHECK(!template_html.empty())
|
||||
<< "unable to load template. ID: " << template_id;
|
||||
std::string html_data = webui::GetI18nTemplateHtml(template_html, &values);
|
||||
|
||||
// |blocked_plugin| will destroy itself when its WebViewPlugin is going away.
|
||||
CefPluginPlaceholder* blocked_plugin =
|
||||
new CefPluginPlaceholder(render_frame, params, html_data, name);
|
||||
|
||||
if (!power_saver_info.poster_attribute.empty())
|
||||
blocked_plugin->BlockForPowerSaverPoster();
|
||||
blocked_plugin->SetPluginInfo(info);
|
||||
blocked_plugin->SetIdentifier(identifier);
|
||||
|
||||
blocked_plugin->set_power_saver_enabled(power_saver_info.power_saver_enabled);
|
||||
blocked_plugin->set_blocked_for_background_tab(
|
||||
power_saver_info.blocked_for_background_tab);
|
||||
|
||||
return blocked_plugin;
|
||||
}
|
||||
|
||||
void CefPluginPlaceholder::SetStatus(
|
||||
CefViewHostMsg_GetPluginInfo_Status status) {
|
||||
status_ = status;
|
||||
}
|
||||
|
||||
bool CefPluginPlaceholder::OnMessageReceived(const IPC::Message& message) {
|
||||
// We don't swallow these messages because multiple blocked plugins and other
|
||||
// objects have an interest in them.
|
||||
IPC_BEGIN_MESSAGE_MAP(CefPluginPlaceholder, message)
|
||||
IPC_MESSAGE_HANDLER(CefViewMsg_LoadBlockedPlugins, OnLoadBlockedPlugins)
|
||||
IPC_END_MESSAGE_MAP()
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefPluginPlaceholder::ShowPermissionBubbleCallback() {
|
||||
// CEF does not use IDR_PREFER_HTML_PLUGIN_HTML which would originate this
|
||||
// callback.
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
void CefPluginPlaceholder::PluginListChanged() {
|
||||
if (!render_frame() || !plugin())
|
||||
return;
|
||||
blink::WebLocalFrame* web_frame = render_frame()->GetWebFrame();
|
||||
if (!web_frame->Top()->IsWebLocalFrame())
|
||||
return;
|
||||
blink::WebDocument document =
|
||||
web_frame->Top()->ToWebLocalFrame()->GetDocument();
|
||||
if (document.IsNull())
|
||||
return;
|
||||
|
||||
CefViewHostMsg_GetPluginInfo_Output output;
|
||||
std::string mime_type(GetPluginParams().mime_type.Utf8());
|
||||
render_frame()->Send(new CefViewHostMsg_GetPluginInfo(
|
||||
routing_id(), GURL(GetPluginParams().url), web_frame->Parent() == nullptr,
|
||||
web_frame->Top()->GetSecurityOrigin(), mime_type, &output));
|
||||
if (output.status == status_)
|
||||
return;
|
||||
blink::WebPlugin* new_plugin = CefContentRendererClient::CreatePlugin(
|
||||
render_frame(), GetPluginParams(), output);
|
||||
ReplacePlugin(new_plugin);
|
||||
}
|
||||
|
||||
void CefPluginPlaceholder::OnMenuAction(int request_id, unsigned action) {
|
||||
DCHECK_EQ(context_menu_request_id_, request_id);
|
||||
if (g_last_active_menu != this)
|
||||
return;
|
||||
switch (action) {
|
||||
case chrome::MENU_COMMAND_PLUGIN_RUN: {
|
||||
RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Load_Menu"));
|
||||
MarkPluginEssential(
|
||||
content::PluginInstanceThrottler::UNTHROTTLE_METHOD_BY_CLICK);
|
||||
LoadPlugin();
|
||||
break;
|
||||
}
|
||||
case chrome::MENU_COMMAND_PLUGIN_HIDE: {
|
||||
RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Hide_Menu"));
|
||||
HidePlugin();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
NOTREACHED();
|
||||
}
|
||||
}
|
||||
|
||||
void CefPluginPlaceholder::OnMenuClosed(int request_id) {
|
||||
DCHECK_EQ(context_menu_request_id_, request_id);
|
||||
context_menu_request_id_ = 0;
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> CefPluginPlaceholder::GetV8Handle(v8::Isolate* isolate) {
|
||||
return gin::CreateHandle(isolate, this).ToV8();
|
||||
}
|
||||
|
||||
void CefPluginPlaceholder::ShowContextMenu(const blink::WebMouseEvent& event) {
|
||||
if (context_menu_request_id_)
|
||||
return; // Don't allow nested context menu requests.
|
||||
if (!render_frame())
|
||||
return;
|
||||
|
||||
content::ContextMenuParams params;
|
||||
|
||||
if (!title_.empty()) {
|
||||
content::MenuItem name_item;
|
||||
name_item.label = title_;
|
||||
params.custom_items.push_back(name_item);
|
||||
|
||||
content::MenuItem separator_item;
|
||||
separator_item.type = content::MenuItem::SEPARATOR;
|
||||
params.custom_items.push_back(separator_item);
|
||||
}
|
||||
|
||||
if (!GetPluginInfo().path.value().empty()) {
|
||||
content::MenuItem run_item;
|
||||
run_item.action = chrome::MENU_COMMAND_PLUGIN_RUN;
|
||||
// Disable this menu item if the plugin is blocked by policy.
|
||||
run_item.enabled = LoadingAllowed();
|
||||
run_item.label = l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLUGIN_RUN);
|
||||
params.custom_items.push_back(run_item);
|
||||
}
|
||||
|
||||
content::MenuItem hide_item;
|
||||
hide_item.action = chrome::MENU_COMMAND_PLUGIN_HIDE;
|
||||
bool is_main_frame_plugin_document =
|
||||
render_frame()->IsMainFrame() &&
|
||||
render_frame()->GetWebFrame()->GetDocument().IsPluginDocument();
|
||||
hide_item.enabled = !is_main_frame_plugin_document;
|
||||
hide_item.label = l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLUGIN_HIDE);
|
||||
params.custom_items.push_back(hide_item);
|
||||
|
||||
blink::WebPoint point(event.PositionInWidget().x, event.PositionInWidget().y);
|
||||
if (plugin() && plugin()->Container())
|
||||
point = plugin()->Container()->LocalToRootFramePoint(point);
|
||||
|
||||
params.x = point.x;
|
||||
params.y = point.y;
|
||||
|
||||
context_menu_request_id_ = render_frame()->ShowContextMenu(this, params);
|
||||
g_last_active_menu = this;
|
||||
}
|
||||
|
||||
blink::WebPlugin* CefPluginPlaceholder::CreatePlugin() {
|
||||
std::unique_ptr<content::PluginInstanceThrottler> throttler;
|
||||
// If the plugin has already been marked essential in its placeholder form,
|
||||
// we shouldn't create a new throttler and start the process all over again.
|
||||
if (power_saver_enabled()) {
|
||||
throttler = content::PluginInstanceThrottler::Create(
|
||||
content::RenderFrame::DONT_RECORD_DECISION);
|
||||
// PluginPreroller manages its own lifetime.
|
||||
new CefPluginPreroller(
|
||||
render_frame(), GetPluginParams(), GetPluginInfo(), GetIdentifier(),
|
||||
title_, l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, title_),
|
||||
throttler.get());
|
||||
}
|
||||
return render_frame()->CreatePlugin(GetPluginInfo(), GetPluginParams(),
|
||||
std::move(throttler));
|
||||
}
|
||||
|
||||
void CefPluginPlaceholder::OnBlockedContent(
|
||||
content::RenderFrame::PeripheralContentStatus status,
|
||||
bool is_same_origin) {
|
||||
DCHECK(render_frame());
|
||||
}
|
||||
|
||||
gin::ObjectTemplateBuilder CefPluginPlaceholder::GetObjectTemplateBuilder(
|
||||
v8::Isolate* isolate) {
|
||||
gin::ObjectTemplateBuilder builder =
|
||||
gin::Wrappable<CefPluginPlaceholder>::GetObjectTemplateBuilder(isolate)
|
||||
.SetMethod<void (CefPluginPlaceholder::*)()>(
|
||||
"hide", &CefPluginPlaceholder::HideCallback)
|
||||
.SetMethod<void (CefPluginPlaceholder::*)()>(
|
||||
"load", &CefPluginPlaceholder::LoadCallback)
|
||||
.SetMethod<void (CefPluginPlaceholder::*)()>(
|
||||
"didFinishLoading",
|
||||
&CefPluginPlaceholder::DidFinishLoadingCallback)
|
||||
.SetMethod("showPermissionBubble",
|
||||
&CefPluginPlaceholder::ShowPermissionBubbleCallback);
|
||||
|
||||
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
switches::kEnablePluginPlaceholderTesting)) {
|
||||
builder.SetMethod<void (CefPluginPlaceholder::*)()>(
|
||||
"didFinishIconRepositionForTesting",
|
||||
&CefPluginPlaceholder::DidFinishIconRepositionForTestingCallback);
|
||||
}
|
||||
|
||||
return builder;
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
// Copyright 2013 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_RENDERER_PLUGINS_CEF_PLUGIN_PLACEHOLDER_H_
|
||||
#define CEF_LIBCEF_RENDERER_PLUGINS_CEF_PLUGIN_PLACEHOLDER_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "chrome/renderer/plugins/power_saver_info.h"
|
||||
#include "components/plugins/renderer/loadable_plugin_placeholder.h"
|
||||
#include "content/public/renderer/context_menu_client.h"
|
||||
#include "content/public/renderer/render_thread_observer.h"
|
||||
|
||||
enum class CefViewHostMsg_GetPluginInfo_Status;
|
||||
|
||||
class CefPluginPlaceholder final : public plugins::LoadablePluginPlaceholder,
|
||||
public content::RenderThreadObserver,
|
||||
public content::ContextMenuClient,
|
||||
public gin::Wrappable<CefPluginPlaceholder> {
|
||||
public:
|
||||
static gin::WrapperInfo kWrapperInfo;
|
||||
|
||||
static CefPluginPlaceholder* CreateBlockedPlugin(
|
||||
content::RenderFrame* render_frame,
|
||||
const blink::WebPluginParams& params,
|
||||
const content::WebPluginInfo& info,
|
||||
const std::string& identifier,
|
||||
const base::string16& name,
|
||||
int resource_id,
|
||||
const base::string16& message,
|
||||
const PowerSaverInfo& power_saver_info);
|
||||
|
||||
// Creates a new WebViewPlugin with a MissingPlugin as a delegate.
|
||||
static CefPluginPlaceholder* CreateLoadableMissingPlugin(
|
||||
content::RenderFrame* render_frame,
|
||||
const blink::WebPluginParams& params);
|
||||
|
||||
void SetStatus(CefViewHostMsg_GetPluginInfo_Status status);
|
||||
|
||||
private:
|
||||
CefPluginPlaceholder(content::RenderFrame* render_frame,
|
||||
const blink::WebPluginParams& params,
|
||||
const std::string& html_data,
|
||||
const base::string16& title);
|
||||
~CefPluginPlaceholder() override;
|
||||
|
||||
// content::LoadablePluginPlaceholder overrides:
|
||||
blink::WebPlugin* CreatePlugin() override;
|
||||
void OnBlockedContent(content::RenderFrame::PeripheralContentStatus status,
|
||||
bool is_same_origin) override;
|
||||
|
||||
// gin::Wrappable (via PluginPlaceholder) method
|
||||
gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
|
||||
v8::Isolate* isolate) final;
|
||||
|
||||
// content::RenderViewObserver (via PluginPlaceholder) override:
|
||||
bool OnMessageReceived(const IPC::Message& message) override;
|
||||
|
||||
// WebViewPlugin::Delegate (via PluginPlaceholder) methods:
|
||||
v8::Local<v8::Value> GetV8Handle(v8::Isolate* isolate) override;
|
||||
void ShowContextMenu(const blink::WebMouseEvent&) override;
|
||||
|
||||
// content::RenderThreadObserver methods:
|
||||
void PluginListChanged() override;
|
||||
|
||||
// content::ContextMenuClient methods:
|
||||
void OnMenuAction(int request_id, unsigned action) override;
|
||||
void OnMenuClosed(int request_id) override;
|
||||
|
||||
// Show the Plugins permission bubble.
|
||||
void ShowPermissionBubbleCallback();
|
||||
|
||||
CefViewHostMsg_GetPluginInfo_Status status_;
|
||||
|
||||
base::string16 title_;
|
||||
|
||||
int context_menu_request_id_; // Nonzero when request pending.
|
||||
base::string16 plugin_name_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefPluginPlaceholder);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_RENDERER_PLUGINS_CEF_PLUGIN_PLACEHOLDER_H_
|
@ -1,95 +0,0 @@
|
||||
// Copyright 2015 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/renderer/plugins/plugin_preroller.h"
|
||||
|
||||
#include "libcef/renderer/plugins/cef_plugin_placeholder.h"
|
||||
|
||||
#include "base/base64.h"
|
||||
#include "chrome/grit/generated_resources.h"
|
||||
#include "chrome/grit/renderer_resources.h"
|
||||
#include "chrome/renderer/plugins/power_saver_info.h"
|
||||
#include "third_party/WebKit/public/platform/WebRect.h"
|
||||
#include "third_party/WebKit/public/web/WebElement.h"
|
||||
#include "third_party/WebKit/public/web/WebPlugin.h"
|
||||
#include "third_party/WebKit/public/web/WebPluginContainer.h"
|
||||
#include "ui/gfx/codec/png_codec.h"
|
||||
|
||||
CefPluginPreroller::CefPluginPreroller(
|
||||
content::RenderFrame* render_frame,
|
||||
const blink::WebPluginParams& params,
|
||||
const content::WebPluginInfo& info,
|
||||
const std::string& identifier,
|
||||
const base::string16& name,
|
||||
const base::string16& message,
|
||||
content::PluginInstanceThrottler* throttler)
|
||||
: RenderFrameObserver(render_frame),
|
||||
params_(params),
|
||||
info_(info),
|
||||
identifier_(identifier),
|
||||
name_(name),
|
||||
message_(message),
|
||||
throttler_(throttler) {
|
||||
DCHECK(throttler);
|
||||
throttler_->AddObserver(this);
|
||||
}
|
||||
|
||||
CefPluginPreroller::~CefPluginPreroller() {
|
||||
if (throttler_)
|
||||
throttler_->RemoveObserver(this);
|
||||
}
|
||||
|
||||
void CefPluginPreroller::OnKeyframeExtracted(const SkBitmap* bitmap) {
|
||||
std::vector<unsigned char> png_data;
|
||||
if (!gfx::PNGCodec::EncodeBGRASkBitmap(*bitmap, false, &png_data)) {
|
||||
DLOG(ERROR) << "Provided keyframe could not be encoded as PNG.";
|
||||
return;
|
||||
}
|
||||
|
||||
base::StringPiece png_as_string(reinterpret_cast<char*>(&png_data[0]),
|
||||
png_data.size());
|
||||
|
||||
std::string data_url_header = "data:image/png;base64,";
|
||||
std::string data_url_body;
|
||||
base::Base64Encode(png_as_string, &data_url_body);
|
||||
keyframe_data_url_ = GURL(data_url_header + data_url_body);
|
||||
}
|
||||
|
||||
void CefPluginPreroller::OnThrottleStateChange() {
|
||||
if (!throttler_->IsThrottled())
|
||||
return;
|
||||
|
||||
PowerSaverInfo power_saver_info;
|
||||
power_saver_info.power_saver_enabled = true;
|
||||
power_saver_info.poster_attribute = keyframe_data_url_.spec();
|
||||
power_saver_info.custom_poster_size = throttler_->GetSize();
|
||||
|
||||
CefPluginPlaceholder* placeholder = CefPluginPlaceholder::CreateBlockedPlugin(
|
||||
render_frame(), params_, info_, identifier_, name_,
|
||||
IDR_PLUGIN_POSTER_HTML, message_, power_saver_info);
|
||||
placeholder->SetPremadePlugin(throttler_);
|
||||
placeholder->set_power_saver_enabled(true);
|
||||
placeholder->AllowLoading();
|
||||
|
||||
blink::WebPluginContainer* container =
|
||||
throttler_->GetWebPlugin()->Container();
|
||||
container->SetPlugin(placeholder->plugin());
|
||||
|
||||
bool success = placeholder->plugin()->Initialize(container);
|
||||
DCHECK(success);
|
||||
|
||||
container->Invalidate();
|
||||
container->ReportGeometry();
|
||||
|
||||
delete this;
|
||||
}
|
||||
|
||||
void CefPluginPreroller::OnThrottlerDestroyed() {
|
||||
throttler_ = nullptr;
|
||||
delete this;
|
||||
}
|
||||
|
||||
void CefPluginPreroller::OnDestruct() {
|
||||
delete this;
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
// Copyright 2015 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_RENDERER_PLUGINS_PLUGIN_PREROLLER_H_
|
||||
#define CEF_LIBCEF_RENDERER_PLUGINS_PLUGIN_PREROLLER_H_
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "content/public/common/webplugininfo.h"
|
||||
#include "content/public/renderer/plugin_instance_throttler.h"
|
||||
#include "content/public/renderer/render_frame_observer.h"
|
||||
#include "third_party/WebKit/public/web/WebPluginParams.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
class SkBitmap;
|
||||
|
||||
// This class manages a plugin briefly for the purposes of keyframe extraction.
|
||||
// Once a keyframe has been extracted, this class will replace the plugin with
|
||||
// a ChromePluginPlaceholder. The actual plugin will continue to live in a
|
||||
// throttled state. This class manages its own lifetime.
|
||||
class CefPluginPreroller : public content::PluginInstanceThrottler::Observer,
|
||||
public content::RenderFrameObserver {
|
||||
public:
|
||||
// Does not take ownership of |render_frame| or |throttler|.
|
||||
CefPluginPreroller(content::RenderFrame* render_frame,
|
||||
const blink::WebPluginParams& params,
|
||||
const content::WebPluginInfo& info,
|
||||
const std::string& identifier,
|
||||
const base::string16& name,
|
||||
const base::string16& message,
|
||||
content::PluginInstanceThrottler* throttler);
|
||||
|
||||
~CefPluginPreroller() override;
|
||||
|
||||
private:
|
||||
// content::PluginInstanceThrottler::Observer methods:
|
||||
void OnKeyframeExtracted(const SkBitmap* bitmap) override;
|
||||
void OnThrottleStateChange() override;
|
||||
void OnThrottlerDestroyed() override;
|
||||
|
||||
// content::RenderFrameObserver implementation.
|
||||
void OnDestruct() override;
|
||||
|
||||
blink::WebPluginParams params_;
|
||||
content::WebPluginInfo info_;
|
||||
std::string identifier_;
|
||||
base::string16 name_;
|
||||
base::string16 message_;
|
||||
|
||||
content::PluginInstanceThrottler* throttler_;
|
||||
|
||||
GURL keyframe_data_url_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefPluginPreroller);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_RENDERER_PLUGINS_PLUGIN_PREROLLER_H_
|
@ -11,9 +11,7 @@
|
||||
#include "base/bind.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "chrome/common/render_messages.h"
|
||||
#include "content/common/devtools_messages.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/renderer/devtools/devtools_agent.h"
|
||||
#include "third_party/WebKit/public/platform/WebString.h"
|
||||
#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
|
||||
#include "url/gurl.h"
|
||||
@ -35,17 +33,7 @@ void CefRenderMessageFilter::OnFilterRemoved() {
|
||||
|
||||
bool CefRenderMessageFilter::OnMessageReceived(const IPC::Message& message) {
|
||||
bool handled = true;
|
||||
|
||||
// Observe the DevTools messages but don't handle them.
|
||||
if (message.type() == DevToolsAgentMsg_Attach::ID) {
|
||||
handled = false;
|
||||
} else if (message.type() == DevToolsAgentMsg_Detach::ID) {
|
||||
OnDevToolsAgentDetach(message.routing_id());
|
||||
return false;
|
||||
}
|
||||
|
||||
IPC_BEGIN_MESSAGE_MAP(CefRenderMessageFilter, message)
|
||||
IPC_MESSAGE_HANDLER(DevToolsAgentMsg_Attach, OnDevToolsAgentAttach)
|
||||
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_IsCrashReportingEnabled,
|
||||
OnIsCrashReportingEnabled)
|
||||
IPC_MESSAGE_UNHANDLED(handled = false)
|
||||
@ -79,44 +67,8 @@ bool CefRenderMessageFilter::Send(IPC::Message* message) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefRenderMessageFilter::OnDevToolsAgentAttach(const std::string& host_id,
|
||||
int session_id) {
|
||||
CEF_POST_TASK_RT(
|
||||
base::Bind(&CefRenderMessageFilter::OnDevToolsAgentAttach_RT, this));
|
||||
}
|
||||
|
||||
void CefRenderMessageFilter::OnDevToolsAgentDetach(int32_t routing_id) {
|
||||
CEF_POST_TASK_RT(base::Bind(&CefRenderMessageFilter::OnDevToolsAgentDetach_RT,
|
||||
this, routing_id));
|
||||
}
|
||||
|
||||
void CefRenderMessageFilter::OnIsCrashReportingEnabled(bool* enabled) {
|
||||
// TODO(cef): Explore whether it's useful for CEF clients to report when crash
|
||||
// reporting is enabled.
|
||||
*enabled = false;
|
||||
}
|
||||
|
||||
void CefRenderMessageFilter::OnDevToolsAgentAttach_RT() {
|
||||
CEF_REQUIRE_RT();
|
||||
CefContentRendererClient::Get()->DevToolsAgentAttached();
|
||||
}
|
||||
|
||||
void CefRenderMessageFilter::OnDevToolsAgentDetach_RT(int32_t routing_id) {
|
||||
CEF_REQUIRE_RT();
|
||||
|
||||
// Wait for the DevToolsAgent to detach. It would be better to receive
|
||||
// notification when the DevToolsAgent detaches but that's not currently
|
||||
// available.
|
||||
content::DevToolsAgent* agent =
|
||||
content::DevToolsAgent::FromRoutingId(routing_id);
|
||||
if (agent && agent->IsAttached()) {
|
||||
// Try again in a bit.
|
||||
CEF_POST_DELAYED_TASK_RT(
|
||||
base::Bind(&CefRenderMessageFilter::OnDevToolsAgentDetach_RT, this,
|
||||
routing_id),
|
||||
50);
|
||||
return;
|
||||
}
|
||||
|
||||
CefContentRendererClient::Get()->DevToolsAgentDetached();
|
||||
}
|
||||
|
@ -28,13 +28,8 @@ class CefRenderMessageFilter : public IPC::MessageFilter {
|
||||
|
||||
private:
|
||||
// Message handlers called on the IO thread.
|
||||
void OnDevToolsAgentAttach(const std::string& host_id, int session_id);
|
||||
void OnDevToolsAgentDetach(int32_t routing_id);
|
||||
void OnIsCrashReportingEnabled(bool* enabled);
|
||||
|
||||
void OnDevToolsAgentAttach_RT();
|
||||
void OnDevToolsAgentDetach_RT(int32_t routing_id);
|
||||
|
||||
IPC::Channel* channel_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefRenderMessageFilter);
|
||||
|
@ -9,15 +9,16 @@
|
||||
#include "libcef/common/request_impl.h"
|
||||
#include "libcef/common/response_impl.h"
|
||||
#include "libcef/common/task_runner_impl.h"
|
||||
#include "libcef/renderer/content_renderer_client.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "third_party/WebKit/public/platform/Platform.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/WebURLLoader.h"
|
||||
#include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
|
||||
#include "third_party/WebKit/public/platform/WebURLLoaderFactory.h"
|
||||
#include "third_party/WebKit/public/platform/WebURLRequest.h"
|
||||
#include "third_party/WebKit/public/platform/WebURLResponse.h"
|
||||
|
||||
@ -102,8 +103,9 @@ class CefRenderURLRequest::Context
|
||||
urlRequest.SetRequestorOrigin(
|
||||
blink::WebSecurityOrigin::Create(urlRequest.Url()));
|
||||
|
||||
loader_ = blink::Platform::Current()->CreateURLLoader(urlRequest,
|
||||
task_runner_.get());
|
||||
loader_ =
|
||||
CefContentRendererClient::Get()->url_loader_factory()->CreateURLLoader(
|
||||
urlRequest, task_runner_.get());
|
||||
loader_->LoadAsynchronously(urlRequest, url_client_.get());
|
||||
return true;
|
||||
}
|
||||
@ -139,7 +141,7 @@ class CefRenderURLRequest::Context
|
||||
|
||||
if (status_ == UR_IO_PENDING) {
|
||||
status_ = UR_FAILED;
|
||||
error_code_ = static_cast<CefURLRequest::ErrorCode>(error.reason);
|
||||
error_code_ = static_cast<cef_errorcode_t>(error.reason());
|
||||
}
|
||||
|
||||
OnComplete();
|
||||
|
@ -713,8 +713,11 @@ void MessageListenerCallbackImpl(v8::Handle<v8::Message> message,
|
||||
CefRefPtr<CefV8Exception> exception = new CefV8ExceptionImpl(
|
||||
static_cast<CefV8ContextImpl*>(context.get())->GetV8Context(), message);
|
||||
|
||||
handler->OnUncaughtException(context->GetBrowser(), context->GetFrame(),
|
||||
context, exception, stackTrace);
|
||||
CefRefPtr<CefBrowser> browser = context->GetBrowser();
|
||||
if (browser) {
|
||||
handler->OnUncaughtException(browser, context->GetFrame(), context,
|
||||
exception, stackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@ -898,8 +901,10 @@ CefRefPtr<CefFrame> CefV8ContextImpl::GetFrame() {
|
||||
if (webframe) {
|
||||
CefRefPtr<CefBrowserImpl> browser =
|
||||
CefBrowserImpl::GetBrowserForMainFrame(webframe->Top());
|
||||
if (browser) {
|
||||
frame = browser->GetFrame(render_frame_util::GetIdentifier(webframe));
|
||||
}
|
||||
}
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ MSVC_PUSH_WARNING_LEVEL(0);
|
||||
#include "third_party/WebKit/Source/core/frame/LocalFrame.h"
|
||||
#include "third_party/WebKit/Source/core/frame/Settings.h"
|
||||
#include "third_party/WebKit/Source/core/frame/WebLocalFrameImpl.h"
|
||||
#include "third_party/WebKit/Source/platform/ScriptForbiddenScope.h"
|
||||
#include "third_party/WebKit/Source/platform/bindings/ScriptForbiddenScope.h"
|
||||
#include "third_party/WebKit/Source/platform/bindings/V8Binding.h"
|
||||
#include "third_party/WebKit/Source/platform/weborigin/SchemeRegistry.h"
|
||||
MSVC_POP_WARNING();
|
||||
@ -158,12 +158,9 @@ v8::MaybeLocal<v8::Value> ExecuteV8ScriptAndReturnValue(
|
||||
if (start_line < 1)
|
||||
start_line = 1;
|
||||
|
||||
const blink::KURL kurl =
|
||||
source_url.IsEmpty() ? blink::KURL()
|
||||
: blink::KURL(blink::kParsedURLString, source_url);
|
||||
|
||||
const blink::ScriptSourceCode ssc = blink::ScriptSourceCode(
|
||||
source, kurl, blink::WebString() /* nonce */, blink::kNotParserInserted,
|
||||
source, blink::ScriptSourceLocationType::kInternal,
|
||||
blink::KURL(source_url),
|
||||
WTF::TextPosition(WTF::OrdinalNumber::FromOneBasedInt(start_line),
|
||||
WTF::OrdinalNumber::FromZeroBasedInt(0)));
|
||||
|
||||
@ -179,8 +176,8 @@ v8::MaybeLocal<v8::Value> ExecuteV8ScriptAndReturnValue(
|
||||
|
||||
v8::Local<v8::Script> script;
|
||||
if (!blink::V8ScriptRunner::CompileScript(blink::ScriptState::From(context),
|
||||
ssc, accessControlStatus,
|
||||
v8CacheOptions)
|
||||
ssc, blink::ScriptFetchOptions(),
|
||||
accessControlStatus, v8CacheOptions)
|
||||
.ToLocal(&script)) {
|
||||
DCHECK(tryCatch.HasCaught());
|
||||
return result;
|
||||
|
@ -15,9 +15,12 @@
|
||||
|
||||
<!-- Extension features supported by CEF. -->
|
||||
<include name="IDR_CEF_EXTENSION_API_FEATURES" file="..\common\extensions\api\_api_features.json" type="BINDATA" />
|
||||
<include name="IDR_CEF_BROWSER_MANIFEST_OVERLAY" file="..\common\extensions\api\browser_manifest_overlay.json" type="BINDATA" />
|
||||
<include name="IDR_CEF_RENDERER_MANIFEST_OVERLAY" file="..\common\extensions\api\renderer_manifest_overlay.json" type="BINDATA" />
|
||||
<include name="IDR_CEF_UTILITY_MANIFEST_OVERLAY" file="..\common\extensions\api\utility_manifest_overlay.json" type="BINDATA" />
|
||||
|
||||
<!-- Service manifests. -->
|
||||
<include name="IDR_CEF_BROWSER_MANIFEST_OVERLAY" file="${root_gen_dir}\cef\cef_browser_manifest_overlay.json" use_base_dir="false" type="BINDATA" />
|
||||
<include name="IDR_CEF_PACKAGED_SERVICES_MANIFEST_OVERLAY" file="${root_gen_dir}\cef\cef_packaged_services_manifest_overlay.json" use_base_dir="false" type="BINDATA" />
|
||||
<include name="IDR_CEF_RENDERER_MANIFEST_OVERLAY" file="${root_gen_dir}\cef\cef_renderer_manifest_overlay.json" use_base_dir="false" type="BINDATA" />
|
||||
<include name="IDR_CEF_UTILITY_MANIFEST_OVERLAY" file="${root_gen_dir}\cef\cef_utility_manifest_overlay.json" use_base_dir="false" type="BINDATA" />
|
||||
</includes>
|
||||
</release>
|
||||
</grit>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user