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

Unified Diff: content/renderer/pepper/content_decryptor_delegate.cc

Issue 839063004: Convert KeyInformation from Pepper type to MediaKeys (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 5 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper/content_decryptor_delegate.cc
diff --git a/content/renderer/pepper/content_decryptor_delegate.cc b/content/renderer/pepper/content_decryptor_delegate.cc
index 8424642bb7b101348c52a023c1237a06339e1e52..a3b52605b53928c32e08b707a7982b296e26d954 100644
--- a/content/renderer/pepper/content_decryptor_delegate.cc
+++ b/content/renderer/pepper/content_decryptor_delegate.cc
@@ -292,6 +292,23 @@ MediaKeys::Exception PpExceptionTypeToMediaException(
}
}
+media::CdmKeyInformation::KeyStatus PpCdmKeyStatusToCdmKeyInformationKeyStatus(
+ PP_CdmKeyStatus status) {
+ switch (status) {
+ case PP_CDMKEYSTATUS_USABLE:
+ return media::CdmKeyInformation::USABLE;
+ case PP_CDMKEYSTATUS_INVALID:
+ return media::CdmKeyInformation::INTERNAL_ERROR;
+ case PP_CDMKEYSTATUS_EXPIRED:
+ return media::CdmKeyInformation::EXPIRED;
+ case PP_CDMKEYSTATUS_OUTPUTNOTALLOWED:
+ return media::CdmKeyInformation::OUTPUT_NOT_ALLOWED;
+ default:
+ NOTREACHED();
+ return media::CdmKeyInformation::INTERNAL_ERROR;
+ }
+}
+
// TODO(xhwang): Unify EME UMA reporting code when prefixed EME is deprecated.
// See http://crbug.com/412987 for details.
void ReportSystemCodeUMA(const std::string& key_system, uint32 system_code) {
@@ -754,7 +771,6 @@ void ContentDecryptorDelegate::OnSessionMessage(PP_Var web_session_id,
GURL::EmptyGURL());
}
-// TODO(jrummell): Decode |key_information| and pass it to the callback.
void ContentDecryptorDelegate::OnSessionKeysChange(
PP_Var web_session_id,
PP_Bool has_additional_usable_key,
@@ -766,10 +782,21 @@ void ContentDecryptorDelegate::OnSessionKeysChange(
StringVar* web_session_id_string = StringVar::FromPPVar(web_session_id);
DCHECK(web_session_id_string);
- // TODO(jrummell): Pass key information through Pepper.
+ media::CdmKeysInfo keys_info;
+ keys_info.reserve(key_count);
+ for (uint32_t i = 0; i < key_count; ++i) {
+ scoped_ptr<media::CdmKeyInformation> key_info(new media::CdmKeyInformation);
+ const auto& info = key_information[i];
+ key_info->key_id.assign(info.key_id, info.key_id + info.key_id_size);
+ key_info->status =
+ PpCdmKeyStatusToCdmKeyInformationKeyStatus(info.key_status);
+ key_info->system_code = info.system_code;
+ keys_info.push_back(key_info.release());
+ }
+
session_keys_change_cb_.Run(web_session_id_string->value(),
PP_ToBool(has_additional_usable_key),
- media::CdmKeysInfo());
+ keys_info.Pass());
}
void ContentDecryptorDelegate::OnSessionExpirationChange(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698