OLD | NEW |
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 // Use the <code>chrome.notifications</code> API to create rich notifications | 5 // Use the <code>chrome.notifications</code> API to create rich notifications |
6 // using templates and show these notifications to users in the system tray. | 6 // using templates and show these notifications to users in the system tray. |
7 namespace notifications { | 7 namespace notifications { |
8 [noinline_doc] enum TemplateType { | 8 [noinline_doc] enum TemplateType { |
9 // icon, title, message, expandedMessage, up to two buttons | 9 // icon, title, message, expandedMessage, up to two buttons |
10 basic, | 10 basic, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 DOMString title; | 46 DOMString title; |
47 DOMString? iconUrl; | 47 DOMString? iconUrl; |
48 [nodoc] NotificationBitmap? iconBitmap; | 48 [nodoc] NotificationBitmap? iconBitmap; |
49 }; | 49 }; |
50 | 50 |
51 dictionary NotificationOptions { | 51 dictionary NotificationOptions { |
52 // Which type of notification to display. | 52 // Which type of notification to display. |
53 // <em>Required for $(ref:notifications.create)</em> method. | 53 // <em>Required for $(ref:notifications.create)</em> method. |
54 TemplateType? type; | 54 TemplateType? type; |
55 | 55 |
56 // Sender's avatar, app icon, or a thumbnail for image notifications. | 56 // A URL to the sender's avatar, app icon, or a thumbnail for image |
| 57 // notifications. |
| 58 // |
| 59 // URLs can be a data URL, a blob URL, or a URL relative to a resource |
| 60 // within this extension's .crx file |
57 // <em>Required for $(ref:notifications.create)</em> method. | 61 // <em>Required for $(ref:notifications.create)</em> method. |
58 DOMString? iconUrl; | 62 DOMString? iconUrl; |
59 [nodoc] NotificationBitmap? iconBitmap; | 63 [nodoc] NotificationBitmap? iconBitmap; |
60 | 64 |
| 65 // A URL to the app icon mask. URLs have the same restrictions as |
| 66 // $(ref:notifications.NotificationOptions.iconUrl iconUrl). |
| 67 // |
| 68 // The app icon mask should be in alpha channel, as only the alpha channel |
| 69 // of the image will be considered. |
| 70 DOMString? appIconMaskUrl; |
| 71 [nodoc] NotificationBitmap? appIconMaskBitmap; |
| 72 |
61 // Title of the notification (e.g. sender name for email). | 73 // Title of the notification (e.g. sender name for email). |
62 // <em>Required for $(ref:notifications.create)</em> method. | 74 // <em>Required for $(ref:notifications.create)</em> method. |
63 DOMString? title; | 75 DOMString? title; |
64 | 76 |
65 // Main notification content. | 77 // Main notification content. |
66 // <em>Required for $(ref:notifications.create)</em> method. | 78 // <em>Required for $(ref:notifications.create)</em> method. |
67 DOMString? message; | 79 DOMString? message; |
68 | 80 |
69 // Alternate notification content with a lower-weight font. | 81 // Alternate notification content with a lower-weight font. |
70 DOMString? contextMessage; | 82 DOMString? contextMessage; |
71 | 83 |
72 // Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero | 84 // Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero |
73 // is default. | 85 // is default. |
74 long? priority; | 86 long? priority; |
75 | 87 |
76 // A timestamp associated with the notification, in milliseconds past the | 88 // A timestamp associated with the notification, in milliseconds past the |
77 // epoch (e.g. <code>Date.now() + n</code>). | 89 // epoch (e.g. <code>Date.now() + n</code>). |
78 double? eventTime; | 90 double? eventTime; |
79 | 91 |
80 // Text and icons for up to two notification action buttons. | 92 // Text and icons for up to two notification action buttons. |
81 NotificationButton[]? buttons; | 93 NotificationButton[]? buttons; |
82 | 94 |
83 // Secondary notification content. | 95 // Secondary notification content. |
84 [nodoc] DOMString? expandedMessage; | 96 [nodoc] DOMString? expandedMessage; |
85 | 97 |
86 // Image thumbnail for image-type notifications. | 98 // A URL to the image thumbnail for image-type notifications. |
| 99 // URLs have the same restrictions as |
| 100 // $(ref:notifications.NotificationOptions.iconUrl iconUrl). |
87 DOMString? imageUrl; | 101 DOMString? imageUrl; |
88 [nodoc] NotificationBitmap? imageBitmap; | 102 [nodoc] NotificationBitmap? imageBitmap; |
89 | 103 |
90 // Items for multi-item notifications. | 104 // Items for multi-item notifications. |
91 NotificationItem[]? items; | 105 NotificationItem[]? items; |
92 | 106 |
93 // Current progress ranges from 0 to 100. | 107 // Current progress ranges from 0 to 100. |
94 long? progress; | 108 long? progress; |
95 | 109 |
96 // Whether to show UI indicating that the app will visibly respond to | 110 // Whether to show UI indicating that the app will visibly respond to |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 static void onButtonClicked(DOMString notificationId, long buttonIndex); | 171 static void onButtonClicked(DOMString notificationId, long buttonIndex); |
158 | 172 |
159 // The user changes the permission level. | 173 // The user changes the permission level. |
160 static void onPermissionLevelChanged(PermissionLevel level); | 174 static void onPermissionLevelChanged(PermissionLevel level); |
161 | 175 |
162 // The user clicked on a link for the app's notification settings. | 176 // The user clicked on a link for the app's notification settings. |
163 static void onShowSettings(); | 177 static void onShowSettings(); |
164 }; | 178 }; |
165 | 179 |
166 }; | 180 }; |
OLD | NEW |