Add ICU message format support
[chromium-blink-merge.git] / extensions / browser / api / dns / dns_api.h
bloba8947ead2ddae5926eeae750affbfef22d31bd25
1 // Copyright 2014 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 EXTENSIONS_BROWSER_API_DNS_DNS_API_H_
6 #define EXTENSIONS_BROWSER_API_DNS_DNS_API_H_
8 #include <string>
10 #include "extensions/browser/extension_function.h"
11 #include "net/base/address_list.h"
12 #include "net/base/completion_callback.h"
13 #include "net/dns/host_resolver.h"
15 namespace content {
16 class ResourceContext;
19 namespace extensions {
21 class DnsResolveFunction : public AsyncExtensionFunction {
22 public:
23 DECLARE_EXTENSION_FUNCTION("dns.resolve", DNS_RESOLVE)
25 DnsResolveFunction();
27 protected:
28 ~DnsResolveFunction() override;
30 // ExtensionFunction:
31 bool RunAsync() override;
33 void WorkOnIOThread();
34 void RespondOnUIThread();
36 private:
37 void OnLookupFinished(int result);
39 std::string hostname_;
41 // Not owned.
42 content::ResourceContext* resource_context_;
44 bool response_; // The value sent in SendResponse().
46 scoped_ptr<net::HostResolver::RequestHandle> request_handle_;
47 scoped_ptr<net::AddressList> addresses_;
50 } // namespace extensions
52 #endif // EXTENSIONS_BROWSER_API_DNS_DNS_API_H_