Chromium Code Reviews| Index: media/base/media_keys.h |
| diff --git a/media/base/media_keys.h b/media/base/media_keys.h |
| index a6ef64ceee0ea8d62a4ad8e29b1401351c766963..5dbb720f909a55b94ade542187328c55188ecfd9 100644 |
| --- a/media/base/media_keys.h |
| +++ b/media/base/media_keys.h |
| @@ -12,6 +12,7 @@ |
| #include "base/callback.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "media/base/media_export.h" |
| +#include "media/base/media_keys_session_promise.h" |
| namespace media { |
| @@ -37,35 +38,43 @@ class MEDIA_EXPORT MediaKeys { |
| kMaxKeyError // Must be last and greater than any legit value. |
| }; |
| + // Type of license required when creating/loading a session. |
| + // Must be kept in sync with |
|
ddorwin
2014/05/05 18:35:42
incomplete
jrummell
2014/05/08 23:37:45
Done.
|
| + enum SessionType { |
| + kTemporary = 0, |
| + kPersistent = 1 |
|
xhwang
2014/05/05 20:46:42
We should use UPPER_CASE for enums. Sorry that Key
jrummell
2014/05/08 23:37:45
Done.
|
| + }; |
| + |
| const static uint32 kInvalidSessionId = 0; |
| MediaKeys(); |
| virtual ~MediaKeys(); |
| - // Creates a session with the |content_type| and |init_data| provided. |
| - // Returns true if a session is successfully created, false otherwise. |
| + // Creates a session with the |init_data_type|, |init_data| and |session_type| |
| + // provided. |
| // Note: UpdateSession() and ReleaseSession() should only be called after |
| - // SessionCreatedCB is fired. |
| - // TODO(jrummell): Remove return value when prefixed API is removed. |
| - // See http://crbug.com/342510 |
| - virtual bool CreateSession(uint32 session_id, |
| - const std::string& content_type, |
| + // |promise| is fired. |
|
ddorwin
2014/05/05 18:35:42
s/fired/resolved/. (It would not be okay to call a
jrummell
2014/05/08 23:37:45
Done.
|
| + virtual void CreateSession(const std::string& init_data_type, |
| const uint8* init_data, |
| - int init_data_length) = 0; |
| + int init_data_length, |
| + SessionType session_type, |
| + scoped_ptr<MediaKeysSessionPromise> promise) = 0; |
| // Loads a session with the |web_session_id| provided. |
| // Note: UpdateSession() and ReleaseSession() should only be called after |
| - // SessionCreatedCB is fired. |
| - virtual void LoadSession(uint32 session_id, |
| - const std::string& web_session_id) = 0; |
| + // |promise| is fired. |
|
ddorwin
2014/05/05 18:35:42
ditto
jrummell
2014/05/08 23:37:45
Done.
|
| + virtual void LoadSession(const std::string& web_session_id, |
| + scoped_ptr<MediaKeysSessionPromise> promise) = 0; |
| - // Updates a session specified by |session_id| with |response|. |
| - virtual void UpdateSession(uint32 session_id, |
| + // Updates a session specified by |web_session_id| with |response|. |
| + virtual void UpdateSession(const std::string& web_session_id, |
| const uint8* response, |
| - int response_length) = 0; |
| + int response_length, |
| + scoped_ptr<MediaKeysSessionPromise> promise) = 0; |
| - // Releases the session specified by |session_id|. |
| - virtual void ReleaseSession(uint32 session_id) = 0; |
| + // Releases the session specified by |web_session_id|. |
| + virtual void ReleaseSession(const std::string& web_session_id, |
| + scoped_ptr<MediaKeysSessionPromise> promise) = 0; |
| // Gets the Decryptor object associated with the MediaKeys. Returns NULL if |
| // no Decryptor object is associated. The returned object is only guaranteed |
| @@ -78,22 +87,19 @@ class MEDIA_EXPORT MediaKeys { |
| // Key event callbacks. See the spec for details: |
| // https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted-media.html#event-summary |
| -typedef base::Callback< |
| - void(uint32 session_id, const std::string& web_session_id)> |
| - SessionCreatedCB; |
| - |
| -typedef base::Callback<void(uint32 session_id, |
| +typedef base::Callback<void(const std::string& web_session_id, |
| const std::vector<uint8>& message, |
| const std::string& destination_url)> |
| SessionMessageCB; |
| -typedef base::Callback<void(uint32 session_id)> SessionReadyCB; |
| +typedef base::Callback<void(const std::string& web_session_id)> SessionReadyCB; |
| -typedef base::Callback<void(uint32 session_id)> SessionClosedCB; |
| +typedef base::Callback<void(const std::string& web_session_id)> SessionClosedCB; |
| -typedef base::Callback<void(uint32 session_id, |
| - media::MediaKeys::KeyError error_code, |
| - uint32 system_code)> SessionErrorCB; |
| +typedef base::Callback<void(const std::string& web_session_id, |
| + const std::string& error_name, |
| + uint32 system_code, |
| + const std::string& error_message)> SessionErrorCB; |
| } // namespace media |