Chromium Code Reviews| Index: chrome/browser/net/chrome_network_delegate.cc |
| diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc |
| index 6558ae123a8d01eac386242f1b1d44222e8e392a..0dcd433ec61e8edea74f9744e3aaa2cb24fc6095 100644 |
| --- a/chrome/browser/net/chrome_network_delegate.cc |
| +++ b/chrome/browser/net/chrome_network_delegate.cc |
| @@ -36,6 +36,7 @@ |
| #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" |
| #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol.h" |
| #include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h" |
| +#include "components/data_reduction_proxy/common/data_reduction_proxy_pref_names.h" |
| #include "components/domain_reliability/monitor.h" |
| #include "components/google/core/browser/google_util.h" |
| #include "content/public/browser/browser_thread.h" |
| @@ -292,6 +293,7 @@ ChromeNetworkDelegate::ChromeNetworkDelegate( |
| enable_referrers_(enable_referrers), |
| enable_do_not_track_(NULL), |
| force_google_safe_search_(NULL), |
| + data_reduction_proxy_enabled_(NULL), |
| #if defined(ENABLE_CONFIGURATION_POLICY) |
| url_blacklist_manager_(NULL), |
| #endif |
| @@ -346,6 +348,7 @@ void ChromeNetworkDelegate::InitializePrefsOnUIThread( |
| BooleanPrefMember* enable_referrers, |
| BooleanPrefMember* enable_do_not_track, |
| BooleanPrefMember* force_google_safe_search, |
| + BooleanPrefMember* data_reduction_proxy_enabled, |
| PrefService* pref_service) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| enable_referrers->Init(prefs::kEnableReferrers, pref_service); |
| @@ -361,6 +364,13 @@ void ChromeNetworkDelegate::InitializePrefsOnUIThread( |
| force_google_safe_search->MoveToThread( |
| BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| } |
| + if (data_reduction_proxy_enabled) { |
| + data_reduction_proxy_enabled->Init( |
| + data_reduction_proxy::prefs::kDataReductionProxyEnabled, |
| + pref_service); |
| + data_reduction_proxy_enabled->MoveToThread( |
| + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| + } |
| } |
| // static |
| @@ -504,11 +514,15 @@ int ChromeNetworkDelegate::OnHeadersReceived( |
| const net::HttpResponseHeaders* original_response_headers, |
| scoped_refptr<net::HttpResponseHeaders>* override_response_headers, |
| GURL* allowed_unsafe_redirect_url) { |
| + net::ProxyService::DataReductionProxyBypassType bypass_type = |
| + net::ProxyService::BYPASS_EVENT_TYPE_MAX; |
| if (data_reduction_proxy::MaybeBypassProxyAndPrepareToRetry( |
| + bypass_type, |
| data_reduction_proxy_params_, |
| request, |
| original_response_headers, |
| override_response_headers)) { |
| + data_reduction_proxy_usage_stats_->SetBypassType(bypass_type); |
|
mef
2014/07/15 18:20:04
Is it expected to always be net::ProxyService::BYP
|
| return net::OK; |
| } |
| @@ -598,6 +612,8 @@ void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request, |
| RecordContentLengthHistograms(received_content_length, |
| original_content_length, |
| freshness_lifetime); |
| + data_reduction_proxy_usage_stats_->RecordBypassedBytesHistograms( |
| + received_content_length, request, data_reduction_proxy_enabled_); |
| DVLOG(2) << __FUNCTION__ |
| << " received content length: " << received_content_length |
| << " original content length: " << original_content_length |