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 |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
15 #include "base/threading/non_thread_safe.h" | 15 #include "base/threading/non_thread_safe.h" |
16 #include "net/base/completion_callback.h" | 16 #include "net/base/completion_callback.h" |
17 #include "net/base/net_api.h" | 17 #include "net/base/net_export.h" |
18 #include "net/base/net_log.h" | 18 #include "net/base/net_log.h" |
19 #include "net/base/network_change_notifier.h" | 19 #include "net/base/network_change_notifier.h" |
20 #include "net/proxy/proxy_config_service.h" | 20 #include "net/proxy/proxy_config_service.h" |
21 #include "net/proxy/proxy_info.h" | 21 #include "net/proxy/proxy_info.h" |
22 #include "net/proxy/proxy_server.h" | 22 #include "net/proxy/proxy_server.h" |
23 | 23 |
24 class GURL; | 24 class GURL; |
25 class MessageLoop; | 25 class MessageLoop; |
26 | 26 |
27 namespace net { | 27 namespace net { |
28 | 28 |
29 class DhcpProxyScriptFetcher; | 29 class DhcpProxyScriptFetcher; |
30 class HostResolver; | 30 class HostResolver; |
31 class InitProxyResolver; | 31 class InitProxyResolver; |
32 class NetworkDelegate; | 32 class NetworkDelegate; |
33 class ProxyResolver; | 33 class ProxyResolver; |
34 class ProxyScriptFetcher; | 34 class ProxyScriptFetcher; |
35 class URLRequestContext; | 35 class URLRequestContext; |
36 | 36 |
37 // This class can be used to resolve the proxy server to use when loading a | 37 // This class can be used to resolve the proxy server to use when loading a |
38 // HTTP(S) URL. It uses the given ProxyResolver to handle the actual proxy | 38 // HTTP(S) URL. It uses the given ProxyResolver to handle the actual proxy |
39 // resolution. See ProxyResolverV8 for example. | 39 // resolution. See ProxyResolverV8 for example. |
40 class NET_API ProxyService : public NetworkChangeNotifier::IPAddressObserver, | 40 class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver, |
41 public ProxyConfigService::Observer, | 41 public ProxyConfigService::Observer, |
42 NON_EXPORTED_BASE(public base::NonThreadSafe) { | 42 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
43 public: | 43 public: |
44 // The instance takes ownership of |config_service| and |resolver|. | 44 // The instance takes ownership of |config_service| and |resolver|. |
45 // |net_log| is a possibly NULL destination to send log events to. It must | 45 // |net_log| is a possibly NULL destination to send log events to. It must |
46 // remain alive for the lifetime of this ProxyService. | 46 // remain alive for the lifetime of this ProxyService. |
47 ProxyService(ProxyConfigService* config_service, | 47 ProxyService(ProxyConfigService* config_service, |
48 ProxyResolver* resolver, | 48 ProxyResolver* resolver, |
49 NetLog* net_log); | 49 NetLog* net_log); |
50 | 50 |
51 virtual ~ProxyService(); | 51 virtual ~ProxyService(); |
52 | 52 |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 // stall re-configuration following an IP address change). | 355 // stall re-configuration following an IP address change). |
356 base::TimeTicks stall_proxy_autoconfig_until_; | 356 base::TimeTicks stall_proxy_autoconfig_until_; |
357 | 357 |
358 // The amount of time to stall requests following IP address changes. | 358 // The amount of time to stall requests following IP address changes. |
359 base::TimeDelta stall_proxy_auto_config_delay_; | 359 base::TimeDelta stall_proxy_auto_config_delay_; |
360 | 360 |
361 DISALLOW_COPY_AND_ASSIGN(ProxyService); | 361 DISALLOW_COPY_AND_ASSIGN(ProxyService); |
362 }; | 362 }; |
363 | 363 |
364 // Wrapper for invoking methods on a ProxyService synchronously. | 364 // Wrapper for invoking methods on a ProxyService synchronously. |
365 class NET_API SyncProxyServiceHelper | 365 class NET_EXPORT SyncProxyServiceHelper |
366 : public base::RefCountedThreadSafe<SyncProxyServiceHelper> { | 366 : public base::RefCountedThreadSafe<SyncProxyServiceHelper> { |
367 public: | 367 public: |
368 SyncProxyServiceHelper(MessageLoop* io_message_loop, | 368 SyncProxyServiceHelper(MessageLoop* io_message_loop, |
369 ProxyService* proxy_service); | 369 ProxyService* proxy_service); |
370 | 370 |
371 int ResolveProxy(const GURL& url, | 371 int ResolveProxy(const GURL& url, |
372 ProxyInfo* proxy_info, | 372 ProxyInfo* proxy_info, |
373 const BoundNetLog& net_log); | 373 const BoundNetLog& net_log); |
374 int ReconsiderProxyAfterError(const GURL& url, | 374 int ReconsiderProxyAfterError(const GURL& url, |
375 ProxyInfo* proxy_info, | 375 ProxyInfo* proxy_info, |
(...skipping 14 matching lines...) Expand all Loading... |
390 | 390 |
391 base::WaitableEvent event_; | 391 base::WaitableEvent event_; |
392 CompletionCallbackImpl<SyncProxyServiceHelper> callback_; | 392 CompletionCallbackImpl<SyncProxyServiceHelper> callback_; |
393 ProxyInfo proxy_info_; | 393 ProxyInfo proxy_info_; |
394 int result_; | 394 int result_; |
395 }; | 395 }; |
396 | 396 |
397 } // namespace net | 397 } // namespace net |
398 | 398 |
399 #endif // NET_PROXY_PROXY_SERVICE_H_ | 399 #endif // NET_PROXY_PROXY_SERVICE_H_ |
OLD | NEW |