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

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

Issue 187223003: Allow content layer to pass ProtocolInterceptors when we create URLRequestContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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/profiles/off_the_record_profile_io_data.cc
diff --git a/chrome/browser/profiles/off_the_record_profile_io_data.cc b/chrome/browser/profiles/off_the_record_profile_io_data.cc
index d614370cbff69c95d463acdc8954b53f0ea2aefd..1697d093b67d705b8326c76e6fa11ed3e8c289c0 100644
--- a/chrome/browser/profiles/off_the_record_profile_io_data.cc
+++ b/chrome/browser/profiles/off_the_record_profile_io_data.cc
@@ -71,7 +71,8 @@ OffTheRecordProfileIOData::Handle::GetResourceContextNoInit() const {
scoped_refptr<ChromeURLRequestContextGetter>
OffTheRecordProfileIOData::Handle::CreateMainRequestContextGetter(
- content::ProtocolHandlerMap* protocol_handlers) const {
+ content::ProtocolHandlerMap* protocol_handlers,
+ content::ProtocolHandlerScopedVector protocol_interceptors) const {
// TODO(oshima): Re-enable when ChromeOS only accesses the profile on the UI
// thread.
#if !defined(OS_CHROMEOS)
@@ -79,9 +80,8 @@ OffTheRecordProfileIOData::Handle::CreateMainRequestContextGetter(
#endif // defined(OS_CHROMEOS)
LazyInitialize();
DCHECK(!main_request_context_getter_.get());
- main_request_context_getter_ =
- ChromeURLRequestContextGetter::Create(
- profile_, io_data_, protocol_handlers);
+ main_request_context_getter_ = ChromeURLRequestContextGetter::Create(
+ profile_, io_data_, protocol_handlers, protocol_interceptors.Pass());
return main_request_context_getter_;
}
@@ -116,7 +116,8 @@ scoped_refptr<ChromeURLRequestContextGetter>
OffTheRecordProfileIOData::Handle::CreateIsolatedAppRequestContextGetter(
const base::FilePath& partition_path,
bool in_memory,
- content::ProtocolHandlerMap* protocol_handlers) const {
+ content::ProtocolHandlerMap* protocol_handlers,
+ content::ProtocolHandlerScopedVector protocol_interceptors) const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!partition_path.empty());
LazyInitialize();
@@ -131,8 +132,12 @@ OffTheRecordProfileIOData::Handle::CreateIsolatedAppRequestContextGetter(
CreateJobInterceptorFactory());
ChromeURLRequestContextGetter* context =
ChromeURLRequestContextGetter::CreateForIsolatedApp(
- profile_, io_data_, descriptor, protocol_handler_interceptor.Pass(),
- protocol_handlers);
+ profile_,
+ io_data_,
+ descriptor,
+ protocol_handler_interceptor.Pass(),
+ protocol_handlers,
+ protocol_interceptors.Pass());
app_request_context_getter_map_[descriptor] = context;
return context;
@@ -162,7 +167,8 @@ OffTheRecordProfileIOData::~OffTheRecordProfileIOData() {
void OffTheRecordProfileIOData::InitializeInternal(
ProfileParams* profile_params,
- content::ProtocolHandlerMap* protocol_handlers) const {
+ content::ProtocolHandlerMap* protocol_handlers,
+ content::ProtocolHandlerScopedVector protocol_interceptors) const {
ChromeURLRequestContext* main_context = main_request_context();
IOThread* const io_thread = profile_params->io_thread;
@@ -229,6 +235,7 @@ void OffTheRecordProfileIOData::InitializeInternal(
InstallProtocolHandlers(main_job_factory.get(), protocol_handlers);
main_job_factory_ = SetUpJobFactoryDefaults(
main_job_factory.Pass(),
+ protocol_interceptors.Pass(),
profile_params->protocol_handler_interceptor.Pass(),
network_delegate(),
ftp_factory_.get());
@@ -276,19 +283,20 @@ void OffTheRecordProfileIOData::
// SetUpJobFactoryDefaults() to get this effect.
extensions_job_factory_ = SetUpJobFactoryDefaults(
extensions_job_factory.Pass(),
+ content::ProtocolHandlerScopedVector(),
scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>(),
NULL,
ftp_factory_.get());
extensions_context->set_job_factory(extensions_job_factory_.get());
}
-ChromeURLRequestContext*
-OffTheRecordProfileIOData::InitializeAppRequestContext(
+ChromeURLRequestContext* OffTheRecordProfileIOData::InitializeAppRequestContext(
ChromeURLRequestContext* main_context,
const StoragePartitionDescriptor& partition_descriptor,
scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor,
- content::ProtocolHandlerMap* protocol_handlers) const {
+ content::ProtocolHandlerMap* protocol_handlers,
+ content::ProtocolHandlerScopedVector protocol_interceptors) const {
AppRequestContext* context = new AppRequestContext();
// Copy most state from the main context.
@@ -315,6 +323,7 @@ OffTheRecordProfileIOData::InitializeAppRequestContext(
InstallProtocolHandlers(job_factory.get(), protocol_handlers);
scoped_ptr<net::URLRequestJobFactory> top_job_factory;
top_job_factory = SetUpJobFactoryDefaults(job_factory.Pass(),
+ protocol_interceptors.Pass(),
protocol_handler_interceptor.Pass(),
network_delegate(),
ftp_factory_.get());
@@ -342,12 +351,15 @@ OffTheRecordProfileIOData::AcquireIsolatedAppRequestContext(
const StoragePartitionDescriptor& partition_descriptor,
scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor,
- content::ProtocolHandlerMap* protocol_handlers) const {
+ content::ProtocolHandlerMap* protocol_handlers,
+ content::ProtocolHandlerScopedVector protocol_interceptors) const {
// We create per-app contexts on demand, unlike the others above.
ChromeURLRequestContext* app_request_context =
- InitializeAppRequestContext(main_context, partition_descriptor,
+ InitializeAppRequestContext(main_context,
+ partition_descriptor,
protocol_handler_interceptor.Pass(),
- protocol_handlers);
+ protocol_handlers,
+ protocol_interceptors.Pass());
DCHECK(app_request_context);
return app_request_context;
}

Powered by Google App Engine
This is Rietveld 408576698