OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 "base/callback.h" |
| 9 #include "base/threading/thread_checker.h" |
| 10 #include "net/dns/host_resolver.h" |
| 11 #include "net/interfaces/host_resolver_service.mojom.h" |
| 12 #include "third_party/mojo/src/mojo/public/cpp/bindings/error_handler.h" |
| 13 |
| 14 namespace net { |
| 15 class AddressList; |
| 16 class BoundNetLog; |
| 17 |
| 18 // A HostResolver implementation that delegates to an interfaces::HostResolver |
| 19 // mojo interface. |
| 20 class HostResolverMojo : public HostResolver, public mojo::ErrorHandler { |
| 21 public: |
| 22 HostResolverMojo(interfaces::HostResolverPtr resolver, |
| 23 const base::Closure& disconnect_callback); |
| 24 ~HostResolverMojo() override; |
| 25 |
| 26 // HostResolver overrides. |
| 27 int Resolve(const RequestInfo& info, |
| 28 RequestPriority priority, |
| 29 AddressList* addresses, |
| 30 const CompletionCallback& callback, |
| 31 RequestHandle* request_handle, |
| 32 const BoundNetLog& source_net_log) override; |
| 33 int ResolveFromCache(const RequestInfo& info, |
| 34 AddressList* addresses, |
| 35 const BoundNetLog& source_net_log) override; |
| 36 void CancelRequest(RequestHandle req) override; |
| 37 |
| 38 private: |
| 39 class Job; |
| 40 |
| 41 // mojo::ErrorHandler override. |
| 42 void OnConnectionError() override; |
| 43 |
| 44 interfaces::HostResolverPtr resolver_; |
| 45 |
| 46 const base::Closure disconnect_callback_; |
| 47 |
| 48 base::ThreadChecker thread_checker_; |
| 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(HostResolverMojo); |
| 51 }; |
| 52 |
| 53 } // namespace net |
| 54 |
| 55 #endif // NET_DNS_HOST_RESOLVER_MOJO_H_ |
OLD | NEW |