michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=2 sw=2 et tw=79: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: #ifndef nsHistory_h___ michael@0: #define nsHistory_h___ michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "mozilla/ErrorResult.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsCycleCollectionParticipant.h" michael@0: #include "nsIDOMHistory.h" michael@0: #include "nsPIDOMWindow.h" // for GetParentObject michael@0: #include "nsStringFwd.h" michael@0: #include "nsWrapperCache.h" michael@0: michael@0: class nsIDocShell; michael@0: class nsISHistory; michael@0: class nsIWeakReference; michael@0: class nsPIDOMWindow; michael@0: michael@0: // Script "History" object michael@0: class nsHistory MOZ_FINAL : public nsIDOMHistory, // Empty, needed for extension michael@0: // backwards compat michael@0: public nsWrapperCache michael@0: { michael@0: public: michael@0: NS_DECL_CYCLE_COLLECTING_ISUPPORTS michael@0: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsHistory) michael@0: michael@0: public: michael@0: nsHistory(nsPIDOMWindow* aInnerWindow); michael@0: virtual ~nsHistory(); michael@0: michael@0: nsPIDOMWindow* GetParentObject() const; michael@0: virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE; michael@0: michael@0: uint32_t GetLength(mozilla::ErrorResult& aRv) const; michael@0: void GetState(JSContext* aCx, JS::MutableHandle aResult, michael@0: mozilla::ErrorResult& aRv) const; michael@0: void Go(int32_t aDelta, mozilla::ErrorResult& aRv); michael@0: void Back(mozilla::ErrorResult& aRv); michael@0: void Forward(mozilla::ErrorResult& aRv); michael@0: void PushState(JSContext* aCx, JS::Handle aData, michael@0: const nsAString& aTitle, const nsAString& aUrl, michael@0: mozilla::ErrorResult& aRv); michael@0: void ReplaceState(JSContext* aCx, JS::Handle aData, michael@0: const nsAString& aTitle, const nsAString& aUrl, michael@0: mozilla::ErrorResult& aRv); michael@0: michael@0: protected: michael@0: nsIDocShell* GetDocShell() const; michael@0: michael@0: void PushOrReplaceState(JSContext* aCx, JS::Handle aData, michael@0: const nsAString& aTitle, const nsAString& aUrl, michael@0: mozilla::ErrorResult& aRv, bool aReplace); michael@0: michael@0: already_AddRefed GetSessionHistory() const; michael@0: michael@0: nsCOMPtr mInnerWindow; michael@0: }; michael@0: michael@0: #endif /* nsHistory_h___ */