aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2003-10-18 21:48:17 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2003-10-18 21:48:17 +0800
commit850649e3b65a15efa73d5c34b5c14d9b9cf5ef09 (patch)
tree570b99cba0e3b6cce7b47a85c4b810848a121af6 /embed
parent8e878e61d90213c812163e1cf5a56381ff8cb641 (diff)
downloadgsoc2013-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')
-rw-r--r--embed/mozilla/EphyHeaderSniffer.cpp43
-rw-r--r--embed/mozilla/EphyHeaderSniffer.h7
2 files changed, 48 insertions, 2 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);
+}
diff --git a/embed/mozilla/EphyHeaderSniffer.h b/embed/mozilla/EphyHeaderSniffer.h
index 9124cfa16..01f5b7bd8 100644
--- a/embed/mozilla/EphyHeaderSniffer.h
+++ b/embed/mozilla/EphyHeaderSniffer.h
@@ -45,9 +45,12 @@
#include "nsILocalFile.h"
#include "nsIInputStream.h"
#include "nsIDOMDocument.h"
+#include "nsIAuthPrompt.h"
+#include "nsIPromptService.h"
// Implementation of a header sniffer class that is used when saving Web pages and images.
-class EphyHeaderSniffer : public nsIWebProgressListener
+class EphyHeaderSniffer : public nsIWebProgressListener,
+ public nsIAuthPrompt
{
public:
EphyHeaderSniffer(nsIWebBrowserPersist* aPersist, MozillaEmbedPersist *aEmbedPersist,
@@ -58,6 +61,7 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIWEBPROGRESSLISTENER
+ NS_DECL_NSIAUTHPROMPT
protected:
@@ -76,5 +80,6 @@ private:
PRBool mBypassCache;
nsCString mContentType;
nsCString mContentDisposition;
+ nsCOMPtr<nsIPromptService> mPrompt;
};