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_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 10 matching lines...) Expand all Loading... | |
| 21 // Provides initialization parameters. Proxy origins, and the probe url are | 21 // Provides initialization parameters. Proxy origins, and the probe url are |
| 22 // are taken from flags if available and from preprocessor constants otherwise. | 22 // are taken from flags if available and from preprocessor constants otherwise. |
| 23 // The DataReductionProxySettings class and others use this class to determine | 23 // The DataReductionProxySettings class and others use this class to determine |
| 24 // the necessary DNS names to configure use of the data reduction proxy. | 24 // the necessary DNS names to configure use of the data reduction proxy. |
| 25 class DataReductionProxyParams { | 25 class DataReductionProxyParams { |
| 26 public: | 26 public: |
| 27 static const unsigned int kAllowed = (1 << 0); | 27 static const unsigned int kAllowed = (1 << 0); |
| 28 static const unsigned int kFallbackAllowed = (1 << 1); | 28 static const unsigned int kFallbackAllowed = (1 << 1); |
| 29 static const unsigned int kAlternativeAllowed = (1 << 2); | 29 static const unsigned int kAlternativeAllowed = (1 << 2); |
| 30 static const unsigned int kPromoAllowed = (1 << 3); | 30 static const unsigned int kPromoAllowed = (1 << 3); |
| 31 static const unsigned int kHoldback = (1 << 4); | |
|
marq (ping after 24h)
2014/07/11 16:41:24
These flags should have some kind of comments.
bengr
2014/07/14 18:51:43
Done.
| |
| 31 | 32 |
| 32 typedef std::vector<GURL> DataReductionProxyList; | 33 typedef std::vector<GURL> DataReductionProxyList; |
| 33 | 34 |
| 34 // Returns true if this client is part of the data reduction proxy field | 35 // Returns true if this client is part of the data reduction proxy field |
| 35 // trial. | 36 // trial. |
| 36 static bool IsIncludedInFieldTrial(); | 37 static bool IsIncludedInFieldTrial(); |
| 37 | 38 |
| 38 // Returns true if this client is part of field trial to use an alternative | 39 // Returns true if this client is part of field trial to use an alternative |
| 39 // configuration for the data reduction proxy. | 40 // configuration for the data reduction proxy. |
| 40 static bool IsIncludedInAlternativeFieldTrial(); | 41 static bool IsIncludedInAlternativeFieldTrial(); |
| 41 | 42 |
| 42 // Returns true if this client is part of the field trial that should display | 43 // Returns true if this client is part of the field trial that should display |
| 43 // a promotion for the data reduction proxy. | 44 // a promotion for the data reduction proxy. |
| 44 static bool IsIncludedInPromoFieldTrial(); | 45 static bool IsIncludedInPromoFieldTrial(); |
| 45 | 46 |
| 46 // Returns true if this client is part of a field trial that uses preconnect | 47 // Returns true if this client is part of a field trial that uses preconnect |
| 47 // hinting. | 48 // hinting. |
| 48 static bool IsIncludedInPreconnectHintingFieldTrial(); | 49 static bool IsIncludedInPreconnectHintingFieldTrial(); |
| 49 | 50 |
| 51 // Returns true if this client is part of a field trial that runs a holdback | |
| 52 // experiment. | |
|
marq (ping after 24h)
2014/07/11 16:41:24
Define 'holdback experiment', for the benefit of s
bengr
2014/07/14 18:51:43
Done.
| |
| 53 static bool IsIncludedInHoldbackFieldTrial(); | |
| 54 | |
| 50 // Constructs configuration parameters. If |kAllowed|, then the standard | 55 // Constructs configuration parameters. If |kAllowed|, then the standard |
| 51 // data reduction proxy configuration is allowed to be used. If | 56 // data reduction proxy configuration is allowed to be used. If |
| 52 // |kfallbackAllowed| a fallback proxy can be used if the primary proxy is | 57 // |kfallbackAllowed| a fallback proxy can be used if the primary proxy is |
| 53 // bypassed or disabled. If |kAlternativeAllowed| then an alternative proxy | 58 // bypassed or disabled. If |kAlternativeAllowed| then an alternative proxy |
| 54 // configuration is allowed to be used. This alternative configuration would | 59 // configuration is allowed to be used. This alternative configuration would |
| 55 // replace the primary and fallback proxy configurations if enabled. Finally | 60 // replace the primary and fallback proxy configurations if enabled. Finally |
| 56 // if |kPromoAllowed|, the client may show a promotion for the data reduction | 61 // if |kPromoAllowed|, the client may show a promotion for the data reduction |
| 57 // proxy. | 62 // proxy. |
| 58 // | 63 // |
| 59 // A standard configuration has a primary proxy, and a fallback proxy for | 64 // A standard configuration has a primary proxy, and a fallback proxy for |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 return alt_allowed_; | 145 return alt_allowed_; |
| 141 } | 146 } |
| 142 | 147 |
| 143 // Returns true if the data reduction proxy promo may be shown. | 148 // Returns true if the data reduction proxy promo may be shown. |
| 144 // This is idependent of whether the data reduction proxy is allowed. | 149 // This is idependent of whether the data reduction proxy is allowed. |
| 145 // TODO(bengr): maybe tie to whether proxy is allowed. | 150 // TODO(bengr): maybe tie to whether proxy is allowed. |
| 146 bool promo_allowed() const { | 151 bool promo_allowed() const { |
| 147 return promo_allowed_; | 152 return promo_allowed_; |
| 148 } | 153 } |
| 149 | 154 |
| 155 // Returns true if the data reduction proxy should not actually use the | |
| 156 // proxy if enabled. | |
| 157 bool holdback() const { | |
| 158 return holdback_; | |
| 159 } | |
| 160 | |
| 150 // Given |allowed_|, |fallback_allowed_|, and |alt_allowed_|, returns the | 161 // Given |allowed_|, |fallback_allowed_|, and |alt_allowed_|, returns the |
| 151 // list of data reduction proxies that may be used. | 162 // list of data reduction proxies that may be used. |
| 152 DataReductionProxyList GetAllowedProxies() const; | 163 DataReductionProxyList GetAllowedProxies() const; |
| 153 | 164 |
| 154 // Returns true if any proxy origins are set on the command line. | 165 // Returns true if any proxy origins are set on the command line. |
| 155 bool is_configured_on_command_line() const { | 166 bool is_configured_on_command_line() const { |
| 156 return configured_on_command_line_; | 167 return configured_on_command_line_; |
| 157 } | 168 } |
| 158 | 169 |
| 159 protected: | 170 protected: |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 187 GURL ssl_origin_; | 198 GURL ssl_origin_; |
| 188 GURL alt_origin_; | 199 GURL alt_origin_; |
| 189 GURL alt_fallback_origin_; | 200 GURL alt_fallback_origin_; |
| 190 GURL probe_url_; | 201 GURL probe_url_; |
| 191 GURL warmup_url_; | 202 GURL warmup_url_; |
| 192 | 203 |
| 193 bool allowed_; | 204 bool allowed_; |
| 194 const bool fallback_allowed_; | 205 const bool fallback_allowed_; |
| 195 bool alt_allowed_; | 206 bool alt_allowed_; |
| 196 const bool promo_allowed_; | 207 const bool promo_allowed_; |
| 208 bool holdback_; | |
| 197 | 209 |
| 198 bool configured_on_command_line_; | 210 bool configured_on_command_line_; |
| 199 | 211 |
| 200 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyParams); | 212 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyParams); |
| 201 }; | 213 }; |
| 202 | 214 |
| 203 } // namespace data_reduction_proxy | 215 } // namespace data_reduction_proxy |
| 204 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PARAMS_H _ | 216 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PARAMS_H _ |
| OLD | NEW |