Chromium Code Reviews| Index: chrome/common/extensions/api/custom_notification_center.idl |
| diff --git a/chrome/common/extensions/api/custom_notification_center.idl b/chrome/common/extensions/api/custom_notification_center.idl |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..fea8af80241f9d196bb6dcbe6abeb14ebc9eeb9f |
| --- /dev/null |
| +++ b/chrome/common/extensions/api/custom_notification_center.idl |
| @@ -0,0 +1,158 @@ |
| +// 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.customNotificationCenter</code> API to get notifications |
| +namespace customNotificationCenter { |
| + [noinline_doc] enum TemplateType { |
| + // icon, title, message, expandedMessage, up to two buttons |
|
Pete Williamson
2014/07/14 19:47:48
Comments should be complete sentences, starting wi
liyanhou
2014/07/15 16:53:32
Done.
|
| + 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; |
| + |
| + // |data|: a one-dimensional unit 8 array containing the data in RGBA order, |
| + // 1 byte/channel (integer from 0 to 255), 4 bytes/pixel |
| + // See the link for more information: |
| + // http://www.w3.org/TR/2014/WD-2dcontext-20140520/ |
| + ArrayBuffer? data; |
| + }; |
| + |
| + dictionary NotificationButton { |
| + DOMString title; |
| + NotificationBitmap? iconBitmap; |
| + }; |
| + |
| + dictionary NotificationContent { |
| + // Which type of notification to display. |
| + TemplateType? type; |
| + |
| + // Sender's avatar, app icon, or a thumbnail for image notifications. |
| + NotificationBitmap? iconBitmap; |
| + |
| + // 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; |
| + }; |
| + |
| + callback SendOnClearCallback = void (boolean wasCleared); |
| + |
| + callback SendOnClickCallback = void (boolean matchExists); |
| + |
| + callback SendOnButtonClickCallback = void (boolean matchExists); |
| + |
| + interface Functions { |
| + // Clears the specified notification. |
| + // |senderId|: The id of the sender of the notification. |
| + // |notificationId|: The id of the notification that was closed. |
| + // |callback|: Called to indicate whether a matching notification existed. |
| + static void sendOnClear(DOMString senderId, |
| + DOMString notificationId, |
| + SendOnClearCallback callback); |
| + |
| + // The user clicked in a non-button area of the notification. |
| + // |senderId|: The id of the sender of the notification. |
| + // |notificationId|: The id of the notification that was clicked on. |
| + // |callback|: Called to indicate whether a matching notification existed. |
| + static void sendOnClick(DOMString senderId, |
| + DOMString notificationId, |
| + SendOnClickCallback callback); |
| + |
| + // The user pressed a button in the notification. |
| + // |senderId|: The id of the sender of the notification. |
| + // |notificationId|: The id of the notification that was clicked on its |
| + // button. |
| + // |buttonIndex|: The index of the button that was clicked. |
| + // |callback|: Called to indicate whether a matching notification existed. |
| + static void sendOnButtonClick(DOMString senderId, |
| + DOMString notificationId, |
| + long buttonIndex, |
| + SendOnButtonClickCallback callback); |
| + |
| + // The user changes the permission level. |
| + // |senderId|: The id of the sender of the notification. |
| + // |level|: The perissionlevel of the app/extension that sent the notification |
| + static void notifyPermissionLevelChanged(DOMString senderId, |
| + PermissionLevel level); |
| + }; |
| + |
| + interface Events { |
| + // New notification created. |
| + // |senderId|: The id of the sender of the notification. |
| + // |notificationId|: The id of the newly created notification. |
| + // |content|: The content of the notification: type, title, message etc. |
| + static void onCreated(DOMString senderId, |
| + DOMString notificaitonId, |
| + NotificationContent content); |
| + |
| + // Notification updated. |
| + // |senderId|: The id of the sender of the notification. |
| + // |notificationId|: The id of the updated notification. |
| + // |content|: The content of the notification: type, title, message etc. |
| + static void onUpdated(DOMString senderId, |
| + DOMString notificationId, |
| + NotificationContent content); |
| + |
| + // Notification cleared. |
| + // |senderId|: The id of the sender of the notification. |
| + // |notificationId|: The id of the cleared notification. |
| + static void onCleared(DOMString senderId, DOMString notificationId); |
| + }; |
| +}; |