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.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #include "nsIStreamListener.idl" |
michael@0 | 6 | |
michael@0 | 7 | interface nsIFile; |
michael@0 | 8 | interface nsIDownloadObserver; |
michael@0 | 9 | |
michael@0 | 10 | /** |
michael@0 | 11 | * nsIDownloader |
michael@0 | 12 | * |
michael@0 | 13 | * A downloader is a special implementation of a nsIStreamListener that will |
michael@0 | 14 | * make the contents of the stream available as a file. This may utilize the |
michael@0 | 15 | * disk cache as an optimization to avoid an extra copy of the data on disk. |
michael@0 | 16 | * The resulting file is valid from the time the downloader completes until |
michael@0 | 17 | * the last reference to the downloader is released. |
michael@0 | 18 | */ |
michael@0 | 19 | [scriptable, uuid(fafe41a9-a531-4d6d-89bc-588a6522fb4e)] |
michael@0 | 20 | interface nsIDownloader : nsIStreamListener |
michael@0 | 21 | { |
michael@0 | 22 | /** |
michael@0 | 23 | * Initialize this downloader |
michael@0 | 24 | * |
michael@0 | 25 | * @param observer |
michael@0 | 26 | * the observer to be notified when the download completes. |
michael@0 | 27 | * @param downloadLocation |
michael@0 | 28 | * the location where the stream contents should be written. |
michael@0 | 29 | * if null, the downloader will select a location and the |
michael@0 | 30 | * resulting file will be deleted (or otherwise made invalid) |
michael@0 | 31 | * when the downloader object is destroyed. if an explicit |
michael@0 | 32 | * download location is specified then the resulting file will |
michael@0 | 33 | * not be deleted, and it will be the callers responsibility |
michael@0 | 34 | * to keep track of the file, etc. |
michael@0 | 35 | */ |
michael@0 | 36 | void init(in nsIDownloadObserver observer, |
michael@0 | 37 | in nsIFile downloadLocation); |
michael@0 | 38 | }; |
michael@0 | 39 | |
michael@0 | 40 | [scriptable, uuid(44b3153e-a54e-4077-a527-b0325e40924e)] |
michael@0 | 41 | interface nsIDownloadObserver : nsISupports |
michael@0 | 42 | { |
michael@0 | 43 | /** |
michael@0 | 44 | * Called to signal a download that has completed. |
michael@0 | 45 | */ |
michael@0 | 46 | void onDownloadComplete(in nsIDownloader downloader, |
michael@0 | 47 | in nsIRequest request, |
michael@0 | 48 | in nsISupports ctxt, |
michael@0 | 49 | in nsresult status, |
michael@0 | 50 | in nsIFile result); |
michael@0 | 51 | }; |