Bug 1930676 - Part 3: Add skeleton PNotification functions r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D228681
This commit is contained in:
17
dom/notification/NotificationChild.cpp
Normal file
17
dom/notification/NotificationChild.cpp
Normal 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
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -16,6 +16,10 @@ namespace notification {
|
||||
async protocol PNotification {
|
||||
parent:
|
||||
async Show() returns (CopyableErrorResult rv);
|
||||
async Close();
|
||||
|
||||
child:
|
||||
async NotifyClick();
|
||||
};
|
||||
|
||||
} // namespace notification
|
||||
|
||||
@@ -29,6 +29,7 @@ EXPORTS.mozilla.dom.notification += [
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
"Notification.cpp",
|
||||
"NotificationChild.cpp",
|
||||
"NotificationEvent.cpp",
|
||||
"NotificationParent.cpp",
|
||||
"NotificationUtils.cpp",
|
||||
|
||||
Reference in New Issue
Block a user