dom/base/nsHistory.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:debb438b8b20
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___
8
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"
17
18 class nsIDocShell;
19 class nsISHistory;
20 class nsIWeakReference;
21 class nsPIDOMWindow;
22
23 // Script "History" object
24 class nsHistory MOZ_FINAL : public nsIDOMHistory, // Empty, needed for extension
25 // backwards compat
26 public nsWrapperCache
27 {
28 public:
29 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
30 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsHistory)
31
32 public:
33 nsHistory(nsPIDOMWindow* aInnerWindow);
34 virtual ~nsHistory();
35
36 nsPIDOMWindow* GetParentObject() const;
37 virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
38
39 uint32_t GetLength(mozilla::ErrorResult& aRv) const;
40 void GetState(JSContext* aCx, JS::MutableHandle<JS::Value> aResult,
41 mozilla::ErrorResult& aRv) const;
42 void Go(int32_t aDelta, mozilla::ErrorResult& aRv);
43 void Back(mozilla::ErrorResult& aRv);
44 void Forward(mozilla::ErrorResult& aRv);
45 void PushState(JSContext* aCx, JS::Handle<JS::Value> aData,
46 const nsAString& aTitle, const nsAString& aUrl,
47 mozilla::ErrorResult& aRv);
48 void ReplaceState(JSContext* aCx, JS::Handle<JS::Value> aData,
49 const nsAString& aTitle, const nsAString& aUrl,
50 mozilla::ErrorResult& aRv);
51
52 protected:
53 nsIDocShell* GetDocShell() const;
54
55 void PushOrReplaceState(JSContext* aCx, JS::Handle<JS::Value> aData,
56 const nsAString& aTitle, const nsAString& aUrl,
57 mozilla::ErrorResult& aRv, bool aReplace);
58
59 already_AddRefed<nsISHistory> GetSessionHistory() const;
60
61 nsCOMPtr<nsIWeakReference> mInnerWindow;
62 };
63
64 #endif /* nsHistory_h___ */

mercurial