Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(477)

Side by Side Diff: chrome/common/extensions/api/experimental_notification.idl

Issue 12212037: Update notifications API after review. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge conflict resolved Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 [nodoc] namespace experimental.notification { 5 [nodoc] namespace experimental.notification {
6 enum TemplateType {
7 // icon, title, message
8 simple,
9
10 // icon, title, message, expandedMessage, up to two buttons
11 basic,
12
13 // icon, title, message, expandedMessage, image, up to two buttons
14 image,
15
16 // icon, title, message, items, up to two buttons
17 list
18 };
19
6 dictionary NotificationItem { 20 dictionary NotificationItem {
7 // Title of one item of a list notification. 21 // Title of one item of a list notification.
8 DOMString title; 22 DOMString title;
9 23
10 // Additional details about this item. 24 // Additional details about this item.
11 DOMString message; 25 DOMString message;
12 }; 26 };
13 27
28 dictionary NotificationButton {
29 DOMString title;
30 DOMString? iconUrl;
31 };
32
14 dictionary NotificationOptions { 33 dictionary NotificationOptions {
15 // Which type of notification to display. 34 // Which type of notification to display.
16 // 35 TemplateType templateType;
17 // simple: icon, title, message
18 // basic: our MVP, with two buttons, expanded text, etc. TEMPORARY!
19 DOMString type;
20 36
21 // Sender's avatar, app icon, or a thumbnail for image notifications. 37 // Sender's avatar, app icon, or a thumbnail for image notifications.
38 // TODO(miket): see browserAction.setIcon() for a better approach.
22 DOMString iconUrl; 39 DOMString iconUrl;
23 40
24 // Title of the notification (e.g. sender name for email). 41 // Title of the notification (e.g. sender name for email).
25 DOMString title; 42 DOMString title;
26 43
27 // Main notification content. 44 // Main notification content.
28 DOMString message; 45 DOMString message;
29 46
30 // Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero 47 // Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero
31 // is default. 48 // is default.
32 long? priority; 49 long? priority;
33 50
34 // A timestamp associated with the notification. An example is 51 // A timestamp associated with the notification, in W3C ISO 8601 format
35 // "Tue, 15 Nov 1994 12:45:26 GMT". Note that RFC822 doesn't specify the 52 // (http://www.w3.org/TR/NOTE-datetime) or ECMAScript date time string
36 // timezone label "UTC." To specify UTC, use "GMT" instead. 53 // format (http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15)
37 DOMString? timestamp; 54 // as generated by date.toISOString(), for example "1994-11-15T12:45:26Z."
55 DOMString? eventTime;
38 56
39 // Smaller version of the icon. 57 // Smaller version of the icon.
40 DOMString? secondIconUrl; 58 DOMString? secondIconUrl;
41 59
42 // A number, controlled entirely by the caller, that is intended to 60 // Text and icons of notification action buttons.
43 // summarize the number of outstanding notifications. TODO(miket) what does 61 NotificationButton[]? buttons;
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 62
55 // Secondary notification content. 63 // Secondary notification content.
56 DOMString? expandedMessage; 64 DOMString? expandedMessage;
57 65
58 // Image thumbnail for image-type notifications 66 // Image thumbnail for image-type notifications.
59 DOMString? imageUrl; 67 DOMString? imageUrl;
60 68
61 // Items for multi-item notifications. 69 // Items for multi-item notifications.
62 NotificationItem[]? items; 70 NotificationItem[]? items;
63 }; 71 };
64 72
65 callback CreateCallback = void (DOMString notificationId); 73 callback CreateCallback = void (DOMString notificationId);
66 74
67 callback UpdateCallback = void (boolean wasUpdated); 75 callback UpdateCallback = void (boolean wasUpdated);
68 76
69 callback DeleteCallback = void (boolean wasDeleted); 77 callback DeleteCallback = void (boolean wasDeleted);
70 78
71 interface Functions { 79 interface Functions {
72 // Creates and displays a notification having the contents in |options|, 80 // Creates and displays a notification having the contents in |options|,
73 // identified by the id |notificationId|. If |notificationId| is empty, 81 // identified by the id |notificationId|. If |notificationId| is empty,
74 // |create| generates an id. |callback| returns the notification id (either 82 // |create| generates an id. If |notificationId| matches an existing
75 // supplied or generated) that represents the created notification. 83 // notification, |create| first deletes that notification before proceeding
84 // with the create operation. |callback| returns the notification id
85 // (either supplied or generated) that represents the created notification.
76 static void create(DOMString notificationId, 86 static void create(DOMString notificationId,
77 NotificationOptions options, 87 NotificationOptions options,
78 CreateCallback callback); 88 CreateCallback callback);
79 89
80 // Updates an existing notification having the id |notificationId| and the 90 // Updates an existing notification having the id |notificationId| and the
81 // options |options|. |callback| indicates whether a matching notification 91 // options |options|. |callback| indicates whether a matching notification
82 // existed. 92 // existed.
83 static void update(DOMString notificationId, 93 static void update(DOMString notificationId,
84 NotificationOptions options, 94 NotificationOptions options,
85 UpdateCallback callback); 95 UpdateCallback callback);
86 96
87 // Given a |notificationId| returned by the |create| method, deletes the 97 // Given a |notificationId| returned by the |create| method, deletes the
88 // corresponding notification. |callback| indicates whether a matching 98 // corresponding notification. |callback| indicates whether a matching
89 // notification existed. 99 // notification existed.
90 static void delete(DOMString notificationId, DeleteCallback callback); 100 static void delete(DOMString notificationId, DeleteCallback callback);
91 }; 101 };
92 102
93 interface Events { 103 interface Events {
94 // The system displayed the notification. 104 // The system displayed the notification. Not all created notifications are
105 // displayed; for example, a low-priority notification might simply appear
106 // in the message center without interrupting the user.
95 static void onDisplayed(DOMString notificationId); 107 static void onDisplayed(DOMString notificationId);
96 108
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. 109 // The notification closed, either by the system or by user action.
102 static void onClosed(DOMString notificationId, boolean byUser); 110 static void onClosed(DOMString notificationId, boolean byUser);
103 111
104 // The user clicked in a non-button area of the notification. 112 // The user clicked in a non-button area of the notification.
105 static void onClicked(DOMString notificationId); 113 static void onClicked(DOMString notificationId);
106 114
107 // The user pressed a button in the notification. 115 // The user pressed a button in the notification.
108 static void onButtonClicked(DOMString notificationId, long buttonIndex); 116 static void onButtonClicked(DOMString notificationId, long buttonIndex);
109 }; 117 };
110 118
111 }; 119 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698