nsIDownloadManager

IID:9be66cc0-1dd1-11b2-8617-e3a3ed26e3b0
Inherits From:nsISupports

This interface is implemented by the following components:


Methods

nsIDownload addDownload ( nsIURI source , nsILocalFile target , PRUnichar* displayName , nsIMIMEInfo MIMEInfo , PRInt64 startTime , nsIWebBrowserPersist persist ) void cancelDownload ( AUTF8String targetPath ) void endBatchUpdate ( ) nsIDownload getDownload ( AUTF8String targetPath ) void onClose ( ) void open ( nsIDOMWindow parent , nsIDownload download ) void openProgressDialogFor ( nsIDownload download , nsIDOMWindow parent , PRBool cancelDownloadOnClose ) void removeDownload ( AUTF8String targetPath ) void startBatchUpdate ( )

nsIDownload addDownload ( nsIURI source , nsILocalFile target , PRUnichar* displayName , nsIMIMEInfo MIMEInfo , PRInt64 startTime , nsIWebBrowserPersist persist )

Creates an nsIDownload and adds it to be managed by the download manager.

Arguments:
source: The source (nsIURI) of the download.
target: The local file to which the download is being saved.
displayName: The user-readable description of the download.
MIMEInfo
startTime
persist: The "persist" used to transfer the download. If set, the manager will set its listener to the download item and use it for cancellation. If not set, the client is expected to set the download item as the listener on whatever transfer component is being used, and to set an observer on the download item that listens for the "oncancel" topic and cancels the download.
Returns:
The newly created download item with the passed-in properties.

void cancelDownload ( AUTF8String targetPath )

Cancels the download with the specified target path if it's currently in progress. If a "persist" was specified for the download, nsIWebBrowserPersist::CancelSave will be called. If an observer was set on the nsIDownload, it will be notified with the "oncancel" topic. Clients that don't provide a "persist" must listen for this topic and cancel the download.

Arguments:
targetPath: The target path of the download to be cancelled.

void endBatchUpdate ( )

Indicate that a batch update is ending.


nsIDownload getDownload ( AUTF8String targetPath )

Retrieves an in-progress download managed by the download manager.

Arguments:
targetPath: A UTF8-encoded path to the target file.
Returns:
The download with the specified path.

void onClose ( )

Called when the download manager front end is closed. Useful for third party managers to let us know when they've closed.


void open ( nsIDOMWindow parent , nsIDownload download )

Opens the Download Manager front end.

Arguments:
parent: The parent, or opener, of the front end (optional).
download: A download to pass to the manager window. Useful if, for example, you want the window to select a certain download (optional).

void openProgressDialogFor ( nsIDownload download , nsIDOMWindow parent , PRBool cancelDownloadOnClose )

Opens an individual progress dialog displaying progress for the download.

Arguments:
download: The download object to display progress for, as returned by getDownload or addDownload.
parent: The parent, or opener, of the front end (optional).
cancelDownloadOnClose: Whether closing the dialog should cancel the download.

void removeDownload ( AUTF8String targetPath )

Removes the download with the specified target path if it's not currently in progress. Whereas cancelDownload simply cancels the transfer but retains information about it, removeDownload removes all knowledge of it.

Arguments:
targetPath: The target path of the download to be removed.

void startBatchUpdate ( )

Indicate that a batch update (e.g. mass removal) is about to start.

Reference documentation is generated from Mozilla's source.

Add a note User Contributed Notes
January 30, 2005, 12:59 pm mozilla_xulp at jedbrown dot net
For Firefox, the Download manager has changed/improved.
You can do the following to clear the entries

var dm = Components.classes["@mozilla.org/download-manager;1"].
getService(Components.interfaces.nsIDownloadManager);
if(dm.canCleanUp) dm.cleanUp();

This will clear out the Download Manager

Copyright © 1999 - 2005 XULPlanet.com