OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 [nodoc] namespace experimental.notification { | 5 [nodoc] namespace experimental.notification { |
6 enum TemplateType { | 6 enum TemplateType { |
7 // icon, title, message | 7 // icon, title, message |
8 simple, | 8 simple, |
9 | 9 |
10 // icon, title, message, expandedMessage, up to two buttons | 10 // icon, title, message, expandedMessage, up to two buttons |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 NotificationButton[]? buttons; | 61 NotificationButton[]? buttons; |
62 | 62 |
63 // Secondary notification content. | 63 // Secondary notification content. |
64 DOMString? expandedMessage; | 64 DOMString? expandedMessage; |
65 | 65 |
66 // Image thumbnail for image-type notifications. | 66 // Image thumbnail for image-type notifications. |
67 DOMString? imageUrl; | 67 DOMString? imageUrl; |
68 | 68 |
69 // Items for multi-item notifications. | 69 // Items for multi-item notifications. |
70 NotificationItem[]? items; | 70 NotificationItem[]? items; |
71 | |
72 // User data for the notification. | |
73 DOMString? userData; | |
dharcourt
2013/02/22 21:35:30
If this object will have the same restriction as t
vadimt
2013/02/22 22:38:44
Yes. Object is better than string.
| |
71 }; | 74 }; |
72 | 75 |
73 callback CreateCallback = void (DOMString notificationId); | 76 callback CreateCallback = void (DOMString notificationId); |
74 | 77 |
75 callback UpdateCallback = void (boolean wasUpdated); | 78 callback UpdateCallback = void (boolean wasUpdated); |
76 | 79 |
77 callback DeleteCallback = void (boolean wasDeleted); | 80 callback DeleteCallback = void (boolean wasDeleted); |
78 | 81 |
82 callback GetAllNotificationsCallback = void ( | |
83 DOMString[] notificationsIds, | |
84 NotificationOptions[] notificationsOptions); | |
85 | |
dharcourt
2013/02/22 21:35:30
How about returning a notificationsInfo object whi
vadimt
2013/02/22 22:38:44
Based on the offline discussion, it seems like we'
| |
79 interface Functions { | 86 interface Functions { |
80 // Creates and displays a notification having the contents in |options|, | 87 // Creates and displays a notification having the contents in |options|, |
81 // identified by the id |notificationId|. If |notificationId| is empty, | 88 // identified by the id |notificationId|. If |notificationId| is empty, |
82 // |create| generates an id. If |notificationId| matches an existing | 89 // |create| generates an id. If |notificationId| matches an existing |
83 // notification, |create| first deletes that notification before proceeding | 90 // notification, |create| first deletes that notification before proceeding |
84 // with the create operation. |callback| returns the notification id | 91 // with the create operation. |callback| returns the notification id |
85 // (either supplied or generated) that represents the created notification. | 92 // (either supplied or generated) that represents the created notification. |
86 static void create(DOMString notificationId, | 93 static void create(DOMString notificationId, |
87 NotificationOptions options, | 94 NotificationOptions options, |
88 CreateCallback callback); | 95 CreateCallback callback); |
89 | 96 |
90 // Updates an existing notification having the id |notificationId| and the | 97 // Updates an existing notification having the id |notificationId| and the |
91 // options |options|. |callback| indicates whether a matching notification | 98 // options |options|. |callback| indicates whether a matching notification |
92 // existed. | 99 // existed. |
93 static void update(DOMString notificationId, | 100 static void update(DOMString notificationId, |
94 NotificationOptions options, | 101 NotificationOptions options, |
95 UpdateCallback callback); | 102 UpdateCallback callback); |
96 | 103 |
97 // Given a |notificationId| returned by the |create| method, deletes the | 104 // Given a |notificationId| returned by the |create| method, deletes the |
98 // corresponding notification. |callback| indicates whether a matching | 105 // corresponding notification. |callback| indicates whether a matching |
99 // notification existed. | 106 // notification existed. |
100 static void delete(DOMString notificationId, DeleteCallback callback); | 107 static void delete(DOMString notificationId, DeleteCallback callback); |
108 | |
109 // Returns to |callback| ids and options of all notifications. | |
110 static void getAllNotifications(GetAllNotificationsCallback callback); | |
dharcourt
2013/02/22 21:35:30
How about getNotification(selector, callback), whe
vadimt
2013/02/22 22:38:44
My usecase requires only getting all notifications
| |
101 }; | 111 }; |
102 | 112 |
103 interface Events { | 113 interface Events { |
104 // The system displayed the notification. Not all created notifications are | 114 // The system displayed the notification. Not all created notifications are |
105 // displayed; for example, a low-priority notification might simply appear | 115 // displayed; for example, a low-priority notification might simply appear |
106 // in the message center without interrupting the user. | 116 // in the message center without interrupting the user. |
107 static void onDisplayed(DOMString notificationId); | 117 static void onDisplayed(DOMString notificationId); |
108 | 118 |
109 // The notification closed, either by the system or by user action. | 119 // The notification closed, either by the system or by user action. |
110 static void onClosed(DOMString notificationId, boolean byUser); | 120 static void onClosed(DOMString notificationId, |
121 boolean byUser, | |
122 NotificationOptions options); | |
111 | 123 |
112 // The user clicked in a non-button area of the notification. | 124 // The user clicked in a non-button area of the notification. |
113 static void onClicked(DOMString notificationId); | 125 static void onClicked(DOMString notificationId, |
126 NotificationOptions options); | |
114 | 127 |
115 // The user pressed a button in the notification. | 128 // The user pressed a button in the notification. |
116 static void onButtonClicked(DOMString notificationId, long buttonIndex); | 129 static void onButtonClicked(DOMString notificationId, |
130 long buttonIndex, | |
131 NotificationOptions options); | |
117 }; | 132 }; |
118 | 133 |
119 }; | 134 }; |
OLD | NEW |