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" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 virtual void CancelRequest(RequestHandle req) = 0; | 149 virtual void CancelRequest(RequestHandle req) = 0; |
150 | 150 |
151 // Adds an observer to this resolver. The observer will be notified of the | 151 // Adds an observer to this resolver. The observer will be notified of the |
152 // start and completion of all requests (excluding cancellation). |observer| | 152 // start and completion of all requests (excluding cancellation). |observer| |
153 // must remain valid for the duration of this HostResolver's lifetime. | 153 // must remain valid for the duration of this HostResolver's lifetime. |
154 virtual void AddObserver(Observer* observer) = 0; | 154 virtual void AddObserver(Observer* observer) = 0; |
155 | 155 |
156 // Unregisters an observer previously added by AddObserver(). | 156 // Unregisters an observer previously added by AddObserver(). |
157 virtual void RemoveObserver(Observer* observer) = 0; | 157 virtual void RemoveObserver(Observer* observer) = 0; |
158 | 158 |
| 159 // Gives the HostResolver an opportunity to flush state. |
| 160 virtual void Flush() {} |
| 161 |
159 // Sets the default AddressFamily to use when requests have left it | 162 // Sets the default AddressFamily to use when requests have left it |
160 // unspecified. For example, this could be used to restrict resolution | 163 // unspecified. For example, this could be used to restrict resolution |
161 // results to AF_INET by passing in ADDRESS_FAMILY_IPV4, or to | 164 // results to AF_INET by passing in ADDRESS_FAMILY_IPV4, or to |
162 // AF_INET6 by passing in ADDRESS_FAMILY_IPV6. | 165 // AF_INET6 by passing in ADDRESS_FAMILY_IPV6. |
163 virtual void SetDefaultAddressFamily(AddressFamily address_family) {} | 166 virtual void SetDefaultAddressFamily(AddressFamily address_family) {} |
164 | 167 |
165 // Returns |this| cast to a HostResolverImpl*, or NULL if the subclass | 168 // Returns |this| cast to a HostResolverImpl*, or NULL if the subclass |
166 // is not compatible with HostResolverImpl. Used primarily to expose | 169 // is not compatible with HostResolverImpl. Used primarily to expose |
167 // additional functionality on the about:net-internals page. | 170 // additional functionality on the about:net-internals page. |
168 virtual HostResolverImpl* GetAsHostResolverImpl() { return NULL; } | 171 virtual HostResolverImpl* GetAsHostResolverImpl() { return NULL; } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 // (Except if a unit-test has changed the global HostResolverProc using | 229 // (Except if a unit-test has changed the global HostResolverProc using |
227 // ScopedHostResolverProc to intercept requests to the system). | 230 // ScopedHostResolverProc to intercept requests to the system). |
228 // |network_change_notifier| must outlive HostResolver. It can optionally be | 231 // |network_change_notifier| must outlive HostResolver. It can optionally be |
229 // NULL, in which case HostResolver will not respond to network changes. | 232 // NULL, in which case HostResolver will not respond to network changes. |
230 HostResolver* CreateSystemHostResolver( | 233 HostResolver* CreateSystemHostResolver( |
231 NetworkChangeNotifier* network_change_notifier); | 234 NetworkChangeNotifier* network_change_notifier); |
232 | 235 |
233 } // namespace net | 236 } // namespace net |
234 | 237 |
235 #endif // NET_BASE_HOST_RESOLVER_H_ | 238 #endif // NET_BASE_HOST_RESOLVER_H_ |
OLD | NEW |