diff options
author | wtc@google.com <wtc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-16 17:42:17 +0000 |
---|---|---|
committer | wtc@google.com <wtc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-16 17:42:17 +0000 |
commit | 8d78f8d983a57581913d3bbc2e6a929fae1def79 (patch) | |
tree | 62e24e22881bf405d42db67ec16ec8686c6e1519 /chrome | |
parent | 34c6495a4a25d34ab900c8e698f4ccc2cf9b39fd (diff) | |
download | chromium_src-8d78f8d983a57581913d3bbc2e6a929fae1def79.zip chromium_src-8d78f8d983a57581913d3bbc2e6a929fae1def79.tar.gz chromium_src-8d78f8d983a57581913d3bbc2e6a929fae1def79.tar.bz2 |
Make GetSignonRealm a global function as opposed to
a static method of the LoginHandler class, which
should remain an interface with only pure virtual
methods.
R=eroman
Review URL: http://codereview.chromium.org/18106
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8183 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/login_prompt.cc | 11 | ||||
-rw-r--r-- | chrome/browser/login_prompt.h | 15 | ||||
-rw-r--r-- | chrome/browser/login_prompt_unittest.cc | 4 |
3 files changed, 13 insertions, 17 deletions
diff --git a/chrome/browser/login_prompt.cc b/chrome/browser/login_prompt.cc index 5ce0638..aaf2076 100644 --- a/chrome/browser/login_prompt.cc +++ b/chrome/browser/login_prompt.cc @@ -42,9 +42,6 @@ static void ResetLoginHandlerForRequest(URLRequest* request) { info->login_handler = NULL; } -// ---------------------------------------------------------------------------- -// LoginHandler - // Get the signon_realm under which this auth info should be stored. // // The format of the signon_realm for proxy auth is: @@ -55,9 +52,8 @@ static void ResetLoginHandlerForRequest(URLRequest* request) { // Be careful when changing this function, since you could make existing // saved logins un-retrievable. -// static -std::string LoginHandler::GetSignonRealm(const GURL& url, - const net::AuthChallengeInfo& auth_info) { +std::string GetSignonRealm(const GURL& url, + const net::AuthChallengeInfo& auth_info) { std::string signon_realm; if (auth_info.is_proxy) { signon_realm = WideToASCII(auth_info.host); @@ -387,8 +383,7 @@ class LoginDialogTask : public Task { dialog_form.scheme = PasswordForm::SCHEME_OTHER; } dialog_form.origin = origin_url; - dialog_form.signon_realm = LoginHandler::GetSignonRealm(dialog_form.origin, - *auth_info_); + dialog_form.signon_realm = GetSignonRealm(dialog_form.origin, *auth_info_); password_manager_input->push_back(dialog_form); // Set the password form for the handler (by copy). handler_->set_password_form(dialog_form); diff --git a/chrome/browser/login_prompt.h b/chrome/browser/login_prompt.h index 0e37467..4b62c49 100644 --- a/chrome/browser/login_prompt.h +++ b/chrome/browser/login_prompt.h @@ -36,20 +36,16 @@ class LoginHandler { // Notify the handler that the request was cancelled. // This function can only be called from the IO thread. virtual void OnRequestCancelled() = 0; - - // Get the signon_realm under which the identity should be saved. - static std::string GetSignonRealm(const GURL& url, - const net::AuthChallengeInfo& auth_info); }; // Details to provide the NotificationObserver. Used by the automation proxy // for testing. class LoginNotificationDetails { -public: + public: LoginNotificationDetails(LoginHandler* handler) : handler_(handler) {} LoginHandler* handler() const { return handler_; } -private: + private: LoginNotificationDetails() {} LoginHandler* handler_; // Where to send the response. @@ -70,5 +66,10 @@ LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info, URLRequest* request, MessageLoop* ui_loop); -#endif // CHROME_BROWSER_LOGIN_PROMPT_H__ + +// Get the signon_realm under which the identity should be saved. +std::string GetSignonRealm(const GURL& url, + const net::AuthChallengeInfo& auth_info); + +#endif // CHROME_BROWSER_LOGIN_PROMPT_H__ diff --git a/chrome/browser/login_prompt_unittest.cc b/chrome/browser/login_prompt_unittest.cc index e16093a..fd5647d 100644 --- a/chrome/browser/login_prompt_unittest.cc +++ b/chrome/browser/login_prompt_unittest.cc @@ -8,7 +8,7 @@ #include "testing/gtest/include/gtest/gtest.h" -TEST(LoginHandlerTest, GetSignonRealm) { +TEST(LoginPromptTest, GetSignonRealm) { scoped_refptr<net::AuthChallengeInfo> auth_info = new net::AuthChallengeInfo; auth_info->is_proxy = false; // server auth // auth_info->host is intentionally left empty. @@ -36,7 +36,7 @@ TEST(LoginHandlerTest, GetSignonRealm) { }; for (size_t i = 0; i < arraysize(url); i++) { - std::string key = LoginHandler::GetSignonRealm(GURL(url[i]), *auth_info); + std::string key = GetSignonRealm(GURL(url[i]), *auth_info); EXPECT_EQ(expected[i], key); } } |