#include "chrome/browser/media/router/discovery/dial/dial_app_discovery_service.h"
#include <vector>
#include "base/functional/bind.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/time/default_clock.h"
#include "chrome/browser/media/router/data_decoder_util.h"
#include "net/http/http_status_code.h"
#include "url/gurl.h"
namespace media_router {
namespace {
const char kLoggerComponent[] = …;
GURL GetAppUrl(const media_router::MediaSinkInternal& sink,
const std::string& app_name) { … }
void RecordDialFetchAppInfo(DialAppInfoResultCode result_code) { … }
}
DialAppInfoResult::DialAppInfoResult(
std::unique_ptr<ParsedDialAppInfo> app_info,
DialAppInfoResultCode result_code,
const std::string& error_message,
std::optional<int> http_error_code)
: … { … }
DialAppInfoResult::DialAppInfoResult(DialAppInfoResult&& other) = default;
DialAppInfoResult::~DialAppInfoResult() = default;
DialAppDiscoveryService::DialAppDiscoveryService()
: … { … }
DialAppDiscoveryService::~DialAppDiscoveryService() { … }
void DialAppDiscoveryService::FetchDialAppInfo(
const MediaSinkInternal& sink,
const std::string& app_name,
DialAppInfoCallback app_info_cb) { … }
void DialAppDiscoveryService::SetParserForTest(
std::unique_ptr<SafeDialAppInfoParser> parser) { … }
void DialAppDiscoveryService::RemovePendingRequest(
DialAppDiscoveryService::PendingRequest* request) { … }
DialAppDiscoveryService::PendingRequest::PendingRequest(
const MediaSinkInternal& sink,
const std::string& app_name,
DialAppInfoCallback app_info_cb,
DialAppDiscoveryService* const service)
: … { … }
DialAppDiscoveryService::PendingRequest::~PendingRequest() { … }
void DialAppDiscoveryService::PendingRequest::Start() { … }
void DialAppDiscoveryService::PendingRequest::OnDialAppInfoFetchComplete(
const std::string& app_info_xml) { … }
void DialAppDiscoveryService::PendingRequest::OnDialAppInfoFetchError(
const std::string& error_message,
std::optional<int> http_response_code) { … }
void DialAppDiscoveryService::PendingRequest::OnDialAppInfoParsed(
std::unique_ptr<ParsedDialAppInfo> parsed_app_info,
SafeDialAppInfoParser::ParsingResult parsing_result) { … }
}