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

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: include nit Created 7 years, 10 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 21d375399e09f3db3c9ba5913106cec90bfc0714..fa65bd08850783a383dad83a5fab2af63f524243 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.
@@ -133,12 +95,10 @@ class FactoryForIsolatedApp : public ChromeURLRequestContextFactory {
// factory is actually destroyed. Thus it is safe to destructively pass
// state onwards.
return profile_io_data_->GetIsolatedAppRequestContext(
- main_request_context_getter_->GetIOContext(), 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());
+ main_request_context_getter_->GetIOContext(),
+ partition_descriptor_,
+ protocol_handler_interceptor_.Pass(),
+ &protocol_handlers_);
}
private:
@@ -148,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 +195,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 +227,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 +256,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 +279,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));
}
// ----------------------------------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698