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

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

Issue 1933653004: Reset the Lo-Fi main frame state when there is a new main frame request (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 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
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc
index cbf79c38e874f14cf6d75a1dd84826462e67a478..729d6aa0683e075168e036951a196be7f70a812f 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc
@@ -153,6 +153,15 @@ DataReductionProxyNetworkDelegate::SessionNetworkStatsInfoToValue() const {
return dict;
}
+void DataReductionProxyNetworkDelegate::OnBeforeURLRequestInternal(
+ net::URLRequest* request,
+ const net::CompletionCallback& callback,
+ GURL* new_url) {
+ DCHECK(request);
tbansal1 2016/05/06 23:36:51 This DCHECK is not necessary. If |request| is null
megjablon 2016/05/07 00:29:08 Done.
+ if ((request->load_flags() & net::LOAD_MAIN_FRAME))
+ data_reduction_proxy_io_data_->SetLoFiModeActiveOnMainFrame(false);
+}
+
void DataReductionProxyNetworkDelegate::OnBeforeSendProxyHeadersInternal(
net::URLRequest* request,
const net::ProxyInfo& proxy_info,
@@ -161,24 +170,31 @@ void DataReductionProxyNetworkDelegate::OnBeforeSendProxyHeadersInternal(
if (proxy_info.is_empty())
return;
+ if (!proxy_info.proxy_server().is_valid())
+ return;
+ if (proxy_info.proxy_server().is_direct())
+ return;
+ if (proxy_info.proxy_server().host_port_pair().IsEmpty())
+ return;
+ if (!data_reduction_proxy_config_->IsDataReductionProxy(
+ proxy_info.proxy_server().host_port_pair(), nullptr)) {
+ return;
+ }
if (data_reduction_proxy_io_data_ &&
data_reduction_proxy_io_data_->lofi_decider() && request) {
LoFiDecider* lofi_decider = data_reduction_proxy_io_data_->lofi_decider();
- bool is_using_lofi_mode = lofi_decider->MaybeAddLoFiDirectiveToHeaders(
- *request, headers, proxy_info.proxy_server(),
- data_reduction_proxy_config_);
+ bool is_using_lofi_mode =
+ lofi_decider->MaybeAddLoFiDirectiveToHeaders(*request, headers);
if ((request->load_flags() & net::LOAD_MAIN_FRAME)) {
- // TODO(megjablon): Need to switch to per page.
data_reduction_proxy_io_data_->SetLoFiModeActiveOnMainFrame(
is_using_lofi_mode);
}
}
if (data_reduction_proxy_request_options_) {
- data_reduction_proxy_request_options_->MaybeAddRequestHeader(
- proxy_info.proxy_server(), headers);
+ data_reduction_proxy_request_options_->AddRequestHeader(headers);
}
}

Powered by Google App Engine
This is Rietveld 408576698