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

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

Issue 390533003: Bypassed Bytes UMAs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed bengr and asvitkine comments 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 "net/proxy/proxy_retry_info.h"
14 #include "url/gurl.h" 15 #include "url/gurl.h"
15 16
17 namespace base {
18 class TimeDelta;
19 }
20
16 namespace net { 21 namespace net {
17 class URLRequest; 22 class URLRequest;
18 } 23 }
19 24
20 namespace data_reduction_proxy { 25 namespace data_reduction_proxy {
21 // Provides initialization parameters. Proxy origins, and the probe url are 26 // Provides initialization parameters. Proxy origins, and the probe url are
22 // are taken from flags if available and from preprocessor constants otherwise. 27 // are taken from flags if available and from preprocessor constants otherwise.
23 // The DataReductionProxySettings class and others use this class to determine 28 // The DataReductionProxySettings class and others use this class to determine
24 // the necessary DNS names to configure use of the data reduction proxy. 29 // the necessary DNS names to configure use of the data reduction proxy.
25 class DataReductionProxyParams { 30 class DataReductionProxyParams {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // bypassed, if one exists. |proxy_servers| can be NULL if the caller isn't 90 // bypassed, if one exists. |proxy_servers| can be NULL if the caller isn't
86 // interested in its values. Virtual for testing. 91 // interested in its values. Virtual for testing.
87 virtual bool IsDataReductionProxy(const net::HostPortPair& host_port_pair, 92 virtual bool IsDataReductionProxy(const net::HostPortPair& host_port_pair,
88 std::pair<GURL, GURL>* proxy_servers) const; 93 std::pair<GURL, GURL>* proxy_servers) const;
89 94
90 // Returns true if this request will be sent through the data request proxy 95 // Returns true if this request will be sent through the data request proxy
91 // based on applying the param rules to the URL. We do not check bad proxy 96 // based on applying the param rules to the URL. We do not check bad proxy
92 // list. 97 // list.
93 virtual bool IsDataReductionProxyEligible(const net::URLRequest* request); 98 virtual bool IsDataReductionProxyEligible(const net::URLRequest* request);
94 99
100 // Checks if all configured data reduction proxies are in the retry map.
101 // Returns true if the request is bypassed by all configured data reduction
102 // proxies and returns the bypass delay in delay_seconds (if not NULL). If
103 // there are no configured data reduction proxies, returns false. If
104 // the request is bypassed by more than one proxy, delay_seconds returns
105 // the shortest delay.
106 bool AreDataReductionProxiesBypassed(const net::URLRequest& request,
107 base::TimeDelta* min_retry_delay) const;
108
109 // Checks if all configured data reduction proxies are in the retry map.
110 // Returns true if the request is bypassed by all configured data reduction
111 // proxies and returns the bypass delay in delay_seconds (if not NULL). If
112 // there are no configured data reduction proxies, returns false. If
113 // the request is bypassed by more than one proxy, delay_seconds returns
114 // the shortest delay.
115 bool AreProxiesBypassed(const net::ProxyRetryInfoMap& retry_map,
116 bool is_https,
117 base::TimeDelta* min_retry_delay) const;
118
95 // Returns the data reduction proxy primary origin. 119 // Returns the data reduction proxy primary origin.
96 const GURL& origin() const { 120 const GURL& origin() const {
97 return origin_; 121 return origin_;
98 } 122 }
99 123
100 // Returns the data reduction proxy fallback origin. 124 // Returns the data reduction proxy fallback origin.
101 const GURL& fallback_origin() const { 125 const GURL& fallback_origin() const {
102 return fallback_origin_; 126 return fallback_origin_;
103 } 127 }
104 128
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 virtual std::string GetDefaultDevOrigin() const; 203 virtual std::string GetDefaultDevOrigin() const;
180 virtual std::string GetDefaultOrigin() const; 204 virtual std::string GetDefaultOrigin() const;
181 virtual std::string GetDefaultFallbackOrigin() const; 205 virtual std::string GetDefaultFallbackOrigin() const;
182 virtual std::string GetDefaultSSLOrigin() const; 206 virtual std::string GetDefaultSSLOrigin() const;
183 virtual std::string GetDefaultAltOrigin() const; 207 virtual std::string GetDefaultAltOrigin() const;
184 virtual std::string GetDefaultAltFallbackOrigin() const; 208 virtual std::string GetDefaultAltFallbackOrigin() const;
185 virtual std::string GetDefaultProbeURL() const; 209 virtual std::string GetDefaultProbeURL() const;
186 virtual std::string GetDefaultWarmupURL() const; 210 virtual std::string GetDefaultWarmupURL() const;
187 211
188 private: 212 private:
213 // Checks if the primary and fallback data reduction proxies are in the retry
214 // map. Returns true if the request is bypassed by both data reduction
215 // proxies and returns the shortest bypass delay in delay_seconds (if not
216 // NULL). If the fallback proxy is not valid, returns true if primary proxy
217 // was bypassed and returns its bypass delay.
218 bool ArePrimaryAndFallbackBypassed(const net::ProxyRetryInfoMap& retry_map,
219 const GURL& primary,
220 const GURL& fallback,
221 base::TimeDelta* min_retry_delay) const;
189 GURL origin_; 222 GURL origin_;
190 GURL fallback_origin_; 223 GURL fallback_origin_;
191 GURL ssl_origin_; 224 GURL ssl_origin_;
192 GURL alt_origin_; 225 GURL alt_origin_;
193 GURL alt_fallback_origin_; 226 GURL alt_fallback_origin_;
194 GURL probe_url_; 227 GURL probe_url_;
195 GURL warmup_url_; 228 GURL warmup_url_;
196 229
197 bool allowed_; 230 bool allowed_;
198 const bool fallback_allowed_; 231 const bool fallback_allowed_;
199 bool alt_allowed_; 232 bool alt_allowed_;
200 const bool promo_allowed_; 233 const bool promo_allowed_;
201 234
202 bool configured_on_command_line_; 235 bool configured_on_command_line_;
203 236
204 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyParams); 237 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyParams);
205 }; 238 };
206 239
207 } // namespace data_reduction_proxy 240 } // namespace data_reduction_proxy
208 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PARAMS_H _ 241 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_PARAMS_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698