2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* 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/. */
|
2007-09-17 13:49:24 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#ifndef downloadmanager___h___
|
|
|
|
#define downloadmanager___h___
|
|
|
|
|
2012-02-22 16:33:19 -08:00
|
|
|
#if defined(XP_WIN)
|
2009-04-12 07:55:29 -07:00
|
|
|
#define DOWNLOAD_SCANNER
|
|
|
|
#endif
|
|
|
|
|
2009-02-19 15:28:12 -08:00
|
|
|
#include "nsIDownload.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIDownloadManager.h"
|
|
|
|
#include "nsIDownloadProgressListener.h"
|
|
|
|
#include "nsILocalFile.h"
|
2009-02-19 15:28:12 -08:00
|
|
|
#include "nsIMIMEInfo.h"
|
|
|
|
#include "nsINavHistoryService.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIObserver.h"
|
2009-02-19 15:28:12 -08:00
|
|
|
#include "nsIObserverService.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIStringBundle.h"
|
|
|
|
#include "nsISupportsPrimitives.h"
|
2012-02-10 07:06:37 -08:00
|
|
|
#include "nsWeakReference.h"
|
2009-02-19 15:28:12 -08:00
|
|
|
#include "nsITimer.h"
|
2011-10-28 00:35:45 -07:00
|
|
|
#include "nsString.h"
|
2009-02-19 15:28:12 -08:00
|
|
|
|
2008-04-22 16:37:00 -07:00
|
|
|
#include "mozStorageHelper.h"
|
2007-05-21 17:03:33 -07:00
|
|
|
#include "nsAutoPtr.h"
|
2009-02-19 15:28:12 -08:00
|
|
|
#include "nsCOMArray.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
typedef PRInt16 DownloadState;
|
|
|
|
typedef PRInt16 DownloadType;
|
|
|
|
|
|
|
|
class nsDownload;
|
|
|
|
|
2008-10-14 06:48:55 -07:00
|
|
|
#ifdef DOWNLOAD_SCANNER
|
2008-10-10 18:15:51 -07:00
|
|
|
#include "nsDownloadScanner.h"
|
2007-08-22 14:55:57 -07:00
|
|
|
#endif
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsDownloadManager : public nsIDownloadManager,
|
2008-04-22 16:37:00 -07:00
|
|
|
public nsINavHistoryObserver,
|
2012-02-10 07:06:37 -08:00
|
|
|
public nsIObserver,
|
|
|
|
public nsSupportsWeakReference
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIDOWNLOADMANAGER
|
2008-04-22 16:37:00 -07:00
|
|
|
NS_DECL_NSINAVHISTORYOBSERVER
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECL_NSIOBSERVER
|
|
|
|
|
|
|
|
nsresult Init();
|
|
|
|
|
2007-07-12 13:01:57 -07:00
|
|
|
static nsDownloadManager *GetSingleton();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual ~nsDownloadManager();
|
2008-10-15 00:24:52 -07:00
|
|
|
nsDownloadManager() :
|
|
|
|
mDBType(DATABASE_DISK)
|
2011-10-17 07:59:28 -07:00
|
|
|
, mInPrivateBrowsing(false)
|
2009-11-29 12:56:33 -08:00
|
|
|
#ifdef DOWNLOAD_SCANNER
|
|
|
|
, mScanner(nsnull)
|
|
|
|
#endif
|
2008-10-15 00:24:52 -07:00
|
|
|
{
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-05-21 17:03:33 -07:00
|
|
|
protected:
|
2008-10-15 00:24:52 -07:00
|
|
|
enum DatabaseType
|
|
|
|
{
|
|
|
|
DATABASE_DISK = 0, // default
|
|
|
|
DATABASE_MEMORY
|
|
|
|
};
|
|
|
|
|
2008-11-28 12:53:57 -08:00
|
|
|
nsresult InitDB();
|
2009-02-19 15:28:12 -08:00
|
|
|
nsresult InitFileDB();
|
2012-03-22 10:02:28 -07:00
|
|
|
void CloseDB();
|
2008-10-15 00:24:52 -07:00
|
|
|
nsresult InitMemoryDB();
|
|
|
|
already_AddRefed<mozIStorageConnection> GetFileDBConnection(nsIFile *dbFile) const;
|
|
|
|
already_AddRefed<mozIStorageConnection> GetMemoryDBConnection() const;
|
|
|
|
nsresult SwitchDatabaseTypeTo(enum DatabaseType aType);
|
2007-05-21 17:03:33 -07:00
|
|
|
nsresult CreateTable();
|
2007-10-07 09:15:32 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Fix up the database after a crash such as dealing with previously-active
|
2007-10-24 15:39:05 -07:00
|
|
|
* downloads. Call this before RestoreActiveDownloads to get the downloads
|
|
|
|
* fixed here to be auto-resumed.
|
2007-10-07 09:15:32 -07:00
|
|
|
*/
|
2007-08-30 12:01:39 -07:00
|
|
|
nsresult RestoreDatabaseState();
|
2007-09-26 00:26:06 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Paused downloads that survive across sessions are considered active, so
|
|
|
|
* rebuild the list of these downloads.
|
|
|
|
*/
|
|
|
|
nsresult RestoreActiveDownloads();
|
|
|
|
|
2007-06-04 17:03:35 -07:00
|
|
|
nsresult GetDownloadFromDB(PRUint32 aID, nsDownload **retVal);
|
2007-07-12 13:01:57 -07:00
|
|
|
|
2007-09-17 14:02:39 -07:00
|
|
|
/**
|
|
|
|
* Specially track the active downloads so that we don't need to check
|
|
|
|
* every download to see if they're in progress.
|
|
|
|
*/
|
|
|
|
nsresult AddToCurrentDownloads(nsDownload *aDl);
|
2007-06-22 16:20:00 -07:00
|
|
|
|
2007-08-22 14:55:57 -07:00
|
|
|
void SendEvent(nsDownload *aDownload, const char *aTopic);
|
|
|
|
|
2007-05-21 17:03:33 -07:00
|
|
|
/**
|
|
|
|
* Adds a download with the specified information to the DB.
|
|
|
|
*
|
|
|
|
* @return The id of the download, or 0 if there was an error.
|
|
|
|
*/
|
|
|
|
PRInt64 AddDownloadToDB(const nsAString &aName,
|
|
|
|
const nsACString &aSource,
|
|
|
|
const nsACString &aTarget,
|
2007-09-26 00:20:16 -07:00
|
|
|
const nsAString &aTempPath,
|
2007-05-21 17:03:33 -07:00
|
|
|
PRInt64 aStartTime,
|
|
|
|
PRInt64 aEndTime,
|
2007-10-24 15:19:04 -07:00
|
|
|
const nsACString &aMimeType,
|
|
|
|
const nsACString &aPreferredApp,
|
|
|
|
nsHandlerInfoAction aPreferredAction);
|
2007-05-21 17:03:33 -07:00
|
|
|
|
2007-05-25 16:47:53 -07:00
|
|
|
void NotifyListenersOnDownloadStateChange(PRInt16 aOldState,
|
|
|
|
nsIDownload *aDownload);
|
|
|
|
void NotifyListenersOnProgressChange(nsIWebProgress *aProgress,
|
|
|
|
nsIRequest *aRequest,
|
|
|
|
PRInt64 aCurSelfProgress,
|
|
|
|
PRInt64 aMaxSelfProgress,
|
|
|
|
PRInt64 aCurTotalProgress,
|
|
|
|
PRInt64 aMaxTotalProgress,
|
|
|
|
nsIDownload *aDownload);
|
|
|
|
void NotifyListenersOnStateChange(nsIWebProgress *aProgress,
|
|
|
|
nsIRequest *aRequest,
|
|
|
|
PRUint32 aStateFlags,
|
|
|
|
nsresult aStatus,
|
|
|
|
nsIDownload *aDownload);
|
|
|
|
|
2007-05-21 17:03:33 -07:00
|
|
|
nsDownload *FindDownload(PRUint32 aID);
|
2007-09-26 00:26:06 -07:00
|
|
|
|
2007-10-24 15:34:02 -07:00
|
|
|
/**
|
|
|
|
* First try to resume the download, and if that fails, retry it.
|
|
|
|
*
|
|
|
|
* @param aDl The download to resume and/or retry.
|
|
|
|
*/
|
|
|
|
nsresult ResumeRetry(nsDownload *aDl);
|
|
|
|
|
2007-10-24 15:31:49 -07:00
|
|
|
/**
|
|
|
|
* Pause all active downloads and remember if they should try to auto-resume
|
|
|
|
* when the download manager starts again.
|
|
|
|
*
|
|
|
|
* @param aSetResume Indicate if the downloads that get paused should be set
|
|
|
|
* as auto-resume.
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
nsresult PauseAllDownloads(bool aSetResume);
|
2007-10-24 15:31:49 -07:00
|
|
|
|
2007-10-24 15:34:02 -07:00
|
|
|
/**
|
|
|
|
* Resume all paused downloads unless we're only supposed to do the automatic
|
|
|
|
* ones; in that case, try to retry them as well if resuming doesn't work.
|
|
|
|
*
|
|
|
|
* @param aResumeAll If true, all downloads will be resumed; otherwise, only
|
|
|
|
* those that are marked as auto-resume will resume.
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
nsresult ResumeAllDownloads(bool aResumeAll);
|
2007-10-24 15:34:02 -07:00
|
|
|
|
2007-09-26 00:26:06 -07:00
|
|
|
/**
|
|
|
|
* Stop tracking the active downloads. Only use this when we're about to quit
|
|
|
|
* the download manager because we destroy our list of active downloads to
|
|
|
|
* break the dlmgr<->dl cycle. Active downloads that aren't real-paused will
|
|
|
|
* be canceled.
|
|
|
|
*/
|
|
|
|
nsresult RemoveAllDownloads();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-04-22 16:37:00 -07:00
|
|
|
/**
|
|
|
|
* Find all downloads from a source URI and delete them.
|
|
|
|
*
|
|
|
|
* @param aURI
|
|
|
|
* The source URI to remove downloads
|
|
|
|
*/
|
|
|
|
nsresult RemoveDownloadsForURI(nsIURI *aURI);
|
|
|
|
|
2008-03-19 18:16:02 -07:00
|
|
|
/**
|
|
|
|
* Callback used for resuming downloads after getting a wake notification.
|
|
|
|
*
|
|
|
|
* @param aTimer
|
|
|
|
* Timer object fired after some delay after a wake notification
|
|
|
|
* @param aClosure
|
|
|
|
* nsDownloadManager object used to resume downloads
|
|
|
|
*/
|
|
|
|
static void ResumeOnWakeCallback(nsITimer *aTimer, void *aClosure);
|
|
|
|
nsCOMPtr<nsITimer> mResumeOnWakeTimer;
|
|
|
|
|
2007-09-17 13:49:24 -07:00
|
|
|
void ConfirmCancelDownloads(PRInt32 aCount,
|
|
|
|
nsISupportsPRBool *aCancelDownloads,
|
|
|
|
const PRUnichar *aTitle,
|
|
|
|
const PRUnichar *aCancelMessageMultiple,
|
|
|
|
const PRUnichar *aCancelMessageSingle,
|
|
|
|
const PRUnichar *aDontCancelButton);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-09-17 13:49:24 -07:00
|
|
|
PRInt32 GetRetentionBehavior();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-01-26 13:11:31 -08:00
|
|
|
/**
|
|
|
|
* Type to indicate possible behaviors for active downloads across sessions.
|
|
|
|
*
|
|
|
|
* Possible values are:
|
|
|
|
* QUIT_AND_RESUME - downloads should be auto-resumed
|
|
|
|
* QUIT_AND_PAUSE - downloads should be paused
|
|
|
|
* QUIT_AND_CANCEL - downloads should be cancelled
|
|
|
|
*/
|
|
|
|
enum QuitBehavior {
|
|
|
|
QUIT_AND_RESUME = 0,
|
|
|
|
QUIT_AND_PAUSE = 1,
|
|
|
|
QUIT_AND_CANCEL = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates user-set behavior for active downloads across sessions,
|
|
|
|
*
|
|
|
|
* @return value of user-set pref for active download behavior
|
|
|
|
*/
|
|
|
|
enum QuitBehavior GetQuitBehavior();
|
|
|
|
|
2008-11-03 15:22:21 -08:00
|
|
|
void OnEnterPrivateBrowsingMode();
|
|
|
|
void OnLeavePrivateBrowsingMode();
|
|
|
|
|
2008-10-10 18:15:51 -07:00
|
|
|
// Virus scanner for windows
|
2008-10-14 06:48:55 -07:00
|
|
|
#ifdef DOWNLOAD_SCANNER
|
|
|
|
private:
|
2009-08-11 10:37:38 -07:00
|
|
|
nsDownloadScanner* mScanner;
|
2008-10-14 06:48:55 -07:00
|
|
|
#endif
|
2008-10-10 18:15:51 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
private:
|
2007-05-25 16:47:53 -07:00
|
|
|
nsCOMArray<nsIDownloadProgressListener> mListeners;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMPtr<nsIStringBundle> mBundle;
|
2007-05-21 17:03:33 -07:00
|
|
|
nsCOMPtr<mozIStorageConnection> mDBConn;
|
|
|
|
nsCOMArray<nsDownload> mCurrentDownloads;
|
|
|
|
nsCOMPtr<nsIObserverService> mObserverService;
|
2007-07-02 10:29:59 -07:00
|
|
|
nsCOMPtr<mozIStorageStatement> mUpdateDownloadStatement;
|
2008-04-22 16:37:00 -07:00
|
|
|
nsCOMPtr<mozIStorageStatement> mGetIdsForURIStatement;
|
2008-05-01 07:55:04 -07:00
|
|
|
nsAutoPtr<mozStorageTransaction> mHistoryTransaction;
|
2007-05-21 17:03:33 -07:00
|
|
|
|
2008-10-15 00:24:52 -07:00
|
|
|
enum DatabaseType mDBType;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mInPrivateBrowsing;
|
2008-10-15 00:24:52 -07:00
|
|
|
|
2007-07-12 13:01:57 -07:00
|
|
|
static nsDownloadManager *gDownloadManagerService;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
friend class nsDownload;
|
|
|
|
};
|
|
|
|
|
|
|
|
class nsDownload : public nsIDownload
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIWEBPROGRESSLISTENER
|
|
|
|
NS_DECL_NSIWEBPROGRESSLISTENER2
|
|
|
|
NS_DECL_NSITRANSFER
|
|
|
|
NS_DECL_NSIDOWNLOAD
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
nsDownload();
|
|
|
|
virtual ~nsDownload();
|
|
|
|
|
2007-05-21 17:03:33 -07:00
|
|
|
/**
|
|
|
|
* This method MUST be called when changing states on a download. It will
|
2007-05-23 16:12:03 -07:00
|
|
|
* notify the download listener when a change happens. This also updates the
|
|
|
|
* database, by calling UpdateDB().
|
2007-05-21 17:03:33 -07:00
|
|
|
*/
|
2007-05-23 16:12:03 -07:00
|
|
|
nsresult SetState(DownloadState aState);
|
2007-05-21 17:03:33 -07:00
|
|
|
|
2007-10-02 08:03:16 -07:00
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* Finish up the download by breaking reference cycles and clearing unneeded
|
|
|
|
* data. Additionally, the download removes itself from the download
|
|
|
|
* manager's list of current downloads.
|
|
|
|
*
|
|
|
|
* NOTE: This method removes the cycle created when starting the download, so
|
|
|
|
* make sure to use kungFuDeathGrip if you want to access member variables.
|
|
|
|
*/
|
|
|
|
void Finalize();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-10-02 08:03:16 -07:00
|
|
|
/**
|
|
|
|
* For finished resumed downloads that came in from exthandler, perform the
|
|
|
|
* action that would have been done if the download wasn't resumed.
|
|
|
|
*/
|
|
|
|
nsresult ExecuteDesiredAction();
|
2007-05-21 17:03:33 -07:00
|
|
|
|
2007-10-02 08:03:16 -07:00
|
|
|
/**
|
|
|
|
* Move the temporary file to the final destination by removing the existing
|
|
|
|
* dummy target and renaming the temporary.
|
|
|
|
*/
|
|
|
|
nsresult MoveTempToTarget();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Update the start time which also implies the last update time is the same.
|
|
|
|
*/
|
2007-05-21 17:03:33 -07:00
|
|
|
void SetStartTime(PRInt64 aStartTime);
|
|
|
|
|
2007-10-01 17:16:12 -07:00
|
|
|
/**
|
|
|
|
* Update the amount of bytes transferred and max bytes; and recalculate the
|
|
|
|
* download percent.
|
|
|
|
*/
|
|
|
|
void SetProgressBytes(PRInt64 aCurrBytes, PRInt64 aMaxBytes);
|
|
|
|
|
2007-09-17 15:41:15 -07:00
|
|
|
/**
|
|
|
|
* Pause the download, but in certain cases it might get fake-paused instead
|
|
|
|
* of real-paused.
|
|
|
|
*/
|
|
|
|
nsresult Pause();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* All this does is cancel the connection that the download is using. It does
|
|
|
|
* not remove it from the download manager.
|
|
|
|
*/
|
|
|
|
nsresult Cancel();
|
|
|
|
|
|
|
|
/**
|
2008-01-21 19:43:02 -08:00
|
|
|
* Resume the download.
|
2007-09-17 15:41:15 -07:00
|
|
|
*/
|
|
|
|
nsresult Resume();
|
|
|
|
|
2007-09-17 14:16:16 -07:00
|
|
|
/**
|
|
|
|
* Download is not transferring?
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsPaused();
|
2007-09-17 14:16:16 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Download can continue from the middle of a transfer?
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsResumable();
|
2007-09-17 14:16:16 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Download was resumed?
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool WasResumed();
|
2007-09-17 14:16:16 -07:00
|
|
|
|
2007-10-24 15:23:13 -07:00
|
|
|
/**
|
|
|
|
* Indicates if the download should try to automatically resume or not.
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool ShouldAutoResume();
|
2007-10-24 15:23:13 -07:00
|
|
|
|
2007-09-17 14:02:39 -07:00
|
|
|
/**
|
|
|
|
* Download is in a state to stop and complete the download?
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsFinishable();
|
2007-09-17 14:02:39 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Download is totally done transferring and all?
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsFinished();
|
2007-09-17 14:02:39 -07:00
|
|
|
|
2007-10-02 08:03:16 -07:00
|
|
|
/**
|
|
|
|
* Update the DB with the current state of the download including time,
|
|
|
|
* download state and other values not known when first creating the
|
|
|
|
* download DB entry.
|
|
|
|
*/
|
|
|
|
nsresult UpdateDB();
|
|
|
|
|
2007-10-01 17:39:50 -07:00
|
|
|
/**
|
|
|
|
* Fail a download because of a failure status and prompt the provided
|
|
|
|
* message or use a generic download failure message if nsnull.
|
|
|
|
*/
|
|
|
|
nsresult FailDownload(nsresult aStatus, const PRUnichar *aMessage);
|
|
|
|
|
2007-10-24 15:19:04 -07:00
|
|
|
/**
|
|
|
|
* Opens the downloaded file with the appropriate application, which is
|
|
|
|
* either the OS default, MIME type default, or the one selected by the user.
|
|
|
|
*
|
|
|
|
* This also adds the temporary file to the "To be deleted on Exit" list, if
|
|
|
|
* the corresponding user preference is set (except on OS X).
|
|
|
|
*
|
|
|
|
* This function was adopted from nsExternalAppHandler::OpenWithApplication
|
|
|
|
* (uriloader/exthandler/nsExternalHelperAppService.cpp).
|
|
|
|
*/
|
|
|
|
nsresult OpenWithApplication();
|
|
|
|
|
2007-09-17 13:49:24 -07:00
|
|
|
nsDownloadManager *mDownloadManager;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMPtr<nsIURI> mTarget;
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsString mDisplayName;
|
2007-09-05 21:59:34 -07:00
|
|
|
nsCString mEntityID;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsCOMPtr<nsIURI> mSource;
|
2007-08-17 16:05:26 -07:00
|
|
|
nsCOMPtr<nsIURI> mReferrer;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMPtr<nsICancelable> mCancelable;
|
|
|
|
nsCOMPtr<nsIRequest> mRequest;
|
|
|
|
nsCOMPtr<nsILocalFile> mTempFile;
|
|
|
|
nsCOMPtr<nsIMIMEInfo> mMIMEInfo;
|
2007-09-17 13:49:24 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
DownloadState mDownloadState;
|
2007-09-17 13:49:24 -07:00
|
|
|
DownloadType mDownloadType;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-05-21 17:03:33 -07:00
|
|
|
PRUint32 mID;
|
2007-03-22 10:30:00 -07:00
|
|
|
PRInt32 mPercentComplete;
|
2007-09-17 13:40:47 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* These bytes are based on the position of where the request started, so 0
|
|
|
|
* doesn't necessarily mean we have nothing. Use GetAmountTransferred and
|
|
|
|
* GetSize for the real transferred amount and size.
|
|
|
|
*/
|
2007-10-01 17:16:12 -07:00
|
|
|
PRInt64 mCurrBytes;
|
|
|
|
PRInt64 mMaxBytes;
|
2007-09-17 13:40:47 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
PRTime mStartTime;
|
|
|
|
PRTime mLastUpdate;
|
2007-10-01 16:57:48 -07:00
|
|
|
PRInt64 mResumedAt;
|
2007-03-22 10:30:00 -07:00
|
|
|
double mSpeed;
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mHasMultipleFiles;
|
2008-01-27 14:38:37 -08:00
|
|
|
|
2007-10-24 15:23:13 -07:00
|
|
|
/**
|
|
|
|
* Track various states of the download trying to auto-resume when starting
|
|
|
|
* the download manager or restoring from a crash.
|
|
|
|
*
|
|
|
|
* DONT_RESUME: Don't automatically resume the download
|
|
|
|
* AUTO_RESUME: Automaically resume the download
|
|
|
|
*/
|
|
|
|
enum AutoResume { DONT_RESUME, AUTO_RESUME };
|
|
|
|
AutoResume mAutoResume;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
friend class nsDownloadManager;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|