| 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 #ifndef MEDIA_CRYPTO_AES_DECRYPTOR_H_ | 5 #ifndef MEDIA_CRYPTO_AES_DECRYPTOR_H_ |
| 6 #define MEDIA_CRYPTO_AES_DECRYPTOR_H_ | 6 #define MEDIA_CRYPTO_AES_DECRYPTOR_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 DISALLOW_COPY_AND_ASSIGN(DecryptionKey); | 107 DISALLOW_COPY_AND_ASSIGN(DecryptionKey); |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 // Keep track of the keys for a key ID. If multiple sessions specify keys | 110 // Keep track of the keys for a key ID. If multiple sessions specify keys |
| 111 // for the same key ID, then the last key inserted is used. The structure is | 111 // for the same key ID, then the last key inserted is used. The structure is |
| 112 // optimized so that Decrypt() has fast access, at the cost of slow deletion | 112 // optimized so that Decrypt() has fast access, at the cost of slow deletion |
| 113 // of keys when a session is released. | 113 // of keys when a session is released. |
| 114 class SessionIdDecryptionKeyMap; | 114 class SessionIdDecryptionKeyMap; |
| 115 | 115 |
| 116 // Key ID <-> SessionIdDecryptionKeyMap map. | 116 // Key ID <-> SessionIdDecryptionKeyMap map. |
| 117 typedef base::ScopedPtrHashMap<std::string, SessionIdDecryptionKeyMap> | 117 typedef base::ScopedPtrHashMap<std::string, |
| 118 scoped_ptr<SessionIdDecryptionKeyMap>> |
| 118 KeyIdToSessionKeysMap; | 119 KeyIdToSessionKeysMap; |
| 119 | 120 |
| 120 // Creates a DecryptionKey using |key_string| and associates it with |key_id|. | 121 // Creates a DecryptionKey using |key_string| and associates it with |key_id|. |
| 121 // Returns true if successful. | 122 // Returns true if successful. |
| 122 bool AddDecryptionKey(const std::string& session_id, | 123 bool AddDecryptionKey(const std::string& session_id, |
| 123 const std::string& key_id, | 124 const std::string& key_id, |
| 124 const std::string& key_string); | 125 const std::string& key_string); |
| 125 | 126 |
| 126 // Gets a DecryptionKey associated with |key_id|. The AesDecryptor still owns | 127 // Gets a DecryptionKey associated with |key_id|. The AesDecryptor still owns |
| 127 // the key. Returns NULL if no key is associated with |key_id|. | 128 // the key. Returns NULL if no key is associated with |key_id|. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 157 // Protect |new_audio_key_cb_| and |new_video_key_cb_| as they are set on the | 158 // Protect |new_audio_key_cb_| and |new_video_key_cb_| as they are set on the |
| 158 // main thread but called on the media thread. | 159 // main thread but called on the media thread. |
| 159 mutable base::Lock new_key_cb_lock_; | 160 mutable base::Lock new_key_cb_lock_; |
| 160 | 161 |
| 161 DISALLOW_COPY_AND_ASSIGN(AesDecryptor); | 162 DISALLOW_COPY_AND_ASSIGN(AesDecryptor); |
| 162 }; | 163 }; |
| 163 | 164 |
| 164 } // namespace media | 165 } // namespace media |
| 165 | 166 |
| 166 #endif // MEDIA_CRYPTO_AES_DECRYPTOR_H_ | 167 #endif // MEDIA_CRYPTO_AES_DECRYPTOR_H_ |
| OLD | NEW |