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

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

Issue 11896113: Add chrome-search: access from Instant overlay (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Yet another rebase Created 7 years, 9 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 91d9375960085ab069c07e20cd10809eec8325e2..f033aecc7faf42c3551fae02033da6ce7c76e17c 100644
--- a/chrome/browser/net/chrome_url_request_context.cc
+++ b/chrome/browser/net/chrome_url_request_context.cc
@@ -42,44 +42,19 @@ class FactoryForMain : public ChromeURLRequestContextFactory {
public:
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::ProtocolHandler>
- developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_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()),
- chrome_protocol_handler_(chrome_protocol_handler.Pass()),
- chrome_devtools_protocol_handler_(
- chrome_devtools_protocol_handler.Pass()) {}
+ content::ProtocolHandlerMap* protocol_handlers)
+ : profile_io_data_(profile_io_data) {
+ std::swap(protocol_handlers_, *protocol_handlers);
+ }
virtual ChromeURLRequestContext* Create() OVERRIDE {
- profile_io_data_->Init(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_->Init(&protocol_handlers_);
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::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_;
};
// Factory that creates the ChromeURLRequestContext for extensions.
@@ -105,26 +80,13 @@ class FactoryForIsolatedApp : public ChromeURLRequestContextFactory {
ChromeURLRequestContextGetter* main_context,
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)
+ content::ProtocolHandlerMap* protocol_handlers)
: profile_io_data_(profile_io_data),
partition_descriptor_(partition_descriptor),
main_request_context_getter_(main_context),
- 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()),
- chrome_protocol_handler_(chrome_protocol_handler.Pass()),
- chrome_devtools_protocol_handler_(
- chrome_devtools_protocol_handler.Pass()) {}
+ protocol_handler_interceptor_(protocol_handler_interceptor.Pass()) {
+ std::swap(protocol_handlers_, *protocol_handlers);
+ }
virtual ChromeURLRequestContext* Create() OVERRIDE {
// We will copy most of the state from the main request context.
@@ -134,10 +96,9 @@ class FactoryForIsolatedApp : public ChromeURLRequestContextFactory {
// state onwards.
return profile_io_data_->GetIsolatedAppRequestContext(
main_request_context_getter_->GetURLRequestContext(),
- 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());
+ partition_descriptor_,
+ protocol_handler_interceptor_.Pass(),
+ &protocol_handlers_);
}
private:
@@ -147,16 +108,7 @@ class FactoryForIsolatedApp : public ChromeURLRequestContextFactory {
main_request_context_getter_;
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_;
+ content::ProtocolHandlerMap protocol_handlers_;
};
// Factory that creates the media ChromeURLRequestContext for a given isolated
@@ -244,24 +196,10 @@ ChromeURLRequestContextGetter::GetNetworkTaskRunner() const {
ChromeURLRequestContextGetter* ChromeURLRequestContextGetter::CreateOriginal(
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::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) {
DCHECK(!profile->IsOffTheRecord());
return new ChromeURLRequestContextGetter(
- new FactoryForMain(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()));
+ new FactoryForMain(profile_io_data, protocol_handlers));
}
// static
@@ -290,25 +228,15 @@ ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp(
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) {
+ content::ProtocolHandlerMap* protocol_handlers) {
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(),
- blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(),
- developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(),
- chrome_devtools_protocol_handler.Pass()));
+ main_context,
+ protocol_handler_interceptor.Pass(),
+ protocol_handlers));
}
// static
@@ -329,24 +257,10 @@ ChromeURLRequestContextGetter*
ChromeURLRequestContextGetter::CreateOffTheRecord(
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::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) {
DCHECK(profile->IsOffTheRecord());
return new ChromeURLRequestContextGetter(
- new FactoryForMain(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()));
+ new FactoryForMain(profile_io_data, protocol_handlers));
}
// static
@@ -366,25 +280,15 @@ ChromeURLRequestContextGetter::CreateOffTheRecordForIsolatedApp(
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) {
+ content::ProtocolHandlerMap* protocol_handlers) {
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(),
- blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(),
- developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(),
- chrome_devtools_protocol_handler.Pass()));
+ main_context,
+ protocol_handler_interceptor.Pass(),
+ protocol_handlers));
}
// ----------------------------------------------------------------------------
« no previous file with comments | « chrome/browser/net/chrome_url_request_context.h ('k') | chrome/browser/profiles/off_the_record_profile_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698