| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 module blink.mojom; | 5 module blink.mojom; |
| 6 | 6 |
| 7 // The different types of actions that can be added to a Notification. | 7 // The different types of actions that can be added to a Notification. |
| 8 enum NotificationActionType { | 8 enum NotificationActionType { |
| 9 BUTTON, | 9 BUTTON, |
| 10 TEXT | 10 TEXT |
| 11 }; | 11 }; |
| 12 | 12 |
| 13 // Structure representing an action button associated with a Notification. | 13 // Structure representing an action button associated with a Notification. |
| 14 struct NotificationAction { | 14 struct NotificationAction { |
| 15 // Type of action this structure represents. | 15 // Type of action this structure represents. |
| 16 NotificationActionType type; | 16 NotificationActionType type; |
| 17 | 17 |
| 18 // Action name that the author can use to distinguish them. | 18 // Action name that the author can use to distinguish them. |
| 19 string action; | 19 string action; |
| 20 | 20 |
| 21 // Title of the action button. | 21 // Title of the action button. |
| 22 string title; | 22 string title; |
| 23 | 23 |
| 24 // URL of the icon for the button. May be empty if no url was specified. | 24 // URL of the icon for the button. May be empty if no url was specified. |
| 25 string icon; | 25 string? icon; |
| 26 | 26 |
| 27 // Placeholder to display for text-based actions in absence of user input. | 27 // Placeholder to display for text-based actions in absence of user input. |
| 28 string? placeholder; | 28 string? placeholder; |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 // Directionality options that can be indicated for notifications. | 31 // Directionality options that can be indicated for notifications. |
| 32 enum NotificationDirection { | 32 enum NotificationDirection { |
| 33 LEFT_TO_RIGHT, | 33 LEFT_TO_RIGHT, |
| 34 RIGHT_TO_LEFT, | 34 RIGHT_TO_LEFT, |
| 35 AUTO | 35 AUTO |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 // Structure representing the information associated with a Web Notification. | 38 // Structure representing the information associated with a Web Notification. |
| 39 // Resources should be passed separately using the NotificationResources object. | 39 // Resources should be passed separately using the NotificationResources object. |
| 40 struct Notification { | 40 struct Notification { |
| 41 // The maximum size of the serialized developer-provided data to be stored in | 41 // The maximum size of the serialized developer-provided data to be stored in |
| 42 // the |data| property of this structure. | 42 // the |data| property of this structure. |
| 43 const int32 kMaximumDeveloperDataBytes = 1048576; // 1MB | 43 const int32 kMaximumDeveloperDataBytes = 1048576; // 1MB |
| 44 | 44 |
| 45 // Id of the notification, provided by the embedder. |
| 46 string? id; |
| 47 |
| 48 // Origin for which the notification was shown, provided by the embedder. |
| 49 string? origin; |
| 50 |
| 45 // Title to be displayed with the Web Notification. | 51 // Title to be displayed with the Web Notification. |
| 46 string title; | 52 string title; |
| 47 | 53 |
| 48 // Hint to determine the directionality of the displayed notification. | 54 // Hint to determine the directionality of the displayed notification. |
| 49 NotificationDirection direction; | 55 NotificationDirection direction; |
| 50 | 56 |
| 51 // BCP 47 language tag describing the notification's contents. Optional. | 57 // BCP 47 language tag describing the notification's contents. Optional. |
| 52 string? lang; | 58 string? lang; |
| 53 | 59 |
| 54 // Contents of the notification. | 60 // Contents of the notification. |
| 55 string body; | 61 string body; |
| 56 | 62 |
| 57 // Tag of the notification. Notifications sharing both their origin and their | 63 // Tag of the notification. Notifications sharing both their origin and their |
| 58 // tag will replace the first displayed notification. | 64 // tag will replace the first displayed notification. |
| 59 string tag; | 65 string tag; |
| 60 | 66 |
| 61 // URL of the icon which is to be displayed with the notification. | 67 // URL of the icon which is to be displayed with the notification. |
| 62 string icon; | 68 string? icon; |
| 63 | 69 |
| 64 // URL of the badge representing the website displaying the notification. | 70 // URL of the badge representing the website displaying the notification. |
| 65 string badge; | 71 string? badge; |
| 66 | 72 |
| 67 // Vibration pattern for the notification, following the syntax of the | 73 // Vibration pattern for the notification, following the syntax of the |
| 68 // Vibration API. https://w3c.github.io/vibration/ | 74 // Vibration API. https://w3c.github.io/vibration/ |
| 69 array<uint32> vibration_pattern; | 75 array<uint32>? vibration_pattern; |
| 70 | 76 |
| 71 // The time at which the event the notification represents took place. | 77 // The time at which the event the notification represents took place. |
| 72 double timestamp; | 78 double timestamp; |
| 73 | 79 |
| 74 // Whether default notification indicators (sound, vibration, light) should | 80 // Whether default notification indicators (sound, vibration, light) should |
| 75 // be played again if the notification is replacing an older notification. | 81 // be played again if the notification is replacing an older notification. |
| 76 bool renotify = false; | 82 bool renotify = false; |
| 77 | 83 |
| 78 // Whether default notification indicators (sound, vibration, light) should | 84 // Whether default notification indicators (sound, vibration, light) should |
| 79 // be suppressed. | 85 // be suppressed. |
| 80 bool silent = false; | 86 bool silent = false; |
| 81 | 87 |
| 82 // Whether the notification should remain onscreen indefinitely, rather than | 88 // Whether the notification should remain onscreen indefinitely, rather than |
| 83 // being auto-minimized to the notification center (if allowed by platform). | 89 // being auto-minimized to the notification center (if allowed by platform). |
| 84 bool require_interaction = false; | 90 bool require_interaction = false; |
| 85 | 91 |
| 86 // Developer-provided data associated with the notification, in the form of | 92 // Developer-provided data associated with the notification, in the form of |
| 87 // a serialized string. Must not exceed |kMaximumDeveloperDataBytes| bytes. | 93 // a serialized string. Must not exceed |kMaximumDeveloperDataBytes| bytes. |
| 88 array<int8> data; | 94 array<int8>? data; |
| 89 | 95 |
| 90 // Actions that should be shown as buttons on the notification. | 96 // Actions that should be shown as buttons on the notification. |
| 91 array<NotificationAction> actions; | 97 array<NotificationAction>? actions; |
| 92 }; | 98 }; |
| OLD | NEW |