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

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

Issue 356673003: Notification Provider API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: bug fix Created 6 years, 5 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
(Empty)
1 // Copyright (c) 2014 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 // Use the <code>chrome.customNotificationCenter</code> API to get notifications
6 namespace customNotificationCenter {
7 [noinline_doc] enum TemplateType {
8 // icon, title, message, expandedMessage, up to two buttons
Pete Williamson 2014/07/14 19:47:48 Comments should be complete sentences, starting wi
liyanhou 2014/07/15 16:53:32 Done.
9 basic,
10
11 // icon, title, message, expandedMessage, image, up to two buttons
12 image,
13
14 // icon, title, message, items, up to two buttons
15 list,
16
17 // icon, title, message, progress, up to two buttons
18 progress
19 };
20
21 enum PermissionLevel {
22 // User has elected to show notifications from the app or extension.
23 // This is the default at install time.
24 granted,
25
26 // User has elected not to show notifications from the app or extension.
27 denied
28 };
29
30 dictionary NotificationItem {
31 // Title of one item of a list notification.
32 DOMString title;
33
34 // Additional details about this item.
35 DOMString message;
36 };
37
38 dictionary NotificationBitmap {
39 long width;
40 long height;
41
42 // |data|: a one-dimensional unit 8 array containing the data in RGBA order,
43 // 1 byte/channel (integer from 0 to 255), 4 bytes/pixel
44 // See the link for more information:
45 // http://www.w3.org/TR/2014/WD-2dcontext-20140520/
46 ArrayBuffer? data;
47 };
48
49 dictionary NotificationButton {
50 DOMString title;
51 NotificationBitmap? iconBitmap;
52 };
53
54 dictionary NotificationContent {
55 // Which type of notification to display.
56 TemplateType? type;
57
58 // Sender's avatar, app icon, or a thumbnail for image notifications.
59 NotificationBitmap? iconBitmap;
60
61 // Title of the notification (e.g. sender name for email).
62 DOMString? title;
63
64 // Main notification content.
65 DOMString? message;
66
67 // Alternate notification content with a lower-weight font.
68 DOMString? contextMessage;
69
70 // Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero
71 // is default.
72 long? priority;
73
74 // A timestamp associated with the notification, in milliseconds past the
75 // epoch (e.g. <code>Date.now() + n</code>).
76 double? eventTime;
77
78 // Text and icons for up to two notification action buttons.
79 NotificationButton[]? buttons;
80
81 // Image thumbnail for image-type notifications.
82 NotificationBitmap? imageBitmap;
83
84 // Items for multi-item notifications.
85 NotificationItem[]? items;
86
87 // Current progress ranges from 0 to 100.
88 long? progress;
89
90 // Whether to show UI indicating that the app will visibly respond to
91 // clicks on the body of a notification.
92 boolean? isClickable;
93 };
94
95 callback SendOnClearCallback = void (boolean wasCleared);
96
97 callback SendOnClickCallback = void (boolean matchExists);
98
99 callback SendOnButtonClickCallback = void (boolean matchExists);
100
101 interface Functions {
102 // Clears the specified notification.
103 // |senderId|: The id of the sender of the notification.
104 // |notificationId|: The id of the notification that was closed.
105 // |callback|: Called to indicate whether a matching notification existed.
106 static void sendOnClear(DOMString senderId,
107 DOMString notificationId,
108 SendOnClearCallback callback);
109
110 // The user clicked in a non-button area of the notification.
111 // |senderId|: The id of the sender of the notification.
112 // |notificationId|: The id of the notification that was clicked on.
113 // |callback|: Called to indicate whether a matching notification existed.
114 static void sendOnClick(DOMString senderId,
115 DOMString notificationId,
116 SendOnClickCallback callback);
117
118 // The user pressed a button in the notification.
119 // |senderId|: The id of the sender of the notification.
120 // |notificationId|: The id of the notification that was clicked on its
121 // button.
122 // |buttonIndex|: The index of the button that was clicked.
123 // |callback|: Called to indicate whether a matching notification existed.
124 static void sendOnButtonClick(DOMString senderId,
125 DOMString notificationId,
126 long buttonIndex,
127 SendOnButtonClickCallback callback);
128
129 // The user changes the permission level.
130 // |senderId|: The id of the sender of the notification.
131 // |level|: The perissionlevel of the app/extension that sent the notificati on
132 static void notifyPermissionLevelChanged(DOMString senderId,
133 PermissionLevel level);
134 };
135
136 interface Events {
137 // New notification created.
138 // |senderId|: The id of the sender of the notification.
139 // |notificationId|: The id of the newly created notification.
140 // |content|: The content of the notification: type, title, message etc.
141 static void onCreated(DOMString senderId,
142 DOMString notificaitonId,
143 NotificationContent content);
144
145 // Notification updated.
146 // |senderId|: The id of the sender of the notification.
147 // |notificationId|: The id of the updated notification.
148 // |content|: The content of the notification: type, title, message etc.
149 static void onUpdated(DOMString senderId,
150 DOMString notificationId,
151 NotificationContent content);
152
153 // Notification cleared.
154 // |senderId|: The id of the sender of the notification.
155 // |notificationId|: The id of the cleared notification.
156 static void onCleared(DOMString senderId, DOMString notificationId);
157 };
158 };
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/api.gyp ('k') | chrome/common/extensions/permissions/chrome_api_permissions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698