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> |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // the necessary DNS names to configure use of the data reduction proxy. | 44 // the necessary DNS names to configure use of the data reduction proxy. |
45 class DataReductionProxyParams { | 45 class DataReductionProxyParams { |
46 public: | 46 public: |
47 // Flags used during construction that specify if the data reduction proxy | 47 // Flags used during construction that specify if the data reduction proxy |
48 // is allowed to be used, if the fallback proxy is allowed to be used, if | 48 // is allowed to be used, if the fallback proxy is allowed to be used, if |
49 // an alternative set of proxies is allowed to be used, if the promotion is | 49 // an alternative set of proxies is allowed to be used, if the promotion is |
50 // allowed to be shown, and if this instance is part of a holdback experiment. | 50 // allowed to be shown, and if this instance is part of a holdback experiment. |
51 static const unsigned int kAllowed = (1 << 0); | 51 static const unsigned int kAllowed = (1 << 0); |
52 static const unsigned int kFallbackAllowed = (1 << 1); | 52 static const unsigned int kFallbackAllowed = (1 << 1); |
53 static const unsigned int kAlternativeAllowed = (1 << 2); | 53 static const unsigned int kAlternativeAllowed = (1 << 2); |
54 static const unsigned int kPromoAllowed = (1 << 3); | 54 static const unsigned int kAlternativeFallbackAllowed = (1 << 3); |
55 static const unsigned int kHoldback = (1 << 4); | 55 static const unsigned int kPromoAllowed = (1 << 4); |
| 56 static const unsigned int kHoldback = (1 << 5); |
56 | 57 |
57 typedef std::vector<GURL> DataReductionProxyList; | 58 typedef std::vector<GURL> DataReductionProxyList; |
58 | 59 |
59 // Returns true if this client is part of the data reduction proxy field | 60 // Returns true if this client is part of the data reduction proxy field |
60 // trial. | 61 // trial. |
61 static bool IsIncludedInFieldTrial(); | 62 static bool IsIncludedInFieldTrial(); |
62 | 63 |
63 // Returns true if this client is part of field trial to use an alternative | 64 // Returns true if this client is part of field trial to use an alternative |
64 // configuration for the data reduction proxy. | 65 // configuration for the data reduction proxy. |
65 static bool IsIncludedInAlternativeFieldTrial(); | 66 static bool IsIncludedInAlternativeFieldTrial(); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 bool fallback_allowed() const { | 203 bool fallback_allowed() const { |
203 return fallback_allowed_; | 204 return fallback_allowed_; |
204 } | 205 } |
205 | 206 |
206 // Returns true if the alternative data reduction proxy configuration may be | 207 // Returns true if the alternative data reduction proxy configuration may be |
207 // used. | 208 // used. |
208 bool alternative_allowed() const { | 209 bool alternative_allowed() const { |
209 return alt_allowed_; | 210 return alt_allowed_; |
210 } | 211 } |
211 | 212 |
| 213 // Returns true if the alternative fallback data reduction proxy |
| 214 // configuration may be used. |
| 215 bool alternative_fallback_allowed() const { |
| 216 return alt_fallback_allowed_; |
| 217 } |
| 218 |
212 // Returns true if the data reduction proxy promo may be shown. | 219 // Returns true if the data reduction proxy promo may be shown. |
213 // This is idependent of whether the data reduction proxy is allowed. | 220 // This is idependent of whether the data reduction proxy is allowed. |
214 // TODO(bengr): maybe tie to whether proxy is allowed. | 221 // TODO(bengr): maybe tie to whether proxy is allowed. |
215 bool promo_allowed() const { | 222 bool promo_allowed() const { |
216 return promo_allowed_; | 223 return promo_allowed_; |
217 } | 224 } |
218 | 225 |
219 // Returns true if the data reduction proxy should not actually use the | 226 // Returns true if the data reduction proxy should not actually use the |
220 // proxy if enabled. | 227 // proxy if enabled. |
221 bool holdback() const { | 228 bool holdback() const { |
(...skipping 12 matching lines...) Expand all Loading... |
234 protected: | 241 protected: |
235 // Test constructor that optionally won't call Init(); | 242 // Test constructor that optionally won't call Init(); |
236 DataReductionProxyParams(int flags, | 243 DataReductionProxyParams(int flags, |
237 bool should_call_init); | 244 bool should_call_init); |
238 | 245 |
239 DataReductionProxyParams(const DataReductionProxyParams& params); | 246 DataReductionProxyParams(const DataReductionProxyParams& params); |
240 | 247 |
241 // Initialize the values of the proxies, and probe URL, from command | 248 // Initialize the values of the proxies, and probe URL, from command |
242 // line flags and preprocessor constants, and check that there are | 249 // line flags and preprocessor constants, and check that there are |
243 // corresponding definitions for the allowed configurations. | 250 // corresponding definitions for the allowed configurations. |
244 bool Init(bool allowed, bool fallback_allowed, bool alt_allowed); | 251 bool Init(bool allowed, |
| 252 bool fallback_allowed, |
| 253 bool alt_allowed, |
| 254 bool alt_fallback_allowed); |
245 | 255 |
246 // Initialize the values of the proxies, and probe URL from command | 256 // Initialize the values of the proxies, and probe URL from command |
247 // line flags and preprocessor constants. | 257 // line flags and preprocessor constants. |
248 void InitWithoutChecks(); | 258 void InitWithoutChecks(); |
249 | 259 |
250 // Returns the corresponding string from preprocessor constants if defined, | 260 // Returns the corresponding string from preprocessor constants if defined, |
251 // and an empty string otherwise. | 261 // and an empty string otherwise. |
252 virtual std::string GetDefaultDevOrigin() const; | 262 virtual std::string GetDefaultDevOrigin() const; |
253 virtual std::string GetDefaultDevFallbackOrigin() const; | 263 virtual std::string GetDefaultDevFallbackOrigin() const; |
254 virtual std::string GetDefaultOrigin() const; | 264 virtual std::string GetDefaultOrigin() const; |
(...skipping 21 matching lines...) Expand all Loading... |
276 GURL fallback_origin_; | 286 GURL fallback_origin_; |
277 GURL ssl_origin_; | 287 GURL ssl_origin_; |
278 GURL alt_origin_; | 288 GURL alt_origin_; |
279 GURL alt_fallback_origin_; | 289 GURL alt_fallback_origin_; |
280 GURL probe_url_; | 290 GURL probe_url_; |
281 GURL warmup_url_; | 291 GURL warmup_url_; |
282 | 292 |
283 bool allowed_; | 293 bool allowed_; |
284 bool fallback_allowed_; | 294 bool fallback_allowed_; |
285 bool alt_allowed_; | 295 bool alt_allowed_; |
| 296 bool alt_fallback_allowed_; |
286 bool promo_allowed_; | 297 bool promo_allowed_; |
287 bool holdback_; | 298 bool holdback_; |
288 | 299 |
289 bool configured_on_command_line_; | 300 bool configured_on_command_line_; |
290 }; | 301 }; |
291 | 302 |
292 } // namespace data_reduction_proxy | 303 } // namespace data_reduction_proxy |
293 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PARAMS_H
_ | 304 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PARAMS_H
_ |
OLD | NEW |