| 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_metr
ics.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_metr
ics.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | |
| 8 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig.h" | 7 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig.h" |
| 9 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade
rs.h" | 8 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade
rs.h" |
| 10 #include "net/base/load_flags.h" | 9 #include "net/base/load_flags.h" |
| 11 #include "net/http/http_response_info.h" | 10 #include "net/http/http_response_info.h" |
| 12 #include "net/proxy/proxy_config.h" | 11 #include "net/proxy/proxy_config.h" |
| 13 #include "net/proxy/proxy_server.h" | 12 #include "net/proxy/proxy_server.h" |
| 14 #include "net/url_request/url_request.h" | 13 #include "net/url_request/url_request.h" |
| 15 #include "net/url_request/url_request_context.h" | 14 #include "net/url_request/url_request_context.h" |
| 16 #include "url/url_constants.h" | 15 #include "url/url_constants.h" |
| 17 | 16 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 (!request.proxy_server().IsEmpty() && | 52 (!request.proxy_server().IsEmpty() && |
| 54 !config.IsDataReductionProxy(request.proxy_server(), NULL)) || | 53 !config.IsDataReductionProxy(request.proxy_server(), NULL)) || |
| 55 config.IsBypassedByDataReductionProxyLocalRules( | 54 config.IsBypassedByDataReductionProxyLocalRules( |
| 56 request, data_reduction_proxy_config)) { | 55 request, data_reduction_proxy_config)) { |
| 57 return SHORT_BYPASS; | 56 return SHORT_BYPASS; |
| 58 } | 57 } |
| 59 | 58 |
| 60 return UNKNOWN_TYPE; | 59 return UNKNOWN_TYPE; |
| 61 } | 60 } |
| 62 | 61 |
| 63 int64 GetAdjustedOriginalContentLength( | 62 int64_t GetAdjustedOriginalContentLength( |
| 64 DataReductionProxyRequestType request_type, | 63 DataReductionProxyRequestType request_type, |
| 65 int64 original_content_length, | 64 int64_t original_content_length, |
| 66 int64 received_content_length) { | 65 int64_t received_content_length) { |
| 67 // Since there was no indication of the original content length, presume | 66 // Since there was no indication of the original content length, presume |
| 68 // it is no different from the number of bytes read. | 67 // it is no different from the number of bytes read. |
| 69 if (original_content_length == -1 || | 68 if (original_content_length == -1 || |
| 70 request_type != VIA_DATA_REDUCTION_PROXY) { | 69 request_type != VIA_DATA_REDUCTION_PROXY) { |
| 71 return received_content_length; | 70 return received_content_length; |
| 72 } | 71 } |
| 73 return original_content_length; | 72 return original_content_length; |
| 74 } | 73 } |
| 75 | 74 |
| 76 } // namespace data_reduction_proxy | 75 } // namespace data_reduction_proxy |
| OLD | NEW |