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

Side by Side Diff: ppapi/thunk/ppb_flash_x509_certificate_thunk.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
5 #include "ppapi/c/private/ppb_flash_x509_certificate.h"
6 #include "ppapi/thunk/enter.h"
7 #include "ppapi/thunk/ppb_flash_x509_certificate_api.h"
8 #include "ppapi/thunk/thunk.h"
yzshen1 2012/03/22 23:32:40 sort, please.
raymes 2012/03/26 16:05:57 Done.
9 #include "ppapi/thunk/resource_creation_api.h"
10
11 namespace ppapi {
12 namespace thunk {
13
14 namespace {
15
16 typedef EnterResource<PPB_Flash_X509Certificate_API> EnterFlashX509Certificate;
17
18 PP_Resource Create(PP_Instance instance) {
19 EnterFunction<ResourceCreationAPI> enter(instance, true);
20 if (enter.failed())
21 return 0;
22 return enter.functions()->CreateX509Certificate(instance);
23 }
24
25 PP_Bool IsFlashX509Certificate(PP_Resource resource) {
26 EnterFlashX509Certificate enter(resource, false);
27 return PP_FromBool(enter.succeeded());
28 }
29
30 PP_Bool Initialize(PP_Resource certificate,
31 const char *bytes,
32 uint32_t length) {
33 EnterFlashX509Certificate enter(certificate, true);
34 if (enter.failed())
35 return PP_FALSE;
36 return enter.object()->Initialize(bytes, length);
37 }
38
39 PP_Var GetField(PP_Resource certificate,
40 PP_Flash_X509Certificate_Field field) {
41 EnterFlashX509Certificate enter(certificate, true);
42 if (enter.failed())
43 return PP_MakeUndefined();
44 return enter.object()->GetField(field);
45 }
46
47 const PPB_Flash_X509Certificate g_ppb_x509_certificate_thunk = {
48 &Create,
49 &IsFlashX509Certificate,
50 &Initialize,
51 &GetField
52 };
53
54 } // namespace
55
56 const PPB_Flash_X509Certificate_0_1* GetPPB_Flash_X509Certificate_0_1_Thunk() {
57 return &g_ppb_x509_certificate_thunk;
58 }
59
60 } // namespace thunk
61 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698