Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | /* A minimally extended progress listener used by download manager |
michael@0 | 7 | * to update its default UI. This is implemented in nsDownloadProgressListener.js. |
michael@0 | 8 | * See nsIWebProgressListener for documentation, and use its constants. This isn't |
michael@0 | 9 | * too pretty, but the alternative is having this extend nsIWebProgressListener and |
michael@0 | 10 | * adding an |item| attribute, which would mean a separate nsIDownloadProgressListener |
michael@0 | 11 | * for every nsIDownloadItem, which is a waste... |
michael@0 | 12 | */ |
michael@0 | 13 | |
michael@0 | 14 | #include "nsISupports.idl" |
michael@0 | 15 | |
michael@0 | 16 | interface nsIWebProgress; |
michael@0 | 17 | interface nsIRequest; |
michael@0 | 18 | interface nsIURI; |
michael@0 | 19 | interface nsIDownload; |
michael@0 | 20 | interface nsIDOMDocument; |
michael@0 | 21 | |
michael@0 | 22 | [scriptable, uuid(7acb07ea-cac2-4c15-a3ad-23aaa789ed51)] |
michael@0 | 23 | interface nsIDownloadProgressListener : nsISupports { |
michael@0 | 24 | |
michael@0 | 25 | /** |
michael@0 | 26 | * document |
michael@0 | 27 | * The document of the download manager frontend. |
michael@0 | 28 | */ |
michael@0 | 29 | |
michael@0 | 30 | attribute nsIDOMDocument document; |
michael@0 | 31 | |
michael@0 | 32 | /** |
michael@0 | 33 | * Dispatched whenever the state of the download changes. |
michael@0 | 34 | * |
michael@0 | 35 | * @param aState The previous download sate. |
michael@0 | 36 | * @param aDownload The download object. |
michael@0 | 37 | * @see nsIDownloadManager for download states. |
michael@0 | 38 | */ |
michael@0 | 39 | void onDownloadStateChange(in short aState, in nsIDownload aDownload); |
michael@0 | 40 | |
michael@0 | 41 | void onStateChange(in nsIWebProgress aWebProgress, |
michael@0 | 42 | in nsIRequest aRequest, |
michael@0 | 43 | in unsigned long aStateFlags, |
michael@0 | 44 | in nsresult aStatus, |
michael@0 | 45 | in nsIDownload aDownload); |
michael@0 | 46 | |
michael@0 | 47 | void onProgressChange(in nsIWebProgress aWebProgress, |
michael@0 | 48 | in nsIRequest aRequest, |
michael@0 | 49 | in long long aCurSelfProgress, |
michael@0 | 50 | in long long aMaxSelfProgress, |
michael@0 | 51 | in long long aCurTotalProgress, |
michael@0 | 52 | in long long aMaxTotalProgress, |
michael@0 | 53 | in nsIDownload aDownload); |
michael@0 | 54 | |
michael@0 | 55 | void onSecurityChange(in nsIWebProgress aWebProgress, |
michael@0 | 56 | in nsIRequest aRequest, |
michael@0 | 57 | in unsigned long aState, |
michael@0 | 58 | in nsIDownload aDownload); |
michael@0 | 59 | |
michael@0 | 60 | }; |