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_ServiceWorkerUnregisterCallback_h 8 #define mozilla_dom_ServiceWorkerUnregisterCallback_h 9 10 #include "mozilla/MozPromise.h" 11 #include "mozilla/RefPtr.h" 12 #include "nsIServiceWorkerManager.h" 13 14 namespace mozilla { 15 namespace dom { 16 17 class UnregisterCallback final : public nsIServiceWorkerUnregisterCallback { 18 public: 19 NS_DECL_ISUPPORTS 20 21 UnregisterCallback(); 22 23 explicit UnregisterCallback(GenericPromise::Private* aPromise); 24 25 // nsIServiceWorkerUnregisterCallback implementation 26 NS_IMETHOD 27 UnregisterSucceeded(bool aState) override; 28 29 NS_IMETHOD 30 UnregisterFailed() override; 31 32 RefPtr<GenericPromise> Promise() const; 33 34 private: 35 ~UnregisterCallback() = default; 36 37 RefPtr<GenericPromise::Private> mPromise; 38 }; 39 40 } // namespace dom 41 } // namespace mozilla 42 43 #endif // mozilla_dom_ServiceWorkerUnregisterCallback_h 44