Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim: set ts=2 sw=2 et tw=79: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | #ifndef nsHistory_h___ |
michael@0 | 7 | #define nsHistory_h___ |
michael@0 | 8 | |
michael@0 | 9 | #include "mozilla/Attributes.h" |
michael@0 | 10 | #include "mozilla/ErrorResult.h" |
michael@0 | 11 | #include "nsCOMPtr.h" |
michael@0 | 12 | #include "nsCycleCollectionParticipant.h" |
michael@0 | 13 | #include "nsIDOMHistory.h" |
michael@0 | 14 | #include "nsPIDOMWindow.h" // for GetParentObject |
michael@0 | 15 | #include "nsStringFwd.h" |
michael@0 | 16 | #include "nsWrapperCache.h" |
michael@0 | 17 | |
michael@0 | 18 | class nsIDocShell; |
michael@0 | 19 | class nsISHistory; |
michael@0 | 20 | class nsIWeakReference; |
michael@0 | 21 | class nsPIDOMWindow; |
michael@0 | 22 | |
michael@0 | 23 | // Script "History" object |
michael@0 | 24 | class nsHistory MOZ_FINAL : public nsIDOMHistory, // Empty, needed for extension |
michael@0 | 25 | // backwards compat |
michael@0 | 26 | public nsWrapperCache |
michael@0 | 27 | { |
michael@0 | 28 | public: |
michael@0 | 29 | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
michael@0 | 30 | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsHistory) |
michael@0 | 31 | |
michael@0 | 32 | public: |
michael@0 | 33 | nsHistory(nsPIDOMWindow* aInnerWindow); |
michael@0 | 34 | virtual ~nsHistory(); |
michael@0 | 35 | |
michael@0 | 36 | nsPIDOMWindow* GetParentObject() const; |
michael@0 | 37 | virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE; |
michael@0 | 38 | |
michael@0 | 39 | uint32_t GetLength(mozilla::ErrorResult& aRv) const; |
michael@0 | 40 | void GetState(JSContext* aCx, JS::MutableHandle<JS::Value> aResult, |
michael@0 | 41 | mozilla::ErrorResult& aRv) const; |
michael@0 | 42 | void Go(int32_t aDelta, mozilla::ErrorResult& aRv); |
michael@0 | 43 | void Back(mozilla::ErrorResult& aRv); |
michael@0 | 44 | void Forward(mozilla::ErrorResult& aRv); |
michael@0 | 45 | void PushState(JSContext* aCx, JS::Handle<JS::Value> aData, |
michael@0 | 46 | const nsAString& aTitle, const nsAString& aUrl, |
michael@0 | 47 | mozilla::ErrorResult& aRv); |
michael@0 | 48 | void ReplaceState(JSContext* aCx, JS::Handle<JS::Value> aData, |
michael@0 | 49 | const nsAString& aTitle, const nsAString& aUrl, |
michael@0 | 50 | mozilla::ErrorResult& aRv); |
michael@0 | 51 | |
michael@0 | 52 | protected: |
michael@0 | 53 | nsIDocShell* GetDocShell() const; |
michael@0 | 54 | |
michael@0 | 55 | void PushOrReplaceState(JSContext* aCx, JS::Handle<JS::Value> aData, |
michael@0 | 56 | const nsAString& aTitle, const nsAString& aUrl, |
michael@0 | 57 | mozilla::ErrorResult& aRv, bool aReplace); |
michael@0 | 58 | |
michael@0 | 59 | already_AddRefed<nsISHistory> GetSessionHistory() const; |
michael@0 | 60 | |
michael@0 | 61 | nsCOMPtr<nsIWeakReference> mInnerWindow; |
michael@0 | 62 | }; |
michael@0 | 63 | |
michael@0 | 64 | #endif /* nsHistory_h___ */ |