diff options
author | rogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-21 16:39:21 +0000 |
---|---|---|
committer | rogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-21 16:39:21 +0000 |
commit | 7d155e97457eae44d00863d3e47b926b4744f6e4 (patch) | |
tree | d54c53b594cc3da2ef1bebc7b6315b633d39b047 /chrome/browser/chromeos | |
parent | 985702c9fa95e190d46b2093d542f42e70296ddd (diff) | |
download | chromium_src-7d155e97457eae44d00863d3e47b926b4744f6e4.zip chromium_src-7d155e97457eae44d00863d3e47b926b4744f6e4.tar.gz chromium_src-7d155e97457eae44d00863d3e47b926b4744f6e4.tar.bz2 |
When a user logs into sync, the appropriate cookies are retrieved so that
she is already logged into Google web services, and does not need to enter
her username and password again.
This feature is on by default, but can be turned off by specifying
--disable-auto-login on the command line or the about:flags page.
BUG=None
TEST=Make sure the browser has no google or youtube cookies. Either clear
all the cookies or start with a brand new profile. Go to menu item
"Wrench / Options", go to the tab "Personal stuff", and click the "Enable
these features..." button to enable sync. Follow the wizard to login to your
google account and finish the sync process. Once terminated, browse to
gmail.com and you should be already logged in.
Review URL: http://codereview.chromium.org/7121014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89842 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos')
3 files changed, 19 insertions, 6 deletions
diff --git a/chrome/browser/chromeos/login/cookie_fetcher_unittest.cc b/chrome/browser/chromeos/login/cookie_fetcher_unittest.cc index cfefb19..ad2ebb9 100644 --- a/chrome/browser/chromeos/login/cookie_fetcher_unittest.cc +++ b/chrome/browser/chromeos/login/cookie_fetcher_unittest.cc @@ -182,11 +182,10 @@ TEST_F(CookieFetcherTest, ClientLoginResponseHandlerTest) { TEST_F(CookieFetcherTest, IssueResponseHandlerTest) { IssueResponseHandler handler(NULL); - std::string input("a\n"); - std::string expected(GaiaUrls::GetInstance()->token_auth_url()); - expected.append(input); + std::string expected(IssueResponseHandler::BuildTokenAuthUrlWithToken( + std::string("a\n"))); - scoped_ptr<URLFetcher> fetcher(handler.Handle(input, NULL)); + scoped_ptr<URLFetcher> fetcher(handler.Handle(std::string("a\n"), NULL)); EXPECT_EQ(expected, handler.token_url()); } diff --git a/chrome/browser/chromeos/login/issue_response_handler.cc b/chrome/browser/chromeos/login/issue_response_handler.cc index e1a23b7..d62aabb 100644 --- a/chrome/browser/chromeos/login/issue_response_handler.cc +++ b/chrome/browser/chromeos/login/issue_response_handler.cc @@ -25,8 +25,7 @@ URLFetcher* IssueResponseHandler::Handle( const std::string& to_process, URLFetcher::Delegate* catcher) { VLOG(1) << "Handling IssueAuthToken response"; - token_url_.assign(base::StringPrintf("%s%s", - GaiaUrls::GetInstance()->token_auth_url().c_str(), to_process.c_str())); + token_url_.assign(BuildTokenAuthUrlWithToken(to_process)); URLFetcher* fetcher = new URLFetcher(GURL(token_url_), URLFetcher::GET, catcher); fetcher->set_load_flags(net::LOAD_DO_NOT_SEND_COOKIES); @@ -38,4 +37,16 @@ URLFetcher* IssueResponseHandler::Handle( return fetcher; } +// static +std::string IssueResponseHandler::BuildTokenAuthUrlWithToken( + const std::string& token) { + const char kUrlFormat[] = "%s?" + "continue=http://www.google.com/webhp&" + "source=chromeos&" + "auth=%s"; + return base::StringPrintf(kUrlFormat, + GaiaUrls::GetInstance()->token_auth_url().c_str(), + token.c_str()); +} + } // namespace chromeos diff --git a/chrome/browser/chromeos/login/issue_response_handler.h b/chrome/browser/chromeos/login/issue_response_handler.h index c560921..a79f9af 100644 --- a/chrome/browser/chromeos/login/issue_response_handler.h +++ b/chrome/browser/chromeos/login/issue_response_handler.h @@ -42,6 +42,9 @@ class IssueResponseHandler : public AuthResponseHandler { // exposed for testing std::string token_url() { return token_url_; } + // Builds a TokenAuth URL using the specified authorization token. + static std::string BuildTokenAuthUrlWithToken(const std::string& token); + private: std::string token_url_; net::URLRequestContextGetter* getter_; |