michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "domstubs.idl" michael@0: michael@0: [scriptable, uuid(fb089720-1c5c-11e3-b773-0800200c9a66)] michael@0: interface nsINotificationStorageCallback : nsISupports michael@0: { michael@0: /** michael@0: * Callback function used to pass single notification back michael@0: * into C++ land for Notification.get return data. michael@0: * michael@0: * @param id: a uuid for this notification michael@0: * @param title: the notification title michael@0: * @param dir: the notification direction, michael@0: * possible values are "ltr", "rtl", "auto" michael@0: * @param lang: the notification language michael@0: * @param body: the notification body michael@0: * @param tag: the notification tag michael@0: */ michael@0: [implicit_jscontext] michael@0: void handle(in DOMString id, michael@0: in DOMString title, michael@0: in DOMString dir, michael@0: in DOMString lang, michael@0: in DOMString body, michael@0: in DOMString tag, michael@0: in DOMString icon); michael@0: michael@0: /** michael@0: * Callback function used to notify C++ the we have returned michael@0: * all notification objects for this Notification.get call. michael@0: */ michael@0: [implicit_jscontext] michael@0: void done(); michael@0: }; michael@0: michael@0: /** michael@0: * Interface for notification persistence layer. michael@0: */ michael@0: [scriptable, uuid(b177b080-2a23-11e3-8224-0800200c9a66)] michael@0: interface nsINotificationStorage : nsISupports michael@0: { michael@0: michael@0: /** michael@0: * Add/replace a notification to the persistence layer. michael@0: * michael@0: * @param origin: the origin/app of this notification michael@0: * @param id: a uuid for this notification michael@0: * @param title: the notification title michael@0: * @param dir: the notification direction, michael@0: * possible values are "ltr", "rtl", "auto" michael@0: * @param lang: the notification language michael@0: * @param body: the notification body michael@0: * @param tag: notification tag, will replace any existing michael@0: * notifications with same origin/tag pair michael@0: */ michael@0: void put(in DOMString origin, michael@0: in DOMString id, michael@0: in DOMString title, michael@0: in DOMString dir, michael@0: in DOMString lang, michael@0: in DOMString body, michael@0: in DOMString tag, michael@0: in DOMString icon); michael@0: michael@0: /** michael@0: * Retrieve a list of notifications. michael@0: * michael@0: * @param origin: the origin/app for which to fetch notifications from michael@0: * @param tag: used to fetch only a specific tag michael@0: * @param callback: nsINotificationStorageCallback, used for michael@0: * returning notifications objects michael@0: */ michael@0: void get(in DOMString origin, michael@0: in DOMString tag, michael@0: in nsINotificationStorageCallback aCallback); michael@0: michael@0: /** michael@0: * Remove a notification from storage. michael@0: * michael@0: * @param origin: the origin/app to delete the notification from michael@0: * @param id: the uuid for the notification to delete michael@0: */ michael@0: void delete(in DOMString origin, michael@0: in DOMString id); michael@0: }; michael@0: michael@0: %{C++ michael@0: #define NS_NOTIFICATION_STORAGE_CONTRACTID "@mozilla.org/notificationStorage;1" michael@0: %}