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/. */
5 #include
"nsIStreamListener.idl"
8 interface nsIDownloadObserver
;
13 * A downloader is a special implementation of a nsIStreamListener that will
14 * make the contents of the stream available as a file. This may utilize the
15 * disk cache as an optimization to avoid an extra copy of the data on disk.
16 * The resulting file is valid from the time the downloader completes until
17 * the last reference to the downloader is released.
19 [scriptable
, uuid(fafe41a9
-a531
-4d6d
-89bc
-588a6522fb4e
)]
20 interface nsIDownloader
: nsIStreamListener
23 * Initialize this downloader
26 * the observer to be notified when the download completes.
27 * @param downloadLocation
28 * the location where the stream contents should be written.
29 * if null, the downloader will select a location and the
30 * resulting file will be deleted (or otherwise made invalid)
31 * when the downloader object is destroyed. if an explicit
32 * download location is specified then the resulting file will
33 * not be deleted, and it will be the callers responsibility
34 * to keep track of the file, etc.
36 void init
(in nsIDownloadObserver observer
,
37 in nsIFile downloadLocation
);
40 [scriptable
, uuid(44b3153e
-a54e
-4077
-a527
-b0325e40924e
)]
41 interface nsIDownloadObserver
: nsISupports
44 * Called to signal a download that has completed.
46 void onDownloadComplete
(in nsIDownloader downloader
,
47 in nsIRequest request
,