| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/crypto/aes_decryptor.h" | 5 #include "media/crypto/aes_decryptor.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 decrypt_cb.Run(kError, NULL); | 222 decrypt_cb.Run(kError, NULL); |
| 223 return; | 223 return; |
| 224 } | 224 } |
| 225 } | 225 } |
| 226 | 226 |
| 227 decrypted->SetTimestamp(encrypted->GetTimestamp()); | 227 decrypted->SetTimestamp(encrypted->GetTimestamp()); |
| 228 decrypted->SetDuration(encrypted->GetDuration()); | 228 decrypted->SetDuration(encrypted->GetDuration()); |
| 229 decrypt_cb.Run(kSuccess, decrypted); | 229 decrypt_cb.Run(kSuccess, decrypted); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void AesDecryptor::Stop() { | 232 void AesDecryptor::CancelDecrypt() { |
| 233 } | 233 } |
| 234 | 234 |
| 235 void AesDecryptor::SetKey(const std::string& key_id, | 235 void AesDecryptor::SetKey(const std::string& key_id, |
| 236 scoped_ptr<DecryptionKey> decryption_key) { | 236 scoped_ptr<DecryptionKey> decryption_key) { |
| 237 base::AutoLock auto_lock(key_map_lock_); | 237 base::AutoLock auto_lock(key_map_lock_); |
| 238 KeyMap::iterator found = key_map_.find(key_id); | 238 KeyMap::iterator found = key_map_.find(key_id); |
| 239 if (found != key_map_.end()) { | 239 if (found != key_map_.end()) { |
| 240 delete found->second; | 240 delete found->second; |
| 241 key_map_.erase(found); | 241 key_map_.erase(found); |
| 242 } | 242 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 262 bool AesDecryptor::DecryptionKey::Init() { | 262 bool AesDecryptor::DecryptionKey::Init() { |
| 263 CHECK(!secret_.empty()); | 263 CHECK(!secret_.empty()); |
| 264 decryption_key_.reset(crypto::SymmetricKey::Import( | 264 decryption_key_.reset(crypto::SymmetricKey::Import( |
| 265 crypto::SymmetricKey::AES, secret_)); | 265 crypto::SymmetricKey::AES, secret_)); |
| 266 if (!decryption_key_.get()) | 266 if (!decryption_key_.get()) |
| 267 return false; | 267 return false; |
| 268 return true; | 268 return true; |
| 269 } | 269 } |
| 270 | 270 |
| 271 } // namespace media | 271 } // namespace media |
| OLD | NEW |