| OLD | NEW |
| (Empty) | |
| 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 #include "ppapi/c/pp_errors.h" |
| 6 #include "ppapi/c/private/ppb_flash_x509_certificate.h" |
| 7 #include "ppapi/thunk/enter.h" |
| 8 #include "ppapi/thunk/ppb_flash_x509_certificate_api.h" |
| 9 #include "ppapi/thunk/thunk.h" |
| 10 #include "ppapi/thunk/resource_creation_api.h" |
| 11 |
| 12 namespace ppapi { |
| 13 namespace thunk { |
| 14 |
| 15 namespace { |
| 16 |
| 17 typedef EnterResource<PPB_Flash_X509Certificate_API> EnterFlashX509Certificate; |
| 18 |
| 19 PP_Resource Create(PP_Instance instance) { |
| 20 EnterFunction<ResourceCreationAPI> enter(instance, true); |
| 21 if (enter.failed()) |
| 22 return 0; |
| 23 return enter.functions()->CreateX509Certificate(instance); |
| 24 } |
| 25 |
| 26 PP_Bool IsFlashX509Certificate(PP_Resource resource) { |
| 27 EnterFlashX509Certificate enter(resource, false); |
| 28 return PP_FromBool(enter.succeeded()); |
| 29 } |
| 30 |
| 31 PP_Bool Init(PP_Resource certificate, |
| 32 const char *bytes, |
| 33 uint32_t length) { |
| 34 EnterFlashX509Certificate enter(certificate, true); |
| 35 if (enter.failed()) |
| 36 return PP_FALSE; |
| 37 return enter.object()->Init(bytes, length); |
| 38 } |
| 39 |
| 40 PP_Var GetField(PP_Resource certificate, |
| 41 PP_Flash_X509Certificate_Field field) { |
| 42 EnterFlashX509Certificate enter(certificate, true); |
| 43 if (enter.failed()) |
| 44 return PP_MakeUndefined(); |
| 45 return enter.object()->GetField(field); |
| 46 } |
| 47 |
| 48 const PPB_Flash_X509Certificate g_ppb_x509_certificate_thunk = { |
| 49 &Create, |
| 50 &IsFlashX509Certificate, |
| 51 &Init, |
| 52 &GetField |
| 53 }; |
| 54 |
| 55 } // namespace |
| 56 |
| 57 const PPB_Flash_X509Certificate_0_1* GetPPB_Flash_X509Certificate_0_1_Thunk() { |
| 58 return &g_ppb_x509_certificate_thunk; |
| 59 } |
| 60 |
| 61 } // namespace thunk |
| 62 } // namespace ppapi |
| OLD | NEW |