|
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 */ |
|
101 void handleCompletion(); |
|
102 |
|
103 }; |
|
104 |
|
105 [scriptable, function, uuid(994092bf-936f-449b-8dd6-0941e024360d)] |
|
106 interface mozIVisitedStatusCallback : nsISupports |
|
107 { |
|
108 /** |
|
109 * Notifies whether a certain URI has been visited. |
|
110 * |
|
111 * @param aURI |
|
112 * URI being notified about. |
|
113 * @param aVisitedStatus |
|
114 * The visited status of aURI. |
|
115 */ |
|
116 void isVisited(in nsIURI aURI, |
|
117 in boolean aVisitedStatus); |
|
118 }; |
|
119 |
|
120 [scriptable, uuid(1643EFD2-A329-4733-A39D-17069C8D3B2D)] |
|
121 interface mozIAsyncHistory : nsISupports |
|
122 { |
|
123 /** |
|
124 * Gets the available information for the given array of places, each |
|
125 * identified by either nsIURI or places GUID (string). |
|
126 * |
|
127 * The retrieved places info objects DO NOT include the visits data (the |
|
128 * |visits| attribute is set to null). |
|
129 * |
|
130 * If a given place does not exist in the database, aCallback.handleError is |
|
131 * called for it with NS_ERROR_NOT_AVAILABLE result code. |
|
132 * |
|
133 * @param aPlaceIdentifiers |
|
134 * The place[s] for which to retrieve information, identified by either |
|
135 * a single place GUID, a single URI, or a JS array of URIs and/or GUIDs. |
|
136 * @param aCallback |
|
137 * A mozIVisitInfoCallback object which consists of callbacks to be |
|
138 * notified for successful or failed retrievals. |
|
139 * If there's no information available for a given place, aCallback |
|
140 * is called with a stub place info object, containing just the provided |
|
141 * data (GUID or URI). |
|
142 * |
|
143 * @throws NS_ERROR_INVALID_ARG |
|
144 * - Passing in NULL for aPlaceIdentifiers or aCallback. |
|
145 * - Not providing at least one valid GUID or URI. |
|
146 */ |
|
147 [implicit_jscontext] |
|
148 void getPlacesInfo(in jsval aPlaceIdentifiers, |
|
149 in mozIVisitInfoCallback aCallback); |
|
150 |
|
151 /** |
|
152 * Adds a set of visits for one or more mozIPlaceInfo objects, and updates |
|
153 * each mozIPlaceInfo's title or guid. |
|
154 * |
|
155 * aCallback.handleResult is called for each visit added. |
|
156 * |
|
157 * @param aPlaceInfo |
|
158 * The mozIPlaceInfo object[s] containing the information to store or |
|
159 * update. This can be a single object, or an array of objects. |
|
160 * @param [optional] aCallback |
|
161 * A mozIVisitInfoCallback object which consists of callbacks to be |
|
162 * notified for successful and/or failed changes. |
|
163 * |
|
164 * @throws NS_ERROR_INVALID_ARG |
|
165 * - Passing in NULL for aPlaceInfo. |
|
166 * - Not providing at least one valid guid, or uri for all |
|
167 * mozIPlaceInfo object[s]. |
|
168 * - Not providing an array or nothing for the visits property of |
|
169 * mozIPlaceInfo. |
|
170 * - Not providing a visitDate and transitionType for each |
|
171 * mozIVisitInfo. |
|
172 * - Providing an invalid transitionType for a mozIVisitInfo. |
|
173 */ |
|
174 [implicit_jscontext] |
|
175 void updatePlaces(in jsval aPlaceInfo, |
|
176 [optional] in mozIVisitInfoCallback aCallback); |
|
177 |
|
178 /** |
|
179 * Checks if a given URI has been visited. |
|
180 * |
|
181 * @param aURI |
|
182 * The URI to check for. |
|
183 * @param aCallback |
|
184 * A mozIVisitStatusCallback object which receives the visited status. |
|
185 */ |
|
186 void isURIVisited(in nsIURI aURI, |
|
187 in mozIVisitedStatusCallback aCallback); |
|
188 }; |