mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-08 04:27:37 +00:00
835 lines
30 KiB
Plaintext
835 lines
30 KiB
Plaintext
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
*
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
* the License. You may obtain a copy of the License at
|
|
* http://www.mozilla.org/MPL/
|
|
*
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
* for the specific language governing rights and limitations under the
|
|
* License.
|
|
*
|
|
* The Original Code is Places code.
|
|
*
|
|
* The Initial Developer of the Original Code is
|
|
* Google Inc.
|
|
* Portions created by the Initial Developer are Copyright (C) 2005
|
|
* the Initial Developer. All Rights Reserved.
|
|
*
|
|
* Contributor(s):
|
|
* Brett Wilson <brett@gmail.com>
|
|
*
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
* the provisions above, a recipient may use your version of this file under
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
*
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
#include "nsISupports.idl"
|
|
#include "nsIArray.idl"
|
|
#include "nsIURI.idl"
|
|
|
|
interface nsINavHistoryQuery;
|
|
interface nsINavHistoryQueryOptions;
|
|
interface nsITransactionManager;
|
|
interface nsITreeColumn;
|
|
interface nsIFile;
|
|
|
|
[scriptable, uuid(acae2b2d-5fcd-4419-b1bc-b7dc92a1836c)]
|
|
interface nsINavHistoryResultNode : nsISupports
|
|
{
|
|
/**
|
|
* Indentifies the parent result node in the result set. This is null for
|
|
* top level nodes.
|
|
*/
|
|
readonly attribute nsINavHistoryResultNode parent;
|
|
|
|
/**
|
|
* Identifies the type of this node.
|
|
*/
|
|
const PRUint32 RESULT_TYPE_URL = 0;
|
|
const PRUint32 RESULT_TYPE_VISIT = 1;
|
|
const PRUint32 RESULT_TYPE_HOST = 2;
|
|
const PRUint32 RESULT_TYPE_DAY = 3;
|
|
const PRUint32 RESULT_TYPE_QUERY = 4;
|
|
readonly attribute PRUint32 type;
|
|
|
|
/**
|
|
* URL of the web page in question. Empty for all other types, including
|
|
* hosts.
|
|
*/
|
|
readonly attribute AUTF8String url;
|
|
|
|
/**
|
|
* ID of the folder corresponding to this node.
|
|
* Only valid for RESULT_TYPE_QUERY nodes where exactly one folder
|
|
* has been specified in the query. 0 in all other cases.
|
|
*/
|
|
readonly attribute PRInt64 folderId;
|
|
|
|
/**
|
|
* Type of the folder corresponding to this node.
|
|
* Only valid for RESULT_TYPE_QUERY nodes where exactly one folder
|
|
* has been specified in the query. 0 in all other cases.
|
|
*/
|
|
readonly attribute AString folderType;
|
|
|
|
/**
|
|
* Get the queries which build this node's children.
|
|
* Only valid for RESULT_TYPE_QUERY nodes.
|
|
*/
|
|
void getQueries(out unsigned long queryCount,
|
|
[retval,array,size_is(queryCount)] out nsINavHistoryQuery queries);
|
|
|
|
/**
|
|
* Get the options which group this node's children.
|
|
* Only valid for RESULT_TYPE_QUERY nodes.
|
|
*/
|
|
readonly attribute nsINavHistoryQueryOptions queryOptions;
|
|
|
|
/**
|
|
* Title of the web page, or of the node's grouping (day, host, folder, etc)
|
|
*/
|
|
readonly attribute AString title;
|
|
|
|
/**
|
|
* Total number of times the URL has ever been accessed. For hosts, this
|
|
* is the total of the children under it, NOT the total times the host has
|
|
* been accessed (this would require an additional query, so is not given
|
|
* by default when most of the time it is never needed).
|
|
*/
|
|
readonly attribute PRInt32 accessCount;
|
|
|
|
/**
|
|
* This is the time the user accessed the page.
|
|
*
|
|
* If this is a visit, it is the exact time that the page visit occurred.
|
|
*
|
|
* If this is a URL, it is the most recent time that the URL was visited.
|
|
* Even if you ask for all URLs for a given date range long ago, this might
|
|
* contain today's date if the URL was visited today.
|
|
*
|
|
* For hosts, or other node types with children, this is the most recent
|
|
* access time for any of the children.
|
|
*
|
|
* For days, this is midnight on the morning of the day in question in
|
|
* UTC time.
|
|
*/
|
|
readonly attribute PRTime time;
|
|
|
|
/**
|
|
* This URI can be used as an image source URL and will give you the favicon
|
|
* for the page. It is *not* the URL of the favicon, but rather something
|
|
* that will resolve to the actual image.
|
|
*
|
|
* In most cases, this is an annotation URI that will query the favicon
|
|
* service. If the entry has no favicon, this is the chrome URL of the
|
|
* default favicon. If the favicon originally lived in chrome, this will
|
|
* be the original chrome URI of the icon.
|
|
*/
|
|
readonly attribute nsIURI icon;
|
|
|
|
/**
|
|
* This is the number of levels between this node and the top of the
|
|
* hierarchy. The members of result.children have indentLevel = 0, their
|
|
* children have indentLevel = 1, etc.
|
|
*/
|
|
readonly attribute PRInt32 indentLevel;
|
|
|
|
/**
|
|
* This gives you the children of the nodes. It is preferrable to use this
|
|
* interface over the array one, since it avoids creating an nsIArray object
|
|
* and the interface is already the correct type.
|
|
*/
|
|
readonly attribute PRInt32 childCount;
|
|
nsINavHistoryResultNode getChild(in PRInt32 index);
|
|
|
|
/**
|
|
* Returns false if this node's list of children can be modified
|
|
* (adding or removing children, or reordering children), or true if
|
|
* the UI should not allow the list of children to be modified.
|
|
* This is false for bookmark folder nodes unless setFolderReadOnly() has
|
|
* been called to override it, and true for non-folder nodes.
|
|
*/
|
|
readonly attribute boolean childrenReadOnly;
|
|
};
|
|
|
|
|
|
/**
|
|
* Allows clients of the HistoryResult to define domain specific handling
|
|
* of specific nsITreeView methods that the HistoryResult does not implement.
|
|
*/
|
|
[scriptable, uuid(b34d5ca4-ce8e-49a6-9201-a59ae2128d2c)]
|
|
interface nsINavHistoryResultViewObserver : nsISupports
|
|
{
|
|
const long DROP_BEFORE = -1;
|
|
const long DROP_ON = 0;
|
|
const long DROP_AFTER = 1;
|
|
/**
|
|
* Methods used by the drag feedback code to determine if a drag is allowable at
|
|
* the current location. To get the behavior where drops are only allowed on
|
|
* items, such as the mailNews folder pane, always return false whe
|
|
* the orientation is not DROP_ON. Implementors should not change the content of
|
|
* the observer list!
|
|
*/
|
|
boolean canDrop(in long index, in long orientation);
|
|
|
|
/**
|
|
* Called when the user drops something on this view. The |orientation| param
|
|
* specifies before/on/after the given |row|.
|
|
*/
|
|
void onDrop(in long row, in long orientation);
|
|
|
|
/**
|
|
* Called when an item is opened or closed.
|
|
*/
|
|
void onToggleOpenState (in long index);
|
|
|
|
/**
|
|
* Called when a header is clicked.
|
|
*/
|
|
void onCycleHeader(in nsITreeColumn column);
|
|
|
|
/**
|
|
* Called when a cell in a non-selectable cycling column (e.g.
|
|
* unread/flag/etc.) is clicked.
|
|
*/
|
|
void onCycleCell(in long row, in nsITreeColumn column);
|
|
|
|
/**
|
|
* Called when selection in the tree changes
|
|
*/
|
|
void onSelectionChanged();
|
|
|
|
/**
|
|
* A command API that can be used to invoke commands on the selection.
|
|
* The tree will automatically invoke this method when certain keys
|
|
* are pressed. For example, when the DEL key is pressed, performAction
|
|
* will be called with the "delete" string.
|
|
*/
|
|
void onPerformAction(in wstring action);
|
|
|
|
/**
|
|
* A command API that can be used to invoke commands on a specific row.
|
|
*/
|
|
void onPerformActionOnRow(in wstring action, in long row);
|
|
|
|
/**
|
|
* A command API that can be used to invoke commands on a specific cell.
|
|
*/
|
|
void onPerformActionOnCell(in wstring action, in long row, in nsITreeColumn column);
|
|
};
|
|
|
|
|
|
/**
|
|
* The result of a history/bookmark query.
|
|
*
|
|
* This class is also a result "node". Use those interfaces to access the
|
|
* toplevel children of this result.
|
|
*/
|
|
|
|
[scriptable, uuid(25b45a94-3323-4c7b-910a-315f2c59bfb4)]
|
|
interface nsINavHistoryResult : nsINavHistoryResultNode
|
|
{
|
|
/**
|
|
* Sorts all nodes recursively by the given parameter, one of
|
|
* nsINavHistory.SORT_BY_*
|
|
*/
|
|
void recursiveSort(in PRUint32 aSortingMode);
|
|
|
|
/**
|
|
* Controls whether duplicate adjacent elements are collapsed into a single
|
|
* item in the tree. This prevents you from seeing multiple entries for
|
|
* things when you have selected to get visits. When you sort by date, the
|
|
* multiple entries will then appear because they will be separated (unless
|
|
* you clicked reload a bunch of times in a row). If you know you'll only
|
|
* ever want one entry per site, you should ask for URLs back instead of
|
|
* visits so it will be more efficient.
|
|
* Default = true
|
|
*/
|
|
attribute boolean collapseDuplicates;
|
|
|
|
/**
|
|
* Call these functions to expand or collapse all elements in the tree.
|
|
*/
|
|
void expandAll();
|
|
void collapseAll();
|
|
|
|
/**
|
|
* This allows you to get at the real node for a given row index in the tree.
|
|
*/
|
|
nsINavHistoryResultNode nodeForTreeIndex(in PRUint32 aIndex);
|
|
|
|
/**
|
|
* Reverse of nodeForTreeIndex, returns the row index for a given result node.
|
|
* Returns INDEX_INVISIBLE if the item is not visible (for example, its
|
|
* parent is collapsed).
|
|
*/
|
|
const PRUint32 INDEX_INVISIBLE = 0xffffffff;
|
|
PRUint32 treeIndexForNode(in nsINavHistoryResultNode aNode);
|
|
|
|
/**
|
|
* Add a Tree Builder Observer to handle Tree View methods that the
|
|
* HistoryResult object does not implement. If ownsWeak is false, then
|
|
* the result will hold a strong reference to the observer. If ownsWeak
|
|
* is true, then the observer must implement nsISupportsWeakReference, and
|
|
* the result will hold a weak reference to the observer.
|
|
*/
|
|
void addObserver(in nsINavHistoryResultViewObserver observer,
|
|
in boolean ownsWeak);
|
|
|
|
/**
|
|
* Remove a tree builder observer.
|
|
*/
|
|
void removeObserver(in nsINavHistoryResultViewObserver observer);
|
|
};
|
|
|
|
/**
|
|
* Similar to nsIRDFObserver for history. Note that we don't pass the data
|
|
* source since that is always the global history.
|
|
*
|
|
* DANGER! If you are in the middle of a batch transaction, there may be a
|
|
* database transaction active. You can still access the DB, but be careful.
|
|
*/
|
|
[scriptable, uuid(849e2184-3dee-416f-91cd-6a619ca49d1c)]
|
|
interface nsINavHistoryObserver : nsISupports
|
|
{
|
|
/**
|
|
* Notifies you that a bunch of things are about to change, don't do any
|
|
* heavy-duty processing until onEndUpdateBatch is called.
|
|
*/
|
|
void onBeginUpdateBatch();
|
|
|
|
/**
|
|
* Notifies you that we are done doing a bunch of things and you should go
|
|
* ahead and update UI, etc.
|
|
*/
|
|
void onEndUpdateBatch();
|
|
|
|
/**
|
|
* Called when a resource is visited. This is called the first time a
|
|
* resource (page, image, etc.) is seen as well as every subsequent time.
|
|
*
|
|
* Normally, transition types of TRANSITION_EMBED (corresponding to images in
|
|
* a page, for example) are not displayed in history results (unless
|
|
* includeHidden is set). Many observers can ignore _EMBED notifications
|
|
* (which will comprise the majority of visit notifications) to save work.
|
|
*
|
|
* @param aVisitID ID of the visit that was just created.
|
|
* @param aTime Time of the visit
|
|
* @param aSessionID The ID of one connected sequence of visits.
|
|
* @param aReferringID The ID of the visit the user came from. 0 if empty.
|
|
* @param aTransitionType One of nsINavHistory.TRANSITION_*
|
|
*/
|
|
void onVisit(in nsIURI aURI, in PRInt64 aVisitID, in PRTime aTime,
|
|
in PRInt64 aSessionID, in PRInt64 aReferringID,
|
|
in PRUint32 aTransitionType);
|
|
|
|
/**
|
|
* Called whenever either the "real" title or the custom title of the page
|
|
* changed. BOTH TITLES ARE ALWAYS INCLUDED in this notification, even though
|
|
* only one will change at a time. Often, consumers will want to display the
|
|
* user title if it is available, and fall back to the page title (the one
|
|
* specified in the <title> tag of the page).
|
|
*
|
|
* Note that there is a difference between an empty title and a NULL title.
|
|
* An empty string means that somebody specifically set the title to be
|
|
* nothing. NULL means nobody set it. From C++: use IsVoid() and SetIsVoid()
|
|
* to see whether an empty string is "null" or not (it will always be an
|
|
* empty string in either case).
|
|
*
|
|
* @param aUserTitleChanged Is true if the user title was the thing that was
|
|
* changed. If false, that means the "real" page
|
|
* title was changed instead.
|
|
*/
|
|
void onTitleChanged(in nsIURI aURI, in AString aPageTitle,
|
|
in AString aUserTitle, in PRBool aUserTitleChanged);
|
|
|
|
/**
|
|
* This page and all of its visits are being deleted. Note: the page may not
|
|
* necessarily have actually existed for this function to be called.
|
|
*
|
|
* Delete notifications are only 99.99% accurate. Batch delete operations
|
|
* must be done in two steps, so first come notifications, then a bulk
|
|
* delete. If there is some error in the middle (for example, out of memory)
|
|
* then you'll get a notification and it won't get deleted. There's no easy
|
|
* way around this.
|
|
*/
|
|
void onDeleteURI(in nsIURI aURI);
|
|
|
|
/**
|
|
* Notification that all of history is being deleted.
|
|
*/
|
|
void onClearHistory();
|
|
|
|
/**
|
|
* A page has had some attribute on it changed. Note that for TYPED and
|
|
* HIDDEN, the page may not necessarily have been added yet.
|
|
*/
|
|
const PRUint32 ATTRIBUTE_FAVICON = 3; // favicon updated, aString = favicon annotation URI
|
|
void onPageChanged(in nsIURI aURI, in PRUint32 aWhat, in AString aValue);
|
|
};
|
|
|
|
|
|
/**
|
|
* This object encapsulates all the query parameters you're likely to need
|
|
* when building up history UI. All parameters are ANDed together.
|
|
*
|
|
* This is not intended to be a super-general query mechanism. This was designed
|
|
* so that most queries can be done in only one SQL query. This is important
|
|
* because, if the user has their profile on a networked drive, query latency
|
|
* can be non-negligible.
|
|
*/
|
|
|
|
[scriptable, uuid(884819a6-1860-4a71-8fd7-89d962c1d984)]
|
|
interface nsINavHistoryQuery : nsISupports
|
|
{
|
|
/**
|
|
* Time range for results (INCLUSIVE). The *TimeReference is one of the
|
|
* constants TIME_RELATIVE_* which indicates how to interpret the
|
|
* corresponding time value.
|
|
* TIME_RELATIVE_EPOCH (default):
|
|
* The time is relative to Jan 1 1970 GMT, (this is a normal PRTime)
|
|
* TIME_RELATIVE_TODAY:
|
|
* The time is relative to this morning at midnight. Normally used for
|
|
* queries relative to today. For example, a "past week" query would be
|
|
* today-6 days -> today+1 day
|
|
* TIME_RELATIVE_NOW:
|
|
* The time is relative to right now.
|
|
*
|
|
* Note: PRTime is in MICROseconds since 1 Jan 1970. Javascript date objects
|
|
* are expressed in MILLIseconds since 1 Jan 1970.
|
|
*
|
|
* As a special case, a 0 time relative to TIME_RELATIVE_EPOCH indicates that
|
|
* the time is not part of the query. This is the default, so an empty query
|
|
* will match any time. The has* functions return whether the corresponding
|
|
* time is considered.
|
|
*/
|
|
const PRUint32 TIME_RELATIVE_EPOCH = 0;
|
|
const PRUint32 TIME_RELATIVE_TODAY = 1;
|
|
const PRUint32 TIME_RELATIVE_NOW = 2;
|
|
|
|
attribute PRTime beginTime;
|
|
attribute PRUint32 beginTimeReference;
|
|
readonly attribute boolean hasBeginTime;
|
|
|
|
attribute PRTime endTime;
|
|
attribute PRUint32 endTimeReference;
|
|
readonly attribute boolean hasEndTime;
|
|
|
|
/**
|
|
* Text search terms.
|
|
*/
|
|
attribute AString searchTerms;
|
|
readonly attribute boolean hasSearchTerms;
|
|
|
|
/**
|
|
* When set, returns only bookmarked items, when unset, returns anything.
|
|
*/
|
|
attribute boolean onlyBookmarked;
|
|
|
|
/**
|
|
* This controls the meaning of 'domain', and whether it is an exact match
|
|
* 'domainIsHost' = true, or hierarchical (= false).
|
|
*/
|
|
attribute boolean domainIsHost;
|
|
|
|
/**
|
|
* This is the host or domain name (controlled by domainIsHost). When
|
|
* domainIsHost, domain only does exact matching on host names. Otherwise,
|
|
* it will return anything whose host name ends in 'domain'.
|
|
*
|
|
* This one is a little different than most. Setting it to an empty string
|
|
* is a real query and will match any URI that has no host name (local files
|
|
* and such). Set this to NULL (in C++ use SetIsVoid) if you don't want
|
|
* domain matching.
|
|
*/
|
|
attribute AUTF8String domain;
|
|
readonly attribute boolean hasDomain;
|
|
|
|
/**
|
|
* Controls the interpretation of 'uri'. When unset (default), the URI will
|
|
* request an exact match of the specified URI. When set, any history entry
|
|
* beginning in 'uri' will match. For example "http://bar.com/foo" will match
|
|
* "http://bar.com/foo" as well as "http://bar.com/foo/baz.gif".
|
|
*/
|
|
attribute boolean uriIsPrefix;
|
|
|
|
/**
|
|
* This is a URI to match, to, for example, find out every time you visited
|
|
* a given URI. Use uriIsPrefix to control whether this is an exact match.
|
|
*/
|
|
attribute nsIURI uri;
|
|
readonly attribute boolean hasUri;
|
|
|
|
/**
|
|
* Limit results to items that are in all of the given folders.
|
|
*/
|
|
void getFolders(out PRUint32 count,
|
|
[retval,array,size_is(count)] out PRInt64 folders);
|
|
readonly attribute PRUint32 folderCount;
|
|
|
|
void setFolders([const,array, size_is(folderCount)] in PRInt64 folders,
|
|
in PRUint32 folderCount);
|
|
|
|
/**
|
|
* Constants for itemTypes
|
|
*/
|
|
const PRUint32 INCLUDE_ITEMS = 1;
|
|
const PRUint32 INCLUDE_QUERIES = 2;
|
|
|
|
/**
|
|
* Filter the items returned. Takes a bitwise combination of INCLUDE_*
|
|
* constants. Note that folders are only returned when a parent folder
|
|
* is specified with setFolders().
|
|
*/
|
|
attribute PRUint32 itemTypes;
|
|
|
|
/**
|
|
* Creates a new query item with the same parameters of this one.
|
|
*/
|
|
nsINavHistoryQuery clone();
|
|
};
|
|
|
|
/**
|
|
* This object represents the global options for executing a query.
|
|
*/
|
|
[scriptable, uuid(25fd4de4-33b0-475e-a63d-2bcb1d123e0d)]
|
|
interface nsINavHistoryQueryOptions : nsISupports
|
|
{
|
|
/**
|
|
* Grouping by day. The results will be an array of nsINavHistoryResults with
|
|
* type = RESULT_TYPE_DAY, one for each day where there are results. These
|
|
* will have children of corresponding to the search results of that day.
|
|
*/
|
|
const PRUint32 GROUP_BY_DAY = 0;
|
|
|
|
/**
|
|
* Groping by exact host. The results will be an array of nsINavHistoryResults
|
|
* with type = RESULT_TYPE_HOST, one for each unique host (for example,
|
|
* "bugzilla.mozilla.org" and "www.mozilla.org" will be separate). The
|
|
* children of these will correspond to the results for each host.
|
|
*/
|
|
const PRUint32 GROUP_BY_HOST = 1;
|
|
|
|
/**
|
|
* Grouping by toplevel domain. Similar to GROUP_BY_HOST, but there will be
|
|
* one result for each toplevel domain (mozilla.org will be one entry, and
|
|
* will contain results including, for example, "bugzilla.mozilla.org" and
|
|
* "www.mozilla.org").
|
|
*/
|
|
const PRUint32 GROUP_BY_DOMAIN = 2;
|
|
|
|
/**
|
|
* Group by bookmark folder. Since this determines the entire subtree
|
|
* hierarchy, it must be the last grouping option given. This option
|
|
* requires the query to have onlyBookmarked set, and for there to be
|
|
* at least one parent folder specified via nsINavHistoryQuery::setFolders.
|
|
* If all of the top-level results belong to a single folder, the folder will
|
|
* be omitted and its children will become the toplevel result nodes.
|
|
*/
|
|
const PRUint32 GROUP_BY_FOLDER = 3;
|
|
|
|
/**
|
|
* You can ask for the results to be pre-sorted. Since the DB has indices
|
|
* of many items, it can produce sorted results almost for free. These should
|
|
* be self-explanatory.
|
|
*
|
|
* Note: re-sorting is slower, as is sorting by title or when you have a
|
|
* host name.
|
|
*/
|
|
const PRUint32 SORT_BY_NONE = 0;
|
|
const PRUint32 SORT_BY_TITLE_ASCENDING = 1;
|
|
const PRUint32 SORT_BY_TITLE_DESCENDING = 2;
|
|
const PRUint32 SORT_BY_DATE_ASCENDING = 3;
|
|
const PRUint32 SORT_BY_DATE_DESCENDING = 4;
|
|
const PRUint32 SORT_BY_URL_ASCENDING = 5;
|
|
const PRUint32 SORT_BY_URL_DESCENDING = 6;
|
|
const PRUint32 SORT_BY_VISITCOUNT_ASCENDING = 7;
|
|
const PRUint32 SORT_BY_VISITCOUNT_DESCENDING = 8;
|
|
|
|
/**
|
|
* "URL" results, one for each URL visited in the range.
|
|
*/
|
|
const PRUint32 RESULT_TYPE_URL = 0;
|
|
|
|
/**
|
|
* "Visit" results, with one for each time a page was visited
|
|
* (this will often give you multiple results for one URL).
|
|
*/
|
|
const PRUint32 RESULT_TYPE_VISIT = 1;
|
|
|
|
/**
|
|
* The grouping mode to be used for this query.
|
|
* Grouping mode is an array of GROUP_BY_* values that specifies the structure
|
|
* of the tree you want. For example, an array consisting of
|
|
* [GROUP_BY_DAY, GROUP_BY_DOMAIN] will give you a tree whose first level is
|
|
* a list of days, and whose second level is a list of domains, and whose
|
|
* third level is a list of pages in those domains. If you don't want a tree,
|
|
* you can specify an empty array.
|
|
*/
|
|
void getGroupingMode(out PRUint32 groupCount,
|
|
[retval,array,size_is(groupCount)] out PRUint32 groupingMode);
|
|
void setGroupingMode([const,array,size_is(groupCount)] in PRUint32 groupingMode,
|
|
in PRUint32 groupCount);
|
|
|
|
/**
|
|
* The sorting mode to be used for this query.
|
|
* mode is one of SORT_BY_*
|
|
*/
|
|
attribute PRUint32 sortingMode;
|
|
|
|
/**
|
|
* Sets the result type. One of RESULT_TYPE_*.
|
|
*/
|
|
attribute PRUint32 resultType;
|
|
|
|
/**
|
|
* When set, allows items with "place:" URIs to appear as containers,
|
|
* with the container's contents filled in from the stored query.
|
|
* If not set, these will appear as normal items.
|
|
*/
|
|
attribute boolean expandPlaces;
|
|
|
|
/**
|
|
* Normally the title of a result will be the user's custom title if there is
|
|
* one, falling back on the default page title. If this is set, we will not
|
|
* do this operation and always use the original page title extracted from
|
|
* the HTML of the page.
|
|
*/
|
|
attribute boolean forceOriginalTitle;
|
|
|
|
/**
|
|
* Most items in history are marked "hidden." Only toplevel pages that the
|
|
* user sees in the URL bar are not hidden. Hidden things include the content
|
|
* of iframes and all images on web pages. Normally, you don't want these
|
|
* things. If you do, set this flag and you'll get all items, even hidden
|
|
* ones.
|
|
*/
|
|
attribute boolean includeHidden;
|
|
|
|
/**
|
|
* This is the maximum number of results that you want. The query is exeucted,
|
|
* the results are sorted, and then the top 'maxResults' results are taken
|
|
* and returned. Set to 0 (the default) to get all results.
|
|
*
|
|
* THIS DOES NOT WORK IN CONJUNCTION WITH SORTING BY TITLE. This is because
|
|
* sorting by title requires us to sort after using locale-sensetive sorting
|
|
* (as opposed to letting the database do it for us).
|
|
*
|
|
* Instead, we get the result ordered by date, pick the maxResult most recent
|
|
* ones, and THEN sort by title.
|
|
*/
|
|
attribute PRUint32 maxResults;
|
|
|
|
/**
|
|
* Creates a new options item with the same parameters of this one.
|
|
*/
|
|
nsINavHistoryQueryOptions clone();
|
|
};
|
|
|
|
[scriptable, uuid(C51F54CB-5E89-4B20-A37C-1343888935B7)]
|
|
interface nsINavHistoryService : nsISupports
|
|
{
|
|
/**
|
|
* This transition type means the user follwed a link and got a new toplevel
|
|
* window. It is not true when
|
|
*/
|
|
const PRUint32 TRANSITION_LINK = 1;
|
|
|
|
/**
|
|
* This transition type means that the user typed the page's URL in the
|
|
* URL bar.
|
|
*/
|
|
const PRUint32 TRANSITION_TYPED = 2;
|
|
|
|
/**
|
|
* This transition is set when the user followed a bookmark to get to the
|
|
* page.
|
|
*/
|
|
const PRUint32 TRANSITION_BOOKMARK = 3;
|
|
|
|
/**
|
|
* This transition type is set when some inner content is loaded. This is
|
|
* true of all images on a page, and the contents of the iframe. It is also
|
|
* true of any content in a frame, regardless if whether or not the user
|
|
* clicked something to get there.
|
|
*/
|
|
const PRUint32 TRANSITION_EMBED = 4;
|
|
|
|
/**
|
|
* 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 attribute boolean hasHistoryEntries;
|
|
|
|
/**
|
|
* This sets the user-defined title of the page. Silently fails if we have
|
|
* no knowledge of this page. Set to empty string to clear the user title and
|
|
* only use the "real" title as declared on the page.
|
|
*/
|
|
void setPageUserTitle(in nsIURI aURI, in AString aUserTitle);
|
|
|
|
/**
|
|
* This is just like markPageAsTyped (in nsIBrowserHistory, also implemented
|
|
* by the history service), but for bookmarks. It declares that the given URL
|
|
* is being opened as a result of following a bookmark. If this URL is loaded
|
|
* soon after this message has been received, that transition will be marked
|
|
* as following a bookmark.
|
|
*/
|
|
void markPageAsFollowedBookmark(in nsIURI aURI);
|
|
|
|
/**
|
|
* 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).
|
|
*/
|
|
boolean canAddURI(in nsIURI aURI);
|
|
|
|
/**
|
|
* 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.
|
|
*
|
|
* @param aURI Page to add/change.
|
|
* @param aTitle Title as specified by the page.
|
|
* @param aUserTitle Custom title provided by user. Set to NULL if none.
|
|
* @param aVisitCount Number of times this page has been visited. Setting this
|
|
* to 0 may make the page invisible in some views.
|
|
* @param aHidden Whether the page is hidden. If the page has only
|
|
* TRANSITION_EMBED visits, this will be true, otherwise
|
|
* false.
|
|
* @param aTyped True if this URL has ever been typed.
|
|
*/
|
|
void setPageDetails(in nsIURI aURI, in AString aTitle, in AString aUserTitle,
|
|
in PRUint32 aVisitCount, in boolean aHidden,
|
|
in boolean aTyped);
|
|
|
|
/**
|
|
* 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.
|
|
*
|
|
* @param aURI Visited page
|
|
* @param aTime Time page was visited (microseconds)
|
|
* @param aReferrer The ID of the visit that generated this one. Use 0
|
|
* for no referrer. This must be a valid visit already
|
|
* in the DB or 0.
|
|
* @param aTranstitionType Type of transition: one of TRANSITION_* above
|
|
* @param aSession The session ID that this page belongs to. Use 0 for
|
|
* no session.
|
|
* @returns The ID of the created visit
|
|
*/
|
|
PRInt64 addVisit(in nsIURI aURI, in PRTime aTime, in PRInt64 aReferrer,
|
|
in PRInt32 aTransitionType, in PRInt64 aSession);
|
|
|
|
/**
|
|
* 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).
|
|
*/
|
|
nsINavHistoryQuery getNewQuery();
|
|
|
|
/**
|
|
* This returns a new options object that you can pass to executeQuer[y/ies]
|
|
* after setting the desired options.
|
|
*/
|
|
nsINavHistoryQueryOptions getNewQueryOptions();
|
|
|
|
/**
|
|
* Executes a single query.
|
|
*/
|
|
nsINavHistoryResult executeQuery(in nsINavHistoryQuery aQuery,
|
|
in 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()
|
|
*/
|
|
nsINavHistoryResult executeQueries(
|
|
[array,size_is(aQueryCount)] in nsINavHistoryQuery aQueries, in PRUint32 aQueryCount,
|
|
in nsINavHistoryQueryOptions options);
|
|
|
|
/**
|
|
* Converts a query URI-like string to an array of actual query objects for
|
|
* use to executeQueries().
|
|
*/
|
|
void queryStringToQueries(in AUTF8String aQueryString,
|
|
[array, size_is(aResultCount)] out nsINavHistoryQuery aQueries, out PRUint32 aResultCount,
|
|
out nsINavHistoryQueryOptions options);
|
|
|
|
/**
|
|
* Converts a query into an equivalent string that can be persisted. Inverse
|
|
* of queryStringToQueries()
|
|
*/
|
|
AUTF8String queriesToQueryString(
|
|
[array, size_is(aQueryCount)] in nsINavHistoryQuery aQueries, in PRUint32 aQueryCount,
|
|
in nsINavHistoryQueryOptions options);
|
|
|
|
/**
|
|
* Adds a history observer. If ownsWeak is false, the history service will
|
|
* keep an owning reference to the observer. If ownsWeak is true, then
|
|
* aObserver must implement nsISupportsWeakReference, and the history service
|
|
* will keep a weak reference to the observer.
|
|
*/
|
|
void addObserver(in nsINavHistoryObserver observer, in boolean ownsWeak);
|
|
|
|
/**
|
|
* Removes a history observer.
|
|
*/
|
|
void removeObserver(in nsINavHistoryObserver observer);
|
|
|
|
/**
|
|
* Causes observers to be notified of a beginUpdateBatch when a lot of things
|
|
* are about to change. Calls can be nested, observers will only be
|
|
* notified when all batches begin/end.
|
|
*/
|
|
void beginUpdateBatch();
|
|
|
|
/**
|
|
* Causes observers to be notified of an endUpdateBatch when a batch is
|
|
* done changing. Should match beginUpdateBatch or bad things will happen.
|
|
*/
|
|
void endUpdateBatch();
|
|
|
|
/**
|
|
* The Transaction Manager for edit operations performed on History and
|
|
* Bookmark items.
|
|
*/
|
|
readonly attribute nsITransactionManager transactionManager;
|
|
};
|
|
|
|
/**
|
|
* nsIMorkHistoryImporter is a service which handles importing old
|
|
* history files.
|
|
*/
|
|
[scriptable, uuid(be935aed-6929-4e44-be29-17ec89e5c8bd)]
|
|
interface nsIMorkHistoryImporter : nsISupports
|
|
{
|
|
/**
|
|
* Import the given Mork history file.
|
|
* @param file The Mork history file to import
|
|
* @param history A reference to the nsINavHistoryService. This is
|
|
* supplied since the importer is invoked during
|
|
* history service initialization.
|
|
*/
|
|
void importHistory(in nsIFile file, in nsINavHistoryService history);
|
|
};
|