| 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 DataReductionProxyParams::kAllowed | | 307 DataReductionProxyParams::kAllowed | |
| 308 DataReductionProxyParams::kFallbackAllowed | | 308 DataReductionProxyParams::kFallbackAllowed | |
| 309 DataReductionProxyParams::kPromoAllowed); | 309 DataReductionProxyParams::kPromoAllowed); |
| 310 base::TimeDelta bypass_delay; | 310 base::TimeDelta bypass_delay; |
| 311 if (params.AreDataReductionProxiesBypassed(*request, &bypass_delay)) { | 311 if (params.AreDataReductionProxiesBypassed(*request, &bypass_delay)) { |
| 312 if (bypass_delay > base::TimeDelta::FromSeconds(kLongBypassDelayInSeconds)) | 312 if (bypass_delay > base::TimeDelta::FromSeconds(kLongBypassDelayInSeconds)) |
| 313 return LONG_BYPASS; | 313 return LONG_BYPASS; |
| 314 return SHORT_BYPASS; | 314 return SHORT_BYPASS; |
| 315 } | 315 } |
| 316 #endif | 316 #endif |
| 317 if (request->response_info().headers && | 317 if (request->response_info().headers.get() && |
| 318 HasDataReductionProxyViaHeader(request->response_info().headers, NULL)) { | 318 HasDataReductionProxyViaHeader(request->response_info().headers.get(), |
| 319 NULL)) { |
| 319 return VIA_DATA_REDUCTION_PROXY; | 320 return VIA_DATA_REDUCTION_PROXY; |
| 320 } | 321 } |
| 321 return UNKNOWN_TYPE; | 322 return UNKNOWN_TYPE; |
| 322 } | 323 } |
| 323 | 324 |
| 324 int64 GetAdjustedOriginalContentLength( | 325 int64 GetAdjustedOriginalContentLength( |
| 325 DataReductionProxyRequestType request_type, | 326 DataReductionProxyRequestType request_type, |
| 326 int64 original_content_length, | 327 int64 original_content_length, |
| 327 int64 received_content_length) { | 328 int64 received_content_length) { |
| 328 // Since there was no indication of the original content length, presume | 329 // Since there was no indication of the original content length, presume |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 UpdateContentLengthPrefsForDataReductionProxy( | 494 UpdateContentLengthPrefsForDataReductionProxy( |
| 494 received_content_length, | 495 received_content_length, |
| 495 original_content_length, | 496 original_content_length, |
| 496 with_data_reduction_proxy_enabled, | 497 with_data_reduction_proxy_enabled, |
| 497 request_type, | 498 request_type, |
| 498 base::Time::Now(), | 499 base::Time::Now(), |
| 499 prefs); | 500 prefs); |
| 500 } | 501 } |
| 501 | 502 |
| 502 } // namespace data_reduction_proxy | 503 } // namespace data_reduction_proxy |
| OLD | NEW |