summaryrefslogtreecommitdiffstats
path: root/chrome/browser/profiles
diff options
context:
space:
mode:
authordhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-07 12:30:06 +0000
committerdhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-07 12:30:06 +0000
commit672c8c1e10e9b8f8b3416ed812cdfeae16005505 (patch)
tree75d427330154213748efe55b8f3163603faf3de1 /chrome/browser/profiles
parentd679c866738497a6c73a7836bdf441831f024be0 (diff)
downloadchromium_src-672c8c1e10e9b8f8b3416ed812cdfeae16005505.zip
chromium_src-672c8c1e10e9b8f8b3416ed812cdfeae16005505.tar.gz
chromium_src-672c8c1e10e9b8f8b3416ed812cdfeae16005505.tar.bz2
Add chrome-search: access from Instant overlay
Enables the Instant NTP page access to: chrome-search://theme/*, chrome-search://favicon/*, and chrome-search://thumb/*. This CL has a number of aspects to make the installed theme background image available to the Instant overlay: 1. Utilizes the new chrome-search: scheme that is accessible only to the Instant overlay's render process. This is enforced on the renderer side by WebKit::WebSecurityPolicy facilities. This is enforced on the browser side by the InstantIOContext::ShouldServiceRequest and URLDataSource::ShouldServiceRequest facilities. 2. Whitelists the chrome-search://theme origin to be made available to the specific Instant overlay's origin/url. 3. Backend CSS that sets the appropriate background image that resides in the chrome-search://theme origin. 4. A small refactoring of the Instant tests to support mix-in usage of InstantTestBase. BUG=172408, 134937 TEST=InstantPolicyTest.SearchSchemePolicy R=sreeram@chromium.org, creis@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=186347 Review URL: https://chromiumcodereview.appspot.com/11896113 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186680 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/profiles')
-rw-r--r--chrome/browser/profiles/off_the_record_profile_impl.cc30
-rw-r--r--chrome/browser/profiles/off_the_record_profile_impl.h23
-rw-r--r--chrome/browser/profiles/off_the_record_profile_io_data.cc102
-rw-r--r--chrome/browser/profiles/off_the_record_profile_io_data.h55
-rw-r--r--chrome/browser/profiles/profile.h23
-rw-r--r--chrome/browser/profiles/profile_impl.cc32
-rw-r--r--chrome/browser/profiles/profile_impl.h23
-rw-r--r--chrome/browser/profiles/profile_impl_io_data.cc103
-rw-r--r--chrome/browser/profiles/profile_impl_io_data.h55
-rw-r--r--chrome/browser/profiles/profile_io_data.cc51
-rw-r--r--chrome/browser/profiles/profile_io_data.h64
11 files changed, 82 insertions, 479 deletions
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc
index 81062f47d..7ff079c 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl.cc
+++ b/chrome/browser/profiles/off_the_record_profile_impl.cc
@@ -261,19 +261,8 @@ net::URLRequestContextGetter* OffTheRecordProfileImpl::GetRequestContext() {
}
net::URLRequestContextGetter* OffTheRecordProfileImpl::CreateRequestContext(
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) {
- return io_data_.CreateMainRequestContextGetter(blob_protocol_handler.Pass(),
- file_system_protocol_handler.Pass(), developer_protocol_handler.Pass(),
- chrome_protocol_handler.Pass(), chrome_devtools_protocol_handler.Pass());
+ content::ProtocolHandlerMap* protocol_handlers) {
+ return io_data_.CreateMainRequestContextGetter(protocol_handlers);
}
net::URLRequestContextGetter*
@@ -313,20 +302,9 @@ net::URLRequestContextGetter*
OffTheRecordProfileImpl::CreateRequestContextForStoragePartition(
const base::FilePath& partition_path,
bool in_memory,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) {
+ content::ProtocolHandlerMap* protocol_handlers) {
return io_data_.CreateIsolatedAppRequestContextGetter(
- partition_path, in_memory, blob_protocol_handler.Pass(),
- file_system_protocol_handler.Pass(), developer_protocol_handler.Pass(),
- chrome_protocol_handler.Pass(), chrome_devtools_protocol_handler.Pass());
+ partition_path, in_memory, protocol_handlers);
}
content::ResourceContext* OffTheRecordProfileImpl::GetResourceContext() {
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.h b/chrome/browser/profiles/off_the_record_profile_impl.h
index c26b3d3..4b7759e 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl.h
+++ b/chrome/browser/profiles/off_the_record_profile_impl.h
@@ -11,6 +11,7 @@
#include "chrome/browser/profiles/off_the_record_profile_io_data.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_list.h"
+#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/host_zoom_map.h"
using base::Time;
@@ -50,29 +51,11 @@ class OffTheRecordProfileImpl : public Profile {
virtual net::URLRequestContextGetter*
GetRequestContextForExtensions() OVERRIDE;
virtual net::URLRequestContextGetter* CreateRequestContext(
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) OVERRIDE;
+ content::ProtocolHandlerMap* protocol_handlers) OVERRIDE;
virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
const base::FilePath& partition_path,
bool in_memory,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) OVERRIDE;
+ content::ProtocolHandlerMap* protocol_handlers) OVERRIDE;
virtual net::SSLConfigService* GetSSLConfigService() OVERRIDE;
virtual HostContentSettingsMap* GetHostContentSettingsMap() OVERRIDE;
virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() OVERRIDE;
diff --git a/chrome/browser/profiles/off_the_record_profile_io_data.cc b/chrome/browser/profiles/off_the_record_profile_io_data.cc
index dfe2a8b..411de3a 100644
--- a/chrome/browser/profiles/off_the_record_profile_io_data.cc
+++ b/chrome/browser/profiles/off_the_record_profile_io_data.cc
@@ -70,16 +70,7 @@ OffTheRecordProfileIOData::Handle::GetResourceContextNoInit() const {
scoped_refptr<ChromeURLRequestContextGetter>
OffTheRecordProfileIOData::Handle::CreateMainRequestContextGetter(
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const {
+ content::ProtocolHandlerMap* protocol_handlers) const {
// TODO(oshima): Re-enable when ChromeOS only accesses the profile on the UI
// thread.
#if !defined(OS_CHROMEOS)
@@ -89,10 +80,7 @@ OffTheRecordProfileIOData::Handle::CreateMainRequestContextGetter(
DCHECK(!main_request_context_getter_);
main_request_context_getter_ =
ChromeURLRequestContextGetter::CreateOffTheRecord(
- profile_, io_data_, blob_protocol_handler.Pass(),
- file_system_protocol_handler.Pass(),
- developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(),
- chrome_devtools_protocol_handler.Pass());
+ profile_, io_data_, protocol_handlers);
return main_request_context_getter_;
}
@@ -128,16 +116,7 @@ scoped_refptr<ChromeURLRequestContextGetter>
OffTheRecordProfileIOData::Handle::CreateIsolatedAppRequestContextGetter(
const base::FilePath& partition_path,
bool in_memory,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const {
+ content::ProtocolHandlerMap* protocol_handlers) const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!partition_path.empty());
LazyInitialize();
@@ -153,9 +132,7 @@ OffTheRecordProfileIOData::Handle::CreateIsolatedAppRequestContextGetter(
ChromeURLRequestContextGetter* context =
ChromeURLRequestContextGetter::CreateOffTheRecordForIsolatedApp(
profile_, io_data_, descriptor, protocol_handler_interceptor.Pass(),
- blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(),
- developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(),
- chrome_devtools_protocol_handler.Pass());
+ protocol_handlers);
app_request_context_getter_map_[descriptor] = context;
return context;
@@ -185,16 +162,7 @@ OffTheRecordProfileIOData::~OffTheRecordProfileIOData() {
void OffTheRecordProfileIOData::InitializeInternal(
ProfileParams* profile_params,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const {
+ content::ProtocolHandlerMap* protocol_handlers) const {
ChromeURLRequestContext* main_context = main_request_context();
IOThread* const io_thread = profile_params->io_thread;
@@ -254,27 +222,13 @@ void OffTheRecordProfileIOData::InitializeInternal(
scoped_ptr<net::URLRequestJobFactoryImpl> main_job_factory(
new net::URLRequestJobFactoryImpl());
- bool set_protocol = main_job_factory->SetProtocolHandler(
- chrome::kBlobScheme, blob_protocol_handler.release());
- DCHECK(set_protocol);
- set_protocol = main_job_factory->SetProtocolHandler(
- chrome::kFileSystemScheme, file_system_protocol_handler.release());
- DCHECK(set_protocol);
- set_protocol = main_job_factory->SetProtocolHandler(
- chrome::kChromeUIScheme, chrome_protocol_handler.release());
- DCHECK(set_protocol);
- set_protocol = main_job_factory->SetProtocolHandler(
- chrome::kChromeDevToolsScheme,
- chrome_devtools_protocol_handler.release());
- DCHECK(set_protocol);
+ InstallProtocolHandlers(main_job_factory.get(), protocol_handlers);
main_job_factory_ = SetUpJobFactoryDefaults(
main_job_factory.Pass(),
profile_params->protocol_handler_interceptor.Pass(),
network_delegate(),
main_context->ftp_transaction_factory(),
main_context->ftp_auth_cache());
- main_job_factory_.reset(new net::ProtocolInterceptJobFactory(
- main_job_factory_.Pass(), developer_protocol_handler.Pass()));
main_context->set_job_factory(main_job_factory_.get());
#if defined(ENABLE_EXTENSIONS)
@@ -336,16 +290,7 @@ OffTheRecordProfileIOData::InitializeAppRequestContext(
const StoragePartitionDescriptor& partition_descriptor,
scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const {
+ content::ProtocolHandlerMap* protocol_handlers) const {
AppRequestContext* context = new AppRequestContext(load_time_stats());
// Copy most state from the main context.
@@ -368,27 +313,13 @@ OffTheRecordProfileIOData::InitializeAppRequestContext(
scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(
new net::URLRequestJobFactoryImpl());
- bool set_protocol = job_factory->SetProtocolHandler(
- chrome::kBlobScheme, blob_protocol_handler.release());
- DCHECK(set_protocol);
- set_protocol = job_factory->SetProtocolHandler(
- chrome::kFileSystemScheme, file_system_protocol_handler.release());
- DCHECK(set_protocol);
- set_protocol = job_factory->SetProtocolHandler(
- chrome::kChromeUIScheme, chrome_protocol_handler.release());
- DCHECK(set_protocol);
- set_protocol = job_factory->SetProtocolHandler(
- chrome::kChromeDevToolsScheme,
- chrome_devtools_protocol_handler.release());
- DCHECK(set_protocol);
+ InstallProtocolHandlers(job_factory.get(), protocol_handlers);
scoped_ptr<net::URLRequestJobFactory> top_job_factory;
top_job_factory = SetUpJobFactoryDefaults(job_factory.Pass(),
protocol_handler_interceptor.Pass(),
network_delegate(),
context->ftp_transaction_factory(),
context->ftp_auth_cache());
- top_job_factory.reset(new net::ProtocolInterceptJobFactory(
- top_job_factory.Pass(), developer_protocol_handler.Pass()));
context->SetJobFactory(top_job_factory.Pass());
return context;
}
@@ -413,25 +344,12 @@ OffTheRecordProfileIOData::AcquireIsolatedAppRequestContext(
const StoragePartitionDescriptor& partition_descriptor,
scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const {
+ content::ProtocolHandlerMap* protocol_handlers) const {
// We create per-app contexts on demand, unlike the others above.
ChromeURLRequestContext* app_request_context =
InitializeAppRequestContext(main_context, partition_descriptor,
protocol_handler_interceptor.Pass(),
- blob_protocol_handler.Pass(),
- file_system_protocol_handler.Pass(),
- developer_protocol_handler.Pass(),
- chrome_protocol_handler.Pass(),
- chrome_devtools_protocol_handler.Pass());
+ protocol_handlers);
DCHECK(app_request_context);
return app_request_context;
}
diff --git a/chrome/browser/profiles/off_the_record_profile_io_data.h b/chrome/browser/profiles/off_the_record_profile_io_data.h
index ed37d48..cfa6cb6 100644
--- a/chrome/browser/profiles/off_the_record_profile_io_data.h
+++ b/chrome/browser/profiles/off_the_record_profile_io_data.h
@@ -44,16 +44,7 @@ class OffTheRecordProfileIOData : public ProfileIOData {
content::ResourceContext* GetResourceContextNoInit() const;
scoped_refptr<ChromeURLRequestContextGetter>
CreateMainRequestContextGetter(
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const;
+ content::ProtocolHandlerMap* protocol_handlers) const;
scoped_refptr<ChromeURLRequestContextGetter>
GetExtensionsRequestContextGetter() const;
scoped_refptr<ChromeURLRequestContextGetter>
@@ -64,16 +55,7 @@ class OffTheRecordProfileIOData : public ProfileIOData {
CreateIsolatedAppRequestContextGetter(
const base::FilePath& partition_path,
bool in_memory,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const;
+ content::ProtocolHandlerMap* protocol_handlers) const;
private:
typedef std::map<StoragePartitionDescriptor,
@@ -120,16 +102,7 @@ class OffTheRecordProfileIOData : public ProfileIOData {
virtual void InitializeInternal(
ProfileParams* profile_params,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const OVERRIDE;
+ content::ProtocolHandlerMap* protocol_handlers) const OVERRIDE;
virtual void InitializeExtensionsRequestContext(
ProfileParams* profile_params) const OVERRIDE;
virtual ChromeURLRequestContext* InitializeAppRequestContext(
@@ -137,16 +110,7 @@ class OffTheRecordProfileIOData : public ProfileIOData {
const StoragePartitionDescriptor& partition_descriptor,
scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const OVERRIDE;
+ content::ProtocolHandlerMap* protocol_handlers) const OVERRIDE;
virtual ChromeURLRequestContext* InitializeMediaRequestContext(
ChromeURLRequestContext* original_context,
const StoragePartitionDescriptor& partition_descriptor) const OVERRIDE;
@@ -158,16 +122,7 @@ class OffTheRecordProfileIOData : public ProfileIOData {
const StoragePartitionDescriptor& partition_descriptor,
scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const OVERRIDE;
+ content::ProtocolHandlerMap* protocol_handlers) const OVERRIDE;
virtual ChromeURLRequestContext*
AcquireIsolatedMediaRequestContext(
ChromeURLRequestContext* app_context,
diff --git a/chrome/browser/profiles/profile.h b/chrome/browser/profiles/profile.h
index 1256c36..a5ae599 100644
--- a/chrome/browser/profiles/profile.h
+++ b/chrome/browser/profiles/profile.h
@@ -14,6 +14,7 @@
#include "base/logging.h"
#include "chrome/browser/net/pref_proxy_config_tracker.h"
#include "content/public/browser/browser_context.h"
+#include "content/public/browser/content_browser_client.h"
#include "net/url_request/url_request_job_factory.h"
class ChromeAppCacheService;
@@ -255,16 +256,7 @@ class Profile : public content::BrowserContext {
// ContextBrowserClient to call this function.
// TODO(ajwong): Remove once http://crbug.com/159193 is resolved.
virtual net::URLRequestContextGetter* CreateRequestContext(
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) = 0;
+ content::ProtocolHandlerMap* protocol_handlers) = 0;
// Creates the net::URLRequestContextGetter for a StoragePartition. Should
// only be called once per partition_path per ContentBrowserClient object.
@@ -275,16 +267,7 @@ class Profile : public content::BrowserContext {
virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
const base::FilePath& partition_path,
bool in_memory,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) = 0;
+ content::ProtocolHandlerMap* protocol_handlers) = 0;
// Returns the last directory that was chosen for uploading or opening a file.
virtual base::FilePath last_selected_directory() = 0;
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 128197d..2b1020d 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -821,22 +821,9 @@ base::FilePath ProfileImpl::GetPrefFilePath() {
}
net::URLRequestContextGetter* ProfileImpl::CreateRequestContext(
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) {
+ content::ProtocolHandlerMap* protocol_handlers) {
return io_data_.CreateMainRequestContextGetter(
- blob_protocol_handler.Pass(),
- file_system_protocol_handler.Pass(),
- developer_protocol_handler.Pass(),
- chrome_protocol_handler.Pass(),
- chrome_devtools_protocol_handler.Pass(),
+ protocol_handlers,
g_browser_process->local_state(),
g_browser_process->io_thread());
}
@@ -888,20 +875,9 @@ net::URLRequestContextGetter*
ProfileImpl::CreateRequestContextForStoragePartition(
const base::FilePath& partition_path,
bool in_memory,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) {
+ content::ProtocolHandlerMap* protocol_handlers) {
return io_data_.CreateIsolatedAppRequestContextGetter(
- partition_path, in_memory, blob_protocol_handler.Pass(),
- file_system_protocol_handler.Pass(), developer_protocol_handler.Pass(),
- chrome_protocol_handler.Pass(), chrome_devtools_protocol_handler.Pass());
+ partition_path, in_memory, protocol_handlers);
}
net::SSLConfigService* ProfileImpl::GetSSLConfigService() {
diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h
index 7e0fa0e..455414c 100644
--- a/chrome/browser/profiles/profile_impl.h
+++ b/chrome/browser/profiles/profile_impl.h
@@ -17,6 +17,7 @@
#include "base/timer.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_impl_io_data.h"
+#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/host_zoom_map.h"
class NetPrefObserver;
@@ -106,29 +107,11 @@ class ProfileImpl : public Profile {
virtual bool IsSameProfile(Profile* profile) OVERRIDE;
virtual base::Time GetStartTime() const OVERRIDE;
virtual net::URLRequestContextGetter* CreateRequestContext(
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) OVERRIDE;
+ content::ProtocolHandlerMap* protocol_handlers) OVERRIDE;
virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
const base::FilePath& partition_path,
bool in_memory,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) OVERRIDE;
+ content::ProtocolHandlerMap* protocol_handlers) OVERRIDE;
virtual base::FilePath last_selected_directory() OVERRIDE;
virtual void set_last_selected_directory(const base::FilePath& path) OVERRIDE;
virtual chrome_browser_net::Predictor* GetNetworkPredictor() OVERRIDE;
diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc
index f4ee923..644377d 100644
--- a/chrome/browser/profiles/profile_impl_io_data.cc
+++ b/chrome/browser/profiles/profile_impl_io_data.cc
@@ -128,25 +128,14 @@ ProfileImplIOData::Handle::GetResourceContextNoInit() const {
scoped_refptr<ChromeURLRequestContextGetter>
ProfileImplIOData::Handle::CreateMainRequestContextGetter(
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler,
+ content::ProtocolHandlerMap* protocol_handlers,
PrefService* local_state,
IOThread* io_thread) const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
LazyInitialize();
DCHECK(!main_request_context_getter_);
main_request_context_getter_ = ChromeURLRequestContextGetter::CreateOriginal(
- profile_, io_data_, blob_protocol_handler.Pass(),
- file_system_protocol_handler.Pass(), developer_protocol_handler.Pass(),
- chrome_protocol_handler.Pass(), chrome_devtools_protocol_handler.Pass());
+ profile_, io_data_, protocol_handlers);
io_data_->predictor_->InitNetworkPredictor(profile_->GetPrefs(),
local_state,
@@ -188,16 +177,7 @@ scoped_refptr<ChromeURLRequestContextGetter>
ProfileImplIOData::Handle::CreateIsolatedAppRequestContextGetter(
const base::FilePath& partition_path,
bool in_memory,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const {
+ content::ProtocolHandlerMap* protocol_handlers) const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// Check that the partition_path is not the same as the base profile path. We
// expect isolated partition, which will never go to the default profile path.
@@ -218,10 +198,8 @@ ProfileImplIOData::Handle::CreateIsolatedAppRequestContextGetter(
ChromeURLRequestContextGetter* context =
ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp(
profile_, io_data_, descriptor,
- protocol_handler_interceptor.Pass(), blob_protocol_handler.Pass(),
- file_system_protocol_handler.Pass(),
- developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(),
- chrome_devtools_protocol_handler.Pass());
+ protocol_handler_interceptor.Pass(),
+ protocol_handlers);
app_request_context_getter_map_[descriptor] = context;
return context;
@@ -317,16 +295,7 @@ ProfileImplIOData::~ProfileImplIOData() {
void ProfileImplIOData::InitializeInternal(
ProfileParams* profile_params,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const {
+ content::ProtocolHandlerMap* protocol_handlers) const {
ChromeURLRequestContext* main_context = main_request_context();
IOThread* const io_thread = profile_params->io_thread;
@@ -447,27 +416,13 @@ void ProfileImplIOData::InitializeInternal(
scoped_ptr<net::URLRequestJobFactoryImpl> main_job_factory(
new net::URLRequestJobFactoryImpl());
- bool set_protocol = main_job_factory->SetProtocolHandler(
- chrome::kBlobScheme, blob_protocol_handler.release());
- DCHECK(set_protocol);
- set_protocol = main_job_factory->SetProtocolHandler(
- chrome::kFileSystemScheme, file_system_protocol_handler.release());
- DCHECK(set_protocol);
- set_protocol = main_job_factory->SetProtocolHandler(
- chrome::kChromeUIScheme, chrome_protocol_handler.release());
- DCHECK(set_protocol);
- set_protocol = main_job_factory->SetProtocolHandler(
- chrome::kChromeDevToolsScheme,
- chrome_devtools_protocol_handler.release());
- DCHECK(set_protocol);
+ InstallProtocolHandlers(main_job_factory.get(), protocol_handlers);
main_job_factory_ = SetUpJobFactoryDefaults(
main_job_factory.Pass(),
profile_params->protocol_handler_interceptor.Pass(),
network_delegate(),
main_context->ftp_transaction_factory(),
main_context->ftp_auth_cache());
- main_job_factory_.reset(new net::ProtocolInterceptJobFactory(
- main_job_factory_.Pass(), developer_protocol_handler.Pass()));
main_context->set_job_factory(main_job_factory_.get());
#if defined(ENABLE_EXTENSIONS)
@@ -539,16 +494,7 @@ ProfileImplIOData::InitializeAppRequestContext(
const StoragePartitionDescriptor& partition_descriptor,
scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const {
+ content::ProtocolHandlerMap* protocol_handlers) const {
// Copy most state from the main context.
AppRequestContext* context = new AppRequestContext(load_time_stats());
context->CopyFrom(main_context);
@@ -620,19 +566,7 @@ ProfileImplIOData::InitializeAppRequestContext(
scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(
new net::URLRequestJobFactoryImpl());
- bool set_protocol = job_factory->SetProtocolHandler(
- chrome::kBlobScheme, blob_protocol_handler.release());
- DCHECK(set_protocol);
- set_protocol = job_factory->SetProtocolHandler(
- chrome::kFileSystemScheme, file_system_protocol_handler.release());
- DCHECK(set_protocol);
- set_protocol = job_factory->SetProtocolHandler(
- chrome::kChromeUIScheme, chrome_protocol_handler.release());
- DCHECK(set_protocol);
- set_protocol = job_factory->SetProtocolHandler(
- chrome::kChromeDevToolsScheme,
- chrome_devtools_protocol_handler.release());
- DCHECK(set_protocol);
+ InstallProtocolHandlers(job_factory.get(), protocol_handlers);
scoped_ptr<net::URLRequestJobFactory> top_job_factory;
// Overwrite the job factory that we inherit from the main context so
// that we can later provide our own handlers for storage related protocols.
@@ -647,8 +581,6 @@ ProfileImplIOData::InitializeAppRequestContext(
} else {
top_job_factory = job_factory.PassAs<net::URLRequestJobFactory>();
}
- top_job_factory.reset(new net::ProtocolInterceptJobFactory(
- top_job_factory.Pass(), developer_protocol_handler.Pass()));
context->SetJobFactory(top_job_factory.Pass());
return context;
@@ -714,25 +646,12 @@ ProfileImplIOData::AcquireIsolatedAppRequestContext(
const StoragePartitionDescriptor& partition_descriptor,
scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const {
+ content::ProtocolHandlerMap* protocol_handlers) const {
// We create per-app contexts on demand, unlike the others above.
ChromeURLRequestContext* app_request_context =
InitializeAppRequestContext(main_context, partition_descriptor,
protocol_handler_interceptor.Pass(),
- blob_protocol_handler.Pass(),
- file_system_protocol_handler.Pass(),
- developer_protocol_handler.Pass(),
- chrome_protocol_handler.Pass(),
- chrome_devtools_protocol_handler.Pass());
+ protocol_handlers);
DCHECK(app_request_context);
return app_request_context;
}
diff --git a/chrome/browser/profiles/profile_impl_io_data.h b/chrome/browser/profiles/profile_impl_io_data.h
index 670d3b7..8fa27a7 100644
--- a/chrome/browser/profiles/profile_impl_io_data.h
+++ b/chrome/browser/profiles/profile_impl_io_data.h
@@ -54,32 +54,14 @@ class ProfileImplIOData : public ProfileIOData {
// these functions.
scoped_refptr<ChromeURLRequestContextGetter>
CreateMainRequestContextGetter(
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler,
+ content::ProtocolHandlerMap* protocol_handlers,
PrefService* local_state,
IOThread* io_thread) const;
scoped_refptr<ChromeURLRequestContextGetter>
CreateIsolatedAppRequestContextGetter(
const base::FilePath& partition_path,
bool in_memory,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const;
+ content::ProtocolHandlerMap* protocol_handlers) const;
content::ResourceContext* GetResourceContext() const;
// GetResourceContextNoInit() does not call LazyInitialize() so it can be
@@ -166,16 +148,7 @@ class ProfileImplIOData : public ProfileIOData {
virtual void InitializeInternal(
ProfileParams* profile_params,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const OVERRIDE;
+ content::ProtocolHandlerMap* protocol_handlers) const OVERRIDE;
virtual void InitializeExtensionsRequestContext(
ProfileParams* profile_params) const OVERRIDE;
virtual ChromeURLRequestContext* InitializeAppRequestContext(
@@ -183,16 +156,7 @@ class ProfileImplIOData : public ProfileIOData {
const StoragePartitionDescriptor& partition_descriptor,
scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const OVERRIDE;
+ content::ProtocolHandlerMap* protocol_handlers) const OVERRIDE;
virtual ChromeURLRequestContext* InitializeMediaRequestContext(
ChromeURLRequestContext* original_context,
const StoragePartitionDescriptor& partition_descriptor) const OVERRIDE;
@@ -204,16 +168,7 @@ class ProfileImplIOData : public ProfileIOData {
const StoragePartitionDescriptor& partition_descriptor,
scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const OVERRIDE;
+ content::ProtocolHandlerMap* protocol_handlers) const OVERRIDE;
virtual ChromeURLRequestContext*
AcquireIsolatedMediaRequestContext(
ChromeURLRequestContext* app_context,
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
index f3b2bd8..9dc346c 100644
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -431,6 +431,7 @@ bool ProfileIOData::IsHandledProtocol(const std::string& scheme) {
chrome::kBlobScheme,
chrome::kFileSystemScheme,
chrome::kExtensionResourceScheme,
+ chrome::kChromeSearchScheme,
};
for (size_t i = 0; i < arraysize(kProtocolList); ++i) {
if (scheme == kProtocolList[i])
@@ -439,6 +440,7 @@ bool ProfileIOData::IsHandledProtocol(const std::string& scheme) {
return net::URLRequest::IsHandledProtocol(scheme);
}
+// static
bool ProfileIOData::IsHandledURL(const GURL& url) {
if (!url.is_valid()) {
// We handle error cases.
@@ -448,6 +450,21 @@ bool ProfileIOData::IsHandledURL(const GURL& url) {
return IsHandledProtocol(url.scheme());
}
+// static
+void ProfileIOData::InstallProtocolHandlers(
+ net::URLRequestJobFactoryImpl* job_factory,
+ content::ProtocolHandlerMap* protocol_handlers) {
+ for (content::ProtocolHandlerMap::iterator it =
+ protocol_handlers->begin();
+ it != protocol_handlers->end();
+ ++it) {
+ bool set_protocol = job_factory->SetProtocolHandler(
+ it->first, it->second.release());
+ DCHECK(set_protocol);
+ }
+ protocol_handlers->clear();
+}
+
content::ResourceContext* ProfileIOData::GetResourceContext() const {
return resource_context_.get();
}
@@ -474,16 +491,7 @@ ChromeURLRequestContext* ProfileIOData::GetIsolatedAppRequestContext(
const StoragePartitionDescriptor& partition_descriptor,
scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const {
+ content::ProtocolHandlerMap* protocol_handlers) const {
DCHECK(initialized_);
ChromeURLRequestContext* context = NULL;
if (ContainsKey(app_request_context_map_, partition_descriptor)) {
@@ -491,9 +499,7 @@ ChromeURLRequestContext* ProfileIOData::GetIsolatedAppRequestContext(
} else {
context = AcquireIsolatedAppRequestContext(
main_context, partition_descriptor, protocol_handler_interceptor.Pass(),
- blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(),
- developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(),
- chrome_devtools_protocol_handler.Pass());
+ protocol_handlers);
app_request_context_map_[partition_descriptor] = context;
}
DCHECK(context);
@@ -603,17 +609,7 @@ std::string ProfileIOData::GetSSLSessionCacheShard() {
return StringPrintf("profile/%u", ssl_session_cache_instance++);
}
-void ProfileIOData::Init(
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const {
+void ProfileIOData::Init(content::ProtocolHandlerMap* protocol_handlers) const {
// The basic logic is implemented here. The specific initialization
// is done in InitializeInternal(), implemented by subtypes. Static helper
// functions have been provided to assist in common operations.
@@ -695,12 +691,7 @@ void ProfileIOData::Init(
managed_mode_url_filter_ = profile_params_->managed_mode_url_filter;
#endif
- InitializeInternal(profile_params_.get(),
- blob_protocol_handler.Pass(),
- file_system_protocol_handler.Pass(),
- developer_protocol_handler.Pass(),
- chrome_protocol_handler.Pass(),
- chrome_devtools_protocol_handler.Pass());
+ InitializeInternal(profile_params_.get(), protocol_handlers);
profile_params_.reset();
initialized_ = true;
diff --git a/chrome/browser/profiles/profile_io_data.h b/chrome/browser/profiles/profile_io_data.h
index ba57faf..406fa98 100644
--- a/chrome/browser/profiles/profile_io_data.h
+++ b/chrome/browser/profiles/profile_io_data.h
@@ -19,6 +19,7 @@
#include "chrome/browser/io_thread.h"
#include "chrome/browser/net/chrome_url_request_context.h"
#include "chrome/browser/profiles/storage_partition_descriptor.h"
+#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/resource_context.h"
#include "net/cookies/cookie_monster.h"
#include "net/http/http_network_session.h"
@@ -77,23 +78,20 @@ class ProfileIOData {
// net::URLRequest.
static bool IsHandledURL(const GURL& url);
+ // Utility to install additional WebUI handlers into the |job_factory|.
+ // Ownership of the handlers is transfered from |protocol_handlers|
+ // to the |job_factory|.
+ static void InstallProtocolHandlers(
+ net::URLRequestJobFactoryImpl* job_factory,
+ content::ProtocolHandlerMap* protocol_handlers);
+
// Called by Profile.
content::ResourceContext* GetResourceContext() const;
// Initializes the ProfileIOData object and primes the RequestContext
// generation. Must be called prior to any of the Get*() methods other than
// GetResouceContext or GetMetricsEnabledStateOnIOThread.
- void Init(
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const;
+ void Init(content::ProtocolHandlerMap* protocol_handlers) const;
ChromeURLRequestContext* GetMainRequestContext() const;
ChromeURLRequestContext* GetMediaRequestContext() const;
@@ -103,16 +101,7 @@ class ProfileIOData {
const StoragePartitionDescriptor& partition_descriptor,
scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const;
+ content::ProtocolHandlerMap* protocol_handlers) const;
ChromeURLRequestContext* GetIsolatedMediaRequestContext(
ChromeURLRequestContext* app_context,
const StoragePartitionDescriptor& partition_descriptor) const;
@@ -386,16 +375,7 @@ class ProfileIOData {
// should use the static helper functions above to implement this.
virtual void InitializeInternal(
ProfileParams* profile_params,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const = 0;
+ content::ProtocolHandlerMap* protocol_handlers) const = 0;
// Initializes the RequestContext for extensions.
virtual void InitializeExtensionsRequestContext(
@@ -407,16 +387,7 @@ class ProfileIOData {
const StoragePartitionDescriptor& details,
scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const = 0;
+ content::ProtocolHandlerMap* protocol_handlers) const = 0;
// Does an on-demand initialization of a media RequestContext for the given
// isolated app.
@@ -434,16 +405,7 @@ class ProfileIOData {
const StoragePartitionDescriptor& partition_descriptor,
scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const = 0;
+ content::ProtocolHandlerMap* protocol_handlers) const = 0;
virtual ChromeURLRequestContext*
AcquireIsolatedMediaRequestContext(
ChromeURLRequestContext* app_context,