| 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 |
| 70 interface Functions { | 72 interface Functions { |
| 71 // Creates and displays a notification having the contents in |options|, | 73 // Creates and displays a notification having the contents in |options|, |
| 72 // identified by the id |notificationId|. If |notificationId| is empty, | 74 // identified by the id |notificationId|. If |notificationId| is empty, |
| 73 // |create| generates an id. If |notificationId| matches an existing | 75 // |create| generates an id. If |notificationId| matches an existing |
| 74 // notification, |create| first clears that notification before proceeding | 76 // notification, |create| first clears that notification before proceeding |
| 75 // with the create operation. |callback| returns the notification id | 77 // with the create operation. |callback| returns the notification id |
| 76 // (either supplied or generated) that represents the created notification. | 78 // (either supplied or generated) that represents the created notification. |
| 77 static void create(DOMString notificationId, | 79 static void create(DOMString notificationId, |
| 78 NotificationOptions options, | 80 NotificationOptions options, |
| 79 CreateCallback callback); | 81 CreateCallback callback); |
| 80 | 82 |
| 81 // Updates an existing notification having the id |notificationId| and the | 83 // Updates an existing notification having the id |notificationId| and the |
| 82 // options |options|. |callback| indicates whether a matching notification | 84 // options |options|. |callback| indicates whether a matching notification |
| 83 // existed. | 85 // existed. |
| 84 static void update(DOMString notificationId, | 86 static void update(DOMString notificationId, |
| 85 NotificationOptions options, | 87 NotificationOptions options, |
| 86 UpdateCallback callback); | 88 UpdateCallback callback); |
| 87 | 89 |
| 88 // Given a |notificationId| returned by the |create| method, clears the | 90 // Given a |notificationId| returned by the |create| method, clears the |
| 89 // corresponding notification. |callback| indicates whether a matching | 91 // corresponding notification. |callback| indicates whether a matching |
| 90 // notification existed. | 92 // notification existed. |
| 91 static void clear(DOMString notificationId, ClearCallback callback); | 93 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); |
| 92 }; | 98 }; |
| 93 | 99 |
| 94 interface Events { | 100 interface Events { |
| 95 // The notification closed, either by the system or by user action. | 101 // The notification closed, either by the system or by user action. |
| 96 static void onClosed(DOMString notificationId, boolean byUser); | 102 static void onClosed(DOMString notificationId, boolean byUser); |
| 97 | 103 |
| 98 // The user clicked in a non-button area of the notification. | 104 // The user clicked in a non-button area of the notification. |
| 99 static void onClicked(DOMString notificationId); | 105 static void onClicked(DOMString notificationId); |
| 100 | 106 |
| 101 // The user pressed a button in the notification. | 107 // The user pressed a button in the notification. |
| 102 static void onButtonClicked(DOMString notificationId, long buttonIndex); | 108 static void onButtonClicked(DOMString notificationId, long buttonIndex); |
| 103 }; | 109 }; |
| 104 | 110 |
| 105 }; | 111 }; |
| OLD | NEW |