Pepper_47_C++_interfaces
x509_certificate_private.cc
Go to the documentation of this file.
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.
4 
6 
8 #include "ppapi/cpp/pass_ref.h"
9 #include "ppapi/cpp/var.h"
10 
11 namespace pp {
12 
13 namespace {
14 
15 template <> const char* interface_name<PPB_X509Certificate_Private_0_1>() {
16  return PPB_X509CERTIFICATE_PRIVATE_INTERFACE_0_1;
17 }
18 
19 } // namespace
20 
22 
24  : Resource(PASS_REF, resource) {
25 }
26 
28  if (has_interface<PPB_X509Certificate_Private_0_1>()) {
29  PassRefFromConstructor(get_interface<PPB_X509Certificate_Private_0_1>()->
30  Create(instance.pp_instance()));
31  }
32 }
33 
34 // static
36  return has_interface<PPB_X509Certificate_Private_0_1>();
37 }
38 
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);
47 }
48 
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));
56 }
57 
58 } // namespace pp
void PassRefFromConstructor(PP_Resource resource)
Definition: resource.cc:50
PassRef
Definition: pass_ref.h:17
bool Initialize(const char *bytes, uint32_t length)
Var GetField(PP_X509Certificate_Private_Field field) const
friend class Var
Definition: resource.h:90
PP_Resource pp_resource() const
Definition: resource.h:47
A generic type used for passing data types between the module and the page.
Definition: var.h:21
PP_Instance pp_instance() const
A reference counted module resource.
Definition: resource.h:20