Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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 :
7 : #ifndef PartialSHistory_h
8 : #define PartialSHistory_h
9 :
10 : #include "nsCycleCollectionParticipant.h"
11 : #include "nsFrameLoader.h"
12 : #include "nsIGroupedSHistory.h"
13 : #include "nsIPartialSHistoryListener.h"
14 : #include "nsIPartialSHistory.h"
15 : #include "nsISHistory.h"
16 : #include "nsISHistoryListener.h"
17 : #include "TabParent.h"
18 :
19 : namespace mozilla {
20 : namespace dom {
21 :
22 : class PartialSHistory final : public nsIPartialSHistory,
23 : public nsISHistoryListener,
24 : public nsIPartialSHistoryListener,
25 : public nsSupportsWeakReference
26 : {
27 : public:
28 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
29 0 : NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(PartialSHistory, nsIPartialSHistory)
30 : NS_DECL_NSIPARTIALSHISTORY
31 : NS_DECL_NSIPARTIALSHISTORYLISTENER
32 : NS_DECL_NSISHISTORYLISTENER
33 :
34 : /**
35 : * Note that PartialSHistory must be constructed after frameloader has
36 : * created a valid docshell or tabparent.
37 : */
38 : explicit PartialSHistory(nsIFrameLoader* aOwnerFrameLoader);
39 :
40 : private:
41 0 : ~PartialSHistory() {}
42 : already_AddRefed<nsISHistory> GetSessionHistory();
43 : already_AddRefed<TabParent> GetTabParent();
44 :
45 : nsresult SHistoryDidUpdate(bool aTruncate = false);
46 :
47 : // The cache of number of entries in corresponding nsISHistory. It's only
48 : // used for remote process case. If nsISHistory is in-process, mCount will not
49 : // be used at all.
50 : uint32_t mCount;
51 :
52 : // The current local index of the active document in this partial SHistory.
53 : uint32_t mIndex;
54 :
55 : // The cache of globalIndexOffset in corresponding nsISHistory. It's only
56 : // used for remote process case.
57 : uint32_t mGlobalIndexOffset;
58 :
59 : // One of the possible active states from nsIPartialSHistory
60 : int32_t mActive;
61 :
62 : // The frameloader which owns this PartialSHistory.
63 : nsCOMPtr<nsIFrameLoader> mOwnerFrameLoader;
64 :
65 : // The GroupedSHistory which this PartialSHistory is part of, or null.
66 : nsCOMPtr<nsIGroupedSHistory> mGroupedSHistory;
67 : };
68 :
69 : } // namespace dom
70 : } // namespace mozilla
71 :
72 : #endif /* PartialSHistory_h */
|