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

Unified Diff: components/data_reduction_proxy/browser/data_reduction_proxy_protocol.cc

Issue 332313003: Add Finch experiment for selectively bypassing proxies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: callback design (not yet done) Created 6 years, 6 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: components/data_reduction_proxy/browser/data_reduction_proxy_protocol.cc
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_protocol.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_protocol.cc
index 53ece226733e4c12637891abcdb7f1691d877e6b..40461a262349dc47c26cffa953d2a92d61fa38df 100644
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_protocol.cc
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_protocol.cc
@@ -17,6 +17,8 @@
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context.h"
#include "url/gurl.h"
+#include "webkit/common/resource_type.h"
+
namespace {
bool SetProxyServerFromGURL(const GURL& gurl,
@@ -85,7 +87,22 @@ bool MaybeBypassProxyAndPrepareToRetry(
return true;
}
+int BuildLoadFlagsForRequest(ResourceType::Type resource_type) {
+ int flags = 0;
+ if (DataReductionProxyParams::IsIncludedInCriticalPathBypassFieldTrial() &&
+ resource_type != ResourceType::IMAGE)
+ flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY;
+ return flags;
+}
+void OnResolveProxyHandler(const GURL& url, int load_flags,
+ net::ProxyInfo* result) {
+ if ((load_flags & net::LOAD_BYPASS_DATA_REDUCTION_PROXY) &&
+ !result->is_direct() &&
+ result->proxy_server().isDataReductionProxy()) {
+ result->UseDirect();
+ }
+}
bool IsRequestIdempotent(const net::URLRequest* request) {
DCHECK(request);

Powered by Google App Engine
This is Rietveld 408576698