Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / ppapi / thunk / ppb_content_decryptor_private_thunk.cc
1 // Copyright (c) 2012 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.
4
5 // From private/ppb_content_decryptor_private.idl modified Wed Nov  5 14:29:15
6 // 2014.
7
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/private/ppb_content_decryptor_private.h"
10 #include "ppapi/shared_impl/tracked_callback.h"
11 #include "ppapi/thunk/enter.h"
12 #include "ppapi/thunk/ppapi_thunk_export.h"
13
14 namespace ppapi {
15 namespace thunk {
16
17 namespace {
18
19 void PromiseResolved(PP_Instance instance, uint32_t promise_id) {
20   VLOG(4) << "PPB_ContentDecryptor_Private::PromiseResolved()";
21   EnterInstance enter(instance);
22   if (enter.failed())
23     return;
24   enter.functions()->PromiseResolved(instance, promise_id);
25 }
26
27 void PromiseResolvedWithSession(PP_Instance instance,
28                                 uint32_t promise_id,
29                                 struct PP_Var web_session_id) {
30   VLOG(4) << "PPB_ContentDecryptor_Private::PromiseResolvedWithSession()";
31   EnterInstance enter(instance);
32   if (enter.failed())
33     return;
34   enter.functions()->PromiseResolvedWithSession(instance, promise_id,
35                                                 web_session_id);
36 }
37
38 void PromiseResolvedWithKeyIds(PP_Instance instance,
39                                uint32_t promise_id,
40                                struct PP_Var key_ids_array) {
41   VLOG(4) << "PPB_ContentDecryptor_Private::PromiseResolvedWithKeyIds()";
42   EnterInstance enter(instance);
43   if (enter.failed())
44     return;
45   enter.functions()->PromiseResolvedWithKeyIds(instance, promise_id,
46                                                key_ids_array);
47 }
48
49 void PromiseRejected(PP_Instance instance,
50                      uint32_t promise_id,
51                      PP_CdmExceptionCode exception_code,
52                      uint32_t system_code,
53                      struct PP_Var error_description) {
54   VLOG(4) << "PPB_ContentDecryptor_Private::PromiseRejected()";
55   EnterInstance enter(instance);
56   if (enter.failed())
57     return;
58   enter.functions()->PromiseRejected(instance, promise_id, exception_code,
59                                      system_code, error_description);
60 }
61
62 void SessionMessage(PP_Instance instance,
63                     struct PP_Var web_session_id,
64                     struct PP_Var message,
65                     struct PP_Var destination_url) {
66   VLOG(4) << "PPB_ContentDecryptor_Private::SessionMessage()";
67   EnterInstance enter(instance);
68   if (enter.failed())
69     return;
70   enter.functions()->SessionMessage(instance, web_session_id, message,
71                                     destination_url);
72 }
73
74 void SessionKeysChange(PP_Instance instance,
75                        struct PP_Var web_session_id,
76                        PP_Bool has_additional_usable_key) {
77   VLOG(4) << "PPB_ContentDecryptor_Private::SessionKeysChange()";
78   EnterInstance enter(instance);
79   if (enter.failed())
80     return;
81   enter.functions()->SessionKeysChange(instance, web_session_id,
82                                        has_additional_usable_key);
83 }
84
85 void SessionExpirationChange(PP_Instance instance,
86                              struct PP_Var web_session_id,
87                              PP_Time new_expiry_time) {
88   VLOG(4) << "PPB_ContentDecryptor_Private::SessionExpirationChange()";
89   EnterInstance enter(instance);
90   if (enter.failed())
91     return;
92   enter.functions()->SessionExpirationChange(instance, web_session_id,
93                                              new_expiry_time);
94 }
95
96 void SessionReady(PP_Instance instance, struct PP_Var web_session_id) {
97   VLOG(4) << "PPB_ContentDecryptor_Private::SessionReady()";
98   EnterInstance enter(instance);
99   if (enter.failed())
100     return;
101   enter.functions()->SessionReady(instance, web_session_id);
102 }
103
104 void SessionClosed(PP_Instance instance, struct PP_Var web_session_id) {
105   VLOG(4) << "PPB_ContentDecryptor_Private::SessionClosed()";
106   EnterInstance enter(instance);
107   if (enter.failed())
108     return;
109   enter.functions()->SessionClosed(instance, web_session_id);
110 }
111
112 void SessionError(PP_Instance instance,
113                   struct PP_Var web_session_id,
114                   PP_CdmExceptionCode exception_code,
115                   uint32_t system_code,
116                   struct PP_Var error_description) {
117   VLOG(4) << "PPB_ContentDecryptor_Private::SessionError()";
118   EnterInstance enter(instance);
119   if (enter.failed())
120     return;
121   enter.functions()->SessionError(instance, web_session_id, exception_code,
122                                   system_code, error_description);
123 }
124
125 void DeliverBlock(PP_Instance instance,
126                   PP_Resource decrypted_block,
127                   const struct PP_DecryptedBlockInfo* decrypted_block_info) {
128   VLOG(4) << "PPB_ContentDecryptor_Private::DeliverBlock()";
129   EnterInstance enter(instance);
130   if (enter.failed())
131     return;
132   enter.functions()->DeliverBlock(instance, decrypted_block,
133                                   decrypted_block_info);
134 }
135
136 void DecoderInitializeDone(PP_Instance instance,
137                            PP_DecryptorStreamType decoder_type,
138                            uint32_t request_id,
139                            PP_Bool success) {
140   VLOG(4) << "PPB_ContentDecryptor_Private::DecoderInitializeDone()";
141   EnterInstance enter(instance);
142   if (enter.failed())
143     return;
144   enter.functions()->DecoderInitializeDone(instance, decoder_type, request_id,
145                                            success);
146 }
147
148 void DecoderDeinitializeDone(PP_Instance instance,
149                              PP_DecryptorStreamType decoder_type,
150                              uint32_t request_id) {
151   VLOG(4) << "PPB_ContentDecryptor_Private::DecoderDeinitializeDone()";
152   EnterInstance enter(instance);
153   if (enter.failed())
154     return;
155   enter.functions()->DecoderDeinitializeDone(instance, decoder_type,
156                                              request_id);
157 }
158
159 void DecoderResetDone(PP_Instance instance,
160                       PP_DecryptorStreamType decoder_type,
161                       uint32_t request_id) {
162   VLOG(4) << "PPB_ContentDecryptor_Private::DecoderResetDone()";
163   EnterInstance enter(instance);
164   if (enter.failed())
165     return;
166   enter.functions()->DecoderResetDone(instance, decoder_type, request_id);
167 }
168
169 void DeliverFrame(PP_Instance instance,
170                   PP_Resource decrypted_frame,
171                   const struct PP_DecryptedFrameInfo* decrypted_frame_info) {
172   VLOG(4) << "PPB_ContentDecryptor_Private::DeliverFrame()";
173   EnterInstance enter(instance);
174   if (enter.failed())
175     return;
176   enter.functions()->DeliverFrame(instance, decrypted_frame,
177                                   decrypted_frame_info);
178 }
179
180 void DeliverSamples(
181     PP_Instance instance,
182     PP_Resource audio_frames,
183     const struct PP_DecryptedSampleInfo* decrypted_sample_info) {
184   VLOG(4) << "PPB_ContentDecryptor_Private::DeliverSamples()";
185   EnterInstance enter(instance);
186   if (enter.failed())
187     return;
188   enter.functions()->DeliverSamples(instance, audio_frames,
189                                     decrypted_sample_info);
190 }
191
192 const PPB_ContentDecryptor_Private_0_12
193     g_ppb_contentdecryptor_private_thunk_0_12 = {&PromiseResolved,
194                                                  &PromiseResolvedWithSession,
195                                                  &PromiseResolvedWithKeyIds,
196                                                  &PromiseRejected,
197                                                  &SessionMessage,
198                                                  &SessionKeysChange,
199                                                  &SessionExpirationChange,
200                                                  &SessionReady,
201                                                  &SessionClosed,
202                                                  &SessionError,
203                                                  &DeliverBlock,
204                                                  &DecoderInitializeDone,
205                                                  &DecoderDeinitializeDone,
206                                                  &DecoderResetDone,
207                                                  &DeliverFrame,
208                                                  &DeliverSamples};
209
210 }  // namespace
211
212 PPAPI_THUNK_EXPORT const PPB_ContentDecryptor_Private_0_12*
213 GetPPB_ContentDecryptor_Private_0_12_Thunk() {
214   return &g_ppb_contentdecryptor_private_thunk_0_12;
215 }
216
217 }  // namespace thunk
218 }  // namespace ppapi