/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "domstubs.idl" [scriptable, uuid(6b782346-49ec-41dd-8165-171506f8d4f4)] interface nsINotificationActionStorageEntry : nsISupports { readonly attribute AString name; readonly attribute AString title; }; [scriptable, uuid(c772e1b9-d4b0-4e23-8481-4a8b7dbbfe92)] interface nsINotificationStorageEntry : nsISupports { readonly attribute AString id; readonly attribute AString title; readonly attribute ACString dir; readonly attribute AString lang; readonly attribute AString body; readonly attribute AString tag; readonly attribute AString icon; readonly attribute boolean requireInteraction; readonly attribute boolean silent; readonly attribute AString dataSerialized; readonly attribute Array actions; }; [scriptable, function, uuid(c1622232-259c-43b0-b52e-89c39dcd9796)] interface nsINotificationStorageCallback : nsISupports { /** * Callback function used to pass single notification back * into C++ land for getNotifications() return data. * * @param aEntry: the stored notification entries */ void done(in Array aEntries); }; /** * Interface for notification persistence layer. */ [scriptable, uuid(17f85e52-fe57-440e-9ba1-5c312ca02b95)] interface nsINotificationStorage : nsISupports { /** * Add/replace a notification to the persistence layer. * * @param aOrigin: the origin/app of this notification * @param aScope: the ServiceWorker registration scope, or empty if unscoped. * @param aEntry: the notification data to store */ void put(in AString aOrigin, in nsINotificationStorageEntry aEntry, in AString aScope); /** * Retrieve a list of notifications. * * @param origin: the origin/app for which to fetch notifications from * @param scope: Used to limit for the specific scope. * Pass an empty string for unscoped notifications. * (See bug 1881812 for potential spec changes to how notifications * are associated with ServiceWorker registrations.) * @param tag: used to fetch only a specific tag * @param callback: nsINotificationStorageCallback, used for * returning notifications objects */ void get(in AString origin, in AString scope, in AString tag, in nsINotificationStorageCallback aCallback); /** * Remove a notification from storage. * * @param origin: the origin/app to delete the notification from * @param id: the uuid for the notification to delete */ void delete(in AString origin, in AString id); }; %{C++ #define NS_NOTIFICATION_STORAGE_CONTRACTID "@mozilla.org/notificationStorage;1" %} %{C++ #define NS_MEMORY_NOTIFICATION_STORAGE_CONTRACTID "@mozilla.org/memoryNotificationStorage;1" %}