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

Side by Side Diff: components/data_reduction_proxy/core/common/data_reduction_proxy_params.h

Issue 2922663002: Data Reduction Proxy: Remove duplicate functions (Closed)
Patch Set: megjablon comments Created 3 years, 6 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_CORE_COMMON_DATA_REDUCTION_PROXY_PARAMS_ H_ 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_COMMON_DATA_REDUCTION_PROXY_PARAMS_ H_
6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_COMMON_DATA_REDUCTION_PROXY_PARAMS_ H_ 6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_COMMON_DATA_REDUCTION_PROXY_PARAMS_ H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 28 matching lines...) Expand all
39 bool IsIncludedInHoldbackFieldTrial(); 39 bool IsIncludedInHoldbackFieldTrial();
40 40
41 // Returns the name of the trusted SPDY/HTTP2 proxy field trial. 41 // Returns the name of the trusted SPDY/HTTP2 proxy field trial.
42 const char* GetTrustedSpdyProxyFieldTrialName(); 42 const char* GetTrustedSpdyProxyFieldTrialName();
43 43
44 // Returns true if this client is part of the enabled group of the trusted 44 // Returns true if this client is part of the enabled group of the trusted
45 // SPDY/HTTP2 proxy field trial. 45 // SPDY/HTTP2 proxy field trial.
46 bool IsIncludedInTrustedSpdyProxyFieldTrial(); 46 bool IsIncludedInTrustedSpdyProxyFieldTrial();
47 47
48 // Returns true if this client is part of the field trial that should display 48 // Returns true if this client is part of the field trial that should display
49 // a promotion for the data reduction proxy on Android One devices. 49 // a promotion for the data reduction proxy on Android One devices. This is for
50 bool IsIncludedInAndroidOnePromoFieldTrial(base::StringPiece build_fingerprint); 50 // testing purposes and should not be called outside of tests.
51 bool IsIncludedInAndroidOnePromoFieldTrialForTesting(
52 base::StringPiece build_fingerprint);
51 53
52 // Returns the name of the Lo-Fi field trial. 54 // Returns the name of the Lo-Fi field trial.
53 const char* GetLoFiFieldTrialName(); 55 const char* GetLoFiFieldTrialName();
54 56
55 // Returns the name of the Lo-Fi field trial that configures LoFi flags when it 57 // Returns the name of the Lo-Fi field trial that configures LoFi flags when it
56 // is force enabled through flags. 58 // is force enabled through flags.
57 const char* GetLoFiFlagFieldTrialName(); 59 const char* GetLoFiFlagFieldTrialName();
58 60
59 // Returns true if this client is part of the "Enabled" or "Enabled_Preview" 61 // Returns true if this client is part of the "Enabled" or "Enabled_Preview"
60 // group of the Lo-Fi field trial, both of which mean Lo-Fi should be enabled. 62 // group of the Lo-Fi field trial, both of which mean Lo-Fi should be enabled.
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 size_t proxy_index; 181 size_t proxy_index;
180 }; 182 };
181 183
182 // Provides initialization parameters. Proxy origins, and the secure proxy 184 // Provides initialization parameters. Proxy origins, and the secure proxy
183 // check url are are taken from flags if available and from preprocessor 185 // check url are are taken from flags if available and from preprocessor
184 // constants otherwise. The DataReductionProxySettings class and others use this 186 // constants otherwise. The DataReductionProxySettings class and others use this
185 // class to determine the necessary DNS names to configure use of the Data 187 // class to determine the necessary DNS names to configure use of the Data
186 // Reduction Proxy. 188 // Reduction Proxy.
187 class DataReductionProxyParams : public DataReductionProxyConfigValues { 189 class DataReductionProxyParams : public DataReductionProxyConfigValues {
188 public: 190 public:
189 // Flags used during construction that specify if the promotion is allowed to 191 // Constructs configuration parameters. A standard configuration has a primary
190 // be shown, and if this instance is part of a holdback experiment. 192 // proxy, and a fallback proxy for HTTP traffic.
191 static const unsigned int kPromoAllowed = (1 << 2); 193 DataReductionProxyParams();
192 static const unsigned int kHoldback = (1 << 3);
193
194 // Constructs configuration parameters. If |kPromoAllowed|, the client may
195 // show a promotion for the data reduction proxy.
196 //
197 // A standard configuration has a primary proxy, and a fallback proxy for
198 // HTTP traffic.
199 explicit DataReductionProxyParams(int flags);
200 194
201 // Updates |proxies_for_http_|. 195 // Updates |proxies_for_http_|.
202 void SetProxiesForHttpForTesting( 196 void SetProxiesForHttpForTesting(
203 const std::vector<DataReductionProxyServer>& proxies_for_http); 197 const std::vector<DataReductionProxyServer>& proxies_for_http);
204 198
205 ~DataReductionProxyParams() override; 199 ~DataReductionProxyParams() override;
206 200
207 const std::vector<DataReductionProxyServer>& proxies_for_http() 201 const std::vector<DataReductionProxyServer>& proxies_for_http()
208 const override; 202 const override;
209 203
210 const GURL& secure_proxy_check_url() const override; 204 const GURL& secure_proxy_check_url() const override;
211 205
212 bool promo_allowed() const override;
213
214 bool holdback() const override;
215
216 protected: 206 protected:
217 // Test constructor that optionally won't call Init(); 207 // Test constructor that optionally won't call Init();
218 DataReductionProxyParams(int flags, 208 explicit DataReductionProxyParams(bool should_call_init);
219 bool should_call_init);
220 209
221 // Initialize the values of the proxies, and secure proxy check URL, from 210 // Initialize the values of the proxies, and secure proxy check URL, from
222 // command line flags and preprocessor constants, and check that there are 211 // command line flags and preprocessor constants, and check that there are
223 // corresponding definitions for the allowed configurations. 212 // corresponding definitions for the allowed configurations.
224 bool Init(); 213 bool Init();
225 214
226 // Initialize the values of the proxies, and secure proxy check URL from 215 // Initialize the values of the proxies, and secure proxy check URL from
227 // command line flags and preprocessor constants. 216 // command line flags and preprocessor constants.
228 void InitWithoutChecks(); 217 void InitWithoutChecks();
229 218
230 // Returns the corresponding string from preprocessor constants if defined, 219 // Returns the corresponding string from preprocessor constants if defined,
231 // and an empty string otherwise. 220 // and an empty string otherwise.
232 virtual std::string GetDefaultOrigin() const; 221 virtual std::string GetDefaultOrigin() const;
233 virtual std::string GetDefaultFallbackOrigin() const; 222 virtual std::string GetDefaultFallbackOrigin() const;
234 virtual std::string GetDefaultSecureProxyCheckURL() const; 223 virtual std::string GetDefaultSecureProxyCheckURL() const;
235 224
236 private: 225 private:
237 std::vector<DataReductionProxyServer> proxies_for_http_; 226 std::vector<DataReductionProxyServer> proxies_for_http_;
238 227
239 net::ProxyServer origin_; 228 net::ProxyServer origin_;
240 net::ProxyServer fallback_origin_; 229 net::ProxyServer fallback_origin_;
241 230
242 GURL secure_proxy_check_url_; 231 GURL secure_proxy_check_url_;
243 232
244 bool promo_allowed_;
245 bool holdback_;
246
247 bool use_override_proxies_for_http_; 233 bool use_override_proxies_for_http_;
248 std::vector<DataReductionProxyServer> override_data_reduction_proxy_servers_; 234 std::vector<DataReductionProxyServer> override_data_reduction_proxy_servers_;
249 235
250 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyParams); 236 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyParams);
251 }; 237 };
252 238
253 } // namespace data_reduction_proxy 239 } // namespace data_reduction_proxy
254 240
255 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_COMMON_DATA_REDUCTION_PROXY_PARA MS_H_ 241 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_COMMON_DATA_REDUCTION_PROXY_PARA MS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698