Chromium Code Reviews| 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 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_COMMON_DATA_REDUCTION_PROXY_HEADERS_H_ | 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_COMMON_DATA_REDUCTION_PROXY_HEADERS_H_ |
| 6 #define COMPONENTS_DATA_REDUCTION_PROXY_COMMON_DATA_REDUCTION_PROXY_HEADERS_H_ | 6 #define COMPONENTS_DATA_REDUCTION_PROXY_COMMON_DATA_REDUCTION_PROXY_HEADERS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 // Amount of time to bypass the data reduction proxy or proxies. | 27 // Amount of time to bypass the data reduction proxy or proxies. |
| 28 base::TimeDelta bypass_duration; | 28 base::TimeDelta bypass_duration; |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 // Returns true if the Chrome-Proxy header is present and contains a bypass | 31 // Returns true if the Chrome-Proxy header is present and contains a bypass |
| 32 // delay. Sets |proxy_info->bypass_duration| to the specified delay if greater | 32 // delay. Sets |proxy_info->bypass_duration| to the specified delay if greater |
| 33 // than 0, and to 0 otherwise to indicate that the default proxy delay | 33 // than 0, and to 0 otherwise to indicate that the default proxy delay |
| 34 // (as specified in |ProxyList::UpdateRetryInfoOnFallback|) should be used. | 34 // (as specified in |ProxyList::UpdateRetryInfoOnFallback|) should be used. |
| 35 // If all available data reduction proxies should by bypassed, |bypass_all| is | 35 // If all available data reduction proxies should by bypassed, |bypass_all| is |
| 36 // set to true. |proxy_info| must be non-NULL. | 36 // set to true. |proxy_info| must be non-NULL. |
| 37 bool GetDataReductionProxyInfo( | 37 bool ParseHeadersAndSetProxyInfo( |
| 38 const net::HttpResponseHeaders* headers, | 38 const net::HttpResponseHeaders* headers, |
| 39 DataReductionProxyInfo* proxy_info); | 39 DataReductionProxyInfo* proxy_info); |
| 40 | 40 |
| 41 // Returns true if the response contain the data reduction proxy Via header | 41 // Returns true if the response contain the data reduction proxy Via header |
| 42 // value. Used to check the integrity of data reduction proxy responses. | 42 // value. Used to check the integrity of data reduction proxy responses. |
| 43 bool HasDataReductionProxyViaHeader(const net::HttpResponseHeaders* headers); | 43 bool HasDataReductionProxyViaHeader(const net::HttpResponseHeaders* headers); |
| 44 | 44 |
| 45 // Returns the reason why the Chrome proxy should be bypassed or not, and | 45 // Returns the reason why the Chrome proxy should be bypassed or not, and |
| 46 // populates |proxy_info| with information on how long to bypass if | 46 // populates |proxy_info| with information on how long to bypass if |
| 47 // applicable. | 47 // applicable. |
| 48 ProxyService::DataReductionProxyBypassType GetDataReductionProxyBypassType( | 48 ProxyService::DataReductionProxyBypassType GetDataReductionProxyBypassType( |
| 49 const net::HttpResponseHeaders* headers, | 49 const net::HttpResponseHeaders* headers, |
| 50 DataReductionProxyInfo* proxy_info); | 50 DataReductionProxyInfo* proxy_info); |
| 51 | 51 |
| 52 // Searches for the specified Chrome-Proxy action, and if present interprets | 52 // Searches for the specified Chrome-Proxy action, and if present interprets |
| 53 // its value as a duration in seconds. | 53 // its value as a duration in seconds. |
| 54 bool GetDataReductionProxyBypassDuration( | 54 bool ParseHeadersAndSetProxyInfoBypassDuration( |
|
bengr
2014/07/17 00:11:08
I'd save function renaming for another CL.
Not at Google. Contact bengr
2014/07/17 18:10:21
These 2 methods are only used locally, so thought
| |
| 55 const net::HttpResponseHeaders* headers, | 55 const net::HttpResponseHeaders* headers, |
| 56 const std::string& action_prefix, | 56 const std::string& action_prefix, |
| 57 base::TimeDelta* duration); | 57 DataReductionProxyInfo* proxy_info); |
| 58 | |
| 59 // Set a random bypass duration between 1 and 5 minutes. | |
|
bengr
2014/07/17 00:11:08
Sets
Not at Google. Contact bengr
2014/07/17 18:10:21
Done. Moved comment to .cc.
| |
| 60 void SetRandBypassDuration(DataReductionProxyInfo* data_reduction_proxy_info); | |
| 58 | 61 |
| 59 } // namespace data_reduction_proxy | 62 } // namespace data_reduction_proxy |
| 60 #endif // COMPONENTS_DATA_REDUCTION_PROXY_COMMON_DATA_REDUCTION_PROXY_HEADERS_H _ | 63 #endif // COMPONENTS_DATA_REDUCTION_PROXY_COMMON_DATA_REDUCTION_PROXY_HEADERS_H _ |
| OLD | NEW |