| 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 // Validate that this is a reference to an active session and then forget it. | 401 // Validate that this is a reference to an active session and then forget it. |
| 402 std::set<std::string>::iterator it = valid_sessions_.find(session_id); | 402 std::set<std::string>::iterator it = valid_sessions_.find(session_id); |
| 403 DCHECK(it != valid_sessions_.end()); | 403 DCHECK(it != valid_sessions_.end()); |
| 404 | 404 |
| 405 valid_sessions_.erase(it); | 405 valid_sessions_.erase(it); |
| 406 | 406 |
| 407 // Close the session. | 407 // Close the session. |
| 408 DeleteKeysForSession(session_id); | 408 DeleteKeysForSession(session_id); |
| 409 promise->resolve(); | 409 promise->resolve(); |
| 410 | 410 |
| 411 // Update key statuses. All keys have been destroyed, so it's an empty set. | |
| 412 session_keys_change_cb_.Run(session_id, false, CdmKeysInfo()); | |
| 413 | |
| 414 // Update expiration time to NaN. (http://crbug.com/624192) | |
| 415 | |
| 416 // Resolve the closed attribute. | 411 // Resolve the closed attribute. |
| 417 session_closed_cb_.Run(session_id); | 412 session_closed_cb_.Run(session_id); |
| 418 } | 413 } |
| 419 | 414 |
| 420 void AesDecryptor::RemoveSession(const std::string& session_id, | 415 void AesDecryptor::RemoveSession(const std::string& session_id, |
| 421 std::unique_ptr<SimpleCdmPromise> promise) { | 416 std::unique_ptr<SimpleCdmPromise> promise) { |
| 422 NOTIMPLEMENTED() << "Need to address https://crbug.com/616166."; | 417 NOTIMPLEMENTED() << "Need to address https://crbug.com/616166."; |
| 423 promise->reject(INVALID_ACCESS_ERROR, 0, "Session does not exist."); | 418 promise->reject(INVALID_ACCESS_ERROR, 0, "Session does not exist."); |
| 424 } | 419 } |
| 425 | 420 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 bool AesDecryptor::DecryptionKey::Init() { | 592 bool AesDecryptor::DecryptionKey::Init() { |
| 598 CHECK(!secret_.empty()); | 593 CHECK(!secret_.empty()); |
| 599 decryption_key_ = | 594 decryption_key_ = |
| 600 crypto::SymmetricKey::Import(crypto::SymmetricKey::AES, secret_); | 595 crypto::SymmetricKey::Import(crypto::SymmetricKey::AES, secret_); |
| 601 if (!decryption_key_) | 596 if (!decryption_key_) |
| 602 return false; | 597 return false; |
| 603 return true; | 598 return true; |
| 604 } | 599 } |
| 605 | 600 |
| 606 } // namespace media | 601 } // namespace media |
| OLD | NEW |