diff options
author | Marco Pesenti Gritti <marco@gnome.org> | 2003-12-22 07:48:39 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2003-12-22 07:48:39 +0800 |
commit | f606a4b6e99b759e408b4b9e7e7a8dca25b306f4 (patch) | |
tree | 659b9c0b0100747de3521784e68fce200a5cd58e | |
parent | ec26f0d7fa45ee4a88f4834347f9a705b06a0ebb (diff) | |
download | gsoc2013-epiphany-f606a4b6e99b759e408b4b9e7e7a8dca25b306f4.tar gsoc2013-epiphany-f606a4b6e99b759e408b4b9e7e7a8dca25b306f4.tar.gz gsoc2013-epiphany-f606a4b6e99b759e408b4b9e7e7a8dca25b306f4.tar.bz2 gsoc2013-epiphany-f606a4b6e99b759e408b4b9e7e7a8dca25b306f4.tar.lz gsoc2013-epiphany-f606a4b6e99b759e408b4b9e7e7a8dca25b306f4.tar.xz gsoc2013-epiphany-f606a4b6e99b759e408b4b9e7e7a8dca25b306f4.tar.zst gsoc2013-epiphany-f606a4b6e99b759e408b4b9e7e7a8dca25b306f4.zip |
Correctly cancel the download instead of just cancelling the request.
2003-12-22 Marco Pesenti Gritti <marco@gnome.org>
* embed/mozilla/MozDownload.cpp:
* embed/mozilla/MozDownload.h:
Correctly cancel the download instead of just
cancelling the request.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | embed/mozilla/MozDownload.cpp | 28 | ||||
-rw-r--r-- | embed/mozilla/MozDownload.h | 4 |
3 files changed, 22 insertions, 18 deletions
@@ -1,3 +1,11 @@ +2003-12-22 Marco Pesenti Gritti <marco@gnome.org> + + * embed/mozilla/MozDownload.cpp: + * embed/mozilla/MozDownload.h: + + Correctly cancel the download instead of just + cancelling the request. + 2003-12-21 Xan Lopez <xan@gnome.org> * embed/downloader-view.c: (download_dialog_pause_cb): diff --git a/embed/mozilla/MozDownload.cpp b/embed/mozilla/MozDownload.cpp index 2b9a9e4b6..62ff29c87 100644 --- a/embed/mozilla/MozDownload.cpp +++ b/embed/mozilla/MozDownload.cpp @@ -58,7 +58,6 @@ const char* const persistContractID = "@mozilla.org/embedding/browser/nsWebBrows MozDownload::MozDownload() : mGotFirstStateChange(false), mIsNetworkTransfer(false), - mUserCanceled(false), mStatus(NS_OK), mEmbedPersist(nsnull), mDownloadState(EPHY_DOWNLOAD_DOWNLOADING) @@ -251,7 +250,9 @@ MozDownload::GetObserver(nsIObserver **aObserver) NS_IMETHODIMP MozDownload::SetObserver(nsIObserver *aObserver) { - return NS_ERROR_NOT_IMPLEMENTED; + mObserver = aObserver; + + return NS_OK; } NS_IMETHODIMP @@ -320,15 +321,6 @@ MozDownload::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest mLastUpdate = now; - if (mUserCanceled) - { - if (aRequest) - { - aRequest->Cancel(NS_BINDING_ABORTED); - } - mUserCanceled = false; - } - if (aMaxTotalProgress == -1) { mPercentComplete = -1; @@ -371,11 +363,15 @@ MozDownload::OnSecurityChange (nsIWebProgress *aWebProgress, nsIRequest *aReques void MozDownload::Cancel() { - mUserCanceled = true; - /* nsWebBrowserPersist does the right thing: After canceling, next time through - * OnStateChange(), aStatus != NS_OK. This isn't the case with nsExternalHelperAppService.*/ - if (!mWebPersist) - mStatus = NS_ERROR_ABORT; + if (mWebPersist) + { + mWebPersist->CancelSave (); + } + + if (mObserver) + { + mObserver->Observe (nsnull, "oncancel", nsnull); + } } void diff --git a/embed/mozilla/MozDownload.h b/embed/mozilla/MozDownload.h index 7f40bc327..ec06a1cad 100644 --- a/embed/mozilla/MozDownload.h +++ b/embed/mozilla/MozDownload.h @@ -118,9 +118,9 @@ protected: PRInt32 mCurrentProgress; bool mGotFirstStateChange, mIsNetworkTransfer; - bool mUserCanceled; nsresult mStatus; - + + nsCOMPtr<nsIObserver> mObserver; nsCOMPtr<nsIWebBrowserPersist> mWebPersist; nsCOMPtr<nsIRequest> mRequest; EphyDownload *mEphyDownload; |