nsIDownloadProgressListener
From MDC
The nsIDownloadProgressListener interface gives applications and extensions a way to monitor the status of downloads being processed by the Download Manager; simply implement this interface in your code, then call the nsIDownloadManager function addListener() to start listening.
When you no longer need to listen to the Download Manager's state, call removeListener() on nsIDownloadManager to stop listening.
As the states of downloads change, the methods described here are called by the Download Manager so your code can take whatever steps it needs to.
This interface works very similarly to the nsIWebProgress interface.
Contents |
nsIDownloadProgressListener is defined in toolkit/components/downloads/public/nsIDownloadProgressListener.idl. It is scriptable and
unfrozen (hasn't changed since Mozilla 1.9).
Inherits from: nsISupports
[edit] Method overview
void onDownloadStateChange(in short aState, in nsIDownload aDownload)
|
void onProgressChange(in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long long aCurSelfProgress, in long long aMaxSelfProgress, in long long aCurTotalProgress, in long long aMaxTotalProgress, in nsIDownload aDownload)
|
Obsolete void onStatusChange(in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage, in nsIDownload aDownload)
|
Obsolete void onLocationChange(in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI aLocation, in nsIDownload aDownload)x
|
void onSecurityChange(in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aState, in nsIDownload aDownload)
|
[edit] Attributes
| Attribute | Type | Description |
document
| nsIDOMDocument
| The document object representing the Download Manager's window. |
[edit] Methods
[edit] onDownloadStateChange()
Called when the status of a particular download changes.
void onDownloadStateChange( in short aState, in nsIDownload aDownload );
[edit] Parameters
- aState
- The previous state of the download. See
nsIDownloadManagerfor a list of possible values.
- aDownload
- The
nsIDownloadobject representing the file whose download status has changed. You can get the new state of the download from this object.
[edit] onStateChange()
Called when the state of a particular download changes.
void onStateChange( in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in nsresult aStatus, in nsIDownload aDownload );
[edit] Parameters
- aWebProgress
- The
nsIWebProgressinstance used by the Download Manager to monitor downloads.
- aRequest
- The
nsIChannelthat changed state. This parameter will not beNULL.
- aStateFlags
- Flags indicating the download's new state. This value is a combination of one of the state transition flags documented in the
nsIWebProgressListenersection.
- aStatus
- The new state information for the download. See
onStateChange()innsIWebProgressListenerfor details. This can also be one of thensIDownloadManagerstate constants.
- aDownload
- The download whose state changed.
[edit] onProgressChange()
Called when the download progress level changes for a download.
void onProgressChange( in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long long aCurSelfProgress, in long long aMaxSelfProgress, in long long aCurTotalProgress, in long long aMaxTotalProgress, in nsIDownload aDownload );
[edit] Parameters
- aWebProgress
- The
nsIWebProgressinstance used by the Download Manager to monitor downloads.
- aRequest
- The
nsIChannelthat changed state. This parameter will not beNULL.
- aCurSelfProgress
- The current amount of progress that's been made on the download specified by aDownload.
- aMaxSelfProgress
- The value that the self progress needs to reach to indicate that the download is complete.
- aCurTotalProgress
- The current amount of progress that's been made on all downloads.
- aMaxTotalProgress
- The value that the total progress needs to reach to indicate that all downloads are complete.
- aDownload
- The
nsIDownloadobject whose progress is represented by the aCurSelfProgress and aMaxSelfProgress parameters.
[edit] onStatusChange()
Called when the status of a download request has changed. The received status message is intended to be displayed visibly to the user.
void onStatusChange( in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage, in nsIDownload aDownload );
[edit] Parameters
- aWebProgress
- The
nsIWebProgressinstance used by the Download Manager to monitor downloads.
- nsIChannel
- The
nsIRequestthat changed state. This parameter will not beNULL.
- aStatus
- The new state information for the download. See
onStateChange()innsIWebProgressListenerfor details.
- aMessage
- A user-readable status message intended to be displayed visibly on the screen.
- aDownload
- The download whose status changed.
[edit] onLocationChange()
void onLocationChange( in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI aLocation, in nsIDownload aDownload );
[edit] Parameters
- aWebProgress
- The
nsIWebProgressinstance used by the Download Manager to monitor downloads.
- aRequest
- The
nsIChannelthat changed state. This parameter will not beNULL.
- aLocation
- The URI of the file being downloaded.
- aDownload
- The
nsIDownloadobject representing the file being downloaded.
[edit] onSecurityChange()
Called when the level of security being used while downloading changes; for example, if the initial request is made via HTTPS but the download switches to HTTP, this function gets called to notify you of that transition.
void onSecurityChange( in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aState, in nsIDownload aDownload );
[edit] Parameters
- aWebProgress
- The
nsIWebProgressinstance used by the Download Manager to monitor downloads.
- aRequest
- The
nsIChannelthat changed state. This parameter will not beNULL.
- aState
- The new state of the download. See
nsIDownloadManagerfor a list of possible values.
- aDownload
- The download whose security level is changing.