#include "third_party/blink/renderer/modules/encryptedmedia/media_keys.h"
#include <memory>
#include "base/memory/scoped_refptr.h"
#include "media/base/content_decryption_module.h"
#include "media/base/key_systems.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/public/platform/web_content_decryption_module.h"
#include "third_party/blink/public/platform/web_encrypted_media_key_information.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_media_keys_policy.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/html/media/html_media_element.h"
#include "third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h"
#include "third_party/blink/renderer/modules/encryptedmedia/content_decryption_module_result_promise.h"
#include "third_party/blink/renderer/modules/encryptedmedia/encrypted_media_utils.h"
#include "third_party/blink/renderer/modules/encryptedmedia/media_key_session.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/bindings/v8_throw_exception.h"
#include "third_party/blink/renderer/platform/instrumentation/instance_counters.h"
#include "third_party/blink/renderer/platform/timer.h"
#include "third_party/blink/renderer/platform/wtf/casting.h"
#define MEDIA_KEYS_LOG_LEVEL …
namespace blink {
class MediaKeys::PendingAction final
: public GarbageCollected<MediaKeys::PendingAction> { … };
class SetCertificateResultPromise
: public ContentDecryptionModuleResultPromise { … };
class GetStatusForPolicyResultPromise
: public ContentDecryptionModuleResultPromise { … };
MediaKeys::MediaKeys(
ExecutionContext* context,
const WebVector<WebEncryptedMediaSessionType>& supported_session_types,
std::unique_ptr<WebContentDecryptionModule> cdm,
const MediaKeysConfig& config)
: … { … }
MediaKeys::~MediaKeys() { … }
MediaKeySession* MediaKeys::createSession(ScriptState* script_state,
const String& session_type_string,
ExceptionState& exception_state) { … }
ScriptPromise<IDLBoolean> MediaKeys::setServerCertificate(
ScriptState* script_state,
const DOMArrayPiece& server_certificate,
ExceptionState& exception_state) { … }
void MediaKeys::SetServerCertificateTask(
DOMArrayBuffer* server_certificate,
ContentDecryptionModuleResult* result) { … }
ScriptPromise<V8MediaKeyStatus> MediaKeys::getStatusForPolicy(
ScriptState* script_state,
const MediaKeysPolicy* media_keys_policy,
ExceptionState& exception_state) { … }
void MediaKeys::GetStatusForPolicyTask(const String& min_hdcp_version,
ContentDecryptionModuleResult* result) { … }
bool MediaKeys::ReserveForMediaElement(HTMLMediaElement* media_element) { … }
void MediaKeys::AcceptReservation() { … }
void MediaKeys::CancelReservation() { … }
void MediaKeys::ClearMediaElement() { … }
bool MediaKeys::SessionTypeSupported(
WebEncryptedMediaSessionType session_type) { … }
void MediaKeys::TimerFired(TimerBase*) { … }
WebContentDecryptionModule* MediaKeys::ContentDecryptionModule() { … }
void MediaKeys::Trace(Visitor* visitor) const { … }
void MediaKeys::ContextDestroyed() { … }
bool MediaKeys::HasPendingActivity() const { … }
}