Chromium Code Reviews| Index: ppapi/cpp/private/flash_x509_certificate.cc |
| diff --git a/ppapi/cpp/private/flash_x509_certificate.cc b/ppapi/cpp/private/flash_x509_certificate.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6268e4d4cbf14d9d03f035d6280a7e1c7b0d66cf |
| --- /dev/null |
| +++ b/ppapi/cpp/private/flash_x509_certificate.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/flash_x509_certificate.h" |
| + |
| +#include "ppapi/cpp/module_impl.h" |
| +#include "ppapi/cpp/var.h" |
| + |
| +namespace pp { |
| + |
| +namespace { |
| + |
| +template <> const char* interface_name<PPB_Flash_X509Certificate>() { |
|
yzshen1
2012/03/20 06:48:01
Please use the version number explicitly.
You coul
raymes
2012/03/21 20:28:08
Done.
|
| + return PPB_FLASH_X509CERTIFICATE_INTERFACE; |
| +} |
| + |
| +} // namespace |
| + |
| +X509Certificate::X509Certificate() : Resource() { |
| +} |
| + |
| +X509Certificate::X509Certificate(PP_Resource resource) : Resource(resource) { |
| +} |
| + |
| +X509Certificate::X509Certificate(const InstanceHandle& instance) { |
| + if (has_interface<PPB_Flash_X509Certificate>() && instance.pp_instance()) { |
|
yzshen1
2012/03/20 06:48:01
I think usually there is no need to check instance
raymes
2012/03/21 20:28:08
Done.
|
| + PassRefFromConstructor(get_interface<PPB_Flash_X509Certificate>()->Create( |
| + instance.pp_instance())); |
| + } |
| +} |
| + |
| +// static |
| +bool X509Certificate::IsAvailable() { |
| + return has_interface<PPB_Flash_X509Certificate>(); |
| +} |
| + |
| +bool X509Certificate::Init(const char* bytes, uint32_t length) { |
| + if (!has_interface<PPB_Flash_X509Certificate>()) |
| + return false; |
| + PP_Bool result = get_interface<PPB_Flash_X509Certificate>()->Init( |
| + pp_resource(), |
| + bytes, |
| + length); |
| + return PP_ToBool(result); |
| +} |
| + |
| +Var X509Certificate::GetField(PP_Flash_X509Certificate_Field field) { |
| + if (!has_interface<PPB_Flash_X509Certificate>()) |
| + return Var(); |
| + return Var(PassRef(), |
| + get_interface<PPB_Flash_X509Certificate>()->GetField(pp_resource(), |
| + field)); |
| +} |
| + |
| +} // namespace pp |