diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-01-09 21:39:17 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-01-09 21:39:17 +0800 |
commit | 86c68923be5ec3ca9f313d17dec3bf9259c211f1 (patch) | |
tree | dca781a1a4280f2c8eac12cc8562bc29e0831bee /embed/mozilla | |
parent | d5c17ea5ab31405cab0ebe3ca6e4d9e52d4d5e47 (diff) | |
download | gsoc2013-epiphany-86c68923be5ec3ca9f313d17dec3bf9259c211f1.tar gsoc2013-epiphany-86c68923be5ec3ca9f313d17dec3bf9259c211f1.tar.gz gsoc2013-epiphany-86c68923be5ec3ca9f313d17dec3bf9259c211f1.tar.bz2 gsoc2013-epiphany-86c68923be5ec3ca9f313d17dec3bf9259c211f1.tar.lz gsoc2013-epiphany-86c68923be5ec3ca9f313d17dec3bf9259c211f1.tar.xz gsoc2013-epiphany-86c68923be5ec3ca9f313d17dec3bf9259c211f1.tar.zst gsoc2013-epiphany-86c68923be5ec3ca9f313d17dec3bf9259c211f1.zip |
Only implement nsITransfer, if possible.
2005-01-09 Christian Persch <chpe@cvs.gnome.org>
* configure.in:
* embed/mozilla/MozDownload.cpp:
* embed/mozilla/MozDownload.h:
Only implement nsITransfer, if possible.
Diffstat (limited to 'embed/mozilla')
-rw-r--r-- | embed/mozilla/MozDownload.cpp | 55 | ||||
-rw-r--r-- | embed/mozilla/MozDownload.h | 25 |
2 files changed, 55 insertions, 25 deletions
diff --git a/embed/mozilla/MozDownload.cpp b/embed/mozilla/MozDownload.cpp index f680de6e7..674a4fad9 100644 --- a/embed/mozilla/MozDownload.cpp +++ b/embed/mozilla/MozDownload.cpp @@ -81,7 +81,11 @@ MozDownload::~MozDownload() NS_ASSERTION (!mEphyDownload, "MozillaDownload still alive!"); } +#ifdef HAVE_NSITRANSFER_H +NS_IMPL_ISUPPORTS1(MozDownload, nsITransfer) +#else NS_IMPL_ISUPPORTS3(MozDownload, nsIDownload, nsITransfer, nsIWebProgressListener) +#endif NS_IMETHODIMP MozDownload::InitForEmbed (nsIURI *aSource, nsIURI *aTarget, const PRUnichar *aDisplayName, @@ -153,6 +157,7 @@ MozDownload::GetSource(nsIURI **aSource) return NS_OK; } +#ifndef HAVE_NSITRANSFER_H NS_IMETHODIMP MozDownload::GetTarget(nsIURI **aTarget) { @@ -161,6 +166,7 @@ MozDownload::GetTarget(nsIURI **aTarget) return NS_OK; } +#endif NS_IMETHODIMP MozDownload::GetTargetFile (nsILocalFile** aTargetFile) @@ -177,6 +183,7 @@ MozDownload::GetTargetFile (nsILocalFile** aTargetFile) return rv; } +#ifndef HAVE_NSITRANSFER_H NS_IMETHODIMP MozDownload::GetPersist(nsIWebBrowserPersist **aPersist) { @@ -185,6 +192,7 @@ MozDownload::GetPersist(nsIWebBrowserPersist **aPersist) return NS_OK; } +#endif NS_IMETHODIMP MozDownload::GetPercentComplete(PRInt32 *aPercentComplete) @@ -195,6 +203,7 @@ MozDownload::GetPercentComplete(PRInt32 *aPercentComplete) return NS_OK; } +#ifndef HAVE_NSITRANSFER_H #ifdef MOZ_NSIDOWNLOAD_GETSIZE /* readonly attribute PRUint64 amountTransferred; */ NS_IMETHODIMP @@ -209,52 +218,54 @@ MozDownload::GetSize(PRUint64 *aSize) { return NS_ERROR_NOT_IMPLEMENTED; } -#endif /* MOZ_NSIDOWNLOAD_GETSIZE */ + +#endif /* MOZ_NSIDOWNLOAD_GETSIZE */ NS_IMETHODIMP -MozDownload::GetTotalProgress(PRInt32 *aTotalProgress) +MozDownload::GetStartTime(PRInt64 *aStartTime) { - NS_ENSURE_ARG_POINTER(aTotalProgress); - *aTotalProgress = mTotalProgress; + NS_ENSURE_ARG_POINTER(aStartTime); + *aStartTime = mStartTime; return NS_OK; } NS_IMETHODIMP -MozDownload::GetCurrentProgress(PRInt32 *aCurrentProgress) +MozDownload::GetDisplayName(PRUnichar * *aDisplayName) { - NS_ENSURE_ARG_POINTER(aCurrentProgress); - *aCurrentProgress = mCurrentProgress; - - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP -MozDownload::GetState(EphyDownloadState *aDownloadState) +MozDownload::SetDisplayName(const PRUnichar * aDisplayName) { - NS_ENSURE_ARG_POINTER(aDownloadState); - *aDownloadState = mDownloadState; - - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } +#endif /* !HAVE_NSITRANSFER_H */ NS_IMETHODIMP -MozDownload::GetDisplayName(PRUnichar * *aDisplayName) +MozDownload::GetTotalProgress(PRInt32 *aTotalProgress) { - return NS_ERROR_NOT_IMPLEMENTED; + NS_ENSURE_ARG_POINTER(aTotalProgress); + *aTotalProgress = mTotalProgress; + + return NS_OK; } NS_IMETHODIMP -MozDownload::SetDisplayName(const PRUnichar * aDisplayName) +MozDownload::GetCurrentProgress(PRInt32 *aCurrentProgress) { - return NS_ERROR_NOT_IMPLEMENTED; + NS_ENSURE_ARG_POINTER(aCurrentProgress); + *aCurrentProgress = mCurrentProgress; + + return NS_OK; } NS_IMETHODIMP -MozDownload::GetStartTime(PRInt64 *aStartTime) +MozDownload::GetState(EphyDownloadState *aDownloadState) { - NS_ENSURE_ARG_POINTER(aStartTime); - *aStartTime = mStartTime; + NS_ENSURE_ARG_POINTER(aDownloadState); + *aDownloadState = mDownloadState; return NS_OK; } @@ -318,7 +329,7 @@ MozDownload::OnStateChange (nsIWebProgress *aWebProgress, nsIRequest *aRequest, if (aStateFlags & STATE_STOP) { /* Keep us alive */ - nsCOMPtr<nsIDownload> kungFuDeathGrip(this); + nsCOMPtr<nsITransfer> kungFuDeathGrip(this); mDownloadState = NS_SUCCEEDED (aStatus) ? EPHY_DOWNLOAD_COMPLETED : EPHY_DOWNLOAD_FAILED; if (mEphyDownload) diff --git a/embed/mozilla/MozDownload.h b/embed/mozilla/MozDownload.h index ed01d248e..d3ba228ce 100644 --- a/embed/mozilla/MozDownload.h +++ b/embed/mozilla/MozDownload.h @@ -51,7 +51,6 @@ #include "ephy-download.h" #include "ephy-embed-shell.h" -#include <nsIDownload.h> #include <nsIWebProgressListener.h> #include <nsIDOMDocument.h> #include <nsIURI.h> @@ -61,6 +60,12 @@ #include <nsIRequest.h> #include <nsIMIMEInfo.h> +#ifdef HAVE_NSITRANSFER_H +#include <nsITransfer.h> +#else +#include <nsIDownload.h> +#endif + #include <libgnomevfs/gnome-vfs-mime-handlers.h> /* MozDownload @@ -91,17 +96,31 @@ nsresult InitiateMozillaDownload (nsIDOMDocument *domDocument, nsIURI *sourceUri PRInt32 aMaxSize); nsresult BuildDownloadPath (const char *defaultFileName, nsILocalFile **_retval); -class MozDownload : public nsIDownload, +class MozDownload : +#ifdef HAVE_NSITRANSFER_H + public nsITransfer +#else + public nsIDownload, public nsIWebProgressListener +#endif { public: MozDownload(); virtual ~MozDownload(); NS_DECL_ISUPPORTS + NS_DECL_NSIWEBPROGRESSLISTENER NS_DECL_NSITRANSFER +#ifndef HAVE_NSITRANSFER_H NS_DECL_NSIDOWNLOAD - NS_DECL_NSIWEBPROGRESSLISTENER +#endif + +#ifdef HAVE_NSITRANSFER_H + nsresult GetMIMEInfo (nsIMIMEInfo **aMIMEInfo); + nsresult GetTargetFile (nsILocalFile **aFile); + nsresult GetSource(nsIURI * *aSource); + nsresult GetPercentComplete(PRInt32 *aPercentComplete); +#endif virtual void Cancel(); virtual void Pause(); |