Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2014 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 // Use the <code>chrome.notificationProvider</code> API to get notifications. | |
|
not at google - send to devlin
2014/07/28 21:32:39
This description is what is shown in the generated
liyanhou
2014/07/29 18:26:53
Done.
| |
| 6 namespace notificationProvider { | |
| 7 | |
| 8 // TODO(liyanhou): Refactoer this to using notifications.PermissionLevel after | |
|
not at google - send to devlin
2014/07/28 21:32:39
Refactor
also note that this will become the docu
liyanhou
2014/07/29 18:26:54
Done.
| |
| 9 // hear back about how to reference enum from another IDL in a dictionary and | |
| 10 // keep the namespace right. | |
| 11 enum NotifierPermissionLevel { | |
| 12 // User has elected to show notifications from the notifier. | |
| 13 // This is the default at install time. | |
| 14 granted, | |
| 15 | |
| 16 // User has elected not to show notifications from the notifier. | |
| 17 denied | |
| 18 }; | |
| 19 | |
| 20 dictionary Notifier { | |
| 21 // Name of the notifier. | |
| 22 DOMString name; | |
| 23 | |
| 24 // Icon of the notifier. | |
| 25 notifications.NotificationBitmap notifierIcon; | |
| 26 | |
| 27 // Permission level of the notifier. | |
| 28 NotifierPermissionLevel permissionLevel; | |
| 29 | |
| 30 // If a notifier has advanced settings. | |
| 31 boolean hasSettings; | |
| 32 }; | |
| 33 | |
| 34 callback NotifyOnClearedCallback = void (boolean wasCleared); | |
| 35 | |
| 36 callback NotifyOnClickedCallback = void (boolean matchExists); | |
| 37 | |
| 38 callback NotifyOnButtonClickedCallback = void (boolean matchExists); | |
| 39 | |
| 40 callback NotifyOnPermissionLevelChangedCallback = void (boolean notifierExists ); | |
|
not at google - send to devlin
2014/07/28 21:32:39
could you line-break after the =?
liyanhou
2014/07/29 18:26:54
Done.
| |
| 41 | |
| 42 callback NotifyOnShowSettingsCallback = void (boolean notifierExists); | |
| 43 | |
| 44 callback GetAllNotifiersCallback = void (object notifiers); | |
| 45 | |
| 46 interface Functions { | |
| 47 // Inform the notifier that the user cleared a notification sent from that | |
| 48 // notifier. | |
| 49 // |notifierId|: The id of the notifier that sent the notification. | |
| 50 // |notificationId|: The id of the notification that was closed. | |
| 51 // |callback|: Called to indicate whether a matching notification existed. | |
| 52 static void notifyOnCleared(DOMString notifierId, | |
| 53 DOMString notificationId, | |
| 54 NotifyOnClearedCallback callback); | |
| 55 | |
| 56 // Inform the notifier that the user clicked in a non-button area of a | |
| 57 // notification sent from that notifier. | |
| 58 // |notifierId|: The id of the notifier that sent the notification. | |
| 59 // |notificationId|: The id of the notification that was clicked on. | |
| 60 // |callback|: Called to indicate whether a matching notification existed. | |
| 61 static void notifyOnClicked(DOMString notifierId, | |
| 62 DOMString notificationId, | |
| 63 NotifyOnClickedCallback callback); | |
| 64 | |
| 65 // Inform the notifier that the user pressed a button in the notification | |
| 66 // sent from that notifier. | |
| 67 // |notifierId|: The id of the notifier that sent the notification. | |
| 68 // |notificationId|: The id of the notification that was clicked on its | |
| 69 // button. | |
| 70 // |buttonIndex|: The index of the button that was clicked. | |
| 71 // |callback|: Called to indicate whether a matching notification existed. | |
| 72 static void notifyOnButtonClicked(DOMString notifierId, | |
| 73 DOMString notificationId, | |
| 74 long buttonIndex, | |
| 75 NotifyOnButtonClickedCallback callback); | |
| 76 | |
| 77 // Inform the notifier that the user changed the permission level of that | |
| 78 // notifier. | |
| 79 // |notifierId|: The id of the notifier that sent the notification. | |
| 80 // |level|: The perission level of the notifier | |
| 81 // |callback|: Called to indicate whether the notifier existed. | |
| 82 static void notifyOnPermissionLevelChanged( | |
| 83 DOMString notifierId, | |
| 84 NotifierPermissionLevel level, | |
| 85 NotifyOnPermissionLevelChangedCallback callback); | |
| 86 | |
| 87 // Inform the notifier that the user chose to see advanced settings of that | |
| 88 // notifier. | |
| 89 // |notifierId|: The id of the notifier that sent the notification. | |
| 90 // |callback|: Called to indicate whether a matching notifier existed. | |
| 91 static void notifyOnShowSettings(DOMString notifierId, | |
| 92 NotifyOnShowSettingsCallback callback); | |
| 93 | |
| 94 // To get all the notifiers that could send notifications. | |
| 95 // |callback|: Returns the set of notifiers currently in the system. | |
| 96 static void getAllNotifiers(GetAllNotifiersCallback callback); | |
| 97 }; | |
| 98 | |
| 99 interface Events { | |
| 100 // A new notification is created. | |
| 101 // |notifierId|: The id of the notifier that sent the new notification. | |
| 102 // |notificationId|: The id of the newly created notification. | |
| 103 // |options|: The content of the notification: type, title, message etc. | |
| 104 static void onCreated(DOMString notifierId, | |
|
not at google - send to devlin
2014/07/28 21:32:39
it would be good to either provide a method to get
liyanhou
2014/07/29 18:26:54
Done.
| |
| 105 DOMString notificaitonId, | |
|
not at google - send to devlin
2014/07/28 21:32:39
notificationId
liyanhou
2014/07/29 18:26:53
Done.
| |
| 106 notifications.NotificationOptions options); | |
| 107 | |
| 108 // A notification is updated by the notifier. | |
| 109 // |notifierId|: The id of the notifier that sent the updated notification. | |
| 110 // |notificationId|: The id of the updated notification. | |
| 111 // |options|: The content of the notification: type, title, message etc. | |
| 112 static void onUpdated(DOMString notifierId, | |
| 113 DOMString notificationId, | |
| 114 notifications.NotificationOptions options); | |
| 115 | |
| 116 // A notification is cleared by the notifier. | |
| 117 // |notifierId|: The id of the notifier that cleared the notification. | |
| 118 // |notificationId|: The id of the cleared notification. | |
| 119 static void onCleared(DOMString notifierId, DOMString notificationId); | |
| 120 }; | |
| 121 }; | |
| OLD | NEW |