| Index: media/base/media_keys.h
|
| diff --git a/media/base/media_keys.h b/media/base/media_keys.h
|
| index a6ef64ceee0ea8d62a4ad8e29b1401351c766963..e8d86bf05557fa6d3a02b8e7754b3202ec1a1f4e 100644
|
| --- a/media/base/media_keys.h
|
| +++ b/media/base/media_keys.h
|
| @@ -17,6 +17,9 @@ namespace media {
|
|
|
| class Decryptor;
|
|
|
| +template <typename T>
|
| +class CdmPromise;
|
| +
|
| // Performs media key operations.
|
| //
|
| // All key operations are called on the renderer thread. Therefore, these calls
|
| @@ -37,35 +40,89 @@ class MEDIA_EXPORT MediaKeys {
|
| kMaxKeyError // Must be last and greater than any legit value.
|
| };
|
|
|
| + // Must be kept in sync with cdm::MediaKeyException (enforced in
|
| + // clear_key_cdm.cc).
|
| + enum MediaKeysException {
|
| + MEDIA_KEYS_EXCEPTION_INDEX_SIZE_ERROR = 1,
|
| + // kDomstringSizeError = 2,
|
| + MEDIA_KEYS_EXCEPTION_HIERARCHY_REQUEST_ERROR = 3,
|
| + MEDIA_KEYS_EXCEPTION_WRONG_DOCUMENT_ERROR = 4,
|
| + MEDIA_KEYS_EXCEPTION_INVALID_CHARACTER_ERROR = 5,
|
| + // kNoDataAllowedError = 6,
|
| + MEDIA_KEYS_EXCEPTION_NO_MODIFICATION_ALLOWED_ERROR = 7,
|
| + MEDIA_KEYS_EXCEPTION_NOT_FOUND_ERROR = 8,
|
| + MEDIA_KEYS_EXCEPTION_NOT_SUPPORTED_ERROR = 9,
|
| + // kInuseAttributeError = 10,
|
| + MEDIA_KEYS_EXCEPTION_INVALID_STATE_ERROR = 11,
|
| + MEDIA_KEYS_EXCEPTION_SYNTAX_ERROR = 12,
|
| + MEDIA_KEYS_EXCEPTION_INVALID_MODIFICATION_ERROR = 13,
|
| + MEDIA_KEYS_EXCEPTION_NAMESPACE_ERROR = 14,
|
| + MEDIA_KEYS_EXCEPTION_INVALID_ACCESS_ERROR = 15,
|
| + // kValidationError = 16,
|
| + // kTypeMismatchError = 17,
|
| + MEDIA_KEYS_EXCEPTION_SECURITY_ERROR = 18,
|
| + MEDIA_KEYS_EXCEPTION_NETWORK_ERROR = 19,
|
| + MEDIA_KEYS_EXCEPTION_ABORT_ERROR = 20,
|
| + MEDIA_KEYS_EXCEPTION_URL_MISMATCH_ERROR = 21,
|
| + MEDIA_KEYS_EXCEPTION_QUOTA_EXCEEDED_ERROR = 22,
|
| + MEDIA_KEYS_EXCEPTION_TIMEOUT_ERROR = 23,
|
| + MEDIA_KEYS_EXCEPTION_INVALID_NODE_TYPE_ERROR = 24,
|
| + MEDIA_KEYS_EXCEPTION_DATA_CLONE_ERROR = 25,
|
| +
|
| + // Additional values from the DOM4 spec that don't have assigned codes.
|
| + MEDIA_KEYS_EXCEPTION_ENCODING_ERROR,
|
| + MEDIA_KEYS_EXCEPTION_NOT_READABLE_ERROR,
|
| +
|
| + // Additional values.
|
| + MEDIA_KEYS_EXCEPTION_DATA_ERROR,
|
| + MEDIA_KEYS_EXCEPTION_OPERATION_ERROR,
|
| + MEDIA_KEYS_EXCEPTION_VERSION_ERROR,
|
| +
|
| + // Additional values for backwards compatibility with previous versions.
|
| + MEDIA_KEYS_EXCEPTION_UNKNOWN_ERROR = 100,
|
| + MEDIA_KEYS_EXCEPTION_CLIENT_ERROR,
|
| + MEDIA_KEYS_EXCEPTION_OUTPUT_ERROR
|
| + };
|
| +
|
| + // Type of license required when creating/loading a session.
|
| + // Must be kept in sync with the values specified in the spec:
|
| + // https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted-media.html#extensions
|
| + // Must be kept in sync with cdm::SessionType (enforced in clear_key_cdm.cc).
|
| + enum SessionType {
|
| + SESSION_TYPE_TEMPORARY = 0,
|
| + SESSION_TYPE_PERSISTENT = 1
|
| + };
|
| +
|
| 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 resolved.
|
| + 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<CdmPromise<std::string> > 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 resolved.
|
| + virtual void LoadSession(const std::string& web_session_id,
|
| + scoped_ptr<CdmPromise<std::string> > 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<CdmPromise<void> > 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<CdmPromise<void> > 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 +135,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,
|
| + MediaKeys::MediaKeysException exception_code,
|
| + uint32 system_code,
|
| + const std::string& error_message)> SessionErrorCB;
|
|
|
| } // namespace media
|
|
|
|
|