Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /*
7 * interface for container for information saved in session history when
8 * the document is not
9 */
11 #ifndef _nsILayoutHistoryState_h
12 #define _nsILayoutHistoryState_h
14 #include "nsISupports.h"
15 #include "nsStringFwd.h"
17 class nsPresState;
18 template<typename> class already_AddRefed;
20 #define NS_ILAYOUTHISTORYSTATE_IID \
21 { 0x5208993e, 0xd812, 0x431e, \
22 { 0x95, 0x9c, 0xc3, 0x84, 0x5b, 0x6e, 0x5a, 0xce } }
24 class nsILayoutHistoryState : public nsISupports {
25 public:
26 NS_DECLARE_STATIC_IID_ACCESSOR(NS_ILAYOUTHISTORYSTATE_IID)
28 /**
29 * Set |aState| as the state object for |aKey|.
30 * This _transfers_ownership_ of |aState| to the LayoutHistoryState.
31 * It will be freed when RemoveState() is called or when the
32 * LayoutHistoryState is destroyed.
33 */
34 virtual void AddState(const nsCString& aKey, nsPresState* aState) = 0;
36 /**
37 * Look up the state object for |aKey|.
38 */
39 virtual nsPresState* GetState(const nsCString& aKey) = 0;
41 /**
42 * Remove the state object for |aKey|.
43 */
44 virtual void RemoveState(const nsCString& aKey) = 0;
46 /**
47 * Check whether this history has any states in it
48 */
49 virtual bool HasStates() const = 0;
51 /**
52 * Sets whether this history can contain only scroll position history
53 * or all possible history
54 */
55 virtual void SetScrollPositionOnly(const bool aFlag) = 0;
56 };
58 NS_DEFINE_STATIC_IID_ACCESSOR(nsILayoutHistoryState,
59 NS_ILAYOUTHISTORYSTATE_IID)
61 already_AddRefed<nsILayoutHistoryState>
62 NS_NewLayoutHistoryState();
64 #endif /* _nsILayoutHistoryState_h */