diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | embed/mozilla/EphyHeaderSniffer.cpp | 42 | ||||
-rw-r--r-- | embed/mozilla/EphyHeaderSniffer.h | 4 |
3 files changed, 19 insertions, 35 deletions
@@ -1,3 +1,11 @@ +2004-05-08 Christian Persch <chpe@cvs.gnome.org> + + * embed/mozilla/EphyHeaderSniffer.cpp: + * embed/mozilla/EphyHeaderSniffer.h: + + Forward nsIAuthPrompt interface to the single sign-on prompt + implementation. + 2004-05-07 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/ContentHandler.cpp: diff --git a/embed/mozilla/EphyHeaderSniffer.cpp b/embed/mozilla/EphyHeaderSniffer.cpp index f34fe1407..b16b0f30f 100644 --- a/embed/mozilla/EphyHeaderSniffer.cpp +++ b/embed/mozilla/EphyHeaderSniffer.cpp @@ -67,6 +67,7 @@ #include <nsIDOMHTMLDocument.h> #include <nsIDownload.h> #include <nsIMIMEHeaderParam.h> +#include <nsIWindowWatcher.h> #ifdef ALLOW_PRIVATE_STRINGS #include <nsReadableUtils.h> @@ -82,9 +83,13 @@ EphyHeaderSniffer::EphyHeaderSniffer (nsIWebBrowserPersist* aPersist, MozillaEmb , mDocument(aDocument) , mPostData(aPostData) { - mPrompt = do_GetService("@mozilla.org/embedcomp/prompt-service;1"); + LOG ("EphyHeaderSniffer ctor (%p)", this) - LOG ("EphyHeaderSniffer ctor (%p)", this) + nsCOMPtr<nsIWindowWatcher> watcher + (do_GetService("@mozilla.org/embedcomp/window-watcher;1")); + if (!watcher) return; + + watcher->GetNewAuthPrompter (nsnull, getter_AddRefs (mAuthPrompt)); } EphyHeaderSniffer::~EphyHeaderSniffer() @@ -343,7 +348,8 @@ nsresult EphyHeaderSniffer::PerformSave (nsIURI* inOriginalURI) dialog = ephy_file_chooser_new (title ? title: _("Save"), GTK_WIDGET (window), GTK_FILE_CHOOSER_ACTION_SAVE, - key ? key : CONF_STATE_SAVE_DIR); + key ? key : CONF_STATE_SAVE_DIR, + TRUE); gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), filename); @@ -374,33 +380,3 @@ nsresult EphyHeaderSniffer::InitiateDownload (nsILocalFile *aDestFile) mContentType.get(), mOriginalURI, mEmbedPersist, mPostData, nsnull, -1); } - -NS_IMETHODIMP EphyHeaderSniffer::Prompt (const PRUnichar *dialogTitle, const PRUnichar *text, - const PRUnichar *passwordRealm, PRUint32 savePassword, - const PRUnichar *defaultText, PRUnichar **result, PRBool *_retval) -{ - if (defaultText) *result = ToNewUnicode(nsDependentString(defaultText)); - - return mPrompt->Prompt (nsnull, dialogTitle, text, result, - nsnull, nsnull, _retval); -} - -NS_IMETHODIMP EphyHeaderSniffer::PromptUsernameAndPassword (const PRUnichar *dialogTitle, const PRUnichar *text, - const PRUnichar *passwordRealm, PRUint32 savePassword, - PRUnichar **user, PRUnichar **pwd, PRBool *_retval) -{ - *_retval = savePassword; - - return mPrompt->PromptUsernameAndPassword (nsnull, dialogTitle, text, user, pwd, - nsnull, nsnull, _retval); -} - -NS_IMETHODIMP EphyHeaderSniffer::PromptPassword (const PRUnichar *dialogTitle, const PRUnichar *text, - const PRUnichar *passwordRealm, PRUint32 savePassword, - PRUnichar **pwd, PRBool *_retval) -{ - *_retval = savePassword; - - return mPrompt->PromptPassword (nsnull, dialogTitle, text, pwd, - nsnull, nsnull, _retval); -} diff --git a/embed/mozilla/EphyHeaderSniffer.h b/embed/mozilla/EphyHeaderSniffer.h index 74c27dbf3..5cef29168 100644 --- a/embed/mozilla/EphyHeaderSniffer.h +++ b/embed/mozilla/EphyHeaderSniffer.h @@ -65,7 +65,7 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSIWEBPROGRESSLISTENER - NS_DECL_NSIAUTHPROMPT + NS_FORWARD_SAFE_NSIAUTHPROMPT(mAuthPrompt) nsresult InitiateDownload (nsILocalFile *aDestFile); @@ -83,6 +83,6 @@ private: nsCOMPtr<nsIInputStream> mPostData; nsCString mContentType; nsCString mContentDisposition; - nsCOMPtr<nsIPromptService> mPrompt; + nsCOMPtr<nsIAuthPrompt> mAuthPrompt; }; |