Chromium Code Reviews| Index: chrome/common/extensions/api/notification_getter.idl |
| diff --git a/chrome/common/extensions/api/notification_getter.idl b/chrome/common/extensions/api/notification_getter.idl |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..cdd6305dd8b4052b86b866ef64046cc4a48bd92f |
| --- /dev/null |
| +++ b/chrome/common/extensions/api/notification_getter.idl |
| @@ -0,0 +1,129 @@ |
| +// Copyright (c) 2014 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. |
| + |
| +// Use the <code>chrome.notificationGetter</code> API to get notifications sent from apps and extensions |
| +namespace notificationGetter { |
| + [noinline_doc] enum TemplateType { |
| + // icon, title, message, expandedMessage, up to two buttons |
| + basic, |
| + |
| + // icon, title, message, expandedMessage, image, up to two buttons |
| + image, |
| + |
| + // icon, title, message, items, up to two buttons |
| + list, |
| + |
| + // icon, title, message, progress, up to two buttons |
| + progress |
| + }; |
| + |
| + enum PermissionLevel { |
| + // User has elected to show notifications from the app or extension. |
| + // This is the default at install time. |
| + granted, |
| + |
| + // User has elected not to show notifications from the app or extension. |
| + denied |
| + }; |
| + |
| + dictionary NotificationItem { |
| + // Title of one item of a list notification. |
| + DOMString title; |
| + |
| + // Additional details about this item. |
| + DOMString message; |
| + }; |
| + |
| + dictionary NotificationBitmap { |
| + long width; |
| + long height; |
| + ArrayBuffer? data; |
| + }; |
| + |
| + dictionary NotificationButton { |
| + DOMString title; |
| + NotificationBitmap? iconBitmap; |
| + }; |
| + |
| + dictionary NotificationOptions { |
|
Pete Williamson
2014/06/30 19:03:49
Can we find a more descriptive name than notificat
liyanhou
2014/07/14 17:44:44
Done.
|
| + // Which type of notification to display. |
| + TemplateType? type; |
| + |
| + // Sender's avatar, app icon, or a thumbnail for image notifications. |
| + NotificationBitmap? iconBitmap; |
| + |
| + // Small icon |
| + NotificationBitmap? smallIconBitmap; |
| + |
| + // Title of the notification (e.g. sender name for email). |
| + DOMString? title; |
| + |
| + // Main notification content. |
| + DOMString? message; |
| + |
| + // Alternate notification content with a lower-weight font. |
| + DOMString? contextMessage; |
| + |
| + // Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero |
| + // is default. |
| + long? priority; |
| + |
| + // A timestamp associated with the notification, in milliseconds past the |
| + // epoch (e.g. <code>Date.now() + n</code>). |
| + double? eventTime; |
| + |
| + // Text and icons for up to two notification action buttons. |
| + NotificationButton[]? buttons; |
| + |
| + // Image thumbnail for image-type notifications. |
| + NotificationBitmap? imageBitmap; |
| + |
| + // Items for multi-item notifications. |
| + NotificationItem[]? items; |
| + |
| + // Current progress ranges from 0 to 100. |
| + long? progress; |
| + |
| + // Whether to show UI indicating that the app will visibly respond to |
| + // clicks on the body of a notification. |
| + boolean? isClickable; |
| + }; |
| + |
| + interface Functions { |
| + // Clears the specified notification. |
| + // |notificationId|: The id of the notification that was closed. |
| + // |byUser|: If the notification was closed by the user. |
| + static void sendOnClose(DOMString senderId, DOMString notificationId, boolean byUser); |
| + |
| + // The user clicked in a non-button area of the notification. |
| + // |notificationId|: The id of the notification that was clicked on. |
| + static void sendOnClick(DOMString senderId, DOMString notificationId); |
| + |
| + // The user pressed a button in the notification. |
| + // |notificationId|: The id of the notification that was clicked on its |
| + // button. |
| + // |buttonIndex|: The index of the button that was clicked. |
| + static void sendOnClickButton(DOMString senderId, DOMString notificationId, long buttonIndex); |
| + |
| + // User changes the permission level. |
| + // |level|: The perissionlevel of the app/extension this |
| + // notificaiton belongs to. |
| + static void notifyPermissionLevelChanged(DOMString senderId, PermissionLevel level); |
| + }; |
| + |
| + interface Events { |
| + // New notification created |
| + static void onCreated(DOMString senderId, |
| + DOMString notificaitonId, |
| + NotificationOptions options); |
| + |
| + // Notification updated |
| + static void onUpdated(DOMString senderId, |
| + DOMString notificationId, |
| + NotificationOptions options); |
| + |
| + // Notification closed |
| + static void onClosed(DOMString senderId, DOMString notificationId); |
| + }; |
| +}; |