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 23 matching lines...) Expand all Loading... |
34 // insertion time (last insertion is first). It takes ownership of the | 34 // insertion time (last insertion is first). It takes ownership of the |
35 // DecryptionKeys. | 35 // DecryptionKeys. |
36 class AesDecryptor::SessionIdDecryptionKeyMap { | 36 class AesDecryptor::SessionIdDecryptionKeyMap { |
37 // Use a std::list to actually hold the data. Insertion is always done | 37 // Use a std::list to actually hold the data. Insertion is always done |
38 // at the front, so the "latest" decryption key is always the first one | 38 // at the front, so the "latest" decryption key is always the first one |
39 // in the list. | 39 // in the list. |
40 typedef std::list<std::pair<std::string, DecryptionKey*> > KeyList; | 40 typedef std::list<std::pair<std::string, DecryptionKey*> > KeyList; |
41 | 41 |
42 public: | 42 public: |
43 SessionIdDecryptionKeyMap() {} | 43 SessionIdDecryptionKeyMap() {} |
44 ~SessionIdDecryptionKeyMap() { STLDeleteValues(&key_list_); } | 44 ~SessionIdDecryptionKeyMap() { base::STLDeleteValues(&key_list_); } |
45 | 45 |
46 // Replaces value if |session_id| is already present, or adds it if not. | 46 // Replaces value if |session_id| is already present, or adds it if not. |
47 // This |decryption_key| becomes the latest until another insertion or | 47 // This |decryption_key| becomes the latest until another insertion or |
48 // |session_id| is erased. | 48 // |session_id| is erased. |
49 void Insert(const std::string& session_id, | 49 void Insert(const std::string& session_id, |
50 std::unique_ptr<DecryptionKey> decryption_key); | 50 std::unique_ptr<DecryptionKey> decryption_key); |
51 | 51 |
52 // Deletes the entry for |session_id| if present. | 52 // Deletes the entry for |session_id| if present. |
53 void Erase(const std::string& session_id); | 53 void Erase(const std::string& session_id); |
54 | 54 |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 bool AesDecryptor::DecryptionKey::Init() { | 614 bool AesDecryptor::DecryptionKey::Init() { |
615 CHECK(!secret_.empty()); | 615 CHECK(!secret_.empty()); |
616 decryption_key_ = | 616 decryption_key_ = |
617 crypto::SymmetricKey::Import(crypto::SymmetricKey::AES, secret_); | 617 crypto::SymmetricKey::Import(crypto::SymmetricKey::AES, secret_); |
618 if (!decryption_key_) | 618 if (!decryption_key_) |
619 return false; | 619 return false; |
620 return true; | 620 return true; |
621 } | 621 } |
622 | 622 |
623 } // namespace media | 623 } // namespace media |
OLD | NEW |