/* -*- 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);

};
