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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 if (!request->url().SchemeIs("http")) { | 349 if (!request->url().SchemeIs("http")) { |
350 NOTREACHED(); | 350 NOTREACHED(); |
351 return UNKNOWN_TYPE; | 351 return UNKNOWN_TYPE; |
352 } | 352 } |
353 int64 bypass_delay = 0; | 353 int64 bypass_delay = 0; |
354 if (IsBypassRequest(request, &bypass_delay)) { | 354 if (IsBypassRequest(request, &bypass_delay)) { |
355 return (bypass_delay > kLongBypassDelayInSeconds) ? | 355 return (bypass_delay > kLongBypassDelayInSeconds) ? |
356 LONG_BYPASS : SHORT_BYPASS; | 356 LONG_BYPASS : SHORT_BYPASS; |
357 } | 357 } |
358 if (request->response_info().headers && | 358 if (request->response_info().headers && |
359 HasDataReductionProxyViaHeader(request->response_info().headers)) { | 359 HasDataReductionProxyViaHeader(request->response_info().headers, NULL)) { |
360 return VIA_DATA_REDUCTION_PROXY; | 360 return VIA_DATA_REDUCTION_PROXY; |
361 } | 361 } |
362 return UNKNOWN_TYPE; | 362 return UNKNOWN_TYPE; |
363 } | 363 } |
364 | 364 |
365 int64 GetAdjustedOriginalContentLength( | 365 int64 GetAdjustedOriginalContentLength( |
366 DataReductionProxyRequestType request_type, | 366 DataReductionProxyRequestType request_type, |
367 int64 original_content_length, | 367 int64 original_content_length, |
368 int64 received_content_length) { | 368 int64 received_content_length) { |
369 // Since there was no indication of the original content length, presume | 369 // Since there was no indication of the original content length, presume |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 UpdateContentLengthPrefsForDataReductionProxy( | 534 UpdateContentLengthPrefsForDataReductionProxy( |
535 received_content_length, | 535 received_content_length, |
536 original_content_length, | 536 original_content_length, |
537 with_data_reduction_proxy_enabled, | 537 with_data_reduction_proxy_enabled, |
538 request_type, | 538 request_type, |
539 base::Time::Now(), | 539 base::Time::Now(), |
540 prefs); | 540 prefs); |
541 } | 541 } |
542 | 542 |
543 } // namespace data_reduction_proxy | 543 } // namespace data_reduction_proxy |
OLD | NEW |