nsIDownloader.idl (1944B)
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/. */ 4 5 #include "nsIStreamListener.idl" 6 7 interface nsIFile; 8 interface nsIDownloadObserver; 9 10 /** 11 * nsIDownloader 12 * 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. 18 */ 19 [scriptable, uuid(fafe41a9-a531-4d6d-89bc-588a6522fb4e)] 20 interface nsIDownloader : nsIStreamListener 21 { 22 /** 23 * Initialize this downloader 24 * 25 * @param observer 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. 35 */ 36 void init(in nsIDownloadObserver observer, 37 in nsIFile downloadLocation); 38 }; 39 40 [scriptable, uuid(44b3153e-a54e-4077-a527-b0325e40924e)] 41 interface nsIDownloadObserver : nsISupports 42 { 43 /** 44 * Called to signal a download that has completed. 45 */ 46 void onDownloadComplete(in nsIDownloader downloader, 47 in nsIRequest request, 48 in nsresult status, 49 in nsIFile result); 50 };