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

Unified Diff: content/shell/browser/shell_url_request_context_getter.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: content/shell/browser/shell_url_request_context_getter.cc
diff --git a/content/shell/browser/shell_url_request_context_getter.cc b/content/shell/browser/shell_url_request_context_getter.cc
index bd5c9374328d26e24be3704afb8d69cfd88a2862..40bca8ca98ed875d6d92dd68c1359f4ad64805d2 100644
--- a/content/shell/browser/shell_url_request_context_getter.cc
+++ b/content/shell/browser/shell_url_request_context_getter.cc
@@ -64,12 +64,14 @@ ShellURLRequestContextGetter::ShellURLRequestContextGetter(
base::MessageLoop* io_loop,
base::MessageLoop* file_loop,
ProtocolHandlerMap* protocol_handlers,
+ ProtocolHandlerScopedVector protocol_interceptors,
net::NetLog* net_log)
: ignore_certificate_errors_(ignore_certificate_errors),
base_path_(base_path),
io_loop_(io_loop),
file_loop_(file_loop),
- net_log_(net_log) {
+ net_log_(net_log),
+ protocol_interceptors_(protocol_interceptors.Pass()) {
// Must first be created on the UI thread.
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -214,7 +216,20 @@ net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() {
GetTaskRunnerWithShutdownBehavior(
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)));
DCHECK(set_protocol);
- storage_->set_job_factory(job_factory.release());
+
+ // Set up interceptors in the reverse order.
+ scoped_ptr<net::URLRequestJobFactory> top_job_factory =
+ job_factory.PassAs<net::URLRequestJobFactory>();
+ for (ProtocolHandlerScopedVector::reverse_iterator i =
+ protocol_interceptors_.rbegin();
+ i != protocol_interceptors_.rend();
+ ++i) {
+ top_job_factory.reset(new net::ProtocolInterceptJobFactory(
+ top_job_factory.Pass(), make_scoped_ptr(*i)));
+ }
+ protocol_interceptors_.weak_clear();
+
+ storage_->set_job_factory(top_job_factory.release());
}
return url_request_context_.get();

Powered by Google App Engine
This is Rietveld 408576698