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