| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ | 6 #define CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_metr
ics.h" | 16 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_metr
ics.h" |
| 17 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event
_store.h" |
| 17 #include "net/base/network_delegate.h" | 18 #include "net/base/network_delegate.h" |
| 18 #include "net/proxy/proxy_retry_info.h" | 19 #include "net/proxy/proxy_retry_info.h" |
| 19 | 20 |
| 20 class ChromeExtensionsNetworkDelegate; | 21 class ChromeExtensionsNetworkDelegate; |
| 21 class ClientHints; | 22 class ClientHints; |
| 22 class CookieSettings; | 23 class CookieSettings; |
| 23 class PrefService; | 24 class PrefService; |
| 24 | 25 |
| 25 template<class T> class PrefMember; | 26 template<class T> class PrefMember; |
| 26 | 27 |
| 27 typedef PrefMember<bool> BooleanPrefMember; | 28 typedef PrefMember<bool> BooleanPrefMember; |
| 28 | 29 |
| 29 namespace base { | 30 namespace base { |
| 30 class Value; | 31 class Value; |
| 31 } | 32 } |
| 32 | 33 |
| 33 namespace chrome_browser_net { | 34 namespace chrome_browser_net { |
| 34 class ConnectInterceptor; | 35 class ConnectInterceptor; |
| 35 class Predictor; | 36 class Predictor; |
| 36 } | 37 } |
| 37 | 38 |
| 38 namespace data_reduction_proxy { | 39 namespace data_reduction_proxy { |
| 39 class DataReductionProxyAuthRequestHandler; | 40 class DataReductionProxyAuthRequestHandler; |
| 41 class DataReductionProxyEventStore; |
| 40 class DataReductionProxyParams; | 42 class DataReductionProxyParams; |
| 41 class DataReductionProxyStatisticsPrefs; | 43 class DataReductionProxyStatisticsPrefs; |
| 42 class DataReductionProxyUsageStats; | 44 class DataReductionProxyUsageStats; |
| 43 } | 45 } |
| 44 | 46 |
| 45 namespace domain_reliability { | 47 namespace domain_reliability { |
| 46 class DomainReliabilityMonitor; | 48 class DomainReliabilityMonitor; |
| 47 } | 49 } |
| 48 | 50 |
| 49 namespace extensions { | 51 namespace extensions { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 } | 183 } |
| 182 | 184 |
| 183 // |data_reduction_proxy_statistics_prefs_| must outlive this | 185 // |data_reduction_proxy_statistics_prefs_| must outlive this |
| 184 // ChromeNetworkDelegate. | 186 // ChromeNetworkDelegate. |
| 185 void set_data_reduction_proxy_statistics_prefs( | 187 void set_data_reduction_proxy_statistics_prefs( |
| 186 data_reduction_proxy::DataReductionProxyStatisticsPrefs* | 188 data_reduction_proxy::DataReductionProxyStatisticsPrefs* |
| 187 statistics_prefs) { | 189 statistics_prefs) { |
| 188 data_reduction_proxy_statistics_prefs_ = statistics_prefs; | 190 data_reduction_proxy_statistics_prefs_ = statistics_prefs; |
| 189 } | 191 } |
| 190 | 192 |
| 193 // |data_reduction_proxy_event_store_| must outlive this |
| 194 // ChromeNetworkDelegate. |
| 195 void set_data_reduction_proxy_event_store( |
| 196 data_reduction_proxy::DataReductionProxyEventStore* event_store) { |
| 197 data_reduction_proxy_event_store_ = event_store; |
| 198 } |
| 199 |
| 191 void set_on_resolve_proxy_handler(OnResolveProxyHandler handler) { | 200 void set_on_resolve_proxy_handler(OnResolveProxyHandler handler) { |
| 192 on_resolve_proxy_handler_ = handler; | 201 on_resolve_proxy_handler_ = handler; |
| 193 } | 202 } |
| 194 | 203 |
| 195 void set_proxy_config_getter(const ProxyConfigGetter& getter) { | 204 void set_proxy_config_getter(const ProxyConfigGetter& getter) { |
| 196 proxy_config_getter_ = getter; | 205 proxy_config_getter_ = getter; |
| 197 } | 206 } |
| 198 | 207 |
| 199 // Adds the Client Hints header to HTTP requests. | 208 // Adds the Client Hints header to HTTP requests. |
| 200 void SetEnableClientHints(); | 209 void SetEnableClientHints(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 220 | 229 |
| 221 // Creates a Value summary of the persistent state of the network session. | 230 // Creates a Value summary of the persistent state of the network session. |
| 222 // The caller is responsible for deleting the returned value. | 231 // The caller is responsible for deleting the returned value. |
| 223 // Must be called on the UI thread. | 232 // Must be called on the UI thread. |
| 224 static base::Value* HistoricNetworkStatsInfoToValue(PrefService* prefs); | 233 static base::Value* HistoricNetworkStatsInfoToValue(PrefService* prefs); |
| 225 | 234 |
| 226 // Creates a Value summary of the state of the network session. The caller is | 235 // Creates a Value summary of the state of the network session. The caller is |
| 227 // responsible for deleting the returned value. | 236 // responsible for deleting the returned value. |
| 228 base::Value* SessionNetworkStatsInfoToValue() const; | 237 base::Value* SessionNetworkStatsInfoToValue() const; |
| 229 | 238 |
| 239 // Creates a Value summary of data reduction proxy related information: |
| 240 // - Whether the proxy is enabled |
| 241 // - The proxy configuration |
| 242 // - The state of the last canary response |
| 243 // - A stream of the last data reduction proxy related events. |
| 244 // The caller is responsible for deleting the returned value. |
| 245 base::Value* DataReductionProxyInfoToValue() const; |
| 246 |
| 230 private: | 247 private: |
| 231 friend class ChromeNetworkDelegateTest; | 248 friend class ChromeNetworkDelegateTest; |
| 232 | 249 |
| 233 // NetworkDelegate implementation. | 250 // NetworkDelegate implementation. |
| 234 int OnBeforeURLRequest(net::URLRequest* request, | 251 int OnBeforeURLRequest(net::URLRequest* request, |
| 235 const net::CompletionCallback& callback, | 252 const net::CompletionCallback& callback, |
| 236 GURL* new_url) override; | 253 GURL* new_url) override; |
| 237 void OnResolveProxy(const GURL& url, | 254 void OnResolveProxy(const GURL& url, |
| 238 int load_flags, | 255 int load_flags, |
| 239 const net::ProxyService& proxy_service, | 256 const net::ProxyService& proxy_service, |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 // |data_reduction_proxy_params_| must outlive this ChromeNetworkDelegate. | 353 // |data_reduction_proxy_params_| must outlive this ChromeNetworkDelegate. |
| 337 data_reduction_proxy::DataReductionProxyParams* data_reduction_proxy_params_; | 354 data_reduction_proxy::DataReductionProxyParams* data_reduction_proxy_params_; |
| 338 // |data_reduction_proxy_usage_stats_| must outlive this | 355 // |data_reduction_proxy_usage_stats_| must outlive this |
| 339 // ChromeNetworkDelegate. | 356 // ChromeNetworkDelegate. |
| 340 data_reduction_proxy::DataReductionProxyUsageStats* | 357 data_reduction_proxy::DataReductionProxyUsageStats* |
| 341 data_reduction_proxy_usage_stats_; | 358 data_reduction_proxy_usage_stats_; |
| 342 data_reduction_proxy::DataReductionProxyAuthRequestHandler* | 359 data_reduction_proxy::DataReductionProxyAuthRequestHandler* |
| 343 data_reduction_proxy_auth_request_handler_; | 360 data_reduction_proxy_auth_request_handler_; |
| 344 data_reduction_proxy::DataReductionProxyStatisticsPrefs* | 361 data_reduction_proxy::DataReductionProxyStatisticsPrefs* |
| 345 data_reduction_proxy_statistics_prefs_; | 362 data_reduction_proxy_statistics_prefs_; |
| 363 // |data_reduction_proxy_event_store_| must outlive this |
| 364 // ChromeNetworkDelegate. |
| 365 data_reduction_proxy::DataReductionProxyEventStore* |
| 366 data_reduction_proxy_event_store_; |
| 346 | 367 |
| 347 OnResolveProxyHandler on_resolve_proxy_handler_; | 368 OnResolveProxyHandler on_resolve_proxy_handler_; |
| 348 ProxyConfigGetter proxy_config_getter_; | 369 ProxyConfigGetter proxy_config_getter_; |
| 349 | 370 |
| 350 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); | 371 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); |
| 351 }; | 372 }; |
| 352 | 373 |
| 353 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ | 374 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ |
| OLD | NEW |