| 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 92a1986135a78592d9b983e343d428f025fc0e71..e8cbea8e0bc784fd281986707fe7852f9dd98a51 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
|
| @@ -9,21 +9,20 @@
|
| #include "base/metrics/histogram_macros.h"
|
| #include "base/strings/string_number_conversions.h"
|
| #include "base/time/time.h"
|
| #include "base/values.h"
|
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.h"
|
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h"
|
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator.h"
|
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_experiments_stats.h"
|
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h"
|
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.h"
|
| -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_event_creator.h"
|
| #include "components/data_reduction_proxy/core/common/lofi_decider.h"
|
| #include "net/base/load_flags.h"
|
| #include "net/http/http_request_headers.h"
|
| #include "net/http/http_response_headers.h"
|
| #include "net/proxy/proxy_info.h"
|
| #include "net/proxy/proxy_server.h"
|
| #include "net/proxy/proxy_service.h"
|
| #include "net/url_request/url_request.h"
|
| #include "net/url_request/url_request_context.h"
|
| #include "net/url_request/url_request_status.h"
|
| @@ -113,40 +112,34 @@ int64_t EstimateOriginalReceivedBytes(
|
|
|
| } // namespace
|
|
|
| namespace data_reduction_proxy {
|
|
|
| DataReductionProxyNetworkDelegate::DataReductionProxyNetworkDelegate(
|
| scoped_ptr<net::NetworkDelegate> network_delegate,
|
| DataReductionProxyConfig* config,
|
| DataReductionProxyRequestOptions* request_options,
|
| const DataReductionProxyConfigurator* configurator,
|
| - DataReductionProxyExperimentsStats* experiments_stats,
|
| - net::NetLog* net_log,
|
| - DataReductionProxyEventCreator* event_creator)
|
| + DataReductionProxyExperimentsStats* experiments_stats)
|
| : LayeredNetworkDelegate(std::move(network_delegate)),
|
| total_received_bytes_(0),
|
| total_original_received_bytes_(0),
|
| data_reduction_proxy_config_(config),
|
| data_reduction_proxy_bypass_stats_(nullptr),
|
| data_reduction_proxy_request_options_(request_options),
|
| data_reduction_proxy_io_data_(nullptr),
|
| configurator_(configurator),
|
| - experiments_stats_(experiments_stats),
|
| - net_log_(net_log),
|
| - event_creator_(event_creator) {
|
| + experiments_stats_(experiments_stats) {
|
| DCHECK(data_reduction_proxy_config_);
|
| DCHECK(data_reduction_proxy_request_options_);
|
| DCHECK(configurator_);
|
| DCHECK(experiments_stats_);
|
| - DCHECK(net_log_);
|
| - DCHECK(event_creator_);
|
| }
|
|
|
| DataReductionProxyNetworkDelegate::~DataReductionProxyNetworkDelegate() {
|
| }
|
|
|
| void DataReductionProxyNetworkDelegate::InitIODataAndUMA(
|
| DataReductionProxyIOData* io_data,
|
| DataReductionProxyBypassStats* bypass_stats) {
|
| DCHECK(bypass_stats);
|
| data_reduction_proxy_io_data_ = io_data;
|
| @@ -157,46 +150,20 @@ base::Value*
|
| DataReductionProxyNetworkDelegate::SessionNetworkStatsInfoToValue() const {
|
| base::DictionaryValue* dict = new base::DictionaryValue();
|
| // Use strings to avoid overflow. base::Value only supports 32-bit integers.
|
| dict->SetString("session_received_content_length",
|
| base::Int64ToString(total_received_bytes_));
|
| dict->SetString("session_original_content_length",
|
| base::Int64ToString(total_original_received_bytes_));
|
| return dict;
|
| }
|
|
|
| -void DataReductionProxyNetworkDelegate::OnResolveProxyInternal(
|
| - const GURL& url,
|
| - int load_flags,
|
| - const net::ProxyService& proxy_service,
|
| - net::ProxyInfo* result) {
|
| - OnResolveProxyHandler(url, load_flags, configurator_->GetProxyConfig(),
|
| - proxy_service.proxy_retry_info(),
|
| - data_reduction_proxy_config_, result);
|
| -}
|
| -
|
| -void DataReductionProxyNetworkDelegate::OnProxyFallbackInternal(
|
| - const net::ProxyServer& bad_proxy,
|
| - int net_error) {
|
| - if (bad_proxy.is_valid() &&
|
| - data_reduction_proxy_config_->IsDataReductionProxy(
|
| - bad_proxy.host_port_pair(), nullptr)) {
|
| - event_creator_->AddProxyFallbackEvent(net_log_, bad_proxy.ToURI(),
|
| - net_error);
|
| - }
|
| -
|
| - if (data_reduction_proxy_bypass_stats_) {
|
| - data_reduction_proxy_bypass_stats_->OnProxyFallback(
|
| - bad_proxy, net_error);
|
| - }
|
| -}
|
| -
|
| void DataReductionProxyNetworkDelegate::OnBeforeSendProxyHeadersInternal(
|
| net::URLRequest* request,
|
| const net::ProxyInfo& proxy_info,
|
| net::HttpRequestHeaders* headers) {
|
| DCHECK(data_reduction_proxy_config_);
|
|
|
| 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 =
|
| @@ -344,40 +311,18 @@ void DataReductionProxyNetworkDelegate::RecordContentLength(
|
| original_content_length);
|
|
|
| if (data_reduction_proxy_io_data_ && data_reduction_proxy_bypass_stats_) {
|
| // Record BypassedBytes histograms for the request.
|
| data_reduction_proxy_bypass_stats_->RecordBytesHistograms(
|
| request, data_reduction_proxy_io_data_->IsEnabled(),
|
| configurator_->GetProxyConfig());
|
| }
|
| }
|
|
|
| -void OnResolveProxyHandler(const GURL& url,
|
| - int load_flags,
|
| - const net::ProxyConfig& data_reduction_proxy_config,
|
| - const net::ProxyRetryInfoMap& proxy_retry_info,
|
| - const DataReductionProxyConfig* config,
|
| - net::ProxyInfo* result) {
|
| - DCHECK(config);
|
| - DCHECK(result->is_empty() || result->is_direct() ||
|
| - !config->IsDataReductionProxy(result->proxy_server().host_port_pair(),
|
| - NULL));
|
| - if (data_reduction_proxy_config.is_valid() &&
|
| - result->proxy_server().is_direct() &&
|
| - result->proxy_list().size() == 1 &&
|
| - !url.SchemeIsWSOrWSS()) {
|
| - net::ProxyInfo data_reduction_proxy_info;
|
| - data_reduction_proxy_config.proxy_rules().Apply(
|
| - url, &data_reduction_proxy_info);
|
| - data_reduction_proxy_info.DeprioritizeBadProxies(proxy_retry_info);
|
| - if (!data_reduction_proxy_info.proxy_server().is_direct())
|
| - result->OverrideProxyList(data_reduction_proxy_info.proxy_list());
|
| - }
|
| -}
|
|
|
| void DataReductionProxyNetworkDelegate::RecordLoFiTransformationType(
|
| LoFiTransformationType type) {
|
| UMA_HISTOGRAM_ENUMERATION("DataReductionProxy.LoFi.TransformationType", type,
|
| LO_FI_TRANSFORMATION_TYPES_INDEX_BOUNDARY);
|
| }
|
|
|
| } // namespace data_reduction_proxy
|
|
|