Bug 320422 r=annie.sullivan: Rename nav-history/nsINavHistory to nav-history-service/nsINavHistoryService

This commit is contained in:
brettw%gmail.com 2005-12-16 00:40:48 +00:00
parent f80210c06e
commit a36360cfa0
12 changed files with 25 additions and 721 deletions

View File

@ -82,11 +82,11 @@
#define NS_RDF_FORWARDPROXY_INFER_DATASOURCE_CID \
{ 0x7a024bcf, 0xedd5, 0x4d9a, { 0x86, 0x14, 0xd4, 0x4b, 0xe1, 0xda, 0xda, 0xd3 } }
#define NS_NAVHISTORY_CID \
#define NS_NAVHISTORYSERVICE_CID \
{ 0x88cecbb7, 0x6c63, 0x4b3b, { 0x8c, 0xd4, 0x84, 0xf3, 0xb8, 0x22, 0x8c, 0x69 } }
#define NS_NAVHISTORY_CONTRACTID \
"@mozilla.org/browser/nav-history;1"
#define NS_NAVHISTORYSERVICE_CONTRACTID \
"@mozilla.org/browser/nav-history-service;1"
#define NS_ANNOTATIONSERVICE_CID \
{ 0x5e8d4751, 0x1852, 0x434b, { 0xa9, 0x92, 0x2c, 0x6d, 0x2a, 0x25, 0xfa, 0x46 } }

View File

@ -134,17 +134,17 @@ static const nsModuleComponentInfo components[] =
#if defined(MOZ_PLACES)
{ "Browser Navigation History",
NS_NAVHISTORY_CID,
NS_NAVHISTORY_CONTRACTID,
NS_NAVHISTORYSERVICE_CID,
NS_NAVHISTORYSERVICE_CONTRACTID,
nsNavHistoryConstructor },
{ "Browser Navigation History",
NS_NAVHISTORY_CID,
NS_NAVHISTORYSERVICE_CID,
"@mozilla.org/browser/global-history;2",
nsNavHistoryConstructor },
{ "Browser Navigation History",
NS_NAVHISTORY_CID,
NS_NAVHISTORYSERVICE_CID,
"@mozilla.org/autocomplete/search;1?name=history",
nsNavHistoryConstructor },

View File

@ -228,7 +228,7 @@ var PlacesController = {
get _hist() {
if (!this.__hist) {
this.__hist =
Cc["@mozilla.org/browser/nav-history;1"].getService(Ci.nsINavHistory);
Cc["@mozilla.org/browser/nav-history-service;1"].getService(Ci.nsINavHistoryService);
}
return this.__hist;
},
@ -772,7 +772,7 @@ var PlacesController = {
this._hist.transactionManager.doTransaction(txn);
} else {
// delete history items: these are unfortunately not undoable.
var hist = Cc["@mozilla.org/browser/nav-history;1"].
var hist = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsIBrowserHistory);
for (var i = 0; i < nodes.length; ++i) {
var node = nodes[i];

View File

@ -11,8 +11,8 @@
<implementation>
<constructor><![CDATA[
this._places =
Cc["@mozilla.org/browser/nav-history;1"].
getService(Ci.nsINavHistory);
Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
this._bms =
Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);

View File

@ -10,8 +10,8 @@
<implementation>
<constructor><![CDATA[
this._places =
Cc["@mozilla.org/browser/nav-history;1"].
getService(Ci.nsINavHistory);
Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
this._bms =
Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);

View File

@ -10,8 +10,8 @@
<implementation implements="nsINavHistoryResultViewObserver">
<constructor><![CDATA[
this._places =
Cc["@mozilla.org/browser/nav-history;1"].
getService(Ci.nsINavHistory);
Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
// Let's all do the happy QI/IRQ dance.
// Go from window->docshell->window.
@ -131,7 +131,7 @@
var queries = result.getQueries({ });
var options = result.queryOptions;
const NH = Ci.nsINavHistory;
const NH = Ci.nsINavHistoryService;
return this._places.queriesToQueryString(queries, queries.length,
options);
]]></getter>

View File

@ -49,11 +49,10 @@ XPIDL_MODULE = places
XPIDLSRCS = \
nsIAnnotationService.idl \
nsIFaviconService.idl \
nsINavHistory.idl \
nsINavHistoryService.idl \
nsINavBookmarksService.idl \
nsIBookmarksContainer.idl \
nsILivemarkService.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -1,695 +0,0 @@
/* -*- 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;
[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 the day appears when time columns are requested
* through the tree interface. True is the default, meaning the date is shown
*/
attribute boolean timesIncludeDates;
/**
* 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();
/**
* True requests that you want to get called for all updates, false if you
* don't necessarily care about which exact things changed during a batch
* update. If false, this will sometimes not call you for things in between
* onBeginUpdateBatch and onEndUpdateBatch. You'll still get the begin and
* end, so you'll know something changed.
*
* Lots of observers don't care about what changes, only that something
* changed so they can update their UI. This allows delete operations to
* avoid iterating over every item, and just doing a single bulk SQL DELETE
* command, which is much more efficient.
*
* Note that you still might get called if you say false in some situations.
* This only skips certain time-consuming notifications if NO observers
* want the information.
*/
readonly attribute boolean wantAllDetails;
/**
* A page has been added that was visited at a given time. It's very possible
* that this page already existed in history, but was just visited again.
* Note that adding a page can (but doesn't always) make the page unhidden.
* This happens implicitly and you won't get a separate change notification.
*/
void onAddURI(in nsIURI aURI, in PRTime aTime);
/**
* 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_TITLE = 0; // aString = new title
const PRUint32 ATTRIBUTE_HIDDEN = 1; // aString = empty
const PRUint32 ATTRIBUTE_TYPED = 2; // aString = empty
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'. Empty string
* means ignore.
*/
attribute AString domain;
readonly attribute boolean hasDomain;
/**
* 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 PRInt32 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 PRInt32 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 PRInt32 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 PRInt32 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 PRInt32 SORT_BY_NONE = 0;
const PRInt32 SORT_BY_TITLE_ASCENDING = 1;
const PRInt32 SORT_BY_TITLE_DESCENDING = 2;
const PRInt32 SORT_BY_DATE_ASCENDING = 3;
const PRInt32 SORT_BY_DATE_DESCENDING = 4;
const PRInt32 SORT_BY_URL_ASCENDING = 5;
const PRInt32 SORT_BY_URL_DESCENDING = 6;
const PRInt32 SORT_BY_VISITCOUNT_ASCENDING = 7;
const PRInt32 SORT_BY_VISITCOUNT_DESCENDING = 8;
/**
* "URL" results, one for each URL visited in the range.
*/
const PRInt32 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 PRInt32 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 PRInt32 groupingMode);
void setGroupingMode([const,array,size_is(groupCount)] in PRInt32 groupingMode,
in PRUint32 groupCount);
/**
* The sorting mode to be used for this query.
* mode is one of SORT_BY_*
*/
attribute PRInt32 sortingMode;
/**
* Sets the result type. One of RESULT_TYPE_*.
*/
attribute PRInt32 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;
/**
* Creates a new options item with the same parameters of this one.
*/
nsINavHistoryQueryOptions clone();
};
[scriptable, uuid(C51F54CB-5E89-4B20-A37C-1343888935B7)]
interface nsINavHistory : nsISupports
{
/**
* 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.
*/
void setPageUserTitle(in nsIURI aURI, in AString aUserTitle);
/**
* 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);
/**
* 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;
};

View File

@ -593,7 +593,7 @@ interface nsINavHistoryQueryOptions : nsISupports
};
[scriptable, uuid(C51F54CB-5E89-4B20-A37C-1343888935B7)]
interface nsINavHistory : nsISupports
interface nsINavHistoryService : nsISupports
{
/**
* True if there is any history. This can be used in UI to determine whether

View File

@ -222,7 +222,7 @@ public:
protected:
nsCOMPtr<nsINavBookmarksService> mBookmarksService;
nsCOMPtr<nsINavHistory> mHistoryService;
nsCOMPtr<nsINavHistoryService> mHistoryService;
nsCOMPtr<nsIAnnotationService> mAnnotationService;
// if set, we will move root items to where we find them. This should be
@ -269,7 +269,7 @@ BookmarkContentSink::Init(PRBool aAllowRootChanges,
{
nsresult rv;
mBookmarksService = bookmarkService;
mHistoryService = do_GetService(NS_NAVHISTORY_CONTRACTID, &rv);
mHistoryService = do_GetService(NS_NAVHISTORYSERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
mAnnotationService = do_GetService(NS_ANNOTATIONSERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -123,7 +123,7 @@ Extra:
#define HISTORY_EXPIRE_NOW_TIMEOUT (3 * PR_MSEC_PER_SEC)
NS_IMPL_ISUPPORTS6(nsNavHistory,
nsINavHistory,
nsINavHistoryService,
nsIGlobalHistory2,
nsIBrowserHistory,
nsIObserver,

View File

@ -48,7 +48,7 @@
#include "nsCOMPtr.h"
#include "nsDataHashtable.h"
#include "nsIAtom.h"
#include "nsINavHistory.h"
#include "nsINavHistoryService.h"
#include "nsIAutoCompleteSearch.h"
#include "nsIAutoCompleteResult.h"
#include "nsIAutoCompleteResultTypes.h"
@ -440,7 +440,7 @@ class AutoCompleteIntermediateResultSet;
// nsNavHistory
class nsNavHistory : public nsSupportsWeakReference,
public nsINavHistory,
public nsINavHistoryService,
public nsIObserver,
public nsIBrowserHistory,
public nsIAutoCompleteSearch
@ -451,7 +451,7 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSINAVHISTORY
NS_DECL_NSINAVHISTORYSERVICE
NS_DECL_NSIGLOBALHISTORY2
NS_DECL_NSIBROWSERHISTORY
NS_DECL_NSIOBSERVER
@ -468,7 +468,7 @@ public:
{
if (! gHistoryService) {
nsresult rv;
nsCOMPtr<nsINavHistory> serv(do_GetService("@mozilla.org/browser/nav-history;1", &rv));
nsCOMPtr<nsINavHistoryService> serv(do_GetService("@mozilla.org/browser/nav-history-service;1", &rv));
NS_ENSURE_SUCCESS(rv, nsnull);
// our constructor should have set the static variable. If it didn't,