nsIDownloadManager
| IID: | 05ed1d45-0aff-4ba0-9e2c-a9ef20383048 |
| Inherits From: | nsISupports |
This interface is implemented by the following components:
Constants
Properties
readonly PRInt32 activeDownloadCount
The number of files currently being downloaded.
readonly nsISimpleEnumerator activeDownloads
An enumeration of active nsIDownloads
readonly PRBool canCleanUp
Whether or not there are downloads that can be cleaned up (removed) i.e. downloads that have completed, have failed or have been canceled.
readonly mozIStorageConnection DBConnection
The database connection to the downloads database.
readonly nsILocalFile defaultDownloadsDirectory
Returns the platform default downloads directory.
readonly nsILocalFile userDownloadsDirectory
Returns the user configured downloads directory. The path is dependent on two user configurable prefs set in preferences:
Browser.download.folderList Indicates the location users wish to save downloaded files too. Values: 0 - The desktop is the default download location. 1 - The system's downloads folder is the default download location. 2 - The default download location is elsewhere as specified in browser.download.dir. If invalid, userDownloadsDirectory will fallback on defaultDownloadsDirectory.
Browser.download.dir - A local path the user may have selected at some point where downloaded files are saved. The use of which is enabled when folderList equals 2.
Methods
nsIDownload addDownload ( PRInt16 downloadType , nsIURI source , nsIURI target , AString displayName , nsIMIMEInfo MIMEInfo , PRTime startTime , nsILocalFile tempFile , nsICancelable cancelable )
void addListener ( nsIDownloadProgressListener listener )
void cancelDownload ( PRUint32 ID )
void cleanUp ( )
nsIDownload getDownload ( PRUint32 ID )
void pauseDownload ( PRUint32 ID )
void removeDownload ( PRUint32 ID )
void removeListener ( nsIDownloadProgressListener listener )
void resumeDownload ( PRUint32 ID )
void retryDownload ( PRUint32 ID )
nsIDownload addDownload ( PRInt16 downloadType , nsIURI source , nsIURI target , AString displayName , nsIMIMEInfo MIMEInfo , PRTime startTime , nsILocalFile tempFile , nsICancelable cancelable )
Creates an nsIDownload and adds it to be managed by the download manager.
- Arguments:
- downloadType
- source: The source URI of the transfer. Must not be null.
- target: The target URI of the transfer. Must not be null.
- displayName: The user-readable description of the transfer. Can be empty.
- MIMEInfo: The MIME info associated with the target, including MIME type and helper app when appropriate. This parameter is optional.
- startTime: Time when the download started
- tempFile: The location of a temporary file; i.e. a file in which the received data will be stored, but which is not equal to the target file. (will be moved to the real target by the caller, when the download is finished) May be null.
- cancelable: An object that can be used to abort the download. Must not be null.
- Returns:
- The newly created download item with the passed-in properties.
void addListener ( nsIDownloadProgressListener listener )
Adds a listener from the download manager.
- Arguments:
- listener
void cancelDownload ( PRUint32 ID )
Cancels the download with the specified ID if it's currently in-progress. This calls cancel(NS_BINDING_ABORTED) on the nsICancelable provided by the download.
- Arguments:
- ID: The unique ID of the download.
Removes completed, failed, and canceled downloads from the list.
Also notifies observers of the "download-manager-remove-download" topic with a null subject to allow any DM consumers to react to the removals.
nsIDownload getDownload ( PRUint32 ID )
Retrieves a download managed by the download manager. This can be one that is in progress, or one that has completed in the past and is stored in the database.
- Arguments:
- ID: The unique ID of the download.
- Returns:
- The download with the specified ID.
void pauseDownload ( PRUint32 ID )
Pause the specified download.
- Arguments:
- ID: The unique ID of the download.
void removeDownload ( PRUint32 ID )
Removes the download with the specified id if it's not currently in-progress. Whereas cancelDownload simply cancels the transfer, but retains information about it, removeDownload removes all knowledge of it.
Also notifies observers of the "download-manager-remove-download" topic with the download id as the subject to allow any DM consumers to react to the removal.
- Arguments:
- ID: The unique ID of the download.
void removeListener ( nsIDownloadProgressListener listener )
Removes a listener from the download manager.
- Arguments:
- listener
void resumeDownload ( PRUint32 ID )
Resume the specified download.
- Arguments:
- ID: The unique ID of the download.
void retryDownload ( PRUint32 ID )
Retries a failed download.
- Arguments:
- ID: The unique ID of the download.
Reference documentation is generated from Mozilla's source.
