Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: media/crypto/aes_decryptor.h

Issue 17309003: Removed unused NeedKey callback from Decryptors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase only Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | media/crypto/aes_decryptor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 11 matching lines...) Expand all
22 } 22 }
23 23
24 namespace media { 24 namespace media {
25 25
26 // Decrypts an AES encrypted buffer into an unencrypted buffer. The AES 26 // Decrypts an AES encrypted buffer into an unencrypted buffer. The AES
27 // encryption must be CTR with a key size of 128bits. 27 // encryption must be CTR with a key size of 128bits.
28 class MEDIA_EXPORT AesDecryptor : public MediaKeys, public Decryptor { 28 class MEDIA_EXPORT AesDecryptor : public MediaKeys, public Decryptor {
29 public: 29 public:
30 AesDecryptor(const KeyAddedCB& key_added_cb, 30 AesDecryptor(const KeyAddedCB& key_added_cb,
31 const KeyErrorCB& key_error_cb, 31 const KeyErrorCB& key_error_cb,
32 const KeyMessageCB& key_message_cb, 32 const KeyMessageCB& key_message_cb);
33 const NeedKeyCB& need_key_cb);
34 virtual ~AesDecryptor(); 33 virtual ~AesDecryptor();
35 34
36 // MediaKeys implementation. 35 // MediaKeys implementation.
37 virtual bool GenerateKeyRequest(const std::string& type, 36 virtual bool GenerateKeyRequest(const std::string& type,
38 const uint8* init_data, 37 const uint8* init_data,
39 int init_data_length) OVERRIDE; 38 int init_data_length) OVERRIDE;
40 virtual void AddKey(const uint8* key, int key_length, 39 virtual void AddKey(const uint8* key, int key_length,
41 const uint8* init_data, int init_data_length, 40 const uint8* init_data, int init_data_length,
42 const std::string& session_id) OVERRIDE; 41 const std::string& session_id) OVERRIDE;
43 virtual void CancelKeyRequest(const std::string& session_id) OVERRIDE; 42 virtual void CancelKeyRequest(const std::string& session_id) OVERRIDE;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 void SetKey(const std::string& key_id, scoped_ptr<DecryptionKey> key); 90 void SetKey(const std::string& key_id, scoped_ptr<DecryptionKey> key);
92 91
93 // Gets a DecryptionKey associated with |key_id|. The AesDecryptor still owns 92 // Gets a DecryptionKey associated with |key_id|. The AesDecryptor still owns
94 // the key. Returns NULL if no key is associated with |key_id|. 93 // the key. Returns NULL if no key is associated with |key_id|.
95 DecryptionKey* GetKey(const std::string& key_id) const; 94 DecryptionKey* GetKey(const std::string& key_id) const;
96 95
97 // Callbacks for firing key events. 96 // Callbacks for firing key events.
98 KeyAddedCB key_added_cb_; 97 KeyAddedCB key_added_cb_;
99 KeyErrorCB key_error_cb_; 98 KeyErrorCB key_error_cb_;
100 KeyMessageCB key_message_cb_; 99 KeyMessageCB key_message_cb_;
101 NeedKeyCB need_key_cb_;
102 100
103 // KeyMap owns the DecryptionKey* and must delete them when they are 101 // KeyMap owns the DecryptionKey* and must delete them when they are
104 // not needed any more. 102 // not needed any more.
105 typedef base::hash_map<std::string, DecryptionKey*> KeyMap; 103 typedef base::hash_map<std::string, DecryptionKey*> KeyMap;
106 104
107 // Since only Decrypt() is called off the renderer thread, we only need to 105 // Since only Decrypt() is called off the renderer thread, we only need to
108 // protect |key_map_|, the only member variable that is shared between 106 // protect |key_map_|, the only member variable that is shared between
109 // Decrypt() and other methods. 107 // Decrypt() and other methods.
110 KeyMap key_map_; // Protected by the |key_map_lock_|. 108 KeyMap key_map_; // Protected by the |key_map_lock_|.
111 mutable base::Lock key_map_lock_; // Protects the |key_map_|. 109 mutable base::Lock key_map_lock_; // Protects the |key_map_|.
112 110
113 // Make session ID unique per renderer by making it static. 111 // Make session ID unique per renderer by making it static.
114 // TODO(xhwang): Make session ID more strictly defined if needed: 112 // TODO(xhwang): Make session ID more strictly defined if needed:
115 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=16739#c0 113 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=16739#c0
116 static uint32 next_session_id_; 114 static uint32 next_session_id_;
117 115
118 NewKeyCB new_audio_key_cb_; 116 NewKeyCB new_audio_key_cb_;
119 NewKeyCB new_video_key_cb_; 117 NewKeyCB new_video_key_cb_;
120 118
121 DISALLOW_COPY_AND_ASSIGN(AesDecryptor); 119 DISALLOW_COPY_AND_ASSIGN(AesDecryptor);
122 }; 120 };
123 121
124 } // namespace media 122 } // namespace media
125 123
126 #endif // MEDIA_CRYPTO_AES_DECRYPTOR_H_ 124 #endif // MEDIA_CRYPTO_AES_DECRYPTOR_H_
OLDNEW
« no previous file with comments | « no previous file | media/crypto/aes_decryptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698