#include "chrome/browser/devtools/device/cast_device_provider.h"
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include "base/functional/bind.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/task/single_thread_task_runner.h"
#include "chrome/browser/local_discovery/service_discovery_shared_client.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/host_port_pair.h"
#include "net/base/ip_address.h"
ServiceDescription;
ServiceDiscoveryDeviceLister;
ServiceDiscoverySharedClient;
namespace {
const int kCastInspectPort = …;
const char kCastServiceType[] = …;
const char kUnknownCastDevice[] = …;
ServiceTxtRecordMap;
std::unique_ptr<ServiceTxtRecordMap> ParseServiceTxtRecord(
const std::vector<std::string>& record) { … }
std::string GetServiceMapValue(const ServiceTxtRecordMap& record_map,
const std::string& key,
const char* default_value) { … }
AndroidDeviceManager::DeviceInfo ServiceDescriptionToDeviceInfo(
const ServiceDescription& service_description) { … }
}
class CastDeviceProvider::DeviceListerDelegate final
: public ServiceDiscoveryDeviceLister::Delegate { … };
CastDeviceProvider::CastDeviceProvider() { … }
CastDeviceProvider::~CastDeviceProvider() { … }
void CastDeviceProvider::QueryDevices(SerialsCallback callback) { … }
void CastDeviceProvider::QueryDeviceInfo(const std::string& serial,
DeviceInfoCallback callback) { … }
void CastDeviceProvider::OpenSocket(const std::string& serial,
const std::string& socket_name,
SocketCallback callback) { … }
void CastDeviceProvider::OnDeviceChanged(
const std::string& service_type,
bool added,
const ServiceDescription& service_description) { … }
void CastDeviceProvider::OnDeviceRemoved(const std::string& service_type,
const std::string& service_name) { … }
void CastDeviceProvider::OnDeviceCacheFlushed(const std::string& service_type) { … }
void CastDeviceProvider::OnPermissionRejected() { … }