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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.cc

Issue 1363673004: [DRP] Consistently use LoFi for an entire page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing tbansal comments Created 5 years, 3 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/core/browser/data_reduction_proxy_request_options.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.cc
index 24be61b0998bdf0d2ccf1d351a23bc011451d626..598edf3b3b271cd7be59c41e51b3d6ac0f3f17b1 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.cc
@@ -159,15 +159,11 @@ void DataReductionProxyRequestOptions::UpdateVersion() {
}
void DataReductionProxyRequestOptions::MayRegenerateHeaderBasedOnLoFi(
- const net::URLRequest* request) {
+ bool is_lofi_on) {
DCHECK(thread_checker_.CalledOnValidThread());
- if (!data_reduction_proxy_config_)
- return;
-
bool lofi_now_enabled =
- !(request && request->load_flags() & net::LOAD_BYPASS_CACHE) &&
- data_reduction_proxy_config_->ShouldUseLoFiHeaderForRequests();
+ is_lofi_on && !params::IsIncludedInLoFiControlFieldTrial();
// Lo-Fi was not enabled, but now is. Add the header option.
if (lofi_.empty() && lofi_now_enabled) {
@@ -223,31 +219,34 @@ void DataReductionProxyRequestOptions::RandBytes(void* output,
void DataReductionProxyRequestOptions::MaybeAddRequestHeader(
net::URLRequest* request,
const net::ProxyServer& proxy_server,
- net::HttpRequestHeaders* request_headers) {
+ net::HttpRequestHeaders* request_headers,
+ bool is_lofi_on) {
DCHECK(thread_checker_.CalledOnValidThread());
tbansal1 2015/09/29 00:47:48 Please add a DCHECK_IMPLIES that if |is_lofi_on| i
megjablon 2015/09/29 02:38:38 With the changes I just made I'll need to test thi
if (!proxy_server.is_valid())
return;
if (proxy_server.is_direct())
return;
MaybeAddRequestHeaderImpl(request, proxy_server.host_port_pair(), false,
- request_headers);
+ request_headers, is_lofi_on);
}
void DataReductionProxyRequestOptions::MaybeAddProxyTunnelRequestHandler(
const net::HostPortPair& proxy_server,
net::HttpRequestHeaders* request_headers) {
DCHECK(thread_checker_.CalledOnValidThread());
- MaybeAddRequestHeaderImpl(nullptr, proxy_server, true, request_headers);
+ MaybeAddRequestHeaderImpl(nullptr, proxy_server, true, request_headers,
+ false);
}
void DataReductionProxyRequestOptions::SetHeader(
const net::URLRequest* request,
- net::HttpRequestHeaders* headers) {
+ net::HttpRequestHeaders* headers,
+ bool is_lofi_on) {
base::Time now = Now();
// Authorization credentials must be regenerated if they are expired.
if (!use_assigned_credentials_ && (now > credentials_expiration_time_))
UpdateCredentials();
- MayRegenerateHeaderBasedOnLoFi(request);
+ MayRegenerateHeaderBasedOnLoFi(is_lofi_on);
const char kChromeProxyHeader[] = "Chrome-Proxy";
std::string header_value;
if (headers->HasHeader(kChromeProxyHeader)) {
@@ -367,13 +366,14 @@ void DataReductionProxyRequestOptions::MaybeAddRequestHeaderImpl(
const net::URLRequest* request,
const net::HostPortPair& proxy_server,
bool expect_ssl,
- net::HttpRequestHeaders* request_headers) {
+ net::HttpRequestHeaders* request_headers,
+ bool is_lofi_on) {
if (proxy_server.IsEmpty())
return;
if (data_reduction_proxy_config_->IsDataReductionProxy(proxy_server, NULL) &&
data_reduction_proxy_config_->UsingHTTPTunnel(proxy_server) ==
expect_ssl) {
- SetHeader(request, request_headers);
+ SetHeader(request, request_headers, is_lofi_on);
}
}

Powered by Google App Engine
This is Rietveld 408576698