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

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

#include "third_party/blink/public/platform/media/key_system_config_selector.h"

#include <stddef.h>

#include <utility>

#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/base/cdm_config.h"
#include "media/base/eme_constants.h"
#include "media/base/key_system_names.h"
#include "media/base/key_systems.h"
#include "media/base/logging_override_if_enabled.h"
#include "media/base/media_permission.h"
#include "media/base/media_switches.h"
#include "media/base/mime_util.h"
#include "media/base/video_codec_string_parsers.h"
#include "media/media_buildflags.h"
#include "third_party/blink/public/platform/web_content_settings_client.h"
#include "third_party/blink/public/platform/web_media_key_system_configuration.h"
#include "third_party/blink/public/platform/web_string.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/public/web/web_local_frame.h"

namespace blink {
namespace {

EmeConfig;
EmeConfigRuleState;
EmeFeatureSupport;
EmeMediaType;
EncryptionScheme;
EmeFeatureRequirement;
EmeEncryptionScheme;

EmeConfig::Rule GetDistinctiveIdentifierConfigRule(
    EmeFeatureSupport support,
    EmeFeatureRequirement requirement) {}

EmeConfig::Rule GetPersistentStateConfigRule(
    EmeFeatureSupport support,
    EmeFeatureRequirement requirement) {}

bool IsPersistentSessionType(WebEncryptedMediaSessionType sessionType) {}

bool IsSupportedMediaType(const std::string& container_mime_type,
                          const std::string& codecs,
                          bool use_aes_decryptor) {}

}  // namespace

bool KeySystemConfigSelector::WebLocalFrameDelegate::
    IsCrossOriginToOutermostMainFrame() {}

bool KeySystemConfigSelector::WebLocalFrameDelegate::AllowStorageAccessSync(
    WebContentSettingsClient::StorageType storage_type) {}

struct KeySystemConfigSelector::SelectionRequest {};

// Accumulates configuration rules to determine if a feature (additional
// configuration rule) can be added to an accumulated configuration.
class KeySystemConfigSelector::ConfigState {};

KeySystemConfigSelector::KeySystemConfigSelector(
    media::KeySystems* key_systems,
    media::MediaPermission* media_permission,
    std::unique_ptr<WebLocalFrameDelegate> web_frame_delegate)
    :{}

KeySystemConfigSelector::~KeySystemConfigSelector() = default;

// TODO(sandersd): Move contentType parsing from Blink to here so that invalid
// parameters can be rejected. http://crbug.com/449690, http://crbug.com/690131
bool KeySystemConfigSelector::IsSupportedContentType(
    const std::string& key_system,
    EmeMediaType media_type,
    const std::string& container_mime_type,
    const std::string& codecs,
    KeySystemConfigSelector::ConfigState* config_state) {}

EmeConfig::Rule KeySystemConfigSelector::GetEncryptionSchemeConfigRule(
    const std::string& key_system,
    const EmeEncryptionScheme encryption_scheme) {}

bool KeySystemConfigSelector::GetSupportedCapabilities(
    const std::string& key_system,
    EmeMediaType media_type,
    const WebVector<WebMediaKeySystemMediaCapability>&
        requested_media_capabilities,
    // Corresponds to the partial configuration, plus restrictions.
    KeySystemConfigSelector::ConfigState* config_state,
    std::vector<WebMediaKeySystemMediaCapability>*
        supported_media_capabilities) {}

KeySystemConfigSelector::ConfigurationSupport
KeySystemConfigSelector::GetSupportedConfiguration(
    const std::string& key_system,
    const WebMediaKeySystemConfiguration& candidate,
    ConfigState* config_state,
    WebMediaKeySystemConfiguration* accumulated_configuration) {}

void KeySystemConfigSelector::SelectConfig(
    const WebString& key_system,
    const WebVector<WebMediaKeySystemConfiguration>& candidate_configurations,
    SelectConfigCB cb) {}

void KeySystemConfigSelector::SelectConfigInternal(
    std::unique_ptr<SelectionRequest> request) {}

void KeySystemConfigSelector::OnPermissionResult(
    std::unique_ptr<SelectionRequest> request,
    bool is_permission_granted) {}

#if BUILDFLAG(IS_WIN)
void KeySystemConfigSelector::OnHardwareSecureDecryptionAllowedResult(
    std::unique_ptr<SelectionRequest> request,
    bool is_hardware_secure_decryption_allowed) {
  DVLOG(3) << __func__;

  request->was_hardware_secure_decryption_preferences_requested = true;
  request->is_hardware_secure_decryption_allowed =
      is_hardware_secure_decryption_allowed;
  SelectConfigInternal(std::move(request));
}
#endif  // BUILDFLAG(IS_WIN)

}  // namespace blink