| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_DNS_HOST_RESOLVER_H_ | 5 #ifndef NET_DNS_HOST_RESOLVER_H_ |
| 6 #define NET_DNS_HOST_RESOLVER_H_ | 6 #define NET_DNS_HOST_RESOLVER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 // Returns the HostResolverCache |this| uses, or NULL if there isn't one. | 171 // Returns the HostResolverCache |this| uses, or NULL if there isn't one. |
| 172 // Used primarily to clear the cache and for getting debug information. | 172 // Used primarily to clear the cache and for getting debug information. |
| 173 virtual HostCache* GetHostCache(); | 173 virtual HostCache* GetHostCache(); |
| 174 | 174 |
| 175 // Returns the current DNS configuration |this| is using, as a Value, or NULL | 175 // Returns the current DNS configuration |this| is using, as a Value, or NULL |
| 176 // if it's configured to always use the system host resolver. Caller takes | 176 // if it's configured to always use the system host resolver. Caller takes |
| 177 // ownership of the returned Value. | 177 // ownership of the returned Value. |
| 178 virtual base::Value* GetDnsConfigAsValue() const; | 178 virtual base::Value* GetDnsConfigAsValue() const; |
| 179 | 179 |
| 180 // Sets an IP address to use instead of the one provided by doing a lookup |
| 181 // on gethostname() for operating systems where gethostname() returns |
| 182 // localhost (e.g. Chrome OS). |
| 183 void set_my_ip_address(const std::string& ip_address) { |
| 184 my_ip_address_ = ip_address; |
| 185 } |
| 186 const std::string& my_ip_address() const { return my_ip_address_; } |
| 187 |
| 180 // Creates a HostResolver implementation that queries the underlying system. | 188 // Creates a HostResolver implementation that queries the underlying system. |
| 181 // (Except if a unit-test has changed the global HostResolverProc using | 189 // (Except if a unit-test has changed the global HostResolverProc using |
| 182 // ScopedHostResolverProc to intercept requests to the system). | 190 // ScopedHostResolverProc to intercept requests to the system). |
| 183 static scoped_ptr<HostResolver> CreateSystemResolver( | 191 static scoped_ptr<HostResolver> CreateSystemResolver( |
| 184 const Options& options, | 192 const Options& options, |
| 185 NetLog* net_log); | 193 NetLog* net_log); |
| 186 | 194 |
| 187 // As above, but uses default parameters. | 195 // As above, but uses default parameters. |
| 188 static scoped_ptr<HostResolver> CreateDefaultResolver(NetLog* net_log); | 196 static scoped_ptr<HostResolver> CreateDefaultResolver(NetLog* net_log); |
| 189 | 197 |
| 190 protected: | 198 protected: |
| 191 HostResolver(); | 199 HostResolver(); |
| 192 | 200 |
| 193 private: | 201 private: |
| 202 std::string my_ip_address_; |
| 203 |
| 194 DISALLOW_COPY_AND_ASSIGN(HostResolver); | 204 DISALLOW_COPY_AND_ASSIGN(HostResolver); |
| 195 }; | 205 }; |
| 196 | 206 |
| 197 } // namespace net | 207 } // namespace net |
| 198 | 208 |
| 199 #endif // NET_DNS_HOST_RESOLVER_H_ | 209 #endif // NET_DNS_HOST_RESOLVER_H_ |
| OLD | NEW |