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

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

Issue 412143009: Moved data reduction proxy initialization logic to ProfileImplIOData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 6 years, 4 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/memory/scoped_ptr.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 "net/proxy/proxy_retry_info.h"
15 #include "url/gurl.h" 15 #include "url/gurl.h"
16 16
17 namespace base { 17 namespace base {
18 class TimeDelta; 18 class TimeDelta;
19 } 19 }
20 20
21 namespace net { 21 namespace net {
22 class URLRequest; 22 class URLRequest;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // |kfallbackAllowed| a fallback proxy can be used if the primary proxy is 73 // |kfallbackAllowed| a fallback proxy can be used if the primary proxy is
74 // bypassed or disabled. If |kAlternativeAllowed| then an alternative proxy 74 // bypassed or disabled. If |kAlternativeAllowed| then an alternative proxy
75 // configuration is allowed to be used. This alternative configuration would 75 // configuration is allowed to be used. This alternative configuration would
76 // replace the primary and fallback proxy configurations if enabled. Finally 76 // replace the primary and fallback proxy configurations if enabled. Finally
77 // if |kPromoAllowed|, the client may show a promotion for the data reduction 77 // if |kPromoAllowed|, the client may show a promotion for the data reduction
78 // proxy. 78 // proxy.
79 // 79 //
80 // A standard configuration has a primary proxy, and a fallback proxy for 80 // A standard configuration has a primary proxy, and a fallback proxy for
81 // HTTP traffic. The alternative configuration has a different primary and 81 // HTTP traffic. The alternative configuration has a different primary and
82 // fallback proxy for HTTP traffic, and an SSL proxy. 82 // fallback proxy for HTTP traffic, and an SSL proxy.
83 explicit DataReductionProxyParams(int flags);
83 84
84 DataReductionProxyParams(int flags); 85 // Creates a copy of the configuration parameters.
86 scoped_ptr<DataReductionProxyParams> Clone();
85 87
86 virtual ~DataReductionProxyParams(); 88 virtual ~DataReductionProxyParams();
87 89
88 // Returns true if a data reduction proxy was used for the given |request|. 90 // Returns true if a data reduction proxy was used for the given |request|.
89 // If true, |proxy_servers.first| will contain the name of the proxy that was 91 // If true, |proxy_servers.first| will contain the name of the proxy that was
90 // used. |proxy_servers.second| will contain the name of the data reduction 92 // used. |proxy_servers.second| will contain the name of the data reduction
91 // proxy server that would be used if |proxy_server.first| is bypassed, if one 93 // proxy server that would be used if |proxy_server.first| is bypassed, if one
92 // exists. |proxy_servers| can be NULL if the caller isn't interested in its 94 // exists. |proxy_servers| can be NULL if the caller isn't interested in its
93 // values. 95 // values.
94 virtual bool WasDataReductionProxyUsed( 96 virtual bool WasDataReductionProxyUsed(
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // Returns true if any proxy origins are set on the command line. 202 // Returns true if any proxy origins are set on the command line.
201 bool is_configured_on_command_line() const { 203 bool is_configured_on_command_line() const {
202 return configured_on_command_line_; 204 return configured_on_command_line_;
203 } 205 }
204 206
205 protected: 207 protected:
206 // Test constructor that optionally won't call Init(); 208 // Test constructor that optionally won't call Init();
207 DataReductionProxyParams(int flags, 209 DataReductionProxyParams(int flags,
208 bool should_call_init); 210 bool should_call_init);
209 211
212 DataReductionProxyParams(const DataReductionProxyParams& params);
213
210 // Initialize the values of the proxies, and probe URL, from command 214 // Initialize the values of the proxies, and probe URL, from command
211 // line flags and preprocessor constants, and check that there are 215 // line flags and preprocessor constants, and check that there are
212 // corresponding definitions for the allowed configurations. 216 // corresponding definitions for the allowed configurations.
213 bool Init(bool allowed, bool fallback_allowed, bool alt_allowed); 217 bool Init(bool allowed, bool fallback_allowed, bool alt_allowed);
214 218
215 // Initialize the values of the proxies, and probe URL from command 219 // Initialize the values of the proxies, and probe URL from command
216 // line flags and preprocessor constants. 220 // line flags and preprocessor constants.
217 void InitWithoutChecks(); 221 void InitWithoutChecks();
218 222
219 // Returns the corresponding string from preprocessor constants if defined, 223 // Returns the corresponding string from preprocessor constants if defined,
(...skipping 10 matching lines...) Expand all
230 private: 234 private:
231 // Checks if the primary and fallback data reduction proxies are in the retry 235 // 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 236 // 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 237 // 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 238 // NULL). If the fallback proxy is not valid, returns true if primary proxy
235 // was bypassed and returns its bypass delay. 239 // was bypassed and returns its bypass delay.
236 bool ArePrimaryAndFallbackBypassed(const net::ProxyRetryInfoMap& retry_map, 240 bool ArePrimaryAndFallbackBypassed(const net::ProxyRetryInfoMap& retry_map,
237 const GURL& primary, 241 const GURL& primary,
238 const GURL& fallback, 242 const GURL& fallback,
239 base::TimeDelta* min_retry_delay) const; 243 base::TimeDelta* min_retry_delay) const;
244
245 DataReductionProxyParams& operator=(const DataReductionProxyParams& params);
246
240 GURL origin_; 247 GURL origin_;
241 GURL fallback_origin_; 248 GURL fallback_origin_;
242 GURL ssl_origin_; 249 GURL ssl_origin_;
243 GURL alt_origin_; 250 GURL alt_origin_;
244 GURL alt_fallback_origin_; 251 GURL alt_fallback_origin_;
245 GURL probe_url_; 252 GURL probe_url_;
246 GURL warmup_url_; 253 GURL warmup_url_;
247 254
248 bool allowed_; 255 bool allowed_;
249 const bool fallback_allowed_; 256 bool fallback_allowed_;
250 bool alt_allowed_; 257 bool alt_allowed_;
251 const bool promo_allowed_; 258 bool promo_allowed_;
252 bool holdback_; 259 bool holdback_;
253 260
254 bool configured_on_command_line_; 261 bool configured_on_command_line_;
255
256 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyParams);
257 }; 262 };
258 263
259 } // namespace data_reduction_proxy 264 } // namespace data_reduction_proxy
260 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PARAMS_H _ 265 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PARAMS_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698