nsINavHistoryService
| IID: | a9bea2db-0a3e-4895-9ccc-24bac41a0674 |
| Inherits From: | nsISupports |
This interface is implemented by the following components:
Constants
Properties
readonly PRBool hasHistoryEntries
True if there is any history. This can be used in UI to determine whether the "clear history" button should be enabled or not. This is much better than using BrowserHistory.count since that can be very slow if there is a lot of history (it must enumerate each item). This is pretty fast.
readonly PRBool historyDisabled
True if history is disabled. currently, history is disabled if the browser.history_expire_days pref is 0
Methods
void addObserver ( nsINavHistoryObserver observer , PRBool ownsWeak )
PRInt64 addVisit ( nsIURI URI , PRTime time , nsIURI referringURI , PRInt32 transitionType , PRBool isRedirect , PRInt64 sessionID )
PRBool canAddURI ( nsIURI URI )
nsINavHistoryResult executeQueries ( nsINavHistoryQuery queries , PRUint32 queryCount , nsINavHistoryQueryOptions options )
nsINavHistoryResult executeQuery ( nsINavHistoryQuery query , nsINavHistoryQueryOptions options )
nsINavHistoryQuery getNewQuery ( )
nsINavHistoryQueryOptions getNewQueryOptions ( )
AString getPageTitle ( nsIURI URI )
void importHistory ( nsIFile file )
void markPageAsFollowedBookmark ( nsIURI URI )
AUTF8String queriesToQueryString ( nsINavHistoryQuery queries , PRUint32 queryCount , nsINavHistoryQueryOptions options )
void queryStringToQueries ( AUTF8String queryString , out nsINavHistoryQuery queries , out PRUint32 resultCount , out nsINavHistoryQueryOptions options )
void removeObserver ( nsINavHistoryObserver observer )
void runInBatchMode ( nsINavHistoryBatchCallback callback , nsISupports closure )
void setPageDetails ( nsIURI URI , AString title , PRUint32 visitCount , PRBool hidden , PRBool typed )
void addObserver ( nsINavHistoryObserver observer , PRBool ownsWeak )
Adds a history observer. If ownsWeak is false, the history service will keep an owning reference to the observer. If ownsWeak is true, then observer must implement nsISupportsWeakReference, and the history service will keep a weak reference to the observer.
- Arguments:
- observer
- ownsWeak
PRInt64 addVisit ( nsIURI URI , PRTime time , nsIURI referringURI , PRInt32 transitionType , PRBool isRedirect , PRInt64 sessionID )
Call to manually add a visit for a specific page. This will probably not be commonly used other than for backup/restore type operations. If the URI does not have an entry in the history database already, one will be created with no visits, no title, hidden, not typed. Adding a visit will automatically increment the visit count for the visited page and will unhide it and/or mark it typed according to the transition type.
- Arguments:
- URI: Visited page
- time: Time page was visited (microseconds)
- referringURI: The URI of the visit that generated this one. Use null for no referrer.
- transitionType
- isRedirect: True if the given visit redirects to somewhere else. (ie you will create an visit out of here that is a redirect transition). This causes this page to be hidden in normal history views (unless it has been unhidden by visiting it with a non-redirect).
- sessionID: The session ID that this page belongs to. Use 0 for no session.
PRBool canAddURI ( nsIURI URI )
Returns true if this URI would be added to the history. You don't have to worry about calling this, addPageToSession/addURI will always check before actually adding the page. This function is public because some components may want to check if this page would go in the history (i.e. for annotations).
- Arguments:
- URI
nsINavHistoryResult executeQueries ( nsINavHistoryQuery queries , PRUint32 queryCount , nsINavHistoryQueryOptions options )
Executes an array of queries. All of the query objects are ORed together. Within a query, all the terms are ANDed together as in executeQuery. See executeQuery()
- Arguments:
- queries
- queryCount
- options
nsINavHistoryResult executeQuery ( nsINavHistoryQuery query , nsINavHistoryQueryOptions options )
Executes a single query.
- Arguments:
- query
- options
nsINavHistoryQuery getNewQuery ( )
This returns a new query object that you can pass to executeQuer[y/ies]. It will be initialized to all empty (so using it will give you all history).
nsINavHistoryQueryOptions getNewQueryOptions ( )
This returns a new options object that you can pass to executeQuer[y/ies] after setting the desired options.
void importHistory ( nsIFile file )
Import the given Mork history file.
- Arguments:
- file: The Mork history file to import
void markPageAsFollowedBookmark ( nsIURI URI )
This is just like markPageAsTyped (in nsIBrowserHistory, also implemented by the history service), but for bookmarks. It declares that the given URI is being opened as a result of following a bookmark. If this URI is loaded soon after this message has been received, that transition will be marked as following a bookmark.
- Arguments:
- URI
AUTF8String queriesToQueryString ( nsINavHistoryQuery queries , PRUint32 queryCount , nsINavHistoryQueryOptions options )
Converts a query into an equivalent string that can be persisted. Inverse of queryStringToQueries()
- Arguments:
- queries
- queryCount
- options
void queryStringToQueries ( AUTF8String queryString , out nsINavHistoryQuery queries , out PRUint32 resultCount , out nsINavHistoryQueryOptions options )
Converts a query URI-like string to an array of actual query objects for use to executeQueries(). The output query array may be empty if there is no information. However, there will always be an options structure returned (if nothing is defined, it will just have the default values).
- Arguments:
- queryString
- queries
- resultCount
- options
void removeObserver ( nsINavHistoryObserver observer )
Removes a history observer.
- Arguments:
- observer
void runInBatchMode ( nsINavHistoryBatchCallback callback , nsISupports closure )
Runs the passed callback in batch mode. Use this when a lot of things are about to change. Calls can be nested, observers will only be notified when all batches begin/end.
- Arguments:
- callback: nsINavHistoryBatchCallback interface to call.
- closure
void setPageDetails ( nsIURI URI , AString title , PRUint32 visitCount , PRBool hidden , PRBool typed )
Call to set the full information for a given page. If the page does not exist, it will be added to the database. If it does, the existing values WILL BE OVERWRITTEN. This is an updated version of addPageWithDetails for backup/restore type operations.
- Arguments:
- URI: Page to add/change.
- title: Title as specified by the page.
- visitCount: Number of times this page has been visited. Setting this to 0 may make the page invisible in some views.
- hidden: Whether the page is hidden. If the page has only TRANSITION_EMBED visits, this will be true, otherwise false.
- typed: True if this URI has ever been typed.
Reference documentation is generated from Mozilla's source.
