Revert "Only store leading 13 bits of password hash."
[chromium-blink-merge.git] / chrome / common / extensions / api / notifications.idl
blobfb1fe65b98977bd6430b043c8f92f0af55287492
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Use the <code>chrome.notifications</code> API to create rich notifications
6 // using templates and show these notifications to users in the system tray.
7 namespace notifications {
8 [noinline_doc] enum TemplateType {
9 // icon, title, message, expandedMessage, up to two buttons
10 basic,
12 // icon, title, message, expandedMessage, image, up to two buttons
13 image,
15 // icon, title, message, items, up to two buttons
16 list,
18 // icon, title, message, progress, up to two buttons
19 progress
22 enum PermissionLevel {
23 // User has elected to show notifications from the app or extension.
24 // This is the default at install time.
25 granted,
27 // User has elected not to show notifications from the app or extension.
28 denied
31 dictionary NotificationItem {
32 // Title of one item of a list notification.
33 DOMString title;
35 // Additional details about this item.
36 DOMString message;
39 [nodoc] dictionary NotificationBitmap {
40 long width;
41 long height;
42 ArrayBuffer? data;
45 dictionary NotificationButton {
46 DOMString title;
47 DOMString? iconUrl;
48 [nodoc] NotificationBitmap? iconBitmap;
51 dictionary NotificationOptions {
52 // Which type of notification to display.
53 // <em>Required for $(ref:notifications.create)</em> method.
54 TemplateType? type;
56 // A URL to the sender's avatar, app icon, or a thumbnail for image
57 // notifications.
59 // URLs can be a data URL, a blob URL, or a URL relative to a resource
60 // within this extension's .crx file
61 // <em>Required for $(ref:notifications.create)</em> method.
62 DOMString? iconUrl;
63 [nodoc] NotificationBitmap? iconBitmap;
65 // A URL to the app icon mask. URLs have the same restrictions as
66 // $(ref:notifications.NotificationOptions.iconUrl iconUrl).
67 //
68 // The app icon mask should be in alpha channel, as only the alpha channel
69 // of the image will be considered.
70 DOMString? appIconMaskUrl;
71 [nodoc] NotificationBitmap? appIconMaskBitmap;
73 // Title of the notification (e.g. sender name for email).
74 // <em>Required for $(ref:notifications.create)</em> method.
75 DOMString? title;
77 // Main notification content.
78 // <em>Required for $(ref:notifications.create)</em> method.
79 DOMString? message;
81 // Alternate notification content with a lower-weight font.
82 DOMString? contextMessage;
84 // Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero
85 // is default.
86 long? priority;
88 // A timestamp associated with the notification, in milliseconds past the
89 // epoch (e.g. <code>Date.now() + n</code>).
90 double? eventTime;
92 // Text and icons for up to two notification action buttons.
93 NotificationButton[]? buttons;
95 // Secondary notification content.
96 [nodoc] DOMString? expandedMessage;
98 // A URL to the image thumbnail for image-type notifications.
99 // URLs have the same restrictions as
100 // $(ref:notifications.NotificationOptions.iconUrl iconUrl).
101 DOMString? imageUrl;
102 [nodoc] NotificationBitmap? imageBitmap;
104 // Items for multi-item notifications.
105 NotificationItem[]? items;
107 // Current progress ranges from 0 to 100.
108 long? progress;
110 // Whether to show UI indicating that the app will visibly respond to
111 // clicks on the body of a notification.
112 boolean? isClickable;
115 callback CreateCallback = void (DOMString notificationId);
117 callback UpdateCallback = void (boolean wasUpdated);
119 callback ClearCallback = void (boolean wasCleared);
121 callback GetAllCallback = void (object notifications);
123 callback PermissionLevelCallback = void (PermissionLevel level);
125 interface Functions {
126 // Creates and displays a notification.
127 // |notificationId|: Identifier of the notification. If it is empty, this
128 // method generates an id. If it matches an existing notification, this
129 // method first clears that notification before proceeding with the create
130 // operation.
131 // |options|: Contents of the notification.
132 // |callback|: Returns the notification id (either supplied or generated)
133 // that represents the created notification.
134 static void create(DOMString notificationId,
135 NotificationOptions options,
136 CreateCallback callback);
138 // Updates an existing notification.
139 // |notificationId|: The id of the notification to be updated. This is
140 // returned by $(ref:notifications.create) method.
141 // |options|: Contents of the notification to update to.
142 // |callback|: Called to indicate whether a matching notification existed.
143 static void update(DOMString notificationId,
144 NotificationOptions options,
145 UpdateCallback callback);
147 // Clears the specified notification.
148 // |notificationId|: The id of the notification to be cleared. This is
149 // returned by $(ref:notifications.create) method.
150 // |callback|: Called to indicate whether a matching notification existed.
151 static void clear(DOMString notificationId, ClearCallback callback);
153 // Retrieves all the notifications.
154 // |callback|: Returns the set of notification_ids currently in the system.
155 static void getAll(GetAllCallback callback);
157 // Retrieves whether the user has enabled notifications from this app
158 // or extension.
159 // |callback|: Returns the current permission level.
160 static void getPermissionLevel(PermissionLevelCallback callback);
163 interface Events {
164 // The notification closed, either by the system or by user action.
165 static void onClosed(DOMString notificationId, boolean byUser);
167 // The user clicked in a non-button area of the notification.
168 static void onClicked(DOMString notificationId);
170 // The user pressed a button in the notification.
171 static void onButtonClicked(DOMString notificationId, long buttonIndex);
173 // The user changes the permission level.
174 static void onPermissionLevelChanged(PermissionLevel level);
176 // The user clicked on a link for the app's notification settings.
177 static void onShowSettings();