OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/cdm/aes_decryptor.h" | 5 #include "media/cdm/aes_decryptor.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <list> | 8 #include <list> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 std::unique_ptr<SimpleCdmPromise> promise) { | 404 std::unique_ptr<SimpleCdmPromise> promise) { |
405 // Validate that this is a reference to an active session and then forget it. | 405 // Validate that this is a reference to an active session and then forget it. |
406 std::set<std::string>::iterator it = valid_sessions_.find(session_id); | 406 std::set<std::string>::iterator it = valid_sessions_.find(session_id); |
407 DCHECK(it != valid_sessions_.end()); | 407 DCHECK(it != valid_sessions_.end()); |
408 | 408 |
409 valid_sessions_.erase(it); | 409 valid_sessions_.erase(it); |
410 | 410 |
411 // Close the session. | 411 // Close the session. |
412 DeleteKeysForSession(session_id); | 412 DeleteKeysForSession(session_id); |
413 promise->resolve(); | 413 promise->resolve(); |
| 414 |
| 415 // Update key statuses. All keys have been destroyed, so it's an empty set. |
| 416 session_keys_change_cb_.Run(session_id, false, CdmKeysInfo()); |
| 417 |
| 418 // Update expiration time to NaN. (http://crbug.com/624192) |
| 419 |
| 420 // Resolve the closed attribute. |
414 session_closed_cb_.Run(session_id); | 421 session_closed_cb_.Run(session_id); |
415 } | 422 } |
416 | 423 |
417 void AesDecryptor::RemoveSession(const std::string& session_id, | 424 void AesDecryptor::RemoveSession(const std::string& session_id, |
418 std::unique_ptr<SimpleCdmPromise> promise) { | 425 std::unique_ptr<SimpleCdmPromise> promise) { |
419 // AesDecryptor doesn't keep any persistent data, so this should be | 426 // AesDecryptor doesn't keep any persistent data, so this should be |
420 // NOT_REACHED(). | 427 // NOT_REACHED(). |
421 // TODO(jrummell): Make sure persistent session types are rejected. | 428 // TODO(jrummell): Make sure persistent session types are rejected. |
422 // http://crbug.com/384152. | 429 // http://crbug.com/384152. |
423 // | 430 // |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 bool AesDecryptor::DecryptionKey::Init() { | 614 bool AesDecryptor::DecryptionKey::Init() { |
608 CHECK(!secret_.empty()); | 615 CHECK(!secret_.empty()); |
609 decryption_key_ = | 616 decryption_key_ = |
610 crypto::SymmetricKey::Import(crypto::SymmetricKey::AES, secret_); | 617 crypto::SymmetricKey::Import(crypto::SymmetricKey::AES, secret_); |
611 if (!decryption_key_) | 618 if (!decryption_key_) |
612 return false; | 619 return false; |
613 return true; | 620 return true; |
614 } | 621 } |
615 | 622 |
616 } // namespace media | 623 } // namespace media |
OLD | NEW |