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_platform_verification_private.idl, |
| 6 // modified Thu Sep 5 17:37:17 2013. |
| 7 |
| 8 #include "ppapi/c/pp_completion_callback.h" |
| 9 #include "ppapi/c/pp_errors.h" |
| 10 #include "ppapi/c/private/ppb_platform_verification_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_platform_verification_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_PlatformVerification_Private::Create()"; |
| 25 EnterResourceCreation enter(instance); |
| 26 if (enter.failed()) |
| 27 return 0; |
| 28 return enter.functions()->CreatePlatformVerificationPrivate(instance); |
| 29 } |
| 30 |
| 31 PP_Bool IsPlatformVerification(PP_Resource resource) { |
| 32 VLOG(4) << "PPB_PlatformVerification_Private::IsPlatformVerification()"; |
| 33 EnterResource<PPB_PlatformVerification_API> enter(resource, false); |
| 34 return PP_FromBool(enter.succeeded()); |
| 35 } |
| 36 |
| 37 PP_Bool CanChallengePlatform(PP_Resource instance) { |
| 38 VLOG(4) << "PPB_PlatformVerification_Private::CanChallengePlatform()"; |
| 39 EnterResource<PPB_PlatformVerification_API> enter(instance, true); |
| 40 if (enter.failed()) |
| 41 return PP_FALSE; |
| 42 return enter.object()->CanChallengePlatform(); |
| 43 } |
| 44 |
| 45 int32_t ChallengePlatform(PP_Resource instance, |
| 46 struct PP_Var service_id, |
| 47 struct PP_Var challenge, |
| 48 struct PP_Var* signed_data, |
| 49 struct PP_Var* signed_data_signature, |
| 50 struct PP_Var* platform_key_certificate, |
| 51 struct PP_CompletionCallback callback) { |
| 52 VLOG(4) << "PPB_PlatformVerification_Private::ChallengePlatform()"; |
| 53 EnterResource<PPB_PlatformVerification_API> enter(instance, callback, true); |
| 54 if (enter.failed()) |
| 55 return enter.retval(); |
| 56 return enter.SetResult(enter.object()->ChallengePlatform( |
| 57 service_id, |
| 58 challenge, |
| 59 signed_data, |
| 60 signed_data_signature, |
| 61 platform_key_certificate, |
| 62 enter.callback())); |
| 63 } |
| 64 |
| 65 const PPB_PlatformVerification_Private_0_1 |
| 66 g_ppb_platformverification_private_thunk_0_1 = { |
| 67 &Create, |
| 68 &IsPlatformVerification, |
| 69 &CanChallengePlatform, |
| 70 &ChallengePlatform |
| 71 }; |
| 72 |
| 73 } // namespace |
| 74 |
| 75 const PPB_PlatformVerification_Private_0_1* |
| 76 GetPPB_PlatformVerification_Private_0_1_Thunk() { |
| 77 return &g_ppb_platformverification_private_thunk_0_1; |
| 78 } |
| 79 |
| 80 } // namespace thunk |
| 81 } // namespace ppapi |
OLD | NEW |