OLD | NEW |
---|---|
(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.notificationGetter</code> API to get notifications sent from apps and extensions | |
6 namespace notificationGetter { | |
7 [noinline_doc] enum TemplateType { | |
8 // icon, title, message, expandedMessage, up to two buttons | |
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 ArrayBuffer? data; | |
42 }; | |
43 | |
44 dictionary NotificationButton { | |
45 DOMString title; | |
46 NotificationBitmap? iconBitmap; | |
47 }; | |
48 | |
49 dictionary NotificationOptions { | |
Pete Williamson
2014/06/30 19:03:49
Can we find a more descriptive name than notificat
liyanhou
2014/07/14 17:44:44
Done.
| |
50 // Which type of notification to display. | |
51 TemplateType? type; | |
52 | |
53 // Sender's avatar, app icon, or a thumbnail for image notifications. | |
54 NotificationBitmap? iconBitmap; | |
55 | |
56 // Small icon | |
57 NotificationBitmap? smallIconBitmap; | |
58 | |
59 // Title of the notification (e.g. sender name for email). | |
60 DOMString? title; | |
61 | |
62 // Main notification content. | |
63 DOMString? message; | |
64 | |
65 // Alternate notification content with a lower-weight font. | |
66 DOMString? contextMessage; | |
67 | |
68 // Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero | |
69 // is default. | |
70 long? priority; | |
71 | |
72 // A timestamp associated with the notification, in milliseconds past the | |
73 // epoch (e.g. <code>Date.now() + n</code>). | |
74 double? eventTime; | |
75 | |
76 // Text and icons for up to two notification action buttons. | |
77 NotificationButton[]? buttons; | |
78 | |
79 // Image thumbnail for image-type notifications. | |
80 NotificationBitmap? imageBitmap; | |
81 | |
82 // Items for multi-item notifications. | |
83 NotificationItem[]? items; | |
84 | |
85 // Current progress ranges from 0 to 100. | |
86 long? progress; | |
87 | |
88 // Whether to show UI indicating that the app will visibly respond to | |
89 // clicks on the body of a notification. | |
90 boolean? isClickable; | |
91 }; | |
92 | |
93 interface Functions { | |
94 // Clears the specified notification. | |
95 // |notificationId|: The id of the notification that was closed. | |
96 // |byUser|: If the notification was closed by the user. | |
97 static void sendOnClose(DOMString senderId, DOMString notificationId, boolea n byUser); | |
98 | |
99 // The user clicked in a non-button area of the notification. | |
100 // |notificationId|: The id of the notification that was clicked on. | |
101 static void sendOnClick(DOMString senderId, DOMString notificationId); | |
102 | |
103 // The user pressed a button in the notification. | |
104 // |notificationId|: The id of the notification that was clicked on its | |
105 // button. | |
106 // |buttonIndex|: The index of the button that was clicked. | |
107 static void sendOnClickButton(DOMString senderId, DOMString notificationId, long buttonIndex); | |
108 | |
109 // User changes the permission level. | |
110 // |level|: The perissionlevel of the app/extension this | |
111 // notificaiton belongs to. | |
112 static void notifyPermissionLevelChanged(DOMString senderId, PermissionLevel level); | |
113 }; | |
114 | |
115 interface Events { | |
116 // New notification created | |
117 static void onCreated(DOMString senderId, | |
118 DOMString notificaitonId, | |
119 NotificationOptions options); | |
120 | |
121 // Notification updated | |
122 static void onUpdated(DOMString senderId, | |
123 DOMString notificationId, | |
124 NotificationOptions options); | |
125 | |
126 // Notification closed | |
127 static void onClosed(DOMString senderId, DOMString notificationId); | |
128 }; | |
129 }; | |
OLD | NEW |