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_RESOLVER_H_ | 5 #ifndef NET_PROXY_PROXY_RESOLVER_H_ |
6 #define NET_PROXY_PROXY_RESOLVER_H_ | 6 #define NET_PROXY_PROXY_RESOLVER_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 // Interface for "proxy resolvers". A ProxyResolver fills in a list of proxies | 23 // Interface for "proxy resolvers". A ProxyResolver fills in a list of proxies |
24 // to use for a particular URL. Generally the backend for a ProxyResolver is | 24 // to use for a particular URL. Generally the backend for a ProxyResolver is |
25 // a PAC script, but it doesn't need to be. ProxyResolver can service multiple | 25 // a PAC script, but it doesn't need to be. ProxyResolver can service multiple |
26 // requests at a time. | 26 // requests at a time. |
27 class NET_EXPORT_PRIVATE ProxyResolver { | 27 class NET_EXPORT_PRIVATE ProxyResolver { |
28 public: | 28 public: |
29 // Opaque pointer type, to return a handle to cancel outstanding requests. | 29 // Opaque pointer type, to return a handle to cancel outstanding requests. |
30 typedef void* RequestHandle; | 30 typedef void* RequestHandle; |
31 | 31 |
32 using LoadStateChangedCallback = | |
33 base::Callback<void(RequestHandle, LoadState)>; | |
34 | |
35 ProxyResolver() {} | 32 ProxyResolver() {} |
36 | 33 |
37 virtual ~ProxyResolver() {} | 34 virtual ~ProxyResolver() {} |
38 | 35 |
39 // Gets a list of proxy servers to use for |url|. If the request will | 36 // Gets a list of proxy servers to use for |url|. If the request will |
40 // complete asynchronously returns ERR_IO_PENDING and notifies the result | 37 // complete asynchronously returns ERR_IO_PENDING and notifies the result |
41 // by running |callback|. If the result code is OK then | 38 // by running |callback|. If the result code is OK then |
42 // the request was successful and |results| contains the proxy | 39 // the request was successful and |results| contains the proxy |
43 // resolution information. In the case of asynchronous completion | 40 // resolution information. In the case of asynchronous completion |
44 // |*request| is written to, and can be passed to CancelRequest(). | 41 // |*request| is written to, and can be passed to CancelRequest(). |
45 virtual int GetProxyForURL(const GURL& url, | 42 virtual int GetProxyForURL(const GURL& url, |
46 ProxyInfo* results, | 43 ProxyInfo* results, |
47 const CompletionCallback& callback, | 44 const CompletionCallback& callback, |
48 RequestHandle* request, | 45 RequestHandle* request, |
49 const BoundNetLog& net_log) = 0; | 46 const BoundNetLog& net_log) = 0; |
50 | 47 |
51 // Cancels |request|. | 48 // Cancels |request|. |
52 virtual void CancelRequest(RequestHandle request) = 0; | 49 virtual void CancelRequest(RequestHandle request) = 0; |
53 | 50 |
54 // Gets the LoadState for |request|. | 51 // Gets the LoadState for |request|. |
55 virtual LoadState GetLoadState(RequestHandle request) const = 0; | 52 virtual LoadState GetLoadState(RequestHandle request) const = 0; |
56 | 53 |
57 private: | 54 private: |
58 DISALLOW_COPY_AND_ASSIGN(ProxyResolver); | 55 DISALLOW_COPY_AND_ASSIGN(ProxyResolver); |
59 }; | 56 }; |
60 | 57 |
61 } // namespace net | 58 } // namespace net |
62 | 59 |
63 #endif // NET_PROXY_PROXY_RESOLVER_H_ | 60 #endif // NET_PROXY_PROXY_RESOLVER_H_ |
OLD | NEW |