Index: media/cdm/ppapi/cdm_adapter.cc |
diff --git a/media/cdm/ppapi/cdm_adapter.cc b/media/cdm/ppapi/cdm_adapter.cc |
index a54ab390c226f5578eca1ad0b5747d99a0a85548..0cf4d68dcb9098e7b48af386fd4c94985e4eb5be 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/22 20:49:20
Is this true? This function can only be called by
jrummell
2014/08/25 21:54:36
Initialize() is called from PpapiDecryptor constru
|
+ // 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, |
@@ -383,8 +410,17 @@ void CdmAdapter::UpdateSession(uint32_t promise_id, |
response_size); |
} |
-void CdmAdapter::ReleaseSession(uint32_t promise_id, |
- const std::string& web_session_id) { |
+void CdmAdapter::GetUsableKeyIds(uint32_t promise_id, |
ddorwin
2014/08/22 20:49:20
Why did this move?
jrummell
2014/08/25 21:54:36
To line up with the order in the .h file. Moved ba
|
+ const std::string& web_session_id) { |
+ if (!cdm_->GetUsableKeyIds( |
+ promise_id, web_session_id.data(), web_session_id.length())) { |
+ // CDM_4 and CDM_5 don't support this method, so reject the promise. |
+ RejectPromise(promise_id, cdm::kNotSupportedError, 0, "Not implemented."); |
+ } |
+} |
+ |
+void CdmAdapter::CloseSession(uint32_t promise_id, |
+ const std::string& web_session_id) { |
cdm_->CloseSession( |
promise_id, web_session_id.data(), web_session_id.length()); |
} |
@@ -398,15 +434,6 @@ void CdmAdapter::RemoveSession(uint32_t promise_id, |
} |
} |
-void CdmAdapter::GetUsableKeyIds(uint32_t promise_id, |
- const std::string& web_session_id) { |
- if (!cdm_->GetUsableKeyIds( |
- promise_id, web_session_id.data(), web_session_id.length())) { |
- // CDM_4 and CDM_5 don't support this method, so reject the promise. |
- RejectPromise(promise_id, cdm::kNotSupportedError, 0, "Not implemented."); |
- } |
-} |
- |
// Note: In the following decryption/decoding related functions, errors are NOT |
// reported via KeyError, but are reported via corresponding PPB calls. |
@@ -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, |