diff options
-rw-r--r-- | chrome/browser/media/encrypted_media_browsertest.cc | 12 | ||||
-rw-r--r-- | components/cdm/renderer/widevine_key_systems.cc | 9 | ||||
-rw-r--r-- | media/base/key_system_info.h | 11 | ||||
-rw-r--r-- | media/base/key_systems.cc | 19 | ||||
-rw-r--r-- | media/base/key_systems_unittest.cc | 40 | ||||
-rw-r--r-- | media/cdm/key_system_names.cc | 8 | ||||
-rw-r--r-- | media/cdm/key_system_names.h | 6 |
7 files changed, 15 insertions, 90 deletions
diff --git a/chrome/browser/media/encrypted_media_browsertest.cc b/chrome/browser/media/encrypted_media_browsertest.cc index 21d2bb4..496758f 100644 --- a/chrome/browser/media/encrypted_media_browsertest.cc +++ b/chrome/browser/media/encrypted_media_browsertest.cc @@ -105,20 +105,16 @@ static bool IsMSESupported() { return true; } -static bool IsParentKeySystemOf(const std::string& parent_key_system, - const std::string& key_system) { - std::string prefix = parent_key_system + '.'; - return key_system.substr(0, prefix.size()) == prefix; -} - // Base class for encrypted media tests. class EncryptedMediaTestBase : public MediaBrowserTest { public: EncryptedMediaTestBase() : is_pepper_cdm_registered_(false) {} bool IsExternalClearKey(const std::string& key_system) { - return key_system == kExternalClearKeyKeySystem || - IsParentKeySystemOf(kExternalClearKeyKeySystem, key_system); + if (key_system == kExternalClearKeyKeySystem) + return true; + std::string prefix = std::string(kExternalClearKeyKeySystem) + '.'; + return key_system.substr(0, prefix.size()) == prefix; } #if defined(WIDEVINE_CDM_AVAILABLE) diff --git a/components/cdm/renderer/widevine_key_systems.cc b/components/cdm/renderer/widevine_key_systems.cc index 4931bd7..821dd06 100644 --- a/components/cdm/renderer/widevine_key_systems.cc +++ b/components/cdm/renderer/widevine_key_systems.cc @@ -22,13 +22,6 @@ using media::SupportedCodecs; namespace cdm { -// Return |name|'s parent key system. -static std::string GetDirectParentName(const std::string& name) { - size_t last_period = name.find_last_of('.'); - DCHECK_GT(last_period, 0u); - return name.substr(0u, last_period); -} - void AddWidevineWithCodecs( WidevineCdmType widevine_cdm_type, SupportedCodecs supported_codecs, @@ -47,8 +40,6 @@ void AddWidevineWithCodecs( switch (widevine_cdm_type) { case WIDEVINE: - // For standard Widevine, add parent name. - info.parent_key_system = GetDirectParentName(kWidevineKeySystem); break; #if defined(OS_ANDROID) case WIDEVINE_HR_NON_COMPOSITING: diff --git a/media/base/key_system_info.h b/media/base/key_system_info.h index 0fb5209..0a9ba67 100644 --- a/media/base/key_system_info.h +++ b/media/base/key_system_info.h @@ -21,12 +21,6 @@ // * Abstract key system // A key system string that cannot be instantiated like a concrete key system // but is otherwise useful, such as in discovery using isTypeSupported(). -// TODO(ddorwin): Remove the concept of a parent key system now that prefixed -// has been removed. https://crbug.com/249976 -// * Parent key system -// A key system string that is one level up from the child key system. It may -// be an abstract key system. -// As an example, "com.example" is the parent of "com.example.foo". namespace media { @@ -52,11 +46,6 @@ struct MEDIA_EXPORT KeySystemInfo { EmeFeatureSupport persistent_state_support = EmeFeatureSupport::INVALID; EmeFeatureSupport distinctive_identifier_support = EmeFeatureSupport::INVALID; - // A hierarchical parent for |key_system|. This value can be used to check - // supported types but cannot be used to instantiate a MediaKeys object. - // Only one parent key system is currently supported per concrete key system. - std::string parent_key_system; - // The following indicate how the corresponding CDM should be instantiated. bool use_aes_decryptor = false; #if defined(ENABLE_PEPPER_CDMS) diff --git a/media/base/key_systems.cc b/media/base/key_systems.cc index 8738fa0..3b131ef 100644 --- a/media/base/key_systems.cc +++ b/media/base/key_systems.cc @@ -153,7 +153,7 @@ static bool IsPotentiallySupportedKeySystem(const std::string& key_system) { // Chromecast defines behaviors for Cast clients within its reverse domain. const char kChromecastRoot[] = "com.chromecast"; - if (IsParentKeySystemOf(kChromecastRoot, key_system)) + if (IsChildKeySystemOf(key_system, kChromecastRoot)) return true; // Implementations that do not have a specification or appropriate glue code @@ -235,7 +235,6 @@ class KeySystemsImpl : public KeySystems { friend struct base::DefaultLazyInstanceTraits<KeySystemsImpl>; typedef base::hash_map<std::string, KeySystemInfo> KeySystemInfoMap; - typedef base::hash_map<std::string, std::string> ParentKeySystemMap; typedef base::hash_map<std::string, SupportedCodecs> MimeTypeCodecsMap; typedef base::hash_map<std::string, EmeCodec> CodecsMap; typedef base::hash_map<std::string, EmeInitDataType> InitDataTypesMap; @@ -251,10 +250,6 @@ class KeySystemsImpl : public KeySystems { // Map from key system string to capabilities. KeySystemInfoMap concrete_key_system_map_; - // Map from parent key system to the concrete key system that should be used - // to represent its capabilities. - ParentKeySystemMap parent_key_system_map_; - // This member should only be modified by RegisterMimeType(). MimeTypeCodecsMap mime_type_to_codec_mask_map_; CodecsMap codec_string_map_; @@ -346,7 +341,6 @@ void KeySystemsImpl::UpdateIfNeeded() { void KeySystemsImpl::UpdateSupportedKeySystems() { DCHECK(thread_checker_.CalledOnValidThread()); concrete_key_system_map_.clear(); - parent_key_system_map_.clear(); // Build KeySystemInfo. std::vector<KeySystemInfo> key_systems_info; @@ -365,7 +359,6 @@ void KeySystemsImpl::AddConcreteSupportedKeySystems( const std::vector<KeySystemInfo>& concrete_key_systems) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(concrete_key_system_map_.empty()); - DCHECK(parent_key_system_map_.empty()); for (const KeySystemInfo& info : concrete_key_systems) { DCHECK(!info.key_system.empty()); @@ -420,17 +413,7 @@ void KeySystemsImpl::AddConcreteSupportedKeySystems( DCHECK(!IsConcreteSupportedKeySystem(info.key_system)) << "Key system '" << info.key_system << "' already registered"; - DCHECK(!parent_key_system_map_.count(info.key_system)) - << "'" << info.key_system << "' is already registered as a parent"; concrete_key_system_map_[info.key_system] = info; - if (!info.parent_key_system.empty()) { - DCHECK(!IsConcreteSupportedKeySystem(info.parent_key_system)) - << "Parent '" << info.parent_key_system << "' " - << "already registered concrete"; - DCHECK(!parent_key_system_map_.count(info.parent_key_system)) - << "Parent '" << info.parent_key_system << "' already registered"; - parent_key_system_map_[info.parent_key_system] = info.key_system; - } } } diff --git a/media/base/key_systems_unittest.cc b/media/base/key_systems_unittest.cc index 117bdfb..0eee5fe 100644 --- a/media/base/key_systems_unittest.cc +++ b/media/base/key_systems_unittest.cc @@ -25,10 +25,8 @@ namespace media { // kUsesAes uses the AesDecryptor like Clear Key. // kExternal uses an external CDM, such as Pepper-based or Android platform CDM. const char kUsesAes[] = "x-org.example.clear"; -const char kUsesAesParent[] = "x-org.example"; // Not registered. const char kUseAesNameForUMA[] = "UseAes"; const char kExternal[] = "x-com.example.test"; -const char kExternalParent[] = "x-com.example"; const char kExternalNameForUMA[] = "External"; const char kClearKey[] = "org.w3.clearkey"; @@ -208,7 +206,6 @@ void TestMediaClient::AddExternalKeySystem( ext.persistent_release_message_support = EmeSessionTypeSupport::NOT_SUPPORTED; ext.persistent_state_support = EmeFeatureSupport::ALWAYS_ENABLED; ext.distinctive_identifier_support = EmeFeatureSupport::ALWAYS_ENABLED; - ext.parent_key_system = kExternalParent; #if defined(ENABLE_PEPPER_CDMS) ext.pepper_type = "application/x-ppapi-external-cdm"; #endif // defined(ENABLE_PEPPER_CDMS) @@ -464,22 +461,6 @@ TEST_F(KeySystemsTest, kAudioWebM, fooaudio_codec(), kUsesAes)); } -// No parent is registered for UsesAes. -TEST_F(KeySystemsTest, Parent_NoParentRegistered) { - EXPECT_FALSE(IsSupportedKeySystem(kUsesAesParent)); - - // The parent is not supported for most things. - EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kUsesAesParent)); - EXPECT_FALSE(CanUseAesDecryptor(kUsesAesParent)); - -#if defined(ENABLE_PEPPER_CDMS) - std::string type; - EXPECT_DEBUG_DEATH(type = GetPepperType(kUsesAesParent), - "x-org.example is not a known concrete system"); - EXPECT_TRUE(type.empty()); -#endif -} - TEST_F(KeySystemsTest, IsSupportedKeySystem_InvalidVariants) { // Case sensitive. EXPECT_FALSE(IsSupportedKeySystem("x-org.example.ClEaR")); @@ -490,7 +471,10 @@ TEST_F(KeySystemsTest, IsSupportedKeySystem_InvalidVariants) { // Extra period. EXPECT_FALSE(IsSupportedKeySystem("x-org.example.clear.")); + + // Prefix. EXPECT_FALSE(IsSupportedKeySystem("x-org.example.")); + EXPECT_FALSE(IsSupportedKeySystem("x-org.example")); // Incomplete. EXPECT_FALSE(IsSupportedKeySystem("x-org.example.clea")); @@ -505,8 +489,6 @@ TEST_F(KeySystemsTest, IsSupportedKeySystem_InvalidVariants) { TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_NoType) { EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( std::string(), no_codecs(), kUsesAes)); - EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( - std::string(), no_codecs(), kUsesAesParent)); EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(std::string(), no_codecs(), "x-org.example.foo")); @@ -579,22 +561,6 @@ TEST_F(KeySystemsTest, Basic_ExternalDecryptor) { #endif // defined(ENABLE_PEPPER_CDMS) } -TEST_F(KeySystemsTest, Parent_ParentRegistered) { - // Unprefixed has no parent key system support. - EXPECT_FALSE(IsSupportedKeySystem(kExternalParent)); - - // The parent is not supported for most things. - EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kExternalParent)); - EXPECT_FALSE(CanUseAesDecryptor(kExternalParent)); - -#if defined(ENABLE_PEPPER_CDMS) - std::string type; - EXPECT_DEBUG_DEATH(type = GetPepperType(kExternalParent), - "x-com.example is not a known concrete system"); - EXPECT_TRUE(type.empty()); -#endif -} - TEST_F( KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_ExternalDecryptor_TypesContainer1) { diff --git a/media/cdm/key_system_names.cc b/media/cdm/key_system_names.cc index f0f1c2e..bcddaea 100644 --- a/media/cdm/key_system_names.cc +++ b/media/cdm/key_system_names.cc @@ -13,15 +13,15 @@ bool IsClearKey(const std::string& key_system) { return key_system == kClearKey; } -bool IsParentKeySystemOf(const std::string& parent_key_system, - const std::string& key_system) { - std::string prefix = parent_key_system + '.'; +bool IsChildKeySystemOf(const std::string& key_system, + const std::string& base) { + std::string prefix = base + '.'; return key_system.substr(0, prefix.size()) == prefix; } bool IsExternalClearKey(const std::string& key_system) { return key_system == kExternalClearKey || - IsParentKeySystemOf(kExternalClearKey, key_system); + IsChildKeySystemOf(key_system, kExternalClearKey); } } // namespace media diff --git a/media/cdm/key_system_names.h b/media/cdm/key_system_names.h index 6c388b98..8b23171 100644 --- a/media/cdm/key_system_names.h +++ b/media/cdm/key_system_names.h @@ -22,9 +22,9 @@ MEDIA_EXPORT extern const char kExternalClearKey[]; // Returns true if |key_system| is Clear Key, false otherwise. MEDIA_EXPORT bool IsClearKey(const std::string& key_system); -// Returns true if |key_system| is (reverse) sub-domain of |parent_key_system|. -MEDIA_EXPORT bool IsParentKeySystemOf(const std::string& parent_key_system, - const std::string& key_system); +// Returns true if |key_system| is (reverse) sub-domain of |base|. +MEDIA_EXPORT bool IsChildKeySystemOf(const std::string& key_system, + const std::string& base); // Returns true if |key_system| is External Clear Key, false otherwise. MEDIA_EXPORT bool IsExternalClearKey(const std::string& key_system); |