| Index: media/cdm/aes_decryptor.cc
|
| diff --git a/media/cdm/aes_decryptor.cc b/media/cdm/aes_decryptor.cc
|
| index b83c9b185d52226737c8437fb63e1d81e0ac1926..c2e0f2c95fb4573aff8363ee2e56a4b6ab6800be 100644
|
| --- a/media/cdm/aes_decryptor.cc
|
| +++ b/media/cdm/aes_decryptor.cc
|
| @@ -224,10 +224,13 @@ static scoped_refptr<DecoderBuffer> DecryptData(const DecoderBuffer& input,
|
| }
|
|
|
| AesDecryptor::AesDecryptor(const SessionMessageCB& session_message_cb,
|
| + const SessionKeysChangeCB& session_keys_change_cb,
|
| const SessionClosedCB& session_closed_cb)
|
| : session_message_cb_(session_message_cb),
|
| + session_keys_change_cb_(session_keys_change_cb),
|
| session_closed_cb_(session_closed_cb) {
|
| DCHECK(!session_message_cb_.is_null());
|
| + DCHECK(!session_keys_change_cb_.is_null());
|
| DCHECK(!session_closed_cb_.is_null());
|
| }
|
|
|
| @@ -235,6 +238,14 @@ 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();
|
| +}
|
| +
|
| 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);
|
| }
|
|
|
| -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.
|
| 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.
|
| + // 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();
|
| +}
|
| +
|
| +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;
|
| }
|
|
|