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 mozilla_dom_PendingGlobalHistoryEntry_h_
8 : #define mozilla_dom_PendingGlobalHistoryEntry_h_
9 :
10 : #include "mozilla/IHistory.h"
11 : #include "nsIGlobalHistory2.h"
12 : #include "nsIURI.h"
13 : #include "nsCOMPtr.h"
14 : #include "nsString.h"
15 : #include "nsTArray.h"
16 :
17 : namespace mozilla {
18 :
19 : namespace dom {
20 :
21 : // This class acts as a wrapper around a IHistory, in that it can be used to
22 : // record a series of operations on the IHistory, and then play them back at a
23 : // later time. This is used in Prerendering in order to record the Global
24 : // History changes being made by the prerendering docshell and then play them
25 : // back when the docshell is finished rendering.
26 : //
27 : // This class also handles applying the changes to nsIGlobalHistory2.
28 0 : class PendingGlobalHistoryEntry
29 : {
30 : public:
31 : void VisitURI(nsIURI* aURI,
32 : nsIURI* aLastVisitedURI,
33 : nsIURI* aReferrerURI,
34 : uint32_t aFlags);
35 :
36 : void SetURITitle(nsIURI* aURI,
37 : const nsAString& aTitle);
38 :
39 : nsresult ApplyChanges(IHistory* aHistory);
40 :
41 : nsresult ApplyChanges(nsIGlobalHistory2* aHistory);
42 :
43 : private:
44 0 : struct URIVisit
45 : {
46 : nsCOMPtr<nsIURI> mURI;
47 : nsCOMPtr<nsIURI> mLastVisitedURI;
48 : nsCOMPtr<nsIURI> mReferrerURI;
49 : uint32_t mFlags = 0;
50 : };
51 0 : struct URITitle
52 : {
53 : nsCOMPtr<nsIURI> mURI;
54 : nsString mTitle;
55 : };
56 : nsTArray<URIVisit> mVisits;
57 : nsTArray<URITitle> mTitles;
58 : };
59 :
60 : } // namespace dom
61 :
62 : } // namespace mozilla
63 :
64 : #endif // mozilla_dom_PendingGlobalHistoryEntry_h_
65 :
|