Bumping gaia.json for 8 gaia revision(s) a=gaia-bump
[gecko.git] / dom / base / nsHistory.h
blob68c08709db3f4af7c5a32aadbae8c0506205d5f9
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 sw=2 et tw=79: */
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 #ifndef nsHistory_h___
7 #define nsHistory_h___
9 #include "mozilla/Attributes.h"
10 #include "mozilla/ErrorResult.h"
11 #include "nsCOMPtr.h"
12 #include "nsCycleCollectionParticipant.h"
13 #include "nsIDOMHistory.h"
14 #include "nsPIDOMWindow.h" // for GetParentObject
15 #include "nsStringFwd.h"
16 #include "nsWrapperCache.h"
18 class nsIDocShell;
19 class nsISHistory;
20 class nsIWeakReference;
21 class nsPIDOMWindow;
23 // Script "History" object
24 class nsHistory MOZ_FINAL : public nsIDOMHistory, // Empty, needed for extension
25 // backwards compat
26 public nsWrapperCache
28 public:
29 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
30 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsHistory)
32 public:
33 explicit nsHistory(nsPIDOMWindow* aInnerWindow);
35 nsPIDOMWindow* GetParentObject() const;
36 virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
38 uint32_t GetLength(mozilla::ErrorResult& aRv) const;
39 void GetState(JSContext* aCx, JS::MutableHandle<JS::Value> aResult,
40 mozilla::ErrorResult& aRv) const;
41 void Go(int32_t aDelta, mozilla::ErrorResult& aRv);
42 void Back(mozilla::ErrorResult& aRv);
43 void Forward(mozilla::ErrorResult& aRv);
44 void PushState(JSContext* aCx, JS::Handle<JS::Value> aData,
45 const nsAString& aTitle, const nsAString& aUrl,
46 mozilla::ErrorResult& aRv);
47 void ReplaceState(JSContext* aCx, JS::Handle<JS::Value> aData,
48 const nsAString& aTitle, const nsAString& aUrl,
49 mozilla::ErrorResult& aRv);
51 protected:
52 virtual ~nsHistory();
54 nsIDocShell* GetDocShell() const;
56 void PushOrReplaceState(JSContext* aCx, JS::Handle<JS::Value> aData,
57 const nsAString& aTitle, const nsAString& aUrl,
58 mozilla::ErrorResult& aRv, bool aReplace);
60 already_AddRefed<nsISHistory> GetSessionHistory() const;
62 nsCOMPtr<nsIWeakReference> mInnerWindow;
65 #endif /* nsHistory_h___ */