2015-02-13 22:36:47 +03:00
|
|
|
/* -*- 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
|
2012-05-21 15:12:37 +04:00
|
|
|
* 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/. */
|
2009-08-20 22:56:10 +04:00
|
|
|
|
|
|
|
#ifndef mozilla_IHistory_h_
|
|
|
|
#define mozilla_IHistory_h_
|
|
|
|
|
|
|
|
#include "nsISupports.h"
|
2019-10-25 16:02:04 +03:00
|
|
|
#include "nsURIHashKey.h"
|
2019-10-25 16:02:02 +03:00
|
|
|
#include "nsTObserverArray.h"
|
2009-08-20 22:56:10 +04:00
|
|
|
|
|
|
|
class nsIURI;
|
2018-11-16 20:29:57 +03:00
|
|
|
class nsIWidget;
|
2009-08-20 22:56:10 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
2015-02-13 22:36:37 +03:00
|
|
|
namespace dom {
|
2019-10-25 16:02:08 +03:00
|
|
|
class Document;
|
2015-02-13 22:36:37 +03:00
|
|
|
class Link;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
2009-08-20 22:56:10 +04:00
|
|
|
|
2012-11-09 13:55:54 +04:00
|
|
|
// 0057c9d3-b98e-4933-bdc5-0275d06705e1
|
2009-08-20 22:56:10 +04:00
|
|
|
#define IHISTORY_IID \
|
2012-11-09 13:55:54 +04:00
|
|
|
{ \
|
|
|
|
0x0057c9d3, 0xb98e, 0x4933, { \
|
|
|
|
0xbd, 0xc5, 0x02, 0x75, 0xd0, 0x67, 0x05, 0xe1 \
|
|
|
|
} \
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
|
|
|
|
2009-08-20 22:56:10 +04:00
|
|
|
class IHistory : public nsISupports {
|
|
|
|
public:
|
2015-02-13 22:36:37 +03:00
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(IHISTORY_IID)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Registers the Link for notifications about the visited-ness of aURI.
|
|
|
|
* Consumers should assume that the URI is unvisited after calling this, and
|
|
|
|
* they will be notified if that state (unvisited) changes by having
|
2020-04-16 00:19:41 +03:00
|
|
|
* VisitedQueryFinished called on themselves. Note that it may call
|
|
|
|
* synchronously if the answer is already known.
|
2015-02-13 22:36:37 +03:00
|
|
|
*
|
2020-04-16 00:19:41 +03:00
|
|
|
* @note VisitedQueryFinished must not call RegisterVisitedCallback or
|
2015-02-13 22:36:37 +03:00
|
|
|
* UnregisterVisitedCallback.
|
|
|
|
*
|
|
|
|
* @pre aURI must not be null.
|
|
|
|
* @pre aLink may be null only in the parent (chrome) process.
|
|
|
|
*
|
|
|
|
* @param aURI
|
|
|
|
* The URI to check.
|
|
|
|
* @param aLink
|
|
|
|
* The link to update whenever the history status changes. The
|
|
|
|
* implementation will only hold onto a raw pointer, so if this
|
|
|
|
* object should be destroyed, be sure to call
|
|
|
|
* UnregisterVistedCallback first.
|
|
|
|
*/
|
2020-04-16 00:19:41 +03:00
|
|
|
virtual void RegisterVisitedCallback(nsIURI* aURI, dom::Link* aLink) = 0;
|
2015-02-13 22:36:37 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Unregisters a previously registered Link object. This must be called
|
2019-10-25 16:02:25 +03:00
|
|
|
* before destroying the registered object, and asserts when misused.
|
2015-02-13 22:36:37 +03:00
|
|
|
*
|
|
|
|
* @pre aURI must not be null.
|
|
|
|
* @pre aLink must not be null.
|
|
|
|
*
|
|
|
|
* @param aURI
|
|
|
|
* The URI that aLink was registered for.
|
|
|
|
* @param aLink
|
|
|
|
* The link object to unregister for aURI.
|
|
|
|
*/
|
2019-10-25 16:02:25 +03:00
|
|
|
virtual void UnregisterVisitedCallback(nsIURI* aURI, dom::Link* aLink) = 0;
|
|
|
|
|
2019-11-04 16:28:58 +03:00
|
|
|
enum class VisitedStatus : uint8_t {
|
|
|
|
Unknown,
|
|
|
|
Visited,
|
|
|
|
Unvisited,
|
|
|
|
};
|
|
|
|
|
2019-10-25 16:02:25 +03:00
|
|
|
/**
|
2019-11-04 16:28:58 +03:00
|
|
|
* Notifies about the visited status of a given URI. The visited status cannot
|
|
|
|
* be unknown, otherwise there's no point in notifying of anything.
|
2019-10-25 16:02:25 +03:00
|
|
|
*/
|
2021-06-10 17:35:20 +03:00
|
|
|
virtual void NotifyVisited(nsIURI*, VisitedStatus) = 0;
|
2015-02-13 22:36:37 +03:00
|
|
|
|
|
|
|
enum VisitFlags {
|
2009-08-20 22:56:10 +04:00
|
|
|
/**
|
2015-02-13 22:36:37 +03:00
|
|
|
* Indicates whether the URI was loaded in a top-level window.
|
2009-08-20 22:56:10 +04:00
|
|
|
*/
|
2015-02-13 22:36:37 +03:00
|
|
|
TOP_LEVEL = 1 << 0,
|
2009-08-20 22:56:10 +04:00
|
|
|
/**
|
2018-05-23 17:49:06 +03:00
|
|
|
* Indicates whether the URI is the target of a permanent redirect.
|
2009-08-20 22:56:10 +04:00
|
|
|
*/
|
2015-02-13 22:36:37 +03:00
|
|
|
REDIRECT_PERMANENT = 1 << 1,
|
2010-07-14 05:00:33 +04:00
|
|
|
/**
|
2018-05-23 17:49:06 +03:00
|
|
|
* Indicates whether the URI is the target of a temporary redirect.
|
2010-07-14 05:00:33 +04:00
|
|
|
*/
|
2015-02-13 22:36:37 +03:00
|
|
|
REDIRECT_TEMPORARY = 1 << 2,
|
2010-07-14 05:00:41 +04:00
|
|
|
/**
|
2018-05-23 17:49:06 +03:00
|
|
|
* Indicates the URI will redirect (Response code 3xx).
|
2010-07-14 05:00:41 +04:00
|
|
|
*/
|
2015-02-13 22:36:37 +03:00
|
|
|
REDIRECT_SOURCE = 1 << 3,
|
2012-11-09 13:55:54 +04:00
|
|
|
/**
|
2015-02-13 22:36:37 +03:00
|
|
|
* Indicates the URI caused an error that is unlikely fixable by a
|
|
|
|
* retry, like a not found or unfetchable page.
|
2012-11-09 13:55:54 +04:00
|
|
|
*/
|
2018-05-23 17:49:06 +03:00
|
|
|
UNRECOVERABLE_ERROR = 1 << 4,
|
|
|
|
/**
|
|
|
|
* If REDIRECT_SOURCE is set, this indicates that the redirect is permanent.
|
|
|
|
* Note this differs from REDIRECT_PERMANENT because that one refers to how
|
|
|
|
* we reached the URI, while this is used when the URI itself redirects.
|
|
|
|
*/
|
|
|
|
REDIRECT_SOURCE_PERMANENT = 1 << 5
|
2015-02-13 22:36:37 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds a history visit for the URI.
|
|
|
|
*
|
|
|
|
* @pre aURI must not be null.
|
|
|
|
*
|
2018-11-16 20:29:57 +03:00
|
|
|
* @param aWidget
|
|
|
|
* The widget for the DocShell.
|
2015-02-13 22:36:37 +03:00
|
|
|
* @param aURI
|
|
|
|
* The URI of the page being visited.
|
|
|
|
* @param aLastVisitedURI
|
|
|
|
* The URI of the last visit in the chain.
|
|
|
|
* @param aFlags
|
|
|
|
* The VisitFlags describing this visit.
|
|
|
|
*/
|
2018-11-16 20:29:57 +03:00
|
|
|
NS_IMETHOD VisitURI(nsIWidget* aWidget, nsIURI* aURI, nsIURI* aLastVisitedURI,
|
2015-02-13 22:36:37 +03:00
|
|
|
uint32_t aFlags) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the title of the URI.
|
|
|
|
*
|
|
|
|
* @pre aURI must not be null.
|
|
|
|
*
|
|
|
|
* @param aURI
|
|
|
|
* The URI to set the title for.
|
|
|
|
* @param aTitle
|
|
|
|
* The title string.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD SetURITitle(nsIURI* aURI, const nsAString& aTitle) = 0;
|
2009-08-20 22:56:10 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(IHistory, IHISTORY_IID)
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_IHistory_h_
|