Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Unified Diff: ppapi/cpp/private/flash_x509_certificate.cc

Issue 9693024: Add the PPAPI X509 Certificate interface and implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..eb93d9f47502813890691ad4662d7673dfb605de
--- /dev/null
+++ b/ppapi/cpp/private/flash_x509_certificate.cc
@@ -0,0 +1,59 @@
+// 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_0_1>() {
+ return PPB_FLASH_X509CERTIFICATE_INTERFACE_0_1;
+}
+
+} // namespace
+
+namespace flash {
+
+X509Certificate::X509Certificate() : Resource() {
+}
+
+X509Certificate::X509Certificate(PP_Resource resource) : Resource(resource) {
+}
+
+X509Certificate::X509Certificate(const InstanceHandle& instance) {
+ if (has_interface<PPB_Flash_X509Certificate_0_1>()) {
+ PassRefFromConstructor(get_interface<PPB_Flash_X509Certificate_0_1>()->
+ Create(instance.pp_instance()));
+ }
+}
+
+// static
+bool X509Certificate::IsAvailable() {
+ return has_interface<PPB_Flash_X509Certificate_0_1>();
+}
+
+bool X509Certificate::Initialize(const char* bytes, uint32_t length) {
+ if (!has_interface<PPB_Flash_X509Certificate_0_1>())
+ return false;
+ PP_Bool result = get_interface<PPB_Flash_X509Certificate_0_1>()->Initialize(
+ pp_resource(),
+ bytes,
+ length);
+ return PP_ToBool(result);
+}
+
+Var X509Certificate::GetField(PP_Flash_X509Certificate_Field field) const {
+ if (!has_interface<PPB_Flash_X509Certificate_0_1>())
+ return Var();
+ return Var(PassRef(),
+ get_interface<PPB_Flash_X509Certificate_0_1>()->GetField(pp_resource(),
+ field));
+}
+
+} // namespace flash
+} // namespace pp

Powered by Google App Engine
This is Rietveld 408576698