Chromium Code Reviews| 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" | |
| 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. |
| 212 virtual void RecordProbeURLFetchResult( | 213 virtual void RecordProbeURLFetchResult( |
| 213 data_reduction_proxy::ProbeURLFetchResult result); | 214 data_reduction_proxy::ProbeURLFetchResult result); |
| 215 | |
| 216 // Virtualized for mocking. | |
|
marq (ping after 24h)
2014/07/11 23:51:19
"Virtualized for mocking" doesn't describe what th
bengr
2014/07/14 18:44:57
Done.
| |
| 214 virtual void RecordStartupState( | 217 virtual void RecordStartupState( |
| 215 data_reduction_proxy::ProxyStartupState state); | 218 data_reduction_proxy::ProxyStartupState state); |
| 216 | 219 |
| 220 // Virtualized for mocking. Returns the list of network interfaces in use. | |
| 221 virtual void GetNetworkList(net::NetworkInterfaceList* interfaces, | |
| 222 int policy); | |
| 223 | |
| 217 DataReductionProxyConfigurator* configurator() { | 224 DataReductionProxyConfigurator* configurator() { |
| 218 return configurator_.get(); | 225 return configurator_.get(); |
| 219 } | 226 } |
| 220 | 227 |
| 221 // Reset params for tests. | 228 // Reset params for tests. |
| 222 void ResetParamsForTest(DataReductionProxyParams* params); | 229 void ResetParamsForTest(DataReductionProxyParams* params); |
| 223 | 230 |
| 224 private: | 231 private: |
| 225 friend class DataReductionProxySettingsTestBase; | 232 friend class DataReductionProxySettingsTestBase; |
| 226 friend class DataReductionProxySettingsTest; | 233 friend class DataReductionProxySettingsTest; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 266 void MaybeActivateDataReductionProxy(bool at_startup); | 273 void MaybeActivateDataReductionProxy(bool at_startup); |
| 267 | 274 |
| 268 // Requests the proxy probe URL, if one is set. If unable to do so, disables | 275 // 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 | 276 // the proxy, if enabled. Otherwise enables the proxy if disabled by a probe |
| 270 // failure. | 277 // failure. |
| 271 void ProbeWhetherDataReductionProxyIsAvailable(); | 278 void ProbeWhetherDataReductionProxyIsAvailable(); |
| 272 | 279 |
| 273 // Warms the connection to the data reduction proxy. | 280 // Warms the connection to the data reduction proxy. |
| 274 void WarmProxyConnection(); | 281 void WarmProxyConnection(); |
| 275 | 282 |
| 283 // Disables use of the data reduction proxy on VPNs. Returns true if the | |
| 284 // data reduction proxy has been disabled. | |
| 285 bool DisableIfVPN(); | |
| 286 | |
| 276 // Generic method to get a URL fetcher. | 287 // Generic method to get a URL fetcher. |
| 277 net::URLFetcher* GetBaseURLFetcher(const GURL& gurl, int load_flags); | 288 net::URLFetcher* GetBaseURLFetcher(const GURL& gurl, int load_flags); |
| 278 | 289 |
| 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_; | 290 std::string key_; |
| 286 bool restricted_by_carrier_; | 291 bool restricted_by_carrier_; |
| 287 bool enabled_by_user_; | 292 bool enabled_by_user_; |
| 293 bool disabled_on_vpn_; | |
| 288 | 294 |
| 289 scoped_ptr<net::URLFetcher> fetcher_; | 295 scoped_ptr<net::URLFetcher> fetcher_; |
| 290 scoped_ptr<net::URLFetcher> warmup_fetcher_; | 296 scoped_ptr<net::URLFetcher> warmup_fetcher_; |
| 291 | 297 |
| 292 BooleanPrefMember spdy_proxy_auth_enabled_; | 298 BooleanPrefMember spdy_proxy_auth_enabled_; |
| 293 BooleanPrefMember data_reduction_proxy_alternative_enabled_; | 299 BooleanPrefMember data_reduction_proxy_alternative_enabled_; |
| 294 | 300 |
| 295 PrefService* prefs_; | 301 PrefService* prefs_; |
| 296 PrefService* local_state_prefs_; | 302 PrefService* local_state_prefs_; |
| 297 | 303 |
| 298 net::URLRequestContextGetter* url_request_context_getter_; | 304 net::URLRequestContextGetter* url_request_context_getter_; |
| 299 | 305 |
| 300 scoped_ptr<DataReductionProxyConfigurator> configurator_; | 306 scoped_ptr<DataReductionProxyConfigurator> configurator_; |
| 301 | 307 |
| 302 base::ThreadChecker thread_checker_; | 308 base::ThreadChecker thread_checker_; |
| 303 | 309 |
| 304 scoped_ptr<DataReductionProxyParams> params_; | 310 scoped_ptr<DataReductionProxyParams> params_; |
| 305 DataReductionProxyUsageStats* usage_stats_; | 311 DataReductionProxyUsageStats* usage_stats_; |
| 306 | 312 |
| 307 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettings); | 313 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettings); |
| 308 }; | 314 }; |
| 309 | 315 |
| 310 } // namespace data_reduction_proxy | 316 } // namespace data_reduction_proxy |
| 311 | 317 |
| 312 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS _H_ | 318 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS _H_ |
| OLD | NEW |