| 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, |
| 11 | 11 |
| 12 // icon, title, message, expandedMessage, image, up to two buttons | 12 // icon, title, message, expandedMessage, image, up to two buttons |
| 13 [deprecated="The image is not visible for Mac OS X users."] |
| 13 image, | 14 image, |
| 14 | 15 |
| 15 // icon, title, message, items, up to two buttons | 16 // icon, title, message, items, up to two buttons. Users on Mac OS X only |
| 17 // see the first item. |
| 16 list, | 18 list, |
| 17 | 19 |
| 18 // icon, title, message, progress, up to two buttons | 20 // icon, title, message, progress, up to two buttons |
| 19 progress | 21 progress |
| 20 }; | 22 }; |
| 21 | 23 |
| 22 enum PermissionLevel { | 24 enum PermissionLevel { |
| 23 // User has elected to show notifications from the app or extension. | 25 // User has elected to show notifications from the app or extension. |
| 24 // This is the default at install time. | 26 // This is the default at install time. |
| 25 granted, | 27 granted, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 37 }; | 39 }; |
| 38 | 40 |
| 39 [nodoc] dictionary NotificationBitmap { | 41 [nodoc] dictionary NotificationBitmap { |
| 40 long width; | 42 long width; |
| 41 long height; | 43 long height; |
| 42 ArrayBuffer? data; | 44 ArrayBuffer? data; |
| 43 }; | 45 }; |
| 44 | 46 |
| 45 dictionary NotificationButton { | 47 dictionary NotificationButton { |
| 46 DOMString title; | 48 DOMString title; |
| 49 [deprecated="Button icons not visible for Mac OS X users."] |
| 47 DOMString? iconUrl; | 50 DOMString? iconUrl; |
| 48 [nodoc] NotificationBitmap? iconBitmap; | 51 [nodoc] NotificationBitmap? iconBitmap; |
| 49 }; | 52 }; |
| 50 | 53 |
| 51 dictionary NotificationOptions { | 54 dictionary NotificationOptions { |
| 52 // Which type of notification to display. | 55 // Which type of notification to display. |
| 53 // <em>Required for $(ref:notifications.create)</em> method. | 56 // <em>Required for $(ref:notifications.create)</em> method. |
| 54 TemplateType? type; | 57 TemplateType? type; |
| 55 | 58 |
| 56 // A URL to the sender's avatar, app icon, or a thumbnail for image | 59 // A URL to the sender's avatar, app icon, or a thumbnail for image |
| 57 // notifications. | 60 // notifications. |
| 58 // | 61 // |
| 59 // URLs can be a data URL, a blob URL, or a URL relative to a resource | 62 // URLs can be a data URL, a blob URL, or a URL relative to a resource |
| 60 // within this extension's .crx file | 63 // within this extension's .crx file |
| 61 // <em>Required for $(ref:notifications.create)</em> method. | 64 // <em>Required for $(ref:notifications.create)</em> method. |
| 62 DOMString? iconUrl; | 65 DOMString? iconUrl; |
| 63 [nodoc] NotificationBitmap? iconBitmap; | 66 [nodoc] NotificationBitmap? iconBitmap; |
| 64 | 67 |
| 65 // A URL to the app icon mask. URLs have the same restrictions as | 68 // A URL to the app icon mask. URLs have the same restrictions as |
| 66 // $(ref:notifications.NotificationOptions.iconUrl iconUrl). | 69 // $(ref:notifications.NotificationOptions.iconUrl iconUrl). |
| 67 // | 70 // |
| 68 // The app icon mask should be in alpha channel, as only the alpha channel | 71 // The app icon mask should be in alpha channel, as only the alpha channel |
| 69 // of the image will be considered. | 72 // of the image will be considered. |
| 73 [deprecated="The app icon mask is not visible for Mac OS X users."] |
| 70 DOMString? appIconMaskUrl; | 74 DOMString? appIconMaskUrl; |
| 71 [nodoc] NotificationBitmap? appIconMaskBitmap; | 75 [nodoc] NotificationBitmap? appIconMaskBitmap; |
| 72 | 76 |
| 73 // Title of the notification (e.g. sender name for email). | 77 // Title of the notification (e.g. sender name for email). |
| 74 // <em>Required for $(ref:notifications.create)</em> method. | 78 // <em>Required for $(ref:notifications.create)</em> method. |
| 75 DOMString? title; | 79 DOMString? title; |
| 76 | 80 |
| 77 // Main notification content. | 81 // Main notification content. |
| 78 // <em>Required for $(ref:notifications.create)</em> method. | 82 // <em>Required for $(ref:notifications.create)</em> method. |
| 79 DOMString? message; | 83 DOMString? message; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 91 // epoch (e.g. <code>Date.now() + n</code>). | 95 // epoch (e.g. <code>Date.now() + n</code>). |
| 92 double? eventTime; | 96 double? eventTime; |
| 93 | 97 |
| 94 // Text and icons for up to two notification action buttons. | 98 // Text and icons for up to two notification action buttons. |
| 95 NotificationButton[]? buttons; | 99 NotificationButton[]? buttons; |
| 96 | 100 |
| 97 // Secondary notification content. | 101 // Secondary notification content. |
| 98 [nodoc] DOMString? expandedMessage; | 102 [nodoc] DOMString? expandedMessage; |
| 99 | 103 |
| 100 // A URL to the image thumbnail for image-type notifications. | 104 // A URL to the image thumbnail for image-type notifications. |
| 101 // URLs have the same restrictions as | 105 // URLs have the same restrictions as |
| 102 // $(ref:notifications.NotificationOptions.iconUrl iconUrl). | 106 // $(ref:notifications.NotificationOptions.iconUrl iconUrl). |
| 107 [deprecated="The image is not visible for Mac OS X users."] |
| 103 DOMString? imageUrl; | 108 DOMString? imageUrl; |
| 104 [nodoc] NotificationBitmap? imageBitmap; | 109 [nodoc] NotificationBitmap? imageBitmap; |
| 105 | 110 |
| 106 // Items for multi-item notifications. | 111 // Items for multi-item notifications. Users on Mac OS X only see the first |
| 112 // item. |
| 107 NotificationItem[]? items; | 113 NotificationItem[]? items; |
| 108 | 114 |
| 109 // Current progress ranges from 0 to 100. | 115 // Current progress ranges from 0 to 100. |
| 110 long? progress; | 116 long? progress; |
| 111 | 117 |
| 112 // Whether to show UI indicating that the app will visibly respond to | 118 // Whether to show UI indicating that the app will visibly respond to |
| 113 // clicks on the body of a notification. | 119 // clicks on the body of a notification. |
| 114 boolean? isClickable; | 120 boolean? isClickable; |
| 115 | 121 |
| 116 // Indicates that the notification should remain visible on screen until the | 122 // Indicates that the notification should remain visible on screen until the |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 193 |
| 188 // The user changes the permission level. As of Chrome 47, only ChromeOS | 194 // The user changes the permission level. As of Chrome 47, only ChromeOS |
| 189 // has UI that dispatches this event. | 195 // has UI that dispatches this event. |
| 190 static void onPermissionLevelChanged(PermissionLevel level); | 196 static void onPermissionLevelChanged(PermissionLevel level); |
| 191 | 197 |
| 192 // The user clicked on a link for the app's notification settings. As of | 198 // The user clicked on a link for the app's notification settings. As of |
| 193 // Chrome 47, only ChromeOS has UI that dispatches this event. | 199 // Chrome 47, only ChromeOS has UI that dispatches this event. |
| 194 static void onShowSettings(); | 200 static void onShowSettings(); |
| 195 }; | 201 }; |
| 196 }; | 202 }; |
| OLD | NEW |