tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

NavigationActivation.h (1896B)


      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_NavigationActivation_h___
      8 #define mozilla_dom_NavigationActivation_h___
      9 
     10 #include "nsCOMPtr.h"
     11 #include "nsISupports.h"
     12 #include "nsWrapperCache.h"
     13 
     14 class nsIGlobalObject;
     15 
     16 namespace mozilla::dom {
     17 
     18 class NavigationHistoryEntry;
     19 enum class NavigationType : uint8_t;
     20 
     21 class NavigationActivation final : public nsISupports, public nsWrapperCache {
     22 public:
     23  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
     24  NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(NavigationActivation)
     25 
     26  NavigationActivation(nsIGlobalObject* aGlobal,
     27                       NavigationHistoryEntry* aNewEntry,
     28                       NavigationHistoryEntry* aOldEntry, NavigationType aType);
     29 
     30  already_AddRefed<NavigationHistoryEntry> GetFrom() const;
     31  already_AddRefed<NavigationHistoryEntry> Entry() const;
     32  // https://html.spec.whatwg.org/#dom-navigationactivation-navigationtype
     33  enum NavigationType NavigationType() const { return mType; }
     34 
     35  JSObject* WrapObject(JSContext* aCx,
     36                       JS::Handle<JSObject*> aGivenProto) override;
     37  nsIGlobalObject* GetParentObject() const { return mGlobal; }
     38 
     39 private:
     40  ~NavigationActivation() = default;
     41 
     42  nsCOMPtr<nsIGlobalObject> mGlobal;
     43  // https://html.spec.whatwg.org/#nav-activation-new-entry
     44  RefPtr<NavigationHistoryEntry> mNewEntry;
     45  // https://html.spec.whatwg.org/#nav-activation-old-entry
     46  RefPtr<NavigationHistoryEntry> mOldEntry;
     47  // https://html.spec.whatwg.org/#nav-activation-navigation-type
     48  enum NavigationType mType;
     49 };
     50 
     51 }  // namespace mozilla::dom
     52 
     53 #endif  // mozilla_dom_NavigationActivation_h___