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