NavigationTransition.h (2088B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=2 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_NavigationTransition_h___ 8 #define mozilla_dom_NavigationTransition_h___ 9 10 #include "mozilla/RefPtr.h" 11 #include "nsCOMPtr.h" 12 #include "nsCycleCollectionParticipant.h" 13 #include "nsISupports.h" 14 #include "nsWrapperCache.h" 15 16 class nsIGlobalObject; 17 18 namespace mozilla::dom { 19 20 class NavigationHistoryEntry; 21 enum class NavigationType : uint8_t; 22 class Promise; 23 24 // https://html.spec.whatwg.org/#navigationtransition 25 class NavigationTransition final : public nsISupports, public nsWrapperCache { 26 public: 27 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 28 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(NavigationTransition) 29 30 NavigationTransition(nsIGlobalObject* aGlobalObject, 31 NavigationType aNavigationType, 32 NavigationHistoryEntry* aFrom, Promise* aCommitted, 33 Promise* aFinished); 34 35 enum NavigationType NavigationType() const; 36 NavigationHistoryEntry* From() const; 37 38 Promise* Committed() const; 39 40 Promise* Finished() const; 41 42 JSObject* WrapObject(JSContext* aCx, 43 JS::Handle<JSObject*> aGivenProto) override; 44 nsIGlobalObject* GetParentObject() const; 45 46 private: 47 ~NavigationTransition() = default; 48 49 nsCOMPtr<nsIGlobalObject> mGlobalObject; 50 51 // https://html.spec.whatwg.org/#concept-navigationtransition-navigationtype 52 enum NavigationType mNavigationType; 53 54 // https://html.spec.whatwg.org/#concept-navigationtransition-from 55 RefPtr<NavigationHistoryEntry> mFrom; 56 57 // https://html.spec.whatwg.org/#concept-navigationtransition-committed 58 RefPtr<Promise> mCommitted; 59 60 // https://html.spec.whatwg.org/#concept-navigationtransition-finished 61 RefPtr<Promise> mFinished; 62 }; 63 64 } // namespace mozilla::dom 65 66 #endif // mozilla_dom_NavigationTransition_h___