Source code

Revision control

Other Tools

1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
* License, v. 2.0. If a copy of the MPL was not distributed with this
3
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5
#include "nsISupports.idl"
6
7
interface nsIURI;
8
interface nsIVariant;
9
10
[scriptable, uuid(41e4ccc9-f0c8-4cd7-9753-7a38514b8488)]
11
interface mozIVisitInfo : nsISupports
12
{
13
/**
14
* The machine-local (internal) id of the visit.
15
*/
16
readonly attribute long long visitId;
17
18
/**
19
* The time the visit occurred.
20
*/
21
readonly attribute PRTime visitDate;
22
23
/**
24
* The transition type used to get to this visit. One of the TRANSITION_TYPE
25
* constants on nsINavHistory.
26
*
27
* @see nsINavHistory.idl
28
*/
29
readonly attribute unsigned long transitionType;
30
31
/**
32
* The referring URI of this visit. This may be null.
33
*/
34
readonly attribute nsIURI referrerURI;
35
};
36
37
[scriptable, uuid(ad83e137-c92a-4b7b-b67e-0a318811f91e)]
38
interface mozIPlaceInfo : nsISupports
39
{
40
/**
41
* The machine-local (internal) id of the place.
42
*/
43
readonly attribute long long placeId;
44
45
/**
46
* The globally unique id of the place.
47
*/
48
readonly attribute ACString guid;
49
50
/**
51
* The URI of the place.
52
*/
53
readonly attribute nsIURI uri;
54
55
/**
56
* The title associated with the place.
57
*/
58
readonly attribute AString title;
59
60
/**
61
* The frecency of the place.
62
*/
63
readonly attribute long long frecency;
64
65
/**
66
* An array of mozIVisitInfo objects for the place.
67
*/
68
[implicit_jscontext]
69
readonly attribute jsval visits;
70
};
71
72
/**
73
* Shared Callback interface for mozIAsyncHistory methods. The semantics
74
* for each method are detailed in mozIAsyncHistory.
75
*/
76
[scriptable, uuid(1f266877-2859-418b-a11b-ec3ae4f4f93d)]
77
interface mozIVisitInfoCallback : nsISupports
78
{
79
/**
80
* Called when the given place could not be processed.
81
*
82
* @param aResultCode
83
* nsresult indicating the failure reason.
84
* @param aPlaceInfo
85
* The information that was given to the caller for the place.
86
*/
87
void handleError(in nsresult aResultCode,
88
in mozIPlaceInfo aPlaceInfo);
89
90
/**
91
* Called for each place processed successfully.
92
*
93
* @param aPlaceInfo
94
* The current info stored for the place.
95
*/
96
void handleResult(in mozIPlaceInfo aPlaceInfo);
97
98
/**
99
* Called when all records were processed.
100
* @param aUpdatedItems
101
* How many items were successfully updated.
102
*/
103
void handleCompletion(in unsigned long aUpdatedItems);
104
105
/**
106
* These two attributes govern whether we attempt to call
107
* handleResult and handleError, respectively, if/once
108
* results/errors occur.
109
*/
110
readonly attribute bool ignoreResults;
111
readonly attribute bool ignoreErrors;
112
};
113
114
[scriptable, function, uuid(994092bf-936f-449b-8dd6-0941e024360d)]
115
interface mozIVisitedStatusCallback : nsISupports
116
{
117
/**
118
* Notifies whether a certain URI has been visited.
119
*
120
* @param aURI
121
* URI being notified about.
122
* @param aVisitedStatus
123
* The visited status of aURI.
124
*/
125
void isVisited(in nsIURI aURI,
126
in boolean aVisitedStatus);
127
};
128
129
/**
130
* This interface contains APIs for cpp consumers.
131
* Javascript consumers should look at History.jsm instead,
132
* that is exposed through PlacesUtils.history.
133
*
134
* If you're evaluating adding a new history API, it should
135
* usually go to History.jsm, unless it needs to do long and
136
* expensive work in a batch, then it could be worth doing
137
* that in History.cpp.
138
*/
139
140
[scriptable, uuid(1643EFD2-A329-4733-A39D-17069C8D3B2D)]
141
interface mozIAsyncHistory : nsISupports
142
{
143
/**
144
* Adds a set of visits for one or more mozIPlaceInfo objects, and updates
145
* each mozIPlaceInfo's title or guid.
146
*
147
* aCallback.handleResult is called for each visit added.
148
*
149
* @param aPlaceInfo
150
* The mozIPlaceInfo object[s] containing the information to store or
151
* update. This can be a single object, or an array of objects.
152
* @param [optional] aCallback
153
* A mozIVisitInfoCallback object which consists of callbacks to be
154
* notified for successful and/or failed changes.
155
* @param [optional] aGroupNotifications
156
* If set to true, the implementation will attempt to avoid using
157
* per-place/visit notifications as much as possible.
158
*
159
* @throws NS_ERROR_INVALID_ARG
160
* - Passing in NULL for aPlaceInfo.
161
* - Not providing at least one valid guid, or uri for all
162
* mozIPlaceInfo object[s].
163
* - Not providing an array or nothing for the visits property of
164
* mozIPlaceInfo.
165
* - Not providing a visitDate and transitionType for each
166
* mozIVisitInfo.
167
* - Providing an invalid transitionType for a mozIVisitInfo.
168
*/
169
[implicit_jscontext]
170
void updatePlaces(in jsval aPlaceInfo,
171
[optional] in mozIVisitInfoCallback aCallback,
172
[optional] in bool aGroupNotifications);
173
174
/**
175
* Checks if a given URI has been visited.
176
*
177
* @param aURI
178
* The URI to check for.
179
* @param aCallback
180
* A mozIVisitStatusCallback object which receives the visited status.
181
*/
182
void isURIVisited(in nsIURI aURI,
183
in mozIVisitedStatusCallback aCallback);
184
};