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 PrincipalOriginAttributes;
16 
17 namespace ipc {
18 class BackgroundChildImpl;
19 } // namespace ipc
20 
21 namespace dom {
22 namespace workers {
23 
24 class ServiceWorkerManagerChild final : public PServiceWorkerManagerChild
25 {
26   friend class mozilla::ipc::BackgroundChildImpl;
27 
28 public:
NS_INLINE_DECL_REFCOUNTING(ServiceWorkerManagerChild)29   NS_INLINE_DECL_REFCOUNTING(ServiceWorkerManagerChild)
30 
31   void ManagerShuttingDown()
32   {
33     mShuttingDown = true;
34   }
35 
36   virtual bool RecvNotifyRegister(const ServiceWorkerRegistrationData& aData)
37                                                                        override;
38 
39   virtual bool RecvNotifySoftUpdate(const PrincipalOriginAttributes& aOriginAttributes,
40                                     const nsString& aScope) override;
41 
42   virtual bool RecvNotifyUnregister(const PrincipalInfo& aPrincipalInfo,
43                                     const nsString& aScope) override;
44 
45   virtual bool RecvNotifyRemove(const nsCString& aHost) override;
46 
47   virtual bool RecvNotifyRemoveAll() override;
48 
49 private:
ServiceWorkerManagerChild()50   ServiceWorkerManagerChild()
51     : mShuttingDown(false)
52   {}
53 
~ServiceWorkerManagerChild()54   ~ServiceWorkerManagerChild() {}
55 
56   bool mShuttingDown;
57 };
58 
59 } // namespace workers
60 } // namespace dom
61 } // namespace mozilla
62 
63 #endif // mozilla_dom_ServiceWorkerManagerChild_h
64