1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "ServiceWorkerManagerChild.h"
8 #include "ServiceWorkerManager.h"
9 #include "ServiceWorkerUpdaterChild.h"
10 #include "mozilla/Unused.h"
18 mozilla::ipc::IPCResult
ServiceWorkerManagerChild::RecvNotifyRegister(
19 const ServiceWorkerRegistrationData
& aData
) {
24 RefPtr
<ServiceWorkerManager
> swm
= ServiceWorkerManager::GetInstance();
26 swm
->LoadRegistration(aData
);
32 mozilla::ipc::IPCResult
ServiceWorkerManagerChild::RecvNotifySoftUpdate(
33 const OriginAttributes
& aOriginAttributes
, const nsString
& aScope
) {
38 RefPtr
<ServiceWorkerManager
> swm
= ServiceWorkerManager::GetInstance();
40 swm
->SoftUpdate(aOriginAttributes
, NS_ConvertUTF16toUTF8(aScope
));
46 mozilla::ipc::IPCResult
ServiceWorkerManagerChild::RecvNotifyUnregister(
47 const PrincipalInfo
& aPrincipalInfo
, const nsString
& aScope
) {
52 RefPtr
<ServiceWorkerManager
> swm
= ServiceWorkerManager::GetInstance();
58 nsCOMPtr
<nsIPrincipal
> principal
= PrincipalInfoToPrincipal(aPrincipalInfo
);
59 if (NS_WARN_IF(!principal
)) {
63 nsresult rv
= swm
->NotifyUnregister(principal
, aScope
);
64 Unused
<< NS_WARN_IF(NS_FAILED(rv
));
68 mozilla::ipc::IPCResult
ServiceWorkerManagerChild::RecvNotifyRemove(
69 const nsCString
& aHost
) {
74 RefPtr
<ServiceWorkerManager
> swm
= ServiceWorkerManager::GetInstance();
82 mozilla::ipc::IPCResult
ServiceWorkerManagerChild::RecvNotifyRemoveAll() {
87 RefPtr
<ServiceWorkerManager
> swm
= ServiceWorkerManager::GetInstance();
95 PServiceWorkerUpdaterChild
*
96 ServiceWorkerManagerChild::AllocPServiceWorkerUpdaterChild(
97 const OriginAttributes
& aOriginAttributes
, const nsCString
& aScope
) {
98 MOZ_CRASH("Do no use ServiceWorkerUpdaterChild IPC CTOR.");
101 bool ServiceWorkerManagerChild::DeallocPServiceWorkerUpdaterChild(
102 PServiceWorkerUpdaterChild
* aActor
) {
108 } // namespace mozilla