| // Copyright 2015 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| [DartPackage="mojo_services"] |
| module notifications; |
| |
| struct NotificationData { |
| // Title to be displayed along with the notification, if supported. |
| string? title; |
| |
| // Text to be displayed along with the notification, if supported. |
| string? text; |
| }; |
| |
| // Interaction with a posted notification will be communicated through the |
| // NotificationClient. Once a NotificationClient callback has been called the |
| // notification can be considered removed and subsequent Update and Cancel calls |
| // to the Notification populated during Post will be ignored. |
| interface NotificationClient { |
| // Called when the notification is selected. |
| OnSelected(); |
| |
| // Called when the notification is dismissed. |
| OnDismissed(); |
| }; |
| |
| interface Notification { |
| // Updates the notification with the information specified in |
| // |notification_data|. |
| Update(NotificationData notification_data); |
| |
| // Cancels the notification. |
| Cancel(); |
| }; |
| |
| interface NotificationService { |
| // Posts a new notification with the information specified in |
| // |notification_data| and with any interactions with the notification being |
| // communicated to |client|. |notification| can be used to modify or cancel |
| // the notification. |
| Post(NotificationData notification_data, NotificationClient? client, |
| Notification&? notification); |
| }; |