nsIBrowserHistory
From MDC
This article covers features introduced in Firefox 3
The nsIBrowserHistory is a browser-specific interface to global history. It adds functions used by the basic browser like, marking pages as typed in the URL bar, and removing pages as from the history interface.
Contents |
nsIBrowserHistory is defined in toolkit/components/places/public/nsIBrowserHistory.idl. It is scriptable and
unfrozen (hasn't changed since Mozilla 1.9).
Inherits from: nsISupports
Implemented by: @mozilla.org/browser/nav-history-service;1. To use this service, use:
var historyService = Components.classes["@mozilla.org/browser/nav-history-service;1"]
.getService(Components.interfaces.nsIBrowserHistory);
[edit] Method overview
void addPageWithDetails(in nsIURI aURI, in wstring aTitle, in long long aLastVisited);
|
void removePage(in nsIURI aURI);
|
void removePagesFromHost(in AUTF8String aHost, in boolean aEntireDomain);
|
void removeAllPages();
|
void hidePage(in nsIURI aURI);
|
void markPageAsTyped(in nsIURI aURI);
|
[edit] Attributes
| Attribute | Type | Description |
lastPageVisited
| AUTF8String
| The last page that was visited in a top-level window. |
count
| PRUint32
| The number of entries in global history. |
[edit] Methods
[edit] addPageWithDetails()
This method adds a page to the history with specific time stamp information. It is called by history importing code and is used in the History migrator.
void addPageWithDetails( in nsIURI aURI, in wstring aTitle, in long long aLastVisited, );
[edit] Parameters
- aURI
- The page that will be added to the history.
- aTitle
- The title of the page.
- aLastVisited
- When the page was last visited. how is this specified?
[edit] removePage()
This method removes a page from the history. It removes the given URI and all of its visits from the history database. This method is called by the UI when the user deletes a history entry.
void removePage( in nsIURI aURI );
[edit] Parameters
- aURI
- The added page which is to be removed.
[edit] removePagesFromHost()
This method removes all the pages from the given host. It is called from the UI when the user deletes a group associated with a host or domain. This method allows you to delete pages from a specific host, or pages from all hosts in a given domain.
If aEntireDomain is true, it will assume aHost is a domain, and remove all pages from the entire domain.
void removePagesFromHost( in AUTF8String aHost, in boolean aEntireDomain );
[edit] Parameters
- aHost
- The name of the host.
- aEntireDomain
- If set to
true, it will assumeaHostis a domain, and remove all pages from the entire domain. Set tofalseotherwise.
[edit] removeAllPages()
This method removes all the pages from the global history.
void removeAllPages();
[edit] Parameters
None.
[edit] hidePage()
This method hides a page so that it does not appear in the UI. It hides the specified URL from being enumerated (and thus displayed in the UI). Many pages are not visible in normal history lists, such as redirects and sub-frame contents.
void hidePage( in nsIURI aURI );
[edit] Parameters
- aURI
- The page that is to be hidden.
[edit] markPageAsTyped()
This method designates the URL as having been explicitly typed in by the user, so it can be used as an autocomplete result. It is called by the URL bar when the user types in a URL. This can be and is called before the page is actually added to history, since the page isn't added until it actually starts loading. The typed flag affects the URL bar autocomplete. This will cause the transition type of the next visit of the URL to be marked as "typed."
void markPageAsTyped( in nsIURI aURI );
[edit] Parameters
- aURI
- The page that is to be marked as typed.