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 file,
5  * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 
7 #ifndef mozilla_dom_ServiceWorkerManagerChild_h
8 #define mozilla_dom_ServiceWorkerManagerChild_h
9 
10 #include "mozilla/dom/PServiceWorkerManagerChild.h"
11 #include "mozilla/ipc/BackgroundUtils.h"
12 
13 namespace mozilla {
14 
15 class OriginAttributes;
16 
17 namespace ipc {
18 class BackgroundChildImpl;
19 }  // namespace ipc
20 
21 namespace dom {
22 
23 class ServiceWorkerManagerChild final : public PServiceWorkerManagerChild {
24   friend class mozilla::ipc::BackgroundChildImpl;
25 
26  public:
NS_INLINE_DECL_REFCOUNTING(ServiceWorkerManagerChild)27   NS_INLINE_DECL_REFCOUNTING(ServiceWorkerManagerChild)
28 
29   void ManagerShuttingDown() { mShuttingDown = true; }
30 
31   mozilla::ipc::IPCResult RecvNotifyRegister(
32       const ServiceWorkerRegistrationData& aData);
33 
34   mozilla::ipc::IPCResult RecvNotifySoftUpdate(
35       const OriginAttributes& aOriginAttributes, const nsString& aScope);
36 
37   mozilla::ipc::IPCResult RecvNotifyUnregister(
38       const PrincipalInfo& aPrincipalInfo, const nsString& aScope);
39 
40   mozilla::ipc::IPCResult RecvNotifyRemove(const nsCString& aHost);
41 
42   mozilla::ipc::IPCResult RecvNotifyRemoveAll();
43 
44   PServiceWorkerUpdaterChild* AllocPServiceWorkerUpdaterChild(
45       const OriginAttributes& originAttributes, const nsCString& scope);
46 
47   bool DeallocPServiceWorkerUpdaterChild(PServiceWorkerUpdaterChild* aActor);
48 
49  private:
ServiceWorkerManagerChild()50   ServiceWorkerManagerChild() : mShuttingDown(false) {}
51 
52   ~ServiceWorkerManagerChild() = default;
53 
54   bool mShuttingDown;
55 };
56 
57 }  // namespace dom
58 }  // namespace mozilla
59 
60 #endif  // mozilla_dom_ServiceWorkerManagerChild_h
61