Chromium Code Reviews| Index: media/cdm/ppapi/cdm_adapter.cc |
| diff --git a/media/cdm/ppapi/cdm_adapter.cc b/media/cdm/ppapi/cdm_adapter.cc |
| index 2452be87b3de72222cb23a2701c4e6a0c3002edb..a1c1cfd02c8af30de9f927139b164f0b70e63c9f 100644 |
| --- a/media/cdm/ppapi/cdm_adapter.cc |
| +++ b/media/cdm/ppapi/cdm_adapter.cc |
| @@ -323,6 +323,33 @@ void CdmAdapter::Initialize(const std::string& key_system) { |
| key_system_ = key_system; |
| } |
| +void CdmAdapter::SetServerCertificate(uint32_t promise_id, |
| + pp::VarArrayBuffer server_certificate) { |
| + const uint8_t* server_certificate_ptr = |
| + static_cast<const uint8_t*>(server_certificate.Map()); |
| + const uint32_t server_certificate_size = server_certificate.ByteLength(); |
| + |
| + PP_DCHECK(server_certificate_ptr); |
| + PP_DCHECK(server_certificate_size > 0); |
| + |
| + // Initialize() doesn't report an error, so SetServerCertificate() can be |
| + // called even if Initialize() failed. |
|
ddorwin
2014/08/25 22:55:01
Possible in a code sense, but not possible from an
jrummell
2014/08/26 00:19:23
It appears possible in both prefixed and unprefixe
|
| + // TODO(jrummell): Remove this code when prefixed EME gets removed. |
| + if (!cdm_) { |
| + RejectPromise(promise_id, |
| + cdm::kInvalidStateError, |
| + 0, |
| + "CDM has not been initialized."); |
| + return; |
| + } |
| + |
| + if (!cdm_->SetServerCertificate( |
| + promise_id, server_certificate_ptr, server_certificate_size)) { |
| + // CDM_4 and CDM_5 don't support this method, so reject the promise. |
| + RejectPromise(promise_id, cdm::kNotSupportedError, 0, "Not implemented."); |
| + } |
| +} |
| + |
| void CdmAdapter::CreateSession(uint32_t promise_id, |
| const std::string& init_data_type, |
| pp::VarArrayBuffer init_data, |
| @@ -392,8 +419,8 @@ void CdmAdapter::CloseSession(uint32_t promise_id, |
| } |
| } |
| -void CdmAdapter::ReleaseSession(uint32_t promise_id, |
| - const std::string& web_session_id) { |
| +void CdmAdapter::RemoveSession(uint32_t promise_id, |
| + const std::string& web_session_id) { |
| cdm_->RemoveSession( |
| promise_id, web_session_id.data(), web_session_id.length()); |
| } |
| @@ -845,8 +872,7 @@ void CdmAdapter::SendPromiseResolvedWithUsableKeyIdsInternal( |
| uint32_t promise_id, |
| std::vector<std::vector<uint8> > key_ids) { |
| PP_DCHECK(result == PP_OK); |
| - // TODO(jrummell): Implement this event in subsequent CL. |
| - // (http://crbug.com/358271). |
| + pp::ContentDecryptor_Private::PromiseResolvedWithKeyIds(promise_id, key_ids); |
| } |
| void CdmAdapter::SendPromiseRejectedInternal(int32_t result, |
| @@ -904,16 +930,16 @@ void CdmAdapter::SendSessionUsableKeysChangeInternal( |
| const std::string& web_session_id, |
| bool has_additional_usable_key) { |
| PP_DCHECK(result == PP_OK); |
| - // TODO(jrummell): Implement this event in subsequent CL. |
| - // (http://crbug.com/358271). |
| + pp::ContentDecryptor_Private::SessionKeysChange(web_session_id, |
| + has_additional_usable_key); |
| } |
| void CdmAdapter::SendExpirationChangeInternal(int32_t result, |
| const std::string& web_session_id, |
| cdm::Time new_expiry_time) { |
| PP_DCHECK(result == PP_OK); |
| - // TODO(jrummell): Implement this event in subsequent CL. |
| - // (http://crbug.com/358271). |
| + pp::ContentDecryptor_Private::SessionExpirationChange(web_session_id, |
| + new_expiry_time); |
| } |
| void CdmAdapter::DeliverBlock(int32_t result, |