naiveproxy/ash/public/interfaces/ash_message_center_controller.mojom

96 lines
3.7 KiB
Plaintext
Raw Normal View History

2018-12-10 05:59:24 +03:00
// Copyright 2017 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 ash.mojom;
import "components/arc/common/notifications.mojom";
import "ui/gfx/image/mojo/image.mojom";
import "ui/message_center/public/mojo/notification.mojom";
import "ui/message_center/public/mojo/notifier_id.mojom";
import "mojo/public/mojom/base/string16.mojom";
import "mojo/public/mojom/base/unguessable_token.mojom";
// A struct that contains information for presenting a notifier in a settings
// panel.
struct NotifierUiData {
// The notifier (e.g. an extension).
message_center.mojom.NotifierId notifier_id;
// The user-visible name of the notifier (e.g. an extension's name).
mojo_base.mojom.String16 name;
// True if notifications from the notifier are presently enabled.
bool enabled;
// True if the setting is enforced by administrator and the user can't change.
bool enforced;
// An icon displayed next to the name.
gfx.mojom.ImageSkia? icon;
};
// The message center controller funnels notification requests from the client
// to the MessageCenter.
interface AshMessageCenterController {
SetClient(associated AshMessageCenterClient client);
// Sets the ARC notification instance.
SetArcNotificationsInstance(arc.mojom.NotificationsInstance instance);
// Shows a notification. |display_token| will be used to reference this
// notification for AshMessageCenterClient::Close().
ShowClientNotification(message_center.mojom.Notification notification,
mojo_base.mojom.UnguessableToken display_token);
// Closes a notification by the notification ID.
CloseClientNotification(string id);
UpdateNotifierIcon(message_center.mojom.NotifierId notifier_id,
gfx.mojom.ImageSkia icon);
NotifierEnabledChanged(message_center.mojom.NotifierId notifier_id,
bool enabled);
// Gets a list of all the notifications in the message center.
GetActiveNotifications() =>
(array<message_center.mojom.Notification> notifications);
};
// The message center client interface mimics
// message_center::NotificationDelegate. The ID strings match the id passed in
// |notification| in ShowClientNotification and the format of the ID is up to
// the client.
interface AshMessageCenterClient {
// Called when a notification previously displayed by the client is closed.
HandleNotificationClosed(mojo_base.mojom.UnguessableToken display_token,
bool by_user);
// Called when the body of a notification is clicked.
HandleNotificationClicked(string id);
// Called when a notification that has buttons (e.g., "Learn more") receives a
// click on one of the buttons. |reply| is a user-provided string for cases
// where the button had a text input field attached to it.
HandleNotificationButtonClicked(string id, int32 button_index,
mojo_base.mojom.String16? reply);
// Called when a notification's settings button has been pressed (and the
// handler is SettingsButtonHandler::DELEGATE).
HandleNotificationSettingsButtonClicked(string id);
// Called when a notification has been disabled (via inline settings).
DisableNotification(string id);
// Called when a user enables or disables notifications from the given
// notifier.
SetNotifierEnabled(message_center.mojom.NotifierId notifier_id, bool enabled);
// Asks the client for a list of notifiers and associated UI information to be
// displayed in a settings panel.
GetNotifierList() => (array<NotifierUiData> notifiers);
// Gets ARC app id from a given package name.
GetArcAppIdByPackageName(string package_name) => (string app_id);
};