Bug 1930676 - Part 3: Add skeleton PNotification functions r=asuth

Differential Revision: https://phabricator.services.mozilla.com/D228681
This commit is contained in:
Kagami Sascha Rosylight
2024-11-15 00:35:41 +00:00
parent 12d8fc1bb0
commit fb8bef8024
6 changed files with 33 additions and 3 deletions

View File

@@ -0,0 +1,17 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 "NotificationChild.h"
namespace mozilla::dom::notification {
using IPCResult = mozilla::ipc::IPCResult;
NotificationChild::NotificationChild() = default;
IPCResult NotificationChild::RecvNotifyClick() { return IPC_OK(); }
} // namespace mozilla::dom::notification

View File

@@ -14,8 +14,15 @@ namespace mozilla::dom::notification {
class NotificationChild final : public PNotificationChild,
public SupportsWeakPtr {
using IPCResult = mozilla::ipc::IPCResult;
NS_INLINE_DECL_REFCOUNTING(NotificationChild)
public:
explicit NotificationChild();
IPCResult RecvNotifyClick();
private:
~NotificationChild() = default;
};

View File

@@ -208,6 +208,8 @@ nsresult NotificationParent::Show() {
return NS_OK;
}
mozilla::ipc::IPCResult NotificationParent::RecvClose() { return IPC_OK(); }
nsresult NotificationParent::BindToMainThread(
Endpoint<PNotificationParent>&& aParentEndpoint,
PBackgroundParent::CreateNotificationParentResolver&& aResolver) {

View File

@@ -32,11 +32,10 @@ class NotificationParent final : public PNotificationParent,
mIsSecureContext(aIsSecureContext),
mId(aId),
mScope(aScope),
mOptions(aOptions) {
MOZ_ASSERT(!mScope.IsEmpty(), "Only for persistent notifications for now");
};
mOptions(aOptions) {};
IPCResult RecvShow(ShowResolver&& aResolver);
IPCResult RecvClose();
nsresult BindToMainThread(
Endpoint<PNotificationParent>&& aParentEndpoint,

View File

@@ -16,6 +16,10 @@ namespace notification {
async protocol PNotification {
parent:
async Show() returns (CopyableErrorResult rv);
async Close();
child:
async NotifyClick();
};
} // namespace notification

View File

@@ -29,6 +29,7 @@ EXPORTS.mozilla.dom.notification += [
UNIFIED_SOURCES += [
"Notification.cpp",
"NotificationChild.cpp",
"NotificationEvent.cpp",
"NotificationParent.cpp",
"NotificationUtils.cpp",