| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 [nodoc] namespace experimental.notification { |
| 6 dictionary NotificationItem { |
| 7 // Title of one item of a list notification. |
| 8 DOMString title; |
| 9 |
| 10 // Additional details about this item. |
| 11 DOMString message; |
| 12 }; |
| 13 |
| 14 dictionary NotificationOptions { |
| 15 // Which type of notification to display. |
| 16 // |
| 17 // simple: icon, title, message |
| 18 // basic: our MVP, with two buttons, expanded text, etc. TEMPORARY! |
| 19 DOMString type; |
| 20 |
| 21 // Sender's avatar, app icon, or a thumbnail for image notifications. |
| 22 DOMString iconUrl; |
| 23 |
| 24 // Title of the notification (e.g. sender name for email). |
| 25 DOMString title; |
| 26 |
| 27 // Main notification content. |
| 28 DOMString message; |
| 29 |
| 30 // Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero |
| 31 // is default. |
| 32 long? priority; |
| 33 |
| 34 // A timestamp associated with the notification. An example is |
| 35 // "Tue, 15 Nov 1994 12:45:26 GMT". Note that RFC822 doesn't specify the |
| 36 // timezone label "UTC." To specify UTC, use "GMT" instead. |
| 37 DOMString? timestamp; |
| 38 |
| 39 // Smaller version of the icon. |
| 40 DOMString? secondIconUrl; |
| 41 |
| 42 // A number, controlled entirely by the caller, that is intended to |
| 43 // summarize the number of outstanding notifications. TODO(miket) what does |
| 44 // that mean? |
| 45 long? unreadCount; |
| 46 |
| 47 // Text and icon of the first button in the notification. |
| 48 DOMString? buttonOneTitle; |
| 49 DOMString? buttonOneIconUrl; |
| 50 |
| 51 // Text and icon of the second button in the notification. |
| 52 DOMString? buttonTwoTitle; |
| 53 DOMString? buttonTwoIconUrl; |
| 54 |
| 55 // Secondary notification content. |
| 56 DOMString? expandedMessage; |
| 57 |
| 58 // Image thumbnail for image-type notifications |
| 59 DOMString? imageUrl; |
| 60 |
| 61 // Items for multi-item notifications. |
| 62 NotificationItem[]? items; |
| 63 }; |
| 64 |
| 65 callback CreateCallback = void (DOMString notificationId); |
| 66 |
| 67 callback UpdateCallback = void (boolean wasUpdated); |
| 68 |
| 69 callback DeleteCallback = void (boolean wasDeleted); |
| 70 |
| 71 interface Functions { |
| 72 // Creates and displays a notification having the contents in |options|, |
| 73 // identified by the id |notificationId|. If |notificationId| is empty, |
| 74 // |create| generates an id. |callback| returns the notification id (either |
| 75 // supplied or generated) that represents the created notification. |
| 76 static void create(DOMString notificationId, |
| 77 NotificationOptions options, |
| 78 CreateCallback callback); |
| 79 |
| 80 // Updates an existing notification having the id |notificationId| and the |
| 81 // options |options|. |callback| indicates whether a matching notification |
| 82 // existed. |
| 83 static void update(DOMString notificationId, |
| 84 NotificationOptions options, |
| 85 UpdateCallback callback); |
| 86 |
| 87 // Given a |notificationId| returned by the |create| method, deletes the |
| 88 // corresponding notification. |callback| indicates whether a matching |
| 89 // notification existed. |
| 90 static void delete(DOMString notificationId, DeleteCallback callback); |
| 91 }; |
| 92 |
| 93 interface Events { |
| 94 // The system displayed the notification. |
| 95 static void onDisplayed(DOMString notificationId); |
| 96 |
| 97 // An error occurred. TODO(miket): which errors can happen, and when? In |
| 98 // which form (string, ID) should we describe the error? |
| 99 static void onError(DOMString notificationId); |
| 100 |
| 101 // The notification closed, either by the system or by user action. |
| 102 static void onClosed(DOMString notificationId, boolean byUser); |
| 103 |
| 104 // The user clicked in a non-button area of the notification. |
| 105 static void onClicked(DOMString notificationId); |
| 106 |
| 107 // The user pressed a button in the notification. |
| 108 static void onButtonClicked(DOMString notificationId, long buttonIndex); |
| 109 }; |
| 110 |
| 111 }; |
| OLD | NEW |