Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(527)

Side by Side Diff: components/data_reduction_proxy/browser/data_reduction_proxy_params.h

Issue 388663002: Added data reduction proxy holdback experiment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "url/gurl.h" 14 #include "url/gurl.h"
15 15
16 namespace net { 16 namespace net {
17 class URLRequest; 17 class URLRequest;
18 } 18 }
19 19
20 namespace data_reduction_proxy { 20 namespace data_reduction_proxy {
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 // Flags used during construction that specify if the data reduction proxy
28 // is allowed to be used, if the fallback proxy is allowed to be used, if
29 // an alternative set of proxies is allowed to be used, if the promotion is
30 // allowed to be shown, and if this instance is part of a holdback experiment.
27 static const unsigned int kAllowed = (1 << 0); 31 static const unsigned int kAllowed = (1 << 0);
28 static const unsigned int kFallbackAllowed = (1 << 1); 32 static const unsigned int kFallbackAllowed = (1 << 1);
29 static const unsigned int kAlternativeAllowed = (1 << 2); 33 static const unsigned int kAlternativeAllowed = (1 << 2);
30 static const unsigned int kPromoAllowed = (1 << 3); 34 static const unsigned int kPromoAllowed = (1 << 3);
35 static const unsigned int kHoldback = (1 << 4);
31 36
32 typedef std::vector<GURL> DataReductionProxyList; 37 typedef std::vector<GURL> DataReductionProxyList;
33 38
34 // Returns true if this client is part of the data reduction proxy field 39 // Returns true if this client is part of the data reduction proxy field
35 // trial. 40 // trial.
36 static bool IsIncludedInFieldTrial(); 41 static bool IsIncludedInFieldTrial();
37 42
38 // Returns true if this client is part of field trial to use an alternative 43 // Returns true if this client is part of field trial to use an alternative
39 // configuration for the data reduction proxy. 44 // configuration for the data reduction proxy.
40 static bool IsIncludedInAlternativeFieldTrial(); 45 static bool IsIncludedInAlternativeFieldTrial();
41 46
42 // Returns true if this client is part of the field trial that should display 47 // Returns true if this client is part of the field trial that should display
43 // a promotion for the data reduction proxy. 48 // a promotion for the data reduction proxy.
44 static bool IsIncludedInPromoFieldTrial(); 49 static bool IsIncludedInPromoFieldTrial();
45 50
46 // Returns true if this client is part of a field trial that uses preconnect 51 // Returns true if this client is part of a field trial that uses preconnect
47 // hinting. 52 // hinting.
48 static bool IsIncludedInPreconnectHintingFieldTrial(); 53 static bool IsIncludedInPreconnectHintingFieldTrial();
49 54
50 // Returns true if this client is part of a field trial that bypasses the 55 // Returns true if this client is part of a field trial that bypasses the
51 // proxy if the request resource type is on the critical path (e.g. HTML). 56 // proxy if the request resource type is on the critical path (e.g. HTML).
52 static bool IsIncludedInCriticalPathBypassFieldTrial(); 57 static bool IsIncludedInCriticalPathBypassFieldTrial();
53 58
59 // Returns true if this client is part of a field trial that runs a holdback
60 // experiment. A holdback experiment is one in which a fraction of browser
61 // instances will not be configured to use the data reduction proxy even if
62 // users have enabled it to be used. The UI will not indicate that a holdback
63 // is in effect.
64 static bool IsIncludedInHoldbackFieldTrial();
65
54 // Constructs configuration parameters. If |kAllowed|, then the standard 66 // Constructs configuration parameters. If |kAllowed|, then the standard
55 // data reduction proxy configuration is allowed to be used. If 67 // data reduction proxy configuration is allowed to be used. If
56 // |kfallbackAllowed| a fallback proxy can be used if the primary proxy is 68 // |kfallbackAllowed| a fallback proxy can be used if the primary proxy is
57 // bypassed or disabled. If |kAlternativeAllowed| then an alternative proxy 69 // bypassed or disabled. If |kAlternativeAllowed| then an alternative proxy
58 // configuration is allowed to be used. This alternative configuration would 70 // configuration is allowed to be used. This alternative configuration would
59 // replace the primary and fallback proxy configurations if enabled. Finally 71 // replace the primary and fallback proxy configurations if enabled. Finally
60 // if |kPromoAllowed|, the client may show a promotion for the data reduction 72 // if |kPromoAllowed|, the client may show a promotion for the data reduction
61 // proxy. 73 // proxy.
62 // 74 //
63 // A standard configuration has a primary proxy, and a fallback proxy for 75 // A standard configuration has a primary proxy, and a fallback proxy for
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 return alt_allowed_; 156 return alt_allowed_;
145 } 157 }
146 158
147 // Returns true if the data reduction proxy promo may be shown. 159 // Returns true if the data reduction proxy promo may be shown.
148 // This is idependent of whether the data reduction proxy is allowed. 160 // This is idependent of whether the data reduction proxy is allowed.
149 // TODO(bengr): maybe tie to whether proxy is allowed. 161 // TODO(bengr): maybe tie to whether proxy is allowed.
150 bool promo_allowed() const { 162 bool promo_allowed() const {
151 return promo_allowed_; 163 return promo_allowed_;
152 } 164 }
153 165
166 // Returns true if the data reduction proxy should not actually use the
167 // proxy if enabled.
168 bool holdback() const {
169 return holdback_;
170 }
171
154 // Given |allowed_|, |fallback_allowed_|, and |alt_allowed_|, returns the 172 // Given |allowed_|, |fallback_allowed_|, and |alt_allowed_|, returns the
155 // list of data reduction proxies that may be used. 173 // list of data reduction proxies that may be used.
156 DataReductionProxyList GetAllowedProxies() const; 174 DataReductionProxyList GetAllowedProxies() const;
157 175
158 // Returns true if any proxy origins are set on the command line. 176 // Returns true if any proxy origins are set on the command line.
159 bool is_configured_on_command_line() const { 177 bool is_configured_on_command_line() const {
160 return configured_on_command_line_; 178 return configured_on_command_line_;
161 } 179 }
162 180
163 protected: 181 protected:
(...skipping 27 matching lines...) Expand all
191 GURL ssl_origin_; 209 GURL ssl_origin_;
192 GURL alt_origin_; 210 GURL alt_origin_;
193 GURL alt_fallback_origin_; 211 GURL alt_fallback_origin_;
194 GURL probe_url_; 212 GURL probe_url_;
195 GURL warmup_url_; 213 GURL warmup_url_;
196 214
197 bool allowed_; 215 bool allowed_;
198 const bool fallback_allowed_; 216 const bool fallback_allowed_;
199 bool alt_allowed_; 217 bool alt_allowed_;
200 const bool promo_allowed_; 218 const bool promo_allowed_;
219 bool holdback_;
201 220
202 bool configured_on_command_line_; 221 bool configured_on_command_line_;
203 222
204 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyParams); 223 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyParams);
205 }; 224 };
206 225
207 } // namespace data_reduction_proxy 226 } // namespace data_reduction_proxy
208 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PARAMS_H _ 227 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PARAMS_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698