Chromium Code Reviews| Index: ppapi/thunk/ppb_content_decryptor_private_thunk.cc |
| diff --git a/ppapi/thunk/ppb_content_decryptor_private_thunk.cc b/ppapi/thunk/ppb_content_decryptor_private_thunk.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..287f1dffb0f3e5b2204c0b2201a57dd864b1622f |
| --- /dev/null |
| +++ b/ppapi/thunk/ppb_content_decryptor_private_thunk.cc |
| @@ -0,0 +1,98 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "ppapi/c/private/ppb_content_decryptor_private.h" |
| +#include "ppapi/thunk/thunk.h" |
| +#include "ppapi/thunk/enter.h" |
| +#include "ppapi/thunk/ppb_instance_api.h" |
|
dmichael (off chromium)
2012/08/15 17:44:37
nit: include order
Tom Finegan
2012/08/16 03:10:48
Done.
|
| + |
| +namespace ppapi { |
| +namespace thunk { |
| + |
| +namespace { |
| + |
| +void NeedKey(PP_Instance instance, |
| + PP_Var key_system, |
| + PP_Var session_id, |
| + PP_Var init_data) { |
| + EnterInstance enter(instance); |
| + if (enter.succeeded()) |
| + enter.functions()->NeedKey(instance, key_system, session_id, init_data); |
| +} |
| + |
| +void KeyAdded(PP_Instance instance, |
| + PP_Var key_system, |
| + PP_Var session_id) { |
| + EnterInstance enter(instance); |
| + if (enter.succeeded()) |
| + enter.functions()->KeyAdded(instance, key_system, session_id); |
| +} |
| + |
| +void KeyMessage(PP_Instance instance, |
| + PP_Var key_system, |
| + PP_Var session_id, |
| + PP_Resource message, |
| + PP_Var default_url) { |
| + EnterInstance enter(instance); |
| + if (enter.succeeded()) { |
| + enter.functions()->KeyMessage(instance, key_system, session_id, message, |
| + default_url); |
| + } |
| +} |
| + |
| +void KeyError(PP_Instance instance, |
| + PP_Var key_system, |
| + PP_Var session_id, |
| + int32_t media_error, |
| + int32_t system_code) { |
| + EnterInstance enter(instance); |
| + if (enter.succeeded()) { |
| + enter.functions()->KeyError(instance, key_system, session_id, media_error, |
| + system_code); |
| + } |
| +} |
| + |
| +void DeliverBlock(PP_Instance instance, |
| + PP_Resource decrypted_block, |
| + int32_t request_id) { |
| + EnterInstance enter(instance); |
| + if (enter.succeeded()) |
| + enter.functions()->DeliverBlock(instance, decrypted_block, request_id); |
| +} |
| + |
| +void DeliverFrame(PP_Instance instance, |
| + PP_Resource decrypted_frame, |
| + int32_t request_id) { |
| + EnterInstance enter(instance); |
| + if (enter.succeeded()) |
| + enter.functions()->DeliverFrame(instance, decrypted_frame, request_id); |
| +} |
| + |
| +void DeliverSamples(PP_Instance instance, |
| + PP_Resource decrypted_samples, |
| + int32_t request_id) { |
| + EnterInstance enter(instance); |
| + if (enter.succeeded()) |
| + enter.functions()->DeliverSamples(instance, decrypted_samples, request_id); |
| +} |
| + |
| +const PPB_ContentDecryptor_Private g_ppb_decryption_thunk = { |
| + &NeedKey, |
| + &KeyAdded, |
| + &KeyMessage, |
| + &KeyError, |
| + &DeliverBlock, |
| + &DeliverFrame, |
| + &DeliverSamples |
| +}; |
| + |
| +} // namespace |
| + |
| +const PPB_ContentDecryptor_Private* |
| + GetPPB_ContentDecryptor_Private_0_1_Thunk() { |
| + return &g_ppb_decryption_thunk; |
| +} |
| + |
| +} // namespace thunk |
| +} // namespace ppapi |