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_SETTINGS_H_ | 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS_H_ |
6 #define COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS_H_ | 6 #define COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/prefs/pref_member.h" | 14 #include "base/prefs/pref_member.h" |
15 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
16 #include "components/data_reduction_proxy/browser/data_reduction_proxy_configura tor.h" | 16 #include "components/data_reduction_proxy/browser/data_reduction_proxy_configura tor.h" |
17 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" | 17 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" |
18 #include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_sta ts.h" | 18 #include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_sta ts.h" |
19 #include "net/base/net_util.h" | |
marq (ping after 24h)
2014/07/11 16:31:56
Why this include and not a forward declaration of
bengr
2014/07/11 22:49:16
NetworkInterfaceList is a vector of network interf
| |
19 #include "net/base/network_change_notifier.h" | 20 #include "net/base/network_change_notifier.h" |
20 #include "net/url_request/url_fetcher_delegate.h" | 21 #include "net/url_request/url_fetcher_delegate.h" |
21 | 22 |
22 class PrefService; | 23 class PrefService; |
23 | 24 |
24 namespace net { | 25 namespace net { |
25 class HostPortPair; | 26 class HostPortPair; |
26 class HttpNetworkSession; | 27 class HttpNetworkSession; |
27 class HttpResponseHeaders; | 28 class HttpResponseHeaders; |
28 class URLFetcher; | 29 class URLFetcher; |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 // Metrics method. Subclasses should override if they wish to provide | 202 // Metrics method. Subclasses should override if they wish to provide |
202 // alternatives. | 203 // alternatives. |
203 virtual void RecordDataReductionInit(); | 204 virtual void RecordDataReductionInit(); |
204 | 205 |
205 virtual void AddDefaultProxyBypassRules(); | 206 virtual void AddDefaultProxyBypassRules(); |
206 | 207 |
207 // Writes a warning to the log that is used in backend processing of | 208 // Writes a warning to the log that is used in backend processing of |
208 // customer feedback. Virtual so tests can mock it for verification. | 209 // customer feedback. Virtual so tests can mock it for verification. |
209 virtual void LogProxyState(bool enabled, bool restricted, bool at_startup); | 210 virtual void LogProxyState(bool enabled, bool restricted, bool at_startup); |
210 | 211 |
211 // Virtualized for mocking | 212 // Virtualized for mocking |
marq (ping after 24h)
2014/07/11 16:31:56
mocking.
bengr
2014/07/11 22:49:16
Done.
| |
212 virtual void RecordProbeURLFetchResult( | 213 virtual void RecordProbeURLFetchResult( |
213 data_reduction_proxy::ProbeURLFetchResult result); | 214 data_reduction_proxy::ProbeURLFetchResult result); |
215 | |
214 virtual void RecordStartupState( | 216 virtual void RecordStartupState( |
215 data_reduction_proxy::ProxyStartupState state); | 217 data_reduction_proxy::ProxyStartupState state); |
216 | 218 |
219 virtual void GetNetworkList(net::NetworkInterfaceList* interfaces, | |
marq (ping after 24h)
2014/07/11 16:31:56
Needs a comment. *all* method declarations in head
bengr
2014/07/11 22:49:16
Done, but that's not true. I think the style is th
marq (ping after 24h)
2014/07/11 23:51:19
That's what I once thought, but the C++ style guid
bengr
2014/07/14 18:44:57
Acknowledged.
| |
220 int policy); | |
221 | |
217 DataReductionProxyConfigurator* configurator() { | 222 DataReductionProxyConfigurator* configurator() { |
218 return configurator_.get(); | 223 return configurator_.get(); |
219 } | 224 } |
220 | 225 |
221 // Reset params for tests. | 226 // Reset params for tests. |
222 void ResetParamsForTest(DataReductionProxyParams* params); | 227 void ResetParamsForTest(DataReductionProxyParams* params); |
223 | 228 |
224 private: | 229 private: |
225 friend class DataReductionProxySettingsTestBase; | 230 friend class DataReductionProxySettingsTestBase; |
226 friend class DataReductionProxySettingsTest; | 231 friend class DataReductionProxySettingsTest; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
266 void MaybeActivateDataReductionProxy(bool at_startup); | 271 void MaybeActivateDataReductionProxy(bool at_startup); |
267 | 272 |
268 // Requests the proxy probe URL, if one is set. If unable to do so, disables | 273 // Requests the proxy probe URL, if one is set. If unable to do so, disables |
269 // the proxy, if enabled. Otherwise enables the proxy if disabled by a probe | 274 // the proxy, if enabled. Otherwise enables the proxy if disabled by a probe |
270 // failure. | 275 // failure. |
271 void ProbeWhetherDataReductionProxyIsAvailable(); | 276 void ProbeWhetherDataReductionProxyIsAvailable(); |
272 | 277 |
273 // Warms the connection to the data reduction proxy. | 278 // Warms the connection to the data reduction proxy. |
274 void WarmProxyConnection(); | 279 void WarmProxyConnection(); |
275 | 280 |
281 // Disables use of the data reduction proxy on VPNs. Returns true if the | |
282 // data reduction proxy has been disabled. | |
283 bool DisableIfVPN(); | |
284 | |
276 // Generic method to get a URL fetcher. | 285 // Generic method to get a URL fetcher. |
277 net::URLFetcher* GetBaseURLFetcher(const GURL& gurl, int load_flags); | 286 net::URLFetcher* GetBaseURLFetcher(const GURL& gurl, int load_flags); |
278 | 287 |
279 // Returns a UTF16 string that's the hash of the configured authentication | |
280 // |key| and |salt|. Returns an empty UTF16 string if no key is configured or | |
281 // the data reduction proxy feature isn't available. | |
282 static base::string16 AuthHashForSalt(int64 salt, | |
283 const std::string& key); | |
284 | |
285 std::string key_; | 288 std::string key_; |
286 bool restricted_by_carrier_; | 289 bool restricted_by_carrier_; |
287 bool enabled_by_user_; | 290 bool enabled_by_user_; |
291 bool disabled_on_vpn_; | |
288 | 292 |
289 scoped_ptr<net::URLFetcher> fetcher_; | 293 scoped_ptr<net::URLFetcher> fetcher_; |
290 scoped_ptr<net::URLFetcher> warmup_fetcher_; | 294 scoped_ptr<net::URLFetcher> warmup_fetcher_; |
291 | 295 |
292 BooleanPrefMember spdy_proxy_auth_enabled_; | 296 BooleanPrefMember spdy_proxy_auth_enabled_; |
293 BooleanPrefMember data_reduction_proxy_alternative_enabled_; | 297 BooleanPrefMember data_reduction_proxy_alternative_enabled_; |
294 | 298 |
295 PrefService* prefs_; | 299 PrefService* prefs_; |
296 PrefService* local_state_prefs_; | 300 PrefService* local_state_prefs_; |
297 | 301 |
298 net::URLRequestContextGetter* url_request_context_getter_; | 302 net::URLRequestContextGetter* url_request_context_getter_; |
299 | 303 |
300 scoped_ptr<DataReductionProxyConfigurator> configurator_; | 304 scoped_ptr<DataReductionProxyConfigurator> configurator_; |
301 | 305 |
302 base::ThreadChecker thread_checker_; | 306 base::ThreadChecker thread_checker_; |
303 | 307 |
304 scoped_ptr<DataReductionProxyParams> params_; | 308 scoped_ptr<DataReductionProxyParams> params_; |
305 DataReductionProxyUsageStats* usage_stats_; | 309 DataReductionProxyUsageStats* usage_stats_; |
306 | 310 |
307 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettings); | 311 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettings); |
308 }; | 312 }; |
309 | 313 |
310 } // namespace data_reduction_proxy | 314 } // namespace data_reduction_proxy |
311 | 315 |
312 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS _H_ | 316 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS _H_ |
OLD | NEW |