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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // 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|. |
120 // Returns true if successful. | 120 // Returns true if successful. |
121 bool AddDecryptionKey(const std::string& session_id, | 121 bool AddDecryptionKey(const std::string& session_id, |
122 const std::string& key_id, | 122 const std::string& key_id, |
123 const std::string& key_string); | 123 const std::string& key_string); |
124 | 124 |
125 // Gets a DecryptionKey associated with |key_id|. The AesDecryptor still owns | 125 // Gets a DecryptionKey associated with |key_id|. The AesDecryptor still owns |
126 // 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|. |
127 DecryptionKey* GetKey(const std::string& key_id) const; | 127 DecryptionKey* GetKey(const std::string& key_id) const; |
128 | 128 |
| 129 // Determines if |key_id| is already specified for |session_id|. |
| 130 bool HasKey(const std::string& session_id, const std::string& key_id); |
| 131 |
129 // Deletes all keys associated with |session_id|. | 132 // Deletes all keys associated with |session_id|. |
130 void DeleteKeysForSession(const std::string& session_id); | 133 void DeleteKeysForSession(const std::string& session_id); |
131 | 134 |
132 // Callbacks for firing session events. | 135 // Callbacks for firing session events. |
133 SessionMessageCB session_message_cb_; | 136 SessionMessageCB session_message_cb_; |
134 SessionClosedCB session_closed_cb_; | 137 SessionClosedCB session_closed_cb_; |
135 SessionKeysChangeCB session_keys_change_cb_; | 138 SessionKeysChangeCB session_keys_change_cb_; |
136 | 139 |
137 // Since only Decrypt() is called off the renderer thread, we only need to | 140 // Since only Decrypt() is called off the renderer thread, we only need to |
138 // protect |key_map_|, the only member variable that is shared between | 141 // protect |key_map_|, the only member variable that is shared between |
(...skipping 14 matching lines...) Expand all Loading... |
153 // 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 |
154 // main thread but called on the media thread. | 157 // main thread but called on the media thread. |
155 mutable base::Lock new_key_cb_lock_; | 158 mutable base::Lock new_key_cb_lock_; |
156 | 159 |
157 DISALLOW_COPY_AND_ASSIGN(AesDecryptor); | 160 DISALLOW_COPY_AND_ASSIGN(AesDecryptor); |
158 }; | 161 }; |
159 | 162 |
160 } // namespace media | 163 } // namespace media |
161 | 164 |
162 #endif // MEDIA_CRYPTO_AES_DECRYPTOR_H_ | 165 #endif // MEDIA_CRYPTO_AES_DECRYPTOR_H_ |
OLD | NEW |