summaryrefslogtreecommitdiffstats
path: root/toolkit/components/downloads/nsIDownloadProgressListener.idl
blob: e406f64d618f54939050ee53916691040e2e67bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* A minimally extended progress listener used by download manager
 * to update its default UI.  This is implemented in nsDownloadProgressListener.js.
 * See nsIWebProgressListener for documentation, and use its constants.  This isn't
 * too pretty, but the alternative is having this extend nsIWebProgressListener and
 * adding an |item| attribute, which would mean a separate nsIDownloadProgressListener
 * for every nsIDownloadItem, which is a waste...
 */

#include "nsISupports.idl"

interface nsIWebProgress;
interface nsIRequest;
interface nsIURI;
interface nsIDownload;
interface nsIDOMDocument;

[scriptable, uuid(7acb07ea-cac2-4c15-a3ad-23aaa789ed51)]
interface nsIDownloadProgressListener : nsISupports {

 /**
  * document
  * The document of the download manager frontend.
  */
  
  attribute nsIDOMDocument document;

 /**
  * Dispatched whenever the state of the download changes.
  *
  * @param aState The previous download sate.
  * @param aDownload The download object.
  * @see nsIDownloadManager for download states.
  */
  void onDownloadStateChange(in short aState, in nsIDownload aDownload);

  void onStateChange(in nsIWebProgress aWebProgress,
                     in nsIRequest aRequest,
                     in unsigned long aStateFlags,
                     in nsresult aStatus,
                     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);

  void onSecurityChange(in nsIWebProgress aWebProgress,
                        in nsIRequest aRequest,
                        in unsigned long aState,
                        in nsIDownload aDownload);

};