| 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..0c0a3f8a96888a3c4172b7646d2700c8cc52bfca 100644
|
| --- a/chrome/browser/net/chrome_url_request_context.cc
|
| +++ b/chrome/browser/net/chrome_url_request_context.cc
|
| @@ -43,43 +43,24 @@ class FactoryForMain : public ChromeURLRequestContextFactory {
|
| 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)
|
| + content::ProtocolHandlerMap* protocol_handlers)
|
| : 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()) {}
|
| + developer_protocol_handler_(developer_protocol_handler.Pass()) {
|
| + 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(developer_protocol_handler_.Pass(),
|
| + &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.
|
| @@ -106,25 +87,15 @@ class FactoryForIsolatedApp : public ChromeURLRequestContextFactory {
|
| 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()) {}
|
| + developer_protocol_handler_(developer_protocol_handler.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 +104,11 @@ 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(),
|
| + main_request_context_getter_->GetIOContext(),
|
| + partition_descriptor_,
|
| + protocol_handler_interceptor_.Pass(),
|
| developer_protocol_handler_.Pass(),
|
| - chrome_protocol_handler_.Pass(),
|
| - chrome_devtools_protocol_handler_.Pass());
|
| + &protocol_handlers_);
|
| }
|
|
|
| private:
|
| @@ -149,15 +119,8 @@ class FactoryForIsolatedApp : public ChromeURLRequestContextFactory {
|
| 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
|
| @@ -245,23 +208,13 @@ 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()));
|
| + protocol_handlers));
|
| }
|
|
|
| // static
|
| @@ -291,24 +244,15 @@ ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp(
|
| 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()));
|
| + developer_protocol_handler.Pass(), protocol_handlers));
|
| }
|
|
|
| // static
|
| @@ -330,23 +274,13 @@ 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) {
|
| + developer_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()));
|
| + protocol_handlers));
|
| }
|
|
|
| // static
|
| @@ -367,24 +301,15 @@ ChromeURLRequestContextGetter::CreateOffTheRecordForIsolatedApp(
|
| 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()));
|
| + developer_protocol_handler.Pass(), protocol_handlers));
|
| }
|
|
|
| // ----------------------------------------------------------------------------
|
|
|