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

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

Issue 806653004: Revert "Remove MediaKeys.isTypeSupported()." (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « Source/modules/encryptedmedia/MediaKeys.h ('k') | Source/modules/encryptedmedia/MediaKeys.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/encryptedmedia/MediaKeys.cpp
diff --git a/Source/modules/encryptedmedia/MediaKeys.cpp b/Source/modules/encryptedmedia/MediaKeys.cpp
index 98ff138798a43511a12cac6f5245494f2e6ae489..aca9600d4c277b4b1d853c4c84558dbbbed07e2d 100644
--- a/Source/modules/encryptedmedia/MediaKeys.cpp
+++ b/Source/modules/encryptedmedia/MediaKeys.cpp
@@ -33,13 +33,24 @@
#include "core/dom/ExecutionContext.h"
#include "modules/encryptedmedia/MediaKeySession.h"
#include "modules/encryptedmedia/SimpleContentDecryptionModuleResultPromise.h"
+#include "platform/ContentType.h"
#include "platform/Logging.h"
+#include "platform/MIMETypeRegistry.h"
#include "platform/Timer.h"
#include "public/platform/WebContentDecryptionModule.h"
#include "wtf/RefPtr.h"
namespace blink {
+static bool isKeySystemSupportedWithContentType(const String& keySystem, const String& contentType)
+{
+ ASSERT(!keySystem.isEmpty());
+
+ ContentType type(contentType);
+ String codecs = type.parameter("codecs");
+ return MIMETypeRegistry::isSupportedEncryptedMediaMIMEType(keySystem, type.type(), codecs);
+}
+
// A class holding a pending action.
class MediaKeys::PendingAction : public GarbageCollectedFinalized<MediaKeys::PendingAction> {
public:
@@ -153,6 +164,28 @@ ScriptPromise MediaKeys::setServerCertificate(ScriptState* scriptState, const DO
return promise;
}
+bool MediaKeys::isTypeSupported(const String& keySystem, const String& contentType)
+{
+ WTF_LOG(Media, "MediaKeys::isTypeSupported(%s, %s)", keySystem.ascii().data(), contentType.ascii().data());
+
+ // 1. If keySystem is an empty string, return false and abort these steps.
+ if (keySystem.isEmpty())
+ return false;
+
+ // 2. If keySystem contains an unrecognized or unsupported Key System, return false and abort
+ // these steps. Key system string comparison is case-sensitive.
+ if (!isKeySystemSupportedWithContentType(keySystem, ""))
+ return false;
+
+ // 3. If contentType is an empty string, return true and abort these steps.
+ if (contentType.isEmpty())
+ return true;
+
+ // 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);
+}
+
void MediaKeys::timerFired(Timer<MediaKeys>*)
{
ASSERT(m_pendingActions.size());
« no previous file with comments | « Source/modules/encryptedmedia/MediaKeys.h ('k') | Source/modules/encryptedmedia/MediaKeys.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698