ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / net / dns / host_resolver_mojo.h
blobd250b969a927c7775d78ab22303900fafa510cf4
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.
5 #ifndef NET_DNS_HOST_RESOLVER_MOJO_H_
6 #define NET_DNS_HOST_RESOLVER_MOJO_H_
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"
14 namespace net {
15 class AddressList;
16 class BoundNetLog;
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;
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;
38 private:
39 class Job;
41 // mojo::ErrorHandler override.
42 void OnConnectionError() override;
44 interfaces::HostResolverPtr resolver_;
46 const base::Closure disconnect_callback_;
48 base::ThreadChecker thread_checker_;
50 DISALLOW_COPY_AND_ASSIGN(HostResolverMojo);
53 } // namespace net
55 #endif // NET_DNS_HOST_RESOLVER_MOJO_H_