| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_netw
ork_delegate.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_netw
ork_delegate.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| 11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp
ression_stats.h" |
| 14 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig.h" | 15 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig.h" |
| 15 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
igurator.h" | 16 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
igurator.h" |
| 16 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" | 17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" |
| 17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_requ
est_options.h" | 18 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_requ
est_options.h" |
| 18 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv
ice.h" | 19 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv
ice.h" |
| 19 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_stat
istics_prefs.h" | |
| 20 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_usag
e_stats.h" | 20 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_usag
e_stats.h" |
| 21 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | 21 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
| 22 #include "net/base/load_flags.h" | 22 #include "net/base/load_flags.h" |
| 23 #include "net/http/http_response_headers.h" | 23 #include "net/http/http_response_headers.h" |
| 24 #include "net/proxy/proxy_info.h" | 24 #include "net/proxy/proxy_info.h" |
| 25 #include "net/proxy/proxy_server.h" | 25 #include "net/proxy/proxy_server.h" |
| 26 #include "net/proxy/proxy_service.h" | 26 #include "net/proxy/proxy_service.h" |
| 27 #include "net/url_request/url_request.h" | 27 #include "net/url_request/url_request.h" |
| 28 #include "net/url_request/url_request_status.h" | 28 #include "net/url_request/url_request_status.h" |
| 29 | 29 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 original_content_length_ += original_content_length; | 250 original_content_length_ += original_content_length; |
| 251 } | 251 } |
| 252 | 252 |
| 253 void DataReductionProxyNetworkDelegate::UpdateContentLengthPrefs( | 253 void DataReductionProxyNetworkDelegate::UpdateContentLengthPrefs( |
| 254 int received_content_length, | 254 int received_content_length, |
| 255 int original_content_length, | 255 int original_content_length, |
| 256 bool data_reduction_proxy_enabled, | 256 bool data_reduction_proxy_enabled, |
| 257 DataReductionProxyRequestType request_type) { | 257 DataReductionProxyRequestType request_type) { |
| 258 if (data_reduction_proxy_io_data_ && | 258 if (data_reduction_proxy_io_data_ && |
| 259 data_reduction_proxy_io_data_->service()) { | 259 data_reduction_proxy_io_data_->service()) { |
| 260 DataReductionProxyStatisticsPrefs* data_reduction_proxy_statistics_prefs = | 260 DataReductionProxyCompressionStats* data_reduction_proxy_statistics_prefs = |
| 261 data_reduction_proxy_io_data_->service()->statistics_prefs(); | 261 data_reduction_proxy_io_data_->service()->statistics_prefs(); |
| 262 int64 total_received = data_reduction_proxy_statistics_prefs->GetInt64( | 262 int64 total_received = data_reduction_proxy_statistics_prefs->GetInt64( |
| 263 data_reduction_proxy::prefs::kHttpReceivedContentLength); | 263 data_reduction_proxy::prefs::kHttpReceivedContentLength); |
| 264 int64 total_original = data_reduction_proxy_statistics_prefs->GetInt64( | 264 int64 total_original = data_reduction_proxy_statistics_prefs->GetInt64( |
| 265 data_reduction_proxy::prefs::kHttpOriginalContentLength); | 265 data_reduction_proxy::prefs::kHttpOriginalContentLength); |
| 266 total_received += received_content_length; | 266 total_received += received_content_length; |
| 267 total_original += original_content_length; | 267 total_original += original_content_length; |
| 268 data_reduction_proxy_statistics_prefs->SetInt64( | 268 data_reduction_proxy_statistics_prefs->SetInt64( |
| 269 data_reduction_proxy::prefs::kHttpReceivedContentLength, | 269 data_reduction_proxy::prefs::kHttpReceivedContentLength, |
| 270 total_received); | 270 total_received); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 DataReductionProxyParams::IsIncludedInCriticalPathBypassFieldTrial()) { | 308 DataReductionProxyParams::IsIncludedInCriticalPathBypassFieldTrial()) { |
| 309 if (!result->is_empty() && !result->is_direct() && | 309 if (!result->is_empty() && !result->is_direct() && |
| 310 config->IsDataReductionProxy(result->proxy_server().host_port_pair(), | 310 config->IsDataReductionProxy(result->proxy_server().host_port_pair(), |
| 311 NULL)) { | 311 NULL)) { |
| 312 result->RemoveProxiesWithoutScheme(net::ProxyServer::SCHEME_DIRECT); | 312 result->RemoveProxiesWithoutScheme(net::ProxyServer::SCHEME_DIRECT); |
| 313 } | 313 } |
| 314 } | 314 } |
| 315 } | 315 } |
| 316 | 316 |
| 317 } // namespace data_reduction_proxy | 317 } // namespace data_reduction_proxy |
| OLD | NEW |