Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "nsITransfer.idl"
8 interface nsIURI;
9 interface nsIFile;
10 interface nsIObserver;
11 interface nsICancelable;
12 interface nsIWebProgressListener;
13 interface nsIMIMEInfo;
15 /**
16 * Represents a download object.
17 *
18 * @note This object is no longer updated once it enters a completed state.
19 * Completed states are the following:
20 * nsIDownloadManager::DOWNLOAD_FINISHED
21 * nsIDownloadManager::DOWNLOAD_FAILED
22 * nsIDownloadManager::DOWNLOAD_CANCELED
23 * nsIDownloadManager::DOWNLOAD_BLOCKED_PARENTAL
24 * nsIDownloadManager::DOWNLOAD_DIRTY
25 * nsIDownloadManager::DOWNLOAD_BLOCKED_POLICY
26 */
27 [scriptable, uuid(b02be33b-d47c-4bd3-afd9-402a942426b0)]
28 interface nsIDownload : nsITransfer {
30 /**
31 * The target of a download is always a file on the local file system.
32 */
33 readonly attribute nsIFile targetFile;
35 /**
36 * The percentage of transfer completed.
37 * If the file size is unknown it'll be -1 here.
38 */
39 readonly attribute long percentComplete;
41 /**
42 * The amount of bytes downloaded so far.
43 */
44 readonly attribute long long amountTransferred;
46 /**
47 * The size of file in bytes.
48 * Unknown size is represented by -1.
49 */
50 readonly attribute long long size;
52 /**
53 * The source of the transfer.
54 */
55 readonly attribute nsIURI source;
57 /**
58 * The target of the transfer.
59 */
60 readonly attribute nsIURI target;
62 /**
63 * Object that can be used to cancel the download.
64 * Will be null after the download is finished.
65 */
66 readonly attribute nsICancelable cancelable;
68 /**
69 * The user-readable description of the transfer.
70 */
71 readonly attribute AString displayName;
73 /**
74 * The time a transfer was started.
75 */
76 readonly attribute long long startTime;
78 /**
79 * The speed of the transfer in bytes/sec.
80 */
81 readonly attribute double speed;
83 /**
84 * Optional. If set, it will contain the target's relevant MIME information.
85 * This includes its MIME Type, helper app, and whether that helper should be
86 * executed.
87 */
88 readonly attribute nsIMIMEInfo MIMEInfo;
90 /**
91 * The id of the download that is stored in the database - not globally unique.
92 * For example, a private download and a public one might have identical ids.
93 * Can only be safely used for direct database manipulation in the database that
94 * contains this download. Use the guid property instead for safe, database-agnostic
95 * searching and manipulation.
96 *
97 * @deprecated
98 */
99 readonly attribute unsigned long id;
101 /**
102 * The guid of the download that is stored in the database.
103 * Has the form of twelve alphanumeric characters.
104 */
105 readonly attribute ACString guid;
107 /**
108 * The state of the download.
109 * @see nsIDownloadManager and nsIXPInstallManagerUI
110 */
111 readonly attribute short state;
113 /**
114 * The referrer uri of the download. This is only valid for HTTP downloads,
115 * and can be null.
116 */
117 readonly attribute nsIURI referrer;
119 /**
120 * Indicates if the download can be resumed after being paused or not. This
121 * is only the case if the download is over HTTP/1.1 or FTP and if the
122 * server supports it.
123 */
124 readonly attribute boolean resumable;
126 /**
127 * Indicates if the download was initiated from a context marked as private,
128 * controlling whether it should be stored in a permanent manner or not.
129 */
130 readonly attribute boolean isPrivate;
132 /**
133 * Cancel this download if it's currently in progress.
134 */
135 void cancel();
137 /**
138 * Pause this download if it is in progress.
139 *
140 * @throws NS_ERROR_UNEXPECTED if it cannot be paused.
141 */
142 void pause();
144 /**
145 * Resume this download if it is paused.
146 *
147 * @throws NS_ERROR_UNEXPECTED if it cannot be resumed or is not paused.
148 */
149 void resume();
151 /**
152 * Instruct the download manager to remove this download. Whereas
153 * cancel simply cancels the transfer, but retains information about it,
154 * remove removes all knowledge of it.
155 *
156 * @see nsIDownloadManager.removeDownload for more detail
157 * @throws NS_ERROR_FAILURE if the download is active.
158 */
159 void remove();
161 /**
162 * Instruct the download manager to retry this failed download
163 * @throws NS_ERROR_NOT_AVAILABLE if the download is not known.
164 * @throws NS_ERROR_FAILURE if the download is not in the following states:
165 * nsIDownloadManager::DOWNLOAD_CANCELED
166 * nsIDownloadManager::DOWNLOAD_FAILED
167 */
168 void retry();
169 };
171 %{C++
172 // {b02be33b-d47c-4bd3-afd9-402a942426b0}
173 #define NS_DOWNLOAD_CID \
174 { 0xb02be33b, 0xd47c, 0x4bd3, { 0xaf, 0xd9, 0x40, 0x2a, 0x94, 0x24, 0x26, 0xb0 } }
175 %}