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

Unified Diff: net/url_request/url_request_context_builder.cc

Issue 937513003: Add Data Saver support to Cronet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nit Created 5 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 | « net/url_request/url_request_context_builder.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_context_builder.cc
diff --git a/net/url_request/url_request_context_builder.cc b/net/url_request/url_request_context_builder.cc
index 5e6f7210f4826f9938180868bb0e2324c843f048..fafc21115fd02c357486b0bd28c11538296c922e 100644
--- a/net/url_request/url_request_context_builder.cc
+++ b/net/url_request/url_request_context_builder.cc
@@ -35,6 +35,8 @@
#include "net/url_request/static_http_user_agent_settings.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_storage.h"
+#include "net/url_request/url_request_intercepting_job_factory.h"
+#include "net/url_request/url_request_interceptor.h"
#include "net/url_request/url_request_job_factory_impl.h"
#include "net/url_request/url_request_throttler_manager.h"
@@ -229,6 +231,11 @@ void URLRequestContextBuilder::SetSpdyAndQuicEnabled(bool spdy_enabled,
http_network_session_params_.enable_quic = quic_enabled;
}
+void URLRequestContextBuilder::SetInterceptors(
+ ScopedVector<URLRequestInterceptor> url_request_interceptors) {
+ url_request_interceptors_ = url_request_interceptors.Pass();
+}
+
void URLRequestContextBuilder::SetCookieAndChannelIdStores(
const scoped_refptr<CookieStore>& cookie_store,
scoped_ptr<ChannelIDService> channel_id_service) {
@@ -408,8 +415,19 @@ URLRequestContext* URLRequestContextBuilder::Build() {
}
#endif // !defined(DISABLE_FTP_SUPPORT)
- storage->set_job_factory(job_factory);
+ scoped_ptr<net::URLRequestJobFactory> top_job_factory(job_factory);
+ if (!url_request_interceptors_.empty()) {
+ // Set up interceptors in the reverse order.
+ for (ScopedVector<net::URLRequestInterceptor>::reverse_iterator i =
+ url_request_interceptors_.rbegin();
+ i != url_request_interceptors_.rend(); ++i) {
+ top_job_factory.reset(new net::URLRequestInterceptingJobFactory(
+ top_job_factory.Pass(), make_scoped_ptr(*i)));
+ }
+ url_request_interceptors_.weak_clear();
+ }
+ storage->set_job_factory(top_job_factory.release());
// TODO(willchan): Support sdch.
return context;
« no previous file with comments | « net/url_request/url_request_context_builder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698