Chromium Code Reviews| 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 18 matching lines...) Expand all Loading... | |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 dictionary NotificationItem { | 31 dictionary NotificationItem { |
| 32 // Title of one item of a list notification. | 32 // Title of one item of a list notification. |
| 33 DOMString title; | 33 DOMString title; |
| 34 | 34 |
| 35 // Additional details about this item. | 35 // Additional details about this item. |
| 36 DOMString message; | 36 DOMString message; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 [nodoc] dictionary NotificationBitmap { | 39 // Contains an array of RGBA bitmap data, 32 bits per channel. |data| |
| 40 long width; | 40 // should therefore have a length equal to 4 * width * height. |
| 41 long height; | 41 dictionary BitmapData { |
| 42 ArrayBuffer? data; | 42 ArrayBuffer data; |
| 43 double width; | |
| 44 double height; | |
| 45 }; | |
| 46 | |
| 47 dictionary ImageRepresentation { | |
| 48 // The pixel ratio for which this bitmap is intended. | |
| 49 double scale; | |
| 50 // A URL from which the image will be downloaded. | |
| 51 (DOMString or BitmapData) data; | |
| 43 }; | 52 }; |
| 44 | 53 |
| 45 dictionary NotificationButton { | 54 dictionary NotificationButton { |
| 46 DOMString title; | 55 DOMString title; |
| 56 // The icon used with the button. Either an icon URL or a spec must be | |
| 57 // provided. | |
| 47 DOMString? iconUrl; | 58 DOMString? iconUrl; |
| 48 [nodoc] NotificationBitmap? iconBitmap; | 59 ImageRepresentation[]? icons; |
|
benwells
2014/06/27 03:15:27
I think having these names be plural is confusing.
dewittj
2014/07/01 15:06:11
Done.
| |
| 49 }; | 60 }; |
| 50 | 61 |
| 51 dictionary NotificationOptions { | 62 dictionary NotificationOptions { |
| 52 // Which type of notification to display. | 63 // Which type of notification to display. |
| 53 // <em>Required for $(ref:notifications.create)</em> method. | 64 // <em>Required for $(ref:notifications.create)</em> method. |
| 54 TemplateType? type; | 65 TemplateType? type; |
| 55 | 66 |
| 56 // Sender's avatar, app icon, or a thumbnail for image notifications. | 67 // Sender's avatar, app icon, or a thumbnail for image notifications. |
|
benwells
2014/06/27 03:15:27
Are we intending notifications to have app icons h
dewittj
2014/07/01 15:06:11
We haven't been too prescriptive about what is acc
benwells
2014/07/02 03:11:11
I was thinking about the comment here not the name
| |
| 57 // <em>Required for $(ref:notifications.create)</em> method. | 68 // Either an iconUrl or a ImageRepresentation must be provided. |
| 58 DOMString? iconUrl; | 69 DOMString? iconUrl; |
| 59 [nodoc] NotificationBitmap? iconBitmap; | 70 ImageRepresentation[]? icons; |
| 60 | 71 |
| 61 // Title of the notification (e.g. sender name for email). | 72 // Title of the notification (e.g. sender name for email). |
| 62 // <em>Required for $(ref:notifications.create)</em> method. | 73 // <em>Required for $(ref:notifications.create)</em> method. |
| 63 DOMString? title; | 74 DOMString? title; |
| 64 | 75 |
| 65 // Main notification content. | 76 // Main notification content. |
| 66 // <em>Required for $(ref:notifications.create)</em> method. | 77 // <em>Required for $(ref:notifications.create)</em> method. |
| 67 DOMString? message; | 78 DOMString? message; |
| 68 | 79 |
| 69 // Alternate notification content with a lower-weight font. | 80 // Alternate notification content with a lower-weight font. |
| 70 DOMString? contextMessage; | 81 DOMString? contextMessage; |
| 71 | 82 |
| 72 // Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero | 83 // Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero |
| 73 // is default. | 84 // is default. |
| 74 long? priority; | 85 long? priority; |
| 75 | 86 |
| 76 // A timestamp associated with the notification, in milliseconds past the | 87 // A timestamp associated with the notification, in milliseconds past the |
| 77 // epoch (e.g. <code>Date.now() + n</code>). | 88 // epoch (e.g. <code>Date.now() + n</code>). |
| 78 double? eventTime; | 89 double? eventTime; |
| 79 | 90 |
| 80 // Text and icons for up to two notification action buttons. | 91 // Text and icons for up to two notification action buttons. |
| 81 NotificationButton[]? buttons; | 92 NotificationButton[]? buttons; |
| 82 | 93 |
| 83 // Secondary notification content. | 94 // Secondary notification content. This field is deprecated and unused. |
| 84 [nodoc] DOMString? expandedMessage; | 95 [deprecated] DOMString? expandedMessage; |
| 85 | 96 |
| 86 // Image thumbnail for image-type notifications. | 97 // Image thumbnail for image-type notifications. Either an imageUrl or an i mageSpec |
| 98 // must be provided. | |
| 87 DOMString? imageUrl; | 99 DOMString? imageUrl; |
| 88 [nodoc] NotificationBitmap? imageBitmap; | 100 ImageRepresentation[]? images; |
| 89 | 101 |
| 90 // Items for multi-item notifications. | 102 // Items for multi-item notifications. |
| 91 NotificationItem[]? items; | 103 NotificationItem[]? items; |
| 92 | 104 |
| 93 // Current progress ranges from 0 to 100. | 105 // Current progress ranges from 0 to 100. |
| 94 long? progress; | 106 long? progress; |
| 95 | 107 |
| 96 // Whether to show UI indicating that the app will visibly respond to | 108 // Whether to show UI indicating that the app will visibly respond to |
| 97 // clicks on the body of a notification. | 109 // clicks on the body of a notification. |
| 98 boolean? isClickable; | 110 boolean? isClickable; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 static void onButtonClicked(DOMString notificationId, long buttonIndex); | 169 static void onButtonClicked(DOMString notificationId, long buttonIndex); |
| 158 | 170 |
| 159 // The user changes the permission level. | 171 // The user changes the permission level. |
| 160 static void onPermissionLevelChanged(PermissionLevel level); | 172 static void onPermissionLevelChanged(PermissionLevel level); |
| 161 | 173 |
| 162 // The user clicked on a link for the app's notification settings. | 174 // The user clicked on a link for the app's notification settings. |
| 163 static void onShowSettings(); | 175 static void onShowSettings(); |
| 164 }; | 176 }; |
| 165 | 177 |
| 166 }; | 178 }; |
| OLD | NEW |