| 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_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/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 friend class Request; | 52 friend class Request; |
| 53 scoped_refptr<Request> request_; | 53 scoped_refptr<Request> request_; |
| 54 DISALLOW_COPY_AND_ASSIGN(HostResolver); | 54 DISALLOW_COPY_AND_ASSIGN(HostResolver); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 // A helper class used in unit tests to alter hostname mappings. See | 57 // A helper class used in unit tests to alter hostname mappings. See |
| 58 // SetHostMapper for details. | 58 // SetHostMapper for details. |
| 59 class HostMapper : public base::RefCountedThreadSafe<HostMapper> { | 59 class HostMapper : public base::RefCountedThreadSafe<HostMapper> { |
| 60 public: | 60 public: |
| 61 virtual ~HostMapper() {} | 61 virtual ~HostMapper() {} |
| 62 |
| 63 // Returns possibly altered hostname, or empty string to simulate |
| 64 // a failed lookup. |
| 62 virtual std::string Map(const std::string& host) = 0; | 65 virtual std::string Map(const std::string& host) = 0; |
| 63 | 66 |
| 64 protected: | 67 protected: |
| 65 // Ask previous host mapper (if set) for mapping of given host. | 68 // Ask previous host mapper (if set) for mapping of given host. |
| 66 std::string MapUsingPrevious(const std::string& host); | 69 std::string MapUsingPrevious(const std::string& host); |
| 67 | 70 |
| 68 private: | 71 private: |
| 69 friend class ScopedHostMapper; | 72 friend class ScopedHostMapper; |
| 70 | 73 |
| 71 // Set mapper to ask when this mapper doesn't want to modify the result. | 74 // Set mapper to ask when this mapper doesn't want to modify the result. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 88 // | 91 // |
| 89 // NOTE: In most cases, you should use ScopedHostMapper instead, which is | 92 // NOTE: In most cases, you should use ScopedHostMapper instead, which is |
| 90 // defined in host_resolver_unittest.h | 93 // defined in host_resolver_unittest.h |
| 91 // | 94 // |
| 92 HostMapper* SetHostMapper(HostMapper* host_mapper); | 95 HostMapper* SetHostMapper(HostMapper* host_mapper); |
| 93 #endif | 96 #endif |
| 94 | 97 |
| 95 } // namespace net | 98 } // namespace net |
| 96 | 99 |
| 97 #endif // NET_BASE_HOST_RESOLVER_H_ | 100 #endif // NET_BASE_HOST_RESOLVER_H_ |
| OLD | NEW |