nsSHEntry.h 4.29 KB
Newer Older
1
2
3
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
4
5
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
8
9

#ifndef nsSHEntry_h
#define nsSHEntry_h

10
#include "nsCOMArray.h"
11
12
#include "nsCOMPtr.h"
#include "nsISHEntry.h"
13
#include "nsString.h"
14

15
#include "mozilla/Attributes.h"
16

17
18
19
20
21
22
23
24
25
namespace mozilla {
namespace dom {

class SHEntrySharedChildState;
class SHEntrySharedParentState;

}  // namespace dom
}  // namespace mozilla

26
class nsSHEntryShared;
27
28
class nsIInputStream;
class nsIURI;
29
class nsIReferrerInfo;
30

31
class nsSHEntry : public nsISHEntry {
32
 public:
33
34
  NS_DECL_ISUPPORTS
  NS_DECL_NSISHENTRY
35

36
  virtual void EvictContentViewer();
37

38
39
  static nsresult Startup();
  static void Shutdown();
40

41
42
43
44
 protected:
  explicit nsSHEntry(mozilla::dom::SHEntrySharedParentState* aState);
  explicit nsSHEntry(const nsSHEntry& aOther);
  virtual ~nsSHEntry();
45

46
47
  // We share the state in here with other SHEntries which correspond to the
  // same document.
48
  RefPtr<mozilla::dom::SHEntrySharedParentState> mShared;
49
50

  // See nsSHEntry.idl for comments on these members.
51
  nsCOMPtr<nsIURI> mURI;
52
  nsCOMPtr<nsIURI> mOriginalURI;
53
  nsCOMPtr<nsIURI> mResultPrincipalURI;
54
  nsCOMPtr<nsIReferrerInfo> mReferrerInfo;
55
  nsString mTitle;
56
  nsCOMPtr<nsIInputStream> mPostData;
57
58
59
60
61
62
  uint32_t mLoadType;
  uint32_t mID;
  int32_t mScrollPositionX;
  int32_t mScrollPositionY;
  nsISHEntry* mParent;
  nsCOMArray<nsISHEntry> mChildren;
63
  nsCOMPtr<nsIStructuredCloneContainer> mStateData;
64
65
  nsString mSrcdocData;
  nsCOMPtr<nsIURI> mBaseURI;
66
67
68
69
  bool mLoadReplace;
  bool mURIWasModified;
  bool mIsSrcdocEntry;
  bool mScrollRestorationIsManual;
70
  bool mLoadedInThisProcess;
71
  bool mPersist;
72
73
};

74
75
76
77
78
79
80
81
/**
 * Session history entry class used for implementing session history for
 * docshells in the parent process (a different solution would be to use the
 * IPC actors for that too, with both parent and child actor created in the
 * parent process).
 */
class nsLegacySHEntry final : public nsSHEntry {
 public:
82
  explicit nsLegacySHEntry(nsISHistory* aHistory, uint64_t aID);
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
  explicit nsLegacySHEntry(const nsLegacySHEntry& aOther) : nsSHEntry(aOther) {}

  NS_IMETHOD GetContentViewer(nsIContentViewer** aResult) override;
  NS_IMETHOD SetContentViewer(nsIContentViewer* aViewer) override;
  NS_IMETHOD GetWindowState(nsISupports** aState) override;
  NS_IMETHOD SetWindowState(nsISupports* aState) override;
  using nsISHEntry::GetRefreshURIList;
  NS_IMETHOD GetRefreshURIList(nsIMutableArray** aRefreshURIList) override;
  NS_IMETHOD SetRefreshURIList(nsIMutableArray* aRefreshURIList) override;
  using nsISHEntry::GetSaveLayoutStateFlag;
  NS_IMETHOD GetSaveLayoutStateFlag(bool* aSaveLayoutStateFlag) override;
  NS_IMETHOD SetSaveLayoutStateFlag(bool aSaveLayoutStateFlag) override;
  NS_IMETHOD_(void) AddChildShell(nsIDocShellTreeItem* aShell) override;
  NS_IMETHOD ChildShellAt(int32_t aIndex,
                          nsIDocShellTreeItem** aShell) override;
  NS_IMETHOD_(void) ClearChildShells() override;
  NS_IMETHOD_(void) SyncPresentationState() override;
100
101
102
103
104
105
106
107
108
109
  NS_IMETHOD Create(
      nsIURI* aURI, const nsAString& aTitle, nsIInputStream* aInputStream,
      uint32_t aCacheKey, const nsACString& aContentType,
      nsIPrincipal* aTriggeringPrincipal, nsIPrincipal* aPrincipalToInherit,
      nsIPrincipal* aStoragePrincipalToInherit, nsIContentSecurityPolicy* aCsp,
      const nsID& aDocshellID, bool aDynamicCreation, nsIURI* aOriginalURI,
      nsIURI* aResultPrincipalURI, bool aLoadReplace,
      nsIReferrerInfo* aReferrerInfo, const nsAString& aSrcdocData,
      bool aSrcdocEntry, nsIURI* aBaseURI, bool aSaveLayoutState,
      bool aExpired) override;
110
111
112
113
114
115
  NS_IMETHOD Clone(nsISHEntry** aResult) override;
  NS_IMETHOD_(nsDocShellEditorData*) ForgetEditorData(void) override;
  NS_IMETHOD_(void) SetEditorData(nsDocShellEditorData* aData) override;
  NS_IMETHOD_(bool) HasDetachedEditor() override;
  NS_IMETHOD_(bool) HasBFCacheEntry(nsIBFCacheEntry* aEntry) override;
  NS_IMETHOD AbandonBFCacheEntry() override;
116
  NS_IMETHOD_(void) ClearEntry() override;
117
  NS_IMETHOD GetBfcacheID(uint64_t* aBFCacheID) override;
118
119
120
121
122

 private:
  nsSHEntryShared* GetState();
};

123
#endif /* nsSHEntry_h */