| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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. |
| 4 |
| 5 module blink.mojom; |
| 6 |
| 7 import "third_party/WebKit/public/platform/modules/notifications/notification.mo
jom"; |
| 8 import "third_party/WebKit/public/platform/modules/notifications/notification_re
sources.mojom"; |
| 9 import "third_party/WebKit/public/platform/modules/permissions/permission_status
.mojom"; |
| 10 |
| 11 enum NotificationDisplayResult { |
| 12 FAILED_STORAGE_ERROR, |
| 13 SUCCESS |
| 14 }; |
| 15 |
| 16 enum NotificationCloseResult { |
| 17 CLOSED, |
| 18 NOT_FOUND |
| 19 }; |
| 20 |
| 21 // Service through which Blink can request notifications to be shown, closed or |
| 22 // retrieved from the embedder. |
| 23 interface NotificationService { |
| 24 // Synchronously retrieves the permission status for |origin|. Required to |
| 25 // be synchronous due to the Notification.permission JavaScript getter. |
| 26 [Sync] GetPermissionStatus(string origin) => (PermissionStatus status); |
| 27 |
| 28 // Displays the non-persistent |notification| for |origin|, to be decorated |
| 29 // with the |resources| when requested by the developer. The |client| will be |
| 30 // informed when the notification was closed by the user. |
| 31 Display(string origin, Notification notification, NotificationResources resour
ces, NotificationClient client) |
| 32 => (NotificationDisplayResult result, string id); |
| 33 |
| 34 // Displays the persistent |notification| for |origin|, to be decorated with |
| 35 // the |resources| when requested by the developer. |
| 36 DisplayPersistent(string origin, int64 service_worker_registration_id, Notific
ation notification, NotificationResources resources) |
| 37 => (NotificationDisplayResult result); |
| 38 |
| 39 // Gets an array with the showing persistent notifications for |origin|, |
| 40 // optionally filtered by the |tag|. |
| 41 GetNotifications(string origin, int64 service_worker_registration_id, string t
ag) |
| 42 => (array<Notification> notifications); |
| 43 |
| 44 // Closes the notification identified by |id| belonging to |origin|. |
| 45 Close(string origin, string id) |
| 46 => (NotificationCloseResult result); |
| 47 }; |
| 48 |
| 49 // Defines a client of a non-persistent notification that is to be informed of |
| 50 // user interactions of the associated notification. |
| 51 interface NotificationClient { |
| 52 OnClick(); |
| 53 OnClose(NotificationCloseResult result); |
| 54 }; |
| OLD | NEW |