summaryrefslogtreecommitdiff
path: root/media/base/media_keys.h
diff options
context:
space:
mode:
authorTorne (Richard Coles) <torne@google.com>2013-11-28 11:55:43 +0000
committerTorne (Richard Coles) <torne@google.com>2013-11-28 11:55:43 +0000
commitf2477e01787aa58f445919b809d89e252beef54f (patch)
tree2db962b4af39f0db3a5f83b314373d0530c484b8 /media/base/media_keys.h
parent7daea1dd5ff7e419322de831b642d81af3247912 (diff)
downloadchromium_org-f2477e01787aa58f445919b809d89e252beef54f.tar.gz
Merge from Chromium at DEPS revision 237746
This commit was generated by merge_to_master.py. Change-Id: I8997af4cddfeb09a7c26f7e8e672c712cab461ea
Diffstat (limited to 'media/base/media_keys.h')
-rw-r--r--media/base/media_keys.h31
1 files changed, 21 insertions, 10 deletions
diff --git a/media/base/media_keys.h b/media/base/media_keys.h
index c0fc56af34..743d71459b 100644
--- a/media/base/media_keys.h
+++ b/media/base/media_keys.h
@@ -24,7 +24,7 @@ class Decryptor;
class MEDIA_EXPORT MediaKeys {
public:
// Reported to UMA, so never reuse a value!
- // Must be kept in sync with WebKit::WebMediaPlayerClient::MediaKeyErrorCode
+ // Must be kept in sync with blink::WebMediaPlayerClient::MediaKeyErrorCode
// (enforced in webmediaplayer_impl.cc).
enum KeyError {
kUnknownError = 1,
@@ -37,6 +37,8 @@ class MEDIA_EXPORT MediaKeys {
kMaxKeyError // Must be last and greater than any legit value.
};
+ const static uint32 kInvalidReferenceId = 0;
+
MediaKeys();
virtual ~MediaKeys();
@@ -44,7 +46,8 @@ class MEDIA_EXPORT MediaKeys {
// Returns true if generating key request succeeded, false otherwise.
// Note: AddKey() and CancelKeyRequest() should only be called after
// GenerateKeyRequest() returns true.
- virtual bool GenerateKeyRequest(const std::string& type,
+ virtual bool GenerateKeyRequest(uint32 reference_id,
+ const std::string& type,
const uint8* init_data,
int init_data_length) = 0;
@@ -52,12 +55,14 @@ class MEDIA_EXPORT MediaKeys {
// 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.
- virtual void AddKey(const uint8* key, int key_length,
- const uint8* init_data, int init_data_length,
- const std::string& session_id) = 0;
+ virtual void AddKey(uint32 reference_id,
+ const uint8* key,
+ int key_length,
+ const uint8* init_data,
+ int init_data_length) = 0;
- // Cancels the key request specified by |session_id|.
- virtual void CancelKeyRequest(const std::string& session_id) = 0;
+ // Cancels the key request specified by |reference_id|.
+ virtual void CancelKeyRequest(uint32 reference_id) = 0;
// Gets the Decryptor object associated with the MediaKeys. Returns NULL if
// no Decryptor object is associated. The returned object is only guaranteed
@@ -70,15 +75,21 @@ class MEDIA_EXPORT MediaKeys {
// Key event callbacks. See the spec for details:
// http://dvcs.w3.org/hg/html-media/raw-file/eme-v0.1b/encrypted-media/encrypted-media.html#event-summary
-typedef base::Callback<void(const std::string& session_id)> KeyAddedCB;
+typedef base::Callback<void(uint32 reference_id)> KeyAddedCB;
-typedef base::Callback<void(const std::string& session_id,
+typedef base::Callback<void(uint32 reference_id,
media::MediaKeys::KeyError error_code,
int system_code)> KeyErrorCB;
-typedef base::Callback<void(const std::string& session_id,
+typedef base::Callback<void(uint32 reference_id,
const std::vector<uint8>& message,
const std::string& default_url)> KeyMessageCB;
+
+// Called by the CDM when it generates the |session_id| as a result of a
+// GenerateKeyRequest() call. Must be called before KeyMessageCB or KeyAddedCB
+// events are fired.
+typedef base::Callback<void(uint32 reference_id,
+ const std::string& session_id)> SetSessionIdCB;
} // namespace media
#endif // MEDIA_BASE_MEDIA_KEYS_H_