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

Unified Diff: media/crypto/aes_decryptor.h

Issue 10539150: Add Decryptor interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and move client() to protected. Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/mock_filters.h ('k') | media/crypto/aes_decryptor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/crypto/aes_decryptor.h
diff --git a/media/crypto/aes_decryptor.h b/media/crypto/aes_decryptor.h
index 3471c53bf9b9a63580f62fc62ef2301471958e6a..37ca3cefcb062f0fbe41e655856beab6d17f666d 100644
--- a/media/crypto/aes_decryptor.h
+++ b/media/crypto/aes_decryptor.h
@@ -12,6 +12,7 @@
#include "base/memory/ref_counted.h"
#include "base/synchronization/lock.h"
#include "media/base/media_export.h"
+#include "media/crypto/decryptor.h"
namespace crypto {
class SymmetricKey;
@@ -19,58 +20,26 @@ class SymmetricKey;
namespace media {
-class DecoderBuffer;
-class DecryptorClient;
-
// Decrypts AES encrypted buffer into unencrypted buffer.
ddorwin 2012/06/18 19:07:22 Is this comment really descriptive of the class? M
xhwang 2012/06/19 01:27:23 Done.
-// All public methods other than Decrypt() will be called on the renderer
-// thread. Therefore, these calls should be fast and nonblocking, with key
-// events fired asynchronously. Decrypt() will be called on the (video/audio)
-// decoder thread synchronously.
-class MEDIA_EXPORT AesDecryptor {
+class MEDIA_EXPORT AesDecryptor : public Decryptor {
public:
- enum KeyError {
- kUnknownError = 1,
- kClientError,
- kServiceError,
- kOutputError,
- kHardwareChangeError,
- kDomainError
- };
-
- // The AesDecryptor does not take ownership of the |client|. The |client|
- // must be valid throughout the lifetime of the AesDecryptor.
explicit AesDecryptor(DecryptorClient* client);
- ~AesDecryptor();
-
- // Generates a key request. The result of this call will be reported via the
- // client's KeyMessage() or KeyError() methods.
- void GenerateKeyRequest(const std::string& key_system,
- const uint8* init_data,
- int init_data_length);
-
- // Adds a |key| to the key system. The key is not limited to a decryption key.
- // It can be any data that the key system accepts, such as a license.
- // If multiple calls of this function set different keys for the same
- // |key_id|, the older key will be replaced by the newer key.
- // The result of this call will be reported via the client's KeyAdded(),
- // KeyMessage() or KeyError() methods.
- void AddKey(const std::string& key_system,
- const uint8* key,
- int key_length,
- const uint8* init_data,
- int init_data_length,
- const std::string& session_id);
-
- // Cancels the key request specified by |session_id|.
- void CancelKeyRequest(const std::string& key_system,
- const std::string& session_id);
-
- // Decrypts the |input| buffer, which should not be NULL.
- // Returns a DecoderBuffer with the decrypted data if decryption succeeded.
- // Returns NULL if decryption failed.
- scoped_refptr<DecoderBuffer> Decrypt(
- const scoped_refptr<DecoderBuffer>& input);
+ virtual ~AesDecryptor();
+
+ // Decryptor implementation.
+ virtual void GenerateKeyRequest(const std::string& key_system,
+ const uint8* init_data,
+ int init_data_length) OVERRIDE;
+ virtual void AddKey(const std::string& key_system,
+ const uint8* key,
+ int key_length,
+ const uint8* init_data,
+ int init_data_length,
+ const std::string& session_id) OVERRIDE;
+ virtual void CancelKeyRequest(const std::string& key_system,
+ const std::string& session_id) OVERRIDE;
+ virtual scoped_refptr<DecoderBuffer> Decrypt(
+ const scoped_refptr<DecoderBuffer>& input) OVERRIDE;
private:
// KeyMap owns the crypto::SymmetricKey* and must delete them when they are
@@ -83,8 +52,6 @@ class MEDIA_EXPORT AesDecryptor {
KeyMap key_map_; // Protected by the |key_map_lock_|.
base::Lock key_map_lock_; // Protects the |key_map_|.
- DecryptorClient* client_;
-
// Make session ID unique per renderer by making it static.
// TODO(xhwang): Make session ID more strictly defined if needed:
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=16739#c0
« no previous file with comments | « media/base/mock_filters.h ('k') | media/crypto/aes_decryptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698