| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ppapi/cpp/private/x509_certificate_private.h" | 5 #include "ppapi/cpp/private/x509_certificate_private.h" |
| 6 | 6 |
| 7 #include "ppapi/cpp/module_impl.h" | 7 #include "ppapi/cpp/module_impl.h" |
| 8 #include "ppapi/cpp/pass_ref.h" |
| 8 #include "ppapi/cpp/var.h" | 9 #include "ppapi/cpp/var.h" |
| 9 | 10 |
| 10 namespace pp { | 11 namespace pp { |
| 11 | 12 |
| 12 namespace { | 13 namespace { |
| 13 | 14 |
| 14 template <> const char* interface_name<PPB_X509Certificate_Private_0_1>() { | 15 template <> const char* interface_name<PPB_X509Certificate_Private_0_1>() { |
| 15 return PPB_X509CERTIFICATE_PRIVATE_INTERFACE_0_1; | 16 return PPB_X509CERTIFICATE_PRIVATE_INTERFACE_0_1; |
| 16 } | 17 } |
| 17 | 18 |
| 18 } // namespace | 19 } // namespace |
| 19 | 20 |
| 20 X509Certificate::X509Certificate() : Resource() { | 21 X509CertificatePrivate::X509CertificatePrivate() : Resource() {} |
| 22 |
| 23 X509CertificatePrivate::X509CertificatePrivate(PassRef, PP_Resource resource) |
| 24 : Resource(PASS_REF, resource) { |
| 21 } | 25 } |
| 22 | 26 |
| 23 X509Certificate::X509Certificate(PP_Resource resource) : Resource(resource) { | 27 X509CertificatePrivate::X509CertificatePrivate(const InstanceHandle& instance) { |
| 24 } | |
| 25 | |
| 26 X509Certificate::X509Certificate(const InstanceHandle& instance) { | |
| 27 if (has_interface<PPB_X509Certificate_Private_0_1>()) { | 28 if (has_interface<PPB_X509Certificate_Private_0_1>()) { |
| 28 PassRefFromConstructor(get_interface<PPB_X509Certificate_Private_0_1>()-> | 29 PassRefFromConstructor(get_interface<PPB_X509Certificate_Private_0_1>()-> |
| 29 Create(instance.pp_instance())); | 30 Create(instance.pp_instance())); |
| 30 } | 31 } |
| 31 } | 32 } |
| 32 | 33 |
| 33 // static | 34 // static |
| 34 bool X509Certificate::IsAvailable() { | 35 bool X509CertificatePrivate::IsAvailable() { |
| 35 return has_interface<PPB_X509Certificate_Private_0_1>(); | 36 return has_interface<PPB_X509Certificate_Private_0_1>(); |
| 36 } | 37 } |
| 37 | 38 |
| 38 bool X509Certificate::Initialize(const char* bytes, uint32_t length) { | 39 bool X509CertificatePrivate::Initialize(const char* bytes, uint32_t length) { |
| 39 if (!has_interface<PPB_X509Certificate_Private_0_1>()) | 40 if (!has_interface<PPB_X509Certificate_Private_0_1>()) |
| 40 return false; | 41 return false; |
| 41 PP_Bool result = get_interface<PPB_X509Certificate_Private_0_1>()->Initialize( | 42 PP_Bool result = get_interface<PPB_X509Certificate_Private_0_1>()->Initialize( |
| 42 pp_resource(), | 43 pp_resource(), |
| 43 bytes, | 44 bytes, |
| 44 length); | 45 length); |
| 45 return PP_ToBool(result); | 46 return PP_ToBool(result); |
| 46 } | 47 } |
| 47 | 48 |
| 48 Var X509Certificate::GetField(PP_X509Certificate_Private_Field field) const { | 49 Var X509CertificatePrivate::GetField( |
| 50 PP_X509Certificate_Private_Field field) const { |
| 49 if (!has_interface<PPB_X509Certificate_Private_0_1>()) | 51 if (!has_interface<PPB_X509Certificate_Private_0_1>()) |
| 50 return Var(); | 52 return Var(); |
| 51 return Var(PassRef(), | 53 return Var(PassRef(), |
| 52 get_interface<PPB_X509Certificate_Private_0_1>()->GetField(pp_resource(), | 54 get_interface<PPB_X509Certificate_Private_0_1>()->GetField(pp_resource(), |
| 53 field)); | 55 field)); |
| 54 } | 56 } |
| 55 | 57 |
| 56 } // namespace pp | 58 } // namespace pp |
| OLD | NEW |