| 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/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/prefs/pref_member.h" | 15 #include "base/prefs/pref_member.h" |
| 16 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
| 17 #include "components/data_reduction_proxy/browser/data_reduction_proxy_configura
tor.h" | 17 #include "components/data_reduction_proxy/browser/data_reduction_proxy_configura
tor.h" |
| 18 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" | 18 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" |
| 19 #include "components/data_reduction_proxy/browser/data_reduction_proxy_statistic
s_prefs.h" |
| 19 #include "net/base/net_util.h" | 20 #include "net/base/net_util.h" |
| 20 #include "net/base/network_change_notifier.h" | 21 #include "net/base/network_change_notifier.h" |
| 21 #include "net/url_request/url_fetcher_delegate.h" | 22 #include "net/url_request/url_fetcher_delegate.h" |
| 22 | 23 |
| 23 class PrefService; | 24 class PrefService; |
| 24 | 25 |
| 25 namespace net { | 26 namespace net { |
| 26 class HostPortPair; | 27 class HostPortPair; |
| 27 class HttpNetworkSession; | 28 class HttpNetworkSession; |
| 28 class HttpResponseHeaders; | 29 class HttpResponseHeaders; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 DataReductionProxyParams* params() const { | 97 DataReductionProxyParams* params() const { |
| 97 return params_.get(); | 98 return params_.get(); |
| 98 } | 99 } |
| 99 | 100 |
| 100 // Initializes the data reduction proxy with profile and local state prefs, | 101 // Initializes the data reduction proxy with profile and local state prefs, |
| 101 // and a |UrlRequestContextGetter| for canary probes. The caller must ensure | 102 // and a |UrlRequestContextGetter| for canary probes. The caller must ensure |
| 102 // that all parameters remain alive for the lifetime of the | 103 // that all parameters remain alive for the lifetime of the |
| 103 // |DataReductionProxySettings| instance. | 104 // |DataReductionProxySettings| instance. |
| 104 void InitDataReductionProxySettings( | 105 void InitDataReductionProxySettings( |
| 105 PrefService* prefs, | 106 PrefService* prefs, |
| 106 PrefService* local_state_prefs, | |
| 107 net::URLRequestContextGetter* url_request_context_getter); | 107 net::URLRequestContextGetter* url_request_context_getter); |
| 108 | 108 |
| 109 // Initializes the data reduction proxy with profile and local state prefs, | 109 // Initializes the data reduction proxy with profile and local state prefs, |
| 110 // a |UrlRequestContextGetter| for canary probes, and a proxy configurator. | 110 // a |UrlRequestContextGetter| for canary probes, and a proxy configurator. |
| 111 // The caller must ensure that all parameters remain alive for the lifetime of | 111 // The caller must ensure that all parameters remain alive for the lifetime of |
| 112 // the |DataReductionProxySettings| instance. | 112 // the |DataReductionProxySettings| instance. |
| 113 // TODO(marq): Remove when iOS supports the new interface above. | 113 // TODO(marq): Remove when iOS supports the new interface above. |
| 114 void InitDataReductionProxySettings( | 114 void InitDataReductionProxySettings( |
| 115 PrefService* prefs, | 115 PrefService* prefs, |
| 116 PrefService* local_state_prefs, | |
| 117 net::URLRequestContextGetter* url_request_context_getter, | 116 net::URLRequestContextGetter* url_request_context_getter, |
| 118 DataReductionProxyConfigurator* configurator); | 117 DataReductionProxyConfigurator* configurator); |
| 119 | 118 |
| 119 // Sets the |statistics_prefs_| to be used for data reduction proxy pref reads |
| 120 // and writes. |
| 121 void SetDataReductionProxyStatisticsPrefs( |
| 122 DataReductionProxyStatisticsPrefs* statistics_prefs); |
| 123 |
| 120 // Sets the |on_data_reduction_proxy_enabled_| callback and runs to register | 124 // Sets the |on_data_reduction_proxy_enabled_| callback and runs to register |
| 121 // the DataReductionProxyEnabled synthetic field trial. | 125 // the DataReductionProxyEnabled synthetic field trial. |
| 122 void SetOnDataReductionEnabledCallback( | 126 void SetOnDataReductionEnabledCallback( |
| 123 const base::Callback<void(bool)>& on_data_reduction_proxy_enabled); | 127 const base::Callback<void(bool)>& on_data_reduction_proxy_enabled); |
| 124 | 128 |
| 125 // Sets the logic the embedder uses to set the networking configuration that | 129 // Sets the logic the embedder uses to set the networking configuration that |
| 126 // causes traffic to be proxied. | 130 // causes traffic to be proxied. |
| 127 void SetProxyConfigurator( | 131 void SetProxyConfigurator( |
| 128 DataReductionProxyConfigurator* configurator); | 132 DataReductionProxyConfigurator* configurator); |
| 129 | 133 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 // Returns a fetcher for the probe to check if OK for the proxy to use SPDY. | 187 // Returns a fetcher for the probe to check if OK for the proxy to use SPDY. |
| 184 // Virtual for testing. | 188 // Virtual for testing. |
| 185 virtual net::URLFetcher* GetURLFetcherForAvailabilityCheck(); | 189 virtual net::URLFetcher* GetURLFetcherForAvailabilityCheck(); |
| 186 | 190 |
| 187 // Returns a fetcher to warm up the connection to the data reduction proxy. | 191 // Returns a fetcher to warm up the connection to the data reduction proxy. |
| 188 // Virtual for testing. | 192 // Virtual for testing. |
| 189 virtual net::URLFetcher* GetURLFetcherForWarmup(); | 193 virtual net::URLFetcher* GetURLFetcherForWarmup(); |
| 190 | 194 |
| 191 // Virtualized for unit test support. | 195 // Virtualized for unit test support. |
| 192 virtual PrefService* GetOriginalProfilePrefs(); | 196 virtual PrefService* GetOriginalProfilePrefs(); |
| 193 virtual PrefService* GetLocalStatePrefs(); | |
| 194 | 197 |
| 195 // Sets the proxy configs, enabling or disabling the proxy according to | 198 // Sets the proxy configs, enabling or disabling the proxy according to |
| 196 // the value of |enabled| and |alternative_enabled|. Use the alternative | 199 // the value of |enabled| and |alternative_enabled|. Use the alternative |
| 197 // configuration only if |enabled| and |alternative_enabled| are true. If | 200 // configuration only if |enabled| and |alternative_enabled| are true. If |
| 198 // |restricted| is true, only enable the fallback proxy. |at_startup| is true | 201 // |restricted| is true, only enable the fallback proxy. |at_startup| is true |
| 199 // when this method is called from InitDataReductionProxySettings. | 202 // when this method is called from InitDataReductionProxySettings. |
| 200 virtual void SetProxyConfigs(bool enabled, | 203 virtual void SetProxyConfigs(bool enabled, |
| 201 bool alternative_enabled, | 204 bool alternative_enabled, |
| 202 bool restricted, | 205 bool restricted, |
| 203 bool at_startup); | 206 bool at_startup); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 bool disabled_on_vpn_; | 303 bool disabled_on_vpn_; |
| 301 bool unreachable_; | 304 bool unreachable_; |
| 302 | 305 |
| 303 scoped_ptr<net::URLFetcher> fetcher_; | 306 scoped_ptr<net::URLFetcher> fetcher_; |
| 304 scoped_ptr<net::URLFetcher> warmup_fetcher_; | 307 scoped_ptr<net::URLFetcher> warmup_fetcher_; |
| 305 | 308 |
| 306 BooleanPrefMember spdy_proxy_auth_enabled_; | 309 BooleanPrefMember spdy_proxy_auth_enabled_; |
| 307 BooleanPrefMember data_reduction_proxy_alternative_enabled_; | 310 BooleanPrefMember data_reduction_proxy_alternative_enabled_; |
| 308 | 311 |
| 309 PrefService* prefs_; | 312 PrefService* prefs_; |
| 310 PrefService* local_state_prefs_; | 313 DataReductionProxyStatisticsPrefs* statistics_prefs_; |
| 311 | 314 |
| 312 net::URLRequestContextGetter* url_request_context_getter_; | 315 net::URLRequestContextGetter* url_request_context_getter_; |
| 313 | 316 |
| 314 base::Callback<void(bool)> on_data_reduction_proxy_enabled_; | 317 base::Callback<void(bool)> on_data_reduction_proxy_enabled_; |
| 315 | 318 |
| 316 DataReductionProxyConfigurator* configurator_; | 319 DataReductionProxyConfigurator* configurator_; |
| 317 | 320 |
| 318 base::ThreadChecker thread_checker_; | 321 base::ThreadChecker thread_checker_; |
| 319 | 322 |
| 320 scoped_ptr<DataReductionProxyParams> params_; | 323 scoped_ptr<DataReductionProxyParams> params_; |
| 321 | 324 |
| 322 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettings); | 325 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettings); |
| 323 }; | 326 }; |
| 324 | 327 |
| 325 } // namespace data_reduction_proxy | 328 } // namespace data_reduction_proxy |
| 326 | 329 |
| 327 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS
_H_ | 330 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS
_H_ |
| OLD | NEW |