OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_BASE_HOST_RESOLVER_H_ | 5 #ifndef NET_BASE_HOST_RESOLVER_H_ |
6 #define NET_BASE_HOST_RESOLVER_H_ | 6 #define NET_BASE_HOST_RESOLVER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
12 #include "net/base/address_family.h" | 12 #include "net/base/address_family.h" |
13 #include "net/base/completion_callback.h" | 13 #include "net/base/completion_callback.h" |
14 #include "net/base/request_priority.h" | 14 #include "net/base/request_priority.h" |
15 | 15 |
16 class MessageLoop; | 16 class MessageLoop; |
17 | 17 |
18 namespace net { | 18 namespace net { |
19 | 19 |
20 class AddressList; | 20 class AddressList; |
21 class BoundNetLog; | 21 class BoundNetLog; |
22 class HostCache; | 22 class HostCache; |
23 class HostResolverImpl; | 23 class HostResolverImpl; |
24 class NetworkChangeNotifier; | |
25 | 24 |
26 // This class represents the task of resolving hostnames (or IP address | 25 // This class represents the task of resolving hostnames (or IP address |
27 // literal) to an AddressList object. | 26 // literal) to an AddressList object. |
28 // | 27 // |
29 // HostResolver can handle multiple requests at a time, so when cancelling a | 28 // HostResolver can handle multiple requests at a time, so when cancelling a |
30 // request the RequestHandle that was returned by Resolve() needs to be | 29 // request the RequestHandle that was returned by Resolve() needs to be |
31 // given. A simpler alternative for consumers that only have 1 outstanding | 30 // given. A simpler alternative for consumers that only have 1 outstanding |
32 // request at a time is to create a SingleRequestHostResolver wrapper around | 31 // request at a time is to create a SingleRequestHostResolver wrapper around |
33 // HostResolver (which will automatically cancel the single request when it | 32 // HostResolver (which will automatically cancel the single request when it |
34 // goes out of scope). | 33 // goes out of scope). |
(...skipping 194 matching lines...) Loading... |
229 | 228 |
230 // Completion callback for when request to |resolver_| completes. | 229 // Completion callback for when request to |resolver_| completes. |
231 net::CompletionCallbackImpl<SingleRequestHostResolver> callback_; | 230 net::CompletionCallbackImpl<SingleRequestHostResolver> callback_; |
232 | 231 |
233 DISALLOW_COPY_AND_ASSIGN(SingleRequestHostResolver); | 232 DISALLOW_COPY_AND_ASSIGN(SingleRequestHostResolver); |
234 }; | 233 }; |
235 | 234 |
236 // Creates a HostResolver implementation that queries the underlying system. | 235 // Creates a HostResolver implementation that queries the underlying system. |
237 // (Except if a unit-test has changed the global HostResolverProc using | 236 // (Except if a unit-test has changed the global HostResolverProc using |
238 // ScopedHostResolverProc to intercept requests to the system). | 237 // ScopedHostResolverProc to intercept requests to the system). |
239 // |network_change_notifier| must outlive HostResolver. It can optionally be | 238 HostResolver* CreateSystemHostResolver(); |
240 // NULL, in which case HostResolver will not respond to network changes. | |
241 HostResolver* CreateSystemHostResolver( | |
242 NetworkChangeNotifier* network_change_notifier); | |
243 | 239 |
244 } // namespace net | 240 } // namespace net |
245 | 241 |
246 #endif // NET_BASE_HOST_RESOLVER_H_ | 242 #endif // NET_BASE_HOST_RESOLVER_H_ |
OLD | NEW |