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

Side by Side Diff: ppapi/api/dev/ppb_alarms_dev.idl

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/api/dev/pp_optional_structs_dev.idl ('k') | ppapi/api/dev/ppb_foobar_dev.idl » ('j') | 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
6 /**
7 * This file defines the Pepper equivalent of the <code>chrome.alarms</code>
8 * extension API.
9 */
10
11 label Chrome {
12 M33 = 0.1
13 };
14
15 struct PP_Alarms_Alarm_Dev {
16 /**
17 * Name of this alarm.
18 */
19 PP_Var name;
20 /**
21 * Time at which this alarm was scheduled to fire, in milliseconds past the
22 * epoch. For performance reasons, the alarm may have been delayed an
23 * arbitrary amount beyond this.
24 */
25 double_t scheduled_time;
26 /**
27 * If set, the alarm is a repeating alarm and will fire again in
28 * <var>period_in_minutes</var> minutes.
29 */
30 PP_Optional_Double period_in_minutes;
31 };
32
33 struct PP_Alarms_AlarmCreateInfo_Dev {
34 /**
35 * Time at which the alarm should fire, in milliseconds past the epoch.
36 */
37 PP_Optional_Double when;
38 /**
39 * Length of time in minutes after which the <code>onAlarm</code> event
40 * should fire.
41 */
42 PP_Optional_Double delay_in_minutes;
43 /**
44 * If set, the onAlarm event should fire every <var>period_in_minutes</var>
45 * minutes after the initial event specified by <var>when</var> or
46 * <var>delay_in_minutes</var>. If not set, the alarm will only fire once.
47 */
48 PP_Optional_Double period_in_minutes;
49 };
50
51 struct PP_Alarms_Alarm_Array_Dev {
52 uint32_t size;
53 [size_is(count)] PP_Alarms_Alarm_Dev[] elements;
54 };
55
56 /**
57 * Fired when an alarm has elapsed. Useful for event pages.
58 *
59 * @param[in] listener_id The listener ID.
60 * @param[inout] user_data The opaque pointer that was used when registering the
61 * listener.
62 * @param[in] alarm The alarm that has elapsed.
63 */
64 typedef void PP_Alarms_OnAlarm_Dev(
65 [in] uint32_t listener_id,
66 [inout] mem_t user_data,
67 [in] PP_Alarms_Alarm_Dev alarm);
68
69 interface PPB_Alarms_Dev {
70 /**
71 * Creates an alarm. Near the time(s) specified by <var>alarm_info</var>,
72 * the <code>PP_Alarms_OnAlarm_Dev</code> event is fired. If there is another
73 * alarm with the same name (or no name if none is specified), it will be
74 * cancelled and replaced by this alarm.
75 *
76 * In order to reduce the load on the user's machine, Chrome limits alarms
77 * to at most once every 1 minute but may delay them an arbitrary amount more.
78 * That is, setting <code>$ref:[PP_Alarms_AlarmCreateInfo_Dev.delay_in_minutes
79 * delay_in_minutes]</code> or
80 * <code>$ref:[PP_Alarms_AlarmCreateInfo_Dev.period_in_minutes
81 * period_in_minutes]</code> to less than <code>1</code> will not be honored
82 * and will cause a warning.
83 * <code>$ref:[PP_Alarms_AlarmCreateInfo_Dev.when when]</code> can be set
84 * to less than 1 minute after "now" without warning but won't actually cause
85 * the alarm to fire for at least 1 minute.
86 *
87 * To help you debug your app or extension, when you've loaded it unpacked,
88 * there's no limit to how often the alarm can fire.
89 *
90 * @param[in] instance A <code>PP_Instance</code>.
91 * @param[in] name A string or undefined <code>PP_Var</code>. Optional name to
92 * identify this alarm. Defaults to the empty string.
93 * @param[in] alarm_info Describes when the alarm should fire. The initial
94 * time must be specified by either <var>when</var> or
95 * <var>delay_in_minutes</var> (but not both). If
96 * <var>period_in_minutes</var> is set, the alarm will repeat every
97 * <var>period_in_minutes</var> minutes after the initial event. If neither
98 * <var>when</var> or <var>delay_in_minutes</var> is set for a repeating
99 * alarm, <var>period_in_minutes</var> is used as the default for
100 * <var>delay_in_minutes</var>.
101 */
102 void Create(
103 [in] PP_Instance instance,
104 [in] PP_Var name,
105 [in] PP_Alarms_AlarmCreateInfo_Dev alarm_info);
106
107 /**
108 * Retrieves details about the specified alarm.
109 *
110 * @param[in] instance A <code>PP_Instance</code>.
111 * @param[in] name A string or undefined <code>PP_Var</code>. The name of the
112 * alarm to get. Defaults to the empty string.
113 * @param[out] alarm A <code>PP_Alarms_Alarm_Dev</code> struct to store the
114 * output result.
115 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
116 * completion.
117 *
118 * @return An error code from <code>pp_errors.h</code>
119 */
120 int32_t Get(
121 [in] PP_Instance instance,
122 [in] PP_Var name,
123 [out] PP_Alarms_Alarm_Dev alarm,
124 [in] PP_CompletionCallback callback);
125
126 /**
127 * Gets an array of all the alarms.
128 *
129 * @param[in] instance A <code>PP_Instance</code>.
130 * @param[out] alarms A <code>PP_Alarms_Alarm_Array_Dev</code> to store the
131 * output result.
132 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
133 * completion.
134 *
135 * @return An error code from <code>pp_errors.h</code>
136 */
137 int32_t GetAll(
138 [in] PP_Instance instance,
139 [out] PP_Alarms_Alarm_Array_Dev alarms,
140 [in] PP_ArrayOutput array_allocator,
141 [in] PP_CompletionCallback callback);
142
143 /**
144 * Clears the alarm with the given name.
145 *
146 * @param[in] instance A <code>PP_Instance</code>.
147 * @param[in] name A string or undefined <code>PP_Var</code>. The name of the
148 * alarm to clear. Defaults to the empty string.
149 */
150 void Clear(
151 [in] PP_Instance instance,
152 [in] PP_Var name);
153
154 /**
155 * Clears all alarms.
156 *
157 * @param[in] instance A <code>PP_Instance</code>.
158 */
159 void ClearAll(
160 [in] PP_Instance instance);
161
162 /**
163 * Registers <code>PP_Alarms_OnAlarm_Dev</code> event.
164 *
165 * @param[in] instance A <code>PP_Instance</code>.
166 * @param[in] callback The callback to receive notifications.
167 * @param[inout] user_data An opaque pointer that will be passed to
168 * <code>callback</code>.
169 *
170 * @return A listener ID, or 0 if failed.
171 *
172 * TODO(yzshen): add a PPB_Events_Dev interface for unregistering:
173 * void UnregisterListener(PP_instance instance, uint32_t listener_id);
174 */
175 uint32_t AddOnAlarmListener(
176 [in] PP_Instance instance,
177 [in] PP_Alarms_OnAlarm_Dev callback,
178 [inout] mem_t user_data);
179 };
OLDNEW
« no previous file with comments | « ppapi/api/dev/pp_optional_structs_dev.idl ('k') | ppapi/api/dev/ppb_foobar_dev.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698