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.
7 #include "ppapi/c/extensions/dev/ppb_ext_alarms_dev.h"
8 #include "ppapi/shared_impl/tracked_callback.h"
9 #include "ppapi/thunk/enter.h"
10 #include "ppapi/thunk/extensions_common_api.h"
11 #include "ppapi/thunk/thunk.h"
18 void Create(PP_Instance instance
,
20 PP_Ext_Alarms_AlarmCreateInfo_Dev alarm_info
) {
21 EnterInstanceAPI
<ExtensionsCommon_API
> enter(instance
);
25 std::vector
<PP_Var
> args
;
27 args
.push_back(alarm_info
);
28 enter
.functions()->PostRenderer("alarms.create", args
);
31 int32_t Get(PP_Instance instance
,
33 PP_Ext_Alarms_Alarm_Dev
* alarm
,
34 PP_CompletionCallback callback
) {
35 EnterInstanceAPI
<ExtensionsCommon_API
> enter(instance
, callback
);
37 return enter
.retval();
39 std::vector
<PP_Var
> input_args
;
40 std::vector
<PP_Var
*> output_args
;
41 input_args
.push_back(name
);
42 output_args
.push_back(alarm
);
43 return enter
.SetResult(enter
.functions()->CallRenderer(
44 "alarms.get", input_args
, output_args
, enter
.callback()));
47 int32_t GetAll(PP_Instance instance
,
48 PP_Ext_Alarms_Alarm_Dev_Array
* alarms
,
49 PP_CompletionCallback callback
) {
50 EnterInstanceAPI
<ExtensionsCommon_API
> enter(instance
, callback
);
52 return enter
.retval();
54 std::vector
<PP_Var
> input_args
;
55 std::vector
<PP_Var
*> output_args
;
56 output_args
.push_back(alarms
);
57 return enter
.SetResult(enter
.functions()->CallRenderer(
58 "alarms.getAll", input_args
, output_args
, enter
.callback()));
61 void Clear(PP_Instance instance
, PP_Var name
) {
62 EnterInstanceAPI
<ExtensionsCommon_API
> enter(instance
);
66 std::vector
<PP_Var
> args
;
68 enter
.functions()->PostRenderer("alarms.clear", args
);
71 void ClearAll(PP_Instance instance
) {
72 EnterInstanceAPI
<ExtensionsCommon_API
> enter(instance
);
76 std::vector
<PP_Var
> args
;
77 enter
.functions()->PostRenderer("alarms.clearAll", args
);
80 const PPB_Ext_Alarms_Dev_0_1 g_ppb_ext_alarms_dev_0_1_thunk
= {
90 const PPB_Ext_Alarms_Dev_0_1
* GetPPB_Ext_Alarms_Dev_0_1_Thunk() {
91 return &g_ppb_ext_alarms_dev_0_1_thunk
;