This article covers features introduced in Firefox 3nsINavHistoryObserver interface is similar to the nsIRDFObserver class, but is used to observe interactions on the global history.
nsINavHistoryObserver is defined in toolkit/components/places/public/nsINavHistoryService.idl
. It is scriptable
and
unfrozen (hasn't changed since Mozilla 1.9)
.
Inherits from: nsISupports
void onBeginUpdateBatch();
|
void onClearHistory();
|
void onDeleteURI(in nsIURI aURI);
|
void onEndUpdateBatch();
|
void onPageChanged(in nsIURI aURI, in unsigned long aWhat, in AString aValue);
|
void onPageExpired(in nsIURI aURI, in PRTime aVisitTime, in boolean aWholeEntry);
|
void onTitleChanged(in nsIURI aURI, in AString aPageTitle);
|
void onVisit(in nsIURI aURI, in long long aVisitID, in PRTime aTime, in long long aSessionID, in long long aReferringID, in unsigned long aTransitionType);
|
Notifies you that a batch of things are about to change. You should avoid doing any heavy-duty processing until onEndUpdateBatch() is called.
void onBeginUpdateBatch();
The specified page and all its visits are about to be deleted.
Delete notifications aren't quite 100% accurate. Batch delete operations take place in two steps; the notifications come first, followed by a bulk delete. If an error occurs in between these two steps (for example, an out of memory error), then you may get a notification even though the page doesn't wind up getting deleted.
void onDeleteURI( in nsIURI aURI );
Called once a batch of updates is completed. Once this has been called, you can perform processing, user interface updates, and so forth. This is called sometime after onBeginUpdateBatch().
void onEndUpdateBatch();
Some attribute on the specified page has changed.
Note that for TYPED and HIDDEN pages, the page might not actually have been added yet. This needs to be clarified; what are TYPED and HIDDEN?
void onPageChanged( in nsIURI aURI, in unsigned long aWhat, in AString aValue );
Called when a history entry expires. This notification is sent to indicate that a specific visit has expired, and includes the time of that visit. When the last visit for a history entry expires, the history entry itself is deleted and the aWholeEntry parameter is true.
If your code only cares about whole entries being deleted instead of individual visits, you can simply act only when aWholeEntry is true.
It's possible for a history entry to be deleted even though it has no visits if something is out of sync after a bookmark with no visits is deleted; this results in the entire history entry being freed). In such cases, aVisitTime is 0.
void onPageExpired( in nsIURI aURI, in PRTime aVisitTime, in boolean aWholeEntry );
true if this expiration will result in the entire history entry being deleted from the history store; if false, only the specified visit is being deleted.
Called whenever either the real title or the custom title of the page changes. Both titles are always included in this notification, even though only one is changed each time it's called, since often consumers will want to display the user title if available, falling back to the title specified by the page's <title> element if there is no user title.
It's important to note that there is a difference between an empty title and a NULL title. An empty string means the title was specifically set to be nothing. NULL means the title was not set at all. From C++ code, use the IsVoid() and SetIsvoid() methods to see whether an empty string is "null" or not; in either case it will always be an empty string.
void onTitleChanged( in nsIURI aURI, in AString aPageTitle );
Page last modified 22:10, 15 Aug 2007 by Sheppy