| 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_0_1>() { |
| 15 return PPB_FLASH_X509CERTIFICATE_INTERFACE_0_1; |
| 16 } |
| 17 |
| 18 } // namespace |
| 19 |
| 20 namespace flash { |
| 21 |
| 22 X509Certificate::X509Certificate() : Resource() { |
| 23 } |
| 24 |
| 25 X509Certificate::X509Certificate(PP_Resource resource) : Resource(resource) { |
| 26 } |
| 27 |
| 28 X509Certificate::X509Certificate(const InstanceHandle& instance) { |
| 29 if (has_interface<PPB_Flash_X509Certificate_0_1>()) { |
| 30 PassRefFromConstructor(get_interface<PPB_Flash_X509Certificate_0_1>()-> |
| 31 Create(instance.pp_instance())); |
| 32 } |
| 33 } |
| 34 |
| 35 // static |
| 36 bool X509Certificate::IsAvailable() { |
| 37 return has_interface<PPB_Flash_X509Certificate_0_1>(); |
| 38 } |
| 39 |
| 40 bool X509Certificate::Initialize(const char* bytes, uint32_t length) { |
| 41 if (!has_interface<PPB_Flash_X509Certificate_0_1>()) |
| 42 return false; |
| 43 PP_Bool result = get_interface<PPB_Flash_X509Certificate_0_1>()->Initialize( |
| 44 pp_resource(), |
| 45 bytes, |
| 46 length); |
| 47 return PP_ToBool(result); |
| 48 } |
| 49 |
| 50 Var X509Certificate::GetField(PP_Flash_X509Certificate_Field field) const { |
| 51 if (!has_interface<PPB_Flash_X509Certificate_0_1>()) |
| 52 return Var(); |
| 53 return Var(PassRef(), |
| 54 get_interface<PPB_Flash_X509Certificate_0_1>()->GetField(pp_resource(), |
| 55 field)); |
| 56 } |
| 57 |
| 58 } // namespace flash |
| 59 } // namespace pp |
| OLD | NEW |