diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-05-08 21:34:55 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-05-08 21:34:55 +0800 |
commit | 9e4d594ee6ccc51bf5dca17b8f790d7fa1a917c2 (patch) | |
tree | 361cd3bfb50f7ac8f9bbd0b93711e716dfbdd7f9 /embed | |
parent | a749eeb5995c534f68a2c38009ca4f325fef2a7c (diff) | |
download | gsoc2013-epiphany-9e4d594ee6ccc51bf5dca17b8f790d7fa1a917c2.tar gsoc2013-epiphany-9e4d594ee6ccc51bf5dca17b8f790d7fa1a917c2.tar.gz gsoc2013-epiphany-9e4d594ee6ccc51bf5dca17b8f790d7fa1a917c2.tar.bz2 gsoc2013-epiphany-9e4d594ee6ccc51bf5dca17b8f790d7fa1a917c2.tar.lz gsoc2013-epiphany-9e4d594ee6ccc51bf5dca17b8f790d7fa1a917c2.tar.xz gsoc2013-epiphany-9e4d594ee6ccc51bf5dca17b8f790d7fa1a917c2.tar.zst gsoc2013-epiphany-9e4d594ee6ccc51bf5dca17b8f790d7fa1a917c2.zip |
Forward nsIAuthPrompt interface to the single sign-on prompt
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
Diffstat (limited to 'embed')
-rw-r--r-- | embed/mozilla/EphyHeaderSniffer.cpp | 42 | ||||
-rw-r--r-- | embed/mozilla/EphyHeaderSniffer.h | 4 |
2 files changed, 11 insertions, 35 deletions
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; }; |