OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_IMPL_H_ | 5 #ifndef NET_BASE_HOST_RESOLVER_IMPL_H_ |
6 #define NET_BASE_HOST_RESOLVER_IMPL_H_ | 6 #define NET_BASE_HOST_RESOLVER_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 RequestHandle* out_req, | 63 RequestHandle* out_req, |
64 LoadLog* load_log); | 64 LoadLog* load_log); |
65 virtual void CancelRequest(RequestHandle req); | 65 virtual void CancelRequest(RequestHandle req); |
66 virtual void AddObserver(Observer* observer); | 66 virtual void AddObserver(Observer* observer); |
67 virtual void RemoveObserver(Observer* observer); | 67 virtual void RemoveObserver(Observer* observer); |
68 virtual HostCache* GetHostCache(); | 68 virtual HostCache* GetHostCache(); |
69 | 69 |
70 // TODO(eroman): temp hack for http://crbug.com/15513 | 70 // TODO(eroman): temp hack for http://crbug.com/15513 |
71 virtual void Shutdown(); | 71 virtual void Shutdown(); |
72 | 72 |
73 // Prevents returning IPv6 addresses from Resolve(). | 73 virtual void SetDefaultAddressFamily(AddressFamily address_family) { |
74 // The default is to allow IPv6 results. | 74 default_address_family_ = address_family; |
75 virtual void DisableIPv6(bool disable_ipv6) { | |
76 disable_ipv6_ = disable_ipv6; | |
77 } | 75 } |
78 | 76 |
79 private: | 77 private: |
80 class Job; | 78 class Job; |
81 class Request; | 79 class Request; |
82 typedef std::vector<Request*> RequestsList; | 80 typedef std::vector<Request*> RequestsList; |
83 typedef HostCache::Key Key; | 81 typedef HostCache::Key Key; |
84 typedef std::map<Key, scoped_refptr<Job> > JobMap; | 82 typedef std::map<Key, scoped_refptr<Job> > JobMap; |
85 typedef std::vector<Observer*> ObserversList; | 83 typedef std::vector<Observer*> ObserversList; |
86 | 84 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 ObserversList observers_; | 130 ObserversList observers_; |
133 | 131 |
134 // Monotonically increasing ID number to assign to the next request. | 132 // Monotonically increasing ID number to assign to the next request. |
135 // Observers are the only consumers of this ID number. | 133 // Observers are the only consumers of this ID number. |
136 int next_request_id_; | 134 int next_request_id_; |
137 | 135 |
138 // The procedure to use for resolving host names. This will be NULL, except | 136 // The procedure to use for resolving host names. This will be NULL, except |
139 // in the case of unit-tests which inject custom host resolving behaviors. | 137 // in the case of unit-tests which inject custom host resolving behaviors. |
140 scoped_refptr<HostResolverProc> resolver_proc_; | 138 scoped_refptr<HostResolverProc> resolver_proc_; |
141 | 139 |
142 // Set to true if only IPv4 address are to be returned by Resolve(). | 140 // Address family to use when the request doesn't specify one. |
143 bool disable_ipv6_; | 141 AddressFamily default_address_family_; |
144 | 142 |
145 // TODO(eroman): temp hack for http://crbug.com/15513 | 143 // TODO(eroman): temp hack for http://crbug.com/15513 |
146 bool shutdown_; | 144 bool shutdown_; |
147 | 145 |
148 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl); | 146 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl); |
149 }; | 147 }; |
150 | 148 |
151 } // namespace net | 149 } // namespace net |
152 | 150 |
153 #endif // NET_BASE_HOST_RESOLVER_IMPL_H_ | 151 #endif // NET_BASE_HOST_RESOLVER_IMPL_H_ |
OLD | NEW |