#include "content/public/browser/media_session_service.h"
#include "base/no_destructor.h"
#include "base/threading/sequence_local_storage_slot.h"
#include "build/chromeos_buildflags.h"
#include "content/public/browser/browser_thread.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/media_session/media_session_service_impl.h"
#include "services/media_session/public/cpp/features.h"
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chromeos/lacros/lacros_service.h"
#include "services/media_session/public/cpp/media_session_service.h"
#endif
namespace content {
#if BUILDFLAG(IS_CHROMEOS_LACROS)
namespace {
class LacrosMediaSessionServiceImpl
: public media_session::MediaSessionService {
public:
LacrosMediaSessionServiceImpl() = default;
~LacrosMediaSessionServiceImpl() override = default;
LacrosMediaSessionServiceImpl(const LacrosMediaSessionServiceImpl&) = delete;
LacrosMediaSessionServiceImpl& operator=(
const LacrosMediaSessionServiceImpl&) = delete;
void BindAudioFocusManager(
mojo::PendingReceiver<media_session::mojom::AudioFocusManager> receiver)
override {
auto* lacros_service = chromeos::LacrosService::Get();
if (lacros_service &&
lacros_service
->IsSupported<media_session::mojom::AudioFocusManager>()) {
lacros_service->BindAudioFocusManager(std::move(receiver));
}
}
void BindAudioFocusManagerDebug(
mojo::PendingReceiver<media_session::mojom::AudioFocusManagerDebug>
receiver) override {
auto* lacros_service = chromeos::LacrosService::Get();
if (lacros_service &&
lacros_service
->IsSupported<media_session::mojom::AudioFocusManagerDebug>()) {
lacros_service->BindAudioFocusManagerDebug(std::move(receiver));
}
}
void BindMediaControllerManager(
mojo::PendingReceiver<media_session::mojom::MediaControllerManager>
receiver) override {
auto* lacros_service = chromeos::LacrosService::Get();
if (lacros_service &&
lacros_service
->IsSupported<media_session::mojom::MediaControllerManager>()) {
lacros_service->BindMediaControllerManager(std::move(receiver));
}
}
};
}
#endif
media_session::MediaSessionService& GetMediaSessionService() { … }
}