blob: 85eebaf55193099c9b5a18da096ae1f66ead33a5 [file] [log] [blame]
// Copyright 2020 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.
module crosapi.mojom;
import "chromeos/crosapi/mojom/notification.mojom";
import "mojo/public/mojom/base/string16.mojom";
// Handles notifications created via the Notifications web platform API and the
// chrome.notifications() extension API. Shows the notifications in the
// message center. Implemented in ash-chrome.
[Stable, Uuid="0d9c1eb6-a383-45c0-ac11-2336e1227f74"]
interface MessageCenter {
// Displays a notification. If the notification's ID is the same as an
// existing notification, that notification is replaced. The delegate will be
// called with user actions.
DisplayNotification@0(Notification notification,
pending_remote<NotificationDelegate> delegate);
// Closes a notification by the ID provided in |notification| above.
CloseNotification@1(string id);
// Returns the IDs of the currently-displayed notifications. Order within the
// array is not guaranteed. Mojo does not support sets.
[MinVersion=1]
GetDisplayedNotifications@2() => (array<string> ids);
};
// Handles responses to user actions on notifications. Multiple actions may
// occur on a single notification. For example, clicking a notification button
// may not close the notification. Implemented in lacros-chrome.
[Stable, Uuid="1a850ac9-a813-4d0d-aa2d-b0d6cf10d548"]
interface NotificationDelegate {
// Called when a notification previously displayed by the client is closed.
OnNotificationClosed@0(bool by_user);
// Called when the body of a notification is clicked.
OnNotificationClicked@1();
// Called when a notification that has buttons (e.g., "Learn more") receives a
// click on one of the buttons.
OnNotificationButtonClicked@2(
uint32 button_index,
// This string contains input that is submitted for a notification button
// with input. It's value will be null if the clicked button has no
// associated input.
[MinVersion=2] mojo_base.mojom.String16? reply);
// Called when a notification's settings button has been pressed.
OnNotificationSettingsButtonClicked@3();
// Called when a notification has been disabled (via inline settings).
OnNotificationDisabled@4();
};