| Index: content/browser/media/cdm/browser_cdm_manager.h
|
| diff --git a/content/browser/media/cdm/browser_cdm_manager.h b/content/browser/media/cdm/browser_cdm_manager.h
|
| index f15ccf37af22641021e1722c746b6cd6f34fa352..10fba1c6402066d3f95ee795c9bf427ffa1aa069 100644
|
| --- a/content/browser/media/cdm/browser_cdm_manager.h
|
| +++ b/content/browser/media/cdm/browser_cdm_manager.h
|
| @@ -17,7 +17,7 @@
|
| #include "content/common/media/cdm_messages_enums.h"
|
| #include "content/public/browser/browser_message_filter.h"
|
| #include "ipc/ipc_message.h"
|
| -// TODO(xhwang): Drop this when KeyError is moved to a common header.
|
| +#include "media/base/cdm_promise.h"
|
| #include "media/base/media_keys.h"
|
| #include "url/gurl.h"
|
|
|
| @@ -57,6 +57,19 @@ class CONTENT_EXPORT BrowserCdmManager : public BrowserMessageFilter {
|
| // destroy the CDM will not be received.
|
| void RenderFrameDeleted(int render_frame_id);
|
|
|
| + // Promise handlers.
|
| + template <typename... T>
|
| + void ResolvePromise(int render_frame_id,
|
| + int cdm_id,
|
| + uint32_t promise_id,
|
| + const T&... result);
|
| + void RejectPromise(int render_frame_id,
|
| + int cdm_id,
|
| + uint32_t promise_id,
|
| + media::MediaKeys::Exception exception,
|
| + uint32_t system_code,
|
| + const std::string& error_message);
|
| +
|
| protected:
|
| friend class base::RefCountedThreadSafe<BrowserCdmManager>;
|
| friend class base::DeleteHelper<BrowserCdmManager>;
|
| @@ -64,43 +77,57 @@ class CONTENT_EXPORT BrowserCdmManager : public BrowserMessageFilter {
|
|
|
| private:
|
| // CDM callbacks.
|
| - void OnSessionCreated(int render_frame_id,
|
| - int cdm_id,
|
| - uint32 session_id,
|
| - const std::string& web_session_id);
|
| void OnSessionMessage(int render_frame_id,
|
| int cdm_id,
|
| - uint32 session_id,
|
| + const std::string& session_id,
|
| + media::MediaKeys::MessageType message_type,
|
| const std::vector<uint8>& message,
|
| - const GURL& destination_url);
|
| - void OnSessionReady(int render_frame_id, int cdm_id, uint32 session_id);
|
| - void OnSessionClosed(int render_frame_id, int cdm_id, uint32 session_id);
|
| - void OnSessionError(int render_frame_id,
|
| - int cdm_id,
|
| - uint32 session_id,
|
| - media::MediaKeys::KeyError error_code,
|
| - uint32 system_code);
|
| + const GURL& legacy_destination_url);
|
| + void OnSessionClosed(int render_frame_id,
|
| + int cdm_id,
|
| + const std::string& session_id);
|
| + void OnLegacySessionError(int render_frame_id,
|
| + int cdm_id,
|
| + const std::string& session_id,
|
| + media::MediaKeys::Exception exception_code,
|
| + uint32_t system_code,
|
| + const std::string& error_message);
|
| + void OnSessionKeysChange(int render_frame_id,
|
| + int cdm_id,
|
| + const std::string& session_id,
|
| + bool has_additional_usable_key,
|
| + media::CdmKeysInfo keys_info);
|
| + void OnSessionExpirationUpdate(int render_frame_id,
|
| + int cdm_id,
|
| + const std::string& session_id,
|
| + const base::Time& new_expiry_time);
|
|
|
| // Message handlers.
|
| void OnInitializeCdm(int render_frame_id,
|
| int cdm_id,
|
| const std::string& key_system,
|
| const GURL& frame_url);
|
| - void OnCreateSession(int render_frame_id,
|
| - int cdm_id,
|
| - uint32 session_id,
|
| - CdmHostMsg_CreateSession_ContentType content_type,
|
| - const std::vector<uint8>& init_data);
|
| + void OnSetServerCertificate(int render_frame_id,
|
| + int cdm_id,
|
| + uint32_t promise_id,
|
| + const std::vector<uint8_t>& certificate);
|
| + void OnCreateSessionAndGenerateRequest(
|
| + int render_frame_id,
|
| + int cdm_id,
|
| + uint32_t promise_id,
|
| + CdmHostMsg_CreateSession_InitDataType init_data_type,
|
| + const std::vector<uint8>& init_data);
|
| void OnUpdateSession(int render_frame_id,
|
| int cdm_id,
|
| - uint32 session_id,
|
| + uint32_t promise_id,
|
| + const std::string& session_id,
|
| const std::vector<uint8>& response);
|
| - void OnReleaseSession(int render_frame_id,
|
| - int cdm_id, uint32 session_id);
|
| + void OnCloseSession(int render_frame_id,
|
| + int cdm_id,
|
| + uint32_t promise_id,
|
| + const std::string& session_id);
|
| void OnDestroyCdm(int render_frame_id, int cdm_id);
|
|
|
| - void SendSessionError(int render_frame_id, int cdm_id, uint32 session_id);
|
| -
|
| // Adds a new CDM identified by |cdm_id| for the given |key_system| and
|
| // |security_origin|.
|
| void AddCdm(int render_frame_id,
|
| @@ -115,24 +142,26 @@ class CONTENT_EXPORT BrowserCdmManager : public BrowserMessageFilter {
|
| void RemoveCdm(uint64 id);
|
|
|
| // Requests permission for the given protected-media session (infobar).
|
| - void RequestSessionPermission(int render_frame_id,
|
| - const GURL& security_origin,
|
| - int cdm_id,
|
| - uint32 session_id,
|
| - const std::string& content_type,
|
| - const std::vector<uint8>& init_data);
|
| + void RequestSessionPermission(
|
| + int render_frame_id,
|
| + const GURL& security_origin,
|
| + int cdm_id,
|
| + const std::string& init_data_type,
|
| + const std::vector<uint8>& init_data,
|
| + scoped_ptr<media::NewSessionCdmPromise> promise);
|
|
|
| // If |permitted| is false, it does nothing but send
|
| - // |CdmMsg_SessionError| IPC message.
|
| + // |CdmMsg_LegacySessionError| IPC message.
|
| // The primary use case is infobar permission callback, i.e., when infobar
|
| // can decide user's intention either from interacting with the actual info
|
| // bar or from the saved preference.
|
| - void CreateSessionIfPermitted(int render_frame_id,
|
| - int cdm_id,
|
| - uint32 session_id,
|
| - const std::string& content_type,
|
| - const std::vector<uint8>& init_data,
|
| - bool permitted);
|
| + void GenerateRequestIfPermitted(
|
| + int render_frame_id,
|
| + int cdm_id,
|
| + const std::string& init_data_type,
|
| + const std::vector<uint8>& init_data,
|
| + scoped_ptr<media::NewSessionCdmPromise> promise,
|
| + bool permitted);
|
|
|
| const int render_process_id_;
|
|
|
|
|