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

Unified Diff: content/public/renderer/key_system_info.cc

Issue 253593002: Componentize EncryptedMediaMessageFilter and rename it CdmMessageFilter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed jam's comments. Created 6 years, 8 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: content/public/renderer/key_system_info.cc
diff --git a/content/public/renderer/key_system_info.cc b/content/public/renderer/key_system_info.cc
index 6a64fdbac0049ea49227ab981400a1d28aea8aad..d26c78a7724ae01e354cec76771d0fe75348d427 100644
--- a/content/public/renderer/key_system_info.cc
+++ b/content/public/renderer/key_system_info.cc
@@ -4,8 +4,47 @@
#include "content/public/renderer/key_system_info.h"
+#include "base/logging.h"
+
namespace content {
+namespace {
+
+// Return |name|'s parent key system.
+std::string GetDirectParentName(std::string name) {
+ int last_period = name.find_last_of('.');
+ DCHECK_GT(last_period, 0);
+ return name.substr(0, last_period);
+}
+
+} // namespace
+
+// static
+KeySystemInfo KeySystemInfo::Build(const char* key_system,
+ bool has_parent,
+ const char* suffix,
+#if defined(ENABLE_PEPPER_CDMS)
+ const char* pepper_type,
+#endif // defined(ENABLE_PEPPER_CDMS)
+ SupportedCodecs supported_codecs) {
+ KeySystemInfo info(key_system);
+
+ if (has_parent)
+ info.parent_key_system = GetDirectParentName(key_system);
+ if (suffix)
+ info.key_system.append(suffix);
+
+ // TODO(xhwang): A container or an initDataType may be supported even though
+ // there are no codecs supported in that container. Fix this when we support
+ // initDataType.
+ info.supported_codecs = supported_codecs;
+
+#if defined(ENABLE_PEPPER_CDMS)
+ info.pepper_type = pepper_type;
+#endif // defined(ENABLE_PEPPER_CDMS)
+ return info;
+}
+
KeySystemInfo::KeySystemInfo(const std::string& key_system)
: key_system(key_system),
use_aes_decryptor(false) {

Powered by Google App Engine
This is Rietveld 408576698