| 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 NET_PROXY_PROXY_SERVICE_H_ | 5 #ifndef NET_PROXY_PROXY_SERVICE_H_ |
| 6 #define NET_PROXY_PROXY_SERVICE_H_ | 6 #define NET_PROXY_PROXY_SERVICE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 class NetworkDelegate; | 36 class NetworkDelegate; |
| 37 class ProxyResolver; | 37 class ProxyResolver; |
| 38 class ProxyResolverScriptData; | 38 class ProxyResolverScriptData; |
| 39 class ProxyScriptDecider; | 39 class ProxyScriptDecider; |
| 40 class ProxyScriptFetcher; | 40 class ProxyScriptFetcher; |
| 41 | 41 |
| 42 // This class can be used to resolve the proxy server to use when loading a | 42 // This class can be used to resolve the proxy server to use when loading a |
| 43 // HTTP(S) URL. It uses the given ProxyResolver to handle the actual proxy | 43 // HTTP(S) URL. It uses the given ProxyResolver to handle the actual proxy |
| 44 // resolution. See ProxyResolverV8 for example. | 44 // resolution. See ProxyResolverV8 for example. |
| 45 class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver, | 45 class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver, |
| 46 public NetworkChangeNotifier::DNSObserver, |
| 46 public ProxyConfigService::Observer, | 47 public ProxyConfigService::Observer, |
| 47 NON_EXPORTED_BASE(public base::NonThreadSafe) { | 48 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| 48 public: | 49 public: |
| 49 static const size_t kDefaultNumPacThreads = 4; | 50 static const size_t kDefaultNumPacThreads = 4; |
| 50 | 51 |
| 51 // This interface defines the set of policies for when to poll the PAC | 52 // This interface defines the set of policies for when to poll the PAC |
| 52 // script for changes. | 53 // script for changes. |
| 53 // | 54 // |
| 54 // The polling policy decides what the next poll delay should be in | 55 // The polling policy decides what the next poll delay should be in |
| 55 // milliseconds. It also decides how to wait for this delay -- either | 56 // milliseconds. It also decides how to wait for this delay -- either |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 // Start the initialization skipping past the "decision" phase. | 319 // Start the initialization skipping past the "decision" phase. |
| 319 void InitializeUsingDecidedConfig( | 320 void InitializeUsingDecidedConfig( |
| 320 int decider_result, | 321 int decider_result, |
| 321 ProxyResolverScriptData* script_data, | 322 ProxyResolverScriptData* script_data, |
| 322 const ProxyConfig& effective_config); | 323 const ProxyConfig& effective_config); |
| 323 | 324 |
| 324 // NetworkChangeNotifier::IPAddressObserver | 325 // NetworkChangeNotifier::IPAddressObserver |
| 325 // When this is called, we re-fetch PAC scripts and re-run WPAD. | 326 // When this is called, we re-fetch PAC scripts and re-run WPAD. |
| 326 virtual void OnIPAddressChanged() OVERRIDE; | 327 virtual void OnIPAddressChanged() OVERRIDE; |
| 327 | 328 |
| 329 // NetworkChangeNotifier::DNSObserver |
| 330 // We respond as above. |
| 331 virtual void OnDNSChanged() OVERRIDE; |
| 332 |
| 328 // ProxyConfigService::Observer | 333 // ProxyConfigService::Observer |
| 329 virtual void OnProxyConfigChanged( | 334 virtual void OnProxyConfigChanged( |
| 330 const ProxyConfig& config, | 335 const ProxyConfig& config, |
| 331 ProxyConfigService::ConfigAvailability availability) OVERRIDE; | 336 ProxyConfigService::ConfigAvailability availability) OVERRIDE; |
| 332 | 337 |
| 333 scoped_ptr<ProxyConfigService> config_service_; | 338 scoped_ptr<ProxyConfigService> config_service_; |
| 334 scoped_ptr<ProxyResolver> resolver_; | 339 scoped_ptr<ProxyResolver> resolver_; |
| 335 | 340 |
| 336 // We store the proxy configuration that was last fetched from the | 341 // We store the proxy configuration that was last fetched from the |
| 337 // ProxyConfigService, as well as the resulting "effective" configuration. | 342 // ProxyConfigService, as well as the resulting "effective" configuration. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 | 426 |
| 422 base::WaitableEvent event_; | 427 base::WaitableEvent event_; |
| 423 CompletionCallback callback_; | 428 CompletionCallback callback_; |
| 424 ProxyInfo proxy_info_; | 429 ProxyInfo proxy_info_; |
| 425 int result_; | 430 int result_; |
| 426 }; | 431 }; |
| 427 | 432 |
| 428 } // namespace net | 433 } // namespace net |
| 429 | 434 |
| 430 #endif // NET_PROXY_PROXY_SERVICE_H_ | 435 #endif // NET_PROXY_PROXY_SERVICE_H_ |
| OLD | NEW |