OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 class HostResolver; | 27 class HostResolver; |
28 class InitProxyResolver; | 28 class InitProxyResolver; |
29 class ProxyResolver; | 29 class ProxyResolver; |
30 class ProxyScriptFetcher; | 30 class ProxyScriptFetcher; |
31 class URLRequestContext; | 31 class URLRequestContext; |
32 | 32 |
33 // This class can be used to resolve the proxy server to use when loading a | 33 // This class can be used to resolve the proxy server to use when loading a |
34 // HTTP(S) URL. It uses the given ProxyResolver to handle the actual proxy | 34 // HTTP(S) URL. It uses the given ProxyResolver to handle the actual proxy |
35 // resolution. See ProxyResolverV8 for example. | 35 // resolution. See ProxyResolverV8 for example. |
36 class ProxyService : public base::RefCountedThreadSafe<ProxyService>, | 36 class ProxyService : public base::RefCountedThreadSafe<ProxyService>, |
37 public NetworkChangeNotifier::Observer, | 37 public NetworkChangeNotifier::IPAddressObserver, |
38 public ProxyConfigService::Observer { | 38 public ProxyConfigService::Observer { |
39 public: | 39 public: |
40 // The instance takes ownership of |config_service| and |resolver|. | 40 // The instance takes ownership of |config_service| and |resolver|. |
41 // |net_log| is a possibly NULL destination to send log events to. It must | 41 // |net_log| is a possibly NULL destination to send log events to. It must |
42 // remain alive for the lifetime of this ProxyService. | 42 // remain alive for the lifetime of this ProxyService. |
43 ProxyService(ProxyConfigService* config_service, | 43 ProxyService(ProxyConfigService* config_service, |
44 ProxyResolver* resolver, | 44 ProxyResolver* resolver, |
45 NetLog* net_log); | 45 NetLog* net_log); |
46 | 46 |
47 // Used internally to handle PAC queries. | 47 // Used internally to handle PAC queries. |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 // Called when proxy resolution has completed (either synchronously or | 273 // Called when proxy resolution has completed (either synchronously or |
274 // asynchronously). Handles logging the result, and cleaning out | 274 // asynchronously). Handles logging the result, and cleaning out |
275 // bad entries from the results list. | 275 // bad entries from the results list. |
276 int DidFinishResolvingProxy(ProxyInfo* result, | 276 int DidFinishResolvingProxy(ProxyInfo* result, |
277 int result_code, | 277 int result_code, |
278 const BoundNetLog& net_log); | 278 const BoundNetLog& net_log); |
279 | 279 |
280 // Start initialization using |fetched_config_|. | 280 // Start initialization using |fetched_config_|. |
281 void InitializeUsingLastFetchedConfig(); | 281 void InitializeUsingLastFetchedConfig(); |
282 | 282 |
283 // NetworkChangeNotifier::Observer | 283 // NetworkChangeNotifier::IPAddressObserver |
284 // When this is called, we re-fetch PAC scripts and re-run WPAD. | 284 // When this is called, we re-fetch PAC scripts and re-run WPAD. |
285 virtual void OnIPAddressChanged(); | 285 virtual void OnIPAddressChanged(); |
286 | 286 |
287 // ProxyConfigService::Observer | 287 // ProxyConfigService::Observer |
288 virtual void OnProxyConfigChanged(const ProxyConfig& config); | 288 virtual void OnProxyConfigChanged(const ProxyConfig& config); |
289 | 289 |
290 scoped_ptr<ProxyConfigService> config_service_; | 290 scoped_ptr<ProxyConfigService> config_service_; |
291 scoped_ptr<ProxyResolver> resolver_; | 291 scoped_ptr<ProxyResolver> resolver_; |
292 | 292 |
293 // We store the proxy configuration that was last fetched from the | 293 // We store the proxy configuration that was last fetched from the |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 | 369 |
370 base::WaitableEvent event_; | 370 base::WaitableEvent event_; |
371 CompletionCallbackImpl<SyncProxyServiceHelper> callback_; | 371 CompletionCallbackImpl<SyncProxyServiceHelper> callback_; |
372 ProxyInfo proxy_info_; | 372 ProxyInfo proxy_info_; |
373 int result_; | 373 int result_; |
374 }; | 374 }; |
375 | 375 |
376 } // namespace net | 376 } // namespace net |
377 | 377 |
378 #endif // NET_PROXY_PROXY_SERVICE_H_ | 378 #endif // NET_PROXY_PROXY_SERVICE_H_ |
OLD | NEW |