Whitelist window states to persist on ASH app windows.
[chromium-blink-merge.git] / ppapi / thunk / ppb_ext_alarms_thunk.cc
blob2fc88d08f5b3a9d8a3ef936347ee7758a3e20bb8
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.
5 #include <vector>
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"
13 namespace ppapi {
14 namespace thunk {
16 namespace {
18 void Create(PP_Instance instance,
19 PP_Var name,
20 PP_Ext_Alarms_AlarmCreateInfo_Dev alarm_info) {
21 EnterInstanceAPI<ExtensionsCommon_API> enter(instance);
22 if (enter.failed())
23 return;
25 std::vector<PP_Var> args;
26 args.push_back(name);
27 args.push_back(alarm_info);
28 enter.functions()->PostRenderer("alarms.create", args);
31 int32_t Get(PP_Instance instance,
32 PP_Var name,
33 PP_Ext_Alarms_Alarm_Dev* alarm,
34 PP_CompletionCallback callback) {
35 EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
36 if (enter.failed())
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);
51 if (enter.failed())
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);
63 if (enter.failed())
64 return;
66 std::vector<PP_Var> args;
67 args.push_back(name);
68 enter.functions()->PostRenderer("alarms.clear", args);
71 void ClearAll(PP_Instance instance) {
72 EnterInstanceAPI<ExtensionsCommon_API> enter(instance);
73 if (enter.failed())
74 return;
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 = {
81 &Create,
82 &Get,
83 &GetAll,
84 &Clear,
85 &ClearAll
88 } // namespace
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;
94 } // namespace thunk
95 } // namespace ppapi