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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 // Returns an vector containing the aggregate received HTTP content in the | 166 // Returns an vector containing the aggregate received HTTP content in the |
167 // last |kNumDaysInHistory| days. | 167 // last |kNumDaysInHistory| days. |
168 ContentLengthList GetDailyReceivedContentLengths(); | 168 ContentLengthList GetDailyReceivedContentLengths(); |
169 | 169 |
170 // net::URLFetcherDelegate: | 170 // net::URLFetcherDelegate: |
171 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 171 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
172 | 172 |
173 protected: | 173 protected: |
174 void InitPrefMembers(); | 174 void InitPrefMembers(); |
175 | 175 |
176 virtual net::URLFetcher* GetURLFetcher(); | 176 // Returns a fetcher for the probe to check if OK for the proxy to use SPDY. |
| 177 // Virtual for testing. |
| 178 virtual net::URLFetcher* GetURLFetcherForAvailabilityCheck(); |
| 179 |
| 180 // Returns a fetcher to warm up the connection to the data reduction proxy. |
| 181 // Virtual for testing. |
| 182 virtual net::URLFetcher* GetURLFetcherForWarmup(); |
177 | 183 |
178 // Virtualized for unit test support. | 184 // Virtualized for unit test support. |
179 virtual PrefService* GetOriginalProfilePrefs(); | 185 virtual PrefService* GetOriginalProfilePrefs(); |
180 virtual PrefService* GetLocalStatePrefs(); | 186 virtual PrefService* GetLocalStatePrefs(); |
181 | 187 |
182 void GetContentLengths(unsigned int days, | 188 void GetContentLengths(unsigned int days, |
183 int64* original_content_length, | 189 int64* original_content_length, |
184 int64* received_content_length, | 190 int64* received_content_length, |
185 int64* last_update_time); | 191 int64* last_update_time); |
186 ContentLengthList GetDailyContentLengths(const char* pref_name); | 192 ContentLengthList GetDailyContentLengths(const char* pref_name); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 | 272 |
267 void ResetDataReductionStatistics(); | 273 void ResetDataReductionStatistics(); |
268 | 274 |
269 void MaybeActivateDataReductionProxy(bool at_startup); | 275 void MaybeActivateDataReductionProxy(bool at_startup); |
270 | 276 |
271 // Requests the proxy probe URL, if one is set. If unable to do so, disables | 277 // Requests the proxy probe URL, if one is set. If unable to do so, disables |
272 // the proxy, if enabled. Otherwise enables the proxy if disabled by a probe | 278 // the proxy, if enabled. Otherwise enables the proxy if disabled by a probe |
273 // failure. | 279 // failure. |
274 void ProbeWhetherDataReductionProxyIsAvailable(); | 280 void ProbeWhetherDataReductionProxyIsAvailable(); |
275 | 281 |
| 282 // Warms the connection to the data reduction proxy. |
| 283 void WarmProxyConnection(); |
| 284 |
| 285 // Generic method to get a URL fetcher. |
| 286 net::URLFetcher* GetBaseURLFetcher(const GURL& gurl, int load_flags); |
| 287 |
276 // Returns a UTF16 string that's the hash of the configured authentication | 288 // Returns a UTF16 string that's the hash of the configured authentication |
277 // |key| and |salt|. Returns an empty UTF16 string if no key is configured or | 289 // |key| and |salt|. Returns an empty UTF16 string if no key is configured or |
278 // the data reduction proxy feature isn't available. | 290 // the data reduction proxy feature isn't available. |
279 static base::string16 AuthHashForSalt(int64 salt, | 291 static base::string16 AuthHashForSalt(int64 salt, |
280 const std::string& key); | 292 const std::string& key); |
281 | 293 |
282 std::string key_; | 294 std::string key_; |
283 bool restricted_by_carrier_; | 295 bool restricted_by_carrier_; |
284 bool enabled_by_user_; | 296 bool enabled_by_user_; |
285 | 297 |
286 scoped_ptr<net::URLFetcher> fetcher_; | 298 scoped_ptr<net::URLFetcher> fetcher_; |
| 299 scoped_ptr<net::URLFetcher> warmup_fetcher_; |
| 300 |
287 BooleanPrefMember spdy_proxy_auth_enabled_; | 301 BooleanPrefMember spdy_proxy_auth_enabled_; |
288 BooleanPrefMember data_reduction_proxy_alternative_enabled_; | 302 BooleanPrefMember data_reduction_proxy_alternative_enabled_; |
289 | 303 |
290 PrefService* prefs_; | 304 PrefService* prefs_; |
291 PrefService* local_state_prefs_; | 305 PrefService* local_state_prefs_; |
292 | 306 |
293 net::URLRequestContextGetter* url_request_context_getter_; | 307 net::URLRequestContextGetter* url_request_context_getter_; |
294 | 308 |
295 scoped_ptr<DataReductionProxyConfigurator> configurator_; | 309 scoped_ptr<DataReductionProxyConfigurator> configurator_; |
296 | 310 |
297 base::ThreadChecker thread_checker_; | 311 base::ThreadChecker thread_checker_; |
298 | 312 |
299 scoped_ptr<DataReductionProxyParams> params_; | 313 scoped_ptr<DataReductionProxyParams> params_; |
300 | 314 |
301 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettings); | 315 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettings); |
302 }; | 316 }; |
303 | 317 |
304 } // namespace data_reduction_proxy | 318 } // namespace data_reduction_proxy |
305 | 319 |
306 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS
_H_ | 320 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS
_H_ |
OLD | NEW |