mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-04-16 11:47:22 +02:00
Add initial NetworkService support (see issue #2622).
This change adds an --enable-network-service command-line flag to run with NetworkService enabled. To test: Run `cefclient --enable-network-service --disable-extensions`. The application should start, load a website and exit without crashing. Network-related handlers (for cookies, schemes, requests, etc) and extensions are not expected to work yet. There should be no functional change when running without the NetworkService enabled.
This commit is contained in:
parent
af349ade33
commit
6b2c1fe969
2
BUILD.gn
2
BUILD.gn
@ -522,6 +522,8 @@ static_library("libcef_static") {
|
|||||||
"libcef/common/net/upload_data.h",
|
"libcef/common/net/upload_data.h",
|
||||||
"libcef/common/net/upload_element.cc",
|
"libcef/common/net/upload_element.cc",
|
||||||
"libcef/common/net/upload_element.h",
|
"libcef/common/net/upload_element.h",
|
||||||
|
"libcef/common/net_service/util.cc",
|
||||||
|
"libcef/common/net_service/util.h",
|
||||||
"libcef/common/parser_impl.cc",
|
"libcef/common/parser_impl.cc",
|
||||||
"libcef/common/process_message_impl.cc",
|
"libcef/common/process_message_impl.cc",
|
||||||
"libcef/common/process_message_impl.h",
|
"libcef/common/process_message_impl.h",
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "libcef/browser/extensions/extension_system.h"
|
#include "libcef/browser/extensions/extension_system.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
#include "libcef/common/extensions/extensions_util.h"
|
#include "libcef/common/extensions/extensions_util.h"
|
||||||
|
#include "libcef/common/net_service/util.h"
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "chrome/browser/plugins/chrome_plugin_service_filter.h"
|
#include "chrome/browser/plugins/chrome_plugin_service_filter.h"
|
||||||
@ -116,6 +117,7 @@ CefBrowserContext::GetClientHintsControllerDelegate() {
|
|||||||
|
|
||||||
net::URLRequestContextGetter* CefBrowserContext::GetRequestContext() {
|
net::URLRequestContextGetter* CefBrowserContext::GetRequestContext() {
|
||||||
CEF_REQUIRE_UIT();
|
CEF_REQUIRE_UIT();
|
||||||
|
DCHECK(!net_service::IsEnabled());
|
||||||
return GetDefaultStoragePartition(this)->GetURLRequestContext();
|
return GetDefaultStoragePartition(this)->GetURLRequestContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
#include "libcef/common/cef_switches.h"
|
#include "libcef/common/cef_switches.h"
|
||||||
#include "libcef/common/extensions/extensions_util.h"
|
#include "libcef/common/extensions/extensions_util.h"
|
||||||
|
#include "libcef/common/net_service/util.h"
|
||||||
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
@ -290,12 +291,14 @@ void CefBrowserContextImpl::Initialize() {
|
|||||||
|
|
||||||
CefBrowserContext::PostInitialize();
|
CefBrowserContext::PostInitialize();
|
||||||
|
|
||||||
|
if (!net_service::IsEnabled()) {
|
||||||
// Create the CefURLRequestContextGetterImpl via an indirect call to
|
// Create the CefURLRequestContextGetterImpl via an indirect call to
|
||||||
// CreateRequestContext. Triggers a call to CefURLRequestContextGetterImpl::
|
// CreateRequestContext. Triggers a call to CefURLRequestContextGetterImpl::
|
||||||
// GetURLRequestContext() on the IO thread which creates the
|
// GetURLRequestContext() on the IO thread which creates the
|
||||||
// CefURLRequestContextImpl.
|
// CefURLRequestContextImpl.
|
||||||
GetRequestContext();
|
GetRequestContext();
|
||||||
DCHECK(url_request_getter_.get());
|
DCHECK(url_request_getter_.get());
|
||||||
|
}
|
||||||
|
|
||||||
// Create the StoragePartitionImplMap and StoragePartitionImpl for this
|
// Create the StoragePartitionImplMap and StoragePartitionImpl for this
|
||||||
// object. This must be done before the first WebContents is created using a
|
// object. This must be done before the first WebContents is created using a
|
||||||
@ -444,6 +447,7 @@ net::URLRequestContextGetter* CefBrowserContextImpl::CreateRequestContext(
|
|||||||
content::ProtocolHandlerMap* protocol_handlers,
|
content::ProtocolHandlerMap* protocol_handlers,
|
||||||
content::URLRequestInterceptorScopedVector request_interceptors) {
|
content::URLRequestInterceptorScopedVector request_interceptors) {
|
||||||
CEF_REQUIRE_UIT();
|
CEF_REQUIRE_UIT();
|
||||||
|
DCHECK(!net_service::IsEnabled());
|
||||||
DCHECK(!url_request_getter_.get());
|
DCHECK(!url_request_getter_.get());
|
||||||
|
|
||||||
auto io_thread_runner =
|
auto io_thread_runner =
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "libcef/browser/net/url_request_context_getter_proxy.h"
|
#include "libcef/browser/net/url_request_context_getter_proxy.h"
|
||||||
#include "libcef/browser/storage_partition_proxy.h"
|
#include "libcef/browser/storage_partition_proxy.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
|
#include "libcef/common/net_service/util.h"
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "chrome/browser/font_family_cache.h"
|
#include "chrome/browser/font_family_cache.h"
|
||||||
@ -246,9 +247,11 @@ CefBrowserContextProxy::GetOrCreateStoragePartitionProxy(
|
|||||||
CEF_REQUIRE_UIT();
|
CEF_REQUIRE_UIT();
|
||||||
|
|
||||||
if (!storage_partition_proxy_) {
|
if (!storage_partition_proxy_) {
|
||||||
scoped_refptr<CefURLRequestContextGetterProxy> url_request_getter =
|
scoped_refptr<CefURLRequestContextGetterProxy> url_request_getter;
|
||||||
new CefURLRequestContextGetterProxy(handler_,
|
if (!net_service::IsEnabled()) {
|
||||||
parent_->request_context_getter());
|
url_request_getter = new CefURLRequestContextGetterProxy(
|
||||||
|
handler_, parent_->request_context_getter());
|
||||||
|
}
|
||||||
storage_partition_proxy_.reset(
|
storage_partition_proxy_.reset(
|
||||||
new CefStoragePartitionProxy(partition_impl, url_request_getter.get()));
|
new CefStoragePartitionProxy(partition_impl, url_request_getter.get()));
|
||||||
|
|
||||||
|
@ -7,14 +7,18 @@
|
|||||||
|
|
||||||
#include "libcef/browser/browser_context_impl.h"
|
#include "libcef/browser/browser_context_impl.h"
|
||||||
#include "libcef/browser/chrome_profile_manager_stub.h"
|
#include "libcef/browser/chrome_profile_manager_stub.h"
|
||||||
|
#include "libcef/browser/prefs/browser_prefs.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
#include "libcef/common/cef_switches.h"
|
#include "libcef/common/cef_switches.h"
|
||||||
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "chrome/browser/net/chrome_net_log_helper.h"
|
#include "chrome/browser/net/chrome_net_log_helper.h"
|
||||||
|
#include "chrome/browser/net/system_network_context_manager.h"
|
||||||
|
#include "chrome/browser/policy/chrome_browser_policy_connector.h"
|
||||||
#include "chrome/browser/printing/print_job_manager.h"
|
#include "chrome/browser/printing/print_job_manager.h"
|
||||||
#include "components/net_log/chrome_net_log.h"
|
#include "components/net_log/chrome_net_log.h"
|
||||||
#include "components/net_log/net_export_file_writer.h"
|
#include "components/net_log/net_export_file_writer.h"
|
||||||
|
#include "components/prefs/pref_service.h"
|
||||||
#include "content/public/common/content_switches.h"
|
#include "content/public/common/content_switches.h"
|
||||||
#include "services/network/public/cpp/network_switches.h"
|
#include "services/network/public/cpp/network_switches.h"
|
||||||
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
@ -38,6 +42,12 @@ void ChromeBrowserProcessStub::Initialize() {
|
|||||||
DCHECK(!context_initialized_);
|
DCHECK(!context_initialized_);
|
||||||
DCHECK(!shutdown_);
|
DCHECK(!shutdown_);
|
||||||
|
|
||||||
|
// Used for very early NetworkService initialization.
|
||||||
|
// TODO(cef): These preferences could be persisted in the DIR_USER_DATA
|
||||||
|
// directory.
|
||||||
|
local_state_ =
|
||||||
|
browser_prefs::CreatePrefService(nullptr, base::FilePath(), false);
|
||||||
|
|
||||||
initialized_ = true;
|
initialized_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,6 +80,9 @@ void ChromeBrowserProcessStub::Shutdown() {
|
|||||||
profile_manager_.reset();
|
profile_manager_.reset();
|
||||||
event_router_forwarder_ = nullptr;
|
event_router_forwarder_ = nullptr;
|
||||||
|
|
||||||
|
local_state_.reset();
|
||||||
|
browser_policy_connector_.reset();
|
||||||
|
|
||||||
shutdown_ = true;
|
shutdown_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,8 +121,8 @@ IOThread* ChromeBrowserProcessStub::io_thread() {
|
|||||||
|
|
||||||
SystemNetworkContextManager*
|
SystemNetworkContextManager*
|
||||||
ChromeBrowserProcessStub::system_network_context_manager() {
|
ChromeBrowserProcessStub::system_network_context_manager() {
|
||||||
NOTREACHED();
|
DCHECK(SystemNetworkContextManager::GetInstance());
|
||||||
return NULL;
|
return SystemNetworkContextManager::GetInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
net_log::NetExportFileWriter*
|
net_log::NetExportFileWriter*
|
||||||
@ -137,9 +150,8 @@ ProfileManager* ChromeBrowserProcessStub::profile_manager() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PrefService* ChromeBrowserProcessStub::local_state() {
|
PrefService* ChromeBrowserProcessStub::local_state() {
|
||||||
DCHECK(context_initialized_);
|
DCHECK(initialized_);
|
||||||
return profile_manager_->GetLastUsedProfile(profile_manager_->user_data_dir())
|
return local_state_.get();
|
||||||
->GetPrefs();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
net::URLRequestContextGetter*
|
net::URLRequestContextGetter*
|
||||||
@ -183,13 +195,15 @@ ChromeBrowserProcessStub::notification_platform_bridge() {
|
|||||||
|
|
||||||
policy::ChromeBrowserPolicyConnector*
|
policy::ChromeBrowserPolicyConnector*
|
||||||
ChromeBrowserProcessStub::browser_policy_connector() {
|
ChromeBrowserProcessStub::browser_policy_connector() {
|
||||||
NOTREACHED();
|
if (!browser_policy_connector_) {
|
||||||
return NULL;
|
browser_policy_connector_ =
|
||||||
|
std::make_unique<policy::ChromeBrowserPolicyConnector>();
|
||||||
|
}
|
||||||
|
return browser_policy_connector_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
policy::PolicyService* ChromeBrowserProcessStub::policy_service() {
|
policy::PolicyService* ChromeBrowserProcessStub::policy_service() {
|
||||||
NOTREACHED();
|
return browser_policy_connector()->GetPolicyService();
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IconManager* ChromeBrowserProcessStub::icon_manager() {
|
IconManager* ChromeBrowserProcessStub::icon_manager() {
|
||||||
|
@ -126,6 +126,10 @@ class ChromeBrowserProcessStub : public BrowserProcess,
|
|||||||
scoped_refptr<extensions::EventRouterForwarder> event_router_forwarder_;
|
scoped_refptr<extensions::EventRouterForwarder> event_router_forwarder_;
|
||||||
std::unique_ptr<net_log::ChromeNetLog> net_log_;
|
std::unique_ptr<net_log::ChromeNetLog> net_log_;
|
||||||
std::unique_ptr<net_log::NetExportFileWriter> net_export_file_writer_;
|
std::unique_ptr<net_log::NetExportFileWriter> net_export_file_writer_;
|
||||||
|
std::unique_ptr<PrefService> local_state_;
|
||||||
|
// Must be destroyed after |local_state_|.
|
||||||
|
std::unique_ptr<policy::ChromeBrowserPolicyConnector>
|
||||||
|
browser_policy_connector_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserProcessStub);
|
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserProcessStub);
|
||||||
};
|
};
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "libcef/common/content_client.h"
|
#include "libcef/common/content_client.h"
|
||||||
#include "libcef/common/extensions/extensions_util.h"
|
#include "libcef/common/extensions/extensions_util.h"
|
||||||
#include "libcef/common/net/scheme_registration.h"
|
#include "libcef/common/net/scheme_registration.h"
|
||||||
|
#include "libcef/common/net_service/util.h"
|
||||||
#include "libcef/common/request_impl.h"
|
#include "libcef/common/request_impl.h"
|
||||||
#include "libcef/common/service_manifests/cef_content_browser_overlay_manifest.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_gpu_overlay_manifest.h"
|
||||||
@ -51,9 +52,12 @@
|
|||||||
#include "cef/grit/cef_resources.h"
|
#include "cef/grit/cef_resources.h"
|
||||||
#include "chrome/browser/browser_process.h"
|
#include "chrome/browser/browser_process.h"
|
||||||
#include "chrome/browser/chrome_service.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_info_host_impl.h"
|
||||||
#include "chrome/browser/profiles/profile.h"
|
#include "chrome/browser/profiles/profile.h"
|
||||||
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
|
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
|
||||||
|
#include "chrome/common/chrome_paths.h"
|
||||||
|
#include "chrome/common/chrome_paths_internal.h"
|
||||||
#include "chrome/common/chrome_switches.h"
|
#include "chrome/common/chrome_switches.h"
|
||||||
#include "chrome/common/constants.mojom.h"
|
#include "chrome/common/constants.mojom.h"
|
||||||
#include "chrome/grit/browser_resources.h"
|
#include "chrome/grit/browser_resources.h"
|
||||||
@ -839,6 +843,26 @@ std::string CefContentBrowserClient::GetApplicationLocale() {
|
|||||||
return g_browser_process->GetApplicationLocale();
|
return g_browser_process->GetApplicationLocale();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scoped_refptr<network::SharedURLLoaderFactory>
|
||||||
|
CefContentBrowserClient::GetSystemSharedURLLoaderFactory() {
|
||||||
|
DCHECK(
|
||||||
|
content::BrowserThread::CurrentlyOn(content::BrowserThread::UI) ||
|
||||||
|
!content::BrowserThread::IsThreadInitialized(content::BrowserThread::UI));
|
||||||
|
|
||||||
|
if (!SystemNetworkContextManager::GetInstance())
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
return SystemNetworkContextManager::GetInstance()
|
||||||
|
->GetSharedURLLoaderFactory();
|
||||||
|
}
|
||||||
|
|
||||||
|
network::mojom::NetworkContext*
|
||||||
|
CefContentBrowserClient::GetSystemNetworkContext() {
|
||||||
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||||
|
DCHECK(SystemNetworkContextManager::GetInstance());
|
||||||
|
return SystemNetworkContextManager::GetInstance()->GetContext();
|
||||||
|
}
|
||||||
|
|
||||||
content::QuotaPermissionContext*
|
content::QuotaPermissionContext*
|
||||||
CefContentBrowserClient::CreateQuotaPermissionContext() {
|
CefContentBrowserClient::CreateQuotaPermissionContext() {
|
||||||
return new CefQuotaPermissionContext();
|
return new CefQuotaPermissionContext();
|
||||||
@ -1173,6 +1197,51 @@ bool CefContentBrowserClient::WillCreateURLLoaderFactory(
|
|||||||
return use_proxy;
|
return use_proxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefContentBrowserClient::OnNetworkServiceCreated(
|
||||||
|
network::mojom::NetworkService* network_service) {
|
||||||
|
if (!net_service::IsEnabled())
|
||||||
|
return;
|
||||||
|
|
||||||
|
DCHECK(g_browser_process);
|
||||||
|
PrefService* local_state = g_browser_process->local_state();
|
||||||
|
DCHECK(local_state);
|
||||||
|
|
||||||
|
if (!SystemNetworkContextManager::GetInstance()) {
|
||||||
|
SystemNetworkContextManager::CreateInstance(local_state);
|
||||||
|
}
|
||||||
|
// Need to set up global NetworkService state before anything else uses it.
|
||||||
|
SystemNetworkContextManager::GetInstance()->OnNetworkServiceCreated(
|
||||||
|
network_service);
|
||||||
|
}
|
||||||
|
|
||||||
|
network::mojom::NetworkContextPtr CefContentBrowserClient::CreateNetworkContext(
|
||||||
|
content::BrowserContext* context,
|
||||||
|
bool in_memory,
|
||||||
|
const base::FilePath& relative_partition_path) {
|
||||||
|
Profile* profile = Profile::FromBrowserContext(context);
|
||||||
|
return profile->CreateNetworkContext(in_memory, relative_partition_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<base::FilePath>
|
||||||
|
CefContentBrowserClient::GetNetworkContextsParentDirectory() {
|
||||||
|
base::FilePath user_data_dir;
|
||||||
|
base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
|
||||||
|
DCHECK(!user_data_dir.empty());
|
||||||
|
|
||||||
|
// TODO(cef): Do we really want to create a cache directory underneath
|
||||||
|
// DIR_USER_DATA?
|
||||||
|
base::FilePath cache_dir;
|
||||||
|
chrome::GetUserCacheDirectory(user_data_dir, &cache_dir);
|
||||||
|
DCHECK(!cache_dir.empty());
|
||||||
|
|
||||||
|
// On some platforms, the cache is a child of the user_data_dir so only
|
||||||
|
// return the one path.
|
||||||
|
if (user_data_dir.IsParent(cache_dir))
|
||||||
|
return {user_data_dir};
|
||||||
|
|
||||||
|
return {user_data_dir, cache_dir};
|
||||||
|
}
|
||||||
|
|
||||||
bool CefContentBrowserClient::HandleExternalProtocol(
|
bool CefContentBrowserClient::HandleExternalProtocol(
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
|
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
|
||||||
|
@ -68,6 +68,9 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
|||||||
base::CommandLine* command_line) override;
|
base::CommandLine* command_line) override;
|
||||||
bool ShouldEnableStrictSiteIsolation() override;
|
bool ShouldEnableStrictSiteIsolation() override;
|
||||||
std::string GetApplicationLocale() override;
|
std::string GetApplicationLocale() override;
|
||||||
|
scoped_refptr<network::SharedURLLoaderFactory>
|
||||||
|
GetSystemSharedURLLoaderFactory() override;
|
||||||
|
network::mojom::NetworkContext* GetSystemNetworkContext() override;
|
||||||
content::QuotaPermissionContext* CreateQuotaPermissionContext() override;
|
content::QuotaPermissionContext* CreateQuotaPermissionContext() override;
|
||||||
void GetQuotaSettings(
|
void GetQuotaSettings(
|
||||||
content::BrowserContext* context,
|
content::BrowserContext* context,
|
||||||
@ -154,7 +157,13 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
|||||||
network::mojom::URLLoaderFactoryRequest* factory_request,
|
network::mojom::URLLoaderFactoryRequest* factory_request,
|
||||||
network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client,
|
network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client,
|
||||||
bool* bypass_redirect_checks) override;
|
bool* bypass_redirect_checks) override;
|
||||||
|
void OnNetworkServiceCreated(
|
||||||
|
network::mojom::NetworkService* network_service) override;
|
||||||
|
network::mojom::NetworkContextPtr CreateNetworkContext(
|
||||||
|
content::BrowserContext* context,
|
||||||
|
bool in_memory,
|
||||||
|
const base::FilePath& relative_partition_path) override;
|
||||||
|
std::vector<base::FilePath> GetNetworkContextsParentDirectory() override;
|
||||||
bool HandleExternalProtocol(
|
bool HandleExternalProtocol(
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
|
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "libcef/browser/context.h"
|
#include "libcef/browser/context.h"
|
||||||
#include "libcef/browser/net/cookie_store_source.h"
|
#include "libcef/browser/net/cookie_store_source.h"
|
||||||
#include "libcef/browser/net/network_delegate.h"
|
#include "libcef/browser/net/network_delegate.h"
|
||||||
|
#include "libcef/common/net_service/util.h"
|
||||||
#include "libcef/common/task_runner_impl.h"
|
#include "libcef/common/task_runner_impl.h"
|
||||||
#include "libcef/common/time_util.h"
|
#include "libcef/common/time_util.h"
|
||||||
|
|
||||||
@ -141,9 +142,13 @@ void CefCookieManagerImpl::Initialize(
|
|||||||
CHECK(!is_blocking_);
|
CHECK(!is_blocking_);
|
||||||
if (request_context.get()) {
|
if (request_context.get()) {
|
||||||
request_context_ = request_context;
|
request_context_ = request_context;
|
||||||
|
if (!net_service::IsEnabled()) {
|
||||||
request_context_->GetRequestContextImpl(
|
request_context_->GetRequestContextImpl(
|
||||||
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO}),
|
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO}),
|
||||||
base::Bind(&CefCookieManagerImpl::InitWithContext, this, callback));
|
base::Bind(&CefCookieManagerImpl::InitWithContext, this, callback));
|
||||||
|
} else {
|
||||||
|
RunAsyncCompletionOnIOThread(callback);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
SetStoragePath(path, persist_session_cookies, callback);
|
SetStoragePath(path, persist_session_cookies, callback);
|
||||||
}
|
}
|
||||||
@ -477,9 +482,14 @@ void CefCookieManagerImpl::SetSupportedSchemesInternal(
|
|||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
|
|
||||||
if (HasContext()) {
|
if (HasContext()) {
|
||||||
|
if (!net_service::IsEnabled()) {
|
||||||
RunMethodWithContext(
|
RunMethodWithContext(
|
||||||
base::Bind(&CefCookieManagerImpl::SetSupportedSchemesWithContext, this,
|
base::Bind(&CefCookieManagerImpl::SetSupportedSchemesWithContext,
|
||||||
schemes, callback));
|
this, schemes, callback));
|
||||||
|
} else {
|
||||||
|
NOTIMPLEMENTED();
|
||||||
|
RunAsyncCompletionOnIOThread(callback);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,6 +249,10 @@ void CefURLRequestContextGetterImpl::RegisterPrefs(
|
|||||||
|
|
||||||
// Based on ProfileImpl::RegisterProfilePrefs.
|
// Based on ProfileImpl::RegisterProfilePrefs.
|
||||||
registry->RegisterBooleanPref(prefs::kForceGoogleSafeSearch, false);
|
registry->RegisterBooleanPref(prefs::kForceGoogleSafeSearch, false);
|
||||||
|
|
||||||
|
// Based on IOThread::RegisterPrefs.
|
||||||
|
registry->RegisterStringPref(prefs::kAuthServerWhitelist, "");
|
||||||
|
registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefURLRequestContextGetterImpl::ShutdownOnUIThread() {
|
void CefURLRequestContextGetterImpl::ShutdownOnUIThread() {
|
||||||
|
@ -17,9 +17,12 @@
|
|||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
#include "chrome/browser/accessibility/accessibility_ui.h"
|
#include "chrome/browser/accessibility/accessibility_ui.h"
|
||||||
#include "chrome/browser/net/prediction_options.h"
|
#include "chrome/browser/net/prediction_options.h"
|
||||||
|
#include "chrome/browser/net/profile_network_context_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_info_host_impl.h"
|
||||||
#include "chrome/browser/prefs/chrome_command_line_pref_store.h"
|
#include "chrome/browser/prefs/chrome_command_line_pref_store.h"
|
||||||
#include "chrome/browser/renderer_host/pepper/device_id_fetcher.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_pref_store.h"
|
||||||
#include "chrome/browser/supervised_user/supervised_user_settings_service.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/supervised_user/supervised_user_settings_service_factory.h"
|
||||||
@ -27,6 +30,7 @@
|
|||||||
#include "chrome/common/chrome_switches.h"
|
#include "chrome/common/chrome_switches.h"
|
||||||
#include "chrome/common/pref_names.h"
|
#include "chrome/common/pref_names.h"
|
||||||
#include "chrome/grit/locale_settings.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/cookie_settings.h"
|
||||||
#include "components/content_settings/core/browser/host_content_settings_map.h"
|
#include "components/content_settings/core/browser/host_content_settings_map.h"
|
||||||
#include "components/google/core/browser/google_url_tracker.h"
|
#include "components/google/core/browser/google_url_tracker.h"
|
||||||
@ -97,6 +101,7 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
|
#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
|
||||||
|
if (profile) {
|
||||||
// Used to store supervised user preferences.
|
// Used to store supervised user preferences.
|
||||||
SupervisedUserSettingsService* supervised_user_settings =
|
SupervisedUserSettingsService* supervised_user_settings =
|
||||||
SupervisedUserSettingsServiceFactory::GetForProfile(profile);
|
SupervisedUserSettingsServiceFactory::GetForProfile(profile);
|
||||||
@ -114,6 +119,7 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
|||||||
base::MakeRefCounted<SupervisedUserPrefStore>(supervised_user_settings);
|
base::MakeRefCounted<SupervisedUserPrefStore>(supervised_user_settings);
|
||||||
DCHECK(supervised_user_prefs->IsInitializationComplete());
|
DCHECK(supervised_user_prefs->IsInitializationComplete());
|
||||||
factory.set_supervised_user_prefs(supervised_user_prefs);
|
factory.set_supervised_user_prefs(supervised_user_prefs);
|
||||||
|
}
|
||||||
#endif // BUILDFLAG(ENABLE_SUPERVISED_USERS)
|
#endif // BUILDFLAG(ENABLE_SUPERVISED_USERS)
|
||||||
|
|
||||||
// Registry that will be populated with all known preferences. Preferences
|
// Registry that will be populated with all known preferences. Preferences
|
||||||
@ -138,25 +144,50 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
|||||||
// use) then register the preferences directly instead of calling the
|
// use) then register the preferences directly instead of calling the
|
||||||
// existing registration method.
|
// existing registration method.
|
||||||
|
|
||||||
|
// Default preferences.
|
||||||
|
CefMediaCaptureDevicesDispatcher::RegisterPrefs(registry.get());
|
||||||
|
certificate_transparency::prefs::RegisterPrefs(registry.get());
|
||||||
|
PluginInfoHostImpl::RegisterUserPrefs(registry.get());
|
||||||
|
PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get());
|
||||||
|
SSLConfigServiceManager::RegisterPrefs(registry.get());
|
||||||
|
update_client::RegisterPrefs(registry.get());
|
||||||
|
|
||||||
|
if (!command_line->HasSwitch(switches::kEnableNetworkService)) {
|
||||||
|
CefURLRequestContextGetterImpl::RegisterPrefs(registry.get());
|
||||||
|
} else if (!profile) {
|
||||||
|
SystemNetworkContextManager::RegisterPrefs(registry.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Browser UI preferences.
|
||||||
|
// Based on chrome/browser/ui/browser_ui_prefs.cc RegisterBrowserPrefs.
|
||||||
|
registry->RegisterBooleanPref(prefs::kAllowFileSelectionDialogs, true);
|
||||||
|
|
||||||
|
if (command_line->HasSwitch(switches::kEnablePreferenceTesting)) {
|
||||||
|
// Preferences used with unit tests.
|
||||||
|
registry->RegisterBooleanPref("test.bool", true);
|
||||||
|
registry->RegisterIntegerPref("test.int", 2);
|
||||||
|
registry->RegisterDoublePref("test.double", 5.0);
|
||||||
|
registry->RegisterStringPref("test.string", "default");
|
||||||
|
registry->RegisterListPref("test.list");
|
||||||
|
registry->RegisterDictionaryPref("test.dict");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (profile) {
|
||||||
// Call RegisterProfilePrefs() for all services listed by
|
// Call RegisterProfilePrefs() for all services listed by
|
||||||
// EnsureBrowserContextKeyedServiceFactoriesBuilt().
|
// EnsureBrowserContextKeyedServiceFactoriesBuilt().
|
||||||
BrowserContextDependencyManager::GetInstance()
|
BrowserContextDependencyManager::GetInstance()
|
||||||
->RegisterProfilePrefsForServices(profile, registry.get());
|
->RegisterProfilePrefsForServices(profile, registry.get());
|
||||||
|
|
||||||
// Default preferences.
|
// Default profile preferences.
|
||||||
AccessibilityUIMessageHandler::RegisterProfilePrefs(registry.get());
|
AccessibilityUIMessageHandler::RegisterProfilePrefs(registry.get());
|
||||||
CefMediaCaptureDevicesDispatcher::RegisterPrefs(registry.get());
|
|
||||||
CefURLRequestContextGetterImpl::RegisterPrefs(registry.get());
|
|
||||||
chrome_browser_net::RegisterPredictionOptionsProfilePrefs(registry.get());
|
chrome_browser_net::RegisterPredictionOptionsProfilePrefs(registry.get());
|
||||||
DeviceIDFetcher::RegisterProfilePrefs(registry.get());
|
DeviceIDFetcher::RegisterProfilePrefs(registry.get());
|
||||||
extensions::ExtensionPrefs::RegisterProfilePrefs(registry.get());
|
extensions::ExtensionPrefs::RegisterProfilePrefs(registry.get());
|
||||||
GoogleURLTracker::RegisterProfilePrefs(registry.get());
|
GoogleURLTracker::RegisterProfilePrefs(registry.get());
|
||||||
HostContentSettingsMap::RegisterProfilePrefs(registry.get());
|
HostContentSettingsMap::RegisterProfilePrefs(registry.get());
|
||||||
language::RegisterProfilePrefs(registry.get());
|
language::RegisterProfilePrefs(registry.get());
|
||||||
PluginInfoHostImpl::RegisterUserPrefs(registry.get());
|
ProfileNetworkContextService::RegisterProfilePrefs(registry.get());
|
||||||
PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get());
|
|
||||||
renderer_prefs::RegisterProfilePrefs(registry.get());
|
renderer_prefs::RegisterProfilePrefs(registry.get());
|
||||||
update_client::RegisterPrefs(registry.get());
|
|
||||||
|
|
||||||
// Print preferences.
|
// Print preferences.
|
||||||
// Based on ProfileImpl::RegisterProfilePrefs.
|
// Based on ProfileImpl::RegisterProfilePrefs.
|
||||||
@ -182,28 +213,10 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
|||||||
// Modify defaults from DeviceIDFetcher::RegisterProfilePrefs.
|
// Modify defaults from DeviceIDFetcher::RegisterProfilePrefs.
|
||||||
registry->SetDefaultPrefValue(prefs::kEnableDRM, base::Value(false));
|
registry->SetDefaultPrefValue(prefs::kEnableDRM, base::Value(false));
|
||||||
|
|
||||||
// Authentication preferences.
|
|
||||||
// Based on IOThread::RegisterPrefs.
|
|
||||||
registry->RegisterStringPref(prefs::kAuthServerWhitelist, "");
|
|
||||||
registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, "");
|
|
||||||
|
|
||||||
// Browser UI preferences.
|
|
||||||
// Based on chrome/browser/ui/browser_ui_prefs.cc RegisterBrowserPrefs.
|
|
||||||
registry->RegisterBooleanPref(prefs::kAllowFileSelectionDialogs, true);
|
|
||||||
|
|
||||||
// DevTools preferences.
|
// DevTools preferences.
|
||||||
// Based on DevToolsWindow::RegisterProfilePrefs.
|
// Based on DevToolsWindow::RegisterProfilePrefs.
|
||||||
registry->RegisterDictionaryPref(prefs::kDevToolsPreferences);
|
registry->RegisterDictionaryPref(prefs::kDevToolsPreferences);
|
||||||
registry->RegisterDictionaryPref(prefs::kDevToolsEditedFiles);
|
registry->RegisterDictionaryPref(prefs::kDevToolsEditedFiles);
|
||||||
|
|
||||||
if (command_line->HasSwitch(switches::kEnablePreferenceTesting)) {
|
|
||||||
// Preferences used with unit tests.
|
|
||||||
registry->RegisterBooleanPref("test.bool", true);
|
|
||||||
registry->RegisterIntegerPref("test.int", 2);
|
|
||||||
registry->RegisterDoublePref("test.double", 5.0);
|
|
||||||
registry->RegisterStringPref("test.string", "default");
|
|
||||||
registry->RegisterListPref("test.list");
|
|
||||||
registry->RegisterDictionaryPref("test.dict");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build the PrefService that manages the PrefRegistry and PrefStores.
|
// Build the PrefService that manages the PrefRegistry and PrefStores.
|
||||||
|
@ -20,6 +20,7 @@ namespace browser_prefs {
|
|||||||
extern const char kUserPrefsFileName[];
|
extern const char kUserPrefsFileName[];
|
||||||
|
|
||||||
// Create the PrefService used to manage pref registration and storage.
|
// Create the PrefService used to manage pref registration and storage.
|
||||||
|
// |profile| will be nullptr for the system-level PrefService.
|
||||||
std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
||||||
const base::FilePath& cache_path,
|
const base::FilePath& cache_path,
|
||||||
bool persist_user_preferences);
|
bool persist_user_preferences);
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "libcef/browser/extensions/extension_system.h"
|
#include "libcef/browser/extensions/extension_system.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
#include "libcef/common/extensions/extensions_util.h"
|
#include "libcef/common/extensions/extensions_util.h"
|
||||||
|
#include "libcef/common/net_service/util.h"
|
||||||
#include "libcef/common/task_runner_impl.h"
|
#include "libcef/common/task_runner_impl.h"
|
||||||
#include "libcef/common/values_impl.h"
|
#include "libcef/common/values_impl.h"
|
||||||
|
|
||||||
@ -194,6 +195,7 @@ void CefRequestContextImpl::GetBrowserContext(
|
|||||||
void CefRequestContextImpl::GetRequestContextImpl(
|
void CefRequestContextImpl::GetRequestContextImpl(
|
||||||
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
||||||
const RequestContextCallback& callback) {
|
const RequestContextCallback& callback) {
|
||||||
|
DCHECK(!net_service::IsEnabled());
|
||||||
if (!task_runner.get())
|
if (!task_runner.get())
|
||||||
task_runner = CefTaskRunnerImpl::GetCurrentTaskRunner();
|
task_runner = CefTaskRunnerImpl::GetCurrentTaskRunner();
|
||||||
if (request_context_getter_impl_) {
|
if (request_context_getter_impl_) {
|
||||||
@ -305,6 +307,10 @@ bool CefRequestContextImpl::RegisterSchemeHandlerFactory(
|
|||||||
const CefString& scheme_name,
|
const CefString& scheme_name,
|
||||||
const CefString& domain_name,
|
const CefString& domain_name,
|
||||||
CefRefPtr<CefSchemeHandlerFactory> factory) {
|
CefRefPtr<CefSchemeHandlerFactory> factory) {
|
||||||
|
if (net_service::IsEnabled()) {
|
||||||
|
NOTIMPLEMENTED();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
GetRequestContextImpl(
|
GetRequestContextImpl(
|
||||||
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO}),
|
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO}),
|
||||||
base::Bind(&CefRequestContextImpl::RegisterSchemeHandlerFactoryInternal,
|
base::Bind(&CefRequestContextImpl::RegisterSchemeHandlerFactoryInternal,
|
||||||
@ -313,6 +319,10 @@ bool CefRequestContextImpl::RegisterSchemeHandlerFactory(
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CefRequestContextImpl::ClearSchemeHandlerFactories() {
|
bool CefRequestContextImpl::ClearSchemeHandlerFactories() {
|
||||||
|
if (net_service::IsEnabled()) {
|
||||||
|
NOTIMPLEMENTED();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
GetRequestContextImpl(
|
GetRequestContextImpl(
|
||||||
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO}),
|
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO}),
|
||||||
base::Bind(&CefRequestContextImpl::ClearSchemeHandlerFactoriesInternal,
|
base::Bind(&CefRequestContextImpl::ClearSchemeHandlerFactoriesInternal,
|
||||||
@ -614,6 +624,7 @@ void CefRequestContextImpl::Initialize() {
|
|||||||
DCHECK(!config_.is_global);
|
DCHECK(!config_.is_global);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!net_service::IsEnabled()) {
|
||||||
request_context_getter_impl_ =
|
request_context_getter_impl_ =
|
||||||
browser_context_impl_->request_context_getter().get();
|
browser_context_impl_->request_context_getter().get();
|
||||||
DCHECK(request_context_getter_impl_);
|
DCHECK(request_context_getter_impl_);
|
||||||
@ -623,6 +634,7 @@ void CefRequestContextImpl::Initialize() {
|
|||||||
// destroyed.
|
// destroyed.
|
||||||
request_context_getter_impl_->AddHandler(config_.handler);
|
request_context_getter_impl_->AddHandler(config_.handler);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (config_.other) {
|
if (config_.other) {
|
||||||
// Clear the reference to |config_.other| after setting
|
// Clear the reference to |config_.other| after setting
|
||||||
@ -640,7 +652,7 @@ void CefRequestContextImpl::EnsureBrowserContext() {
|
|||||||
if (!browser_context())
|
if (!browser_context())
|
||||||
Initialize();
|
Initialize();
|
||||||
DCHECK(browser_context());
|
DCHECK(browser_context());
|
||||||
DCHECK(request_context_getter_impl_);
|
DCHECK(net_service::IsEnabled() || request_context_getter_impl_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRequestContextImpl::GetBrowserContextOnUIThread(
|
void CefRequestContextImpl::GetBrowserContextOnUIThread(
|
||||||
@ -677,6 +689,7 @@ void CefRequestContextImpl::GetRequestContextImplOnIOThread(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DCHECK(!net_service::IsEnabled());
|
||||||
DCHECK(request_context_getter_impl_);
|
DCHECK(request_context_getter_impl_);
|
||||||
|
|
||||||
// Make sure the request context exists.
|
// Make sure the request context exists.
|
||||||
|
@ -4,14 +4,20 @@
|
|||||||
|
|
||||||
#include "libcef/browser/storage_partition_proxy.h"
|
#include "libcef/browser/storage_partition_proxy.h"
|
||||||
|
|
||||||
|
#include "libcef/common/net_service/util.h"
|
||||||
|
|
||||||
|
#include "base/logging.h"
|
||||||
#include "services/network/public/mojom/cookie_manager.mojom.h"
|
#include "services/network/public/mojom/cookie_manager.mojom.h"
|
||||||
|
|
||||||
CefStoragePartitionProxy::CefStoragePartitionProxy(
|
CefStoragePartitionProxy::CefStoragePartitionProxy(
|
||||||
content::StoragePartition* parent,
|
content::StoragePartition* parent,
|
||||||
CefURLRequestContextGetterProxy* url_request_context)
|
CefURLRequestContextGetterProxy* url_request_context)
|
||||||
: parent_(parent), url_request_context_(url_request_context) {}
|
: parent_(parent), url_request_context_(url_request_context) {
|
||||||
|
DCHECK(net_service::IsEnabled() || url_request_context_);
|
||||||
|
}
|
||||||
|
|
||||||
CefStoragePartitionProxy::~CefStoragePartitionProxy() {
|
CefStoragePartitionProxy::~CefStoragePartitionProxy() {
|
||||||
|
if (url_request_context_)
|
||||||
url_request_context_->ShutdownOnUIThread();
|
url_request_context_->ShutdownOnUIThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,6 +116,9 @@ const char kEnablePreferenceTesting[] = "enable-preference-testing";
|
|||||||
// Enable date-based expiration of built in network security information.
|
// Enable date-based expiration of built in network security information.
|
||||||
const char kEnableNetSecurityExpiration[] = "enable-net-security-expiration";
|
const char kEnableNetSecurityExpiration[] = "enable-net-security-expiration";
|
||||||
|
|
||||||
|
// Enable the NetworkService.
|
||||||
|
const char kEnableNetworkService[] = "enable-network-service";
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
// Path to the framework directory.
|
// Path to the framework directory.
|
||||||
const char kFrameworkDirPath[] = "framework-dir-path";
|
const char kFrameworkDirPath[] = "framework-dir-path";
|
||||||
|
@ -52,6 +52,7 @@ extern const char kPluginPolicy_Detect[];
|
|||||||
extern const char kPluginPolicy_Block[];
|
extern const char kPluginPolicy_Block[];
|
||||||
extern const char kEnablePreferenceTesting[];
|
extern const char kEnablePreferenceTesting[];
|
||||||
extern const char kEnableNetSecurityExpiration[];
|
extern const char kEnableNetSecurityExpiration[];
|
||||||
|
extern const char kEnableNetworkService[];
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
extern const char kFrameworkDirPath[];
|
extern const char kFrameworkDirPath[];
|
||||||
|
@ -570,7 +570,8 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
|
|||||||
// Disable NetworkService for now
|
// Disable NetworkService for now
|
||||||
// TODO(cef): Implement the required changes for network service
|
// TODO(cef): Implement the required changes for network service
|
||||||
if (network::features::kNetworkService.default_state ==
|
if (network::features::kNetworkService.default_state ==
|
||||||
base::FEATURE_ENABLED_BY_DEFAULT) {
|
base::FEATURE_ENABLED_BY_DEFAULT &&
|
||||||
|
!command_line->HasSwitch(switches::kEnableNetworkService)) {
|
||||||
disable_features.push_back(network::features::kNetworkService.name);
|
disable_features.push_back(network::features::kNetworkService.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
16
libcef/common/net_service/util.cc
Normal file
16
libcef/common/net_service/util.cc
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// 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/common/net_service/util.h"
|
||||||
|
|
||||||
|
#include "base/feature_list.h"
|
||||||
|
#include "services/network/public/cpp/features.h"
|
||||||
|
|
||||||
|
namespace net_service {
|
||||||
|
|
||||||
|
bool IsEnabled() {
|
||||||
|
return base::FeatureList::IsEnabled(network::features::kNetworkService);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace net_service
|
16
libcef/common/net_service/util.h
Normal file
16
libcef/common/net_service/util.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// 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_COMMON_NET_SERVICE_UTIL_H_
|
||||||
|
#define CEF_LIBCEF_COMMON_NET_SERVICE_UTIL_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace net_service {
|
||||||
|
|
||||||
|
// Returns true if the NetworkService is enabled.
|
||||||
|
bool IsEnabled();
|
||||||
|
|
||||||
|
} // namespace net_service
|
||||||
|
|
||||||
|
#endif // CEF_LIBCEF_COMMON_NET_SERVICE_UTIL_H_
|
Loading…
x
Reference in New Issue
Block a user