ServiceWorkerManagerService.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  4. * You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef mozilla_dom_ServiceWorkerManagerService_h
  6. #define mozilla_dom_ServiceWorkerManagerService_h
  7. #include "nsISupportsImpl.h"
  8. #include "nsHashKeys.h"
  9. #include "nsTHashtable.h"
  10. namespace mozilla {
  11. class PrincipalOriginAttributes;
  12. namespace ipc {
  13. class PrincipalInfo;
  14. } // namespace ipc
  15. namespace dom {
  16. class ServiceWorkerRegistrationData;
  17. namespace workers {
  18. class ServiceWorkerManagerParent;
  19. class ServiceWorkerManagerService final
  20. {
  21. public:
  22. NS_INLINE_DECL_REFCOUNTING(ServiceWorkerManagerService)
  23. static already_AddRefed<ServiceWorkerManagerService> Get();
  24. static already_AddRefed<ServiceWorkerManagerService> GetOrCreate();
  25. void RegisterActor(ServiceWorkerManagerParent* aParent);
  26. void UnregisterActor(ServiceWorkerManagerParent* aParent);
  27. void PropagateRegistration(uint64_t aParentID,
  28. ServiceWorkerRegistrationData& aData);
  29. void PropagateSoftUpdate(uint64_t aParentID,
  30. const PrincipalOriginAttributes& aOriginAttributes,
  31. const nsAString& aScope);
  32. void PropagateUnregister(uint64_t aParentID,
  33. const mozilla::ipc::PrincipalInfo& aPrincipalInfo,
  34. const nsAString& aScope);
  35. void PropagateRemove(uint64_t aParentID, const nsACString& aHost);
  36. void PropagateRemoveAll(uint64_t aParentID);
  37. private:
  38. ServiceWorkerManagerService();
  39. ~ServiceWorkerManagerService();
  40. nsTHashtable<nsPtrHashKey<ServiceWorkerManagerParent>> mAgents;
  41. };
  42. } // namespace workers
  43. } // namespace dom
  44. } // namespace mozilla
  45. #endif // mozilla_dom_ServiceWorkerManagerService_h