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..6df96a7005f44d9424c3fe844c299156289906b1 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: |
ddorwin
2015/01/09 03:27:36
We should fix the naming sometime.
jrummell
2015/01/09 17:24:28
Acknowledged.
|
+ return media::CdmKeyInformation::INTERNAL_ERROR; |
+ case PP_CDMKEYSTATUS_EXPIRED: |
+ return media::CdmKeyInformation::EXPIRED; |
+ case PP_CDMKEYSTATUS_OUTPUTNOTALLOWED: |
ddorwin
2015/01/09 03:27:35
And this probably shouldn't be one word.
jrummell
2015/01/09 17:24:28
Acknowledged.
|
+ 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,22 @@ 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); |
+ key_info->key_id.assign( |
+ key_information[i].key_id, |
ddorwin
2015/01/09 03:27:36
nit: With 5 references to it, you might consider m
jrummell
2015/01/09 17:24:28
Done. I would think the compilers are smart enough
|
+ key_information[i].key_id + key_information[i].key_id_size); |
+ key_info->status = PpCdmKeyStatusToCdmKeyInformationKeyStatus( |
+ key_information[i].key_status); |
+ key_info->system_code = key_information[i].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( |