#include "chrome/browser/media/router/providers/cast/app_activity.h"
#include <memory>
#include <optional>
#include <vector>
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/ranges/algorithm.h"
#include "chrome/browser/media/router/providers/cast/cast_activity_manager.h"
#include "chrome/browser/media/router/providers/cast/cast_session_client.h"
#include "components/media_router/common/providers/cast/channel/cast_message_handler.h"
#include "components/media_router/common/providers/cast/channel/cast_message_util.h"
#include "components/media_router/common/providers/cast/channel/enum_table.h"
#include "url/origin.h"
PresentationConnectionCloseReason;
PresentationConnectionMessagePtr;
namespace media_router {
namespace {
bool IsMediaStatusMessage(const cast_channel::InternalMessage& message) { … }
}
AppActivity::AppActivity(const MediaRoute& route,
const std::string& app_id,
cast_channel::CastMessageHandler* message_handler,
CastSessionTracker* session_tracker)
: … { … }
AppActivity::~AppActivity() = default;
void AppActivity::OnSessionSet(const CastSession& session) { … }
void AppActivity::OnSessionUpdated(const CastSession& session,
const std::string& hash_token) { … }
cast_channel::Result AppActivity::SendAppMessageToReceiver(
const CastInternalMessage& cast_message) { … }
std::optional<int> AppActivity::SendMediaRequestToReceiver(
const CastInternalMessage& cast_message) { … }
void AppActivity::SendSetVolumeRequestToReceiver(
const CastInternalMessage& cast_message,
cast_channel::ResultCallback callback) { … }
void AppActivity::SendMediaStatusToClients(
const base::Value::Dict& media_status,
std::optional<int> request_id) { … }
void AppActivity::BindMediaController(
mojo::PendingReceiver<mojom::MediaController> media_controller,
mojo::PendingRemote<mojom::MediaStatusObserver> observer) { … }
void AppActivity::OnAppMessage(
const openscreen::cast::proto::CastMessage& message) { … }
void AppActivity::OnInternalMessage(
const cast_channel::InternalMessage& message) { … }
bool AppActivity::CanJoinSession(const CastMediaSource& cast_source) const { … }
bool AppActivity::HasJoinableClient(AutoJoinPolicy policy,
const url::Origin& origin,
int frame_tree_node_id) const { … }
}