1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
23 * Blake Ross <blaker@netscape.com>
25 * Alternatively, the contents of this file may be used under the terms of
26 * either of the GNU General Public License Version 2 or later (the "GPL"),
27 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
39 #include
"nsITransfer.idl"
42 interface nsILocalFile
;
43 interface nsIObserver
;
44 interface nsICancelable
;
45 interface nsIWebProgressListener
;
46 interface nsIMIMEInfo
;
49 * Represents a download object.
51 * @note This object is no longer updated once it enters a completed state.
52 * Completed states are the following:
53 * nsIDownloadManager::DOWNLOAD_FINISHED
54 * nsIDownloadManager::DOWNLOAD_FAILED
55 * nsIDownloadManager::DOWNLOAD_CANCELED
57 [scriptable
, uuid(974db2c6
-fbd2
-4de1
-8d24
-f54ce4f3e8bc
)]
58 interface nsIDownload
: nsITransfer
{
61 * The target of a download is always a file on the local file system.
63 readonly attribute nsILocalFile targetFile
;
66 * The percentage of transfer completed.
67 * If the file size is unknown it'll be -1 here.
69 readonly attribute PRInt32 percentComplete
;
72 * The amount of bytes downloaded so far.
74 readonly attribute PRUint64 amountTransferred
;
77 * The size of file in bytes.
78 * Unknown size is represented by LL_MAXUINT.
80 readonly attribute PRUint64 size
;
83 * The source of the transfer.
85 readonly attribute nsIURI
source;
88 * The target of the transfer.
90 readonly attribute nsIURI target
;
93 * Object that can be used to cancel the download.
94 * Will be null after the download is finished.
96 readonly attribute nsICancelable cancelable
;
99 * The user-readable description of the transfer.
101 readonly attribute AString displayName
;
104 * The time a transfer was started.
106 readonly attribute
long long startTime
;
109 * The speed of the transfer in bytes/sec.
111 readonly attribute
double speed
;
114 * Optional. If set, it will contain the target's relevant MIME information.
115 * This includes its MIME Type, helper app, and whether that helper should be
118 readonly attribute nsIMIMEInfo MIMEInfo
;
121 * The id of the download that is stored in the database.
123 readonly attribute
unsigned long id;
126 * The state of the download.
127 * @see nsIDownloadManager and nsIXPInstallManagerUI
129 readonly attribute
short state
;
133 // {E3FA9D0A-1DD1-11B2-BDEF-8C720B597445}
134 #define NS_DOWNLOAD_CID \
135 { 0xe3fa9d0a, 0x1dd1, 0x11b2, { 0xbd, 0xef, 0x8c, 0x72, 0x0b, 0x59, 0x74, 0x45 } }