| 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" |
| 14 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 15 | 16 |
| 17 namespace base { |
| 18 class TimeDelta; |
| 19 } |
| 20 |
| 16 namespace net { | 21 namespace net { |
| 17 class URLRequest; | 22 class URLRequest; |
| 18 } | 23 } |
| 19 | 24 |
| 20 namespace data_reduction_proxy { | 25 namespace data_reduction_proxy { |
| 21 // Provides initialization parameters. Proxy origins, and the probe url are | 26 // Provides initialization parameters. Proxy origins, and the probe url are |
| 22 // are taken from flags if available and from preprocessor constants otherwise. | 27 // are taken from flags if available and from preprocessor constants otherwise. |
| 23 // The DataReductionProxySettings class and others use this class to determine | 28 // The DataReductionProxySettings class and others use this class to determine |
| 24 // the necessary DNS names to configure use of the data reduction proxy. | 29 // the necessary DNS names to configure use of the data reduction proxy. |
| 25 class DataReductionProxyParams { | 30 class DataReductionProxyParams { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // bypassed, if one exists. |proxy_servers| can be NULL if the caller isn't | 102 // bypassed, if one exists. |proxy_servers| can be NULL if the caller isn't |
| 98 // interested in its values. Virtual for testing. | 103 // interested in its values. Virtual for testing. |
| 99 virtual bool IsDataReductionProxy(const net::HostPortPair& host_port_pair, | 104 virtual bool IsDataReductionProxy(const net::HostPortPair& host_port_pair, |
| 100 std::pair<GURL, GURL>* proxy_servers) const; | 105 std::pair<GURL, GURL>* proxy_servers) const; |
| 101 | 106 |
| 102 // Returns true if this request will be sent through the data request proxy | 107 // Returns true if this request will be sent through the data request proxy |
| 103 // based on applying the param rules to the URL. We do not check bad proxy | 108 // based on applying the param rules to the URL. We do not check bad proxy |
| 104 // list. | 109 // list. |
| 105 virtual bool IsDataReductionProxyEligible(const net::URLRequest* request); | 110 virtual bool IsDataReductionProxyEligible(const net::URLRequest* request); |
| 106 | 111 |
| 112 // Checks if all configured data reduction proxies are in the retry map. |
| 113 // Returns true if the request is bypassed by all configured data reduction |
| 114 // proxies and returns the bypass delay in delay_seconds (if not NULL). If |
| 115 // there are no configured data reduction proxies, returns false. If |
| 116 // the request is bypassed by more than one proxy, delay_seconds returns |
| 117 // the shortest delay. |
| 118 bool AreDataReductionProxiesBypassed(const net::URLRequest& request, |
| 119 base::TimeDelta* min_retry_delay) const; |
| 120 |
| 121 // Checks if all configured data reduction proxies are in the retry map. |
| 122 // Returns true if the request is bypassed by all configured data reduction |
| 123 // proxies and returns the bypass delay in delay_seconds (if not NULL). If |
| 124 // there are no configured data reduction proxies, returns false. If |
| 125 // the request is bypassed by more than one proxy, delay_seconds returns |
| 126 // the shortest delay. |
| 127 bool AreProxiesBypassed(const net::ProxyRetryInfoMap& retry_map, |
| 128 bool is_https, |
| 129 base::TimeDelta* min_retry_delay) const; |
| 130 |
| 107 // Returns the data reduction proxy primary origin. | 131 // Returns the data reduction proxy primary origin. |
| 108 const GURL& origin() const { | 132 const GURL& origin() const { |
| 109 return origin_; | 133 return origin_; |
| 110 } | 134 } |
| 111 | 135 |
| 112 // Returns the data reduction proxy fallback origin. | 136 // Returns the data reduction proxy fallback origin. |
| 113 const GURL& fallback_origin() const { | 137 const GURL& fallback_origin() const { |
| 114 return fallback_origin_; | 138 return fallback_origin_; |
| 115 } | 139 } |
| 116 | 140 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 virtual std::string GetDefaultDevOrigin() const; | 221 virtual std::string GetDefaultDevOrigin() const; |
| 198 virtual std::string GetDefaultOrigin() const; | 222 virtual std::string GetDefaultOrigin() const; |
| 199 virtual std::string GetDefaultFallbackOrigin() const; | 223 virtual std::string GetDefaultFallbackOrigin() const; |
| 200 virtual std::string GetDefaultSSLOrigin() const; | 224 virtual std::string GetDefaultSSLOrigin() const; |
| 201 virtual std::string GetDefaultAltOrigin() const; | 225 virtual std::string GetDefaultAltOrigin() const; |
| 202 virtual std::string GetDefaultAltFallbackOrigin() const; | 226 virtual std::string GetDefaultAltFallbackOrigin() const; |
| 203 virtual std::string GetDefaultProbeURL() const; | 227 virtual std::string GetDefaultProbeURL() const; |
| 204 virtual std::string GetDefaultWarmupURL() const; | 228 virtual std::string GetDefaultWarmupURL() const; |
| 205 | 229 |
| 206 private: | 230 private: |
| 231 // Checks if the primary and fallback data reduction proxies are in the retry |
| 232 // map. Returns true if the request is bypassed by both data reduction |
| 233 // proxies and returns the shortest bypass delay in delay_seconds (if not |
| 234 // NULL). If the fallback proxy is not valid, returns true if primary proxy |
| 235 // was bypassed and returns its bypass delay. |
| 236 bool ArePrimaryAndFallbackBypassed(const net::ProxyRetryInfoMap& retry_map, |
| 237 const GURL& primary, |
| 238 const GURL& fallback, |
| 239 base::TimeDelta* min_retry_delay) const; |
| 207 GURL origin_; | 240 GURL origin_; |
| 208 GURL fallback_origin_; | 241 GURL fallback_origin_; |
| 209 GURL ssl_origin_; | 242 GURL ssl_origin_; |
| 210 GURL alt_origin_; | 243 GURL alt_origin_; |
| 211 GURL alt_fallback_origin_; | 244 GURL alt_fallback_origin_; |
| 212 GURL probe_url_; | 245 GURL probe_url_; |
| 213 GURL warmup_url_; | 246 GURL warmup_url_; |
| 214 | 247 |
| 215 bool allowed_; | 248 bool allowed_; |
| 216 const bool fallback_allowed_; | 249 const bool fallback_allowed_; |
| 217 bool alt_allowed_; | 250 bool alt_allowed_; |
| 218 const bool promo_allowed_; | 251 const bool promo_allowed_; |
| 219 bool holdback_; | 252 bool holdback_; |
| 220 | 253 |
| 221 bool configured_on_command_line_; | 254 bool configured_on_command_line_; |
| 222 | 255 |
| 223 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyParams); | 256 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyParams); |
| 224 }; | 257 }; |
| 225 | 258 |
| 226 } // namespace data_reduction_proxy | 259 } // namespace data_reduction_proxy |
| 227 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PARAMS_H
_ | 260 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PARAMS_H
_ |
| OLD | NEW |