Update to Chromium version 78.0.3904.0 (#693954)

This commit is contained in:
Marshall Greenblatt 2019-10-01 13:55:16 +00:00
parent c8b457da38
commit f8e0797773
151 changed files with 1485 additions and 2238 deletions

View File

@ -93,7 +93,7 @@
# https://chromium.googlesource.com/chromium/src/+/master/tools/gn/docs/language.md
#
import("//build/config/allocator.gni")
import("//base/allocator/allocator.gni")
import("//build/config/features.gni")
import("//build/config/locales.gni")
import("//build/config/sanitizers/sanitizers.gni")
@ -544,6 +544,8 @@ static_library("libcef_static") {
"libcef/browser/process_util_impl.cc",
"libcef/browser/resource_context.cc",
"libcef/browser/resource_context.h",
"libcef/browser/request_context_handler_map.cc",
"libcef/browser/request_context_handler_map.h",
"libcef/browser/request_context_impl.cc",
"libcef/browser/request_context_impl.h",
"libcef/browser/scheme_impl.cc",
@ -687,8 +689,6 @@ static_library("libcef_static") {
"libcef/renderer/url_loader_throttle_provider_impl.h",
"libcef/renderer/v8_impl.cc",
"libcef/renderer/v8_impl.h",
"libcef/utility/content_utility_client.cc",
"libcef/utility/content_utility_client.h",
"//chrome/browser/local_discovery/service_discovery_device_lister.cc",
"//chrome/browser/local_discovery/service_discovery_device_lister.h",
@ -750,7 +750,7 @@ static_library("libcef_static") {
"//components/content_settings/core/common",
"//components/crx_file",
"//components/data_use_measurement/core",
"//components/google/core/browser",
"//components/google/core/common",
"//components/keyed_service/content:content",
"//components/keyed_service/core:core",
"//components/navigation_interception",
@ -764,7 +764,7 @@ static_library("libcef_static") {
"//components/printing/renderer",
"//components/proxy_config",
"//components/safe_browsing/db:test_database_manager",
"//components/services/pdf_compositor/public/cpp:factory",
"//components/services/pdf_compositor/public/cpp",
"//components/services/pdf_compositor/public/mojom",
"//components/tracing",
"//components/update_client",
@ -1169,7 +1169,6 @@ source_set("cef_content_browser_overlay_manifest") {
deps = [
"//base",
"//components/services/heap_profiling/public/mojom",
"//extensions/buildflags",
"//extensions/common:mojom",
"//extensions/common/api:mojom",
@ -1178,23 +1177,6 @@ source_set("cef_content_browser_overlay_manifest") {
]
}
source_set("cef_content_gpu_overlay_manifest") {
sources = [
"libcef/common/service_manifests/cef_content_gpu_overlay_manifest.cc",
"libcef/common/service_manifests/cef_content_gpu_overlay_manifest.h",
]
configs += [
"libcef/features:config"
]
deps = [
"//base",
"//components/services/heap_profiling/public/mojom",
"//services/service_manager/public/cpp",
]
}
source_set("cef_content_renderer_overlay_manifest") {
sources = [
"libcef/common/service_manifests/cef_content_renderer_overlay_manifest.cc",
@ -1207,85 +1189,18 @@ source_set("cef_content_renderer_overlay_manifest") {
deps = [
"//base",
"//components/services/heap_profiling/public/mojom",
"//components/subresource_filter/content/mojom",
"//extensions/buildflags",
"//extensions/common:mojom",
"//services/service_manager/public/cpp",
"//third_party/blink/public/common",
]
if (is_mac) {
deps += [ "//components/spellcheck/common:interfaces" ]
}
}
source_set("cef_content_utility_overlay_manifest") {
sources = [
"libcef/common/service_manifests/cef_content_utility_overlay_manifest.cc",
"libcef/common/service_manifests/cef_content_utility_overlay_manifest.h",
]
configs += [
"libcef/features:config"
]
deps = [
"//base",
"//components/services/heap_profiling/public/mojom",
"//services/service_manager/public/cpp",
]
}
source_set("builtin_service_manifests") {
sources = [
"libcef/common/service_manifests/builtin_service_manifests.cc",
"libcef/common/service_manifests/builtin_service_manifests.h",
]
configs += [
"libcef/features:config"
]
deps = [
"//base",
"//chrome/common:mojo_bindings",
"//chrome/services/printing/public/cpp:manifest",
"//components/services/pdf_compositor/public/cpp:manifest",
"//components/spellcheck/common:interfaces",
"//components/startup_metric_utils/common:interfaces",
"//extensions/buildflags",
"//printing/buildflags",
"//services/service_manager/public/cpp",
]
}
source_set("cef_renderer_manifest") {
sources = [
"libcef/common/service_manifests/cef_renderer_manifest.cc",
"libcef/common/service_manifests/cef_renderer_manifest.h",
]
configs += [
"libcef/features:config"
]
deps = [
"//base",
"//chrome/common:mojo_bindings",
"//components/spellcheck/common:interfaces",
"//services/service_manager/public/cpp",
]
}
source_set("cef_service_manifests") {
public_deps = [
":cef_content_browser_overlay_manifest",
":cef_content_gpu_overlay_manifest",
":cef_content_renderer_overlay_manifest",
":cef_content_utility_overlay_manifest",
":builtin_service_manifests",
":cef_renderer_manifest",
]
}

View File

@ -7,5 +7,5 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': 'refs/tags/77.0.3865.0'
'chromium_checkout': 'refs/tags/78.0.3904.0'
}

View File

@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=e4acb9c80e79f3e0784c1dc44f5ce885a8fb7fff$
// $hash=a132b1b06541afe31536aadf06c4acf7371cd98f$
//
#ifndef CEF_INCLUDE_CAPI_CEF_PRINT_SETTINGS_CAPI_H_
@ -67,12 +67,6 @@ typedef struct _cef_print_settings_t {
///
int(CEF_CALLBACK* is_read_only)(struct _cef_print_settings_t* self);
///
// Returns a writable copy of this object.
///
struct _cef_print_settings_t*(CEF_CALLBACK* copy)(
struct _cef_print_settings_t* self);
///
// Set the page orientation.
///

View File

@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=9c9e2d87b54564137f970081f25d09157c5903d2$
// $hash=53c090308ab6406dcba8a1fb9282febe4795cd4f$
//
#ifndef CEF_INCLUDE_CAPI_CEF_SSL_INFO_CAPI_H_
@ -71,16 +71,10 @@ typedef struct _cef_sslinfo_t {
} cef_sslinfo_t;
///
// Returns true (1) if the certificate status has any error, major or minor.
// Returns true (1) if the certificate status represents an error.
///
CEF_EXPORT int cef_is_cert_status_error(cef_cert_status_t status);
///
// Returns true (1) if the certificate status represents only minor errors (e.g.
// failure to verify certificate revocation).
///
CEF_EXPORT int cef_is_cert_status_minor_error(cef_cert_status_t status);
#ifdef __cplusplus
}
#endif

View File

@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=ae3b4b169b668985a8f641af215b7db7c26f964b$
// $hash=e1a269bd8ef9436eba8257f958b5720d092d584b$
//
#ifndef CEF_INCLUDE_CAPI_TEST_CEF_TRANSLATOR_TEST_CAPI_H_
@ -323,7 +323,7 @@ typedef struct _cef_translator_test_t {
///
// Set an object. Returns the value from
// cef_translator_test_ref_ptr_client_t::get_value(). This tests input and
// cef_translator_test_tRefPtrClient::get_value(). This tests input and
// execution of a client-side object type.
///
int(CEF_CALLBACK* set_ref_ptr_client)(
@ -341,7 +341,7 @@ typedef struct _cef_translator_test_t {
///
// Set a child object. Returns the value from
// cef_translator_test_ref_ptr_client_t::get_value(). This tests input of a
// cef_translator_test_tRefPtrClient::get_value(). This tests input of a
// client- side child object type and execution as the parent type.
///
int(CEF_CALLBACK* set_child_ref_ptr_client)(

View File

@ -34,7 +34,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=420dfefdb6497faaa2c0280ad70e66e0b7d37dfc$
// $hash=e1836e5dade0a6f19f058dbfd55df881f454d1e3$
//
#ifndef CEF_INCLUDE_API_HASH_H_
@ -47,13 +47,13 @@
// way that may cause binary incompatibility with other builds. The universal
// hash value will change if any platform is affected whereas the platform hash
// values will change only if that particular platform is affected.
#define CEF_API_HASH_UNIVERSAL "440be38b46f14493a9981a1d9282742a83b9070e"
#define CEF_API_HASH_UNIVERSAL "14afb7265af06a50b900ddd775adc235dc34ec77"
#if defined(OS_WIN)
#define CEF_API_HASH_PLATFORM "e5386095f03ffc204bdeacac7a13275918c66eb1"
#define CEF_API_HASH_PLATFORM "228f8ff0c24b688aa36db6f0bf88b0c301738c1a"
#elif defined(OS_MACOSX)
#define CEF_API_HASH_PLATFORM "1c87ca78fce1bd15cd78f33f8f4e1763d616556a"
#define CEF_API_HASH_PLATFORM "dd1c23009c1356fcb066f195af3da9fcf3175799"
#elif defined(OS_LINUX)
#define CEF_API_HASH_PLATFORM "0050dbeab6fe92dd6b954241224cb67c9d9ac23e"
#define CEF_API_HASH_PLATFORM "ebc0f044eab1238ff313ad4496dd2ff22bd261ec"
#endif
#ifdef __cplusplus

View File

@ -72,12 +72,6 @@ class CefPrintSettings : public virtual CefBaseRefCounted {
/*--cef()--*/
virtual bool IsReadOnly() = 0;
///
// Returns a writable copy of this object.
///
/*--cef()--*/
virtual CefRefPtr<CefPrintSettings> Copy() = 0;
///
// Set the page orientation.
///

View File

@ -64,16 +64,9 @@ class CefSSLInfo : public virtual CefBaseRefCounted {
};
///
// Returns true if the certificate status has any error, major or minor.
// Returns true if the certificate status represents an error.
///
/*--cef()--*/
bool CefIsCertStatusError(cef_cert_status_t status);
///
// Returns true if the certificate status represents only minor errors
// (e.g. failure to verify certificate revocation).
///
/*--cef()--*/
bool CefIsCertStatusMinorError(cef_cert_status_t status);
#endif // CEF_INCLUDE_CEF_SSL_INFO_H_

View File

@ -89,24 +89,39 @@ class ImplManager {
return GetImplPos(impl) != all_.end();
}
CefBrowserContext* GetImplForIDs(int render_process_id,
int render_frame_id,
int frame_tree_node_id,
bool require_frame_match) {
CEF_REQUIRE_UIT();
for (const auto& context : all_) {
if (context->IsAssociatedContext(render_process_id, render_frame_id,
frame_tree_node_id,
require_frame_match)) {
return context;
}
}
return nullptr;
}
CefBrowserContext* GetImplForContext(const content::BrowserContext* context) {
CEF_REQUIRE_UIT();
if (!context)
return NULL;
return nullptr;
Vector::iterator it = all_.begin();
for (; it != all_.end(); ++it) {
if (*it == context)
return *it;
}
return NULL;
return nullptr;
}
void SetImplPath(CefBrowserContext* impl, const base::FilePath& path) {
CEF_REQUIRE_UIT();
DCHECK(!path.empty());
DCHECK(IsValidImpl(impl));
DCHECK(GetImplForPath(path) == NULL);
DCHECK(GetImplForPath(path) == nullptr);
map_.insert(std::make_pair(path, impl));
}
@ -116,7 +131,7 @@ class ImplManager {
PathMap::const_iterator it = map_.find(path);
if (it != map_.end())
return it->second;
return NULL;
return nullptr;
}
const Vector GetAllImpl() const { return all_; }
@ -219,8 +234,7 @@ CefBrowserContext::~CefBrowserContext() {
// Send notifications to clean up objects associated with this Profile.
MaybeSendDestroyedNotification();
ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext(
resource_context_.get());
ChromePluginServiceFilter::GetInstance()->UnregisterProfile(this);
// Remove any BrowserContextKeyedServiceFactory associations. This must be
// called before the ProxyService owned by CefBrowserContext is destroyed.
@ -253,7 +267,7 @@ CefBrowserContext::~CefBrowserContext() {
// The FontFamilyCache references the ProxyService so delete it before the
// ProxyService is deleted.
SetUserData(&kFontFamilyCacheKey, NULL);
SetUserData(&kFontFamilyCacheKey, nullptr);
pref_proxy_config_tracker_->DetachFromPrefService();
@ -263,7 +277,7 @@ CefBrowserContext::~CefBrowserContext() {
// Delete the download manager delegate here because otherwise we'll crash
// when it's accessed from the content::BrowserContext destructor.
if (download_manager_delegate_)
download_manager_delegate_.reset(NULL);
download_manager_delegate_.reset(nullptr);
}
void CefBrowserContext::Initialize() {
@ -313,7 +327,6 @@ void CefBrowserContext::Initialize() {
extension_system_ = static_cast<extensions::CefExtensionSystem*>(
extensions::ExtensionSystem::Get(this));
extension_system_->InitForRegularProfile(true);
resource_context_->set_extensions_info_map(extension_system_->info_map());
// Make sure the ProcessManager is created so that it receives extension
// load notifications. This is necessary for the proper initialization of
@ -334,8 +347,7 @@ void CefBrowserContext::Initialize() {
// Initialize proxy configuration tracker.
pref_proxy_config_tracker_.reset(new PrefProxyConfigTrackerImpl(
GetPrefs(),
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO})));
GetPrefs(), base::CreateSingleThreadTaskRunner({BrowserThread::IO})));
// Spell checking support and possibly other subsystems retrieve the
// PrefService associated with a BrowserContext via UserPrefs::Get().
@ -347,8 +359,7 @@ void CefBrowserContext::Initialize() {
if (extensions_enabled)
extension_system_->Init();
ChromePluginServiceFilter::GetInstance()->RegisterResourceContext(
this, resource_context_.get());
ChromePluginServiceFilter::GetInstance()->RegisterProfile(this);
}
void CefBrowserContext::AddCefRequestContext(CefRequestContextImpl* context) {
@ -377,6 +388,15 @@ CefBrowserContext* CefBrowserContext::GetForCachePath(
return g_manager.Get().GetImplForPath(cache_path);
}
// static
CefBrowserContext* CefBrowserContext::GetForIDs(int render_process_id,
int render_frame_id,
int frame_tree_node_id,
bool require_frame_match) {
return g_manager.Get().GetImplForIDs(render_process_id, render_frame_id,
frame_tree_node_id, require_frame_match);
}
// static
CefBrowserContext* CefBrowserContext::GetForContext(
content::BrowserContext* context) {
@ -397,15 +417,6 @@ CefBrowserContext::GetClientHintsControllerDelegate() {
return nullptr;
}
net::URLRequestContextGetter* CefBrowserContext::GetRequestContext() {
NOTREACHED() << "NetworkService is required";
return nullptr;
}
net::URLRequestContextGetter* CefBrowserContext::CreateMediaRequestContext() {
return GetRequestContext();
}
void CefBrowserContext::SetCorsOriginAccessListForOrigin(
const url::Origin& source_origin,
std::vector<network::mojom::CorsOriginPatternPtr> allow_patterns,
@ -417,7 +428,7 @@ void CefBrowserContext::SetCorsOriginAccessListForOrigin(
ChromeZoomLevelPrefs* CefBrowserContext::GetZoomLevelPrefs() {
return static_cast<ChromeZoomLevelPrefs*>(
GetStoragePartition(this, NULL)->GetZoomLevelDelegate());
GetStoragePartition(this, nullptr)->GetZoomLevelDelegate());
}
scoped_refptr<network::SharedURLLoaderFactory>
@ -467,11 +478,11 @@ content::BrowserPluginGuestManager* CefBrowserContext::GetGuestManager() {
}
storage::SpecialStoragePolicy* CefBrowserContext::GetSpecialStoragePolicy() {
return NULL;
return nullptr;
}
content::PushMessagingService* CefBrowserContext::GetPushMessagingService() {
return NULL;
return nullptr;
}
content::SSLHostStateDelegate* CefBrowserContext::GetSSLHostStateDelegate() {
@ -500,13 +511,6 @@ CefBrowserContext::GetBrowsingDataRemoverDelegate() {
return nullptr;
}
net::URLRequestContextGetter* CefBrowserContext::CreateRequestContext(
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) {
NOTREACHED() << "NetworkService is required";
return nullptr;
}
PrefService* CefBrowserContext::GetPrefs() {
return pref_service_.get();
}
@ -599,18 +603,26 @@ void CefBrowserContext::OnRenderFrameCreated(
DCHECK_GE(render_frame_id, 0);
DCHECK_GE(frame_tree_node_id, 0);
render_id_set_.insert(std::make_pair(render_process_id, render_frame_id));
node_id_set_.insert(frame_tree_node_id);
CefRefPtr<CefRequestContextHandler> handler = request_context->GetHandler();
if (handler && resource_context_) {
DCHECK_GE(render_process_id, 0);
// Using base::Unretained() is safe because both this callback and possible
// deletion of |resource_context_| will execute on the IO thread, and this
// callback will be executed first.
CEF_POST_TASK(CEF_IOT, base::Bind(&CefResourceContext::AddHandler,
if (handler) {
handler_map_.AddHandler(render_process_id, render_frame_id,
frame_tree_node_id, handler);
if (resource_context_) {
// Using base::Unretained() is safe because both this callback and
// possible deletion of |resource_context_| will execute on the IO thread,
// and this callback will be executed first.
CEF_POST_TASK(CEF_IOT,
base::Bind(&CefResourceContext::AddHandler,
base::Unretained(resource_context_.get()),
render_process_id, render_frame_id,
frame_tree_node_id, handler));
}
}
}
void CefBrowserContext::OnRenderFrameDeleted(
CefRequestContextImpl* request_context,
@ -624,39 +636,126 @@ void CefBrowserContext::OnRenderFrameDeleted(
DCHECK_GE(render_frame_id, 0);
DCHECK_GE(frame_tree_node_id, 0);
auto it1 =
render_id_set_.find(std::make_pair(render_process_id, render_frame_id));
if (it1 != render_id_set_.end())
render_id_set_.erase(it1);
auto it2 = node_id_set_.find(frame_tree_node_id);
if (it2 != node_id_set_.end())
node_id_set_.erase(it2);
CefRefPtr<CefRequestContextHandler> handler = request_context->GetHandler();
if (handler && resource_context_) {
DCHECK_GE(render_process_id, 0);
// Using base::Unretained() is safe because both this callback and possible
// deletion of |resource_context_| will execute on the IO thread, and this
// callback will be executed first.
CEF_POST_TASK(CEF_IOT, base::Bind(&CefResourceContext::RemoveHandler,
base::Unretained(resource_context_.get()),
render_process_id, render_frame_id,
frame_tree_node_id));
}
if (handler) {
handler_map_.RemoveHandler(render_process_id, render_frame_id,
frame_tree_node_id);
if (resource_context_ && is_main_frame) {
DCHECK_GE(render_process_id, 0);
// Using base::Unretained() is safe because both this callback and possible
// deletion of |resource_context_| will execute on the IO thread, and this
// callback will be executed first.
CEF_POST_TASK(CEF_IOT,
base::Bind(&CefResourceContext::ClearPluginLoadDecision,
base::Unretained(resource_context_.get()),
render_process_id));
}
}
void CefBrowserContext::OnPurgePluginListCache() {
CEF_REQUIRE_UIT();
if (resource_context_) {
// Using base::Unretained() is safe because both this callback and possible
// deletion of |resource_context_| will execute on the IO thread, and this
// callback will be executed first.
CEF_POST_TASK(CEF_IOT,
base::Bind(&CefResourceContext::ClearPluginLoadDecision,
base::Unretained(resource_context_.get()), -1));
// Using base::Unretained() is safe because both this callback and
// possible deletion of |resource_context_| will execute on the IO thread,
// and this callback will be executed first.
CEF_POST_TASK(
CEF_IOT,
base::Bind(&CefResourceContext::RemoveHandler,
base::Unretained(resource_context_.get()),
render_process_id, render_frame_id, frame_tree_node_id));
}
}
if (is_main_frame) {
ClearPluginLoadDecision(render_process_id);
}
}
CefRefPtr<CefRequestContextHandler> CefBrowserContext::GetHandler(
int render_process_id,
int render_frame_id,
int frame_tree_node_id,
bool require_frame_match) const {
CEF_REQUIRE_UIT();
return handler_map_.GetHandler(render_process_id, render_frame_id,
frame_tree_node_id, require_frame_match);
}
bool CefBrowserContext::IsAssociatedContext(int render_process_id,
int render_frame_id,
int frame_tree_node_id,
bool require_frame_match) const {
CEF_REQUIRE_UIT();
if (render_process_id >= 0 && render_frame_id >= 0) {
const auto it1 =
render_id_set_.find(std::make_pair(render_process_id, render_frame_id));
if (it1 != render_id_set_.end())
return true;
}
if (frame_tree_node_id >= 0) {
const auto it2 = node_id_set_.find(frame_tree_node_id);
if (it2 != node_id_set_.end())
return true;
}
if (render_process_id >= 0 && !require_frame_match) {
// Choose an arbitrary handler for the same process.
for (const auto& render_ids : render_id_set_) {
if (render_ids.first == render_process_id)
return true;
}
}
return false;
}
void CefBrowserContext::AddPluginLoadDecision(
int render_process_id,
const base::FilePath& plugin_path,
bool is_main_frame,
const url::Origin& main_frame_origin,
chrome::mojom::PluginStatus status) {
CEF_REQUIRE_UIT();
DCHECK_GE(render_process_id, 0);
DCHECK(!plugin_path.empty());
plugin_load_decision_map_.insert(std::make_pair(
std::make_pair(std::make_pair(render_process_id, plugin_path),
std::make_pair(is_main_frame, main_frame_origin)),
status));
}
bool CefBrowserContext::HasPluginLoadDecision(
int render_process_id,
const base::FilePath& plugin_path,
bool is_main_frame,
const url::Origin& main_frame_origin,
chrome::mojom::PluginStatus* status) const {
CEF_REQUIRE_UIT();
DCHECK_GE(render_process_id, 0);
DCHECK(!plugin_path.empty());
PluginLoadDecisionMap::const_iterator it = plugin_load_decision_map_.find(
std::make_pair(std::make_pair(render_process_id, plugin_path),
std::make_pair(is_main_frame, main_frame_origin)));
if (it == plugin_load_decision_map_.end())
return false;
*status = it->second;
return true;
}
void CefBrowserContext::ClearPluginLoadDecision(int render_process_id) {
CEF_REQUIRE_UIT();
if (render_process_id == -1) {
plugin_load_decision_map_.clear();
} else {
PluginLoadDecisionMap::iterator it = plugin_load_decision_map_.begin();
while (it != plugin_load_decision_map_.end()) {
if (it->first.first.first == render_process_id)
it = plugin_load_decision_map_.erase(it);
else
++it;
}
}
}

View File

@ -6,18 +6,23 @@
#define CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_IMPL_H_
#pragma once
#include <set>
#include "include/cef_request_context_handler.h"
#include "libcef/browser/chrome_profile_stub.h"
#include "libcef/browser/request_context_handler_map.h"
#include "libcef/browser/resource_context.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "chrome/browser/download/download_prefs.h"
#include "chrome/common/plugin.mojom.h"
#include "components/proxy_config/pref_proxy_config_tracker.h"
#include "components/visitedlink/browser/visitedlink_delegate.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
#include "url/origin.h"
/*
// Classes used in request processing (network, storage, service, etc.):
@ -105,6 +110,13 @@ class CefBrowserContext : public ChromeProfileStub,
// |cache_path|.
static CefBrowserContext* GetForCachePath(const base::FilePath& cache_path);
// Returns the existing instance, if any, associated with the specified IDs.
// See comments on IsAssociatedContext() for usage.
static CefBrowserContext* GetForIDs(int render_process_id,
int render_frame_id,
int frame_tree_node_id,
bool require_frame_match);
// Returns the underlying CefBrowserContext if any.
static CefBrowserContext* GetForContext(content::BrowserContext* context);
@ -123,8 +135,6 @@ class CefBrowserContext : public ChromeProfileStub,
content::ResourceContext* GetResourceContext() override;
content::ClientHintsControllerDelegate* GetClientHintsControllerDelegate()
override;
net::URLRequestContextGetter* GetRequestContext() override;
net::URLRequestContextGetter* CreateMediaRequestContext() override;
void SetCorsOriginAccessListForOrigin(
const url::Origin& source_origin,
std::vector<network::mojom::CorsOriginPatternPtr> allow_patterns,
@ -146,9 +156,6 @@ class CefBrowserContext : public ChromeProfileStub,
content::BackgroundSyncController* GetBackgroundSyncController() override;
content::BrowsingDataRemoverDelegate* GetBrowsingDataRemoverDelegate()
override;
net::URLRequestContextGetter* CreateRequestContext(
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) override;
// Profile methods.
ChromeZoomLevelPrefs* GetZoomLevelPrefs() override;
@ -205,9 +212,42 @@ class CefBrowserContext : public ChromeProfileStub,
bool is_main_frame,
bool is_guest_view);
// Called from CefRequestContextImpl::PurgePluginListCacheInternal when the
// plugin list cache should be purged.
void OnPurgePluginListCache();
// Returns the handler that matches the specified IDs. Pass -1 for unknown
// values. If |require_frame_match| is true only exact matches will be
// returned. If |require_frame_match| is false, and there is not an exact
// match, then the first handler for the same |render_process_id| will be
// returned.
CefRefPtr<CefRequestContextHandler> GetHandler(
int render_process_id,
int render_frame_id,
int frame_tree_node_id,
bool require_frame_match) const;
// Returns true if this context is associated with the specified IDs. Pass -1
// for unknown values. If |require_frame_match| is true only exact matches
// will qualify. If |require_frame_match| is false, and there is not an exact
// match, then any match for |render_process_id| will qualify.
bool IsAssociatedContext(int render_process_id,
int render_frame_id,
int frame_tree_node_id,
bool require_frame_match) const;
// Remember the plugin load decision for plugin status requests that arrive
// via CefPluginServiceFilter::IsPluginAvailable.
void AddPluginLoadDecision(int render_process_id,
const base::FilePath& plugin_path,
bool is_main_frame,
const url::Origin& main_frame_origin,
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,
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.
void ClearPluginLoadDecision(int render_process_id);
// Called from CefRequestContextImpl methods of the same name.
void RegisterSchemeHandlerFactory(const std::string& scheme_name,
@ -274,6 +314,29 @@ class CefBrowserContext : public ChromeProfileStub,
std::unique_ptr<DownloadPrefs> download_prefs_;
// Map IDs to CefRequestContextHandler objects.
CefRequestContextHandlerMap handler_map_;
// Map (render_process_id, plugin_path, is_main_frame, main_frame_origin) to
// plugin load decision.
typedef std::map<
std::pair<std::pair<int, base::FilePath>, std::pair<bool, url::Origin>>,
chrome::mojom::PluginStatus>
PluginLoadDecisionMap;
PluginLoadDecisionMap plugin_load_decision_map_;
// Set of (render_process_id, render_frame_id) associated with this context.
typedef std::set<std::pair<int, int>> RenderIdSet;
RenderIdSet render_id_set_;
// Set of frame_tree_node_id associated with this context. Keeping this list
// is necessary because, when navigating the main frame, a new (pre-commit)
// network request will be created before the RenderFrameHost. Consequently we
// can't rely on valid render IDs. See https://crbug.com/776884 for
// background.
typedef std::set<int> NodeIdSet;
NodeIdSet node_id_set_;
DISALLOW_COPY_AND_ASSIGN(CefBrowserContext);
};

View File

@ -67,7 +67,7 @@
#include "content/public/browser/render_process_host.h"
#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/browser/web_contents.h"
#include "content/public/common/favicon_url.h"
#include "extensions/browser/process_manager.h"
#include "net/base/net_errors.h"

View File

@ -28,7 +28,6 @@
#include "base/strings/string_number_conversions.h"
#include "base/task/post_task.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_browser_main_extra_parts.h"
#include "chrome/browser/net/system_network_context_manager.h"
#include "chrome/browser/plugins/plugin_finder.h"
#include "components/constrained_window/constrained_window_views.h"
@ -75,13 +74,6 @@ CefBrowserMainParts::CefBrowserMainParts(
CefBrowserMainParts::~CefBrowserMainParts() {
constrained_window::SetConstrainedWindowViewsClient(nullptr);
for (int i = static_cast<int>(chrome_extra_parts_.size()) - 1; i >= 0; --i)
delete chrome_extra_parts_[i];
chrome_extra_parts_.clear();
}
void CefBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
chrome_extra_parts_.push_back(parts);
}
int CefBrowserMainParts::PreEarlyInitialization() {
@ -91,17 +83,9 @@ int CefBrowserMainParts::PreEarlyInitialization() {
ui::InitializeInputMethodForTesting();
#endif
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PreEarlyInitialization();
return service_manager::RESULT_CODE_NORMAL_EXIT;
}
void CefBrowserMainParts::PostEarlyInitialization() {
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PostEarlyInitialization();
}
void CefBrowserMainParts::ToolkitInitialized() {
SetConstrainedWindowViewsClient(CreateCefConstrainedWindowViewsClient());
#if defined(USE_AURA)
@ -116,9 +100,6 @@ void CefBrowserMainParts::ToolkitInitialized() {
CefContentBrowserClient::Get()->GetResourceDllName());
#endif
#endif // defined(USE_AURA)
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->ToolkitInitialized();
}
void CefBrowserMainParts::PreMainMessageLoopStart() {
@ -132,9 +113,6 @@ void CefBrowserMainParts::PreMainMessageLoopStart() {
DCHECK(local_state);
OSCrypt::Init(local_state);
#endif
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PreMainMessageLoopStart();
}
void CefBrowserMainParts::PostMainMessageLoopStart() {
@ -144,9 +122,6 @@ void CefBrowserMainParts::PostMainMessageLoopStart() {
printing::PrintingContextLinux::SetPdfPaperSizeFunction(
&CefPrintDialogLinux::GetPdfPaperSize);
#endif
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PostMainMessageLoopStart();
}
int CefBrowserMainParts::PreCreateThreads() {
@ -161,17 +136,9 @@ int CefBrowserMainParts::PreCreateThreads() {
content::GpuDataManager::GetInstance();
SystemNetworkContextManager::CreateInstance(g_browser_process->local_state());
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PreCreateThreads();
return 0;
}
void CefBrowserMainParts::PostCreateThreads() {
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PostCreateThreads();
}
void CefBrowserMainParts::PreMainMessageLoopRun() {
#if defined(USE_AURA)
display::Screen::SetScreenInstance(views::CreateDesktopScreen());
@ -179,9 +146,6 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
ui::MaterialDesignController::Initialize();
// CEF's profile is a BrowserContext.
PreProfileInit();
if (extensions::ExtensionsEnabled()) {
// Initialize extension global objects before creating the global
// BrowserContext.
@ -200,14 +164,14 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
printing::CefPrintingMessageFilter::EnsureShutdownNotifierFactoryBuilt();
background_task_runner_ = base::CreateSingleThreadTaskRunnerWithTraits(
{base::TaskPriority::BEST_EFFORT,
background_task_runner_ = base::CreateSingleThreadTaskRunner(
{base::ThreadPool(), base::TaskPriority::BEST_EFFORT,
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
user_visible_task_runner_ = base::CreateSingleThreadTaskRunnerWithTraits(
{base::TaskPriority::USER_VISIBLE,
user_visible_task_runner_ = base::CreateSingleThreadTaskRunner(
{base::ThreadPool(), base::TaskPriority::USER_VISIBLE,
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
user_blocking_task_runner_ = base::CreateSingleThreadTaskRunnerWithTraits(
{base::TaskPriority::USER_BLOCKING,
user_blocking_task_runner_ = base::CreateSingleThreadTaskRunner(
{base::ThreadPool(), base::TaskPriority::USER_BLOCKING,
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
CefRequestContextSettings settings;
@ -219,21 +183,12 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
CefBrowserContext* browser_context = static_cast<CefBrowserContext*>(
global_request_context_->GetBrowserContext());
PostProfileInit();
CefDevToolsManagerDelegate::StartHttpHandler(browser_context);
// Triggers initialization of the singleton instance on UI thread.
PluginFinder::GetInstance()->Init();
scheme::RegisterWebUIControllerFactory();
// These have no equivalent in CEF.
PreBrowserStart();
PostBrowserStart();
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PreMainMessageLoopRun();
}
void CefBrowserMainParts::PostMainMessageLoopRun() {
@ -244,9 +199,6 @@ void CefBrowserMainParts::PostMainMessageLoopRun() {
// during shutdown. Did you forget to release a CefBrowser reference?
DCHECK(global_request_context_->HasOneRef());
global_request_context_ = NULL;
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PostMainMessageLoopRun();
}
void CefBrowserMainParts::PostDestroyThreads() {
@ -260,23 +212,3 @@ void CefBrowserMainParts::PostDestroyThreads() {
delete views::ViewsDelegate::GetInstance();
#endif
}
void CefBrowserMainParts::PreProfileInit() {
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PreProfileInit();
}
void CefBrowserMainParts::PostProfileInit() {
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PostProfileInit();
}
void CefBrowserMainParts::PreBrowserStart() {
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PreBrowserStart();
}
void CefBrowserMainParts::PostBrowserStart() {
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PostBrowserStart();
}

View File

@ -30,34 +30,21 @@ class WMState;
#endif
class CefDevToolsDelegate;
class ChromeBrowserMainExtraParts;
class CefBrowserMainParts : public content::BrowserMainParts {
public:
explicit CefBrowserMainParts(const content::MainFunctionParams& parameters);
~CefBrowserMainParts() override;
// Add additional ChromeBrowserMainExtraParts.
void AddParts(ChromeBrowserMainExtraParts* parts);
int PreEarlyInitialization() override;
void PostEarlyInitialization() override;
void ToolkitInitialized() override;
void PreMainMessageLoopStart() override;
void PostMainMessageLoopStart() override;
int PreCreateThreads() override;
void PostCreateThreads() override;
void PreMainMessageLoopRun() override;
void PostMainMessageLoopRun() override;
void PostDestroyThreads() override;
// Additional stages for ChromeBrowserMainExtraParts. These stages are called
// in order from PreMainMessageLoopRun(). See implementation for details.
void PreProfileInit();
void PostProfileInit();
void PreBrowserStart();
void PostBrowserStart();
CefRefPtr<CefRequestContextImpl> request_context() const {
return global_request_context_;
}
@ -98,10 +85,6 @@ class CefBrowserMainParts : public content::BrowserMainParts {
std::unique_ptr<wm::WMState> wm_state_;
#endif
// Vector of additional ChromeBrowserMainExtraParts.
// Parts are deleted in the inverse order they are added.
std::vector<ChromeBrowserMainExtraParts*> chrome_extra_parts_;
DISALLOW_COPY_AND_ASSIGN(CefBrowserMainParts);
};

View File

@ -338,12 +338,6 @@ ChromeBrowserProcessStub::component_updater() {
return NULL;
}
component_updater::SupervisedUserWhitelistInstaller*
ChromeBrowserProcessStub::supervised_user_whitelist_installer() {
NOTREACHED();
return NULL;
}
MediaFileSystemRegistry*
ChromeBrowserProcessStub::media_file_system_registry() {
NOTREACHED();
@ -382,9 +376,3 @@ ChromeBrowserProcessStub::resource_coordinator_parts() {
NOTREACHED();
return NULL;
}
prefs::InProcessPrefServiceFactory*
ChromeBrowserProcessStub::pref_service_factory() const {
NOTREACHED();
return NULL;
}

View File

@ -91,8 +91,6 @@ class ChromeBrowserProcessStub : public BrowserProcess {
#endif
component_updater::ComponentUpdateService* component_updater() override;
component_updater::SupervisedUserWhitelistInstaller*
supervised_user_whitelist_installer() override;
MediaFileSystemRegistry* media_file_system_registry() override;
WebRtcLogUploader* webrtc_log_uploader() override;
network_time::NetworkTimeTracker* network_time_tracker() override;
@ -102,7 +100,6 @@ class ChromeBrowserProcessStub : public BrowserProcess {
resource_coordinator::TabManager* GetTabManager() override;
resource_coordinator::ResourceCoordinatorParts* resource_coordinator_parts()
override;
prefs::InProcessPrefServiceFactory* pref_service_factory() const override;
private:
bool initialized_;

View File

@ -120,3 +120,12 @@ Profile::ExitType ChromeProfileStub::GetLastSessionExitType() {
NOTREACHED();
return EXIT_NORMAL;
}
base::Time ChromeProfileStub::GetCreationTime() const {
NOTREACHED();
return base::Time();
}
void ChromeProfileStub::SetCreationTimeForTesting(base::Time creation_time) {
NOTREACHED();
}

View File

@ -44,6 +44,8 @@ class ChromeProfileStub : public Profile {
bool IsIndependentOffTheRecordProfile() override;
void SetExitType(ExitType exit_type) override;
ExitType GetLastSessionExitType() override;
base::Time GetCreationTime() const override;
void SetCreationTimeForTesting(base::Time creation_time) override;
private:
DISALLOW_COPY_AND_ASSIGN(ChromeProfileStub);

View File

@ -38,12 +38,8 @@
#include "libcef/common/extensions/extensions_util.h"
#include "libcef/common/net/scheme_registration.h"
#include "libcef/common/request_impl.h"
#include "libcef/common/service_manifests/builtin_service_manifests.h"
#include "libcef/common/service_manifests/cef_content_browser_overlay_manifest.h"
#include "libcef/common/service_manifests/cef_content_gpu_overlay_manifest.h"
#include "libcef/common/service_manifests/cef_content_renderer_overlay_manifest.h"
#include "libcef/common/service_manifests/cef_content_utility_overlay_manifest.h"
#include "libcef/common/service_manifests/cef_renderer_manifest.h"
#include "base/base_switches.h"
#include "base/command_line.h"
@ -55,27 +51,22 @@
#include "cef/grit/cef_resources.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_content_browser_client.h"
#include "chrome/browser/chrome_service.h"
#include "chrome/browser/net/system_network_context_manager.h"
#include "chrome/browser/plugins/plugin_info_host_impl.h"
#include "chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.h"
#include "chrome/browser/plugins/plugin_utils.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
#include "chrome/browser/spellchecker/spell_check_host_chrome_impl.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/constants.mojom.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/browser_resources.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/services/printing/printing_service.h"
#include "chrome/services/printing/public/mojom/constants.mojom.h"
#include "components/navigation_interception/intercept_navigation_throttle.h"
#include "components/navigation_interception/navigation_params.h"
#include "components/services/heap_profiling/heap_profiling_service.h"
#include "components/services/heap_profiling/public/mojom/constants.mojom.h"
#include "components/services/pdf_compositor/public/cpp/pdf_compositor_service_factory.h"
#include "components/services/pdf_compositor/public/mojom/pdf_compositor.mojom.h"
#include "components/spellcheck/common/spellcheck.mojom.h"
#include "components/version_info/version_info.h"
#include "content/browser/frame_host/navigation_handle_impl.h"
#include "content/browser/frame_host/render_frame_host_impl.h"
@ -93,7 +84,6 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/resource_dispatcher_host.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_ui_url_loader_factory.h"
#include "content/public/common/content_switches.h"
@ -112,6 +102,7 @@
#include "extensions/common/constants.h"
#include "extensions/common/switches.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/bindings/strong_associated_binding.h"
#include "net/base/auth.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "ppapi/host/ppapi_host.h"
@ -149,6 +140,10 @@
#include "sandbox/win/src/sandbox_policy.h"
#endif
#if BUILDFLAG(HAS_SPELLCHECK_PANEL)
#include "chrome/browser/spellchecker/spell_check_panel_host_impl.h"
#endif
namespace {
class CefQuotaCallbackImpl : public CefRequestCallback {
@ -483,28 +478,20 @@ bool NavigationOnUIThread(
return ignore_navigation;
}
const extensions::ExtensionSet* GetEnabledExtensions(
content::BrowserContext* context) {
auto registry = extensions::ExtensionRegistry::Get(context);
return &registry->enabled_extensions();
}
// From chrome/browser/plugins/chrome_content_browser_client_plugins_part.cc.
void BindPluginInfoHost(
int render_process_id,
chrome::mojom::PluginInfoHostAssociatedRequest request) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
content::RenderProcessHost* host =
content::RenderProcessHost::FromID(render_process_id);
if (!host)
return;
const extensions::ExtensionSet* GetEnabledExtensions(
content::ResourceContext* context) {
auto cef_context = static_cast<CefResourceContext*>(context);
if (!cef_context)
return nullptr;
return &cef_context->GetExtensionInfoMap()->extensions();
}
const extensions::ExtensionSet* GetEnabledExtensions(
content::BrowserOrResourceContext context) {
if (content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) {
return GetEnabledExtensions(context.ToBrowserContext());
}
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
return GetEnabledExtensions(context.ToResourceContext());
Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
mojo::MakeStrongAssociatedBinding(
std::make_unique<PluginInfoHostImpl>(render_process_id, profile),
std::move(request));
}
} // namespace
@ -529,14 +516,11 @@ std::unique_ptr<content::BrowserMainParts>
CefContentBrowserClient::CreateBrowserMainParts(
const content::MainFunctionParams& parameters) {
browser_main_parts_ = new CefBrowserMainParts(parameters);
browser_main_parts_->AddParts(
ChromeService::GetInstance()->CreateExtraParts());
return base::WrapUnique(browser_main_parts_);
}
void CefContentBrowserClient::RenderProcessWillLaunch(
content::RenderProcessHost* host,
service_manager::mojom::ServiceRequest* service_request) {
content::RenderProcessHost* host) {
const int id = host->GetID();
Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
@ -545,8 +529,7 @@ void CefContentBrowserClient::RenderProcessWillLaunch(
if (extensions::ExtensionsEnabled()) {
host->AddFilter(new extensions::ExtensionMessageFilter(id, profile));
host->AddFilter(
new extensions::IOThreadExtensionMessageFilter(id, profile));
host->AddFilter(new extensions::IOThreadExtensionMessageFilter());
host->AddFilter(
new extensions::ExtensionsGuestViewMessageFilter(id, profile));
}
@ -559,17 +542,6 @@ void CefContentBrowserClient::RenderProcessWillLaunch(
host->Send(
new CefProcessMsg_SetIsIncognitoProcess(profile->IsOffTheRecord()));
service_manager::mojom::ServicePtrInfo service;
*service_request = mojo::MakeRequest(&service);
service_manager::Identity renderer_identity = host->GetChildIdentity();
mojo::Remote<service_manager::mojom::ProcessMetadata> metadata;
ChromeService::GetInstance()->connector()->RegisterServiceInstance(
service_manager::Identity(chrome::mojom::kRendererServiceName,
renderer_identity.instance_group(),
renderer_identity.instance_id(),
base::Token::CreateRandom()),
std::move(service), metadata.BindNewPipeAndPassReceiver());
}
bool CefContentBrowserClient::ShouldUseProcessPerSite(
@ -602,13 +574,15 @@ bool CefContentBrowserClient::ShouldUseProcessPerSite(
// Based on
// ChromeContentBrowserClientExtensionsPart::DoesSiteRequireDedicatedProcess.
bool CefContentBrowserClient::DoesSiteRequireDedicatedProcess(
content::BrowserOrResourceContext browser_or_resource_context,
content::BrowserContext* browser_context,
const GURL& effective_site_url) {
if (!extensions::ExtensionsEnabled())
return false;
auto extension = GetEnabledExtensions(browser_or_resource_context)
->GetExtensionOrAppByURL(effective_site_url);
const extensions::Extension* extension =
extensions::ExtensionRegistry::Get(browser_context)
->enabled_extensions()
.GetExtensionOrAppByURL(effective_site_url);
// Isolate all extensions.
return extension != nullptr;
}
@ -708,59 +682,36 @@ void CefContentBrowserClient::SiteInstanceDeleting(
site_instance->GetId()));
}
void CefContentBrowserClient::RunServiceInstance(
const service_manager::Identity& identity,
mojo::PendingReceiver<service_manager::mojom::Service>* receiver) {
const std::string& service_name = identity.name();
if (service_name == printing::mojom::kServiceName) {
service_manager::Service::RunAsyncUntilTermination(
printing::CreatePdfCompositorService(std::move(*receiver)));
void CefContentBrowserClient::BindHostReceiverForRenderer(
content::RenderProcessHost* render_process_host,
mojo::GenericPendingReceiver receiver) {
if (auto host_receiver = receiver.As<spellcheck::mojom::SpellCheckHost>()) {
SpellCheckHostChromeImpl::Create(render_process_host->GetID(),
std::move(host_receiver));
return;
}
if (service_name == printing::mojom::kChromePrintingServiceName) {
service_manager::Service::RunAsyncUntilTermination(
std::make_unique<printing::PrintingService>(std::move(*receiver)));
return;
}
}
void CefContentBrowserClient::RunServiceInstanceOnIOThread(
const service_manager::Identity& identity,
mojo::PendingReceiver<service_manager::mojom::Service>* receiver) {
if (identity.name() == chrome::mojom::kServiceName) {
ChromeService::GetInstance()->CreateChromeServiceRequestHandler().Run(
std::move(*receiver));
return;
}
if (identity.name() == heap_profiling::mojom::kServiceName) {
heap_profiling::HeapProfilingService::GetServiceFactory().Run(
std::move(*receiver));
#if BUILDFLAG(HAS_SPELLCHECK_PANEL)
if (auto panel_host_receiver =
receiver.As<spellcheck::mojom::SpellCheckPanelHost>()) {
SpellCheckPanelHostImpl::Create(render_process_host->GetID(),
std::move(panel_host_receiver));
return;
}
#endif // BUILDFLAG(HAS_SPELLCHECK_PANEL)
}
base::Optional<service_manager::Manifest>
CefContentBrowserClient::GetServiceManifestOverlay(base::StringPiece name) {
if (name == content::mojom::kBrowserServiceName) {
return GetCefContentBrowserOverlayManifest();
} else if (name == content::mojom::kGpuServiceName) {
return GetCefContentGpuOverlayManifest();
} else if (name == content::mojom::kRendererServiceName) {
return GetCefContentRendererOverlayManifest();
} else if (name == content::mojom::kUtilityServiceName) {
return GetCefContentUtilityOverlayManifest();
}
return base::nullopt;
}
std::vector<service_manager::Manifest>
CefContentBrowserClient::GetExtraServiceManifests() {
auto manifests = GetBuiltinServiceManifests();
manifests.push_back(GetCefRendererManifest());
return manifests;
}
void CefContentBrowserClient::AppendExtraCommandLineSwitches(
base::CommandLine* command_line,
int child_process_id) {
@ -976,7 +927,6 @@ void CefContentBrowserClient::AllowCertificateError(
const GURL& request_url,
bool is_main_frame_request,
bool strict_enforcement,
bool expired_previous_decision,
const base::Callback<void(content::CertificateRequestResultType)>&
callback) {
CEF_REQUIRE_UIT();
@ -1144,18 +1094,18 @@ CefContentBrowserClient::CreateThrottlesForNavigation(
return throttles;
}
std::vector<std::unique_ptr<content::URLLoaderThrottle>>
std::vector<std::unique_ptr<blink::URLLoaderThrottle>>
CefContentBrowserClient::CreateURLLoaderThrottles(
const network::ResourceRequest& request,
content::BrowserContext* resource_context,
content::BrowserContext* browser_context,
const base::RepeatingCallback<content::WebContents*()>& wc_getter,
content::NavigationUIData* navigation_ui_data,
int frame_tree_node_id) {
std::vector<std::unique_ptr<content::URLLoaderThrottle>> result;
std::vector<std::unique_ptr<blink::URLLoaderThrottle>> result;
// Used to substitute View ID for PDF contents when using the PDF plugin.
result.push_back(std::make_unique<PluginResponseInterceptorURLLoaderThrottle>(
resource_context, request.resource_type, frame_tree_node_id));
request.resource_type, frame_tree_node_id));
return result;
}
@ -1189,7 +1139,8 @@ const wchar_t* CefContentBrowserClient::GetResourceDllName() {
return file_path;
}
bool CefContentBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy) {
bool CefContentBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy,
RendererSpawnFlags flags) {
return true;
}
#endif // defined(OS_WIN)
@ -1198,10 +1149,8 @@ void CefContentBrowserClient::ExposeInterfacesToRenderer(
service_manager::BinderRegistry* registry,
blink::AssociatedInterfaceRegistry* associated_registry,
content::RenderProcessHost* host) {
Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
host->GetChannel()->AddAssociatedInterfaceForIOThread(base::Bind(
&PluginInfoHostImpl::OnPluginInfoHostRequest,
base::MakeRefCounted<PluginInfoHostImpl>(host->GetID(), profile)));
associated_registry->AddInterface(
base::BindRepeating(&BindPluginInfoHost, host->GetID()));
}
std::unique_ptr<net::ClientCertStore>
@ -1297,23 +1246,19 @@ bool CefContentBrowserClient::WillCreateURLLoaderFactory(
content::BrowserContext* browser_context,
content::RenderFrameHost* frame,
int render_process_id,
bool is_navigation,
bool is_download,
URLLoaderFactoryType type,
const url::Origin& request_initiator,
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client,
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
header_client,
bool* bypass_redirect_checks) {
auto request_handler = net_service::CreateInterceptedRequestHandler(
browser_context, frame, render_process_id, is_navigation, is_download,
request_initiator);
auto proxied_receiver = std::move(*factory_receiver);
network::mojom::URLLoaderFactoryPtrInfo target_factory_info;
*factory_receiver = mojo::MakeRequest(&target_factory_info);
browser_context, frame, render_process_id,
type == URLLoaderFactoryType::kNavigation,
type == URLLoaderFactoryType::kDownload, request_initiator);
net_service::ProxyURLLoaderFactory::CreateProxy(
browser_context, std::move(proxied_receiver),
std::move(target_factory_info), header_client,
browser_context, factory_receiver, header_client,
std::move(request_handler));
return true;
}
@ -1362,7 +1307,7 @@ CefContentBrowserClient::GetNetworkContextsParentDirectory() {
bool CefContentBrowserClient::HandleExternalProtocol(
const GURL& url,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
content::WebContents::Getter web_contents_getter,
int child_id,
content::NavigationUIData* navigation_data,
bool is_main_frame,
@ -1374,7 +1319,7 @@ bool CefContentBrowserClient::HandleExternalProtocol(
}
bool CefContentBrowserClient::HandleExternalProtocol(
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
content::WebContents::Getter web_contents_getter,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
const network::ResourceRequest& resource_request,
@ -1396,8 +1341,7 @@ bool CefContentBrowserClient::HandleExternalProtocol(
[](network::mojom::URLLoaderFactoryRequest request,
std::unique_ptr<net_service::InterceptedRequestHandler>
request_handler,
content::ResourceRequestInfo::WebContentsGetter
web_contents_getter) {
content::WebContents::Getter web_contents_getter) {
// Manages its own lifetime.
net_service::ProxyURLLoaderFactory::CreateProxy(
@ -1440,9 +1384,9 @@ blink::UserAgentMetadata CefContentBrowserClient::GetUserAgentMetadata() {
base::flat_set<std::string>
CefContentBrowserClient::GetPluginMimeTypesWithExternalHandlers(
content::ResourceContext* resource_context) {
content::BrowserContext* browser_context) {
base::flat_set<std::string> mime_types;
auto map = PluginUtils::GetMimeTypeToExtensionIdMap(resource_context);
auto map = PluginUtils::GetMimeTypeToExtensionIdMap(browser_context);
for (const auto& pair : map)
mime_types.insert(pair.first);
return mime_types;

View File

@ -41,13 +41,10 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
// ContentBrowserClient implementation.
std::unique_ptr<content::BrowserMainParts> CreateBrowserMainParts(
const content::MainFunctionParams& parameters) override;
void RenderProcessWillLaunch(
content::RenderProcessHost* host,
service_manager::mojom::ServiceRequest* service_request) override;
void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
bool ShouldUseProcessPerSite(content::BrowserContext* browser_context,
const GURL& effective_url) override;
bool DoesSiteRequireDedicatedProcess(
content::BrowserOrResourceContext browser_or_resource_contexts,
bool DoesSiteRequireDedicatedProcess(content::BrowserContext* browser_context,
const GURL& effective_site_url) override;
void GetAdditionalWebUISchemes(
std::vector<std::string>* additional_schemes) override;
@ -59,17 +56,11 @@ 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 RunServiceInstance(
const service_manager::Identity& identity,
mojo::PendingReceiver<service_manager::mojom::Service>* receiver)
override;
void RunServiceInstanceOnIOThread(
const service_manager::Identity& identity,
mojo::PendingReceiver<service_manager::mojom::Service>* receiver)
override;
void BindHostReceiverForRenderer(
content::RenderProcessHost* render_process_host,
mojo::GenericPendingReceiver receiver) override;
base::Optional<service_manager::Manifest> GetServiceManifestOverlay(
base::StringPiece name) override;
std::vector<service_manager::Manifest> GetExtraServiceManifests() override;
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
int child_process_id) override;
void AdjustUtilityServiceProcessCommandLine(
@ -98,7 +89,6 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
const GURL& request_url,
bool is_main_frame_request,
bool strict_enforcement,
bool expired_previous_decision,
const base::Callback<void(content::CertificateRequestResultType)>&
callback) override;
base::OnceClosure SelectClientCertificate(
@ -128,10 +118,10 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
std::vector<std::unique_ptr<content::NavigationThrottle>>
CreateThrottlesForNavigation(
content::NavigationHandle* navigation_handle) override;
std::vector<std::unique_ptr<content::URLLoaderThrottle>>
std::vector<std::unique_ptr<blink::URLLoaderThrottle>>
CreateURLLoaderThrottles(
const network::ResourceRequest& request,
content::BrowserContext* resource_context,
content::BrowserContext* browser_context,
const base::RepeatingCallback<content::WebContents*()>& wc_getter,
content::NavigationUIData* navigation_ui_data,
int frame_tree_node_id) override;
@ -145,7 +135,8 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
#if defined(OS_WIN)
const wchar_t* GetResourceDllName();
bool PreSpawnRenderer(sandbox::TargetPolicy* policy) override;
bool PreSpawnRenderer(sandbox::TargetPolicy* policy,
RendererSpawnFlags flags) override;
#endif
void ExposeInterfacesToRenderer(
@ -174,11 +165,11 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
content::BrowserContext* browser_context,
content::RenderFrameHost* frame,
int render_process_id,
bool is_navigation,
bool is_download,
URLLoaderFactoryType type,
const url::Origin& request_initiator,
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client,
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
header_client,
bool* bypass_redirect_checks) override;
void OnNetworkServiceCreated(
network::mojom::NetworkService* network_service) override;
@ -189,7 +180,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
std::vector<base::FilePath> GetNetworkContextsParentDirectory() override;
bool HandleExternalProtocol(
const GURL& url,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
content::WebContents::Getter web_contents_getter,
int child_id,
content::NavigationUIData* navigation_data,
bool is_main_frame,
@ -197,7 +188,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
bool has_user_gesture,
network::mojom::URLLoaderFactoryPtr* out_factory) override;
bool HandleExternalProtocol(
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
content::WebContents::Getter web_contents_getter,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
const network::ResourceRequest& request,
@ -209,7 +200,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
std::string GetUserAgent() override;
blink::UserAgentMetadata GetUserAgentMetadata() override;
base::flat_set<std::string> GetPluginMimeTypesWithExternalHandlers(
content::ResourceContext* resource_context) override;
content::BrowserContext* browser_context) override;
// Perform browser process registration for the custom scheme.
void RegisterCustomScheme(const std::string& scheme);

View File

@ -43,8 +43,8 @@ CefDevToolsFileManager::CefDevToolsFileManager(CefBrowserHostImpl* browser_impl,
PrefService* prefs)
: browser_impl_(browser_impl),
prefs_(prefs),
file_task_runner_(
base::CreateSequencedTaskRunnerWithTraits({base::MayBlock()})),
file_task_runner_(base::CreateSequencedTaskRunner(
{base::ThreadPool(), base::MayBlock()})),
weak_factory_(this) {}
void CefDevToolsFileManager::SaveToFile(const std::string& url,

View File

@ -197,7 +197,7 @@ void CefDevToolsFrontend::InspectElementAt(int x, int y) {
}
void CefDevToolsFrontend::Close() {
base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::UI},
base::PostTask(FROM_HERE, {content::BrowserThread::UI},
base::Bind(&CefBrowserHostImpl::CloseBrowser,
frontend_browser_.get(), true));
}

View File

@ -21,7 +21,7 @@ class WebContents;
namespace extensions {
namespace cef {
class TabsGetFunction : public UIThreadExtensionFunction {
class TabsGetFunction : public ExtensionFunction {
~TabsGetFunction() override {}
ResponseAction Run() override;
@ -29,7 +29,7 @@ class TabsGetFunction : public UIThreadExtensionFunction {
DECLARE_EXTENSION_FUNCTION("tabs.get", TABS_GET)
};
class TabsCreateFunction : public UIThreadExtensionFunction {
class TabsCreateFunction : public ExtensionFunction {
public:
TabsCreateFunction();
~TabsCreateFunction() override {}
@ -88,7 +88,7 @@ class TabsInsertCSSFunction : public ExecuteCodeInTabFunction {
};
// Based on ChromeAsyncExtensionFunction.
class ZoomAPIFunction : public UIThreadExtensionFunction {
class ZoomAPIFunction : public ExtensionFunction {
public:
ZoomAPIFunction();

View File

@ -83,9 +83,10 @@ class CefGetExtensionLoadFileCallbackImpl
return;
}
base::PostTaskWithTraitsAndReplyWithResult(
base::PostTaskAndReplyWithResult(
FROM_HERE,
{base::MayBlock(), base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
{base::ThreadPool(), base::MayBlock(),
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
base::BindOnce(LoadFileFromStream, file, stream), std::move(callback));
}
@ -135,7 +136,7 @@ class CefGetExtensionLoadFileCallbackImpl
} // namespace
CefExtensionFunctionDetails::CefExtensionFunctionDetails(
UIThreadExtensionFunction* function)
ExtensionFunction* function)
: function_(function) {}
CefExtensionFunctionDetails::~CefExtensionFunctionDetails() {}
@ -401,9 +402,17 @@ base::DictionaryValue* CefExtensionFunctionDetails::OpenTab(
return nullptr;
// Return data about the newly created tab.
auto extension = function()->extension();
auto web_contents = new_browser->web_contents();
auto result = CreateTabObject(new_browser, opener_browser_id, active, index);
ExtensionTabUtil::ScrubTabForExtension(
function()->extension(), new_browser->web_contents(), result.get());
auto scrub_tab_behavior = ExtensionTabUtil::GetScrubTabBehavior(
extension, extensions::Feature::Context::UNSPECIFIED_CONTEXT,
web_contents);
if (scrub_tab_behavior != ExtensionTabUtil::kDontScrubTab) {
ExtensionTabUtil::ScrubTabForExtension(extension, web_contents,
result.get(), scrub_tab_behavior);
}
return result->ToValue().release();
}

View File

@ -15,7 +15,7 @@
#include "ui/gfx/native_widget_types.h"
class Profile;
class UIThreadExtensionFunction;
class ExtensionFunction;
namespace content {
class WebContents;
@ -23,13 +23,13 @@ class WebContents;
namespace extensions {
// Provides CEF-specific details to UIThreadExtensionFunction implementations.
// Provides CEF-specific details to ExtensionFunction implementations.
// Based on chrome/browser/extensions/chrome_extension_function_details.h.
class CefExtensionFunctionDetails {
public:
// Constructs a new ChromeExtensionFunctionDetails instance for |function|.
// This instance does not own |function| and must outlive it.
explicit CefExtensionFunctionDetails(UIThreadExtensionFunction* function);
explicit CefExtensionFunctionDetails(ExtensionFunction* function);
~CefExtensionFunctionDetails();
Profile* GetProfile() const;
@ -124,9 +124,9 @@ class CefExtensionFunctionDetails {
static std::unique_ptr<api::tabs::MutedInfo> CreateMutedInfo(
content::WebContents* contents);
// Returns a pointer to the associated UIThreadExtensionFunction
UIThreadExtensionFunction* function() { return function_; }
const UIThreadExtensionFunction* function() const { return function_; }
// Returns a pointer to the associated ExtensionFunction
ExtensionFunction* function() { return function_; }
const ExtensionFunction* function() const { return function_; }
protected:
CefRefPtr<CefExtension> GetCefExtension() const;
@ -134,7 +134,7 @@ class CefExtensionFunctionDetails {
private:
// The function for which these details have been created. Must outlive the
// CefExtensionFunctionDetails instance.
UIThreadExtensionFunction* function_;
ExtensionFunction* function_;
mutable CefRefPtr<CefExtension> cef_extension_;

View File

@ -419,7 +419,7 @@ void CefExtensionSystem::RegisterExtensionWithRequestContexts(
const base::Closure& callback) {
// TODO(extensions): The |incognito_enabled| value should be set based on
// manifest settings.
base::PostTaskWithTraitsAndReply(
base::PostTaskAndReply(
FROM_HERE, {BrowserThread::IO},
base::Bind(&InfoMap::AddExtension, info_map(),
base::RetainedRef(extension), base::Time::Now(),
@ -433,7 +433,7 @@ void CefExtensionSystem::RegisterExtensionWithRequestContexts(
void CefExtensionSystem::UnregisterExtensionWithRequestContexts(
const std::string& extension_id,
const UnloadedExtensionReason reason) {
base::PostTaskWithTraits(
base::PostTask(
FROM_HERE, {BrowserThread::IO},
base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason));
}

View File

@ -281,10 +281,11 @@ CefExtensionsBrowserClient::GetComponentExtensionResourceManager() {
void CefExtensionsBrowserClient::BroadcastEventToRenderers(
events::HistogramValue histogram_value,
const std::string& event_name,
std::unique_ptr<base::ListValue> args) {
std::unique_ptr<base::ListValue> args,
bool dispatch_to_off_the_record_profiles) {
g_browser_process->extension_event_router_forwarder()
->BroadcastEventToRenderers(histogram_value, event_name, std::move(args),
GURL());
GURL(), dispatch_to_off_the_record_profiles);
}
ExtensionCache* CefExtensionsBrowserClient::GetExtensionCache() {

View File

@ -93,7 +93,8 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
void BroadcastEventToRenderers(
events::HistogramValue histogram_value,
const std::string& event_name,
std::unique_ptr<base::ListValue> args) override;
std::unique_ptr<base::ListValue> args,
bool dispatch_to_off_the_record_profiles) override;
ExtensionCache* GetExtensionCache() override;
bool IsBackgroundUpdateAllowed() override;
bool IsMinBrowserVersionSupported(const std::string& min_version) override;

View File

@ -98,8 +98,10 @@ ValueStore::WriteResult CefValueStore::Set(
if (!storage_.GetWithoutPathExpansion(it.key(), &old_value) ||
!old_value->Equals(&it.value())) {
changes->push_back(ValueStoreChange(
it.key(), old_value ? old_value->CreateDeepCopy() : nullptr,
it.value().CreateDeepCopy()));
it.key(),
old_value ? base::Optional<base::Value>(old_value->Clone())
: base::nullopt,
it.value().Clone()));
storage_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy());
}
}
@ -121,7 +123,8 @@ ValueStore::WriteResult CefValueStore::Remove(
it != keys.end(); ++it) {
std::unique_ptr<base::Value> old_value;
if (storage_.RemoveWithoutPathExpansion(*it, &old_value)) {
changes->push_back(ValueStoreChange(*it, std::move(old_value), nullptr));
changes->push_back(
ValueStoreChange(*it, std::move(*old_value), base::nullopt));
}
}
return WriteResult(std::move(changes), CreateStatusCopy(status_));

View File

@ -104,7 +104,7 @@ class CefSimpleMenuModel : public ui::MenuModel {
return impl_->GetGroupIdAt(index);
}
bool GetIconAt(int index, gfx::Image* icon) override { return false; }
bool GetIconAt(int index, gfx::Image* icon) const override { return false; }
ui::ButtonMenuItemModel* GetButtonMenuItemAt(int index) const override {
return NULL;

View File

@ -54,7 +54,7 @@ void CefWindowDelegateView::Init(gfx::AcceleratedWidget parent_widget,
: ui::ZOrderLevel::kNormal;
// Results in a call to InitContent().
widget->Init(params);
widget->Init(std::move(params));
// |widget| should now be associated with |this|.
DCHECK_EQ(widget, GetWidget());

View File

@ -41,8 +41,8 @@ const char kUTF8String[] = "UTF8_STRING";
::Window* children;
::Window child_window = x11::None;
unsigned int nchildren;
if (XQueryTree(display, window, &root, &parent, &children, &nchildren)) {
DCHECK_EQ(1U, nchildren);
if (XQueryTree(display, window, &root, &parent, &children, &nchildren) &&
nchildren == 1) {
child_window = children[0];
XFree(children);
}

View File

@ -462,7 +462,7 @@ class CefURLDataSource : public content::URLDataSource {
void StartDataRequest(
const std::string& path,
const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
const content::WebContents::Getter& wc_getter,
const content::URLDataSource::GotDataCallback& callback) override {
callback.Run(output_);
}
@ -638,87 +638,19 @@ class CefWebUIControllerFactory : public content::WebUIControllerFactory {
// From chrome/browser/chrome_content_browser_client.cc
// Returns a copy of the given url with its host set to given host and path
// set to given path. Other parts of the url will be the same.
static GURL ReplaceURLHostAndPath(const GURL& url,
const std::string& host,
const std::string& path) {
url::Replacements<char> replacements;
replacements.SetHost(host.c_str(), url::Component(0, host.length()));
replacements.SetPath(path.c_str(), url::Component(0, path.length()));
return url.ReplaceComponents(replacements);
}
// Maps "foo://bar/baz/" to "foo://chrome/bar/baz/".
static GURL AddUberHost(const GURL& url) {
const std::string uber_host = chrome::kChromeUIUberHost;
std::string new_path;
url.host_piece().AppendToString(&new_path);
url.path_piece().AppendToString(&new_path);
return ReplaceURLHostAndPath(url, uber_host, new_path);
}
// If url->host() is "chrome" and url->path() has characters other than the
// first slash, changes the url from "foo://chrome/bar/" to "foo://bar/" and
// returns true. Otherwise returns false.
static bool RemoveUberHost(GURL* url) {
if (url->host() != chrome::kChromeUIUberHost)
return false;
if (url->path().empty() || url->path() == "/")
return false;
const std::string old_path = url->path();
const std::string::size_type separator = old_path.find('/', 1);
std::string new_host;
std::string new_path;
if (separator == std::string::npos) {
new_host = old_path.substr(1);
} else {
new_host = old_path.substr(1, separator - 1);
new_path = old_path.substr(separator);
}
// Do not allow URLs with paths empty before the first slash since we can't
// have an empty host. (e.g "foo://chrome//")
if (new_host.empty())
return false;
*url = ReplaceURLHostAndPath(*url, new_host, new_path);
DCHECK(url->is_valid());
return true;
}
// Handles rewriting Web UI URLs.
static bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) {
// Do not handle special URLs such as "about:foo"
if (!url->host().empty()) {
const GURL chrome_url = AddUberHost(*url);
// Handle valid "chrome://chrome/foo" URLs so the reverse handler will
// be called.
if (GetInstance()->UseWebUIForURL(browser_context, chrome_url))
return true;
}
if (!GetInstance()->UseWebUIForURL(browser_context, *url))
return false;
return true;
}
// Reverse URL handler for Web UI. Maps "chrome://chrome/foo/" to
// "chrome://foo/".
// Reverse URL handler for Web UI.
static bool HandleWebUIReverse(GURL* url,
content::BrowserContext* browser_context) {
if (!url->is_valid() || !url->SchemeIs(content::kChromeUIScheme))
// No need to actually reverse-rewrite the URL.
return false;
return RemoveUberHost(url);
}
DISALLOW_COPY_AND_ASSIGN(CefWebUIControllerFactory);

View File

@ -35,26 +35,26 @@ network::mojom::CookieManager* GetCookieManager(
void ContinueWithLoadedCookies(const AllowCookieCallback& allow_cookie_callback,
DoneCookieCallback done_callback,
const net::CookieList& cookies) {
const net::CookieStatusList& cookies) {
CEF_REQUIRE_IOT();
net::CookieList allowed_cookies;
for (const auto& cookie : cookies) {
for (const auto& status : cookies) {
bool allow = false;
allow_cookie_callback.Run(cookie, &allow);
allow_cookie_callback.Run(status.cookie, &allow);
if (allow)
allowed_cookies.push_back(cookie);
allowed_cookies.push_back(status.cookie);
}
std::move(done_callback).Run(cookies.size(), std::move(allowed_cookies));
}
void GetCookieListCallback(const AllowCookieCallback& allow_cookie_callback,
DoneCookieCallback done_callback,
const net::CookieList& cookies,
const net::CookieStatusList& included_cookies,
const net::CookieStatusList&) {
CEF_REQUIRE_UIT();
CEF_POST_TASK(CEF_IOT,
base::BindOnce(ContinueWithLoadedCookies, allow_cookie_callback,
std::move(done_callback), cookies));
std::move(done_callback), included_cookies));
}
void LoadCookiesOnUIThread(content::BrowserContext* browser_context,
@ -87,7 +87,7 @@ void SetCanonicalCookieCallback(
net::CanonicalCookie::CookieInclusionStatus status) {
CEF_REQUIRE_UIT();
progress->num_cookie_lines_left_--;
if (status == net::CanonicalCookie::CookieInclusionStatus::INCLUDE) {
if (status.IsInclude()) {
progress->allowed_cookies_.push_back(cookie);
}
@ -133,7 +133,8 @@ void SaveCookiesOnUIThread(content::BrowserContext* browser_context,
SetCanonicalCookieCallback(
progress, net::CanonicalCookie(),
net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_UNKNOWN_ERROR);
net::CanonicalCookie::CookieInclusionStatus(
net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_UNKNOWN_ERROR));
}
} // namespace
@ -145,7 +146,7 @@ void LoadCookies(content::BrowserContext* browser_context,
CEF_REQUIRE_IOT();
if ((request.load_flags & net::LOAD_DO_NOT_SEND_COOKIES) ||
!request.allow_credentials) {
request.credentials_mode == network::mojom::CredentialsMode::kOmit) {
// Continue immediately without loading cookies.
std::move(done_callback).Run(0, {});
return;
@ -172,7 +173,7 @@ void SaveCookies(content::BrowserContext* browser_context,
DoneCookieCallback done_callback) {
CEF_REQUIRE_IOT();
if (!request.allow_credentials ||
if (request.credentials_mode == network::mojom::CredentialsMode::kOmit ||
!head.headers->HasHeader(net_service::kHTTPSetCookieHeaderName)) {
// Continue immediately without saving cookies.
std::move(done_callback).Run(0, {});
@ -187,7 +188,6 @@ void SaveCookies(content::BrowserContext* browser_context,
net::CookieOptions options;
options.set_include_httponly();
options.set_server_time(response_date);
options.set_same_site_cookie_context(
net::cookie_util::ComputeSameSiteContextForRequest(
request.method, request.url, request.site_for_cookies,
@ -204,10 +204,9 @@ void SaveCookies(content::BrowserContext* browser_context,
net::CanonicalCookie::CookieInclusionStatus returned_status;
std::unique_ptr<net::CanonicalCookie> cookie = net::CanonicalCookie::Create(
request.url, cookie_string, base::Time::Now(), options,
&returned_status);
if (returned_status !=
net::CanonicalCookie::CookieInclusionStatus::INCLUDE) {
request.url, cookie_string, base::Time::Now(),
base::make_optional(response_date), &returned_status);
if (!returned_status.IsInclude()) {
continue;
}

View File

@ -38,11 +38,8 @@ void SetCookieCallbackImpl(CefRefPtr<CefSetCookieCallback> callback,
net::CanonicalCookie::CookieInclusionStatus status) {
if (!callback.get())
return;
CEF_POST_TASK(
CEF_UIT,
base::Bind(
&CefSetCookieCallback::OnComplete, callback.get(),
status == net::CanonicalCookie::CookieInclusionStatus::INCLUDE));
CEF_POST_TASK(CEF_UIT, base::Bind(&CefSetCookieCallback::OnComplete,
callback.get(), status.IsInclude()));
}
// Always execute the callback asynchronously.
@ -79,19 +76,22 @@ void ExecuteVisitor(CefRefPtr<CefCookieVisitor> visitor,
}
// Always execute the callback asynchronously.
void GetCookiesCallbackImpl(CefRefPtr<CefCookieVisitor> visitor,
void GetAllCookiesCallbackImpl(CefRefPtr<CefCookieVisitor> visitor,
CefRefPtr<CefRequestContextImpl> request_context,
const net::CookieList& cookies,
const net::CookieStatusList&) {
const net::CookieList& cookies) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&ExecuteVisitor, visitor, request_context, cookies));
}
void GetAllCookiesCallbackImpl(CefRefPtr<CefCookieVisitor> visitor,
void GetCookiesCallbackImpl(CefRefPtr<CefCookieVisitor> visitor,
CefRefPtr<CefRequestContextImpl> request_context,
const net::CookieList& cookies) {
GetCookiesCallbackImpl(visitor, request_context, cookies,
net::CookieStatusList());
const net::CookieStatusList& include_cookies,
const net::CookieStatusList&) {
net::CookieList cookies;
for (const auto& status : include_cookies) {
cookies.push_back(status.cookie);
}
GetAllCookiesCallbackImpl(visitor, request_context, cookies);
}
} // namespace
@ -221,9 +221,10 @@ bool CefCookieManagerImpl::SetCookie(const CefString& url,
net::CookieSameSite::UNSPECIFIED, net::COOKIE_PRIORITY_DEFAULT);
if (!canonical_cookie) {
SetCookieCallbackImpl(
callback,
net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_UNKNOWN_ERROR);
SetCookieCallbackImpl(callback,
net::CanonicalCookie::CookieInclusionStatus(
net::CanonicalCookie::CookieInclusionStatus::
EXCLUDE_UNKNOWN_ERROR));
return true;
}

View File

@ -16,6 +16,7 @@
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/resource_context.h"
#include "content/public/browser/web_contents.h"
#include "mojo/public/cpp/base/big_buffer.h"
#include "net/http/http_status_code.h"
#include "services/network/public/cpp/cors/cors.h"
@ -37,7 +38,7 @@ class ResourceContextData : public base::SupportsUserData::Data {
static void AddProxyOnUIThread(
ProxyURLLoaderFactory* proxy,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter) {
content::WebContents::Getter web_contents_getter) {
CEF_REQUIRE_UIT();
content::WebContents* web_contents = web_contents_getter.Run();
@ -130,7 +131,8 @@ class InterceptedRequest : public network::mojom::URLLoader,
void Restart();
// Called from ProxyURLLoaderFactory::OnLoaderCreated.
void OnLoaderCreated(network::mojom::TrustedHeaderClientRequest request);
void OnLoaderCreated(
mojo::PendingReceiver<network::mojom::TrustedHeaderClient> receiver);
// Called from InterceptDelegate::OnInputStreamOpenFailed.
void InputStreamFailed(bool restart_needed);
@ -142,9 +144,9 @@ class InterceptedRequest : public network::mojom::URLLoader,
OnHeadersReceivedCallback callback) override;
// mojom::URLLoaderClient methods:
void OnReceiveResponse(const network::ResourceResponseHead& head) override;
void OnReceiveResponse(network::mojom::URLResponseHeadPtr head) override;
void OnReceiveRedirect(const net::RedirectInfo& redirect_info,
const network::ResourceResponseHead& head) override;
network::mojom::URLResponseHeadPtr head) override;
void OnUploadProgress(int64_t current_position,
int64_t total_size,
OnUploadProgressCallback callback) override;
@ -158,7 +160,6 @@ class InterceptedRequest : public network::mojom::URLLoader,
void FollowRedirect(const std::vector<std::string>& removed_headers,
const net::HttpRequestHeaders& modified_headers,
const base::Optional<GURL>& new_url) override;
void ProceedWithResponse() override;
void SetPriority(net::RequestPriority priority,
int32_t intra_priority_value) override;
void PauseReadingBodyFromNet() override;
@ -259,7 +260,8 @@ class InterceptedRequest : public network::mojom::URLLoader,
bool current_request_uses_header_client_ = false;
OnHeadersReceivedCallback on_headers_received_callback_;
mojo::Binding<network::mojom::TrustedHeaderClient> header_client_binding_;
mojo::Receiver<network::mojom::TrustedHeaderClient> header_client_receiver_{
this};
StreamReaderURLLoader* stream_loader_ = nullptr;
@ -321,7 +323,6 @@ InterceptedRequest::InterceptedRequest(
target_client_(std::move(client)),
proxied_client_binding_(this),
target_factory_(std::move(target_factory)),
header_client_binding_(this),
weak_factory_(this) {
status_ = network::URLLoaderCompletionStatus(net::OK);
@ -354,11 +355,11 @@ void InterceptedRequest::Restart() {
target_loader_.reset();
}
if (header_client_binding_.is_bound())
header_client_binding_.Unbind();
if (header_client_receiver_.is_bound())
ignore_result(header_client_receiver_.Unbind());
current_request_uses_header_client_ =
!!factory_->url_loader_header_client_binding_;
!!factory_->url_loader_header_client_receiver_;
const GURL original_url = request_.url;
@ -371,11 +372,11 @@ void InterceptedRequest::Restart() {
}
void InterceptedRequest::OnLoaderCreated(
network::mojom::TrustedHeaderClientRequest request) {
mojo::PendingReceiver<network::mojom::TrustedHeaderClient> receiver) {
DCHECK(current_request_uses_header_client_);
// Only called if we're using the default loader.
header_client_binding_.Bind(std::move(request));
header_client_receiver_.Bind(std::move(receiver));
}
void InterceptedRequest::InputStreamFailed(bool restart_needed) {
@ -443,7 +444,7 @@ void InterceptedRequest::OnHeadersReceived(const std::string& headers,
// URLLoaderClient methods.
void InterceptedRequest::OnReceiveResponse(
const network::ResourceResponseHead& head) {
network::mojom::URLResponseHeadPtr head) {
if (current_request_uses_header_client_) {
// Use the headers we got from OnHeadersReceived as that'll contain
// Set-Cookie if it existed.
@ -463,7 +464,7 @@ void InterceptedRequest::OnReceiveResponse(
void InterceptedRequest::OnReceiveRedirect(
const net::RedirectInfo& redirect_info,
const network::ResourceResponseHead& head) {
network::mojom::URLResponseHeadPtr head) {
bool needs_callback = false;
if (current_request_uses_header_client_) {
@ -575,11 +576,6 @@ void InterceptedRequest::FollowRedirect(
Restart();
}
void InterceptedRequest::ProceedWithResponse() {
if (target_loader_)
target_loader_->ProceedWithResponse();
}
void InterceptedRequest::SetPriority(net::RequestPriority priority,
int32_t intra_priority_value) {
if (target_loader_)
@ -699,7 +695,7 @@ void InterceptedRequest::ContinueAfterInterceptWithOverride(
// avoid having Set-Cookie headers stripped by the IPC layer.
current_request_uses_header_client_ = true;
network::mojom::TrustedHeaderClientPtr header_client;
header_client_binding_.Bind(mojo::MakeRequest(&header_client));
header_client_receiver_.Bind(mojo::MakeRequest(&header_client));
stream_loader_ = new StreamReaderURLLoader(
id_, request_, std::move(proxied_client), std::move(header_client),
@ -951,7 +947,7 @@ void InterceptedRequest::CallOnComplete(
// Since the original client is gone no need to continue loading the
// request.
proxied_client_binding_.Close();
header_client_binding_.Close();
header_client_receiver_.reset();
target_loader_.reset();
// In case there are pending checks as to whether this request should be
@ -1034,13 +1030,12 @@ InterceptedRequestHandler::OnFilterResponseBody(
//==============================
ProxyURLLoaderFactory::ProxyURLLoaderFactory(
network::mojom::URLLoaderFactoryRequest loader_request,
mojo::PendingReceiver<network::mojom::URLLoaderFactory> factory_receiver,
network::mojom::URLLoaderFactoryPtrInfo target_factory_info,
network::mojom::TrustedURLLoaderHeaderClientRequest header_client_request,
mojo::PendingReceiver<network::mojom::TrustedURLLoaderHeaderClient>
header_client_receiver,
std::unique_ptr<InterceptedRequestHandler> request_handler)
: url_loader_header_client_binding_(this),
request_handler_(std::move(request_handler)),
weak_factory_(this) {
: request_handler_(std::move(request_handler)), weak_factory_(this) {
CEF_REQUIRE_IOT();
DCHECK(request_handler_);
@ -1050,12 +1045,12 @@ ProxyURLLoaderFactory::ProxyURLLoaderFactory(
target_factory_.set_connection_error_handler(base::BindOnce(
&ProxyURLLoaderFactory::OnTargetFactoryError, base::Unretained(this)));
}
proxy_bindings_.AddBinding(this, std::move(loader_request));
proxy_bindings_.AddBinding(this, std::move(factory_receiver));
proxy_bindings_.set_connection_error_handler(base::BindRepeating(
&ProxyURLLoaderFactory::OnProxyBindingError, base::Unretained(this)));
if (header_client_request)
url_loader_header_client_binding_.Bind(std::move(header_client_request));
if (header_client_receiver)
url_loader_header_client_receiver_.Bind(std::move(header_client_receiver));
}
ProxyURLLoaderFactory::~ProxyURLLoaderFactory() {
@ -1064,15 +1059,16 @@ ProxyURLLoaderFactory::~ProxyURLLoaderFactory() {
// static
void ProxyURLLoaderFactory::CreateOnIOThread(
network::mojom::URLLoaderFactoryRequest loader_request,
mojo::PendingReceiver<network::mojom::URLLoaderFactory> factory_receiver,
network::mojom::URLLoaderFactoryPtrInfo target_factory_info,
network::mojom::TrustedURLLoaderHeaderClientRequest header_client_request,
mojo::PendingReceiver<network::mojom::TrustedURLLoaderHeaderClient>
header_client_receiver,
content::ResourceContext* resource_context,
std::unique_ptr<InterceptedRequestHandler> request_handler) {
CEF_REQUIRE_IOT();
auto proxy = new ProxyURLLoaderFactory(
std::move(loader_request), std::move(target_factory_info),
std::move(header_client_request), std::move(request_handler));
std::move(factory_receiver), std::move(target_factory_info),
std::move(header_client_receiver), std::move(request_handler));
ResourceContextData::AddProxy(proxy, resource_context);
}
@ -1087,16 +1083,21 @@ void ProxyURLLoaderFactory::SetDisconnectCallback(
// static
void ProxyURLLoaderFactory::CreateProxy(
content::BrowserContext* browser_context,
network::mojom::URLLoaderFactoryRequest loader_request,
network::mojom::URLLoaderFactoryPtrInfo target_factory_info,
network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client,
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
header_client,
std::unique_ptr<InterceptedRequestHandler> request_handler) {
CEF_REQUIRE_UIT();
DCHECK(request_handler);
network::mojom::TrustedURLLoaderHeaderClientRequest header_client_request;
auto proxied_receiver = std::move(*factory_receiver);
network::mojom::URLLoaderFactoryPtrInfo target_factory_info;
*factory_receiver = mojo::MakeRequest(&target_factory_info);
mojo::PendingReceiver<network::mojom::TrustedURLLoaderHeaderClient>
header_client_receiver;
if (header_client)
header_client_request = mojo::MakeRequest(header_client);
header_client_receiver = header_client->InitWithNewPipeAndPassReceiver();
content::ResourceContext* resource_context =
browser_context->GetResourceContext();
@ -1105,21 +1106,23 @@ void ProxyURLLoaderFactory::CreateProxy(
CEF_POST_TASK(
CEF_IOT,
base::BindOnce(
&ProxyURLLoaderFactory::CreateOnIOThread, std::move(loader_request),
std::move(target_factory_info), std::move(header_client_request),
&ProxyURLLoaderFactory::CreateOnIOThread, std::move(proxied_receiver),
std::move(target_factory_info), std::move(header_client_receiver),
base::Unretained(resource_context), std::move(request_handler)));
}
// static
ProxyURLLoaderFactory* ProxyURLLoaderFactory::CreateProxy(
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
content::WebContents::Getter web_contents_getter,
network::mojom::URLLoaderFactoryRequest loader_request,
std::unique_ptr<InterceptedRequestHandler> request_handler) {
CEF_REQUIRE_IOT();
DCHECK(request_handler);
auto proxy = new ProxyURLLoaderFactory(std::move(loader_request), nullptr,
nullptr, std::move(request_handler));
auto proxy = new ProxyURLLoaderFactory(
std::move(loader_request), nullptr,
mojo::PendingReceiver<network::mojom::TrustedURLLoaderHeaderClient>(),
std::move(request_handler));
CEF_POST_TASK(CEF_UIT,
base::BindOnce(ResourceContextData::AddProxyOnUIThread,
base::Unretained(proxy), web_contents_getter));
@ -1169,11 +1172,11 @@ void ProxyURLLoaderFactory::Clone(
void ProxyURLLoaderFactory::OnLoaderCreated(
int32_t request_id,
network::mojom::TrustedHeaderClientRequest request) {
mojo::PendingReceiver<network::mojom::TrustedHeaderClient> receiver) {
CEF_REQUIRE_IOT();
auto request_it = requests_.find(request_id);
if (request_it != requests_.end())
request_it->second->OnLoaderCreated(std::move(request));
request_it->second->OnLoaderCreated(std::move(receiver));
}
void ProxyURLLoaderFactory::OnTargetFactoryError() {

View File

@ -12,10 +12,13 @@
#include "base/containers/unique_ptr_adapters.h"
#include "base/hash/hash.h"
#include "base/macros.h"
#include "base/optional.h"
#include "base/strings/string_piece.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/resource_request_info.h"
#include "content/public/browser/web_contents.h"
#include "mojo/public/cpp/bindings/binding_set.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "services/network/public/cpp/resource_response.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
@ -137,14 +140,14 @@ class ProxyURLLoaderFactory
// Create a proxy object on the UI thread.
static void CreateProxy(
content::BrowserContext* browser_context,
network::mojom::URLLoaderFactoryRequest loader_request,
network::mojom::URLLoaderFactoryPtrInfo target_factory_info,
network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client,
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
header_client,
std::unique_ptr<InterceptedRequestHandler> request_handler);
// Create a proxy object on the IO thread.
static ProxyURLLoaderFactory* CreateProxy(
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
content::WebContents::Getter web_contents_getter,
network::mojom::URLLoaderFactoryRequest loader_request,
std::unique_ptr<InterceptedRequestHandler> request_handler);
@ -162,22 +165,25 @@ class ProxyURLLoaderFactory
// network::mojom::TrustedURLLoaderHeaderClient:
void OnLoaderCreated(
int32_t request_id,
network::mojom::TrustedHeaderClientRequest request) override;
mojo::PendingReceiver<network::mojom::TrustedHeaderClient> receiver)
override;
private:
friend class InterceptedRequest;
friend class ResourceContextData;
ProxyURLLoaderFactory(
network::mojom::URLLoaderFactoryRequest loader_request,
mojo::PendingReceiver<network::mojom::URLLoaderFactory> factory_receiver,
network::mojom::URLLoaderFactoryPtrInfo target_factory_info,
network::mojom::TrustedURLLoaderHeaderClientRequest header_client_request,
mojo::PendingReceiver<network::mojom::TrustedURLLoaderHeaderClient>
header_client_receiver,
std::unique_ptr<InterceptedRequestHandler> request_handler);
static void CreateOnIOThread(
network::mojom::URLLoaderFactoryRequest loader_request,
mojo::PendingReceiver<network::mojom::URLLoaderFactory> factory_receiver,
network::mojom::URLLoaderFactoryPtrInfo target_factory_info,
network::mojom::TrustedURLLoaderHeaderClientRequest header_client_request,
mojo::PendingReceiver<network::mojom::TrustedURLLoaderHeaderClient>
header_client_receiver,
content::ResourceContext* resource_context,
std::unique_ptr<InterceptedRequestHandler> request_handler);
@ -192,7 +198,7 @@ class ProxyURLLoaderFactory
mojo::BindingSet<network::mojom::URLLoaderFactory> proxy_bindings_;
network::mojom::URLLoaderFactoryPtr target_factory_;
mojo::Binding<network::mojom::TrustedURLLoaderHeaderClient>
url_loader_header_client_binding_;
url_loader_header_client_receiver_{this};
std::unique_ptr<InterceptedRequestHandler> request_handler_;

View File

@ -1175,7 +1175,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
void InitOnUIThread(
scoped_refptr<InterceptedRequestHandlerWrapper::InitHelper> init_helper,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
content::WebContents::Getter web_contents_getter,
int frame_tree_node_id,
const network::ResourceRequest& request) {
CEF_REQUIRE_UIT();
@ -1300,7 +1300,7 @@ std::unique_ptr<InterceptedRequestHandler> CreateInterceptedRequestHandler(
}
std::unique_ptr<InterceptedRequestHandler> CreateInterceptedRequestHandler(
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
content::WebContents::Getter web_contents_getter,
int frame_tree_node_id,
const network::ResourceRequest& request) {
auto wrapper = std::make_unique<InterceptedRequestHandlerWrapper>();

View File

@ -5,7 +5,7 @@
#ifndef CEF_LIBCEF_BROWSER_NET_SERVICE_RESOURCE_REQUEST_HANDLER_WRAPPER_H_
#define CEF_LIBCEF_BROWSER_NET_SERVICE_RESOURCE_REQUEST_HANDLER_WRAPPER_H_
#include "content/public/browser/resource_request_info.h"
#include "content/public/browser/web_contents.h"
namespace content {
class BrowserContext;
@ -39,7 +39,7 @@ std::unique_ptr<InterceptedRequestHandler> CreateInterceptedRequestHandler(
// CefResourceRequestHandler. The resulting object should be passed to
// ProxyURLLoaderFactory::CreateProxy. Called on the IO thread only.
std::unique_ptr<InterceptedRequestHandler> CreateInterceptedRequestHandler(
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
content::WebContents::Getter web_contents_getter,
int frame_tree_node_id,
const network::ResourceRequest& request);

View File

@ -478,7 +478,7 @@ StreamReaderURLLoader::StreamReaderURLLoader(
// All InputStream work will be performed on this task runner.
stream_work_task_runner_ =
base::CreateSequencedTaskRunnerWithTraits({base::MayBlock()});
base::CreateSequencedTaskRunner({base::ThreadPool(), base::MayBlock()});
}
StreamReaderURLLoader::~StreamReaderURLLoader() {
@ -537,8 +537,6 @@ void StreamReaderURLLoader::FollowRedirect(
NOTREACHED();
}
void StreamReaderURLLoader::ProceedWithResponse() {}
void StreamReaderURLLoader::SetPriority(net::RequestPriority priority,
int intra_priority_value) {}

View File

@ -13,6 +13,7 @@
#include "mojo/public/cpp/system/simple_watcher.h"
#include "net/http/http_byte_range.h"
#include "services/network/public/cpp/net_adapters.h"
#include "services/network/public/cpp/resource_response.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "services/network/public/mojom/url_loader.mojom.h"
@ -173,7 +174,6 @@ class StreamReaderURLLoader : public network::mojom::URLLoader {
void FollowRedirect(const std::vector<std::string>& removed_headers,
const net::HttpRequestHeaders& modified_headers,
const base::Optional<GURL>& new_url) override;
void ProceedWithResponse() override;
void SetPriority(net::RequestPriority priority,
int intra_priority_value) override;
void PauseReadingBodyFromNet() override;

View File

@ -61,8 +61,8 @@ scoped_refptr<URLLoaderFactoryGetter> URLLoaderFactoryGetter::Create(
// Allow the Content embedder to inject itself if it wants to.
should_proxy |= CefContentBrowserClient::Get()->WillCreateURLLoaderFactory(
browser_context, render_frame_host, render_process_id,
false /* is_navigation */, false /* is_download */, url::Origin(),
&maybe_proxy_factory_request, nullptr /* header_client */,
content::ContentBrowserClient::URLLoaderFactoryType::kDocumentSubResource,
url::Origin(), &maybe_proxy_factory_request, nullptr /* header_client */,
nullptr /* bypass_redirect_checks */);
// If anyone above indicated that they care about proxying, pass the

View File

@ -13,7 +13,7 @@
#include "components/viz/common/resources/resource_format.h"
#include "components/viz/common/resources/resource_sizes.h"
#include "mojo/public/cpp/system/platform_handle.h"
#include "services/viz/privileged/interfaces/compositing/layered_window_updater.mojom.h"
#include "services/viz/privileged/mojom/compositing/layered_window_updater.mojom.h"
#include "skia/ext/platform_canvas.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkRect.h"

View File

@ -29,6 +29,7 @@
#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"
#include "content/browser/gpu/gpu_data_manager_impl.h"
#include "content/browser/renderer_host/cursor_manager.h"
#include "content/browser/renderer_host/delegated_frame_host.h"
#include "content/browser/renderer_host/dip_util.h"
@ -247,7 +248,7 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
Show();
}
if (!factory->IsGpuCompositingDisabled()) {
if (!content::GpuDataManagerImpl::GetInstance()->IsGpuCompositingDisabled()) {
video_consumer_.reset(new CefVideoConsumerOSR(this));
video_consumer_->SetActive(true);
video_consumer_->SetFrameRate(
@ -258,8 +259,10 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
CefRenderWidgetHostViewOSR::~CefRenderWidgetHostViewOSR() {
// Marking the DelegatedFrameHost as removed from the window hierarchy is
// necessary to remove all connections to its old ui::Compositor.
if (is_showing_)
delegated_frame_host_->WasHidden();
if (is_showing_) {
delegated_frame_host_->WasHidden(
content::DelegatedFrameHost::HiddenCause::kOther);
}
delegated_frame_host_->DetachFromCompositor();
delegated_frame_host_.reset(nullptr);
@ -347,7 +350,8 @@ void CefRenderWidgetHostViewOSR::Hide() {
if (render_widget_host_)
render_widget_host_->WasHidden();
GetDelegatedFrameHost()->WasHidden();
GetDelegatedFrameHost()->WasHidden(
content::DelegatedFrameHost::HiddenCause::kOther);
GetDelegatedFrameHost()->DetachFromCompositor();
}
@ -395,7 +399,7 @@ base::Optional<SkColor> CefRenderWidgetHostViewOSR::GetBackgroundColor() {
void CefRenderWidgetHostViewOSR::UpdateBackgroundColor() {}
bool CefRenderWidgetHostViewOSR::LockMouse() {
bool CefRenderWidgetHostViewOSR::LockMouse(bool request_unadjusted_movement) {
return false;
}
@ -447,10 +451,6 @@ void CefRenderWidgetHostViewOSR::SubmitCompositorFrame(
NOTREACHED();
}
void CefRenderWidgetHostViewOSR::ClearCompositorFrame() {
NOTREACHED();
}
void CefRenderWidgetHostViewOSR::ResetFallbackToFirstNavigationSurface() {
GetDelegatedFrameHost()->ResetFallbackToFirstNavigationSurface();
}

View File

@ -18,6 +18,7 @@
#include "libcef/browser/osr/motion_event_osr.h"
#include "base/memory/weak_ptr.h"
#include "base/optional.h"
#include "build/build_config.h"
#include "components/viz/common/frame_sinks/begin_frame_source.h"
#include "components/viz/common/surfaces/parent_local_surface_id_allocator.h"
@ -125,7 +126,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
void SetBackgroundColor(SkColor color) override;
base::Optional<SkColor> GetBackgroundColor() override;
void UpdateBackgroundColor() override;
bool LockMouse() override;
bool LockMouse(bool request_unadjusted_movement) override;
void UnlockMouse() override;
void TakeFallbackContentFrom(content::RenderWidgetHostView* view) override;
@ -143,7 +144,6 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
const viz::LocalSurfaceId& local_surface_id,
viz::CompositorFrame frame,
base::Optional<viz::HitTestRegionList> hit_test_region_list) override;
void ClearCompositorFrame() override;
void ResetFallbackToFirstNavigationSurface() override;
void InitAsPopup(content::RenderWidgetHostView* parent_host_view,
const gfx::Rect& pos) override;

View File

@ -5,8 +5,8 @@
#include "base/threading/thread_checker.h"
#include "components/viz/service/display/software_output_device.h"
#include "components/viz/service/viz_service_export.h"
#include "services/viz/privileged/interfaces/compositing/display_private.mojom.h"
#include "services/viz/privileged/interfaces/compositing/layered_window_updater.mojom.h"
#include "services/viz/privileged/mojom/compositing/display_private.mojom.h"
#include "services/viz/privileged/mojom/compositing/layered_window_updater.mojom.h"
namespace viz {

View File

@ -5,8 +5,7 @@
#include "libcef/browser/plugins/plugin_service_filter.h"
#include "include/cef_request_context_handler.h"
#include "libcef/browser/browser_host_impl.h"
#include "libcef/browser/resource_context.h"
#include "libcef/browser/browser_context.h"
#include "libcef/browser/thread_util.h"
#include "libcef/browser/web_plugin_impl.h"
#include "libcef/common/content_client.h"
@ -18,17 +17,13 @@ CefPluginServiceFilter::CefPluginServiceFilter() {}
bool CefPluginServiceFilter::IsPluginAvailable(
int render_process_id,
int render_frame_id,
const void* context,
const GURL& url,
bool is_main_frame,
const url::Origin& main_frame_origin,
content::WebPluginInfo* plugin) {
// With PlzNavigate this can be called before the renderer process exists.
if (render_process_id < 0)
return true;
CEF_REQUIRE_UIT();
DCHECK_GT(render_process_id, 0);
CefResourceContext* resource_context = const_cast<CefResourceContext*>(
reinterpret_cast<const CefResourceContext*>(context));
chrome::mojom::PluginStatus status = chrome::mojom::PluginStatus::kAllowed;
// Perform origin check here because we're passing an empty origin value to
@ -52,8 +47,8 @@ bool CefPluginServiceFilter::IsPluginAvailable(
// retrieve the actual load decision with a non-empty origin. That will
// determine whether the plugin load is allowed or the plugin placeholder is
// displayed.
return IsPluginAvailable(render_process_id, render_frame_id, resource_context,
url, is_main_frame, url::Origin(), plugin, &status);
return IsPluginAvailable(render_process_id, render_frame_id, url,
is_main_frame, url::Origin(), plugin, &status);
}
bool CefPluginServiceFilter::CanLoadPlugin(int render_process_id,
@ -64,14 +59,13 @@ bool CefPluginServiceFilter::CanLoadPlugin(int render_process_id,
bool CefPluginServiceFilter::IsPluginAvailable(
int render_process_id,
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,
chrome::mojom::PluginStatus* status) {
CefResourceContext* resource_context =
static_cast<CefResourceContext*>(content_resource_context);
CEF_REQUIRE_UIT();
DCHECK_GT(render_process_id, 0);
if (*status == chrome::mojom::PluginStatus::kNotFound) {
// The plugin does not exist so no need to query the handler.
@ -94,17 +88,21 @@ bool CefPluginServiceFilter::IsPluginAvailable(
return true;
}
// The |render_frame_id| value may not be valid, so allow matches with any
// handler that shares the same |render_process_id| value.
CefRefPtr<CefRequestContextHandler> handler = resource_context->GetHandler(
auto browser_context = CefBrowserContext::GetForIDs(
render_process_id, render_frame_id, -1, false);
CefRefPtr<CefRequestContextHandler> handler;
if (browser_context) {
handler = browser_context->GetHandler(render_process_id, render_frame_id,
-1, false);
}
if (!handler) {
// No handler so go with the default plugin load decision.
return *status != chrome::mojom::PluginStatus::kDisabled;
}
// Check for a cached plugin load decision.
if (resource_context->HasPluginLoadDecision(render_process_id, plugin->path,
if (browser_context->HasPluginLoadDecision(render_process_id, plugin->path,
is_main_frame, main_frame_origin,
status)) {
return *status != chrome::mojom::PluginStatus::kDisabled;
@ -156,7 +154,7 @@ bool CefPluginServiceFilter::IsPluginAvailable(
}
// Cache the plugin load decision.
resource_context->AddPluginLoadDecision(render_process_id, plugin->path,
browser_context->AddPluginLoadDecision(render_process_id, plugin->path,
is_main_frame, main_frame_origin,
*status);

View File

@ -25,7 +25,6 @@ class CefPluginServiceFilter : public content::PluginServiceFilter {
// exposed to JavaScript via 'navigator.plugins'.
bool IsPluginAvailable(int render_process_id,
int render_frame_id,
const void* context,
const GURL& url,
bool is_main_frame,
const url::Origin& main_frame_origin,
@ -41,7 +40,6 @@ class CefPluginServiceFilter : public content::PluginServiceFilter {
// See related discussion in issue #2015.
bool IsPluginAvailable(int render_process_id,
int render_frame_id,
content::ResourceContext* resource_context,
const GURL& url,
bool is_main_frame,
const url::Origin& main_frame_origin,

View File

@ -25,18 +25,16 @@
#include "chrome/browser/prefs/chrome_command_line_pref_store.h"
#include "chrome/browser/renderer_host/pepper/device_id_fetcher.h"
#include "chrome/browser/ssl/ssl_config_service_manager.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"
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/ui/webui/print_preview/sticky_settings.h"
#include "chrome/common/buildflags.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/locale_settings.h"
#include "components/certificate_transparency/pref_names.h"
#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/flags_ui/pref_service_flags_storage.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/language/core/browser/language_prefs.h"
#include "components/language/core/browser/pref_names.h"
@ -61,6 +59,12 @@
#include "components/os_crypt/os_crypt.h"
#endif
#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
#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"
#endif
namespace browser_prefs {
namespace {
@ -104,8 +108,9 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
// Get sequenced task runner for making sure that file operations are
// executed in expected order (what was previously assured by the FILE
// thread).
sequenced_task_runner = base::CreateSequencedTaskRunnerWithTraits(
{base::MayBlock(), base::TaskShutdownBehavior::BLOCK_SHUTDOWN});
sequenced_task_runner = base::CreateSequencedTaskRunner(
{base::ThreadPool(), base::MayBlock(),
base::TaskShutdownBehavior::BLOCK_SHUTDOWN});
}
// Used to store user preferences.
@ -170,6 +175,7 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
// Default preferences.
CefMediaCaptureDevicesDispatcher::RegisterPrefs(registry.get());
certificate_transparency::prefs::RegisterPrefs(registry.get());
flags_ui::PrefServiceFlagsStorage::RegisterPrefs(registry.get());
PluginInfoHostImpl::RegisterUserPrefs(registry.get());
PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get());
SSLConfigServiceManager::RegisterPrefs(registry.get());
@ -215,7 +221,6 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
chrome_browser_net::RegisterPredictionOptionsProfilePrefs(registry.get());
DeviceIDFetcher::RegisterProfilePrefs(registry.get());
extensions::ExtensionPrefs::RegisterProfilePrefs(registry.get());
GoogleURLTracker::RegisterProfilePrefs(registry.get());
HostContentSettingsMap::RegisterProfilePrefs(registry.get());
language::LanguagePrefs::RegisterProfilePrefs(registry.get());
ProfileNetworkContextService::RegisterProfilePrefs(registry.get());

View File

@ -6,15 +6,15 @@
#include "base/logging.h"
CefPrintSettingsImpl::CefPrintSettingsImpl(printing::PrintSettings* value,
bool will_delete,
CefPrintSettingsImpl::CefPrintSettingsImpl(
std::unique_ptr<printing::PrintSettings> settings,
bool read_only)
: CefValueBase<CefPrintSettings, printing::PrintSettings>(
value,
NULL,
will_delete ? kOwnerWillDelete : kOwnerNoDelete,
: CefValueBase<CefPrintSettings, printing::PrintSettings>(settings.get(),
nullptr,
kOwnerNoDelete,
read_only,
NULL) {}
nullptr),
settings_(std::move(settings)) {}
bool CefPrintSettingsImpl::IsValid() {
return !detached();
@ -24,13 +24,6 @@ bool CefPrintSettingsImpl::IsReadOnly() {
return read_only();
}
CefRefPtr<CefPrintSettings> CefPrintSettingsImpl::Copy() {
CEF_VALUE_VERIFY_RETURN(false, NULL);
printing::PrintSettings* new_settings = new printing::PrintSettings;
*new_settings = const_value();
return new CefPrintSettingsImpl(new_settings, true, false);
}
void CefPrintSettingsImpl::SetOrientation(bool landscape) {
CEF_VALUE_VERIFY_RETURN_VOID(true);
mutable_value()->SetOrientation(landscape);
@ -155,9 +148,15 @@ CefPrintSettings::DuplexMode CefPrintSettingsImpl::GetDuplexMode() {
return static_cast<DuplexMode>(const_value().duplex_mode());
}
std::unique_ptr<printing::PrintSettings> CefPrintSettingsImpl::TakeOwnership() {
Detach(nullptr);
return std::move(settings_);
}
// CefPrintSettings implementation.
// static
CefRefPtr<CefPrintSettings> CefPrintSettings::Create() {
return new CefPrintSettingsImpl(new printing::PrintSettings(), true, false);
return new CefPrintSettingsImpl(std::make_unique<printing::PrintSettings>(),
false);
}

View File

@ -15,14 +15,12 @@
class CefPrintSettingsImpl
: public CefValueBase<CefPrintSettings, printing::PrintSettings> {
public:
CefPrintSettingsImpl(printing::PrintSettings* value,
bool will_delete,
CefPrintSettingsImpl(std::unique_ptr<printing::PrintSettings> settings,
bool read_only);
// CefPrintSettings methods.
bool IsValid() override;
bool IsReadOnly() override;
CefRefPtr<CefPrintSettings> Copy() override;
void SetOrientation(bool landscape) override;
bool IsLandscape() override;
void SetPrinterPrintableArea(const CefSize& physical_size_device_units,
@ -46,8 +44,10 @@ class CefPrintSettingsImpl
void SetDuplexMode(DuplexMode mode) override;
DuplexMode GetDuplexMode() override;
// Must hold the controller lock while using this value.
const printing::PrintSettings& print_settings() { return const_value(); }
std::unique_ptr<printing::PrintSettings> TakeOwnership() WARN_UNUSED_RESULT;
private:
std::unique_ptr<printing::PrintSettings> settings_;
DISALLOW_COPY_AND_ASSIGN(CefPrintSettingsImpl);
};

View File

@ -173,12 +173,12 @@ CefPrintDialogLinux::~CefPrintDialogLinux() {
}
void CefPrintDialogLinux::UseDefaultSettings() {
PrintSettings settings;
UpdateSettings(&settings, true);
UpdateSettings(std::make_unique<PrintSettings>(), true);
}
void CefPrintDialogLinux::UpdateSettings(printing::PrintSettings* settings) {
UpdateSettings(settings, false);
void CefPrintDialogLinux::UpdateSettings(
std::unique_ptr<PrintSettings> settings) {
UpdateSettings(std::move(settings), false);
}
void CefPrintDialogLinux::ShowDialog(
@ -267,7 +267,8 @@ void CefPrintDialogLinux::ReleaseHandler() {
}
}
bool CefPrintDialogLinux::UpdateSettings(printing::PrintSettings* settings,
bool CefPrintDialogLinux::UpdateSettings(
std::unique_ptr<PrintSettings> settings,
bool get_defaults) {
CEF_REQUIRE_UIT();
@ -276,11 +277,10 @@ bool CefPrintDialogLinux::UpdateSettings(printing::PrintSettings* settings,
return false;
CefRefPtr<CefPrintSettingsImpl> settings_impl(
new CefPrintSettingsImpl(settings, false, false));
new CefPrintSettingsImpl(std::move(settings), false));
handler_->OnPrintSettings(browser_.get(), settings_impl.get(), get_defaults);
settings_impl->Detach(NULL);
context_->InitWithSettings(*settings);
context_->InitWithSettings(settings_impl->TakeOwnership());
return true;
}
@ -305,12 +305,9 @@ void CefPrintDialogLinux::SendDocumentToPrinter(
void CefPrintDialogLinux::OnPrintContinue(
CefRefPtr<CefPrintSettings> settings) {
{
CefPrintSettingsImpl* impl =
static_cast<CefPrintSettingsImpl*>(settings.get());
CefValueController::AutoLock lock_scope(impl->controller());
context_->InitWithSettings(impl->print_settings());
}
context_->InitWithSettings(impl->TakeOwnership());
std::move(callback_).Run(PrintingContextLinux::OK);
}

View File

@ -42,7 +42,8 @@ class CefPrintDialogLinux : public printing::PrintDialogGtkInterface,
// PrintDialogGtkInterface implementation.
void UseDefaultSettings() override;
void UpdateSettings(printing::PrintSettings* settings) override;
void UpdateSettings(
std::unique_ptr<printing::PrintSettings> settings) override;
void ShowDialog(
gfx::NativeView parent_view,
bool has_selection,
@ -68,7 +69,8 @@ class CefPrintDialogLinux : public printing::PrintDialogGtkInterface,
void SetHandler();
void ReleaseHandler();
bool UpdateSettings(printing::PrintSettings* settings, bool get_defaults);
bool UpdateSettings(std::unique_ptr<printing::PrintSettings> settings,
bool get_defaults);
// Prints document named |document_name|.
void SendDocumentToPrinter(const base::string16& document_name);

View File

@ -137,7 +137,7 @@ void StopWorker(int document_cookie) {
std::unique_ptr<PrinterQuery> printer_query =
queue->PopPrinterQuery(document_cookie);
if (printer_query.get()) {
base::PostTaskWithTraits(
base::PostTask(
FROM_HERE, {BrowserThread::IO},
base::BindOnce(&PrinterQuery::StopWorker, std::move(printer_query)));
}
@ -158,8 +158,7 @@ void SavePdfFile(scoped_refptr<base::RefCountedSharedMemoryMapping> data,
bool ok = file.IsValid() && metafile.SaveTo(&file);
if (!callback.is_null()) {
base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI},
base::Bind(callback, ok));
base::PostTask(FROM_HERE, {BrowserThread::UI}, base::Bind(callback, ok));
}
}
@ -330,7 +329,7 @@ void CefPrintViewManager::TerminatePdfPrintJob() {
if (!pdf_print_state_->callback_.is_null()) {
// Execute the callback.
base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI},
base::PostTask(FROM_HERE, {BrowserThread::UI},
base::Bind(pdf_print_state_->callback_, false));
}

View File

@ -80,7 +80,7 @@ CefPrintingMessageFilter::CefPrintingMessageFilter(int render_process_id,
base::Unretained(this)));
is_printing_enabled_.Init(prefs::kPrintingEnabled, profile->GetPrefs());
is_printing_enabled_.MoveToSequence(
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO}));
base::CreateSingleThreadTaskRunner({BrowserThread::IO}));
}
void CefPrintingMessageFilter::EnsureShutdownNotifierFactoryBuilt() {

View File

@ -0,0 +1,69 @@
// Copyright (c) 2019 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "libcef/browser/request_context_handler_map.h"
CefRequestContextHandlerMap::CefRequestContextHandlerMap() = default;
CefRequestContextHandlerMap::~CefRequestContextHandlerMap() = default;
void CefRequestContextHandlerMap::AddHandler(
int render_process_id,
int render_frame_id,
int frame_tree_node_id,
CefRefPtr<CefRequestContextHandler> handler) {
DCHECK_GE(render_process_id, 0);
DCHECK_GE(render_frame_id, 0);
DCHECK_GE(frame_tree_node_id, 0);
DCHECK(handler);
render_id_handler_map_.insert(std::make_pair(
std::make_pair(render_process_id, render_frame_id), handler));
node_id_handler_map_.insert(std::make_pair(frame_tree_node_id, handler));
}
void CefRequestContextHandlerMap::RemoveHandler(int render_process_id,
int render_frame_id,
int frame_tree_node_id) {
DCHECK_GE(render_process_id, 0);
DCHECK_GE(render_frame_id, 0);
DCHECK_GE(frame_tree_node_id, 0);
auto it1 = render_id_handler_map_.find(
std::make_pair(render_process_id, render_frame_id));
if (it1 != render_id_handler_map_.end())
render_id_handler_map_.erase(it1);
auto it2 = node_id_handler_map_.find(frame_tree_node_id);
if (it2 != node_id_handler_map_.end())
node_id_handler_map_.erase(it2);
}
CefRefPtr<CefRequestContextHandler> CefRequestContextHandlerMap::GetHandler(
int render_process_id,
int render_frame_id,
int frame_tree_node_id,
bool require_frame_match) const {
if (render_process_id >= 0 && render_frame_id >= 0) {
const auto it1 = render_id_handler_map_.find(
std::make_pair(render_process_id, render_frame_id));
if (it1 != render_id_handler_map_.end())
return it1->second;
}
if (frame_tree_node_id >= 0) {
const auto it2 = node_id_handler_map_.find(frame_tree_node_id);
if (it2 != node_id_handler_map_.end())
return it2->second;
}
if (render_process_id >= 0 && !require_frame_match) {
// Choose an arbitrary handler for the same process.
for (auto& kv : render_id_handler_map_) {
if (kv.first.first == render_process_id)
return kv.second;
}
}
return nullptr;
}

View File

@ -0,0 +1,61 @@
// Copyright (c) 2019 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_REQUEST_CONTEXT_HANDLER_MAP_
#define CEF_LIBCEF_BROWSER_REQUEST_CONTEXT_HANDLER_MAP_
#pragma once
#include <map>
#include "include/cef_request_context.h"
#include "include/cef_request_context_handler.h"
#include "base/macros.h"
// Tracks CefRequestContextHandler associations on a single thread.
class CefRequestContextHandlerMap {
public:
CefRequestContextHandlerMap();
~CefRequestContextHandlerMap();
// Keep track of handlers associated with specific frames. This information
// originates from frame create/delete notifications in CefBrowserHostImpl or
// CefMimeHandlerViewGuestDelegate which are forwarded via
// CefRequestContextImpl and CefBrowserContext.
void AddHandler(int render_process_id,
int render_frame_id,
int frame_tree_node_id,
CefRefPtr<CefRequestContextHandler> handler);
void RemoveHandler(int render_process_id,
int render_frame_id,
int frame_tree_node_id);
// Returns the handler that matches the specified IDs. Pass -1 for unknown
// values. If |require_frame_match| is true only exact matches will be
// returned. If |require_frame_match| is false, and there is not an exact
// match, then the first handler for the same |render_process_id| will be
// returned.
CefRefPtr<CefRequestContextHandler> GetHandler(
int render_process_id,
int render_frame_id,
int frame_tree_node_id,
bool require_frame_match) const;
private:
// Map of (render_process_id, render_frame_id) to handler.
typedef std::map<std::pair<int, int>, CefRefPtr<CefRequestContextHandler>>
RenderIdHandlerMap;
RenderIdHandlerMap render_id_handler_map_;
// Map of frame_tree_node_id to handler. Keeping this map is necessary
// because, when navigating the main frame, a new (pre-commit) network request
// will be created before the RenderFrameHost. Consequently we can't rely
// on valid render IDs. See https://crbug.com/776884 for background.
typedef std::map<int, CefRefPtr<CefRequestContextHandler>> NodeIdHandlerMap;
NodeIdHandlerMap node_id_handler_map_;
DISALLOW_COPY_AND_ASSIGN(CefRequestContextHandlerMap);
};
#endif // CEF_LIBCEF_BROWSER_REQUEST_CONTEXT_HANDLER_MAP_

View File

@ -358,7 +358,7 @@ bool CefRequestContextImpl::ClearSchemeHandlerFactories() {
void CefRequestContextImpl::PurgePluginListCache(bool reload_pages) {
GetBrowserContext(
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::UI}),
base::CreateSingleThreadTaskRunner({BrowserThread::UI}),
base::Bind(&CefRequestContextImpl::PurgePluginListCacheInternal, this,
reload_pages));
}
@ -490,7 +490,7 @@ bool CefRequestContextImpl::SetPreference(const CefString& name,
void CefRequestContextImpl::ClearCertificateExceptions(
CefRefPtr<CefCompletionCallback> callback) {
GetBrowserContext(
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::UI}),
base::CreateSingleThreadTaskRunner({BrowserThread::UI}),
base::Bind(&CefRequestContextImpl::ClearCertificateExceptionsInternal,
this, callback));
}
@ -498,7 +498,7 @@ void CefRequestContextImpl::ClearCertificateExceptions(
void CefRequestContextImpl::ClearHttpAuthCredentials(
CefRefPtr<CefCompletionCallback> callback) {
GetBrowserContext(
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::UI}),
base::CreateSingleThreadTaskRunner({BrowserThread::UI}),
base::Bind(&CefRequestContextImpl::ClearHttpAuthCredentialsInternal, this,
callback));
}
@ -506,7 +506,7 @@ void CefRequestContextImpl::ClearHttpAuthCredentials(
void CefRequestContextImpl::CloseAllConnections(
CefRefPtr<CefCompletionCallback> callback) {
GetBrowserContext(
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::UI}),
base::CreateSingleThreadTaskRunner({BrowserThread::UI}),
base::Bind(&CefRequestContextImpl::CloseAllConnectionsInternal, this,
callback));
}
@ -514,10 +514,9 @@ void CefRequestContextImpl::CloseAllConnections(
void CefRequestContextImpl::ResolveHost(
const CefString& origin,
CefRefPtr<CefResolveCallback> callback) {
GetBrowserContext(
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::UI}),
base::Bind(&CefRequestContextImpl::ResolveHostInternal, this, origin,
callback));
GetBrowserContext(base::CreateSingleThreadTaskRunner({BrowserThread::UI}),
base::Bind(&CefRequestContextImpl::ResolveHostInternal,
this, origin, callback));
}
void CefRequestContextImpl::LoadExtension(
@ -711,7 +710,7 @@ void CefRequestContextImpl::PurgePluginListCacheInternal(
bool reload_pages,
CefBrowserContext* browser_context) {
CEF_REQUIRE_UIT();
browser_context->OnPurgePluginListCache();
browser_context->ClearPluginLoadDecision(-1);
content::PluginService::GetInstance()->PurgePluginListCache(browser_context,
false);
}

View File

@ -12,7 +12,6 @@
#include "base/logging.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "content/browser/loader/resource_dispatcher_host_impl.h"
#include "content/browser/resource_context_impl.h"
#include "content/public/browser/browser_thread.h"
@ -58,127 +57,32 @@ CefResourceContext::CreateClientCertStore() {
#endif
}
void CefResourceContext::set_extensions_info_map(
extensions::InfoMap* extensions_info_map) {
DCHECK(!extension_info_map_);
extension_info_map_ = extensions_info_map;
}
void CefResourceContext::AddHandler(
int render_process_id,
int render_frame_id,
int frame_tree_node_id,
CefRefPtr<CefRequestContextHandler> handler) {
CEF_REQUIRE_IOT();
DCHECK_GE(render_process_id, 0);
DCHECK_GE(render_frame_id, 0);
DCHECK_GE(frame_tree_node_id, 0);
DCHECK(handler);
render_id_handler_map_.insert(std::make_pair(
std::make_pair(render_process_id, render_frame_id), handler));
node_id_handler_map_.insert(std::make_pair(frame_tree_node_id, handler));
handler_map_.AddHandler(render_process_id, render_frame_id,
frame_tree_node_id, handler);
}
void CefResourceContext::RemoveHandler(int render_process_id,
int render_frame_id,
int frame_tree_node_id) {
CEF_REQUIRE_IOT();
DCHECK_GE(render_process_id, 0);
DCHECK_GE(render_frame_id, 0);
DCHECK_GE(frame_tree_node_id, 0);
auto it1 = render_id_handler_map_.find(
std::make_pair(render_process_id, render_frame_id));
if (it1 != render_id_handler_map_.end())
render_id_handler_map_.erase(it1);
auto it2 = node_id_handler_map_.find(frame_tree_node_id);
if (it2 != node_id_handler_map_.end())
node_id_handler_map_.erase(it2);
handler_map_.RemoveHandler(render_process_id, render_frame_id,
frame_tree_node_id);
}
CefRefPtr<CefRequestContextHandler> CefResourceContext::GetHandler(
int render_process_id,
int render_frame_id,
int frame_tree_node_id,
bool require_frame_match) {
bool require_frame_match) const {
CEF_REQUIRE_IOT();
if (render_process_id >= 0 && render_frame_id >= 0) {
const auto it1 = render_id_handler_map_.find(
std::make_pair(render_process_id, render_frame_id));
if (it1 != render_id_handler_map_.end())
return it1->second;
}
if (frame_tree_node_id >= 0) {
const auto it2 = node_id_handler_map_.find(frame_tree_node_id);
if (it2 != node_id_handler_map_.end())
return it2->second;
}
if (render_process_id >= 0 && !require_frame_match) {
// Choose an arbitrary handler for the same process.
for (auto& kv : render_id_handler_map_) {
if (kv.first.first == render_process_id)
return kv.second;
}
}
return nullptr;
}
void CefResourceContext::AddPluginLoadDecision(
int render_process_id,
const base::FilePath& plugin_path,
bool is_main_frame,
const url::Origin& main_frame_origin,
chrome::mojom::PluginStatus status) {
CEF_REQUIRE_IOT();
DCHECK_GE(render_process_id, 0);
DCHECK(!plugin_path.empty());
plugin_load_decision_map_.insert(std::make_pair(
std::make_pair(std::make_pair(render_process_id, plugin_path),
std::make_pair(is_main_frame, main_frame_origin)),
status));
}
bool CefResourceContext::HasPluginLoadDecision(
int render_process_id,
const base::FilePath& plugin_path,
bool is_main_frame,
const url::Origin& main_frame_origin,
chrome::mojom::PluginStatus* status) const {
CEF_REQUIRE_IOT();
DCHECK_GE(render_process_id, 0);
DCHECK(!plugin_path.empty());
PluginLoadDecisionMap::const_iterator it = plugin_load_decision_map_.find(
std::make_pair(std::make_pair(render_process_id, plugin_path),
std::make_pair(is_main_frame, main_frame_origin)));
if (it == plugin_load_decision_map_.end())
return false;
*status = it->second;
return true;
}
void CefResourceContext::ClearPluginLoadDecision(int render_process_id) {
CEF_REQUIRE_IOT();
if (render_process_id == -1) {
plugin_load_decision_map_.clear();
} else {
PluginLoadDecisionMap::iterator it = plugin_load_decision_map_.begin();
while (it != plugin_load_decision_map_.end()) {
if (it->first.first.first == render_process_id)
it = plugin_load_decision_map_.erase(it);
else
++it;
}
}
return handler_map_.GetHandler(render_process_id, render_frame_id,
frame_tree_node_id, require_frame_match);
}
void CefResourceContext::RegisterSchemeHandlerFactory(

View File

@ -10,12 +10,12 @@
#include "include/cef_request_context_handler.h"
#include "include/cef_scheme.h"
#include "base/files/file_path.h"
#include "chrome/common/plugin.mojom.h"
#include "libcef/browser/request_context_handler_map.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 GURL;
// Acts as a bridge for resource loading. Life span is controlled by
// CefBrowserContext. Created on the UI thread but accessed and destroyed on the
@ -30,12 +30,7 @@ class CefResourceContext : public content::ResourceContext {
std::unique_ptr<net::ClientCertStore> CreateClientCertStore();
void set_extensions_info_map(extensions::InfoMap* extensions_info_map);
// Keep track of handlers associated with specific frames. This information
// originates from frame create/delete notifications in CefBrowserHostImpl or
// CefMimeHandlerViewGuestDelegate which are forwarded via
// CefRequestContextImpl and CefBrowserContext.
// See comments in CefRequestContextHandlerMap.
void AddHandler(int render_process_id,
int render_frame_id,
int frame_tree_node_id,
@ -43,33 +38,11 @@ class CefResourceContext : public content::ResourceContext {
void RemoveHandler(int render_process_id,
int render_frame_id,
int frame_tree_node_id);
// Returns the handler that matches the specified IDs. Pass -1 for unknown
// values. If |require_frame_match| is true only exact matches will be
// returned. If |require_frame_match| is false, and there is not an exact
// match, then the first handler for the same |render_process_id| will be
// returned.
CefRefPtr<CefRequestContextHandler> GetHandler(int render_process_id,
CefRefPtr<CefRequestContextHandler> GetHandler(
int render_process_id,
int render_frame_id,
int frame_tree_node_id,
bool require_frame_match);
// Remember the plugin load decision for plugin status requests that arrive
// via CefPluginServiceFilter::IsPluginAvailable.
void AddPluginLoadDecision(int render_process_id,
const base::FilePath& plugin_path,
bool is_main_frame,
const url::Origin& main_frame_origin,
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,
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.
void ClearPluginLoadDecision(int render_process_id);
bool require_frame_match) const;
// Manage scheme handler factories associated with this context.
void RegisterSchemeHandlerFactory(const std::string& scheme_name,
@ -80,36 +53,15 @@ class CefResourceContext : public content::ResourceContext {
// State transferred from the BrowserContext for use on the IO thread.
bool IsOffTheRecord() const { return is_off_the_record_; }
const extensions::InfoMap* GetExtensionInfoMap() const {
return extension_info_map_.get();
}
private:
void InitOnIOThread();
// Only accessed on the IO thread.
bool is_off_the_record_;
scoped_refptr<extensions::InfoMap> extension_info_map_;
const bool is_off_the_record_;
// Map of (render_process_id, render_frame_id) to handler.
typedef std::map<std::pair<int, int>, CefRefPtr<CefRequestContextHandler>>
RenderIdHandlerMap;
RenderIdHandlerMap render_id_handler_map_;
// Map of frame_tree_node_id to handler. Keeping this map is necessary
// because, when navigating the main frame, a new (pre-commit) network request
// will be created before the RenderFrameHost. Consequently we can't rely
// on valid render IDs. See https://crbug.com/776884 for background.
typedef std::map<int, CefRefPtr<CefRequestContextHandler>> NodeIdHandlerMap;
NodeIdHandlerMap node_id_handler_map_;
// Map (render_process_id, plugin_path, is_main_frame, main_frame_origin) to
// plugin load decision.
typedef std::map<
std::pair<std::pair<int, base::FilePath>, std::pair<bool, url::Origin>>,
chrome::mojom::PluginStatus>
PluginLoadDecisionMap;
PluginLoadDecisionMap plugin_load_decision_map_;
// Map IDs to CefRequestContextHandler objects.
CefRequestContextHandlerMap handler_map_;
// Map (scheme, domain) to factories.
typedef std::map<std::pair<std::string, std::string>,

View File

@ -521,7 +521,7 @@ void CefServerImpl::StartOnUIThread(const std::string& address,
std::unique_ptr<base::Thread> thread(
new base::Thread(base::StringPrintf("%s:%d", address.c_str(), port)));
base::Thread::Options options;
options.message_loop_type = base::MessageLoop::TYPE_IO;
options.message_pump_type = base::MessagePumpType::IO;
if (thread->StartWithOptions(options)) {
// Add a reference that will be released in ShutdownOnUIThread().
AddRef();

View File

@ -76,7 +76,7 @@ void CefSpeechRecognitionManagerDelegate::CheckRecognitionIsAllowed(
// Make sure that initiators properly set the |render_process_id| field.
DCHECK_NE(context.render_process_id, 0);
base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO},
base::PostTask(FROM_HERE, {content::BrowserThread::IO},
base::BindOnce(std::move(callback), false, true));
}

View File

@ -82,8 +82,7 @@ void CefSSLHostStateDelegate::Clear(
SSLHostStateDelegate::CertJudgment CefSSLHostStateDelegate::QueryPolicy(
const std::string& host,
const net::X509Certificate& cert,
int error,
bool* expired_previous_decision) {
int error) {
return cert_policy_for_host_[host].Check(cert, error)
? SSLHostStateDelegate::ALLOWED
: SSLHostStateDelegate::DENIED;

View File

@ -55,8 +55,7 @@ class CefSSLHostStateDelegate : public content::SSLHostStateDelegate {
content::SSLHostStateDelegate::CertJudgment QueryPolicy(
const std::string& host,
const net::X509Certificate& cert,
int error,
bool* expired_previous_decision) override;
int error) override;
void HostRanInsecureContent(const std::string& host,
int child_id,
InsecureContentType content_type) override;

View File

@ -26,7 +26,3 @@ CefRefPtr<CefX509Certificate> CefSSLInfoImpl::GetX509Certificate() {
bool CefIsCertStatusError(cef_cert_status_t status) {
return net::IsCertStatusError(status);
}
bool CefIsCertStatusMinorError(cef_cert_status_t status) {
return net::IsCertStatusMinorError(status);
}

View File

@ -41,9 +41,9 @@
#define CEF_REQUIRE_UIT_RETURN_VOID() CEF_REQUIRE_RETURN_VOID(CEF_UIT)
#define CEF_REQUIRE_IOT_RETURN_VOID() CEF_REQUIRE_RETURN_VOID(CEF_IOT)
#define CEF_POST_TASK(id, task) base::PostTaskWithTraits(FROM_HERE, {id}, task)
#define CEF_POST_TASK(id, task) base::PostTask(FROM_HERE, {id}, task)
#define CEF_POST_DELAYED_TASK(id, task, delay_ms) \
base::PostDelayedTaskWithTraits(FROM_HERE, {id}, task, \
base::PostDelayedTask(FROM_HERE, {id}, task, \
base::TimeDelta::FromMilliseconds(delay_ms))
// Post a blocking task with the specified |priority|. Tasks that have not
@ -51,15 +51,15 @@
// already begun executing when shutdown is invoked will be allowed to continue
// and will block shutdown until completion.
// Tasks posted with this method are not guaranteed to run sequentially. Use
// base::CreateSequencedTaskRunnerWithTraits instead if sequence is important.
// base::CreateSequencedTaskRunner instead if sequence is important.
// Sequenced runners at various priorities that always execute all pending tasks
// before shutdown are available via CefContentBrowserClient::*_task_runner()
// and exposed by the CEF API.
#define CEF_POST_BLOCKING_TASK(priority, task) \
base::PostTaskWithTraits( \
base::PostTask( \
FROM_HERE, \
{priority, base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN, \
base::MayBlock()}, \
{base::ThreadPool(), priority, \
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN, base::MayBlock()}, \
task)
// Post a blocking task that affects UI or responsiveness of future user

View File

@ -39,12 +39,12 @@ void CefTextfieldImpl::SetReadOnly(bool read_only) {
bool CefTextfieldImpl::IsReadOnly() {
CEF_REQUIRE_VALID_RETURN(false);
return root_view()->read_only();
return root_view()->GetReadOnly();
}
CefString CefTextfieldImpl::GetText() {
CEF_REQUIRE_VALID_RETURN(CefString());
return root_view()->text();
return root_view()->GetText();
}
void CefTextfieldImpl::SetText(const CefString& text) {
@ -90,7 +90,7 @@ CefRange CefTextfieldImpl::GetSelectedRange() {
void CefTextfieldImpl::SelectRange(const CefRange& range) {
CEF_REQUIRE_VALID_RETURN_VOID();
root_view()->SelectRange(gfx::Range(range.from, range.to));
root_view()->SetSelectedRange(gfx::Range(range.from, range.to));
}
size_t CefTextfieldImpl::GetCursorPosition() {
@ -172,7 +172,7 @@ void CefTextfieldImpl::ClearEditHistory() {
void CefTextfieldImpl::SetPlaceholderText(const CefString& text) {
CEF_REQUIRE_VALID_RETURN_VOID();
root_view()->set_placeholder_text(text);
root_view()->SetPlaceholderText(text);
}
CefString CefTextfieldImpl::GetPlaceholderText() {

View File

@ -283,7 +283,7 @@ void CefWindowView::CreateWidget() {
}
#endif
widget->Init(params);
widget->Init(std::move(params));
// |widget| should now be associated with |this|.
DCHECK_EQ(widget, GetWidget());
@ -519,8 +519,9 @@ void CefWindowView::SetDraggableRegions(
draggable_region_.reset(new SkRegion);
for (const CefDraggableRegion& region : regions) {
draggable_region_->op(
region.bounds.x, region.bounds.y, region.bounds.x + region.bounds.width,
region.bounds.y + region.bounds.height,
{region.bounds.x, region.bounds.y,
region.bounds.x + region.bounds.width,
region.bounds.y + region.bounds.height},
region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op);
}
}

View File

@ -279,10 +279,6 @@ base::RefCountedMemory* CefContentClient::GetDataResourceBytes(
return value;
}
bool CefContentClient::IsDataResourceGzipped(int resource_id) {
return ui::ResourceBundle::GetSharedInstance().IsGzipped(resource_id);
}
gfx::Image& CefContentClient::GetNativeImageNamed(int resource_id) {
gfx::Image& value =
ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id);

View File

@ -42,7 +42,6 @@ class CefContentClient : public content::ContentClient {
base::StringPiece GetDataResource(int resource_id,
ui::ScaleFactor scale_factor) override;
base::RefCountedMemory* GetDataResourceBytes(int resource_id) override;
bool IsDataResourceGzipped(int resource_id) override;
gfx::Image& GetNativeImageNamed(int resource_id) override;
// Values are registered with all processes (url/url_util.h) and with Blink

View File

@ -16,7 +16,6 @@
#include "libcef/common/crash_reporting.h"
#include "libcef/common/extensions/extensions_util.h"
#include "libcef/renderer/content_renderer_client.h"
#include "libcef/utility/content_utility_client.h"
#include "base/at_exit.h"
#include "base/base_switches.h"
@ -35,6 +34,7 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_paths_internal.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/utility/chrome_content_utility_client.h"
#include "components/content_settings/core/common/content_settings_pattern.h"
#include "components/viz/common/features.h"
#include "content/browser/browser_process_sub_thread.h"
@ -321,7 +321,7 @@ class CefUIThread : public base::PlatformThread::Delegate {
if (!stopping_) {
stopping_ = true;
base::PostTaskWithTraits(
base::PostTask(
FROM_HERE, {content::BrowserThread::UI},
base::BindOnce(&CefUIThread::ThreadQuitHelper, Unretained(this)));
}
@ -628,7 +628,7 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
const base::FilePath& log_file =
command_line->GetSwitchValuePath(switches::kLogFile);
DCHECK(!log_file.empty());
log_settings.log_file = log_file.value().c_str();
log_settings.log_file_path = log_file.value().c_str();
log_settings.lock_log = logging::DONT_LOCK_LOG_FILE;
log_settings.delete_old = logging::APPEND_TO_OLD_LOG_FILE;
@ -802,7 +802,7 @@ content::ContentRendererClient* CefMainDelegate::CreateContentRendererClient() {
}
content::ContentUtilityClient* CefMainDelegate::CreateContentUtilityClient() {
utility_client_.reset(new CefContentUtilityClient);
utility_client_.reset(new ChromeContentUtilityClient);
return utility_client_.get();
}

View File

@ -26,8 +26,8 @@ class BrowserMainRunner;
class CefContentBrowserClient;
class CefContentRendererClient;
class CefContentUtilityClient;
class CefUIThread;
class ChromeContentUtilityClient;
class CefMainDelegate : public content::ContentMainDelegate {
public:
@ -65,7 +65,7 @@ class CefMainDelegate : public content::ContentMainDelegate {
std::unique_ptr<CefContentBrowserClient> browser_client_;
std::unique_ptr<CefContentRendererClient> renderer_client_;
std::unique_ptr<CefContentUtilityClient> utility_client_;
std::unique_ptr<ChromeContentUtilityClient> utility_client_;
CefContentClient content_client_;
DISALLOW_COPY_AND_ASSIGN(CefMainDelegate);

View File

@ -74,8 +74,8 @@ class BytesElementReader : public net::UploadBytesElementReader {
};
scoped_refptr<base::SequencedTaskRunner> GetFileTaskRunner() {
return base::CreateSequencedTaskRunnerWithTraits(
{base::MayBlock(), base::TaskPriority::USER_VISIBLE});
return base::CreateSequencedTaskRunner(
{base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE});
}
// A subclass of net::UploadFileElementReader that keeps the associated

View File

@ -1,63 +0,0 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/common/service_manifests/builtin_service_manifests.h"
#include "base/no_destructor.h"
#include "build/build_config.h"
#include "chrome/common/buildflags.h"
#include "chrome/common/constants.mojom.h"
#include "chrome/services/printing/public/cpp/manifest.h"
#include "components/services/pdf_compositor/public/cpp/manifest.h" // nogncheck
#include "components/spellcheck/common/spellcheck.mojom.h"
#include "components/startup_metric_utils/common/startup_metric.mojom.h"
#include "extensions/buildflags/buildflags.h"
#include "printing/buildflags/buildflags.h"
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
#include "services/service_manager/public/cpp/manifest_builder.h"
#if defined(OS_MACOSX)
#include "components/spellcheck/common/spellcheck_panel.mojom.h"
#endif
namespace {
const service_manager::Manifest& GetCefManifest() {
static base::NoDestructor<service_manager::Manifest> manifest {
service_manager::ManifestBuilder()
.WithServiceName(chrome::mojom::kServiceName)
.WithDisplayName("CEF")
.WithOptions(
service_manager::ManifestOptionsBuilder()
.WithExecutionMode(
service_manager::Manifest::ExecutionMode::kInProcessBuiltin)
.WithInstanceSharingPolicy(
service_manager::Manifest::InstanceSharingPolicy::
kSharedAcrossGroups)
.CanConnectToInstancesWithAnyId(true)
.CanRegisterOtherServiceInstances(true)
.Build())
.ExposeCapability("renderer",
service_manager::Manifest::InterfaceList<
#if defined(OS_MACOSX)
spellcheck::mojom::SpellCheckPanelHost,
#endif
spellcheck::mojom::SpellCheckHost,
startup_metric_utils::mojom::StartupMetricHost>())
.RequireCapability(chrome::mojom::kRendererServiceName, "browser")
.Build()
};
return *manifest;
}
} // namespace
const std::vector<service_manager::Manifest>& GetBuiltinServiceManifests() {
static base::NoDestructor<std::vector<service_manager::Manifest>> manifests{{
GetCefManifest(),
printing::GetPdfCompositorManifest(),
GetChromePrintingManifest(),
}};
return *manifests;
}

View File

@ -1,17 +0,0 @@
// Copyright 2018 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_COMMON_SERVICE_MANIFESTS_CEF_PACKAGED_SERVICE_MANIFESTS_H_
#define CEF_LIBCEF_COMMON_SERVICE_MANIFESTS_CEF_PACKAGED_SERVICE_MANIFESTS_H_
#include <vector>
#include "services/service_manager/public/cpp/manifest.h"
// Returns manifests for all shared (i.e. cross-profile) services packaged by
// CEF but not packaged by Content. This includes both in- and out-of-process
// services.
const std::vector<service_manager::Manifest>& GetBuiltinServiceManifests();
#endif // CEF_LIBCEF_COMMON_SERVICE_MANIFESTS_CEF_PACKAGED_SERVICE_MANIFESTS_H_

View File

@ -7,8 +7,7 @@
#include "base/command_line.h"
#include "base/no_destructor.h"
#include "build/build_config.h"
#include "components/metrics/public/interfaces/call_stack_profile_collector.mojom.h"
#include "components/services/heap_profiling/public/mojom/heap_profiling_client.mojom.h"
#include "components/metrics/public/mojom/call_stack_profile_collector.mojom.h"
#include "extensions/buildflags/buildflags.h"
#include "extensions/common/api/mime_handler.mojom.h" // nogncheck
#include "extensions/common/mojom/keep_alive.mojom.h" // nogncheck
@ -24,9 +23,6 @@ const service_manager::Manifest& GetCefContentBrowserOverlayManifest() {
.ExposeCapability("gpu",
service_manager::Manifest::InterfaceList<
metrics::mojom::CallStackProfileCollector>())
.ExposeCapability("profiling_client",
service_manager::Manifest::InterfaceList<
heap_profiling::mojom::ProfilingClient>())
.ExposeCapability("renderer",
service_manager::Manifest::InterfaceList<
#if defined(OS_WIN)
@ -34,10 +30,6 @@ const service_manager::Manifest& GetCefContentBrowserOverlayManifest() {
#endif
metrics::mojom::CallStackProfileCollector>())
.RequireCapability("chrome_printing", "converter")
.RequireCapability("heap_profiling", "heap_profiler")
.RequireCapability("heap_profiling", "profiling")
.RequireCapability("pdf_compositor", "compositor")
.RequireCapability("proxy_resolver", "factory")
.ExposeInterfaceFilterCapability_Deprecated(
"navigation:frame", "renderer",
service_manager::Manifest::InterfaceList<

View File

@ -1,20 +0,0 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/common/service_manifests/cef_content_gpu_overlay_manifest.h"
#include "base/no_destructor.h"
#include "build/build_config.h"
#include "components/services/heap_profiling/public/mojom/heap_profiling_client.mojom.h"
#include "services/service_manager/public/cpp/manifest_builder.h"
const service_manager::Manifest& GetCefContentGpuOverlayManifest() {
static base::NoDestructor<service_manager::Manifest> manifest{
service_manager::ManifestBuilder()
.ExposeCapability("browser",
service_manager::Manifest::InterfaceList<
heap_profiling::mojom::ProfilingClient>())
.Build()};
return *manifest;
}

View File

@ -1,15 +0,0 @@
// Copyright 2018 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_COMMON_SERVICE_MANIFESTS_CEF_CONTENT_GPU_OVERLAY_MANIFEST_H_
#define CEF_LIBCEF_COMMON_SERVICE_MANIFESTS_CEF_CONTENT_GPU_OVERLAY_MANIFEST_H_
#include "services/service_manager/public/cpp/manifest.h"
// Returns the Manifest CEF amends to Contents's content_gpu service
// manifest. This allows CEF to extend the capabilities exposed and/or
// required by content_gpu service instances
const service_manager::Manifest& GetCefContentGpuOverlayManifest();
#endif // CEF_LIBCEF_COMMON_SERVICE_MANIFESTS_CEF_CONTENT_GPU_OVERLAY_MANIFEST_H_

View File

@ -6,7 +6,6 @@
#include "base/no_destructor.h"
#include "build/build_config.h"
#include "components/services/heap_profiling/public/mojom/heap_profiling_client.mojom.h"
#include "components/subresource_filter/content/mojom/subresource_filter_agent.mojom.h"
#include "extensions/buildflags/buildflags.h"
#include "services/service_manager/public/cpp/manifest_builder.h"
@ -18,9 +17,6 @@
const service_manager::Manifest& GetCefContentRendererOverlayManifest() {
static base::NoDestructor<service_manager::Manifest> manifest {
service_manager::ManifestBuilder()
.ExposeCapability("browser",
service_manager::Manifest::InterfaceList<
heap_profiling::mojom::ProfilingClient>())
#if defined(OS_MACOSX)
.ExposeInterfaceFilterCapability_Deprecated(
"navigation:frame", "browser",

View File

@ -1,19 +0,0 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/common/service_manifests/cef_content_utility_overlay_manifest.h"
#include "base/no_destructor.h"
#include "components/services/heap_profiling/public/mojom/heap_profiling_client.mojom.h"
#include "services/service_manager/public/cpp/manifest_builder.h"
const service_manager::Manifest& GetCefContentUtilityOverlayManifest() {
static base::NoDestructor<service_manager::Manifest> manifest{
service_manager::ManifestBuilder()
.ExposeCapability("browser",
service_manager::Manifest::InterfaceList<
heap_profiling::mojom::ProfilingClient>())
.Build()};
return *manifest;
}

View File

@ -1,15 +0,0 @@
// Copyright 2018 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_COMMON_SERVICE_MANIFESTS_CEF_CONTENT_UTILITY_OVERLAY_MANIFEST_H_
#define CEF_LIBCEF_COMMON_SERVICE_MANIFESTS_CEF_CONTENT_UTILITY_OVERLAY_MANIFEST_H_
#include "services/service_manager/public/cpp/manifest.h"
// Returns the Manifest CEF amends to Contents's content_utility service
// manifest. This allows CEF to extend the capabilities exposed and/or
// required by content_utility service instances
const service_manager::Manifest& GetCefContentUtilityOverlayManifest();
#endif // CEF_LIBCEF_COMMON_SERVICE_MANIFESTS_CEF_CONTENT_UTILITY_OVERLAY_MANIFEST_H_

View File

@ -1,21 +0,0 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/common/service_manifests/cef_renderer_manifest.h"
#include "base/no_destructor.h"
#include "chrome/common/constants.mojom.h"
#include "components/spellcheck/common/spellcheck.mojom.h"
#include "services/service_manager/public/cpp/manifest_builder.h"
const service_manager::Manifest& GetCefRendererManifest() {
static base::NoDestructor<service_manager::Manifest> manifest{
service_manager::ManifestBuilder()
.WithServiceName(chrome::mojom::kRendererServiceName)
.ExposeCapability("browser", service_manager::Manifest::InterfaceList<
spellcheck::mojom::SpellChecker>())
.RequireCapability(chrome::mojom::kServiceName, "renderer")
.Build()};
return *manifest;
}

View File

@ -1,16 +0,0 @@
// Copyright 2018 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_COMMON_SERVICE_MANIFESTS_CEF_RENDERER_MANIFEST_H_
#define CEF_LIBCEF_COMMON_SERVICE_MANIFESTS_CEF_RENDERER_MANIFEST_H_
#include "services/service_manager/public/cpp/manifest.h"
// Returns the Manifest for the cef_renderer service. CEF registers an
// instance of this service for each renderer process started by Content, and
// that instance lives in the corresponding renderer process alongside the
// content_renderer instance.
const service_manager::Manifest& GetCefRendererManifest();
#endif // CEF_LIBCEF_COMMON_SERVICE_MANIFESTS_CEF_RENDERER_MANIFEST_H_

View File

@ -88,7 +88,7 @@ scoped_refptr<base::SingleThreadTaskRunner> CefTaskRunnerImpl::GetTaskRunner(
BrowserThread::IsThreadInitialized(static_cast<BrowserThread::ID>(id))) {
// Specify USER_BLOCKING so that BrowserTaskExecutor::GetTaskRunner always
// gives us the same TaskRunner object.
return base::CreateSingleThreadTaskRunnerWithTraits(
return base::CreateSingleThreadTaskRunner(
{static_cast<BrowserThread::ID>(id),
base::TaskPriority::USER_BLOCKING});
}
@ -108,7 +108,7 @@ CefTaskRunnerImpl::GetCurrentTaskRunner() {
BrowserThread::IsThreadInitialized(current_id)) {
// Specify USER_BLOCKING so that BrowserTaskExecutor::GetTaskRunner always
// gives us the same TaskRunner object.
task_runner = base::CreateSingleThreadTaskRunnerWithTraits(
task_runner = base::CreateSingleThreadTaskRunner(
{current_id, base::TaskPriority::USER_BLOCKING});
}

View File

@ -86,10 +86,10 @@ bool CefThreadImpl::Create(const CefString& display_name,
switch (message_loop_type) {
case ML_TYPE_UI:
options.message_loop_type = base::MessageLoop::TYPE_UI;
options.message_pump_type = base::MessagePumpType::UI;
break;
case ML_TYPE_IO:
options.message_loop_type = base::MessageLoop::TYPE_IO;
options.message_pump_type = base::MessagePumpType::IO;
break;
default:
break;
@ -100,7 +100,7 @@ bool CefThreadImpl::Create(const CefString& display_name,
#if defined(OS_WIN)
if (com_init_mode != COM_INIT_MODE_NONE) {
if (com_init_mode == COM_INIT_MODE_STA)
options.message_loop_type = base::MessageLoop::TYPE_UI;
options.message_pump_type = base::MessagePumpType::UI;
thread_->init_com_with_mta(com_init_mode == COM_INIT_MODE_MTA);
}
#endif

View File

@ -61,7 +61,7 @@ void GoBack(blink::WebView* view) {
blink::WebViewImpl* view_impl = reinterpret_cast<blink::WebViewImpl*>(view);
if (view_impl->Client()->HistoryBackListCount() > 0) {
main_frame->ToWebLocalFrame()->Client()->NavigateBackForwardSoon(
-1, true /* has_user_gesture */);
-1, true /* has_user_gesture */, false /* from_script */);
}
}
}
@ -75,7 +75,7 @@ void GoForward(blink::WebView* view) {
blink::WebViewImpl* view_impl = reinterpret_cast<blink::WebViewImpl*>(view);
if (view_impl->Client()->HistoryForwardListCount() > 0) {
main_frame->ToWebLocalFrame()->Client()->NavigateBackForwardSoon(
1, true /* has_user_gesture */);
1, true /* has_user_gesture */, false /* from_script */);
}
}
}

View File

@ -51,7 +51,6 @@
#include "base/task/post_task.h"
#include "build/build_config.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/constants.mojom.h"
#include "chrome/common/url_constants.h"
#include "chrome/renderer/chrome_content_renderer_client.h"
#include "chrome/renderer/extensions/chrome_extensions_renderer_client.h"
@ -85,6 +84,7 @@
#include "extensions/renderer/renderer_extension_registry.h"
#include "ipc/ipc_sync_channel.h"
#include "media/base/media.h"
#include "mojo/public/cpp/bindings/generic_pending_receiver.h"
#include "printing/print_settings.h"
#include "services/network/public/cpp/is_potentially_trustworthy.h"
#include "services/service_manager/public/cpp/connector.h"
@ -346,7 +346,7 @@ void CefContentRendererClient::RunSingleProcessCleanup() {
if (content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) {
RunSingleProcessCleanupOnUIThread();
} else {
base::PostTaskWithTraits(
base::PostTask(
FROM_HERE, {content::BrowserThread::UI},
base::Bind(&CefContentRendererClient::RunSingleProcessCleanupOnUIThread,
base::Unretained(this)));
@ -382,9 +382,9 @@ void CefContentRendererClient::RenderThreadStarted() {
: blink::scheduler::WebRendererProcessType::kRenderer);
{
startup_metric_utils::mojom::StartupMetricHostPtr startup_metric_host;
GetConnector()->BindInterface(chrome::mojom::kServiceName,
&startup_metric_host);
mojo::Remote<startup_metric_utils::mojom::StartupMetricHost>
startup_metric_host;
thread->BindHostReceiver(startup_metric_host.BindNewPipeAndPassReceiver());
startup_metric_host->RecordRendererMainEntryTime(main_entry_time_);
}
@ -678,31 +678,31 @@ void CefContentRendererClient::DevToolsAgentDetached() {
}
}
void CefContentRendererClient::CreateRendererService(
service_manager::mojom::ServiceRequest service_request) {
DCHECK(!service_binding_.is_bound());
service_binding_.Bind(std::move(service_request));
}
std::unique_ptr<content::URLLoaderThrottleProvider>
CefContentRendererClient::CreateURLLoaderThrottleProvider(
content::URLLoaderThrottleProviderType provider_type) {
return std::make_unique<CefURLLoaderThrottleProviderImpl>(provider_type);
}
void CefContentRendererClient::OnBindInterface(
const service_manager::BindSourceInfo& remote_info,
const std::string& name,
mojo::ScopedMessagePipeHandle handle) {
registry_.TryBindInterface(name, &handle);
void CefContentRendererClient::BindReceiverOnMainThread(
mojo::GenericPendingReceiver receiver) {
// TODO(crbug.com/977637): Get rid of the use of BinderRegistry here. This is
// only used to bind a spellcheck interface.
std::string interface_name = *receiver.interface_name();
auto pipe = receiver.PassPipe();
registry_.TryBindInterface(interface_name, &pipe);
}
void CefContentRendererClient::GetInterface(
const std::string& interface_name,
mojo::ScopedMessagePipeHandle interface_pipe) {
service_binding_.GetConnector()->BindInterface(
service_manager::ServiceFilter::ByName(chrome::mojom::kServiceName),
interface_name, std::move(interface_pipe));
// TODO(crbug.com/977637): Get rid of the use of this implementation of
// |service_manager::LocalInterfaceProvider|. This was done only to avoid
// churning spellcheck code while eliminating the "chrome" and
// "chrome_renderer" services. Spellcheck is (and should remain) the only
// consumer of this implementation.
content::RenderThread::Get()->BindHostReceiver(
mojo::GenericPendingReceiver(interface_name, std::move(interface_pipe)));
}
void CefContentRendererClient::WillDestroyCurrentMessageLoop() {
@ -808,10 +808,6 @@ void CefContentRendererClient::RunSingleProcessCleanupOnUIThread() {
delete host;
}
service_manager::Connector* CefContentRendererClient::GetConnector() {
return service_binding_.GetConnector();
}
// Enable deprecation warnings on Windows. See http://crbug.com/585142.
#if defined(OS_WIN)
#if defined(__clang__)

View File

@ -16,16 +16,14 @@
#include "libcef/renderer/browser_impl.h"
#include "base/compiler_specific.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_current.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 "mojo/public/cpp/bindings/generic_pending_receiver.h"
#include "services/service_manager/public/cpp/binder_registry.h"
#include "services/service_manager/public/cpp/connector.h"
#include "services/service_manager/public/cpp/local_interface_provider.h"
#include "services/service_manager/public/cpp/service.h"
#include "services/service_manager/public/cpp/service_binding.h"
namespace blink {
class WebURLLoaderFactory;
@ -53,7 +51,6 @@ class SpellCheck;
class CefContentRendererClient
: public content::ContentRendererClient,
public service_manager::Service,
public service_manager::LocalInterfaceProvider,
public base::MessageLoopCurrent::DestructionObserver {
public:
@ -140,16 +137,10 @@ class CefContentRendererClient
void RunScriptsAtDocumentIdle(content::RenderFrame* render_frame) override;
void DevToolsAgentAttached() override;
void DevToolsAgentDetached() override;
void CreateRendererService(
service_manager::mojom::ServiceRequest service_request) override;
std::unique_ptr<content::URLLoaderThrottleProvider>
CreateURLLoaderThrottleProvider(
content::URLLoaderThrottleProviderType provider_type) override;
// service_manager::Service implementation.
void OnBindInterface(const service_manager::BindSourceInfo& remote_info,
const std::string& name,
mojo::ScopedMessagePipeHandle handle) override;
void BindReceiverOnMainThread(mojo::GenericPendingReceiver receiver) override;
// service_manager::LocalInterfaceProvider implementation.
void GetInterface(const std::string& name,
@ -168,8 +159,6 @@ class CefContentRendererClient
// Perform cleanup work for single-process mode.
void RunSingleProcessCleanupOnUIThread();
service_manager::Connector* GetConnector();
// Time at which this object was created. This is very close to the time at
// which the RendererMain function was entered.
base::TimeTicks main_entry_time_;
@ -208,7 +197,6 @@ class CefContentRendererClient
bool single_process_cleanup_complete_;
base::Lock single_process_cleanup_lock_;
service_manager::ServiceBinding service_binding_{this};
service_manager::BinderRegistry registry_;
DISALLOW_COPY_AND_ASSIGN(CefContentRendererClient);

View File

@ -55,10 +55,9 @@ bool CefRenderMessageFilter::Send(IPC::Message* message) {
}
if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
base::PostTaskWithTraits(
FROM_HERE, {content::BrowserThread::IO},
base::Bind(base::IgnoreResult(&CefRenderMessageFilter::Send), this,
message));
base::PostTask(FROM_HERE, {content::BrowserThread::IO},
base::Bind(base::IgnoreResult(&CefRenderMessageFilter::Send),
this, message));
return true;
}

View File

@ -44,13 +44,11 @@ class CefWebURLLoaderClient : public blink::WebURLLoaderClient {
uint64_t total_bytes_to_be_sent) override;
void DidReceiveResponse(const WebURLResponse& response) override;
void DidReceiveData(const char* data, int dataLength) override;
void DidFinishLoading(
base::TimeTicks finish_time,
void DidFinishLoading(base::TimeTicks finish_time,
int64_t total_encoded_data_length,
int64_t total_encoded_body_length,
int64_t total_decoded_body_length,
bool should_report_corb_blocking,
const blink::WebVector<network::cors::PreflightTimingInfo>&) override;
bool should_report_corb_blocking) override;
void DidFail(const WebURLError&,
int64_t total_encoded_data_length,
int64_t total_encoded_body_length,
@ -374,13 +372,11 @@ void CefWebURLLoaderClient::DidReceiveData(const char* data, int dataLength) {
context_->OnDownloadData(data, dataLength);
}
void CefWebURLLoaderClient::DidFinishLoading(
base::TimeTicks finish_time,
void CefWebURLLoaderClient::DidFinishLoading(base::TimeTicks finish_time,
int64_t total_encoded_data_length,
int64_t total_encoded_body_length,
int64_t total_decoded_body_length,
bool should_report_corb_blocking,
const blink::WebVector<network::cors::PreflightTimingInfo>&) {
bool should_report_corb_blocking) {
context_->OnComplete();
}

View File

@ -37,14 +37,14 @@ CefURLLoaderThrottleProviderImpl::Clone() {
return base::WrapUnique(new CefURLLoaderThrottleProviderImpl(*this));
}
std::vector<std::unique_ptr<content::URLLoaderThrottle>>
std::vector<std::unique_ptr<blink::URLLoaderThrottle>>
CefURLLoaderThrottleProviderImpl::CreateThrottles(
int render_frame_id,
const blink::WebURLRequest& request,
content::ResourceType resource_type) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
std::vector<std::unique_ptr<content::URLLoaderThrottle>> throttles;
std::vector<std::unique_ptr<blink::URLLoaderThrottle>> throttles;
// Some throttles have already been added in the browser for frame resources.
// Don't add them for frame requests.

View File

@ -23,7 +23,7 @@ class CefURLLoaderThrottleProviderImpl
// content::URLLoaderThrottleProvider implementation.
std::unique_ptr<content::URLLoaderThrottleProvider> Clone() override;
std::vector<std::unique_ptr<content::URLLoaderThrottle>> CreateThrottles(
std::vector<std::unique_ptr<blink::URLLoaderThrottle>> CreateThrottles(
int render_frame_id,
const blink::WebURLRequest& request,
content::ResourceType resource_type) override;

View File

@ -340,7 +340,7 @@ class V8TrackArrayBuffer : public CefTrackNode {
return release_callback_;
}
void Neuter() { buffer_ = nullptr; }
void Detach() { buffer_ = nullptr; }
// Attach this track object to the specified V8 object.
void AttachTo(v8::Local<v8::Context> context,
@ -2283,12 +2283,12 @@ bool CefV8ValueImpl::NeuterArrayBuffer() {
}
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
v8::Local<v8::ArrayBuffer> arr = v8::Local<v8::ArrayBuffer>::Cast(obj);
if (!arr->IsNeuterable()) {
if (!arr->IsDetachable()) {
return false;
}
arr->Neuter();
arr->Detach();
V8TrackArrayBuffer* tracker = V8TrackArrayBuffer::Unwrap(context, obj);
tracker->Neuter();
tracker->Detach();
return true;
}

View File

@ -1,105 +0,0 @@
// Copyright (c) 2014 the Chromium Embedded Framework authors.
// Portions 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/utility/content_utility_client.h"
#include <utility>
#include "build/build_config.h"
#include "chrome/services/printing/printing_service.h"
#include "chrome/services/printing/public/mojom/constants.mojom.h"
#include "components/services/pdf_compositor/public/cpp/pdf_compositor_service_factory.h"
#include "components/services/pdf_compositor/public/mojom/pdf_compositor.mojom.h"
#include "content/public/child/child_thread.h"
#include "content/public/common/service_manager_connection.h"
#include "content/public/common/simple_connection_filter.h"
#include "content/public/utility/utility_thread.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "services/network/url_request_context_builder_mojo.h"
#include "services/proxy_resolver/proxy_resolver_factory_impl.h" // nogncheck
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
#include "services/service_manager/public/cpp/binder_registry.h"
#if defined(OS_WIN)
#include "chrome/utility/printing_handler.h"
#endif
namespace {
void RunServiceAsyncThenTerminateProcess(
std::unique_ptr<service_manager::Service> service) {
service_manager::Service::RunAsyncUntilTermination(
std::move(service),
base::BindOnce([] { content::UtilityThread::Get()->ReleaseProcess(); }));
}
} // namespace
CefContentUtilityClient::CefContentUtilityClient() {
#if defined(OS_WIN)
printing_handler_ = std::make_unique<printing::PrintingHandler>();
#endif
}
CefContentUtilityClient::~CefContentUtilityClient() {}
void CefContentUtilityClient::UtilityThreadStarted() {
content::ServiceManagerConnection* connection =
content::ChildThread::Get()->GetServiceManagerConnection();
// NOTE: Some utility process instances are not connected to the Service
// Manager. Nothing left to do in that case.
if (!connection)
return;
auto registry = std::make_unique<service_manager::BinderRegistry>();
connection->AddConnectionFilter(
std::make_unique<content::SimpleConnectionFilter>(std::move(registry)));
}
bool CefContentUtilityClient::OnMessageReceived(const IPC::Message& message) {
bool handled = false;
#if defined(OS_WIN)
if (printing_handler_->OnMessageReceived(message))
return true;
#endif
return handled;
}
void CefContentUtilityClient::RunIOThreadService(
mojo::GenericPendingReceiver* receiver) {
if (auto factory_receiver =
receiver->As<proxy_resolver::mojom::ProxyResolverFactory>()) {
static base::NoDestructor<proxy_resolver::ProxyResolverFactoryImpl> factory(
std::move(factory_receiver));
return;
}
}
std::unique_ptr<service_manager::Service>
CefContentUtilityClient::MaybeCreateMainThreadService(
const std::string& service_name,
service_manager::mojom::ServiceRequest request) {
if (service_name == printing::mojom::kServiceName) {
return printing::CreatePdfCompositorService(std::move(request));
}
if (service_name == printing::mojom::kChromePrintingServiceName) {
return std::make_unique<printing::PrintingService>(std::move(request));
}
return nullptr;
}
bool CefContentUtilityClient::HandleServiceRequest(
const std::string& service_name,
service_manager::mojom::ServiceRequest request) {
auto service = MaybeCreateMainThreadService(service_name, std::move(request));
if (service) {
RunServiceAsyncThenTerminateProcess(std::move(service));
return true;
}
return false;
}

View File

@ -1,44 +0,0 @@
// Copyright (c) 2014 the Chromium Embedded Framework authors.
// Portions 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_UTILITY_CONTENT_UTILITY_CLIENT_H_
#define LIBCEF_UTILITY_CONTENT_UTILITY_CLIENT_H_
#include <memory>
#include <vector>
#include "content/public/utility/content_utility_client.h"
#if defined(OS_WIN)
namespace printing {
class PrintingHandler;
}
#endif
class CefContentUtilityClient : public content::ContentUtilityClient {
public:
CefContentUtilityClient();
~CefContentUtilityClient() override;
void UtilityThreadStarted() override;
bool OnMessageReceived(const IPC::Message& message) override;
bool HandleServiceRequest(
const std::string& service_name,
service_manager::mojom::ServiceRequest request) override;
void RunIOThreadService(mojo::GenericPendingReceiver* receiver) override;
private:
std::unique_ptr<service_manager::Service> MaybeCreateMainThreadService(
const std::string& service_name,
service_manager::mojom::ServiceRequest request);
#if defined(OS_WIN)
std::unique_ptr<printing::PrintingHandler> printing_handler_;
#endif
DISALLOW_COPY_AND_ASSIGN(CefContentUtilityClient);
};
#endif // LIBCEF_UTILITY_CONTENT_UTILITY_CLIENT_H_

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=d4f6d6a06e05d1d0d2938a2aa73c8a25885fc3ef$
// $hash=989794be6ca669465f6d0ee3c81de8c9a11c8fca$
//
#include "libcef_dll/cpptoc/print_settings_cpptoc.h"
@ -67,24 +67,6 @@ print_settings_is_read_only(struct _cef_print_settings_t* self) {
return _retval;
}
struct _cef_print_settings_t* CEF_CALLBACK
print_settings_copy(struct _cef_print_settings_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefPrintSettings> _retval =
CefPrintSettingsCppToC::Get(self)->Copy();
// Return type: refptr_same
return CefPrintSettingsCppToC::Wrap(_retval);
}
void CEF_CALLBACK
print_settings_set_orientation(struct _cef_print_settings_t* self,
int landscape) {
@ -465,7 +447,6 @@ print_settings_get_duplex_mode(struct _cef_print_settings_t* self) {
CefPrintSettingsCppToC::CefPrintSettingsCppToC() {
GetStruct()->is_valid = print_settings_is_valid;
GetStruct()->is_read_only = print_settings_is_read_only;
GetStruct()->copy = print_settings_copy;
GetStruct()->set_orientation = print_settings_set_orientation;
GetStruct()->is_landscape = print_settings_is_landscape;
GetStruct()->set_printer_printable_area =

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=a24e37a1b0fbff6c8489c8a054bba14c99907cd3$
// $hash=5d50d3e5c268b1304db14532f6f010286b85b1d1$
//
#include "libcef_dll/ctocpp/print_settings_ctocpp.h"
@ -65,23 +65,6 @@ NO_SANITIZE("cfi-icall") bool CefPrintSettingsCToCpp::IsReadOnly() {
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefPrintSettings> CefPrintSettingsCToCpp::Copy() {
shutdown_checker::AssertNotShutdown();
cef_print_settings_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, copy))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_print_settings_t* _retval = _struct->copy(_struct);
// Return type: refptr_same
return CefPrintSettingsCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall")
void CefPrintSettingsCToCpp::SetOrientation(bool landscape) {
shutdown_checker::AssertNotShutdown();

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=d031ce1331738df412c61dd9bf4c6d36f94b82a8$
// $hash=b9e902ff99086dca1a15f17daaeda2f9e32f6d89$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_PRINT_SETTINGS_CTOCPP_H_
@ -37,7 +37,6 @@ class CefPrintSettingsCToCpp
// CefPrintSettings methods.
bool IsValid() OVERRIDE;
bool IsReadOnly() OVERRIDE;
CefRefPtr<CefPrintSettings> Copy() OVERRIDE;
void SetOrientation(bool landscape) OVERRIDE;
bool IsLandscape() OVERRIDE;
void SetPrinterPrintableArea(const CefSize& physical_size_device_units,

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=d75ab7306d1e7f3633403c15b38edda291a2077e$
// $hash=1f856cdb27fed708d944b6188812799e9e27c67d$
//
#include "include/capi/cef_app_capi.h"
@ -717,16 +717,6 @@ CEF_EXPORT int cef_is_cert_status_error(cef_cert_status_t status) {
return _retval;
}
CEF_EXPORT int cef_is_cert_status_minor_error(cef_cert_status_t status) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
bool _retval = CefIsCertStatusMinorError(status);
// Return type: bool
return _retval;
}
CEF_EXPORT int cef_currently_on(cef_thread_id_t threadId) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=231f2dd6f300c93a38ef8c18e19141691b3337ac$
// $hash=33f5c103833cb9b4e6555f6a82fcaec06f3ff449$
//
#include <dlfcn.h>
@ -153,7 +153,6 @@ typedef int (*cef_register_scheme_handler_factory_ptr)(
struct _cef_scheme_handler_factory_t*);
typedef int (*cef_clear_scheme_handler_factories_ptr)();
typedef int (*cef_is_cert_status_error_ptr)(cef_cert_status_t);
typedef int (*cef_is_cert_status_minor_error_ptr)(cef_cert_status_t);
typedef int (*cef_currently_on_ptr)(cef_thread_id_t);
typedef int (*cef_post_task_ptr)(cef_thread_id_t, struct _cef_task_t*);
typedef int (*cef_post_delayed_task_ptr)(cef_thread_id_t,
@ -553,7 +552,6 @@ struct libcef_pointers {
cef_register_scheme_handler_factory_ptr cef_register_scheme_handler_factory;
cef_clear_scheme_handler_factories_ptr cef_clear_scheme_handler_factories;
cef_is_cert_status_error_ptr cef_is_cert_status_error;
cef_is_cert_status_minor_error_ptr cef_is_cert_status_minor_error;
cef_currently_on_ptr cef_currently_on;
cef_post_task_ptr cef_post_task;
cef_post_delayed_task_ptr cef_post_delayed_task;
@ -769,7 +767,6 @@ int libcef_init_pointers(const char* path) {
INIT_ENTRY(cef_register_scheme_handler_factory);
INIT_ENTRY(cef_clear_scheme_handler_factories);
INIT_ENTRY(cef_is_cert_status_error);
INIT_ENTRY(cef_is_cert_status_minor_error);
INIT_ENTRY(cef_currently_on);
INIT_ENTRY(cef_post_task);
INIT_ENTRY(cef_post_delayed_task);
@ -1089,8 +1086,8 @@ int cef_create_url(const struct _cef_urlparts_t* parts, cef_string_t* url) {
}
NO_SANITIZE("cfi-icall")
cef_string_userfree_t
cef_format_url_for_security_display(const cef_string_t* origin_url) {
cef_string_userfree_t cef_format_url_for_security_display(
const cef_string_t* origin_url) {
return g_libcef_pointers.cef_format_url_for_security_display(origin_url);
}
@ -1177,11 +1174,6 @@ int cef_is_cert_status_error(cef_cert_status_t status) {
return g_libcef_pointers.cef_is_cert_status_error(status);
}
NO_SANITIZE("cfi-icall")
int cef_is_cert_status_minor_error(cef_cert_status_t status) {
return g_libcef_pointers.cef_is_cert_status_minor_error(status);
}
NO_SANITIZE("cfi-icall") int cef_currently_on(cef_thread_id_t threadId) {
return g_libcef_pointers.cef_currently_on(threadId);
}
@ -1569,25 +1561,21 @@ struct _cef_translator_test_t* cef_translator_test_create() {
}
NO_SANITIZE("cfi-icall")
struct
_cef_translator_test_ref_ptr_library_t* cef_translator_test_ref_ptr_library_create(
int value) {
struct _cef_translator_test_ref_ptr_library_t*
cef_translator_test_ref_ptr_library_create(int value) {
return g_libcef_pointers.cef_translator_test_ref_ptr_library_create(value);
}
NO_SANITIZE("cfi-icall")
struct
_cef_translator_test_ref_ptr_library_child_t* cef_translator_test_ref_ptr_library_child_create(
int value,
int other_value) {
struct _cef_translator_test_ref_ptr_library_child_t*
cef_translator_test_ref_ptr_library_child_create(int value, int other_value) {
return g_libcef_pointers.cef_translator_test_ref_ptr_library_child_create(
value, other_value);
}
NO_SANITIZE("cfi-icall")
struct
_cef_translator_test_ref_ptr_library_child_child_t* cef_translator_test_ref_ptr_library_child_child_create(
int value,
struct _cef_translator_test_ref_ptr_library_child_child_t*
cef_translator_test_ref_ptr_library_child_child_create(int value,
int other_value,
int other_other_value) {
return g_libcef_pointers
@ -1596,25 +1584,21 @@ struct
}
NO_SANITIZE("cfi-icall")
struct
_cef_translator_test_scoped_library_t* cef_translator_test_scoped_library_create(
int value) {
struct _cef_translator_test_scoped_library_t*
cef_translator_test_scoped_library_create(int value) {
return g_libcef_pointers.cef_translator_test_scoped_library_create(value);
}
NO_SANITIZE("cfi-icall")
struct
_cef_translator_test_scoped_library_child_t* cef_translator_test_scoped_library_child_create(
int value,
int other_value) {
struct _cef_translator_test_scoped_library_child_t*
cef_translator_test_scoped_library_child_create(int value, int other_value) {
return g_libcef_pointers.cef_translator_test_scoped_library_child_create(
value, other_value);
}
NO_SANITIZE("cfi-icall")
struct
_cef_translator_test_scoped_library_child_child_t* cef_translator_test_scoped_library_child_child_create(
int value,
struct _cef_translator_test_scoped_library_child_child_t*
cef_translator_test_scoped_library_child_child_create(int value,
int other_value,
int other_other_value) {
return g_libcef_pointers

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=32eea715f2566d1b6a4e3d263e35400cf7c53869$
// $hash=b12081eab77cac5baf1134e9fba8a23c6aef770a$
//
#include "include/capi/cef_app_capi.h"
@ -669,17 +669,6 @@ CEF_GLOBAL bool CefIsCertStatusError(cef_cert_status_t status) {
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
CEF_GLOBAL bool CefIsCertStatusMinorError(cef_cert_status_t status) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = cef_is_cert_status_minor_error(status);
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall") CEF_GLOBAL bool CefCurrentlyOn(CefThreadId threadId) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

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