chromium/third_party/blink/renderer/platform/media/web_content_decryption_module_session_impl.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "third_party/blink/renderer/platform/media/web_content_decryption_module_session_impl.h"

#include <memory>

#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/metrics/histogram_functions.h"
#include "base/notreached.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "media/base/cdm_key_information.h"
#include "media/base/cdm_promise.h"
#include "media/base/content_decryption_module.h"
#include "media/base/key_system_names.h"
#include "media/base/key_systems.h"
#include "media/base/limits.h"
#include "media/cdm/cenc_utils.h"
#include "media/cdm/json_web_key.h"
#include "third_party/blink/public/platform/web_data.h"
#include "third_party/blink/public/platform/web_encrypted_media_key_information.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/platform/web_url.h"
#include "third_party/blink/public/platform/web_vector.h"
#include "third_party/blink/public/web/modules/media/web_media_player_util.h"
#include "third_party/blink/renderer/platform/media/cdm_result_promise.h"
#include "third_party/blink/renderer/platform/media/cdm_result_promise_helper.h"
#include "third_party/blink/renderer/platform/media/cdm_session_adapter.h"

namespace blink {

namespace {

const char kCloseSessionUMAName[] =;
const char kGenerateRequestUMAName[] =;
const char kLoadSessionUMAName[] =;
const char kRemoveSessionUMAName[] =;
const char kUpdateSessionUMAName[] =;
const char kKeyStatusSystemCodeUMAName[] =;
const char kInitialKeyStatusMixUMAName[] =;

media::CdmSessionType ConvertSessionType(
    WebEncryptedMediaSessionType session_type) {}

bool SanitizeInitData(media::EmeInitDataType init_data_type,
                      const unsigned char* init_data,
                      size_t init_data_length,
                      std::vector<uint8_t>* sanitized_init_data,
                      std::string* error_message) {}

bool SanitizeSessionId(const WebString& session_id,
                       std::string* sanitized_session_id) {}

bool SanitizeResponse(const std::string& key_system,
                      const uint8_t* response,
                      size_t response_length,
                      std::vector<uint8_t>* sanitized_response) {}

// Reported to UMA. Do NOT change or reuse existing values.
enum class KeyStatusMixForUma {};

KeyStatusMixForUma GetKeyStatusMixForUma(const media::CdmKeysInfo& keys_info) {}

}  // namespace

WebContentDecryptionModuleSessionImpl::WebContentDecryptionModuleSessionImpl(
    const scoped_refptr<CdmSessionAdapter>& adapter,
    WebEncryptedMediaSessionType session_type,
    media::KeySystems* key_systems)
    :{}

WebContentDecryptionModuleSessionImpl::
    ~WebContentDecryptionModuleSessionImpl() {}

void WebContentDecryptionModuleSessionImpl::SetClientInterface(Client* client) {}

WebString WebContentDecryptionModuleSessionImpl::SessionId() const {}

void WebContentDecryptionModuleSessionImpl::InitializeNewSession(
    media::EmeInitDataType eme_init_data_type,
    const unsigned char* init_data,
    size_t init_data_length,
    WebContentDecryptionModuleResult result) {}

void WebContentDecryptionModuleSessionImpl::Load(
    const WebString& session_id,
    WebContentDecryptionModuleResult result) {}

void WebContentDecryptionModuleSessionImpl::Update(
    const uint8_t* response,
    size_t response_length,
    WebContentDecryptionModuleResult result) {}

void WebContentDecryptionModuleSessionImpl::Close(
    WebContentDecryptionModuleResult result) {}

void WebContentDecryptionModuleSessionImpl::Remove(
    WebContentDecryptionModuleResult result) {}

void WebContentDecryptionModuleSessionImpl::OnSessionMessage(
    media::CdmMessageType message_type,
    const std::vector<uint8_t>& message) {}

void WebContentDecryptionModuleSessionImpl::OnSessionKeysChange(
    bool has_additional_usable_key,
    media::CdmKeysInfo keys_info) {}

void WebContentDecryptionModuleSessionImpl::OnSessionExpirationUpdate(
    base::Time new_expiry_time) {}

void WebContentDecryptionModuleSessionImpl::OnSessionClosed(
    media::CdmSessionClosedReason reason) {}

void WebContentDecryptionModuleSessionImpl::OnSessionInitialized(
    const std::string& session_id,
    SessionInitStatus* status) {}

}  // namespace blink