#include "chrome/browser/media/router/providers/cast/cast_activity.h"
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/logging.h"
#include "chrome/browser/media/router/media_router_feature.h"
#include "chrome/browser/media/router/providers/cast/cast_internal_message_util.h"
#include "chrome/browser/media/router/providers/cast/cast_session_client_impl.h"
#include "components/media_router/common/discovery/media_sink_internal.h"
#include "third_party/blink/public/mojom/presentation/presentation.mojom.h"
namespace media_router {
CastActivity::CastActivity(const MediaRoute& route,
const std::string& app_id,
cast_channel::CastMessageHandler* message_handler,
CastSessionTracker* session_tracker)
: … { … }
CastActivity::~CastActivity() = default;
void CastActivity::SetRouteIsConnecting(bool is_connecting) { … }
mojom::RoutePresentationConnectionPtr CastActivity::AddClient(
const CastMediaSource& source,
const url::Origin& origin,
int frame_tree_node_id) { … }
void CastActivity::RemoveClient(const std::string& client_id) { … }
CastSession* CastActivity::GetSession() const { … }
void CastActivity::SetOrUpdateSession(const CastSession& session,
const MediaSinkInternal& sink,
const std::string& hash_token) { … }
void CastActivity::SendStopSessionMessageToClients(
const std::string& hash_token) { … }
void CastActivity::SendMessageToClient(
const std::string& client_id,
blink::mojom::PresentationConnectionMessagePtr message) { … }
void CastActivity::SendMediaStatusToClients(
const base::Value::Dict& media_status,
std::optional<int> request_id) { … }
void CastActivity::ClosePresentationConnections(
blink::mojom::PresentationConnectionCloseReason close_reason) { … }
void CastActivity::TerminatePresentationConnections() { … }
std::optional<int> CastActivity::SendMediaRequestToReceiver(
const CastInternalMessage& cast_message) { … }
cast_channel::Result CastActivity::SendAppMessageToReceiver(
const CastInternalMessage& cast_message) { … }
void CastActivity::SendSetVolumeRequestToReceiver(
const CastInternalMessage& cast_message,
cast_channel::ResultCallback callback) { … }
void CastActivity::StopSessionOnReceiver(
const std::string& client_id,
cast_channel::ResultCallback callback) { … }
void CastActivity::CloseConnectionOnReceiver(
const std::string& client_id,
blink::mojom::PresentationConnectionCloseReason reason) { … }
void CastActivity::HandleLeaveSession(const std::string& client_id) { … }
void CastActivity::OnSessionUpdated(const CastSession& session,
const std::string& hash_token) { … }
std::string CastActivity::GetRouteDescription(
const CastSession& session) const { … }
CastSessionClientFactoryForTest* CastActivity::client_factory_for_test_ = …;
}