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/. */
6 
7 #ifndef mozilla_dom_ServiceWorkerRegistrationListener_h
8 #define mozilla_dom_ServiceWorkerRegistrationListener_h
9 
10 namespace mozilla {
11 namespace dom {
12 
13 class ServiceWorkerRegistrationDescriptor;
14 
15 // Used by ServiceWorkerManager to notify ServiceWorkerRegistrations of
16 // updatefound event and invalidating ServiceWorker instances.
17 class ServiceWorkerRegistrationListener {
18  public:
19   NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
20 
21   virtual void UpdateState(
22       const ServiceWorkerRegistrationDescriptor& aDescriptor) = 0;
23 
24   virtual void FireUpdateFound() = 0;
25 
26   virtual void RegistrationCleared() = 0;
27 
28   virtual void GetScope(nsAString& aScope) const = 0;
29 
30   virtual bool MatchesDescriptor(
31       const ServiceWorkerRegistrationDescriptor& aDescriptor) = 0;
32 };
33 
34 }  // namespace dom
35 }  // namespace mozilla
36 
37 #endif /* mozilla_dom_ServiceWorkerRegistrationListener_h */
38