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" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // net::URLFetcherDelegate: | 177 // net::URLFetcherDelegate: |
178 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 178 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
179 | 179 |
180 protected: | 180 protected: |
181 void InitPrefMembers(); | 181 void InitPrefMembers(); |
182 | 182 |
183 // Returns a fetcher for the probe to check if OK for the proxy to use SPDY. | 183 // Returns a fetcher for the probe to check if OK for the proxy to use SPDY. |
184 // Virtual for testing. | 184 // Virtual for testing. |
185 virtual net::URLFetcher* GetURLFetcherForAvailabilityCheck(); | 185 virtual net::URLFetcher* GetURLFetcherForAvailabilityCheck(); |
186 | 186 |
187 // Returns a fetcher to warm up the connection to the data reduction proxy. | |
188 // Virtual for testing. | |
189 virtual net::URLFetcher* GetURLFetcherForWarmup(); | |
190 | |
191 // Virtualized for unit test support. | 187 // Virtualized for unit test support. |
192 virtual PrefService* GetOriginalProfilePrefs(); | 188 virtual PrefService* GetOriginalProfilePrefs(); |
193 virtual PrefService* GetLocalStatePrefs(); | 189 virtual PrefService* GetLocalStatePrefs(); |
194 | 190 |
195 // Sets the proxy configs, enabling or disabling the proxy according to | 191 // Sets the proxy configs, enabling or disabling the proxy according to |
196 // the value of |enabled| and |alternative_enabled|. Use the alternative | 192 // the value of |enabled| and |alternative_enabled|. Use the alternative |
197 // configuration only if |enabled| and |alternative_enabled| are true. If | 193 // configuration only if |enabled| and |alternative_enabled| are true. If |
198 // |restricted| is true, only enable the fallback proxy. |at_startup| is true | 194 // |restricted| is true, only enable the fallback proxy. |at_startup| is true |
199 // when this method is called from InitDataReductionProxySettings. | 195 // when this method is called from InitDataReductionProxySettings. |
200 virtual void SetProxyConfigs(bool enabled, | 196 virtual void SetProxyConfigs(bool enabled, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 | 273 |
278 void ResetDataReductionStatistics(); | 274 void ResetDataReductionStatistics(); |
279 | 275 |
280 void MaybeActivateDataReductionProxy(bool at_startup); | 276 void MaybeActivateDataReductionProxy(bool at_startup); |
281 | 277 |
282 // Requests the proxy probe URL, if one is set. If unable to do so, disables | 278 // Requests the proxy probe URL, if one is set. If unable to do so, disables |
283 // the proxy, if enabled. Otherwise enables the proxy if disabled by a probe | 279 // the proxy, if enabled. Otherwise enables the proxy if disabled by a probe |
284 // failure. | 280 // failure. |
285 void ProbeWhetherDataReductionProxyIsAvailable(); | 281 void ProbeWhetherDataReductionProxyIsAvailable(); |
286 | 282 |
287 // Warms the connection to the data reduction proxy. | |
288 void WarmProxyConnection(); | |
289 | |
290 // Disables use of the data reduction proxy on VPNs. Returns true if the | 283 // Disables use of the data reduction proxy on VPNs. Returns true if the |
291 // data reduction proxy has been disabled. | 284 // data reduction proxy has been disabled. |
292 bool DisableIfVPN(); | 285 bool DisableIfVPN(); |
293 | 286 |
294 // Generic method to get a URL fetcher. | 287 // Generic method to get a URL fetcher. |
295 net::URLFetcher* GetBaseURLFetcher(const GURL& gurl, int load_flags); | 288 net::URLFetcher* GetBaseURLFetcher(const GURL& gurl, int load_flags); |
296 | 289 |
297 std::string key_; | 290 std::string key_; |
298 bool restricted_by_carrier_; | 291 bool restricted_by_carrier_; |
299 bool enabled_by_user_; | 292 bool enabled_by_user_; |
300 bool disabled_on_vpn_; | 293 bool disabled_on_vpn_; |
301 bool unreachable_; | 294 bool unreachable_; |
302 | 295 |
303 scoped_ptr<net::URLFetcher> fetcher_; | 296 scoped_ptr<net::URLFetcher> fetcher_; |
304 scoped_ptr<net::URLFetcher> warmup_fetcher_; | |
305 | 297 |
306 BooleanPrefMember spdy_proxy_auth_enabled_; | 298 BooleanPrefMember spdy_proxy_auth_enabled_; |
307 BooleanPrefMember data_reduction_proxy_alternative_enabled_; | 299 BooleanPrefMember data_reduction_proxy_alternative_enabled_; |
308 | 300 |
309 PrefService* prefs_; | 301 PrefService* prefs_; |
310 PrefService* local_state_prefs_; | 302 PrefService* local_state_prefs_; |
311 | 303 |
312 net::URLRequestContextGetter* url_request_context_getter_; | 304 net::URLRequestContextGetter* url_request_context_getter_; |
313 | 305 |
314 base::Callback<void(bool)> on_data_reduction_proxy_enabled_; | 306 base::Callback<void(bool)> on_data_reduction_proxy_enabled_; |
315 | 307 |
316 DataReductionProxyConfigurator* configurator_; | 308 DataReductionProxyConfigurator* configurator_; |
317 | 309 |
318 base::ThreadChecker thread_checker_; | 310 base::ThreadChecker thread_checker_; |
319 | 311 |
320 scoped_ptr<DataReductionProxyParams> params_; | 312 scoped_ptr<DataReductionProxyParams> params_; |
321 | 313 |
322 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettings); | 314 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettings); |
323 }; | 315 }; |
324 | 316 |
325 } // namespace data_reduction_proxy | 317 } // namespace data_reduction_proxy |
326 | 318 |
327 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS
_H_ | 319 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS
_H_ |
OLD | NEW |