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_BROWSER_DATA_REDUCTION_PROXY_PARAMS_H_ | 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PARAMS_H_ |
6 #define COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PARAMS_H_ | 6 #define COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PARAMS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "net/base/host_port_pair.h" | 13 #include "net/base/host_port_pair.h" |
14 #include "net/proxy/proxy_retry_info.h" | |
bengr
2014/07/21 22:23:57
You should be able to forward declare ProxyRetryIn
| |
14 #include "url/gurl.h" | 15 #include "url/gurl.h" |
15 | 16 |
16 namespace net { | 17 namespace net { |
17 class URLRequest; | 18 class URLRequest; |
18 } | 19 } |
19 | 20 |
20 namespace data_reduction_proxy { | 21 namespace data_reduction_proxy { |
21 // Provides initialization parameters. Proxy origins, and the probe url are | 22 // Provides initialization parameters. Proxy origins, and the probe url are |
22 // are taken from flags if available and from preprocessor constants otherwise. | 23 // are taken from flags if available and from preprocessor constants otherwise. |
23 // The DataReductionProxySettings class and others use this class to determine | 24 // The DataReductionProxySettings class and others use this class to determine |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 // bypassed, if one exists. |proxy_servers| can be NULL if the caller isn't | 86 // bypassed, if one exists. |proxy_servers| can be NULL if the caller isn't |
86 // interested in its values. Virtual for testing. | 87 // interested in its values. Virtual for testing. |
87 virtual bool IsDataReductionProxy(const net::HostPortPair& host_port_pair, | 88 virtual bool IsDataReductionProxy(const net::HostPortPair& host_port_pair, |
88 std::pair<GURL, GURL>* proxy_servers) const; | 89 std::pair<GURL, GURL>* proxy_servers) const; |
89 | 90 |
90 // Returns true if this request will be sent through the data request proxy | 91 // Returns true if this request will be sent through the data request proxy |
91 // based on applying the param rules to the URL. We do not check bad proxy | 92 // based on applying the param rules to the URL. We do not check bad proxy |
92 // list. | 93 // list. |
93 virtual bool IsDataReductionProxyEligible(const net::URLRequest* request); | 94 virtual bool IsDataReductionProxyEligible(const net::URLRequest* request); |
94 | 95 |
96 // Checks if all configured data reduction proxies are in the retry map. | |
97 // Returns true if the request is bypassed by all configured data reduction | |
98 // proxies and returns the bypass delay in delay_seconds (if not NULL). If | |
99 // there are no configured data reduction proxies, returns false. If | |
100 // the request is bypassed by more than one proxy, delay_seconds returns | |
101 // the shortest delay. | |
102 bool AreDataReductionProxiesBypassed(const net::URLRequest& request, | |
103 base::TimeDelta* delay_seconds) const; | |
bengr
2014/07/21 22:23:57
add:
namespace base {
class TimeDelta;
}
megjablon
2014/07/22 02:11:30
Done.
| |
104 | |
105 // Checks if all configured data reduction proxies are in the retry map. | |
106 // Returns true if the request is bypassed by all configured data reduction | |
107 // proxies and returns the bypass delay in delay_seconds (if not NULL). If | |
108 // there are no configured data reduction proxies, returns false. If | |
109 // the request is bypassed by more than one proxy, delay_seconds returns | |
110 // the shortest delay. | |
111 bool AreProxiesBypassed(const net::ProxyRetryInfoMap& retry_map, | |
112 bool ssl, | |
113 base::TimeDelta* delay_second) const; | |
114 | |
95 // Returns the data reduction proxy primary origin. | 115 // Returns the data reduction proxy primary origin. |
96 const GURL& origin() const { | 116 const GURL& origin() const { |
97 return origin_; | 117 return origin_; |
98 } | 118 } |
99 | 119 |
100 // Returns the data reduction proxy fallback origin. | 120 // Returns the data reduction proxy fallback origin. |
101 const GURL& fallback_origin() const { | 121 const GURL& fallback_origin() const { |
102 return fallback_origin_; | 122 return fallback_origin_; |
103 } | 123 } |
104 | 124 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
194 GURL probe_url_; | 214 GURL probe_url_; |
195 GURL warmup_url_; | 215 GURL warmup_url_; |
196 | 216 |
197 bool allowed_; | 217 bool allowed_; |
198 const bool fallback_allowed_; | 218 const bool fallback_allowed_; |
199 bool alt_allowed_; | 219 bool alt_allowed_; |
200 const bool promo_allowed_; | 220 const bool promo_allowed_; |
201 | 221 |
202 bool configured_on_command_line_; | 222 bool configured_on_command_line_; |
203 | 223 |
224 bool ArePrimaryAndFallbackBypassed(const net::ProxyRetryInfoMap& retry_map, | |
bengr
2014/07/21 22:23:57
Move this up to before the member variables. Add a
megjablon
2014/07/22 02:11:30
Done.
| |
225 const GURL& primary, | |
226 const GURL& fallback, | |
227 base::TimeDelta* delay_seconds) const; | |
228 | |
204 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyParams); | 229 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyParams); |
205 }; | 230 }; |
206 | 231 |
207 } // namespace data_reduction_proxy | 232 } // namespace data_reduction_proxy |
208 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PARAMS_H _ | 233 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PARAMS_H _ |
OLD | NEW |