Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1543)

Unified Diff: Source/modules/encryptedmedia/MediaKeys.cpp

Issue 183943003: Verify MediaKeys parameter values consistently (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rename Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/encryptedmedia/MediaKeys.cpp
diff --git a/Source/modules/encryptedmedia/MediaKeys.cpp b/Source/modules/encryptedmedia/MediaKeys.cpp
index d0e173a96c1859077feaaf9cfdbc00005c6e1bb6..b3c213e922e2c3cbd080609ace217d0d5b5f6974 100644
--- a/Source/modules/encryptedmedia/MediaKeys.cpp
+++ b/Source/modules/encryptedmedia/MediaKeys.cpp
@@ -53,7 +53,7 @@ PassRefPtrWillBeRawPtr<MediaKeys> MediaKeys::create(ExecutionContext* context, c
}
// 2. If keySystem is not one of the user agent's supported Key Systems, throw a NotSupportedError and abort these steps.
- if (!ContentDecryptionModule::supportsKeySystem(keySystem)) {
+ if (!isKeySystemSupported(keySystem)) {
exceptionState.throwDOMException(NotSupportedError, "The '" + keySystem + "' key system is not supported.");
return nullptr;
}
@@ -108,7 +108,7 @@ PassRefPtrWillBeRawPtr<MediaKeySession> MediaKeys::createSession(ExecutionContex
// 1. If type contains a MIME type that is not supported or is not supported by the keySystem,
// throw a NOT_SUPPORTED_ERR exception and abort these steps.
- if (!m_cdm->supportsMIMEType(contentType)) {
+ if (!isKeySystemSupportedWithContentType(m_keySystem, contentType)) {
exceptionState.throwDOMException(NotSupportedError, "The type provided ('" + contentType + "') is unsupported.");
return nullptr;
}
@@ -141,7 +141,7 @@ bool MediaKeys::isTypeSupported(const String& keySystem, const String& contentTy
// 2. If keySystem contains an unrecognized or unsupported Key System, return false and abort
// these steps. Key system string comparison is case-sensitive.
- if (!MIMETypeRegistry::isSupportedEncryptedMediaMIMEType(keySystem, "", ""))
+ if (!isKeySystemSupported(keySystem))
return false;
// 3. If contentType is null or an empty string, return true and abort these steps.
@@ -150,9 +150,22 @@ bool MediaKeys::isTypeSupported(const String& keySystem, const String& contentTy
// 4. If the Key System specified by keySystem does not support decrypting the container and/or
// codec specified by contentType, return false and abort these steps.
+ return isKeySystemSupportedWithContentType(keySystem, contentType);
+}
+
+bool MediaKeys::isKeySystemSupported(const String& keySystem)
+{
+ ASSERT(!keySystem.isEmpty());
+ return MIMETypeRegistry::isSupportedEncryptedMediaMIMEType(keySystem, "", "");
+}
+
+bool MediaKeys::isKeySystemSupportedWithContentType(const String& keySystem, const String& contentType)
+{
+ ASSERT(!keySystem.isEmpty());
+ ASSERT(!contentType.isEmpty());
acolwell GONE FROM CHROMIUM 2014/02/28 16:50:40 nit: I'm not sure there is a lot of value having 2
jrummell 2014/02/28 19:06:52 Done.
+
ContentType type(contentType);
String codecs = type.parameter("codecs");
-
return MIMETypeRegistry::isSupportedEncryptedMediaMIMEType(keySystem, type.type(), codecs);
}

Powered by Google App Engine
This is Rietveld 408576698