|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
|
2 * vim: sw=2 ts=2 sts=2 |
|
3 * This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #include "nsISupports.idl" |
|
8 |
|
9 interface nsIURI; |
|
10 |
|
11 /** |
|
12 * This interface can be used to add a download to history. There is a separate |
|
13 * interface specifically for downloads in case embedders choose to track |
|
14 * downloads differently from other types of history. |
|
15 */ |
|
16 [scriptable, uuid(4dcd6a12-a091-4f38-8360-022929635746)] |
|
17 interface nsIDownloadHistory : nsISupports { |
|
18 /** |
|
19 * Adds a download to history. This will also notify observers that the |
|
20 * URI aSource is visited with the topic NS_LINK_VISITED_EVENT_TOPIC if |
|
21 * aSource has not yet been visited. |
|
22 * |
|
23 * @param aSource |
|
24 * The source of the download we are adding to history. This cannot be |
|
25 * null. |
|
26 * @param aReferrer |
|
27 * [optional] The referrer of source URI. |
|
28 * @param aStartTime |
|
29 * [optional] The time the download was started. If the start time |
|
30 * is not given, the current time is used. |
|
31 * @param aDestination |
|
32 * [optional] The target where the download is to be saved on the local |
|
33 * filesystem. |
|
34 * @throws NS_ERROR_NOT_AVAILABLE |
|
35 * In a situation where a history implementation is not available, |
|
36 * where 'history implementation' refers to something like |
|
37 * nsIGlobalHistory and friends. |
|
38 * @note This addition is not guaranteed to be synchronous, since it delegates |
|
39 * the actual addition to the underlying history implementation. If you |
|
40 * need to observe the completion of the addition, use the underlying |
|
41 * history implementation's notifications system (e.g. nsINavHistoryObserver |
|
42 * for toolkit's implementation of this interface). |
|
43 */ |
|
44 void addDownload(in nsIURI aSource, [optional] in nsIURI aReferrer, |
|
45 [optional] in PRTime aStartTime, |
|
46 [optional] in nsIURI aDestination); |
|
47 |
|
48 /** |
|
49 * Remove all downloads from history. |
|
50 * |
|
51 * @note This removal is not guaranteed to be synchronous, since it delegates |
|
52 * the actual removal to the underlying history implementation. If you |
|
53 * need to observe the completion of the removal, use the underlying |
|
54 * history implementation's notifications system (e.g. nsINavHistoryObserver |
|
55 * for toolkit's implementation of this interface). |
|
56 */ |
|
57 void removeAllDownloads(); |
|
58 }; |