1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // IPC messages for content decryption module (CDM) implementation.
6 // Multiply-included message file, hence no include guard.
11 #include "base/basictypes.h"
12 #include "content/common/content_export.h"
13 #include "content/common/media/cdm_messages_enums.h"
14 #include "ipc/ipc_message_macros.h"
15 #include "media/base/cdm_key_information.h"
16 #include "media/base/media_keys.h"
19 #undef IPC_MESSAGE_EXPORT
20 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
21 #define IPC_MESSAGE_START CdmMsgStart
23 IPC_ENUM_TRAITS_MAX_VALUE(media::CdmKeyInformation::KeyStatus
,
24 media::CdmKeyInformation::KEY_STATUS_MAX
)
25 IPC_ENUM_TRAITS_MAX_VALUE(media::MediaKeys::Exception
,
26 media::MediaKeys::EXCEPTION_MAX
)
27 IPC_ENUM_TRAITS_MAX_VALUE(media::MediaKeys::SessionType
,
28 media::MediaKeys::SESSION_TYPE_MAX
)
29 IPC_ENUM_TRAITS_MAX_VALUE(media::MediaKeys::MessageType
,
30 media::MediaKeys::MESSAGE_TYPE_MAX
)
31 IPC_ENUM_TRAITS_MAX_VALUE(CdmHostMsg_CreateSession_InitDataType
,
34 IPC_STRUCT_BEGIN(CdmHostMsg_InitializeCdm_Params
)
35 IPC_STRUCT_MEMBER(std::string
, key_system
)
36 IPC_STRUCT_MEMBER(GURL
, security_origin
)
37 IPC_STRUCT_MEMBER(bool, use_hw_secure_codecs
)
40 IPC_STRUCT_TRAITS_BEGIN(media::CdmKeyInformation
)
41 IPC_STRUCT_TRAITS_MEMBER(key_id
)
42 IPC_STRUCT_TRAITS_MEMBER(status
)
43 IPC_STRUCT_TRAITS_MEMBER(system_code
)
44 IPC_STRUCT_TRAITS_END()
46 // Parameter structure for CdmHostMsg_CreateSessionAndGenerateRequest.
47 IPC_STRUCT_BEGIN(CdmHostMsg_CreateSessionAndGenerateRequest_Params
)
48 IPC_STRUCT_MEMBER(int, render_frame_id
)
49 IPC_STRUCT_MEMBER(int, cdm_id
)
50 IPC_STRUCT_MEMBER(uint32_t, promise_id
)
51 IPC_STRUCT_MEMBER(media::MediaKeys::SessionType
, session_type
)
52 IPC_STRUCT_MEMBER(CdmHostMsg_CreateSession_InitDataType
, init_data_type
)
53 IPC_STRUCT_MEMBER(std::vector
<uint8_t>, init_data
)
57 // Messages from render to browser.
59 IPC_MESSAGE_CONTROL4(CdmHostMsg_InitializeCdm
,
60 int /* render_frame_id */,
62 uint32_t /* promise_id */,
63 CdmHostMsg_InitializeCdm_Params
/* params */)
65 IPC_MESSAGE_CONTROL4(CdmHostMsg_SetServerCertificate
,
66 int /* render_frame_id */,
68 uint32_t /* promise_id */,
69 std::vector
<uint8_t> /* certificate */)
71 IPC_MESSAGE_CONTROL1(CdmHostMsg_CreateSessionAndGenerateRequest
,
72 CdmHostMsg_CreateSessionAndGenerateRequest_Params
)
74 IPC_MESSAGE_CONTROL5(CdmHostMsg_LoadSession
,
75 int /* render_frame_id */,
77 uint32_t /* promise_id */,
78 media::MediaKeys::SessionType
/* session_type */,
79 std::string
/* session_id */)
81 IPC_MESSAGE_CONTROL5(CdmHostMsg_UpdateSession
,
82 int /* render_frame_id */,
84 uint32_t /* promise_id */,
85 std::string
/* session_id */,
86 std::vector
<uint8_t> /* response */)
88 IPC_MESSAGE_CONTROL4(CdmHostMsg_CloseSession
,
89 int /* render_frame_id */,
91 uint32_t /* promise_id */,
92 std::string
/* session_id */)
94 IPC_MESSAGE_CONTROL4(CdmHostMsg_RemoveSession
,
95 int /* render_frame_id */,
97 uint32_t /* promise_id */,
98 std::string
/* session_id */)
100 IPC_MESSAGE_CONTROL2(CdmHostMsg_DestroyCdm
,
101 int /* render_frame_id */,
104 // Messages from browser to render.
106 IPC_MESSAGE_ROUTED5(CdmMsg_SessionMessage
,
108 std::string
/* session_id */,
109 media::MediaKeys::MessageType
/* message_type */,
110 std::vector
<uint8_t> /* message */,
111 GURL
/* legacy_destination_url */)
113 IPC_MESSAGE_ROUTED2(CdmMsg_SessionClosed
,
115 std::string
/* session_id */)
117 IPC_MESSAGE_ROUTED5(CdmMsg_LegacySessionError
,
119 std::string
/* session_id */,
120 media::MediaKeys::Exception
/* exception_code */,
121 uint32_t /* system_code */,
122 std::string
/* error_message */)
124 IPC_MESSAGE_ROUTED4(CdmMsg_SessionKeysChange
,
126 std::string
/* session_id */,
127 bool /* has_additional_usable_key */,
128 std::vector
<media::CdmKeyInformation
> /* keys_info */)
130 IPC_MESSAGE_ROUTED3(CdmMsg_SessionExpirationUpdate
,
132 std::string
/* session_id */,
133 base::Time
/* new_expiry_time */)
135 IPC_MESSAGE_ROUTED2(CdmMsg_ResolvePromise
,
137 uint32_t /* promise_id */)
139 IPC_MESSAGE_ROUTED3(CdmMsg_ResolvePromiseWithSession
,
141 uint32_t /* promise_id */,
142 std::string
/* session_id */)
144 IPC_MESSAGE_ROUTED5(CdmMsg_RejectPromise
,
146 uint32_t /* promise_id */,
147 media::MediaKeys::Exception
/* exception */,
148 uint32_t /* system_code */,
149 std::string
/* error_message */)