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

Side by Side Diff: ppapi/thunk/ppb_alarms_dev_thunk.cc

Issue 60173003: Draft: apps APIs in Pepper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
« no previous file with comments | « ppapi/thunk/interfaces_ppb_public_dev.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 <vector>
6
7 #include "ppapi/c/dev/ppb_alarms_dev.h"
8 #include "ppapi/shared_impl/proxy_lock.h"
9 #include "ppapi/shared_impl/tracked_callback.h"
10 #include "ppapi/shared_impl/var.h"
11 #include "ppapi/thunk/enter.h"
12 #include "ppapi/thunk/extensions_common_api.h"
13 #include "ppapi/thunk/thunk.h"
14
15 namespace ppapi {
16 namespace thunk {
17
18 namespace {
19
20 void Create(PP_Instance instance,
21 PP_Var name,
22 const PP_Alarms_AlarmCreateInfo_Dev* alarm_info) {
23 ProxyAutoLock lock;
24 std::string a = StringVar::FromPPVar(name)->value();
25 }
26
27 int32_t Get(PP_Instance instance,
28 PP_Var name,
29 PP_Alarms_Alarm_Dev* alarm,
30 PP_CompletionCallback callback) {
31 EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
32 if (enter.failed())
33 return enter.retval();
34
35 std::string a = StringVar::FromPPVar(name)->value();
36 alarm->name = StringVar::StringToPPVar(a);
37 alarm->scheduled_time = 1;
38 alarm->period_in_minutes.is_set = PP_FALSE;
39
40 return enter.SetResult(PP_OK);
41 }
42
43 int32_t GetAll(PP_Instance instance,
44 PP_Alarms_Alarm_Array_Dev* alarms,
45 PP_ArrayOutput array_allocator,
46 PP_CompletionCallback callback) {
47 EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
48 if (enter.failed())
49 return enter.retval();
50
51 alarms->elements =
52 static_cast<PP_Alarms_Alarm_Dev*>(array_allocator.GetDataBuffer(
53 array_allocator.user_data,
54 2,
55 sizeof(PP_Alarms_Alarm_Dev)));
56 alarms->size = 2;
57
58 alarms->elements[0].name = StringVar::StringToPPVar("abc");
59 alarms->elements[0].scheduled_time = 1;
60 alarms->elements[0].period_in_minutes.is_set = PP_TRUE;
61 alarms->elements[0].period_in_minutes.value = 3;
62
63 alarms->elements[1].name = StringVar::StringToPPVar("def");
64 alarms->elements[1].scheduled_time = 4;
65 alarms->elements[1].period_in_minutes.is_set = PP_FALSE;
66 alarms->elements[1].period_in_minutes.value = 0;
67
68 return enter.SetResult(PP_OK);
69 }
70
71 void Clear(PP_Instance instance, PP_Var name) {
72 ProxyAutoLock lock;
73 std::string a = StringVar::FromPPVar(name)->value();
74 }
75
76 void ClearAll(PP_Instance instance) {
77 }
78
79 uint32_t AddOnAlarmListener(PP_Instance instance,
80 PP_Alarms_OnAlarm_Dev callback,
81 void* user_data) {
82 return 0;
83 }
84
85 const PPB_Alarms_Dev_0_1 g_ppb_alarms_dev_0_1_thunk = {
86 &Create,
87 &Get,
88 &GetAll,
89 &Clear,
90 &ClearAll,
91 &AddOnAlarmListener
92 };
93
94 } // namespace
95
96 const PPB_Alarms_Dev_0_1* GetPPB_Alarms_Dev_0_1_Thunk() {
97 return &g_ppb_alarms_dev_0_1_thunk;
98 }
99
100 } // namespace thunk
101 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/thunk/interfaces_ppb_public_dev.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698