OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NET_DNS_HOST_RESOLVER_MOJO_H_ |
| 6 #define NET_DNS_HOST_RESOLVER_MOJO_H_ |
| 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/scoped_vector.h" |
| 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/threading/non_thread_safe.h" |
| 16 #include "base/time/time.h" |
| 17 #include "net/base/net_export.h" |
| 18 #include "net/base/network_change_notifier.h" |
| 19 #include "net/dns/host_cache.h" |
| 20 #include "net/dns/host_resolver.h" |
| 21 #include "net/dns/host_resolver.mojom.h" |
| 22 |
| 23 namespace net { |
| 24 |
| 25 class BoundNetLog; |
| 26 class DnsClient; |
| 27 class NetLog; |
| 28 |
| 29 class NET_EXPORT HostResolverMojo |
| 30 : public HostResolver, |
| 31 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| 32 public: |
| 33 explicit HostResolverMojo(dns::ResolverPtr resolver); |
| 34 ~HostResolverMojo(); |
| 35 |
| 36 int Resolve(const RequestInfo& info, |
| 37 RequestPriority priority, |
| 38 AddressList* addresses, |
| 39 const CompletionCallback& callback, |
| 40 RequestHandle* out_req, |
| 41 const BoundNetLog& source_net_log) override; |
| 42 int ResolveFromCache(const RequestInfo& info, |
| 43 AddressList* addresses, |
| 44 const BoundNetLog& source_net_log) override; |
| 45 void CancelRequest(RequestHandle req) override; |
| 46 |
| 47 private: |
| 48 class Job; |
| 49 |
| 50 dns::ResolverPtr resolver_; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(HostResolverMojo); |
| 53 }; |
| 54 |
| 55 } // namespace net |
| 56 |
| 57 namespace mojo { |
| 58 |
| 59 template <> |
| 60 struct TypeConverter<net::dns::RequestInfoPtr, net::HostResolver::RequestInfo> { |
| 61 static net::dns::RequestInfoPtr Convert( |
| 62 const net::HostResolver::RequestInfo& obj); |
| 63 }; |
| 64 |
| 65 template <> |
| 66 struct TypeConverter<net::AddressList, net::dns::AddressList> { |
| 67 static net::AddressList Convert(const net::dns::AddressList& obj); |
| 68 }; |
| 69 |
| 70 } // namespace mojo |
| 71 |
| 72 #endif // NET_DNS_HOST_RESOLVER_MOJO_H_ |
OLD | NEW |