#include "components/global_media_controls/public/media_session_item_producer.h"
#include "base/containers/contains.h"
#include "base/metrics/histogram_functions.h"
#include "base/not_fatal_until.h"
#include "base/observer_list.h"
#include "components/global_media_controls/public/media_item_manager.h"
#include "components/global_media_controls/public/media_item_ui.h"
#include "components/global_media_controls/public/media_session_item_producer_observer.h"
#include "media/base/media_switches.h"
namespace global_media_controls {
namespace {
constexpr int kAutoDismissTimerInMinutesDefault = …;
constexpr const char kAutoDismissTimerInMinutesParamName[] = …;
base::TimeDelta GetAutoDismissTimerValue() { … }
}
MediaSessionItemProducer::Session::Session(
MediaSessionItemProducer* owner,
const std::string& id,
std::unique_ptr<MediaSessionNotificationItem> item,
mojo::Remote<media_session::mojom::MediaController> controller)
: … { … }
MediaSessionItemProducer::Session::~Session() { … }
void MediaSessionItemProducer::Session::MediaSessionInfoChanged(
media_session::mojom::MediaSessionInfoPtr session_info) { … }
void MediaSessionItemProducer::Session::MediaSessionActionsChanged(
const std::vector<media_session::mojom::MediaSessionAction>& actions) { … }
void MediaSessionItemProducer::Session::MediaSessionPositionChanged(
const std::optional<media_session::MediaPosition>& position) { … }
void MediaSessionItemProducer::Session::OnRequestIdReleased() { … }
void MediaSessionItemProducer::Session::SetController(
mojo::Remote<media_session::mojom::MediaController> controller) { … }
void MediaSessionItemProducer::Session::set_dismiss_reason(
GlobalMediaControlsDismissReason reason) { … }
void MediaSessionItemProducer::Session::OnSessionInteractedWith() { … }
bool MediaSessionItemProducer::Session::IsPlaying() const { … }
void MediaSessionItemProducer::Session::SetAudioSinkId(const std::string& id) { … }
base::CallbackListSubscription MediaSessionItemProducer::Session::
RegisterIsAudioDeviceSwitchingSupportedCallback(
base::RepeatingCallback<void(bool)> callback) { … }
void MediaSessionItemProducer::Session::RecordDismissReason(
GlobalMediaControlsDismissReason reason) { … }
void MediaSessionItemProducer::Session::StartInactiveTimer() { … }
void MediaSessionItemProducer::Session::OnInactiveTimerFired() { … }
void MediaSessionItemProducer::Session::RecordInteractionDelayAfterPause() { … }
void MediaSessionItemProducer::Session::MarkActiveIfNecessary() { … }
MediaSessionItemProducer::MediaSessionItemProducer(
mojo::Remote<media_session::mojom::AudioFocusManager> audio_focus_remote,
mojo::Remote<media_session::mojom::MediaControllerManager>
controller_manager_remote,
MediaItemManager* item_manager,
std::optional<base::UnguessableToken> source_id)
: … { … }
MediaSessionItemProducer::~MediaSessionItemProducer() = default;
base::WeakPtr<media_message_center::MediaNotificationItem>
MediaSessionItemProducer::GetMediaItem(const std::string& id) { … }
std::set<std::string> MediaSessionItemProducer::GetActiveControllableItemIds()
const { … }
bool MediaSessionItemProducer::HasFrozenItems() { … }
void MediaSessionItemProducer::OnFocusGained(
media_session::mojom::AudioFocusRequestStatePtr session) { … }
void MediaSessionItemProducer::OnFocusLost(
media_session::mojom::AudioFocusRequestStatePtr session) { … }
void MediaSessionItemProducer::OnRequestIdReleased(
const base::UnguessableToken& request_id) { … }
void MediaSessionItemProducer::OnMediaItemUIClicked(
const std::string& id,
bool activate_original_media) { … }
void MediaSessionItemProducer::OnMediaItemUIDismissed(const std::string& id) { … }
void MediaSessionItemProducer::AddObserver(
MediaSessionItemProducerObserver* observer) { … }
void MediaSessionItemProducer::RemoveObserver(
MediaSessionItemProducerObserver* observer) { … }
void MediaSessionItemProducer::OnItemShown(const std::string& id,
MediaItemUI* item_ui) { … }
bool MediaSessionItemProducer::IsItemActivelyPlaying(const std::string& id) { … }
void MediaSessionItemProducer::ActivateItem(const std::string& id) { … }
void MediaSessionItemProducer::HideItem(const std::string& id) { … }
void MediaSessionItemProducer::RemoveItem(const std::string& id) { … }
void MediaSessionItemProducer::RefreshItem(const std::string& id) { … }
bool MediaSessionItemProducer::HasSession(const std::string& id) const { … }
void MediaSessionItemProducer::LogMediaSessionActionButtonPressed(
const std::string& id,
media_session::mojom::MediaSessionAction action) { … }
void MediaSessionItemProducer::SetAudioSinkId(const std::string& id,
const std::string& sink_id) { … }
media_session::mojom::RemotePlaybackMetadataPtr
MediaSessionItemProducer::GetRemotePlaybackMetadataFromItem(
const std::string& id) { … }
base::CallbackListSubscription
MediaSessionItemProducer::RegisterIsAudioOutputDeviceSwitchingSupportedCallback(
const std::string& id,
base::RepeatingCallback<void(bool)> callback) { … }
void MediaSessionItemProducer::UpdateMediaItemSourceOrigin(
const std::string& id,
const url::Origin& origin) { … }
MediaSessionItemProducer::Session* MediaSessionItemProducer::GetSession(
const std::string& id) { … }
void MediaSessionItemProducer::OnSessionBecameActive(const std::string& id) { … }
void MediaSessionItemProducer::OnSessionBecameInactive(const std::string& id) { … }
void MediaSessionItemProducer::OnReceivedAudioFocusRequests(
std::vector<media_session::mojom::AudioFocusRequestStatePtr> sessions) { … }
void MediaSessionItemProducer::OnItemUnfrozen(const std::string& id) { … }
}