| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h" | 5 #include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 std::string primary_email = | 124 std::string primary_email = |
| 125 SigninManagerFactory::GetForProfile(profile_)->GetAuthenticatedUsername(); | 125 SigninManagerFactory::GetForProfile(profile_)->GetAuthenticatedUsername(); |
| 126 if (gaia::AreEmailsSame(email, primary_email) && | 126 if (gaia::AreEmailsSame(email, primary_email) && |
| 127 source == signin::SOURCE_REAUTH && | 127 source == signin::SOURCE_REAUTH && |
| 128 switches::IsNewProfileManagement()) { | 128 switches::IsNewProfileManagement()) { |
| 129 chrome::SetLocalAuthCredentials(profile_, password_); | 129 chrome::SetLocalAuthCredentials(profile_, password_); |
| 130 } | 130 } |
| 131 | 131 |
| 132 if (source == signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT || | 132 if (source == signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT || |
| 133 source == signin::SOURCE_REAUTH) { | 133 source == signin::SOURCE_REAUTH) { |
| 134 // TODO(rogerta): the java code will need to pass in the gaia-id |
| 135 // of the account instead of the email when chrome uses gaia-id as key. |
| 136 const std::string account_id = gaia::CanonicalizeEmail(email); |
| 134 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)-> | 137 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)-> |
| 135 UpdateCredentials(email, refresh_token); | 138 UpdateCredentials(account_id, refresh_token); |
| 136 | 139 |
| 137 if (signin::IsAutoCloseEnabledInURL(current_url_)) { | 140 if (signin::IsAutoCloseEnabledInURL(current_url_)) { |
| 138 // Close the gaia sign in tab via a task to make sure we aren't in the | 141 // Close the gaia sign in tab via a task to make sure we aren't in the |
| 139 // middle of any webui handler code. | 142 // middle of any webui handler code. |
| 140 base::MessageLoop::current()->PostTask( | 143 base::MessageLoop::current()->PostTask( |
| 141 FROM_HERE, | 144 FROM_HERE, |
| 142 base::Bind(&InlineLoginHandlerImpl::CloseTab, | 145 base::Bind(&InlineLoginHandlerImpl::CloseTab, |
| 143 handler_, | 146 handler_, |
| 144 signin::ShouldShowAccountManagement(current_url_))); | 147 signin::ShouldShowAccountManagement(current_url_))); |
| 145 } | 148 } |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 } | 453 } |
| 451 } | 454 } |
| 452 | 455 |
| 453 if (show_account_management) { | 456 if (show_account_management) { |
| 454 browser->window()->ShowAvatarBubbleFromAvatarButton( | 457 browser->window()->ShowAvatarBubbleFromAvatarButton( |
| 455 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, | 458 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, |
| 456 signin::ManageAccountsParams()); | 459 signin::ManageAccountsParams()); |
| 457 } | 460 } |
| 458 } | 461 } |
| 459 } | 462 } |
| OLD | NEW |