#ifndef EXTENSIONS_BROWSER_API_DNS_DNS_API_H_
#define EXTENSIONS_BROWSER_API_DNS_DNS_API_H_
#include <string>
#include "extensions/browser/extension_function.h"
#include "net/base/address_list.h"
#include "net/base/completion_callback.h"
#include "net/dns/host_resolver.h"
namespace content {
class ResourceContext;
}
namespace extensions {
class DnsResolveFunction : public AsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("dns.resolve", DNS_RESOLVE)
DnsResolveFunction();
protected:
virtual ~DnsResolveFunction();
virtual bool RunImpl() OVERRIDE;
void WorkOnIOThread();
void RespondOnUIThread();
private:
void OnLookupFinished(int result);
std::string hostname_;
content::ResourceContext* resource_context_;
bool response_;
scoped_ptr<net::HostResolver::RequestHandle> request_handle_;
scoped_ptr<net::AddressList> addresses_;
};
}
#endif