| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 183 |
| 180 protected: | 184 protected: |
| 181 void InitPrefMembers(); | 185 void InitPrefMembers(); |
| 182 | 186 |
| 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 // Virtualized for unit test support. | 191 // Virtualized for unit test support. |
| 188 virtual PrefService* GetOriginalProfilePrefs(); | 192 virtual PrefService* GetOriginalProfilePrefs(); |
| 189 virtual PrefService* GetLocalStatePrefs(); | |
| 190 | 193 |
| 191 // Sets the proxy configs, enabling or disabling the proxy according to | 194 // Sets the proxy configs, enabling or disabling the proxy according to |
| 192 // the value of |enabled| and |alternative_enabled|. Use the alternative | 195 // the value of |enabled| and |alternative_enabled|. Use the alternative |
| 193 // configuration only if |enabled| and |alternative_enabled| are true. If | 196 // configuration only if |enabled| and |alternative_enabled| are true. If |
| 194 // |restricted| is true, only enable the fallback proxy. |at_startup| is true | 197 // |restricted| is true, only enable the fallback proxy. |at_startup| is true |
| 195 // when this method is called from InitDataReductionProxySettings. | 198 // when this method is called from InitDataReductionProxySettings. |
| 196 virtual void SetProxyConfigs(bool enabled, | 199 virtual void SetProxyConfigs(bool enabled, |
| 197 bool alternative_enabled, | 200 bool alternative_enabled, |
| 198 bool restricted, | 201 bool restricted, |
| 199 bool at_startup); | 202 bool at_startup); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 bool enabled_by_user_; | 295 bool enabled_by_user_; |
| 293 bool disabled_on_vpn_; | 296 bool disabled_on_vpn_; |
| 294 bool unreachable_; | 297 bool unreachable_; |
| 295 | 298 |
| 296 scoped_ptr<net::URLFetcher> fetcher_; | 299 scoped_ptr<net::URLFetcher> fetcher_; |
| 297 | 300 |
| 298 BooleanPrefMember spdy_proxy_auth_enabled_; | 301 BooleanPrefMember spdy_proxy_auth_enabled_; |
| 299 BooleanPrefMember data_reduction_proxy_alternative_enabled_; | 302 BooleanPrefMember data_reduction_proxy_alternative_enabled_; |
| 300 | 303 |
| 301 PrefService* prefs_; | 304 PrefService* prefs_; |
| 302 PrefService* local_state_prefs_; | 305 DataReductionProxyStatisticsPrefs* statistics_prefs_; |
| 303 | 306 |
| 304 net::URLRequestContextGetter* url_request_context_getter_; | 307 net::URLRequestContextGetter* url_request_context_getter_; |
| 305 | 308 |
| 306 base::Callback<void(bool)> on_data_reduction_proxy_enabled_; | 309 base::Callback<void(bool)> on_data_reduction_proxy_enabled_; |
| 307 | 310 |
| 308 DataReductionProxyConfigurator* configurator_; | 311 DataReductionProxyConfigurator* configurator_; |
| 309 | 312 |
| 310 base::ThreadChecker thread_checker_; | 313 base::ThreadChecker thread_checker_; |
| 311 | 314 |
| 312 scoped_ptr<DataReductionProxyParams> params_; | 315 scoped_ptr<DataReductionProxyParams> params_; |
| 313 | 316 |
| 314 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettings); | 317 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettings); |
| 315 }; | 318 }; |
| 316 | 319 |
| 317 } // namespace data_reduction_proxy | 320 } // namespace data_reduction_proxy |
| 318 | 321 |
| 319 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS
_H_ | 322 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS
_H_ |
| OLD | NEW |