michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIURI; michael@0: interface nsIVariant; michael@0: michael@0: [scriptable, uuid(41e4ccc9-f0c8-4cd7-9753-7a38514b8488)] michael@0: interface mozIVisitInfo : nsISupports michael@0: { michael@0: /** michael@0: * The machine-local (internal) id of the visit. michael@0: */ michael@0: readonly attribute long long visitId; michael@0: michael@0: /** michael@0: * The time the visit occurred. michael@0: */ michael@0: readonly attribute PRTime visitDate; michael@0: michael@0: /** michael@0: * The transition type used to get to this visit. One of the TRANSITION_TYPE michael@0: * constants on nsINavHistory. michael@0: * michael@0: * @see nsINavHistory.idl michael@0: */ michael@0: readonly attribute unsigned long transitionType; michael@0: michael@0: /** michael@0: * The referring URI of this visit. This may be null. michael@0: */ michael@0: readonly attribute nsIURI referrerURI; michael@0: }; michael@0: michael@0: [scriptable, uuid(ad83e137-c92a-4b7b-b67e-0a318811f91e)] michael@0: interface mozIPlaceInfo : nsISupports michael@0: { michael@0: /** michael@0: * The machine-local (internal) id of the place. michael@0: */ michael@0: readonly attribute long long placeId; michael@0: michael@0: /** michael@0: * The globally unique id of the place. michael@0: */ michael@0: readonly attribute ACString guid; michael@0: michael@0: /** michael@0: * The URI of the place. michael@0: */ michael@0: readonly attribute nsIURI uri; michael@0: michael@0: /** michael@0: * The title associated with the place. michael@0: */ michael@0: readonly attribute AString title; michael@0: michael@0: /** michael@0: * The frecency of the place. michael@0: */ michael@0: readonly attribute long long frecency; michael@0: michael@0: /** michael@0: * An array of mozIVisitInfo objects for the place. michael@0: */ michael@0: [implicit_jscontext] michael@0: readonly attribute jsval visits; michael@0: }; michael@0: michael@0: /** michael@0: * Shared Callback interface for mozIAsyncHistory methods. The semantics michael@0: * for each method are detailed in mozIAsyncHistory. michael@0: */ michael@0: [scriptable, uuid(1f266877-2859-418b-a11b-ec3ae4f4f93d)] michael@0: interface mozIVisitInfoCallback : nsISupports michael@0: { michael@0: /** michael@0: * Called when the given place could not be processed. michael@0: * michael@0: * @param aResultCode michael@0: * nsresult indicating the failure reason. michael@0: * @param aPlaceInfo michael@0: * The information that was given to the caller for the place. michael@0: */ michael@0: void handleError(in nsresult aResultCode, michael@0: in mozIPlaceInfo aPlaceInfo); michael@0: michael@0: /** michael@0: * Called for each place processed successfully. michael@0: * michael@0: * @param aPlaceInfo michael@0: * The current info stored for the place. michael@0: */ michael@0: void handleResult(in mozIPlaceInfo aPlaceInfo); michael@0: michael@0: /** michael@0: * Called when all records were processed. michael@0: */ michael@0: void handleCompletion(); michael@0: michael@0: }; michael@0: michael@0: [scriptable, function, uuid(994092bf-936f-449b-8dd6-0941e024360d)] michael@0: interface mozIVisitedStatusCallback : nsISupports michael@0: { michael@0: /** michael@0: * Notifies whether a certain URI has been visited. michael@0: * michael@0: * @param aURI michael@0: * URI being notified about. michael@0: * @param aVisitedStatus michael@0: * The visited status of aURI. michael@0: */ michael@0: void isVisited(in nsIURI aURI, michael@0: in boolean aVisitedStatus); michael@0: }; michael@0: michael@0: [scriptable, uuid(1643EFD2-A329-4733-A39D-17069C8D3B2D)] michael@0: interface mozIAsyncHistory : nsISupports michael@0: { michael@0: /** michael@0: * Gets the available information for the given array of places, each michael@0: * identified by either nsIURI or places GUID (string). michael@0: * michael@0: * The retrieved places info objects DO NOT include the visits data (the michael@0: * |visits| attribute is set to null). michael@0: * michael@0: * If a given place does not exist in the database, aCallback.handleError is michael@0: * called for it with NS_ERROR_NOT_AVAILABLE result code. michael@0: * michael@0: * @param aPlaceIdentifiers michael@0: * The place[s] for which to retrieve information, identified by either michael@0: * a single place GUID, a single URI, or a JS array of URIs and/or GUIDs. michael@0: * @param aCallback michael@0: * A mozIVisitInfoCallback object which consists of callbacks to be michael@0: * notified for successful or failed retrievals. michael@0: * If there's no information available for a given place, aCallback michael@0: * is called with a stub place info object, containing just the provided michael@0: * data (GUID or URI). michael@0: * michael@0: * @throws NS_ERROR_INVALID_ARG michael@0: * - Passing in NULL for aPlaceIdentifiers or aCallback. michael@0: * - Not providing at least one valid GUID or URI. michael@0: */ michael@0: [implicit_jscontext] michael@0: void getPlacesInfo(in jsval aPlaceIdentifiers, michael@0: in mozIVisitInfoCallback aCallback); michael@0: michael@0: /** michael@0: * Adds a set of visits for one or more mozIPlaceInfo objects, and updates michael@0: * each mozIPlaceInfo's title or guid. michael@0: * michael@0: * aCallback.handleResult is called for each visit added. michael@0: * michael@0: * @param aPlaceInfo michael@0: * The mozIPlaceInfo object[s] containing the information to store or michael@0: * update. This can be a single object, or an array of objects. michael@0: * @param [optional] aCallback michael@0: * A mozIVisitInfoCallback object which consists of callbacks to be michael@0: * notified for successful and/or failed changes. michael@0: * michael@0: * @throws NS_ERROR_INVALID_ARG michael@0: * - Passing in NULL for aPlaceInfo. michael@0: * - Not providing at least one valid guid, or uri for all michael@0: * mozIPlaceInfo object[s]. michael@0: * - Not providing an array or nothing for the visits property of michael@0: * mozIPlaceInfo. michael@0: * - Not providing a visitDate and transitionType for each michael@0: * mozIVisitInfo. michael@0: * - Providing an invalid transitionType for a mozIVisitInfo. michael@0: */ michael@0: [implicit_jscontext] michael@0: void updatePlaces(in jsval aPlaceInfo, michael@0: [optional] in mozIVisitInfoCallback aCallback); michael@0: michael@0: /** michael@0: * Checks if a given URI has been visited. michael@0: * michael@0: * @param aURI michael@0: * The URI to check for. michael@0: * @param aCallback michael@0: * A mozIVisitStatusCallback object which receives the visited status. michael@0: */ michael@0: void isURIVisited(in nsIURI aURI, michael@0: in mozIVisitedStatusCallback aCallback); michael@0: };