1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/interfaces/notification/nsINotificationStorage.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,92 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#include "domstubs.idl" 1.9 + 1.10 +[scriptable, uuid(fb089720-1c5c-11e3-b773-0800200c9a66)] 1.11 +interface nsINotificationStorageCallback : nsISupports 1.12 +{ 1.13 + /** 1.14 + * Callback function used to pass single notification back 1.15 + * into C++ land for Notification.get return data. 1.16 + * 1.17 + * @param id: a uuid for this notification 1.18 + * @param title: the notification title 1.19 + * @param dir: the notification direction, 1.20 + * possible values are "ltr", "rtl", "auto" 1.21 + * @param lang: the notification language 1.22 + * @param body: the notification body 1.23 + * @param tag: the notification tag 1.24 + */ 1.25 + [implicit_jscontext] 1.26 + void handle(in DOMString id, 1.27 + in DOMString title, 1.28 + in DOMString dir, 1.29 + in DOMString lang, 1.30 + in DOMString body, 1.31 + in DOMString tag, 1.32 + in DOMString icon); 1.33 + 1.34 + /** 1.35 + * Callback function used to notify C++ the we have returned 1.36 + * all notification objects for this Notification.get call. 1.37 + */ 1.38 + [implicit_jscontext] 1.39 + void done(); 1.40 +}; 1.41 + 1.42 +/** 1.43 + * Interface for notification persistence layer. 1.44 + */ 1.45 +[scriptable, uuid(b177b080-2a23-11e3-8224-0800200c9a66)] 1.46 +interface nsINotificationStorage : nsISupports 1.47 +{ 1.48 + 1.49 + /** 1.50 + * Add/replace a notification to the persistence layer. 1.51 + * 1.52 + * @param origin: the origin/app of this notification 1.53 + * @param id: a uuid for this notification 1.54 + * @param title: the notification title 1.55 + * @param dir: the notification direction, 1.56 + * possible values are "ltr", "rtl", "auto" 1.57 + * @param lang: the notification language 1.58 + * @param body: the notification body 1.59 + * @param tag: notification tag, will replace any existing 1.60 + * notifications with same origin/tag pair 1.61 + */ 1.62 + void put(in DOMString origin, 1.63 + in DOMString id, 1.64 + in DOMString title, 1.65 + in DOMString dir, 1.66 + in DOMString lang, 1.67 + in DOMString body, 1.68 + in DOMString tag, 1.69 + in DOMString icon); 1.70 + 1.71 + /** 1.72 + * Retrieve a list of notifications. 1.73 + * 1.74 + * @param origin: the origin/app for which to fetch notifications from 1.75 + * @param tag: used to fetch only a specific tag 1.76 + * @param callback: nsINotificationStorageCallback, used for 1.77 + * returning notifications objects 1.78 + */ 1.79 + void get(in DOMString origin, 1.80 + in DOMString tag, 1.81 + in nsINotificationStorageCallback aCallback); 1.82 + 1.83 + /** 1.84 + * Remove a notification from storage. 1.85 + * 1.86 + * @param origin: the origin/app to delete the notification from 1.87 + * @param id: the uuid for the notification to delete 1.88 + */ 1.89 + void delete(in DOMString origin, 1.90 + in DOMString id); 1.91 +}; 1.92 + 1.93 +%{C++ 1.94 +#define NS_NOTIFICATION_STORAGE_CONTRACTID "@mozilla.org/notificationStorage;1" 1.95 +%}