summaryrefslogtreecommitdiffstats
path: root/dom/interfaces/notification
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /dom/interfaces/notification
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/interfaces/notification')
-rw-r--r--dom/interfaces/notification/moz.build14
-rw-r--r--dom/interfaces/notification/nsINotificationStorage.idl105
2 files changed, 119 insertions, 0 deletions
diff --git a/dom/interfaces/notification/moz.build b/dom/interfaces/notification/moz.build
new file mode 100644
index 0000000000..dba68fb092
--- /dev/null
+++ b/dom/interfaces/notification/moz.build
@@ -0,0 +1,14 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# 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/.
+
+with Files("**"):
+ BUG_COMPONENT = ("Core", "DOM: Notifications")
+
+XPIDL_SOURCES += [
+ "nsINotificationStorage.idl",
+]
+
+XPIDL_MODULE = "dom_notification"
diff --git a/dom/interfaces/notification/nsINotificationStorage.idl b/dom/interfaces/notification/nsINotificationStorage.idl
new file mode 100644
index 0000000000..c7a0b4490a
--- /dev/null
+++ b/dom/interfaces/notification/nsINotificationStorage.idl
@@ -0,0 +1,105 @@
+/* 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(c1622232-259c-43b0-b52e-89c39dcd9796)]
+interface nsINotificationStorageCallback : nsISupports
+{
+ /**
+ * Callback function used to pass single notification back
+ * into C++ land for Notification.get return data.
+ *
+ * @param id: a uuid for this notification
+ * @param title: the notification title
+ * @param dir: the notification direction,
+ * possible values are "ltr", "rtl", "auto"
+ * @param lang: the notification language
+ * @param body: the notification body
+ * @param tag: the notification tag
+ */
+ void handle(in AString id,
+ in AString title,
+ in AString dir,
+ in AString lang,
+ in AString body,
+ in AString tag,
+ in AString icon,
+ in AString data,
+ in AString behavior,
+ in AString serviceWorkerRegistrationScope);
+
+ /**
+ * Callback function used to notify C++ the we have returned
+ * all notification objects for this Notification.get call.
+ */
+ void done();
+};
+
+/**
+ * Interface for notification persistence layer.
+ */
+[scriptable, uuid(17f85e52-fe57-440e-9ba1-5c312ca02b95)]
+interface nsINotificationStorage : nsISupports
+{
+
+ /**
+ * Add/replace a notification to the persistence layer.
+ *
+ * @param origin: the origin/app of this notification
+ * @param id: a uuid for this notification
+ * @param title: the notification title
+ * @param dir: the notification direction,
+ * possible values are "ltr", "rtl", "auto"
+ * @param lang: the notification language
+ * @param body: the notification body
+ * @param tag: notification tag, will replace any existing
+ * notifications with same origin/tag pair
+ * @param alertName: the alert identifier as used by system app.
+ * Stored in the database to avoid re-computing
+ * it. Built from origin and tag or id depending
+ * whether there is a tag defined.
+ * @param registrationID: Opaque string that identifies the service worker
+ * registration this Notification is associated with.
+ * May be empty. Only set for Notifications created by
+ * showNotification().
+ */
+ void put(in AString origin,
+ in AString id,
+ in AString title,
+ in AString dir,
+ in AString lang,
+ in AString body,
+ in AString tag,
+ in AString icon,
+ in AString alertName,
+ in AString data,
+ in AString behavior,
+ in AString serviceWorkerRegistrationScope);
+
+ /**
+ * Retrieve a list of notifications.
+ *
+ * @param origin: the origin/app for which to fetch notifications from
+ * @param tag: used to fetch only a specific tag
+ * @param callback: nsINotificationStorageCallback, used for
+ * returning notifications objects
+ */
+ void get(in AString origin,
+ 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"
+%}