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