diff options
author | Marco Pesenti Gritti <marco@gnome.org> | 2003-10-18 21:48:17 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2003-10-18 21:48:17 +0800 |
commit | 850649e3b65a15efa73d5c34b5c14d9b9cf5ef09 (patch) | |
tree | 570b99cba0e3b6cce7b47a85c4b810848a121af6 /embed/mozilla/EphyHeaderSniffer.cpp | |
parent | 8e878e61d90213c812163e1cf5a56381ff8cb641 (diff) | |
download | gsoc2013-epiphany-850649e3b65a15efa73d5c34b5c14d9b9cf5ef09.tar gsoc2013-epiphany-850649e3b65a15efa73d5c34b5c14d9b9cf5ef09.tar.gz gsoc2013-epiphany-850649e3b65a15efa73d5c34b5c14d9b9cf5ef09.tar.bz2 gsoc2013-epiphany-850649e3b65a15efa73d5c34b5c14d9b9cf5ef09.tar.lz gsoc2013-epiphany-850649e3b65a15efa73d5c34b5c14d9b9cf5ef09.tar.xz gsoc2013-epiphany-850649e3b65a15efa73d5c34b5c14d9b9cf5ef09.tar.zst gsoc2013-epiphany-850649e3b65a15efa73d5c34b5c14d9b9cf5ef09.zip |
Add nsIAuthPrompt implementation, necessary to make downloads on
2003-10-18 Marco Pesenti Gritti <marco@gnome.org>
* embed/mozilla/EphyHeaderSniffer.cpp:
* embed/mozilla/EphyHeaderSniffer.h:
Add nsIAuthPrompt implementation, necessary
to make downloads on authenticated pages work.
Diffstat (limited to 'embed/mozilla/EphyHeaderSniffer.cpp')
-rw-r--r-- | embed/mozilla/EphyHeaderSniffer.cpp | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/embed/mozilla/EphyHeaderSniffer.cpp b/embed/mozilla/EphyHeaderSniffer.cpp index fe0e6ac4a..78135fe35 100644 --- a/embed/mozilla/EphyHeaderSniffer.cpp +++ b/embed/mozilla/EphyHeaderSniffer.cpp @@ -40,6 +40,7 @@ #include "EphyHeaderSniffer.h" #include "netCore.h" +#include "nsReadableUtils.h" #include "nsIChannel.h" #include "nsIHttpChannel.h" #include "nsIURL.h" @@ -64,13 +65,14 @@ EphyHeaderSniffer::EphyHeaderSniffer(nsIWebBrowserPersist* aPersist, MozillaEmbe , mDefaultFilename(aSuggestedFilename) , mBypassCache(aBypassCache) { + mPrompt = do_GetService("@mozilla.org/embedcomp/prompt-service;1"); } EphyHeaderSniffer::~EphyHeaderSniffer() { } -NS_IMPL_ISUPPORTS1(EphyHeaderSniffer, nsIWebProgressListener) +NS_IMPL_ISUPPORTS2(EphyHeaderSniffer, nsIWebProgressListener, nsIAuthPrompt) // Implementation of nsIWebProgressListener /* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aStateFlags, in unsigned long aStatus); */ @@ -250,3 +252,42 @@ nsresult EphyHeaderSniffer::InitiateDownload(nsISupports* inSourceData, nsILocal return rv; } + +NS_IMETHODIMP EphyHeaderSniffer::Prompt (const PRUnichar *dialogTitle, const PRUnichar *text, + const PRUnichar *passwordRealm, PRUint32 savePassword, + const PRUnichar *defaultText, PRUnichar **result, PRBool *_retval) +{ + PRBool checkValue; + + if (defaultText) *result = ToNewUnicode(nsDependentString(defaultText)); + checkValue = savePassword; + + return mPrompt->Prompt (nsnull, dialogTitle, text, result, + passwordRealm, &checkValue, _retval); +} + +NS_IMETHODIMP EphyHeaderSniffer::PromptUsernameAndPassword (const PRUnichar *dialogTitle, const PRUnichar *text, + const PRUnichar *passwordRealm, PRUint32 savePassword, + PRUnichar **user, PRUnichar **pwd, PRBool *_retval) +{ + PRBool checkValue; + + *_retval = savePassword; + checkValue = savePassword; + + return mPrompt->PromptUsernameAndPassword (nsnull, dialogTitle, text, user, pwd, + passwordRealm, &checkValue, _retval); +} + +NS_IMETHODIMP EphyHeaderSniffer::PromptPassword (const PRUnichar *dialogTitle, const PRUnichar *text, + const PRUnichar *passwordRealm, PRUint32 savePassword, + PRUnichar **pwd, PRBool *_retval) +{ + PRBool checkValue; + + *_retval = savePassword; + checkValue = savePassword; + + return mPrompt->PromptPassword (nsnull, dialogTitle, text, pwd, + passwordRealm, &checkValue, _retval); +} |