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) { |