From 9e4d594ee6ccc51bf5dca17b8f790d7fa1a917c2 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Sat, 8 May 2004 13:34:55 +0000 Subject: Forward nsIAuthPrompt interface to the single sign-on prompt 2004-05-08 Christian Persch * embed/mozilla/EphyHeaderSniffer.cpp: * embed/mozilla/EphyHeaderSniffer.h: Forward nsIAuthPrompt interface to the single sign-on prompt --- ChangeLog | 8 +++++++ embed/mozilla/EphyHeaderSniffer.cpp | 42 ++++++++----------------------------- embed/mozilla/EphyHeaderSniffer.h | 4 ++-- 3 files changed, 19 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3053f7d79..75e7593ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-05-08 Christian Persch + + * embed/mozilla/EphyHeaderSniffer.cpp: + * embed/mozilla/EphyHeaderSniffer.h: + + Forward nsIAuthPrompt interface to the single sign-on prompt + implementation. + 2004-05-07 Christian Persch * 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 #include #include +#include #ifdef ALLOW_PRIVATE_STRINGS #include @@ -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 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 mPostData; nsCString mContentType; nsCString mContentDisposition; - nsCOMPtr mPrompt; + nsCOMPtr mAuthPrompt; }; -- cgit v1.2.3