| 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/cpp/private/flash_x509_certificate.h" |
| 6 |
| 7 #include "ppapi/cpp/module_impl.h" |
| 8 #include "ppapi/cpp/var.h" |
| 9 |
| 10 namespace pp { |
| 11 |
| 12 namespace { |
| 13 |
| 14 template <> const char* interface_name<PPB_Flash_X509Certificate>() { |
| 15 return PPB_FLASH_X509CERTIFICATE_INTERFACE; |
| 16 } |
| 17 |
| 18 } // namespace |
| 19 |
| 20 X509Certificate::X509Certificate() : Resource() { |
| 21 } |
| 22 |
| 23 X509Certificate::X509Certificate(PP_Resource resource) : Resource(resource) { |
| 24 } |
| 25 |
| 26 X509Certificate::X509Certificate(const InstanceHandle& instance) { |
| 27 if (has_interface<PPB_Flash_X509Certificate>() && instance.pp_instance()) { |
| 28 PassRefFromConstructor(get_interface<PPB_Flash_X509Certificate>()->Create( |
| 29 instance.pp_instance())); |
| 30 } |
| 31 } |
| 32 |
| 33 // static |
| 34 bool X509Certificate::IsAvailable() { |
| 35 return has_interface<PPB_Flash_X509Certificate>(); |
| 36 } |
| 37 |
| 38 bool X509Certificate::Init(const char* bytes, uint32_t length) { |
| 39 if (!has_interface<PPB_Flash_X509Certificate>()) |
| 40 return false; |
| 41 PP_Bool result = get_interface<PPB_Flash_X509Certificate>()->Init( |
| 42 pp_resource(), |
| 43 bytes, |
| 44 length); |
| 45 return PP_ToBool(result); |
| 46 } |
| 47 |
| 48 Var X509Certificate::GetField(PP_Flash_X509Certificate_Field field) { |
| 49 if (!has_interface<PPB_Flash_X509Certificate>()) |
| 50 return Var(); |
| 51 return Var(PassRef(), |
| 52 get_interface<PPB_Flash_X509Certificate>()->GetField(pp_resource(), |
| 53 field)); |
| 54 } |
| 55 |
| 56 } // namespace pp |
| OLD | NEW |