blob: a072f42b97e23e4b9d47fb7ab3931d7361785699 [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/bitmap.mojom";
import "mojo/public/mojom/base/string16.mojom";
import "mojo/public/mojom/base/time.mojom";
import "ui/gfx/image/mojom/image.mojom";
import "url/mojom/url.mojom";
// Type of notification to show. See the chrome.notifications extension API:
// https://developer.chrome.com/extensions/notifications#type-TemplateType
[Stable, Extensible]
enum NotificationType {
// Icon, title and message.
kSimple = 0,
// Icon, title and message with a large image.
kImage = 1,
// List of items. Note: C++ calls this type "multiple".
kList = 2,
// Progress bar.
kProgress = 3,
};
// How to display notifications when a fullscreen window is open. For example,
// a child account time limit notification should appear over a fullscreen
// video.
[Stable, Extensible]
enum FullscreenVisibility {
// Do not show over fullscreen windows.
kNone = 0,
// Show on top of user-created fullscreen windows.
kOverUser = 1,
};
// List items for NotificationType::kList.
[Stable]
struct NotificationItem {
mojo_base.mojom.String16 title@0;
mojo_base.mojom.String16 message@1;
};
// Data for each button. Implemented as a struct for extensibility (e.g. so we
// could add icon buttons).
[Stable]
struct ButtonInfo {
mojo_base.mojom.String16 title@0;
// The placeholder string that should be displayed in the input field for
// text input type buttons until the user has entered a response themselves.
// If the value is null, there is no input field associated with the button.
[MinVersion=1] mojo_base.mojom.String16? placeholder@1;
};
// A notification to show in the system message center. Fields exist to support
// both the web platform notification API and the chrome.notifications extension
// API. See documentation at:
// https://developer.mozilla.org/en-US/docs/Web/API/notification
// https://developer.chrome.com/extensions/notifications#type-NotificationOptions
[Stable]
struct Notification {
// Type of notification to show.
NotificationType type@0;
// The client decides the format of the ID.
string id@1;
// The title, usually just a few words.
mojo_base.mojom.String16 title@2;
// The message body. If long, will wrap inside the notification.
mojo_base.mojom.String16 message@3;
// Human-readable description of the source of the notification. For example,
// "Google Calendar".
mojo_base.mojom.String16 display_source@4;
// For web notifications, the URL of the website responsible for showing the
// notification. Otherwise empty.
url.mojom.Url? origin_url@5;
// DEPRECATED, replaced with |icon| below.
Bitmap? deprecated_icon@6;
// Priority from -2 to 2. Zero is the default. Other values are clamped.
int32 priority@7;
// User must explicitly dismiss.
bool require_interaction@8;
// Time at which the notification is applicable (past, present or future).
// See web platform API "timestamp" and chrome.notifications "eventTime".
mojo_base.mojom.Time timestamp@9;
// DEPRECATED, replaced with |image| below.
Bitmap? deprecated_image@10;
// DEPRECATED, replaced with |badge| below.
Bitmap? deprecated_badge@11;
// Item list for type kList. Not displayed for other types.
array<NotificationItem> items@12;
// Progress from 0 to 100 for type kProgress. Negative values result in an
// animating "indefinite progress" indicator. Values above 100 are clamped.
int32 progress@13;
// Status message for type kProgress.
mojo_base.mojom.String16 progress_status@14;
// Up to 4 buttons. It is not guaranteed that all buttons will be visible,
// especially if the labels are long.
array<ButtonInfo> buttons@15;
// Pinned notifications cannot be closed by the user, only by a call to
// MessageCenter::CloseNotification.
bool pinned@16;
// Whether an announcement should occur (e.g. a popup or vibration) when an
// existing notification is updated. See web platform API
// Notification.renotify.
bool renotify@17;
// Whether all announcement mechanisms should be suppressed. See web platform
// API Notification.silent.
bool silent@18;
// Accessible description of the notification's contents. If empty, the
// message field will be used instead.
mojo_base.mojom.String16 accessible_name@19;
// Whether to show on top of fullscreen windows. See enum definition.
FullscreenVisibility fullscreen_visibility@20;
// Icon for the notification.
[MinVersion=1]
gfx.mojom.ImageSkia? icon@21;
// For type kImage, the large image.
[MinVersion=1]
gfx.mojom.ImageSkia? image@22;
// Badge to show the source of the notification (e.g. a 16x16 browser icon).
[MinVersion=1]
gfx.mojom.ImageSkia? badge@23;
[MinVersion=2]
// Whether the bool badge_needs_additional_masking is set.
bool badge_needs_additional_masking_has_value@24;
[MinVersion=2]
// Whether the badge needs additional masking.
bool badge_needs_additional_masking@25;
};