#include "chrome/browser/local_discovery/service_discovery_client_mdns.h"
#include <stddef.h>
#include <utility>
#include <vector>
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/observer_list.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/thread_pool.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/local_discovery/service_discovery_client_impl.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/network_service_instance.h"
#include "net/base/net_errors.h"
#include "net/socket/datagram_server_socket.h"
namespace net {
class IPAddress;
}
namespace local_discovery {
BrowserThread;
class ServiceDiscoveryClientMdns::Proxy { … };
namespace {
const int kMaxRestartAttempts = …;
const int kRestartDelayOnNetworkChangeSeconds = …;
MdnsInitCallback;
class SocketFactory : public net::MDnsSocketFactory { … };
void InitMdns(MdnsInitCallback on_initialized,
const net::InterfaceIndexFamilyList& interfaces,
net::MDnsClient* mdns) { … }
template<class T>
class ProxyBase : public ServiceDiscoveryClientMdns::Proxy, public T { … };
class ServiceWatcherProxy : public ProxyBase<ServiceWatcher> { … };
class ServiceResolverProxy : public ProxyBase<ServiceResolver> { … };
class LocalDomainResolverProxy : public ProxyBase<LocalDomainResolver> { … };
}
ServiceDiscoveryClientMdns::ServiceDiscoveryClientMdns()
: … { … }
std::unique_ptr<ServiceWatcher>
ServiceDiscoveryClientMdns::CreateServiceWatcher(
const std::string& service_type,
ServiceWatcher::UpdatedCallback callback) { … }
std::unique_ptr<ServiceResolver>
ServiceDiscoveryClientMdns::CreateServiceResolver(
const std::string& service_name,
ServiceResolver::ResolveCompleteCallback callback) { … }
std::unique_ptr<LocalDomainResolver>
ServiceDiscoveryClientMdns::CreateLocalDomainResolver(
const std::string& domain,
net::AddressFamily address_family,
LocalDomainResolver::IPAddressCallback callback) { … }
ServiceDiscoveryClientMdns::~ServiceDiscoveryClientMdns() { … }
void ServiceDiscoveryClientMdns::OnConnectionChanged(
network::mojom::ConnectionType type) { … }
void ServiceDiscoveryClientMdns::ScheduleStartNewClient() { … }
void ServiceDiscoveryClientMdns::StartNewClient() { … }
void ServiceDiscoveryClientMdns::OnInterfaceListReady(
const net::InterfaceIndexFamilyList& interfaces) { … }
void ServiceDiscoveryClientMdns::OnMdnsInitialized(int net_error) { … }
void ServiceDiscoveryClientMdns::OnBeforeMdnsDestroy() { … }
void ServiceDiscoveryClientMdns::DestroyMdns() { … }
}