| 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/browser/data_reduction_proxy_metrics.h
" | 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_metrics.h
" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/prefs/scoped_user_pref_update.h" | 9 #include "base/prefs/scoped_user_pref_update.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 private: | 294 private: |
| 295 DailyContentLengthUpdate original_; | 295 DailyContentLengthUpdate original_; |
| 296 DailyContentLengthUpdate received_; | 296 DailyContentLengthUpdate received_; |
| 297 }; | 297 }; |
| 298 | 298 |
| 299 // Returns true if the request is bypassed by all configured data reduction | 299 // Returns true if the request is bypassed by all configured data reduction |
| 300 // proxies. It returns the bypass delay in delay_seconds (if not NULL). If | 300 // proxies. It returns the bypass delay in delay_seconds (if not NULL). If |
| 301 // the request is bypassed by more than one proxy, delay_seconds returns | 301 // the request is bypassed by more than one proxy, delay_seconds returns |
| 302 // shortest delay. | 302 // shortest delay. |
| 303 bool IsBypassRequest(const net::URLRequest* request, int64* delay_seconds) { | 303 bool IsBypassRequest(const net::URLRequest* request, int64* delay_seconds) { |
| 304 DataReductionProxySettings::DataReductionProxyList proxies = | 304 // TODO(bengr): Add support for other data reduction proxy configurations. |
| 305 DataReductionProxySettings::GetDataReductionProxies(); | 305 DataReductionProxyParams params(true, true, false, true); |
| 306 DataReductionProxyParams::DataReductionProxyList proxies = |
| 307 params.GetAllowedProxies(); |
| 306 if (proxies.size() == 0) | 308 if (proxies.size() == 0) |
| 307 return false; | 309 return false; |
| 308 | 310 |
| 309 if (request == NULL || request->context() == NULL || | 311 if (request == NULL || request->context() == NULL || |
| 310 request->context()->proxy_service() == NULL) { | 312 request->context()->proxy_service() == NULL) { |
| 311 return false; | 313 return false; |
| 312 } | 314 } |
| 313 | 315 |
| 314 const net::ProxyRetryInfoMap& retry_map = | 316 const net::ProxyRetryInfoMap& retry_map = |
| 315 request->context()->proxy_service()->proxy_retry_info(); | 317 request->context()->proxy_service()->proxy_retry_info(); |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 UpdateContentLengthPrefsForDataReductionProxy( | 533 UpdateContentLengthPrefsForDataReductionProxy( |
| 532 received_content_length, | 534 received_content_length, |
| 533 original_content_length, | 535 original_content_length, |
| 534 with_data_reduction_proxy_enabled, | 536 with_data_reduction_proxy_enabled, |
| 535 request_type, | 537 request_type, |
| 536 base::Time::Now(), | 538 base::Time::Now(), |
| 537 prefs); | 539 prefs); |
| 538 } | 540 } |
| 539 | 541 |
| 540 } // namespace data_reduction_proxy | 542 } // namespace data_reduction_proxy |
| OLD | NEW |