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/logging.h" | 9 #include "base/logging.h" |
9 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
10 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
11 #include "net/base/completion_callback.h" | 12 #include "net/base/completion_callback.h" |
12 #include "net/base/load_states.h" | 13 #include "net/base/load_states.h" |
13 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
14 #include "net/proxy/proxy_resolver_script_data.h" | 15 #include "net/proxy/proxy_resolver_script_data.h" |
15 #include "url/gurl.h" | 16 #include "url/gurl.h" |
16 | 17 |
17 namespace net { | 18 namespace net { |
18 | 19 |
19 class BoundNetLog; | 20 class BoundNetLog; |
20 class ProxyInfo; | 21 class ProxyInfo; |
21 | 22 |
22 // 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 |
23 // 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 |
24 // 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 |
25 // requests at a time. | 26 // requests at a time. |
26 class NET_EXPORT_PRIVATE ProxyResolver { | 27 class NET_EXPORT_PRIVATE ProxyResolver { |
27 public: | 28 public: |
28 // Opaque pointer type, to return a handle to cancel outstanding requests. | 29 // Opaque pointer type, to return a handle to cancel outstanding requests. |
29 typedef void* RequestHandle; | 30 typedef void* RequestHandle; |
30 | 31 |
| 32 using LoadStateChangedCallback = |
| 33 const base::Callback<void(RequestHandle, LoadState)>; |
| 34 |
31 // See |expects_pac_bytes()| for the meaning of |expects_pac_bytes|. | 35 // See |expects_pac_bytes()| for the meaning of |expects_pac_bytes|. |
32 explicit ProxyResolver(bool expects_pac_bytes) | 36 explicit ProxyResolver(bool expects_pac_bytes) |
33 : expects_pac_bytes_(expects_pac_bytes) {} | 37 : expects_pac_bytes_(expects_pac_bytes) {} |
34 | 38 |
35 virtual ~ProxyResolver() {} | 39 virtual ~ProxyResolver() {} |
36 | 40 |
37 // Gets a list of proxy servers to use for |url|. If the request will | 41 // Gets a list of proxy servers to use for |url|. If the request will |
38 // complete asynchronously returns ERR_IO_PENDING and notifies the result | 42 // complete asynchronously returns ERR_IO_PENDING and notifies the result |
39 // by running |callback|. If the result code is OK then | 43 // by running |callback|. If the result code is OK then |
40 // the request was successful and |results| contains the proxy | 44 // the request was successful and |results| contains the proxy |
(...skipping 28 matching lines...) Expand all Loading... |
69 | 73 |
70 private: | 74 private: |
71 const bool expects_pac_bytes_; | 75 const bool expects_pac_bytes_; |
72 | 76 |
73 DISALLOW_COPY_AND_ASSIGN(ProxyResolver); | 77 DISALLOW_COPY_AND_ASSIGN(ProxyResolver); |
74 }; | 78 }; |
75 | 79 |
76 } // namespace net | 80 } // namespace net |
77 | 81 |
78 #endif // NET_PROXY_PROXY_RESOLVER_H_ | 82 #endif // NET_PROXY_PROXY_RESOLVER_H_ |
OLD | NEW |