#include "chrome/browser/ui/global_media_controls/cast_media_notification_item.h"
#include "base/i18n/rtl.h"
#include "base/location.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "chrome/browser/feature_engagement/tracker_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/global_media_controls/cast_media_session_controller.h"
#include "chrome/browser/ui/global_media_controls/media_item_ui_metrics.h"
#include "chrome/browser/ui/media_router/media_cast_mode.h"
#include "components/feature_engagement/public/tracker.h"
#include "components/global_media_controls/public/media_item_manager.h"
#include "components/media_message_center/media_notification_view.h"
#include "components/media_message_center/media_notification_view_impl.h"
#include "components/media_router/browser/media_router.h"
#include "components/media_router/browser/media_router_factory.h"
#include "components/strings/grit/components_strings.h"
#include "components/vector_icons/vector_icons.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/storage_partition.h"
#include "media/base/media_switches.h"
#include "net/base/load_flags.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "net/url_request/referrer_policy.h"
#include "services/media_session/public/cpp/util.h"
#include "services/media_session/public/mojom/media_session.mojom.h"
#include "ui/base/l10n/l10n_util.h"
Metadata;
namespace {
net::NetworkTrafficAnnotationTag GetTrafficAnnotationTag() { … }
media_session::mojom::MediaSessionInfoPtr CreateSessionInfo() { … }
std::vector<media_session::mojom::MediaSessionAction> ToMediaSessionActions(
const media_router::mojom::MediaStatus& status) { … }
media_session::mojom::MediaPlaybackState ToPlaybackState(
media_router::mojom::MediaStatus::PlayState play_state) { … }
media_session::mojom::MediaSessionInfo::SessionState ToSessionState(
media_router::mojom::MediaStatus::PlayState play_state) { … }
std::u16string GetSourceTitle(const media_router::MediaRoute& route) { … }
}
CastMediaNotificationItem::CastMediaNotificationItem(
const media_router::MediaRoute& route,
global_media_controls::MediaItemManager* item_manager,
std::unique_ptr<CastMediaSessionController> session_controller,
Profile* profile)
: … { … }
CastMediaNotificationItem::~CastMediaNotificationItem() { … }
void CastMediaNotificationItem::SetView(
media_message_center::MediaNotificationView* view) { … }
void CastMediaNotificationItem::OnMediaSessionActionButtonPressed(
media_session::mojom::MediaSessionAction action) { … }
void CastMediaNotificationItem::SeekTo(base::TimeDelta time) { … }
void CastMediaNotificationItem::Dismiss() { … }
void CastMediaNotificationItem::SetVolume(float volume) { … }
void CastMediaNotificationItem::SetMute(bool mute) { … }
bool CastMediaNotificationItem::RequestMediaRemoting() { … }
media_message_center::Source CastMediaNotificationItem::GetSource() const { … }
media_message_center::SourceType CastMediaNotificationItem::GetSourceType()
const { … }
std::optional<base::UnguessableToken> CastMediaNotificationItem::GetSourceId()
const { … }
void CastMediaNotificationItem::OnMediaStatusUpdated(
media_router::mojom::MediaStatusPtr status) { … }
void CastMediaNotificationItem::OnRouteUpdated(
const media_router::MediaRoute& route) { … }
void CastMediaNotificationItem::StopCasting() { … }
mojo::PendingRemote<media_router::mojom::MediaStatusObserver>
CastMediaNotificationItem::GetObserverPendingRemote() { … }
CastMediaNotificationItem::ImageDownloader::ImageDownloader(
Profile* profile,
base::RepeatingCallback<void(const SkBitmap&)> callback)
: … { … }
CastMediaNotificationItem::ImageDownloader::~ImageDownloader() = default;
void CastMediaNotificationItem::ImageDownloader::OnFetchComplete(
const GURL& url,
const SkBitmap* bitmap) { … }
void CastMediaNotificationItem::ImageDownloader::Download(const GURL& url) { … }
void CastMediaNotificationItem::ImageDownloader::Reset() { … }
void CastMediaNotificationItem::UpdateView() { … }
void CastMediaNotificationItem::ImageChanged(const SkBitmap& bitmap) { … }