From ce1641f62c58ef2dd82e37b96f3b35071cef2468 Mon Sep 17 00:00:00 2001 From: stippi Date: Sat, 27 Feb 2010 13:20:24 +0000 Subject: [PATCH] Hide the implementation details of BWebWindow::AuthenticationChallenge() from clients. git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@235 94f232f2-1747-11df-bad5-a5bfde151594 --- src/apps/webpositive/LauncherWindow.cpp | 29 +++++-------------------- src/apps/webpositive/LauncherWindow.h | 4 +++- 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/src/apps/webpositive/LauncherWindow.cpp b/src/apps/webpositive/LauncherWindow.cpp index 4bd0ac61a6..e44836cec8 100644 --- a/src/apps/webpositive/LauncherWindow.cpp +++ b/src/apps/webpositive/LauncherWindow.cpp @@ -653,31 +653,14 @@ void LauncherWindow::UpdateGlobalHistory(const BString& url) BrowsingHistory::defaultInstance()->addItem(BrowsingHistoryItem(url)); } -void LauncherWindow::AuthenticationChallenge(BMessage* message) +bool LauncherWindow::AuthenticationChallenge(BString message, BString& inOutUser, + BString& inOutPassword, bool& inOutRememberCredentials, uint32 failureCount) { - BString text; - bool rememberCredentials = false; - uint32 failureCount = 0; - BString user; - BString password; - - message->FindString("text", &text); - message->FindString("user", &user); - message->FindString("password", &password); - message->FindUInt32("failureCount", &failureCount); - AuthenticationPanel* panel = new AuthenticationPanel(Frame()); - if (!panel->getAuthentication(text, user, password, rememberCredentials, - failureCount > 0, user, password, &rememberCredentials)) { - message->SendReply((uint32)0); - return; - } - - BMessage reply; - reply.AddString("user", user); - reply.AddString("password", password); - reply.AddBool("rememberCredentials", rememberCredentials); - message->SendReply(&reply); + // Panel auto-destructs. + return panel->getAuthentication(message, inOutUser, inOutPassword, + inOutRememberCredentials, failureCount > 0, inOutUser, inOutPassword, + &inOutRememberCredentials); } void LauncherWindow::updateTitle(const BString& title) diff --git a/src/apps/webpositive/LauncherWindow.h b/src/apps/webpositive/LauncherWindow.h index 192d42786a..e502360f49 100644 --- a/src/apps/webpositive/LauncherWindow.h +++ b/src/apps/webpositive/LauncherWindow.h @@ -91,7 +91,9 @@ private: virtual void NavigationCapabilitiesChanged(bool canGoBackward, bool canGoForward, bool canStop, BWebView* view); virtual void UpdateGlobalHistory(const BString& url); - virtual void AuthenticationChallenge(BMessage* challenge); + virtual bool AuthenticationChallenge(BString message, BString& inOutUser, + BString& inOutPassword, bool& inOutRememberCredentials, + uint32 failureCount); void updateTitle(const BString &title); void updateTabGroupVisibility();