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

Side by Side Diff: ppapi/c/extensions/dev/ppb_ext_alarms_dev.h

Issue 103093004: Remove PPB_Ext_Alarms_Dev and PPB_Ext_Events_Dev. (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
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
6 /* From extensions/dev/ppb_ext_alarms_dev.idl,
7 * modified Wed Mar 20 13:50:11 2013.
8 */
9
10 #ifndef PPAPI_C_EXTENSIONS_DEV_PPB_EXT_ALARMS_DEV_H_
11 #define PPAPI_C_EXTENSIONS_DEV_PPB_EXT_ALARMS_DEV_H_
12
13 #include "ppapi/c/pp_bool.h"
14 #include "ppapi/c/pp_completion_callback.h"
15 #include "ppapi/c/pp_instance.h"
16 #include "ppapi/c/pp_macros.h"
17 #include "ppapi/c/pp_stdint.h"
18 #include "ppapi/c/pp_var.h"
19
20 #define PPB_EXT_ALARMS_DEV_INTERFACE_0_1 "PPB_Ext_Alarms(Dev);0.1"
21 #define PPB_EXT_ALARMS_DEV_INTERFACE PPB_EXT_ALARMS_DEV_INTERFACE_0_1
22
23 /**
24 * @file
25 * This file defines the Pepper equivalent of the <code>chrome.alarms</code>
26 * extension API.
27 */
28
29
30 #include "ppapi/c/extensions/dev/ppb_ext_events_dev.h"
31
32 /**
33 * @addtogroup Typedefs
34 * @{
35 */
36 /**
37 * A dictionary <code>PP_Var</code> which contains:
38 * - "name" : string <code>PP_Var</code>
39 * Name of this alarm.
40 *
41 * - "scheduledTime" : double <code>PP_Var</code>
42 * Time at which this alarm was scheduled to fire, in milliseconds past the
43 * epoch (e.g. <code>Date.now() + n</code>). For performance reasons, the
44 * alarm may have been delayed an arbitrary amount beyond this.
45 *
46 * - "periodInMinutes" : double or undefined <code>PP_Var</code>
47 * If not undefined, the alarm is a repeating alarm and will fire again in
48 * <var>periodInMinutes</var> minutes.
49 */
50 typedef struct PP_Var PP_Ext_Alarms_Alarm_Dev;
51
52 /**
53 * A dictionary <code>PP_Var</code> which contains
54 * - "when" : double or undefined <code>PP_Var</code>
55 * Time at which the alarm should fire, in milliseconds past the epoch
56 * (e.g. <code>Date.now() + n</code>).
57 *
58 * - "delayInMinutes" : double or undefined <code>PP_Var</code>
59 * Length of time in minutes after which the
60 * <code>PP_Ext_Alarms_OnAlarm_Dev</code> event should fire.
61 *
62 * - "periodInMinutes" : double or undefined <code>PP_Var</code>
63 * If set, the <code>PP_Ext_Alarms_OnAlarm_Dev</code> event should fire every
64 * <var>periodInMinutes</var> minutes after the initial event specified by
65 * <var>when</var> or <var>delayInMinutes</var>. If not set, the alarm will
66 * only fire once.
67 */
68 typedef struct PP_Var PP_Ext_Alarms_AlarmCreateInfo_Dev;
69
70 /**
71 * An array <code>PP_Var</code> which contains elements of
72 * <code>PP_Ext_Alarms_Alarm_Dev</code>.
73 */
74 typedef struct PP_Var PP_Ext_Alarms_Alarm_Dev_Array;
75 /**
76 * @}
77 */
78
79 /**
80 * @addtogroup Interfaces
81 * @{
82 */
83 struct PPB_Ext_Alarms_Dev_0_1 {
84 /**
85 * Creates an alarm. Near the time(s) specified by <var>alarm_info</var>,
86 * the <code>PP_Ext_Alarms_OnAlarm_Dev</code> event is fired. If there is
87 * another alarm with the same name (or no name if none is specified), it will
88 * be cancelled and replaced by this alarm.
89 *
90 * In order to reduce the load on the user's machine, Chrome limits alarms
91 * to at most once every 1 minute but may delay them an arbitrary amount
92 * more. That is, setting
93 * <code>$ref:[PP_Ext_Alarms_AlarmCreateInfo_Dev.delayInMinutes
94 * delayInMinutes]</code> or
95 * <code>$ref:[PP_Ext_Alarms_AlarmCreateInfo_Dev.periodInMinutes
96 * periodInMinutes]</code> to less than <code>1</code> will not be honored
97 * and will cause a warning.
98 * <code>$ref:[PP_Ext_Alarms_AlarmCreateInfo_Dev.when when]</code> can be set
99 * to less than 1 minute after "now" without warning but won't actually cause
100 * the alarm to fire for at least 1 minute.
101 *
102 * To help you debug your app or extension, when you've loaded it unpacked,
103 * there's no limit to how often the alarm can fire.
104 *
105 * @param[in] instance A <code>PP_Instance</code>.
106 * @param[in] name A string or undefined <code>PP_Var</code>. Optional name to
107 * identify this alarm. Defaults to the empty string.
108 * @param[in] alarm_info A <code>PP_Var</code> whose contents conform to the
109 * description of <code>PP_Ext_Alarms_AlarmCreateInfo_Dev</code>. Describes
110 * when the alarm should fire. The initial time must be specified by either
111 * <var>when</var> or <var>delayInMinutes</var> (but not both). If
112 * <var>periodInMinutes</var> is set, the alarm will repeat every
113 * <var>periodInMinutes</var> minutes after the initial event. If neither
114 * <var>when</var> or <var>delayInMinutes</var> is set for a repeating alarm,
115 * <var>periodInMinutes</var> is used as the default for
116 * <var>delayInMinutes</var>.
117 */
118 void (*Create)(PP_Instance instance,
119 struct PP_Var name,
120 PP_Ext_Alarms_AlarmCreateInfo_Dev alarm_info);
121 /**
122 * Retrieves details about the specified alarm.
123 *
124 * @param[in] instance A <code>PP_Instance</code>.
125 * @param[in] name A string or undefined <code>PP_Var</code>. The name of the
126 * alarm to get. Defaults to the empty string.
127 * @param[out] alarm A <code>PP_Var</code> whose contents conform to the
128 * description of <code>PP_Ext_Alarms_Alarm_Dev</code>.
129 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
130 * completion.
131 *
132 * @return An error code from <code>pp_errors.h</code>
133 */
134 int32_t (*Get)(PP_Instance instance,
135 struct PP_Var name,
136 PP_Ext_Alarms_Alarm_Dev* alarm,
137 struct PP_CompletionCallback callback);
138 /**
139 * Gets an array of all the alarms.
140 *
141 * @param[in] instance A <code>PP_Instance</code>.
142 * @param[out] alarms A <code>PP_Var</code> whose contents conform to the
143 * description of <code>PP_Ext_Alarms_Alarm_Dev_Array</code>.
144 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
145 * completion.
146 *
147 * @return An error code from <code>pp_errors.h</code>
148 */
149 int32_t (*GetAll)(PP_Instance instance,
150 PP_Ext_Alarms_Alarm_Dev_Array* alarms,
151 struct PP_CompletionCallback callback);
152 /**
153 * Clears the alarm with the given name.
154 *
155 * @param[in] instance A <code>PP_Instance</code>.
156 * @param[in] name A string or undefined <code>PP_Var</code>. The name of the
157 * alarm to clear. Defaults to the empty string.
158 */
159 void (*Clear)(PP_Instance instance, struct PP_Var name);
160 /**
161 * Clears all alarms.
162 *
163 * @param[in] instance A <code>PP_Instance</code>.
164 */
165 void (*ClearAll)(PP_Instance instance);
166 };
167
168 typedef struct PPB_Ext_Alarms_Dev_0_1 PPB_Ext_Alarms_Dev;
169 /**
170 * @}
171 */
172
173 /**
174 * @addtogroup Typedefs
175 * @{
176 */
177 /**
178 * Fired when an alarm has elapsed. Useful for event pages.
179 *
180 * @param[in] listener_id The listener ID.
181 * @param[inout] user_data The opaque pointer that was used when registering the
182 * listener.
183 * @param[in] alarm A <code>PP_Var</code> whose contents conform to the
184 * description of <code>PP_Ext_Alarms_Alarm_Dev</code>. The alarm that has
185 * elapsed.
186 */
187 typedef void (*PP_Ext_Alarms_OnAlarm_Func_Dev_0_1)(
188 uint32_t listener_id,
189 void* user_data,
190 PP_Ext_Alarms_Alarm_Dev alarm);
191 /**
192 * @}
193 */
194
195 PP_INLINE struct PP_Ext_EventListener PP_Ext_Alarms_OnAlarm_Dev_0_1(
196 PP_Ext_Alarms_OnAlarm_Func_Dev_0_1 func,
197 void* user_data) {
198 return PP_Ext_MakeEventListener("alarms.onAlarm;0.1",
199 (PP_Ext_GenericFuncType)(func), user_data);
200 }
201
202 #define PP_Ext_Alarms_OnAlarm_Dev PP_Ext_Alarms_OnAlarm_Dev_0_1
203 #endif /* PPAPI_C_EXTENSIONS_DEV_PPB_EXT_ALARMS_DEV_H_ */
204
OLDNEW
« no previous file with comments | « ppapi/api/extensions/dev/ppb_ext_events_dev.idl ('k') | ppapi/c/extensions/dev/ppb_ext_events_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698