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