| 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 } | 344 } |
| 345 | 345 |
| 346 if (source == signin_metrics::SOURCE_REAUTH) | 346 if (source == signin_metrics::SOURCE_REAUTH) |
| 347 signin_manager->MergeSigninCredentialIntoCookieJar(); | 347 signin_manager->MergeSigninCredentialIntoCookieJar(); |
| 348 } else { | 348 } else { |
| 349 ProfileSyncService* sync_service = | 349 ProfileSyncService* sync_service = |
| 350 ProfileSyncServiceFactory::GetForProfile(profile_); | 350 ProfileSyncServiceFactory::GetForProfile(profile_); |
| 351 SigninErrorController* error_controller = | 351 SigninErrorController* error_controller = |
| 352 SigninErrorControllerFactory::GetForProfile(profile_); | 352 SigninErrorControllerFactory::GetForProfile(profile_); |
| 353 | 353 |
| 354 bool is_new_avatar_menu = switches::IsNewAvatarMenu(); | 354 OneClickSigninSyncStarter::StartSyncMode start_mode = |
| 355 | 355 OneClickSigninSyncStarter::CONFIRM_SYNC_SETTINGS_FIRST; |
| 356 OneClickSigninSyncStarter::StartSyncMode start_mode; | |
| 357 if (source == signin_metrics::SOURCE_SETTINGS || choose_what_to_sync_) { | 356 if (source == signin_metrics::SOURCE_SETTINGS || choose_what_to_sync_) { |
| 358 bool show_settings_without_configure = | 357 bool show_settings_without_configure = |
| 359 error_controller->HasError() && | 358 error_controller->HasError() && |
| 360 sync_service && | 359 sync_service && |
| 361 sync_service->HasSyncSetupCompleted(); | 360 sync_service->HasSyncSetupCompleted(); |
| 362 start_mode = show_settings_without_configure ? | 361 start_mode = show_settings_without_configure ? |
| 363 OneClickSigninSyncStarter::SHOW_SETTINGS_WITHOUT_CONFIGURE : | 362 OneClickSigninSyncStarter::SHOW_SETTINGS_WITHOUT_CONFIGURE : |
| 364 OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST; | 363 OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST; |
| 365 } else { | |
| 366 start_mode = is_new_avatar_menu ? | |
| 367 OneClickSigninSyncStarter::CONFIRM_SYNC_SETTINGS_FIRST : | |
| 368 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS; | |
| 369 } | 364 } |
| 370 | 365 |
| 371 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required; | 366 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required = |
| 372 if (confirm_untrusted_signin_) { | 367 confirm_untrusted_signin_ ? |
| 373 confirmation_required = | 368 OneClickSigninSyncStarter::CONFIRM_UNTRUSTED_SIGNIN : |
| 374 OneClickSigninSyncStarter::CONFIRM_UNTRUSTED_SIGNIN; | 369 OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN; |
| 375 } else if (is_new_avatar_menu) { | |
| 376 confirmation_required = OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN; | |
| 377 } else { | |
| 378 confirmation_required = | |
| 379 source == signin_metrics::SOURCE_SETTINGS || | |
| 380 choose_what_to_sync_ ? | |
| 381 OneClickSigninSyncStarter::NO_CONFIRMATION : | |
| 382 OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN; | |
| 383 } | |
| 384 | 370 |
| 385 bool start_signin = !HandleCrossAccountError(result.refresh_token, source, | 371 bool start_signin = !HandleCrossAccountError(result.refresh_token, source, |
| 386 confirmation_required, start_mode); | 372 confirmation_required, start_mode); |
| 387 if (start_signin) { | 373 if (start_signin) { |
| 388 // Call OneClickSigninSyncStarter to exchange oauth code for tokens. | 374 // Call OneClickSigninSyncStarter to exchange oauth code for tokens. |
| 389 // OneClickSigninSyncStarter will delete itself once the job is done. | 375 // OneClickSigninSyncStarter will delete itself once the job is done. |
| 390 new OneClickSigninSyncStarter( | 376 new OneClickSigninSyncStarter( |
| 391 profile_, browser, | 377 profile_, browser, |
| 392 gaia_id_, email_, password_, result.refresh_token, | 378 gaia_id_, email_, password_, result.refresh_token, |
| 393 start_mode, | 379 start_mode, |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 } | 854 } |
| 869 } | 855 } |
| 870 | 856 |
| 871 if (show_account_management) { | 857 if (show_account_management) { |
| 872 browser->window()->ShowAvatarBubbleFromAvatarButton( | 858 browser->window()->ShowAvatarBubbleFromAvatarButton( |
| 873 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, | 859 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, |
| 874 signin::ManageAccountsParams()); | 860 signin::ManageAccountsParams()); |
| 875 } | 861 } |
| 876 } | 862 } |
| 877 } | 863 } |
| OLD | NEW |