#include "media/mojo/services/mojo_cdm_service_context.h"
#include "base/logging.h"
#include "media/base/callback_registry.h"
#include "media/base/cdm_context.h"
#include "media/base/content_decryption_module.h"
#include "media/cdm/cdm_context_ref_impl.h"
#include "media/mojo/services/mojo_cdm_service.h"
namespace media {
namespace {
base::UnguessableToken GetNextCdmId() { … }
}
MojoCdmServiceContext::MojoCdmServiceContext() = default;
MojoCdmServiceContext::~MojoCdmServiceContext() = default;
base::UnguessableToken MojoCdmServiceContext::RegisterCdm(
MojoCdmService* cdm_service) { … }
void MojoCdmServiceContext::UnregisterCdm(
const base::UnguessableToken& cdm_id) { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
base::UnguessableToken MojoCdmServiceContext::RegisterRemoteCdmContext(
chromeos::RemoteCdmContext* remote_context) {
DCHECK(remote_context);
base::UnguessableToken cdm_id = GetNextCdmId();
remote_cdm_contexts_[cdm_id] = remote_context;
DVLOG(1) << __func__ << ": RemoteCdmContext registered with CDM ID "
<< cdm_id;
return cdm_id;
}
void MojoCdmServiceContext::UnregisterRemoteCdmContext(
const base::UnguessableToken& cdm_id) {
DVLOG(1) << __func__ << ": cdm_id = " << cdm_id;
DCHECK(remote_cdm_contexts_.count(cdm_id));
remote_cdm_contexts_.erase(cdm_id);
}
#endif
std::unique_ptr<CdmContextRef> MojoCdmServiceContext::GetCdmContextRef(
const base::UnguessableToken& cdm_id) { … }
}