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 #include "net/dns/mapped_host_resolver.h" | 5 #include "net/dns/mapped_host_resolver.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "net/base/host_port_pair.h" | 11 #include "net/base/host_port_pair.h" |
12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 MappedHostResolver::MappedHostResolver(std::unique_ptr<HostResolver> impl) | 16 MappedHostResolver::MappedHostResolver(std::unique_ptr<HostResolver> impl) |
17 : impl_(std::move(impl)) {} | 17 : impl_(std::move(impl)) {} |
18 | 18 |
19 MappedHostResolver::~MappedHostResolver() { | 19 MappedHostResolver::~MappedHostResolver() { |
20 } | 20 } |
21 | 21 |
22 int MappedHostResolver::Resolve(const RequestInfo& original_info, | 22 int MappedHostResolver::Resolve(const RequestInfo& original_info, |
23 RequestPriority priority, | 23 RequestPriority priority, |
24 AddressList* addresses, | 24 AddressList* addresses, |
25 const CompletionCallback& callback, | 25 const CompletionCallback& callback, |
26 std::unique_ptr<Request>* request, | 26 std::unique_ptr<Request>* request, |
27 const BoundNetLog& net_log) { | 27 const NetLogWithSource& net_log) { |
28 RequestInfo info = original_info; | 28 RequestInfo info = original_info; |
29 int rv = ApplyRules(&info); | 29 int rv = ApplyRules(&info); |
30 if (rv != OK) | 30 if (rv != OK) |
31 return rv; | 31 return rv; |
32 | 32 |
33 return impl_->Resolve(info, priority, addresses, callback, request, net_log); | 33 return impl_->Resolve(info, priority, addresses, callback, request, net_log); |
34 } | 34 } |
35 | 35 |
36 int MappedHostResolver::ResolveFromCache(const RequestInfo& original_info, | 36 int MappedHostResolver::ResolveFromCache(const RequestInfo& original_info, |
37 AddressList* addresses, | 37 AddressList* addresses, |
38 const BoundNetLog& net_log) { | 38 const NetLogWithSource& net_log) { |
39 RequestInfo info = original_info; | 39 RequestInfo info = original_info; |
40 int rv = ApplyRules(&info); | 40 int rv = ApplyRules(&info); |
41 if (rv != OK) | 41 if (rv != OK) |
42 return rv; | 42 return rv; |
43 | 43 |
44 return impl_->ResolveFromCache(info, addresses, net_log); | 44 return impl_->ResolveFromCache(info, addresses, net_log); |
45 } | 45 } |
46 | 46 |
47 void MappedHostResolver::SetDnsClientEnabled(bool enabled) { | 47 void MappedHostResolver::SetDnsClientEnabled(bool enabled) { |
48 impl_->SetDnsClientEnabled(enabled); | 48 impl_->SetDnsClientEnabled(enabled); |
(...skipping 11 matching lines...) Expand all Loading... |
60 HostPortPair host_port(info->host_port_pair()); | 60 HostPortPair host_port(info->host_port_pair()); |
61 if (rules_.RewriteHost(&host_port)) { | 61 if (rules_.RewriteHost(&host_port)) { |
62 if (host_port.host() == "~NOTFOUND") | 62 if (host_port.host() == "~NOTFOUND") |
63 return ERR_NAME_NOT_RESOLVED; | 63 return ERR_NAME_NOT_RESOLVED; |
64 info->set_host_port_pair(host_port); | 64 info->set_host_port_pair(host_port); |
65 } | 65 } |
66 return OK; | 66 return OK; |
67 } | 67 } |
68 | 68 |
69 } // namespace net | 69 } // namespace net |
OLD | NEW |