1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * vim: set ts=4 sw=4 et 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/. */
7 #ifndef mozilla_IHistory_h_
8 #define mozilla_IHistory_h_
10 #include "nsISupports.h"
21 // 0057c9d3-b98e-4933-bdc5-0275d06705e1
22 #define IHISTORY_IID \
23 {0x0057c9d3, 0xb98e, 0x4933, {0xbd, 0xc5, 0x02, 0x75, 0xd0, 0x67, 0x05, 0xe1}}
25 class IHistory
: public nsISupports
28 NS_DECLARE_STATIC_IID_ACCESSOR(IHISTORY_IID
)
31 * Registers the Link for notifications about the visited-ness of aURI.
32 * Consumers should assume that the URI is unvisited after calling this, and
33 * they will be notified if that state (unvisited) changes by having
34 * SetLinkState called on themselves. This function is guaranteed to run to
35 * completion before aLink is notified. After the node is notified, it will
38 * @note SetLinkState must not call RegisterVisitedCallback or
39 * UnregisterVisitedCallback.
41 * @pre aURI must not be null.
42 * @pre aLink may be null only in the parent (chrome) process.
47 * The link to update whenever the history status changes. The
48 * implementation will only hold onto a raw pointer, so if this
49 * object should be destroyed, be sure to call
50 * UnregisterVistedCallback first.
52 NS_IMETHOD
RegisterVisitedCallback(nsIURI
*aURI
, dom::Link
*aLink
) = 0;
55 * Unregisters a previously registered Link object. This must be called
56 * before destroying the registered object.
58 * @pre aURI must not be null.
59 * @pre aLink must not be null.
62 * The URI that aLink was registered for.
64 * The link object to unregister for aURI.
66 NS_IMETHOD
UnregisterVisitedCallback(nsIURI
*aURI
, dom::Link
*aLink
) = 0;
70 * Indicates whether the URI was loaded in a top-level window.
74 * Indicates whether the URI was loaded as part of a permanent redirect.
76 REDIRECT_PERMANENT
= 1 << 1,
78 * Indicates whether the URI was loaded as part of a temporary redirect.
80 REDIRECT_TEMPORARY
= 1 << 2,
82 * Indicates the URI is redirecting (Response code 3xx).
84 REDIRECT_SOURCE
= 1 << 3,
86 * Indicates the URI caused an error that is unlikely fixable by a
87 * retry, like a not found or unfetchable page.
89 UNRECOVERABLE_ERROR
= 1 << 4
93 * Adds a history visit for the URI.
95 * @pre aURI must not be null.
98 * The URI of the page being visited.
99 * @param aLastVisitedURI
100 * The URI of the last visit in the chain.
102 * The VisitFlags describing this visit.
106 nsIURI
*aLastVisitedURI
,
111 * Set the title of the URI.
113 * @pre aURI must not be null.
116 * The URI to set the title for.
120 NS_IMETHOD
SetURITitle(nsIURI
* aURI
, const nsAString
& aTitle
) = 0;
123 * Notifies about the visited status of a given URI.
126 * The URI to notify about.
128 NS_IMETHOD
NotifyVisited(nsIURI
* aURI
) = 0;
131 NS_DEFINE_STATIC_IID_ACCESSOR(IHistory
, IHISTORY_IID
)
133 #define NS_DECL_IHISTORY \
134 NS_IMETHOD RegisterVisitedCallback(nsIURI *aURI, \
135 mozilla::dom::Link *aContent); \
136 NS_IMETHOD UnregisterVisitedCallback(nsIURI *aURI, \
137 mozilla::dom::Link *aContent); \
138 NS_IMETHOD VisitURI(nsIURI *aURI, \
139 nsIURI *aLastVisitedURI, \
141 NS_IMETHOD SetURITitle(nsIURI* aURI, const nsAString& aTitle); \
142 NS_IMETHOD NotifyVisited(nsIURI* aURI);
144 } // namespace mozilla
146 #endif // mozilla_IHistory_h_