Chromium Code Reviews| 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 // Prime the account tracker with this combination of gaia id/display email. | |
| 309 AccountTrackerService* account_tracker = | 310 AccountTrackerService* account_tracker = |
| 310 AccountTrackerServiceFactory::GetForProfile(profile_); | 311 AccountTrackerServiceFactory::GetForProfile(profile_); |
| 311 std::string account_id = | 312 std::string account_id = |
| 312 account_tracker->PickAccountIdForAccount(gaia_id_, email_); | 313 account_tracker->SeedAccountInfo(gaia_id_, email_); |
|
Mike Lerman
2015/04/08 14:45:26
nit: don't need to create a local account_tracker
Roger Tawa OOO till Jul 10th
2015/04/08 20:24:21
Done.
| |
| 313 | |
| 314 // Prime the account tracker with this combination of gaia id/display email. | |
| 315 account_tracker->SeedAccountInfo(gaia_id_, email_); | |
| 316 | 314 |
| 317 signin_metrics::Source source = signin::GetSourceForPromoURL(current_url_); | 315 signin_metrics::Source source = signin::GetSourceForPromoURL(current_url_); |
| 318 | 316 |
| 319 SigninManager* signin_manager = SigninManagerFactory::GetForProfile(profile_); | 317 SigninManager* signin_manager = SigninManagerFactory::GetForProfile(profile_); |
| 320 std::string primary_email = signin_manager->GetAuthenticatedUsername(); | 318 std::string primary_email = signin_manager->GetAuthenticatedUsername(); |
| 321 if (gaia::AreEmailsSame(email_, primary_email) && | 319 if (gaia::AreEmailsSame(email_, primary_email) && |
| 322 source == signin_metrics::SOURCE_REAUTH && | 320 source == signin_metrics::SOURCE_REAUTH && |
| 323 switches::IsNewProfileManagement() && | 321 switches::IsNewProfileManagement() && |
| 324 !password_.empty() && | 322 !password_.empty() && |
| 325 profiles::IsLockAvailable(profile_)) { | 323 profiles::IsLockAvailable(profile_)) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 380 OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN; | 378 OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN; |
| 381 } | 379 } |
| 382 | 380 |
| 383 bool start_signin = !HandleCrossAccountError(result.refresh_token, source, | 381 bool start_signin = !HandleCrossAccountError(result.refresh_token, source, |
| 384 confirmation_required, start_mode); | 382 confirmation_required, start_mode); |
| 385 if (start_signin) { | 383 if (start_signin) { |
| 386 // Call OneClickSigninSyncStarter to exchange oauth code for tokens. | 384 // Call OneClickSigninSyncStarter to exchange oauth code for tokens. |
| 387 // OneClickSigninSyncStarter will delete itself once the job is done. | 385 // OneClickSigninSyncStarter will delete itself once the job is done. |
| 388 new OneClickSigninSyncStarter( | 386 new OneClickSigninSyncStarter( |
| 389 profile_, browser, | 387 profile_, browser, |
| 390 email_, password_, result.refresh_token, | 388 gaia_id_, email_, password_, result.refresh_token, |
| 391 start_mode, | 389 start_mode, |
| 392 contents, | 390 contents, |
| 393 confirmation_required, | 391 confirmation_required, |
| 394 signin::GetNextPageURLForPromoURL(current_url_), | 392 signin::GetNextPageURLForPromoURL(current_url_), |
| 395 base::Bind(&InlineLoginHandlerImpl::SyncStarterCallback, handler_)); | 393 base::Bind(&InlineLoginHandlerImpl::SyncStarterCallback, handler_)); |
| 396 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 394 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 397 } | 395 } |
| 398 } | 396 } |
| 399 } | 397 } |
| 400 | 398 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 441 case ConfirmEmailDialogDelegate::CREATE_NEW_USER: | 439 case ConfirmEmailDialogDelegate::CREATE_NEW_USER: |
| 442 if (handler_) { | 440 if (handler_) { |
| 443 handler_->SyncStarterCallback( | 441 handler_->SyncStarterCallback( |
| 444 OneClickSigninSyncStarter::SYNC_SETUP_FAILURE); | 442 OneClickSigninSyncStarter::SYNC_SETUP_FAILURE); |
| 445 } | 443 } |
| 446 chrome::ShowSettingsSubPage(browser, | 444 chrome::ShowSettingsSubPage(browser, |
| 447 std::string(chrome::kCreateProfileSubPage)); | 445 std::string(chrome::kCreateProfileSubPage)); |
| 448 break; | 446 break; |
| 449 case ConfirmEmailDialogDelegate::START_SYNC: | 447 case ConfirmEmailDialogDelegate::START_SYNC: |
| 450 new OneClickSigninSyncStarter( | 448 new OneClickSigninSyncStarter( |
| 451 profile_, browser, email_, password_, refresh_token, | 449 profile_, browser, gaia_id_, email_, password_, refresh_token, |
| 452 start_mode, web_contents, confirmation_required, GURL(), | 450 start_mode, web_contents, confirmation_required, GURL(), |
| 453 base::Bind(&InlineLoginHandlerImpl::SyncStarterCallback, handler_)); | 451 base::Bind(&InlineLoginHandlerImpl::SyncStarterCallback, handler_)); |
| 454 break; | 452 break; |
| 455 case ConfirmEmailDialogDelegate::CLOSE: | 453 case ConfirmEmailDialogDelegate::CLOSE: |
| 456 if (handler_) { | 454 if (handler_) { |
| 457 handler_->SyncStarterCallback( | 455 handler_->SyncStarterCallback( |
| 458 OneClickSigninSyncStarter::SYNC_SETUP_FAILURE); | 456 OneClickSigninSyncStarter::SYNC_SETUP_FAILURE); |
| 459 } | 457 } |
| 460 break; | 458 break; |
| 461 default: | 459 default: |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 775 } | 773 } |
| 776 } | 774 } |
| 777 | 775 |
| 778 if (show_account_management) { | 776 if (show_account_management) { |
| 779 browser->window()->ShowAvatarBubbleFromAvatarButton( | 777 browser->window()->ShowAvatarBubbleFromAvatarButton( |
| 780 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, | 778 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, |
| 781 signin::ManageAccountsParams()); | 779 signin::ManageAccountsParams()); |
| 782 } | 780 } |
| 783 } | 781 } |
| 784 } | 782 } |
| OLD | NEW |