Chromium Code Reviews| Index: media/cdm/aes_decryptor.cc |
| diff --git a/media/cdm/aes_decryptor.cc b/media/cdm/aes_decryptor.cc |
| index b83c9b185d52226737c8437fb63e1d81e0ac1926..627de0988cd040b24d34996d5b1c793556629a3e 100644 |
| --- a/media/cdm/aes_decryptor.cc |
| +++ b/media/cdm/aes_decryptor.cc |
| @@ -224,17 +224,28 @@ static scoped_refptr<DecoderBuffer> DecryptData(const DecoderBuffer& input, |
| } |
| AesDecryptor::AesDecryptor(const SessionMessageCB& session_message_cb, |
| - const SessionClosedCB& session_closed_cb) |
| + const SessionClosedCB& session_closed_cb, |
| + const SessionKeysChangeCB& session_keys_change_cb) |
| : session_message_cb_(session_message_cb), |
| - session_closed_cb_(session_closed_cb) { |
| + session_closed_cb_(session_closed_cb), |
| + session_keys_change_cb_(session_keys_change_cb) { |
| DCHECK(!session_message_cb_.is_null()); |
| DCHECK(!session_closed_cb_.is_null()); |
| + DCHECK(!session_keys_change_cb_.is_null()); |
| } |
| AesDecryptor::~AesDecryptor() { |
| key_map_.clear(); |
| } |
| +void AesDecryptor::SetServerCertificate(const uint8* certificate_data, |
| + int certificate_data_length, |
| + scoped_ptr<SimpleCdmPromise> promise) { |
| + // AesDecryptor does not communicate with a license server, so no need to |
| + // handle the server certificate. Simply resolve the promise. |
| + promise->resolve(); |
|
ddorwin
2014/09/12 21:46:30
Reject with not supported. CK key system does not
jrummell
2014/09/15 18:22:40
Done.
|
| +} |
| + |
| void AesDecryptor::CreateSession(const std::string& init_data_type, |
| const uint8* init_data, |
| int init_data_length, |
| @@ -318,27 +329,13 @@ void AesDecryptor::UpdateSession(const std::string& web_session_id, |
| } |
| promise->resolve(); |
| -} |
| -void AesDecryptor::GetUsableKeyIds(const std::string& web_session_id, |
| - scoped_ptr<KeyIdsPromise> promise) { |
| - // Since |web_session_id| is not provided by the user, this should never |
| - // happen. |
| - DCHECK(valid_sessions_.find(web_session_id) != valid_sessions_.end()); |
| - |
| - KeyIdsVector keyids; |
| - base::AutoLock auto_lock(key_map_lock_); |
| - for (KeyIdToSessionKeysMap::iterator it = key_map_.begin(); |
| - it != key_map_.end(); |
| - ++it) { |
| - if (it->second->Contains(web_session_id)) |
| - keyids.push_back(std::vector<uint8>(it->first.begin(), it->first.end())); |
| - } |
| - promise->resolve(keyids); |
| + // Keys have been added, so send notification. |
| + session_keys_change_cb_.Run(web_session_id, true); |
|
ddorwin
2014/09/12 21:46:30
We should at least comment that we are assuming ke
jrummell
2014/09/15 18:22:40
Done.
|
| } |
| -void AesDecryptor::ReleaseSession(const std::string& web_session_id, |
| - scoped_ptr<SimpleCdmPromise> promise) { |
| +void AesDecryptor::CloseSession(const std::string& web_session_id, |
| + scoped_ptr<SimpleCdmPromise> promise) { |
| // Validate that this is a reference to an active session and then forget it. |
|
ddorwin
2014/09/12 21:46:30
Since this either comes from line 360 or unprefixe
jrummell
2014/09/15 18:22:40
Done.
|
| std::set<std::string>::iterator it = valid_sessions_.find(web_session_id); |
| // TODO(jrummell): Convert back to a DCHECK once prefixed EME is removed. |
| @@ -355,6 +352,35 @@ void AesDecryptor::ReleaseSession(const std::string& web_session_id, |
| session_closed_cb_.Run(web_session_id); |
| } |
| +void AesDecryptor::RemoveSession(const std::string& web_session_id, |
| + scoped_ptr<SimpleCdmPromise> promise) { |
| + // AesDecryptor doesn't keep any persistent data, so no work to do. |
|
ddorwin
2014/09/12 21:46:30
This should be rejected: Step 2 of https://dvcs.w3
jrummell
2014/09/15 18:22:40
Done.
|
| + // However, close the session if it exists. |
| + if (valid_sessions_.find(web_session_id) != valid_sessions_.end()) { |
| + CloseSession(web_session_id, promise.Pass()); |
| + return; |
| + } |
| + |
| + promise->resolve(); |
|
ddorwin
2014/09/12 21:46:30
If it's not found (only prefixed case), we should
jrummell
2014/09/15 18:22:40
Done.
|
| +} |
| + |
| +void AesDecryptor::GetUsableKeyIds(const std::string& web_session_id, |
| + scoped_ptr<KeyIdsPromise> promise) { |
| + // Since |web_session_id| is not provided by the user, this should never |
| + // happen. |
| + DCHECK(valid_sessions_.find(web_session_id) != valid_sessions_.end()); |
| + |
| + KeyIdsVector keyids; |
| + base::AutoLock auto_lock(key_map_lock_); |
| + for (KeyIdToSessionKeysMap::iterator it = key_map_.begin(); |
| + it != key_map_.end(); |
| + ++it) { |
| + if (it->second->Contains(web_session_id)) |
| + keyids.push_back(std::vector<uint8>(it->first.begin(), it->first.end())); |
| + } |
| + promise->resolve(keyids); |
| +} |
| + |
| Decryptor* AesDecryptor::GetDecryptor() { |
| return this; |
| } |