Bug 396488 - Clean up nsDownloadManager - spaces and stars. Patch by Edward Lee <edilee@gmail.com>. r=sdwilsh, a=mconnor

This commit is contained in:
sdwilsh@shawnwilsher.com 2007-09-17 13:49:24 -07:00
parent cc29cb6a03
commit d348d25ede
2 changed files with 103 additions and 112 deletions

View File

@ -1021,14 +1021,14 @@ nsDownloadManager::GetUserDownloadsDirectory(nsILocalFile **aResult)
NS_IMETHODIMP
nsDownloadManager::AddDownload(DownloadType aDownloadType,
nsIURI* aSource,
nsIURI* aTarget,
nsIURI *aSource,
nsIURI *aTarget,
const nsAString& aDisplayName,
nsIMIMEInfo *aMIMEInfo,
PRTime aStartTime,
nsILocalFile* aTempFile,
nsICancelable* aCancelable,
nsIDownload** aDownload)
nsILocalFile *aTempFile,
nsICancelable *aCancelable,
nsIDownload **aDownload)
{
NS_ENSURE_ARG_POINTER(aSource);
NS_ENSURE_ARG_POINTER(aTarget);
@ -1210,7 +1210,6 @@ NS_IMETHODIMP
nsDownloadManager::RemoveDownload(PRUint32 aID)
{
nsDownload *dl = FindDownload(aID);
NS_ASSERTION(!dl, "Can't call RemoveDownload on a download in progress!");
if (dl)
return NS_ERROR_FAILURE;
@ -1302,7 +1301,6 @@ nsresult
nsDownloadManager::PauseResumeDownload(PRUint32 aID, PRBool aPause)
{
nsDownload *dl = FindDownload(aID);
if (!dl)
return NS_ERROR_FAILURE;
@ -1374,7 +1372,7 @@ nsDownloadManager::NotifyListenersOnStateChange(nsIWebProgress *aProgress,
NS_IMETHODIMP
nsDownloadManager::Observe(nsISupports *aSubject,
const char *aTopic,
const PRUnichar* aData)
const PRUnichar *aData)
{
PRInt32 currDownloadCount = mCurrentDownloads.Count();
@ -1437,11 +1435,11 @@ nsDownloadManager::Observe(nsISupports *aSubject,
void
nsDownloadManager::ConfirmCancelDownloads(PRInt32 aCount,
nsISupportsPRBool* aCancelDownloads,
const PRUnichar* aTitle,
const PRUnichar* aCancelMessageMultiple,
const PRUnichar* aCancelMessageSingle,
const PRUnichar* aDontCancelButton)
nsISupportsPRBool *aCancelDownloads,
const PRUnichar *aTitle,
const PRUnichar *aCancelMessageMultiple,
const PRUnichar *aCancelMessageSingle,
const PRUnichar *aDontCancelButton)
{
nsXPIDLString title, message, quitButton, dontQuitButton;
@ -1449,7 +1447,7 @@ nsDownloadManager::ConfirmCancelDownloads(PRInt32 aCount,
nsAutoString countString;
countString.AppendInt(aCount);
const PRUnichar* strings[1] = { countString.get() };
const PRUnichar *strings[1] = { countString.get() };
if (aCount > 1) {
mBundle->FormatStringFromName(aCancelMessageMultiple, strings, 1,
getter_Copies(message));
@ -1580,7 +1578,6 @@ nsDownload::SetState(DownloadState aState)
PRBool removeWhenDone =
mDownloadManager->GetRetentionBehavior() == 0;
// If downloads are automatically removed per the user's
// retention policy, there's no reason to make the text clickable
// because if it is, they'll click open the download manager and
@ -1721,7 +1718,7 @@ nsDownload::OnProgressChange64(nsIWebProgress *aWebProgress,
}
}
//Fetch the entityID
// Fetch the entityID
nsCOMPtr<nsIResumableChannel> resumableChannel(do_QueryInterface(aRequest));
if (resumableChannel) {
rv = resumableChannel->GetEntityID(mEntityID);
@ -1843,8 +1840,8 @@ nsDownload::OnStatusChange(nsIWebProgress *aWebProgress,
}
NS_IMETHODIMP
nsDownload::OnStateChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest, PRUint32 aStateFlags,
nsDownload::OnStateChange(nsIWebProgress *aWebProgress,
nsIRequest *aRequest, PRUint32 aStateFlags,
nsresult aStatus)
{
// Record the start time only if it hasn't been set.
@ -1865,7 +1862,6 @@ nsDownload::OnStateChange(nsIWebProgress* aWebProgress,
rv = channel->GetResponseStatus(&status);
// HTTP 450 - Blocked by parental control proxies
if (NS_SUCCEEDED(rv) && status == 450) {
// Cancel using the provided object
if (mCancelable)
(void)mCancelable->Cancel(NS_BINDING_ABORTED);
@ -1911,13 +1907,13 @@ nsDownload::OnSecurityChange(nsIWebProgress *aWebProgress,
// nsIDownload
NS_IMETHODIMP
nsDownload::Init(nsIURI* aSource,
nsIURI* aTarget,
nsDownload::Init(nsIURI *aSource,
nsIURI *aTarget,
const nsAString& aDisplayName,
nsIMIMEInfo *aMIMEInfo,
PRTime aStartTime,
nsILocalFile* aTempFile,
nsICancelable* aCancelable)
nsILocalFile *aTempFile,
nsICancelable *aCancelable)
{
NS_WARNING("Huh...how did we get here?!");
return NS_OK;
@ -1927,7 +1923,6 @@ NS_IMETHODIMP
nsDownload::GetState(PRInt16 *aState)
{
*aState = mDownloadState;
return NS_OK;
}
@ -1935,12 +1930,11 @@ NS_IMETHODIMP
nsDownload::GetDisplayName(nsAString &aDisplayName)
{
aDisplayName = mDisplayName;
return NS_OK;
}
NS_IMETHODIMP
nsDownload::GetCancelable(nsICancelable** aCancelable)
nsDownload::GetCancelable(nsICancelable **aCancelable)
{
*aCancelable = mCancelable;
NS_IF_ADDREF(*aCancelable);
@ -1948,7 +1942,7 @@ nsDownload::GetCancelable(nsICancelable** aCancelable)
}
NS_IMETHODIMP
nsDownload::GetTarget(nsIURI** aTarget)
nsDownload::GetTarget(nsIURI **aTarget)
{
*aTarget = mTarget;
NS_IF_ADDREF(*aTarget);
@ -1956,7 +1950,7 @@ nsDownload::GetTarget(nsIURI** aTarget)
}
NS_IMETHODIMP
nsDownload::GetSource(nsIURI** aSource)
nsDownload::GetSource(nsIURI **aSource)
{
*aSource = mSource;
NS_IF_ADDREF(*aSource);
@ -1964,35 +1958,35 @@ nsDownload::GetSource(nsIURI** aSource)
}
NS_IMETHODIMP
nsDownload::GetStartTime(PRInt64* aStartTime)
nsDownload::GetStartTime(PRInt64 *aStartTime)
{
*aStartTime = mStartTime;
return NS_OK;
}
NS_IMETHODIMP
nsDownload::GetPercentComplete(PRInt32* aPercentComplete)
nsDownload::GetPercentComplete(PRInt32 *aPercentComplete)
{
*aPercentComplete = mPercentComplete;
return NS_OK;
}
NS_IMETHODIMP
nsDownload::GetAmountTransferred(PRUint64* aAmountTransferred)
nsDownload::GetAmountTransferred(PRUint64 *aAmountTransferred)
{
*aAmountTransferred = mCurrBytes + mResumedAt;
return NS_OK;
}
NS_IMETHODIMP
nsDownload::GetSize(PRUint64* aSize)
nsDownload::GetSize(PRUint64 *aSize)
{
*aSize = mMaxBytes + (mMaxBytes != LL_MAXUINT ? mResumedAt : 0);
return NS_OK;
}
NS_IMETHODIMP
nsDownload::GetMIMEInfo(nsIMIMEInfo** aMIMEInfo)
nsDownload::GetMIMEInfo(nsIMIMEInfo **aMIMEInfo)
{
*aMIMEInfo = mMIMEInfo;
NS_IF_ADDREF(*aMIMEInfo);
@ -2000,7 +1994,7 @@ nsDownload::GetMIMEInfo(nsIMIMEInfo** aMIMEInfo)
}
NS_IMETHODIMP
nsDownload::GetTargetFile(nsILocalFile** aTargetFile)
nsDownload::GetTargetFile(nsILocalFile **aTargetFile)
{
nsresult rv;
@ -2015,7 +2009,7 @@ nsDownload::GetTargetFile(nsILocalFile** aTargetFile)
}
NS_IMETHODIMP
nsDownload::GetSpeed(double* aSpeed)
nsDownload::GetSpeed(double *aSpeed)
{
*aSpeed = mSpeed;
return NS_OK;
@ -2025,7 +2019,6 @@ NS_IMETHODIMP
nsDownload::GetId(PRUint32 *aId)
{
*aId = mID;
return NS_OK;
}
@ -2033,7 +2026,6 @@ NS_IMETHODIMP
nsDownload::GetReferrer(nsIURI **referrer)
{
NS_IF_ADDREF(*referrer = mReferrer);
return NS_OK;
}
@ -2172,7 +2164,7 @@ nsDownload::UpdateDB()
}
NS_ENSURE_SUCCESS(rv, rv);
//entityID
// entityID
rv = stmt->BindUTF8StringParameter(4, mEntityID);
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -111,7 +111,6 @@ protected:
void SendEvent(nsDownload *aDownload, const char *aTopic);
/**
* Adds a download with the specified information to the DB.
*
@ -152,11 +151,11 @@ protected:
void CompleteDownload(nsDownload *aDownload);
void ConfirmCancelDownloads(PRInt32 aCount,
nsISupportsPRBool* aCancelDownloads,
const PRUnichar* aTitle,
const PRUnichar* aCancelMessageMultiple,
const PRUnichar* aCancelMessageSingle,
const PRUnichar* aDontCancelButton);
nsISupportsPRBool *aCancelDownloads,
const PRUnichar *aTitle,
const PRUnichar *aCancelMessageMultiple,
const PRUnichar *aCancelMessageSingle,
const PRUnichar *aDontCancelButton);
PRInt32 GetRetentionBehavior();
nsresult ExecuteDesiredAction(nsDownload *aDownload);
@ -224,7 +223,7 @@ protected:
nsresult PauseResume(PRBool aPause);
nsDownloadManager* mDownloadManager;
nsDownloadManager *mDownloadManager;
nsCOMPtr<nsIURI> mTarget;
private: