#include "chrome/browser/media/router/discovery/dial/dial_media_sink_service_impl.h"
#include <algorithm>
#include <memory>
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/task/sequenced_task_runner.h"
#include "chrome/browser/media/router/discovery/dial/dial_device_data.h"
#include "chrome/browser/media/router/media_router_feature.h"
#include "components/media_router/common/mojom/media_router.mojom.h"
namespace media_router {
SinkAppStatus;
namespace {
constexpr char kLoggerComponent[] = …;
static constexpr const char* kDiscoveryOnlyModelNames[3] = …;
std::string EnumToString(DialRegistry::DialErrorCode code) { … }
bool IsDiscoveryOnly(const std::string& model_name) { … }
SinkAppStatus GetSinkAppStatusFromResponse(const DialAppInfoResult& result) { … }
}
DialMediaSinkServiceImpl::DialMediaSinkServiceImpl(
const OnSinksDiscoveredCallback& on_sinks_discovered_cb,
const scoped_refptr<base::SequencedTaskRunner>& task_runner)
: … { … }
DialMediaSinkServiceImpl::~DialMediaSinkServiceImpl() { … }
void DialMediaSinkServiceImpl::Initialize() { … }
void DialMediaSinkServiceImpl::StartDiscovery() { … }
void DialMediaSinkServiceImpl::DiscoverSinksNow() { … }
DialAppDiscoveryService* DialMediaSinkServiceImpl::app_discovery_service() { … }
base::CallbackListSubscription
DialMediaSinkServiceImpl::StartMonitoringAvailableSinksForApp(
const std::string& app_name,
const SinkQueryByAppCallback& callback) { … }
void DialMediaSinkServiceImpl::SetDescriptionServiceForTest(
std::unique_ptr<DeviceDescriptionService> description_service) { … }
void DialMediaSinkServiceImpl::SetAppDiscoveryServiceForTest(
std::unique_ptr<DialAppDiscoveryService> app_discovery_service) { … }
void DialMediaSinkServiceImpl::OnDiscoveryComplete() { … }
void DialMediaSinkServiceImpl::OnDialDeviceList(
const DialRegistry::DeviceList& devices) { … }
void DialMediaSinkServiceImpl::OnDialError(DialRegistry::DialErrorCode type) { … }
void DialMediaSinkServiceImpl::OnDeviceDescriptionAvailable(
const DialDeviceData& device_data,
const ParsedDialDeviceDescription& description_data) { … }
void DialMediaSinkServiceImpl::OnDeviceDescriptionError(
const DialDeviceData& device,
const std::string& error_message) { … }
void DialMediaSinkServiceImpl::OnAppInfoParseCompleted(
const std::string& sink_id,
const std::string& app_name,
DialAppInfoResult result) { … }
void DialMediaSinkServiceImpl::FetchAppInfoForSink(
const MediaSinkInternal& dial_sink,
const std::string& app_name) { … }
void DialMediaSinkServiceImpl::RescanAppInfo() { … }
SinkAppStatus DialMediaSinkServiceImpl::GetAppStatus(
const std::string& sink_id,
const std::string& app_name) const { … }
void DialMediaSinkServiceImpl::SetAppStatus(const std::string& sink_id,
const std::string& app_name,
SinkAppStatus app_status) { … }
void DialMediaSinkServiceImpl::RecordDeviceCounts() { … }
void DialMediaSinkServiceImpl::MaybeRemoveSinkQueryCallbackList(
const std::string& app_name,
SinkQueryByAppCallbackList* callback_list) { … }
std::vector<MediaSinkInternal> DialMediaSinkServiceImpl::GetAvailableSinks(
const std::string& app_name) const { … }
}