| // 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; |
| |
| // Indicates if notification sound must be played when notification is shown. |
| bool play_sound; |
| |
| // Indicates if the device should vibrate, if it supports vibration. |
| bool vibrate; |
| |
| // Indicates if notification lights must be set so that the lights can blink |
| // till the notification is attended. Note this would depend on the device |
| // support for notification lights. |
| bool set_lights; |
| }; |
| |
| // 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(); |
| }; |
| |
| [ServiceName="notifications::NotificationService"] |
| 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); |
| }; |