1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/base/nsHistory.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,64 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim: set ts=2 sw=2 et tw=79: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 +#ifndef nsHistory_h___ 1.10 +#define nsHistory_h___ 1.11 + 1.12 +#include "mozilla/Attributes.h" 1.13 +#include "mozilla/ErrorResult.h" 1.14 +#include "nsCOMPtr.h" 1.15 +#include "nsCycleCollectionParticipant.h" 1.16 +#include "nsIDOMHistory.h" 1.17 +#include "nsPIDOMWindow.h" // for GetParentObject 1.18 +#include "nsStringFwd.h" 1.19 +#include "nsWrapperCache.h" 1.20 + 1.21 +class nsIDocShell; 1.22 +class nsISHistory; 1.23 +class nsIWeakReference; 1.24 +class nsPIDOMWindow; 1.25 + 1.26 +// Script "History" object 1.27 +class nsHistory MOZ_FINAL : public nsIDOMHistory, // Empty, needed for extension 1.28 + // backwards compat 1.29 + public nsWrapperCache 1.30 +{ 1.31 +public: 1.32 + NS_DECL_CYCLE_COLLECTING_ISUPPORTS 1.33 + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsHistory) 1.34 + 1.35 +public: 1.36 + nsHistory(nsPIDOMWindow* aInnerWindow); 1.37 + virtual ~nsHistory(); 1.38 + 1.39 + nsPIDOMWindow* GetParentObject() const; 1.40 + virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE; 1.41 + 1.42 + uint32_t GetLength(mozilla::ErrorResult& aRv) const; 1.43 + void GetState(JSContext* aCx, JS::MutableHandle<JS::Value> aResult, 1.44 + mozilla::ErrorResult& aRv) const; 1.45 + void Go(int32_t aDelta, mozilla::ErrorResult& aRv); 1.46 + void Back(mozilla::ErrorResult& aRv); 1.47 + void Forward(mozilla::ErrorResult& aRv); 1.48 + void PushState(JSContext* aCx, JS::Handle<JS::Value> aData, 1.49 + const nsAString& aTitle, const nsAString& aUrl, 1.50 + mozilla::ErrorResult& aRv); 1.51 + void ReplaceState(JSContext* aCx, JS::Handle<JS::Value> aData, 1.52 + const nsAString& aTitle, const nsAString& aUrl, 1.53 + mozilla::ErrorResult& aRv); 1.54 + 1.55 +protected: 1.56 + nsIDocShell* GetDocShell() const; 1.57 + 1.58 + void PushOrReplaceState(JSContext* aCx, JS::Handle<JS::Value> aData, 1.59 + const nsAString& aTitle, const nsAString& aUrl, 1.60 + mozilla::ErrorResult& aRv, bool aReplace); 1.61 + 1.62 + already_AddRefed<nsISHistory> GetSessionHistory() const; 1.63 + 1.64 + nsCOMPtr<nsIWeakReference> mInnerWindow; 1.65 +}; 1.66 + 1.67 +#endif /* nsHistory_h___ */