OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Use the <code>chrome.notifications</code> API to create rich notifications | 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. | 6 // using templates and show these notifications to users in the system tray. |
7 namespace notifications { | 7 namespace notifications { |
8 [noinline_doc] enum TemplateType { | 8 [noinline_doc] enum TemplateType { |
9 // icon, title, message, expandedMessage, up to two buttons | 9 // icon, title, message, expandedMessage, up to two buttons |
10 basic, | 10 basic, |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 callback UpdateCallback = void (boolean wasUpdated); | 117 callback UpdateCallback = void (boolean wasUpdated); |
118 | 118 |
119 callback ClearCallback = void (boolean wasCleared); | 119 callback ClearCallback = void (boolean wasCleared); |
120 | 120 |
121 callback GetAllCallback = void (object notifications); | 121 callback GetAllCallback = void (object notifications); |
122 | 122 |
123 callback PermissionLevelCallback = void (PermissionLevel level); | 123 callback PermissionLevelCallback = void (PermissionLevel level); |
124 | 124 |
125 interface Functions { | 125 interface Functions { |
126 // Creates and displays a notification. | 126 // Creates and displays a notification. |
127 // |notificationId|: Identifier of the notification. If it is empty, this | 127 // |notificationId|: Identifier of the notification. If not set or empty, an |
128 // method generates an id. If it matches an existing notification, this | 128 // ID will automatically be generated. If it matches an existing |
129 // method first clears that notification before proceeding with the create | 129 // notification, this method first clears that notification before |
130 // operation. | 130 // proceeding with the create operation. |
131 // The parameter was required before Chrome 42. | |
not at google - send to devlin
2015/02/03 18:08:20
s/was/is/g
same below.
could you also put it on
robwu
2015/02/03 18:13:08
Done.
| |
131 // |options|: Contents of the notification. | 132 // |options|: Contents of the notification. |
132 // |callback|: Returns the notification id (either supplied or generated) | 133 // |callback|: Returns the notification id (either supplied or generated) |
133 // that represents the created notification. | 134 // that represents the created notification. |
134 static void create(DOMString notificationId, | 135 // The callback was required before Chrome 42. |
136 static void create(optional DOMString notificationId, | |
135 NotificationOptions options, | 137 NotificationOptions options, |
136 CreateCallback callback); | 138 optional CreateCallback callback); |
137 | 139 |
138 // Updates an existing notification. | 140 // Updates an existing notification. |
139 // |notificationId|: The id of the notification to be updated. This is | 141 // |notificationId|: The id of the notification to be updated. This is |
140 // returned by $(ref:notifications.create) method. | 142 // returned by $(ref:notifications.create) method. |
141 // |options|: Contents of the notification to update to. | 143 // |options|: Contents of the notification to update to. |
142 // |callback|: Called to indicate whether a matching notification existed. | 144 // |callback|: Called to indicate whether a matching notification existed. |
145 // The callback was required before Chrome 42. | |
143 static void update(DOMString notificationId, | 146 static void update(DOMString notificationId, |
144 NotificationOptions options, | 147 NotificationOptions options, |
145 UpdateCallback callback); | 148 optional UpdateCallback callback); |
146 | 149 |
147 // Clears the specified notification. | 150 // Clears the specified notification. |
148 // |notificationId|: The id of the notification to be cleared. This is | 151 // |notificationId|: The id of the notification to be cleared. This is |
149 // returned by $(ref:notifications.create) method. | 152 // returned by $(ref:notifications.create) method. |
150 // |callback|: Called to indicate whether a matching notification existed. | 153 // |callback|: Called to indicate whether a matching notification existed. |
151 static void clear(DOMString notificationId, ClearCallback callback); | 154 // The callback was required before Chrome 42. |
155 static void clear(DOMString notificationId, | |
156 optional ClearCallback callback); | |
152 | 157 |
153 // Retrieves all the notifications. | 158 // Retrieves all the notifications. |
154 // |callback|: Returns the set of notification_ids currently in the system. | 159 // |callback|: Returns the set of notification_ids currently in the system. |
155 static void getAll(GetAllCallback callback); | 160 static void getAll(GetAllCallback callback); |
156 | 161 |
157 // Retrieves whether the user has enabled notifications from this app | 162 // Retrieves whether the user has enabled notifications from this app |
158 // or extension. | 163 // or extension. |
159 // |callback|: Returns the current permission level. | 164 // |callback|: Returns the current permission level. |
160 static void getPermissionLevel(PermissionLevelCallback callback); | 165 static void getPermissionLevel(PermissionLevelCallback callback); |
161 }; | 166 }; |
162 | 167 |
163 interface Events { | 168 interface Events { |
164 // The notification closed, either by the system or by user action. | 169 // The notification closed, either by the system or by user action. |
165 static void onClosed(DOMString notificationId, boolean byUser); | 170 static void onClosed(DOMString notificationId, boolean byUser); |
166 | 171 |
167 // The user clicked in a non-button area of the notification. | 172 // The user clicked in a non-button area of the notification. |
168 static void onClicked(DOMString notificationId); | 173 static void onClicked(DOMString notificationId); |
169 | 174 |
170 // The user pressed a button in the notification. | 175 // The user pressed a button in the notification. |
171 static void onButtonClicked(DOMString notificationId, long buttonIndex); | 176 static void onButtonClicked(DOMString notificationId, long buttonIndex); |
172 | 177 |
173 // The user changes the permission level. | 178 // The user changes the permission level. |
174 static void onPermissionLevelChanged(PermissionLevel level); | 179 static void onPermissionLevelChanged(PermissionLevel level); |
175 | 180 |
176 // The user clicked on a link for the app's notification settings. | 181 // The user clicked on a link for the app's notification settings. |
177 static void onShowSettings(); | 182 static void onShowSettings(); |
178 }; | 183 }; |
179 | 184 |
180 }; | 185 }; |
OLD | NEW |