#ifndef SERVICES_NETWORK_MOJO_HOST_RESOLVER_IMPL_H_
#define SERVICES_NETWORK_MOJO_HOST_RESOLVER_IMPL_H_
#include <list>
#include <memory>
#include <string>
#include "base/component_export.h"
#include "base/memory/raw_ptr.h"
#include "base/threading/thread_checker.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "net/log/net_log_with_source.h"
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
namespace net {
class HostResolver;
class NetworkAnonymizationKey;
}
namespace network {
class COMPONENT_EXPORT(NETWORK_SERVICE) MojoHostResolverImpl {
public:
MojoHostResolverImpl(net::HostResolver* resolver,
const net::NetLogWithSource& net_log);
MojoHostResolverImpl(const MojoHostResolverImpl&) = delete;
MojoHostResolverImpl& operator=(const MojoHostResolverImpl&) = delete;
~MojoHostResolverImpl();
void Resolve(
const std::string& hostname,
const net::NetworkAnonymizationKey& network_anonymization_key,
bool is_ex,
mojo::PendingRemote<proxy_resolver::mojom::HostResolverRequestClient>
client);
bool request_in_progress() { return !pending_jobs_.empty(); }
private:
class Job;
void DeleteJob(std::list<Job>::iterator job);
raw_ptr<net::HostResolver> resolver_;
const net::NetLogWithSource net_log_;
std::list<Job> pending_jobs_;
base::ThreadChecker thread_checker_;
};
}
#endif