Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
nsDownloadManager.cpp File Reference
#include "nsDownloadManager.h"
#include "nsIWebProgress.h"
#include "nsIRDFLiteral.h"
#include "rdf.h"
#include "nsNetUtil.h"
#include "nsIURI.h"
#include "nsIURL.h"
#include "nsIDOMChromeWindow.h"
#include "nsIDOMWindow.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDOMEvent.h"
#include "nsIDOMEventTarget.h"
#include "nsRDFCID.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsIWebBrowserPersist.h"
#include "nsIObserver.h"
#include "nsIProgressDialog.h"
#include "nsIWindowWatcher.h"
#include "nsIStringBundle.h"
#include "nsCRT.h"
#include "nsIWindowMediator.h"
#include "nsIPromptService.h"
#include "nsIObserverService.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsVoidArray.h"
#include "nsEnumeratorUtils.h"
#include "nsIFileURL.h"
#include "nsEmbedCID.h"
#include "nsInt64.h"
#include "nsAutoPtr.h"

Go to the source code of this file.

Defines

#define BYTES_TO_KBYTES(bytes)   ((PRFloat64)bytes / 1024.0 + .5)
#define DOWNLOAD_MANAGER_FE_URL   "chrome://mozapps/content/downloads/downloads.xul"
#define DOWNLOAD_MANAGER_BUNDLE   "chrome://mozapps/locale/downloads/downloads.properties"
#define DOWNLOAD_MANAGER_ALERT_ICON   "chrome://mozapps/skin/downloads/downloadIcon.png"
#define PREF_BDM_SHOWALERTONCOMPLETE   "browser.download.manager.showAlertOnComplete"
#define PREF_BDM_SHOWALERTINTERVAL   "browser.download.manager.showAlertInterval"
#define PREF_BDM_RETENTION   "browser.download.manager.retention"
#define PREF_BDM_OPENDELAY   "browser.download.manager.openDelay"
#define PREF_BDM_SHOWWHENSTARTING   "browser.download.manager.showWhenStarting"
#define PREF_BDM_FOCUSWHENSTARTING   "browser.download.manager.focusWhenStarting"
#define PREF_BDM_CLOSEWHENDONE   "browser.download.manager.closeWhenDone"
#define PREF_BDM_FLASHCOUNT   "browser.download.manager.flashCount"
#define PREF_BDM_ADDTORECENTDOCS   "browser.download.manager.addToRecentDocs"

Functions

static NS_DEFINE_CID (kRDFServiceCID, NS_RDFSERVICE_CID)
static NS_DEFINE_CID (kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID)
static nsresult GetFilePathFromURI (nsIURI *aURI, nsAString &aPath)
 Extract the file path associated with a URI.
 NS_IMPL_ISUPPORTS4 (nsDownloadManager, nsIDownloadManager, nsIXPInstallManagerUI, nsIObserver, nsISupportsWeakReference) nsDownloadManager
 NS_IMPL_ISUPPORTS5 (nsDownload, nsIDownload, nsIDownload_MOZILLA_1_8_BRANCH, nsITransfer, nsIWebProgressListener, nsIWebProgressListener2) nsDownload

Variables

static PRBool gStoppingDownloads = PR_FALSE
static const nsInt64 gInterval ((PRUint32)(400 *PR_USEC_PER_MSEC))
static nsIRDFResourcegNC_DownloadsRoot = nsnull
static nsIRDFResourcegNC_File = nsnull
static nsIRDFResourcegNC_URL = nsnull
static nsIRDFResourcegNC_IconURL = nsnull
static nsIRDFResourcegNC_Name = nsnull
static nsIRDFResourcegNC_ProgressPercent = nsnull
static nsIRDFResourcegNC_Transferred = nsnull
static nsIRDFResourcegNC_DownloadState = nsnull
static nsIRDFResourcegNC_StatusText = nsnull
static nsIRDFResourcegNC_DateStarted = nsnull
static nsIRDFResourcegNC_DateEnded = nsnull
static nsIRDFServicegRDFService = nsnull
static nsIObserverServicegObserverService = nsnull
static PRInt32 gRefCnt = 0

Define Documentation

#define BYTES_TO_KBYTES (   bytes)    ((PRFloat64)bytes / 1024.0 + .5)

Definition at line 80 of file nsDownloadManager.cpp.

#define DOWNLOAD_MANAGER_ALERT_ICON   "chrome://mozapps/skin/downloads/downloadIcon.png"

Definition at line 93 of file nsDownloadManager.cpp.

#define DOWNLOAD_MANAGER_BUNDLE   "chrome://mozapps/locale/downloads/downloads.properties"

Definition at line 92 of file nsDownloadManager.cpp.

#define DOWNLOAD_MANAGER_FE_URL   "chrome://mozapps/content/downloads/downloads.xul"

Definition at line 91 of file nsDownloadManager.cpp.

#define PREF_BDM_ADDTORECENTDOCS   "browser.download.manager.addToRecentDocs"

Definition at line 102 of file nsDownloadManager.cpp.

#define PREF_BDM_CLOSEWHENDONE   "browser.download.manager.closeWhenDone"

Definition at line 100 of file nsDownloadManager.cpp.

#define PREF_BDM_FLASHCOUNT   "browser.download.manager.flashCount"

Definition at line 101 of file nsDownloadManager.cpp.

#define PREF_BDM_FOCUSWHENSTARTING   "browser.download.manager.focusWhenStarting"

Definition at line 99 of file nsDownloadManager.cpp.

#define PREF_BDM_OPENDELAY   "browser.download.manager.openDelay"

Definition at line 97 of file nsDownloadManager.cpp.

#define PREF_BDM_RETENTION   "browser.download.manager.retention"

Definition at line 96 of file nsDownloadManager.cpp.

#define PREF_BDM_SHOWALERTINTERVAL   "browser.download.manager.showAlertInterval"

Definition at line 95 of file nsDownloadManager.cpp.

#define PREF_BDM_SHOWALERTONCOMPLETE   "browser.download.manager.showAlertOnComplete"

Definition at line 94 of file nsDownloadManager.cpp.

#define PREF_BDM_SHOWWHENSTARTING   "browser.download.manager.showWhenStarting"

Definition at line 98 of file nsDownloadManager.cpp.


Function Documentation

static nsresult GetFilePathFromURI ( nsIURI aURI,
nsAString &  aPath 
) [static]

Extract the file path associated with a URI.

We try to convert to a nsIFile instead of extracting the path from the URI directly since this ensures that we get a string in the right charset and that all %-encoded characters have been expanded.

Definition at line 129 of file nsDownloadManager.cpp.

{
  nsresult rv;

  nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(aURI, &rv);
  if (NS_FAILED(rv)) return rv;

  nsCOMPtr<nsIFile> file;
  rv = fileURL->GetFile(getter_AddRefs(file));
  if (NS_SUCCEEDED(rv))
    rv = file->GetPath(aPath);

  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static NS_DEFINE_CID ( kRDFServiceCID  ,
NS_RDFSERVICE_CID   
) [static]
static NS_DEFINE_CID ( kStringBundleServiceCID  ,
NS_STRINGBUNDLESERVICE_CID   
) [static]

Definition at line 147 of file nsDownloadManager.cpp.

                                     : mBatches(0)
{
}

Definition at line 1847 of file nsDownloadManager.cpp.

                      :mDownloadState(nsIDownloadManager::DOWNLOAD_NOTSTARTED),
                         mPercentComplete(0),
                         mCurrBytes(LL_ZERO),
                         mMaxBytes(LL_ZERO),
                         mStartTime(LL_ZERO),
                         mLastUpdate(PR_Now() - (PRUint32)gInterval),
                         mPaused(PR_FALSE),
                         mSpeed(0)
{
}

Variable Documentation

Definition at line 116 of file nsDownloadManager.cpp.

Definition at line 115 of file nsDownloadManager.cpp.

Definition at line 106 of file nsDownloadManager.cpp.

Definition at line 113 of file nsDownloadManager.cpp.

Definition at line 107 of file nsDownloadManager.cpp.

Definition at line 109 of file nsDownloadManager.cpp.

Definition at line 110 of file nsDownloadManager.cpp.

Definition at line 111 of file nsDownloadManager.cpp.

Definition at line 114 of file nsDownloadManager.cpp.

Definition at line 112 of file nsDownloadManager.cpp.

Definition at line 108 of file nsDownloadManager.cpp.

Definition at line 119 of file nsDownloadManager.cpp.

Definition at line 118 of file nsDownloadManager.cpp.

PRInt32 gRefCnt = 0 [static]

Definition at line 120 of file nsDownloadManager.cpp.

Definition at line 89 of file nsDownloadManager.cpp.