| 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/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 Browser* browser = NULL; | 299 Browser* browser = NULL; |
| 300 if (handler_) { | 300 if (handler_) { |
| 301 contents = handler_->web_ui()->GetWebContents(); | 301 contents = handler_->web_ui()->GetWebContents(); |
| 302 browser = handler_->GetDesktopBrowser(); | 302 browser = handler_->GetDesktopBrowser(); |
| 303 } | 303 } |
| 304 | 304 |
| 305 AboutSigninInternals* about_signin_internals = | 305 AboutSigninInternals* about_signin_internals = |
| 306 AboutSigninInternalsFactory::GetForProfile(profile_); | 306 AboutSigninInternalsFactory::GetForProfile(profile_); |
| 307 about_signin_internals->OnRefreshTokenReceived("Successful"); | 307 about_signin_internals->OnRefreshTokenReceived("Successful"); |
| 308 | 308 |
| 309 AccountTrackerService* account_tracker = | 309 // Prime the account tracker with this combination of gaia id/display email. |
| 310 AccountTrackerServiceFactory::GetForProfile(profile_); | |
| 311 std::string account_id = | 310 std::string account_id = |
| 312 account_tracker->PickAccountIdForAccount(gaia_id_, email_); | 311 AccountTrackerServiceFactory::GetForProfile(profile_) |
| 313 | 312 ->SeedAccountInfo(gaia_id_, email_); |
| 314 // Prime the account tracker with this combination of gaia id/display email. | |
| 315 account_tracker->SeedAccountInfo(gaia_id_, email_); | |
| 316 | 313 |
| 317 signin_metrics::Source source = signin::GetSourceForPromoURL(current_url_); | 314 signin_metrics::Source source = signin::GetSourceForPromoURL(current_url_); |
| 318 | 315 |
| 319 SigninManager* signin_manager = SigninManagerFactory::GetForProfile(profile_); | 316 SigninManager* signin_manager = SigninManagerFactory::GetForProfile(profile_); |
| 320 std::string primary_email = signin_manager->GetAuthenticatedUsername(); | 317 std::string primary_email = signin_manager->GetAuthenticatedUsername(); |
| 321 if (gaia::AreEmailsSame(email_, primary_email) && | 318 if (gaia::AreEmailsSame(email_, primary_email) && |
| 322 source == signin_metrics::SOURCE_REAUTH && | 319 source == signin_metrics::SOURCE_REAUTH && |
| 323 switches::IsNewProfileManagement() && | 320 switches::IsNewProfileManagement() && |
| 324 !password_.empty() && | 321 !password_.empty() && |
| 325 profiles::IsLockAvailable(profile_)) { | 322 profiles::IsLockAvailable(profile_)) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN; | 377 OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN; |
| 381 } | 378 } |
| 382 | 379 |
| 383 bool start_signin = !HandleCrossAccountError(result.refresh_token, source, | 380 bool start_signin = !HandleCrossAccountError(result.refresh_token, source, |
| 384 confirmation_required, start_mode); | 381 confirmation_required, start_mode); |
| 385 if (start_signin) { | 382 if (start_signin) { |
| 386 // Call OneClickSigninSyncStarter to exchange oauth code for tokens. | 383 // Call OneClickSigninSyncStarter to exchange oauth code for tokens. |
| 387 // OneClickSigninSyncStarter will delete itself once the job is done. | 384 // OneClickSigninSyncStarter will delete itself once the job is done. |
| 388 new OneClickSigninSyncStarter( | 385 new OneClickSigninSyncStarter( |
| 389 profile_, browser, | 386 profile_, browser, |
| 390 email_, password_, result.refresh_token, | 387 gaia_id_, email_, password_, result.refresh_token, |
| 391 start_mode, | 388 start_mode, |
| 392 contents, | 389 contents, |
| 393 confirmation_required, | 390 confirmation_required, |
| 394 signin::GetNextPageURLForPromoURL(current_url_), | 391 signin::GetNextPageURLForPromoURL(current_url_), |
| 395 base::Bind(&InlineLoginHandlerImpl::SyncStarterCallback, handler_)); | 392 base::Bind(&InlineLoginHandlerImpl::SyncStarterCallback, handler_)); |
| 396 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 393 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 397 } | 394 } |
| 398 } | 395 } |
| 399 } | 396 } |
| 400 | 397 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 case ConfirmEmailDialogDelegate::CREATE_NEW_USER: | 438 case ConfirmEmailDialogDelegate::CREATE_NEW_USER: |
| 442 if (handler_) { | 439 if (handler_) { |
| 443 handler_->SyncStarterCallback( | 440 handler_->SyncStarterCallback( |
| 444 OneClickSigninSyncStarter::SYNC_SETUP_FAILURE); | 441 OneClickSigninSyncStarter::SYNC_SETUP_FAILURE); |
| 445 } | 442 } |
| 446 chrome::ShowSettingsSubPage(browser, | 443 chrome::ShowSettingsSubPage(browser, |
| 447 std::string(chrome::kCreateProfileSubPage)); | 444 std::string(chrome::kCreateProfileSubPage)); |
| 448 break; | 445 break; |
| 449 case ConfirmEmailDialogDelegate::START_SYNC: | 446 case ConfirmEmailDialogDelegate::START_SYNC: |
| 450 new OneClickSigninSyncStarter( | 447 new OneClickSigninSyncStarter( |
| 451 profile_, browser, email_, password_, refresh_token, | 448 profile_, browser, gaia_id_, email_, password_, refresh_token, |
| 452 start_mode, web_contents, confirmation_required, GURL(), | 449 start_mode, web_contents, confirmation_required, GURL(), |
| 453 base::Bind(&InlineLoginHandlerImpl::SyncStarterCallback, handler_)); | 450 base::Bind(&InlineLoginHandlerImpl::SyncStarterCallback, handler_)); |
| 454 break; | 451 break; |
| 455 case ConfirmEmailDialogDelegate::CLOSE: | 452 case ConfirmEmailDialogDelegate::CLOSE: |
| 456 if (handler_) { | 453 if (handler_) { |
| 457 handler_->SyncStarterCallback( | 454 handler_->SyncStarterCallback( |
| 458 OneClickSigninSyncStarter::SYNC_SETUP_FAILURE); | 455 OneClickSigninSyncStarter::SYNC_SETUP_FAILURE); |
| 459 } | 456 } |
| 460 break; | 457 break; |
| 461 default: | 458 default: |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 } | 772 } |
| 776 } | 773 } |
| 777 | 774 |
| 778 if (show_account_management) { | 775 if (show_account_management) { |
| 779 browser->window()->ShowAvatarBubbleFromAvatarButton( | 776 browser->window()->ShowAvatarBubbleFromAvatarButton( |
| 780 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, | 777 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, |
| 781 signin::ManageAccountsParams()); | 778 signin::ManageAccountsParams()); |
| 782 } | 779 } |
| 783 } | 780 } |
| 784 } | 781 } |
| OLD | NEW |