|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 #include "domstubs.idl" |
|
6 |
|
7 [scriptable, uuid(fb089720-1c5c-11e3-b773-0800200c9a66)] |
|
8 interface nsINotificationStorageCallback : nsISupports |
|
9 { |
|
10 /** |
|
11 * Callback function used to pass single notification back |
|
12 * into C++ land for Notification.get return data. |
|
13 * |
|
14 * @param id: a uuid for this notification |
|
15 * @param title: the notification title |
|
16 * @param dir: the notification direction, |
|
17 * possible values are "ltr", "rtl", "auto" |
|
18 * @param lang: the notification language |
|
19 * @param body: the notification body |
|
20 * @param tag: the notification tag |
|
21 */ |
|
22 [implicit_jscontext] |
|
23 void handle(in DOMString id, |
|
24 in DOMString title, |
|
25 in DOMString dir, |
|
26 in DOMString lang, |
|
27 in DOMString body, |
|
28 in DOMString tag, |
|
29 in DOMString icon); |
|
30 |
|
31 /** |
|
32 * Callback function used to notify C++ the we have returned |
|
33 * all notification objects for this Notification.get call. |
|
34 */ |
|
35 [implicit_jscontext] |
|
36 void done(); |
|
37 }; |
|
38 |
|
39 /** |
|
40 * Interface for notification persistence layer. |
|
41 */ |
|
42 [scriptable, uuid(b177b080-2a23-11e3-8224-0800200c9a66)] |
|
43 interface nsINotificationStorage : nsISupports |
|
44 { |
|
45 |
|
46 /** |
|
47 * Add/replace a notification to the persistence layer. |
|
48 * |
|
49 * @param origin: the origin/app of this notification |
|
50 * @param id: a uuid for this notification |
|
51 * @param title: the notification title |
|
52 * @param dir: the notification direction, |
|
53 * possible values are "ltr", "rtl", "auto" |
|
54 * @param lang: the notification language |
|
55 * @param body: the notification body |
|
56 * @param tag: notification tag, will replace any existing |
|
57 * notifications with same origin/tag pair |
|
58 */ |
|
59 void put(in DOMString origin, |
|
60 in DOMString id, |
|
61 in DOMString title, |
|
62 in DOMString dir, |
|
63 in DOMString lang, |
|
64 in DOMString body, |
|
65 in DOMString tag, |
|
66 in DOMString icon); |
|
67 |
|
68 /** |
|
69 * Retrieve a list of notifications. |
|
70 * |
|
71 * @param origin: the origin/app for which to fetch notifications from |
|
72 * @param tag: used to fetch only a specific tag |
|
73 * @param callback: nsINotificationStorageCallback, used for |
|
74 * returning notifications objects |
|
75 */ |
|
76 void get(in DOMString origin, |
|
77 in DOMString tag, |
|
78 in nsINotificationStorageCallback aCallback); |
|
79 |
|
80 /** |
|
81 * Remove a notification from storage. |
|
82 * |
|
83 * @param origin: the origin/app to delete the notification from |
|
84 * @param id: the uuid for the notification to delete |
|
85 */ |
|
86 void delete(in DOMString origin, |
|
87 in DOMString id); |
|
88 }; |
|
89 |
|
90 %{C++ |
|
91 #define NS_NOTIFICATION_STORAGE_CONTRACTID "@mozilla.org/notificationStorage;1" |
|
92 %} |