123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- // 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 "skia/public/mojom/skcolor.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,
- };
- [Stable, Extensible]
- enum NotifierType {
- [Default] kApplication = 0,
- kArcApplication = 1,
- kWebPage = 2,
- kSystemComponent = 3,
- kCrostiniApplication = 4,
- kPhoneHub = 5,
- };
- // 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,
- };
- [Stable]
- struct NotifierId {
- NotifierType type@0;
- // The identifier of the app notifier. Empty if |type| is kWebPage.
- string id@1;
- url.mojom.Url? url@2;
- mojo_base.mojom.String16? title@3;
- // A unique identifier of the user profile associated with the
- // notification, usually an email address.
- string profile_id@4;
- };
- // 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
- //
- // Next MinVersion: 4
- // Next ID: 27
- [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;
- [MinVersion=3]
- // Unified theme color used in new style notification.
- skia.mojom.SkColor? accent_color@26;
- [MinVersion=4]
- // The notifierId contains additional details for the notification's origin.
- // Will contain information on the type of sender
- // (Webpage, Android, System etc..) along with additional info that can
- // identify the sender (url, app name etc..).
- NotifierId? notifier_id@27;
- };
|