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

Unified Diff: chrome/browser/profiles/profile_impl_io_data.cc

Issue 11293252: Change Interceptors into URLRequestJobFactory::ProtocolHandlers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address erikwright's third round of comments Created 8 years 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/profiles/profile_impl_io_data.cc
diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc
index 568274e41153e18314efc45170f49291a55ae0a8..9a71cefc2b8ea0baf50ef05827f54ca208bcf6ce 100644
--- a/chrome/browser/profiles/profile_impl_io_data.cc
+++ b/chrome/browser/profiles/profile_impl_io_data.cc
@@ -420,12 +420,12 @@ void ProfileImplIOData::LazyInitializeInternal(
scoped_ptr<net::URLRequestJobFactoryImpl> main_job_factory(
new net::URLRequestJobFactoryImpl());
- SetUpJobFactory(main_job_factory.get(),
- profile_params->protocol_handler_interceptor.Pass(),
- network_delegate(),
- main_context->ftp_transaction_factory(),
- main_context->ftp_auth_cache());
- main_job_factory_ = main_job_factory.Pass();
+ main_job_factory_ = SetUpJobFactory(
+ main_job_factory.Pass(),
+ profile_params->protocol_handler_interceptor.Pass(),
+ network_delegate(),
+ main_context->ftp_transaction_factory(),
+ main_context->ftp_auth_cache());
main_context->set_job_factory(main_job_factory_.get());
#if defined(ENABLE_EXTENSIONS)
@@ -479,12 +479,13 @@ void ProfileImplIOData::
// job_factory::IsHandledProtocol return true, which prevents attempts to
// handle the protocol externally. We pass NULL in to
// SetUpJobFactory() to get this effect.
- SetUpJobFactory(extensions_job_factory.get(),
- scoped_ptr<net::URLRequestJobFactoryImpl::Interceptor>(NULL),
- NULL,
- extensions_context->ftp_transaction_factory(),
- extensions_context->ftp_auth_cache());
- extensions_job_factory_ = extensions_job_factory.Pass();
+ extensions_job_factory_ = SetUpJobFactory(
+ extensions_job_factory.Pass(),
+ scoped_ptr<net::URLRequestJobFactoryImpl::Interceptor>(NULL),
+ NULL,
+ extensions_context->ftp_transaction_factory(),
+ extensions_context->ftp_auth_cache());
+
extensions_context->set_job_factory(extensions_job_factory_.get());
}
@@ -560,15 +561,19 @@ ProfileImplIOData::InitializeAppRequestContext(
// that we can later provide our own handles for storage related protocols.
willchan no longer on Chromium 2012/12/11 19:14:38 s/handles/handlers/
// Install all the usual protocol handlers unless we are in a browser plugin
// guest process, in which case only web-safe schemes are allowed.
- scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(
+ scoped_ptr<net::URLRequestJobFactoryImpl> base_job_factory(
new net::URLRequestJobFactoryImpl());
+ scoped_ptr<net::URLRequestJobFactory> top_job_factory;
if (!partition_descriptor.in_memory) {
- SetUpJobFactory(job_factory.get(), protocol_handler_interceptor.Pass(),
- network_delegate(),
- context->ftp_transaction_factory(),
- context->ftp_auth_cache());
+ top_job_factory = SetUpJobFactory(base_job_factory.Pass(),
willchan no longer on Chromium 2012/12/11 19:14:38 Now that you're returning it, perhas we should ren
+ protocol_handler_interceptor.Pass(),
+ network_delegate(),
+ context->ftp_transaction_factory(),
+ context->ftp_auth_cache());
+ } else {
+ top_job_factory = base_job_factory.PassAs<net::URLRequestJobFactory>();
}
- context->SetJobFactory(job_factory.PassAs<net::URLRequestJobFactory>());
+ context->SetJobFactory(top_job_factory.Pass());
return context;
}
@@ -657,21 +662,22 @@ chrome_browser_net::LoadTimeStats* ProfileImplIOData::GetLoadTimeStats(
return io_thread_globals->load_time_stats.get();
}
-void ProfileImplIOData::SetUpJobFactory(
- net::URLRequestJobFactoryImpl* job_factory,
+scoped_ptr<net::URLRequestJobFactory> ProfileImplIOData::SetUpJobFactory(
+ scoped_ptr<net::URLRequestJobFactoryImpl> job_factory,
scoped_ptr<net::URLRequestJobFactory::Interceptor>
protocol_handler_interceptor,
net::NetworkDelegate* network_delegate,
net::FtpTransactionFactory* ftp_transaction_factory,
net::FtpAuthCache* ftp_auth_cache) const {
- SetUpJobFactoryDefaults(job_factory, protocol_handler_interceptor.Pass(),
- network_delegate, ftp_transaction_factory,
- ftp_auth_cache);
-
- job_factory->AddInterceptor(
- new chrome_browser_net::ConnectInterceptor(predictor_.get()));
job_factory->AddInterceptor(
new DoubleGetExperimentInterceptor(NULL));
+ scoped_ptr<net::URLRequestJobFactory> top_job_factory =
+ SetUpJobFactoryDefaults(job_factory.Pass(),
willchan no longer on Chromium 2012/12/11 19:14:38 Ditto here. Maybe this should be CreateDefaultJobF
+ protocol_handler_interceptor.Pass(),
+ network_delegate, ftp_transaction_factory,
+ ftp_auth_cache);
+ return chrome_browser_net::ConnectInterceptor::CreateURLRequestJobFactory(
+ top_job_factory.Pass(), predictor_.get());
}
void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread(

Powered by Google App Engine
This is Rietveld 408576698