Chromium Code Reviews| Index: ppapi/cpp/private/x509_certificate_private.cc |
| diff --git a/ppapi/cpp/private/x509_certificate_private.cc b/ppapi/cpp/private/x509_certificate_private.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..feb6047ccc651364902a7b6733ae5bda5a22747c |
| --- /dev/null |
| +++ b/ppapi/cpp/private/x509_certificate_private.cc |
| @@ -0,0 +1,56 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "ppapi/cpp/private/x509_certificate_private.h" |
| + |
| +#include "ppapi/cpp/module_impl.h" |
| +#include "ppapi/cpp/var.h" |
| + |
| +namespace pp { |
| + |
| +namespace { |
| + |
| +template <> const char* interface_name<PPB_X509Certificate_Private_0_1>() { |
| + return PPB_X509CERTIFICATE_PRIVATE_INTERFACE_0_1; |
| +} |
| + |
| +} // namespace |
| + |
| +X509Certificate::X509Certificate() : Resource() { |
| +} |
| + |
| +X509Certificate::X509Certificate(PP_Resource resource) : Resource(resource) { |
| +} |
| + |
| +X509Certificate::X509Certificate(const InstanceHandle& instance) { |
| + if (has_interface<PPB_X509Certificate_Private_0_1>()) { |
| + PassRefFromConstructor(get_interface<PPB_X509Certificate_Private_0_1>()-> |
| + Create(instance.pp_instance())); |
| + } |
| +} |
| + |
| +// static |
| +bool X509Certificate::IsAvailable() { |
| + return has_interface<PPB_X509Certificate_Private_0_1>(); |
| +} |
| + |
| +bool X509Certificate::Initialize(const char* bytes, uint32_t length) { |
| + if (!has_interface<PPB_X509Certificate_Private_0_1>()) |
| + return false; |
| + PP_Bool result = get_interface<PPB_X509Certificate_Private_0_1>()->Initialize( |
| + pp_resource(), |
| + bytes, |
| + length); |
| + return PP_ToBool(result); |
| +} |
| + |
| +Var X509Certificate::GetField(PP_X509Certificate_Private_Field field) const { |
| + if (!has_interface<PPB_X509Certificate_Private_0_1>()) |
| + return Var(); |
| + return Var(PassRef(), |
| + get_interface<PPB_X509Certificate_Private_0_1>()->GetField(pp_resource(), |
| + field)); |
|
yzshen1
2012/03/26 17:51:08
wrong indent.
raymes
2012/03/26 19:31:34
Done.
|
| +} |
| + |
| +} // namespace pp |