Index: chrome/common/extensions/api/experimental_notification.idl |
diff --git a/chrome/common/extensions/api/experimental_notification.idl b/chrome/common/extensions/api/experimental_notification.idl |
index 1af49c245d3f7cb84bc70036782bd0c346254946..582c9b63153f69c753f10c17994e6f2836571a0d 100644 |
--- a/chrome/common/extensions/api/experimental_notification.idl |
+++ b/chrome/common/extensions/api/experimental_notification.idl |
@@ -3,6 +3,20 @@ |
// found in the LICENSE file. |
[nodoc] namespace experimental.notification { |
+ enum TemplateType { |
+ // icon, title, message |
+ simple, |
+ |
+ // icon, title, message, expandedMessage, up to two buttons |
+ basic, |
+ |
+ // icon, title, message, expandedMessage, image, up to two buttons |
+ image, |
+ |
+ // icon, title, message, items, up to two buttons |
+ list |
+ }; |
+ |
dictionary NotificationItem { |
// Title of one item of a list notification. |
DOMString title; |
@@ -11,14 +25,17 @@ |
DOMString message; |
}; |
+ dictionary NotificationButton { |
+ DOMString title; |
+ DOMString? iconUrl; |
+ }; |
+ |
dictionary NotificationOptions { |
// Which type of notification to display. |
- // |
- // simple: icon, title, message |
- // basic: our MVP, with two buttons, expanded text, etc. TEMPORARY! |
- DOMString type; |
+ TemplateType templateType; |
// Sender's avatar, app icon, or a thumbnail for image notifications. |
+ // TODO(miket): see browserAction.setIcon() for a better approach. |
DOMString iconUrl; |
// Title of the notification (e.g. sender name for email). |
@@ -31,31 +48,22 @@ |
// is default. |
long? priority; |
- // A timestamp associated with the notification. An example is |
- // "Tue, 15 Nov 1994 12:45:26 GMT". Note that RFC822 doesn't specify the |
- // timezone label "UTC." To specify UTC, use "GMT" instead. |
- DOMString? timestamp; |
+ // A timestamp associated with the notification, in W3C ISO 8601 format |
+ // (http://www.w3.org/TR/NOTE-datetime) or ECMAScript date time string |
+ // format (http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15) |
+ // as generated by date.toISOString(), for example "1994-11-15T12:45:26Z." |
+ DOMString? eventTime; |
// Smaller version of the icon. |
DOMString? secondIconUrl; |
- // A number, controlled entirely by the caller, that is intended to |
- // summarize the number of outstanding notifications. TODO(miket) what does |
- // that mean? |
- long? unreadCount; |
- |
- // Text and icon of the first button in the notification. |
- DOMString? buttonOneTitle; |
- DOMString? buttonOneIconUrl; |
- |
- // Text and icon of the second button in the notification. |
- DOMString? buttonTwoTitle; |
- DOMString? buttonTwoIconUrl; |
+ // Text and icons of notification action buttons. |
+ NotificationButton[]? buttons; |
// Secondary notification content. |
DOMString? expandedMessage; |
- // Image thumbnail for image-type notifications |
+ // Image thumbnail for image-type notifications. |
DOMString? imageUrl; |
// Items for multi-item notifications. |
@@ -71,8 +79,10 @@ |
interface Functions { |
// Creates and displays a notification having the contents in |options|, |
// identified by the id |notificationId|. If |notificationId| is empty, |
- // |create| generates an id. |callback| returns the notification id (either |
- // supplied or generated) that represents the created notification. |
+ // |create| generates an id. If |notificationId| matches an existing |
+ // notification, |create| first deletes that notification before proceeding |
+ // with the create operation. |callback| returns the notification id |
+ // (either supplied or generated) that represents the created notification. |
static void create(DOMString notificationId, |
NotificationOptions options, |
CreateCallback callback); |
@@ -91,13 +101,11 @@ |
}; |
interface Events { |
- // The system displayed the notification. |
+ // The system displayed the notification. Not all created notifications are |
+ // displayed; for example, a low-priority notification might simply appear |
+ // in the message center without interrupting the user. |
dharcourt
2013/02/06 21:34:20
I'm confused... will onDisplayed() be called: 1) e
|
static void onDisplayed(DOMString notificationId); |
- // An error occurred. TODO(miket): which errors can happen, and when? In |
- // which form (string, ID) should we describe the error? |
- static void onError(DOMString notificationId); |
- |
// The notification closed, either by the system or by user action. |
static void onClosed(DOMString notificationId, boolean byUser); |