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

Side by Side Diff: chrome/common/extensions/api/experimental.alarms.idl

Issue 10066024: Convert chrome.experimental.alarms API to use IDL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months 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) 2012 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 // File-level comment to appease parser. Eventually this will not be necessary.
6 // TODO(mpcomplete): We need documentation before we can release this.
7
8 namespace experimental.alarms {
9 dictionary Alarm {
10 // Name of this alarm.
11 DOMString name;
12
13 // Original length of time in seconds after which the onAlarm event should
14 // fire.
15 // TODO: need minimum=0
16 long delayInSeconds;
17
18 // True if the alarm repeatedly fires at regular intervals, false if it
19 // only fires once.
20 boolean repeating;
21 };
22
23 // TODO(mpcomplete): rename to CreateInfo when http://crbug.com/123073 is
24 // fixed.
25 dictionary AlarmCreateInfo {
26 // Length of time in seconds after which the onAlarm event should fire.
27 // Note that granularity is not guaranteed: this value is more of a hint to
28 // the browser. For performance reasons, alarms may be delayed an arbitrary
29 // amount of time before firing.
30 // TODO: need minimum=0
31 long delayInSeconds;
32
33 // True if the alarm should repeatedly fire at regular intervals. Defaults
34 // to false.
35 boolean? repeating;
36 };
37
38 callback AlarmCallback = void (Alarm alarm);
39 callback AlarmListCallback = void (Alarm[] alarms);
40
41 interface Functions {
42 // Creates an alarm. After the delay is expired, the onAlarm event is
43 // fired. If there is another alarm with the same name (or no name if none
44 // is specified), it will be cancelled and replaced by this alarm.
45 static void create(optional DOMString name, AlarmCreateInfo alarmInfo);
46
47 // Retrieves details about the specified alarm.
48 // |name|: The name of the alarm to get. Defaults to the empty string.
49 static void get(optional DOMString name, AlarmCallback callback);
50
51 // Gets an array of all the alarms.
52 static void getAll(AlarmListCallback callback);
53
54 // Clears the alarm with the given name.
55 // |name|: The name of the alarm to clear. Defaults to the empty string.
56 static void clear(optional DOMString name);
57
58 // Clears all alarms.
59 static void clearAll();
60 };
61
62 interface Events {
63 // Fired when an alarm has expired. Useful for transient background pages.
asargent_no_longer_on_chrome 2012/04/12 23:07:38 nit: Using the word "expired" seems sort of mislea
64 // |name|: The name of the alarm that has expired.
65 static void onAlarm(optional DOMString name);
66 };
67 };
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/api.gyp ('k') | chrome/common/extensions/api/experimental.alarms.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698