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 namespace notifications { | 5 namespace notifications { |
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // Items for multi-item notifications. | 63 // Items for multi-item notifications. |
64 NotificationItem[]? items; | 64 NotificationItem[]? items; |
65 }; | 65 }; |
66 | 66 |
67 callback CreateCallback = void (DOMString notificationId); | 67 callback CreateCallback = void (DOMString notificationId); |
68 | 68 |
69 callback UpdateCallback = void (boolean wasUpdated); | 69 callback UpdateCallback = void (boolean wasUpdated); |
70 | 70 |
71 callback ClearCallback = void (boolean wasCleared); | 71 callback ClearCallback = void (boolean wasCleared); |
72 | 72 |
| 73 callback GetAllCallback = void (object notifications); |
| 74 |
73 interface Functions { | 75 interface Functions { |
74 // Creates and displays a notification having the contents in |options|, | 76 // Creates and displays a notification having the contents in |options|, |
75 // identified by the id |notificationId|. If |notificationId| is empty, | 77 // identified by the id |notificationId|. If |notificationId| is empty, |
76 // |create| generates an id. If |notificationId| matches an existing | 78 // |create| generates an id. If |notificationId| matches an existing |
77 // notification, |create| first clears that notification before proceeding | 79 // notification, |create| first clears that notification before proceeding |
78 // with the create operation. |callback| returns the notification id | 80 // with the create operation. |callback| returns the notification id |
79 // (either supplied or generated) that represents the created notification. | 81 // (either supplied or generated) that represents the created notification. |
80 static void create(DOMString notificationId, | 82 static void create(DOMString notificationId, |
81 NotificationOptions options, | 83 NotificationOptions options, |
82 CreateCallback callback); | 84 CreateCallback callback); |
83 | 85 |
84 // Updates an existing notification having the id |notificationId| and the | 86 // Updates an existing notification having the id |notificationId| and the |
85 // options |options|. |callback| indicates whether a matching notification | 87 // options |options|. |callback| indicates whether a matching notification |
86 // existed. | 88 // existed. |
87 static void update(DOMString notificationId, | 89 static void update(DOMString notificationId, |
88 NotificationOptions options, | 90 NotificationOptions options, |
89 UpdateCallback callback); | 91 UpdateCallback callback); |
90 | 92 |
91 // Given a |notificationId| returned by the |create| method, clears the | 93 // Given a |notificationId| returned by the |create| method, clears the |
92 // corresponding notification. |callback| indicates whether a matching | 94 // corresponding notification. |callback| indicates whether a matching |
93 // notification existed. | 95 // notification existed. |
94 static void clear(DOMString notificationId, ClearCallback callback); | 96 static void clear(DOMString notificationId, ClearCallback callback); |
| 97 |
| 98 // |callback| is executed with the set of notification_ids currently in |
| 99 // the system. |
| 100 static void getAll(GetAllCallback callback); |
95 }; | 101 }; |
96 | 102 |
97 interface Events { | 103 interface Events { |
98 // The notification closed, either by the system or by user action. | 104 // The notification closed, either by the system or by user action. |
99 static void onClosed(DOMString notificationId, boolean byUser); | 105 static void onClosed(DOMString notificationId, boolean byUser); |
100 | 106 |
101 // The user clicked in a non-button area of the notification. | 107 // The user clicked in a non-button area of the notification. |
102 static void onClicked(DOMString notificationId); | 108 static void onClicked(DOMString notificationId); |
103 | 109 |
104 // The user pressed a button in the notification. | 110 // The user pressed a button in the notification. |
105 static void onButtonClicked(DOMString notificationId, long buttonIndex); | 111 static void onButtonClicked(DOMString notificationId, long buttonIndex); |
106 }; | 112 }; |
107 | 113 |
108 }; | 114 }; |
OLD | NEW |