OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 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_output_protection_private.idl, |
| 6 // modified Thu Aug 29 13:39:04 2013. |
| 7 |
| 8 #include "ppapi/c/pp_completion_callback.h" |
| 9 #include "ppapi/c/pp_errors.h" |
| 10 #include "ppapi/c/private/ppb_output_protection_private.h" |
| 11 #include "ppapi/shared_impl/tracked_callback.h" |
| 12 #include "ppapi/thunk/enter.h" |
| 13 #include "ppapi/thunk/ppb_instance_api.h" |
| 14 #include "ppapi/thunk/ppb_output_protection_api.h" |
| 15 #include "ppapi/thunk/resource_creation_api.h" |
| 16 #include "ppapi/thunk/thunk.h" |
| 17 |
| 18 namespace ppapi { |
| 19 namespace thunk { |
| 20 |
| 21 namespace { |
| 22 |
| 23 PP_Resource Create(PP_Instance instance) { |
| 24 VLOG(4) << "PPB_OutputProtection_Private::Create()"; |
| 25 EnterResourceCreation enter(instance); |
| 26 if (enter.failed()) |
| 27 return 0; |
| 28 return enter.functions()->CreateOutputProtectionPrivate(instance); |
| 29 } |
| 30 |
| 31 PP_Bool IsOutputProtection(PP_Resource resource) { |
| 32 VLOG(4) << "PPB_OutputProtection_Private::IsOutputProtection()"; |
| 33 EnterResource<PPB_OutputProtection_API> enter(resource, false); |
| 34 return PP_FromBool(enter.succeeded()); |
| 35 } |
| 36 |
| 37 int32_t QueryStatus(PP_Resource resource, |
| 38 uint32_t* link_mask, |
| 39 uint32_t* protection_mask, |
| 40 struct PP_CompletionCallback callback) { |
| 41 VLOG(4) << "PPB_OutputProtection_Private::QueryStatus()"; |
| 42 EnterResource<PPB_OutputProtection_API> enter(resource, callback, true); |
| 43 if (enter.failed()) |
| 44 return enter.retval(); |
| 45 return enter.SetResult(enter.object()->QueryStatus(link_mask, |
| 46 protection_mask, |
| 47 enter.callback())); |
| 48 } |
| 49 |
| 50 int32_t EnableProtection(PP_Resource resource, |
| 51 uint32_t desired_protection_mask, |
| 52 struct PP_CompletionCallback callback) { |
| 53 VLOG(4) << "PPB_OutputProtection_Private::EnableProtection()"; |
| 54 EnterResource<PPB_OutputProtection_API> enter(resource, callback, true); |
| 55 if (enter.failed()) |
| 56 return enter.retval(); |
| 57 return enter.SetResult(enter.object()->EnableProtection( |
| 58 desired_protection_mask, |
| 59 enter.callback())); |
| 60 } |
| 61 |
| 62 const PPB_OutputProtection_Private_0_1 |
| 63 g_ppb_outputprotection_private_thunk_0_1 = { |
| 64 &Create, |
| 65 &IsOutputProtection, |
| 66 &QueryStatus, |
| 67 &EnableProtection |
| 68 }; |
| 69 |
| 70 } // namespace |
| 71 |
| 72 const PPB_OutputProtection_Private_0_1* |
| 73 GetPPB_OutputProtection_Private_0_1_Thunk() { |
| 74 return &g_ppb_outputprotection_private_thunk_0_1; |
| 75 } |
| 76 |
| 77 } // namespace thunk |
| 78 } // namespace ppapi |
OLD | NEW |