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

Unified Diff: android_webview/browser/net/aw_url_request_context_getter.cc

Issue 294023015: Hook up request interceptors in AndroidWebView code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 6 years, 7 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
« no previous file with comments | « android_webview/browser/net/aw_url_request_context_getter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/browser/net/aw_url_request_context_getter.cc
diff --git a/android_webview/browser/net/aw_url_request_context_getter.cc b/android_webview/browser/net/aw_url_request_context_getter.cc
index 7882eea35d878c84abc6fc8e47bb6a77069b4076..50ea9f9e8a37789ccd2182903f11e35955a7b7c6 100644
--- a/android_webview/browser/net/aw_url_request_context_getter.cc
+++ b/android_webview/browser/net/aw_url_request_context_getter.cc
@@ -101,7 +101,8 @@ void PopulateNetworkSessionParams(
}
scoped_ptr<net::URLRequestJobFactory> CreateJobFactory(
- content::ProtocolHandlerMap* protocol_handlers) {
+ content::ProtocolHandlerMap* protocol_handlers,
+ content::URLRequestInterceptorScopedVector request_interceptors) {
scoped_ptr<AwURLRequestJobFactory> aw_job_factory(new AwURLRequestJobFactory);
bool set_protocol = aw_job_factory->SetProtocolHandler(
url::kFileScheme,
@@ -131,12 +132,6 @@ scoped_ptr<net::URLRequestJobFactory> CreateJobFactory(
DCHECK(set_protocol);
protocol_handlers->clear();
- // Create a chain of URLRequestJobFactories. The handlers will be invoked
- // in the order in which they appear in the |request_interceptors| vector.
- typedef std::vector<net::URLRequestInterceptor*>
- URLRequestInterceptorVector;
- URLRequestInterceptorVector request_interceptors;
-
// Note that even though the content:// scheme handler is created here,
// it cannot be used by child processes until access to it is granted via
// ChildProcessSecurityPolicy::GrantScheme(). This is done in
@@ -157,13 +152,14 @@ scoped_ptr<net::URLRequestJobFactory> CreateJobFactory(
// The chain of responsibility will execute the handlers in reverse to the
// order in which the elements of the chain are created.
scoped_ptr<net::URLRequestJobFactory> job_factory(aw_job_factory.Pass());
- for (URLRequestInterceptorVector::reverse_iterator
- i = request_interceptors.rbegin();
+ for (content::URLRequestInterceptorScopedVector::reverse_iterator i =
+ request_interceptors.rbegin();
i != request_interceptors.rend();
++i) {
job_factory.reset(new net::URLRequestInterceptingJobFactory(
job_factory.Pass(), make_scoped_ptr(*i)));
}
+ request_interceptors.weak_clear();
return job_factory.Pass();
}
@@ -246,7 +242,8 @@ void AwURLRequestContextGetter::InitializeURLRequestContext() {
url_request_context_->set_http_transaction_factory(main_cache);
url_request_context_->set_cookie_store(cookie_store_);
- job_factory_ = CreateJobFactory(&protocol_handlers_);
+ job_factory_ = CreateJobFactory(&protocol_handlers_,
+ request_interceptors_.Pass());
url_request_context_->set_job_factory(job_factory_.get());
}
@@ -263,9 +260,11 @@ AwURLRequestContextGetter::GetNetworkTaskRunner() const {
return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
}
-void AwURLRequestContextGetter::SetProtocolHandlers(
- content::ProtocolHandlerMap* protocol_handlers) {
+void AwURLRequestContextGetter::SetHandlersAndInterceptors(
+ content::ProtocolHandlerMap* protocol_handlers,
+ content::URLRequestInterceptorScopedVector request_interceptors) {
std::swap(protocol_handlers_, *protocol_handlers);
+ request_interceptors_.swap(request_interceptors);
}
DataReductionProxyConfigService*
« no previous file with comments | « android_webview/browser/net/aw_url_request_context_getter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698