Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2182)

Unified Diff: chrome/browser/net/chrome_url_request_context.cc

Issue 11308362: Add StoragePartition's ProtocolHandlers at URLRequestContext construction time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync (r175140) Created 7 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/net/chrome_url_request_context.cc
diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc
index 677ed0a7ca76103e7072a6364f309bbe6b5f7611..0fdaa79670e9d803ec558b87c3f544d503614145 100644
--- a/chrome/browser/net/chrome_url_request_context.cc
+++ b/chrome/browser/net/chrome_url_request_context.cc
@@ -40,15 +40,33 @@ namespace {
// Factory that creates the main ChromeURLRequestContext.
class FactoryForMain : public ChromeURLRequestContextFactory {
public:
- explicit FactoryForMain(const ProfileIOData* profile_io_data)
- : profile_io_data_(profile_io_data) {}
+ FactoryForMain(
+ const ProfileIOData* profile_io_data,
+ scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
+ blob_protocol_handler,
+ scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
+ file_system_protocol_handler,
+ scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ developer_protocol_handler)
+ : profile_io_data_(profile_io_data),
+ blob_protocol_handler_(blob_protocol_handler.Pass()),
+ file_system_protocol_handler_(file_system_protocol_handler.Pass()),
+ developer_protocol_handler_(developer_protocol_handler.Pass()) {}
virtual ChromeURLRequestContext* Create() OVERRIDE {
+ profile_io_data_->Init(blob_protocol_handler_.Pass(),
+ file_system_protocol_handler_.Pass(),
+ developer_protocol_handler_.Pass());
return profile_io_data_->GetMainRequestContext();
}
private:
const ProfileIOData* const profile_io_data_;
+ scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> blob_protocol_handler_;
+ scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
+ file_system_protocol_handler_;
+ scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ developer_protocol_handler_;
};
// Factory that creates the ChromeURLRequestContext for extensions.
@@ -72,11 +90,20 @@ class FactoryForIsolatedApp : public ChromeURLRequestContextFactory {
const StoragePartitionDescriptor& partition_descriptor,
ChromeURLRequestContextGetter* main_context,
scoped_ptr<net::URLRequestJobFactory::Interceptor>
- protocol_handler_interceptor)
+ protocol_handler_interceptor,
+ scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
+ blob_protocol_handler,
+ scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
+ file_system_protocol_handler,
+ scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ developer_protocol_handler)
: profile_io_data_(profile_io_data),
partition_descriptor_(partition_descriptor),
main_request_context_getter_(main_context),
- protocol_handler_interceptor_(protocol_handler_interceptor.Pass()) {}
+ protocol_handler_interceptor_(protocol_handler_interceptor.Pass()),
+ blob_protocol_handler_(blob_protocol_handler.Pass()),
+ file_system_protocol_handler_(file_system_protocol_handler.Pass()),
+ developer_protocol_handler_(developer_protocol_handler.Pass()) {}
virtual ChromeURLRequestContext* Create() OVERRIDE {
// We will copy most of the state from the main request context.
@@ -86,7 +113,9 @@ class FactoryForIsolatedApp : public ChromeURLRequestContextFactory {
// state onwards.
return profile_io_data_->GetIsolatedAppRequestContext(
main_request_context_getter_->GetIOContext(), partition_descriptor_,
- protocol_handler_interceptor_.Pass());
+ protocol_handler_interceptor_.Pass(), blob_protocol_handler_.Pass(),
+ file_system_protocol_handler_.Pass(),
+ developer_protocol_handler_.Pass());
}
private:
@@ -96,6 +125,12 @@ class FactoryForIsolatedApp : public ChromeURLRequestContextFactory {
main_request_context_getter_;
scoped_ptr<net::URLRequestJobFactory::Interceptor>
protocol_handler_interceptor_;
+ scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
+ blob_protocol_handler_;
+ scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
+ file_system_protocol_handler_;
+ scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ developer_protocol_handler_;
};
// Factory that creates the media ChromeURLRequestContext for a given isolated
@@ -181,10 +216,19 @@ ChromeURLRequestContextGetter::GetNetworkTaskRunner() const {
// static
ChromeURLRequestContextGetter* ChromeURLRequestContextGetter::CreateOriginal(
Profile* profile,
- const ProfileIOData* profile_io_data) {
+ const ProfileIOData* profile_io_data,
+ scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
+ blob_protocol_handler,
+ scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
+ file_system_protocol_handler,
+ scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ developer_protocol_handler) {
DCHECK(!profile->IsOffTheRecord());
return new ChromeURLRequestContextGetter(
- new FactoryForMain(profile_io_data));
+ new FactoryForMain(profile_io_data,
+ blob_protocol_handler.Pass(),
+ file_system_protocol_handler.Pass(),
+ developer_protocol_handler.Pass()));
}
// static
@@ -212,13 +256,21 @@ ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp(
const ProfileIOData* profile_io_data,
const StoragePartitionDescriptor& partition_descriptor,
scoped_ptr<net::URLRequestJobFactory::Interceptor>
- protocol_handler_interceptor) {
+ protocol_handler_interceptor,
+ scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
+ blob_protocol_handler,
+ scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
+ file_system_protocol_handler,
+ scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ developer_protocol_handler) {
DCHECK(!profile->IsOffTheRecord());
ChromeURLRequestContextGetter* main_context =
static_cast<ChromeURLRequestContextGetter*>(profile->GetRequestContext());
return new ChromeURLRequestContextGetter(
new FactoryForIsolatedApp(profile_io_data, partition_descriptor,
- main_context, protocol_handler_interceptor.Pass()));
+ main_context, protocol_handler_interceptor.Pass(),
+ blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(),
+ developer_protocol_handler.Pass()));
}
// static
@@ -237,10 +289,20 @@ ChromeURLRequestContextGetter::CreateOriginalForIsolatedMedia(
// static
ChromeURLRequestContextGetter*
ChromeURLRequestContextGetter::CreateOffTheRecord(
- Profile* profile, const ProfileIOData* profile_io_data) {
+ Profile* profile,
+ const ProfileIOData* profile_io_data,
+ scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
+ blob_protocol_handler,
+ scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
+ file_system_protocol_handler,
+ scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ developer_protocol_handler) {
DCHECK(profile->IsOffTheRecord());
return new ChromeURLRequestContextGetter(
- new FactoryForMain(profile_io_data));
+ new FactoryForMain(profile_io_data,
+ blob_protocol_handler.Pass(),
+ file_system_protocol_handler.Pass(),
+ developer_protocol_handler.Pass()));
}
// static
@@ -259,13 +321,21 @@ ChromeURLRequestContextGetter::CreateOffTheRecordForIsolatedApp(
const ProfileIOData* profile_io_data,
const StoragePartitionDescriptor& partition_descriptor,
scoped_ptr<net::URLRequestJobFactory::Interceptor>
- protocol_handler_interceptor) {
+ protocol_handler_interceptor,
+ scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
+ blob_protocol_handler,
+ scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
+ file_system_protocol_handler,
+ scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ developer_protocol_handler) {
DCHECK(profile->IsOffTheRecord());
ChromeURLRequestContextGetter* main_context =
static_cast<ChromeURLRequestContextGetter*>(profile->GetRequestContext());
return new ChromeURLRequestContextGetter(
new FactoryForIsolatedApp(profile_io_data, partition_descriptor,
- main_context, protocol_handler_interceptor.Pass()));
+ main_context, protocol_handler_interceptor.Pass(),
+ blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(),
+ developer_protocol_handler.Pass()));
}
// ----------------------------------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698