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

Unified Diff: chrome/browser/net/chrome_url_request_context.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/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 1ab503448c757266ae6237edf649a601078afb46..0099eb1aa6cc3a8d32df01169fe1103a0d6dece1 100644
--- a/chrome/browser/net/chrome_url_request_context.cc
+++ b/chrome/browser/net/chrome_url_request_context.cc
@@ -39,21 +39,23 @@ namespace {
// Factory that creates the main ChromeURLRequestContext.
class FactoryForMain : public ChromeURLRequestContextFactory {
public:
- FactoryForMain(
- const ProfileIOData* profile_io_data,
- content::ProtocolHandlerMap* protocol_handlers)
- : profile_io_data_(profile_io_data) {
+ FactoryForMain(const ProfileIOData* profile_io_data,
+ content::ProtocolHandlerMap* protocol_handlers,
+ content::ProtocolHandlerScopedVector protocol_interceptors)
+ : profile_io_data_(profile_io_data),
+ protocol_interceptors_(protocol_interceptors.Pass()) {
std::swap(protocol_handlers_, *protocol_handlers);
}
virtual ChromeURLRequestContext* Create() OVERRIDE {
- profile_io_data_->Init(&protocol_handlers_);
+ profile_io_data_->Init(&protocol_handlers_, protocol_interceptors_.Pass());
return profile_io_data_->GetMainRequestContext();
}
private:
const ProfileIOData* const profile_io_data_;
content::ProtocolHandlerMap protocol_handlers_;
+ content::ProtocolHandlerScopedVector protocol_interceptors_;
};
// Factory that creates the ChromeURLRequestContext for extensions.
@@ -79,11 +81,13 @@ class FactoryForIsolatedApp : public ChromeURLRequestContextFactory {
ChromeURLRequestContextGetter* main_context,
scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor,
- content::ProtocolHandlerMap* protocol_handlers)
+ content::ProtocolHandlerMap* protocol_handlers,
+ content::ProtocolHandlerScopedVector protocol_interceptors)
: profile_io_data_(profile_io_data),
partition_descriptor_(partition_descriptor),
main_request_context_getter_(main_context),
- protocol_handler_interceptor_(protocol_handler_interceptor.Pass()) {
+ protocol_handler_interceptor_(protocol_handler_interceptor.Pass()),
+ protocol_interceptors_(protocol_interceptors.Pass()) {
std::swap(protocol_handlers_, *protocol_handlers);
}
@@ -97,7 +101,8 @@ class FactoryForIsolatedApp : public ChromeURLRequestContextFactory {
main_request_context_getter_->GetURLRequestContext(),
partition_descriptor_,
protocol_handler_interceptor_.Pass(),
- &protocol_handlers_);
+ &protocol_handlers_,
+ protocol_interceptors_.Pass());
}
private:
@@ -108,6 +113,7 @@ class FactoryForIsolatedApp : public ChromeURLRequestContextFactory {
scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor_;
content::ProtocolHandlerMap protocol_handlers_;
+ content::ProtocolHandlerScopedVector protocol_interceptors_;
};
// Factory that creates the media ChromeURLRequestContext for a given isolated
@@ -195,9 +201,10 @@ ChromeURLRequestContextGetter::GetNetworkTaskRunner() const {
ChromeURLRequestContextGetter* ChromeURLRequestContextGetter::Create(
Profile* profile,
const ProfileIOData* profile_io_data,
- content::ProtocolHandlerMap* protocol_handlers) {
- return new ChromeURLRequestContextGetter(
- new FactoryForMain(profile_io_data, protocol_handlers));
+ content::ProtocolHandlerMap* protocol_handlers,
+ content::ProtocolHandlerScopedVector protocol_interceptors) {
+ return new ChromeURLRequestContextGetter(new FactoryForMain(
+ profile_io_data, protocol_handlers, protocol_interceptors.Pass()));
}
// static
@@ -224,14 +231,17 @@ ChromeURLRequestContextGetter::CreateForIsolatedApp(
const StoragePartitionDescriptor& partition_descriptor,
scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor,
- content::ProtocolHandlerMap* protocol_handlers) {
+ content::ProtocolHandlerMap* protocol_handlers,
+ content::ProtocolHandlerScopedVector protocol_interceptors) {
ChromeURLRequestContextGetter* main_context =
static_cast<ChromeURLRequestContextGetter*>(profile->GetRequestContext());
return new ChromeURLRequestContextGetter(
- new FactoryForIsolatedApp(profile_io_data, partition_descriptor,
+ new FactoryForIsolatedApp(profile_io_data,
+ partition_descriptor,
main_context,
protocol_handler_interceptor.Pass(),
- protocol_handlers));
+ protocol_handlers,
+ protocol_interceptors.Pass()));
}
// static

Powered by Google App Engine
This is Rietveld 408576698