[Android] Implement 3-way sensor fallback for Device Orientation.
[chromium-blink-merge.git] / ppapi / cpp / private / x509_certificate_private.cc
blobec242b7953341eda0b99d25779ec6120644aa3bd
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.
5 #include "ppapi/cpp/private/x509_certificate_private.h"
7 #include "ppapi/cpp/module_impl.h"
8 #include "ppapi/cpp/pass_ref.h"
9 #include "ppapi/cpp/var.h"
11 namespace pp {
13 namespace {
15 template <> const char* interface_name<PPB_X509Certificate_Private_0_1>() {
16 return PPB_X509CERTIFICATE_PRIVATE_INTERFACE_0_1;
19 } // namespace
21 X509CertificatePrivate::X509CertificatePrivate() : Resource() {}
23 X509CertificatePrivate::X509CertificatePrivate(PassRef, PP_Resource resource)
24 : Resource(PASS_REF, resource) {
27 X509CertificatePrivate::X509CertificatePrivate(const InstanceHandle& instance) {
28 if (has_interface<PPB_X509Certificate_Private_0_1>()) {
29 PassRefFromConstructor(get_interface<PPB_X509Certificate_Private_0_1>()->
30 Create(instance.pp_instance()));
34 // static
35 bool X509CertificatePrivate::IsAvailable() {
36 return has_interface<PPB_X509Certificate_Private_0_1>();
39 bool X509CertificatePrivate::Initialize(const char* bytes, uint32_t length) {
40 if (!has_interface<PPB_X509Certificate_Private_0_1>())
41 return false;
42 PP_Bool result = get_interface<PPB_X509Certificate_Private_0_1>()->Initialize(
43 pp_resource(),
44 bytes,
45 length);
46 return PP_ToBool(result);
49 Var X509CertificatePrivate::GetField(
50 PP_X509Certificate_Private_Field field) const {
51 if (!has_interface<PPB_X509Certificate_Private_0_1>())
52 return Var();
53 return Var(PassRef(),
54 get_interface<PPB_X509Certificate_Private_0_1>()->GetField(pp_resource(),
55 field));
58 } // namespace pp