| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/login/existing_user_controller.h" | 5 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 user_context.GetAuthFlow() != UserContext::AUTH_FLOW_EASY_BOOTSTRAP; | 732 user_context.GetAuthFlow() != UserContext::AUTH_FLOW_EASY_BOOTSTRAP; |
| 733 | 733 |
| 734 // LoginPerformer instance will delete itself in case of successful auth. | 734 // LoginPerformer instance will delete itself in case of successful auth. |
| 735 login_performer_->set_delegate(nullptr); | 735 login_performer_->set_delegate(nullptr); |
| 736 ignore_result(login_performer_.release()); | 736 ignore_result(login_performer_.release()); |
| 737 | 737 |
| 738 if (user_context.GetAuthFlow() == UserContext::AUTH_FLOW_OFFLINE) | 738 if (user_context.GetAuthFlow() == UserContext::AUTH_FLOW_OFFLINE) |
| 739 UMA_HISTOGRAM_COUNTS_100("Login.OfflineSuccess.Attempts", | 739 UMA_HISTOGRAM_COUNTS_100("Login.OfflineSuccess.Attempts", |
| 740 num_login_attempts_); | 740 num_login_attempts_); |
| 741 | 741 |
| 742 const bool is_enterprise_managed = g_browser_process->platform_part() |
| 743 ->browser_policy_connector_chromeos() |
| 744 ->IsEnterpriseManaged(); |
| 745 |
| 746 // Mark device will be consumer owned if the device is not managed and this is |
| 747 // the first user on the device. |
| 748 if (!is_enterprise_managed && |
| 749 user_manager::UserManager::Get()->GetUsers().empty()) { |
| 750 DeviceSettingsService::Get()->MarkWillEstablishConsumerOwnership(); |
| 751 } |
| 752 |
| 742 UserSessionManager::StartSessionType start_session_type = | 753 UserSessionManager::StartSessionType start_session_type = |
| 743 UserAddingScreen::Get()->IsRunning() | 754 UserAddingScreen::Get()->IsRunning() |
| 744 ? UserSessionManager::SECONDARY_USER_SESSION | 755 ? UserSessionManager::SECONDARY_USER_SESSION |
| 745 : UserSessionManager::PRIMARY_USER_SESSION; | 756 : UserSessionManager::PRIMARY_USER_SESSION; |
| 746 UserSessionManager::GetInstance()->StartSession( | 757 UserSessionManager::GetInstance()->StartSession( |
| 747 user_context, start_session_type, has_auth_cookies, | 758 user_context, start_session_type, has_auth_cookies, |
| 748 false, // Start session for user. | 759 false, // Start session for user. |
| 749 this); | 760 this); |
| 750 | 761 |
| 751 // Update user's displayed email. | 762 // Update user's displayed email. |
| 752 if (!display_email_.empty()) { | 763 if (!display_email_.empty()) { |
| 753 user_manager::UserManager::Get()->SaveUserDisplayEmail( | 764 user_manager::UserManager::Get()->SaveUserDisplayEmail( |
| 754 user_context.GetAccountId(), display_email_); | 765 user_context.GetAccountId(), display_email_); |
| 755 } | 766 } |
| 756 if (!display_name_.empty() || !given_name_.empty()) { | 767 if (!display_name_.empty() || !given_name_.empty()) { |
| 757 user_manager::UserManager::Get()->UpdateUserAccountData( | 768 user_manager::UserManager::Get()->UpdateUserAccountData( |
| 758 user_context.GetAccountId(), | 769 user_context.GetAccountId(), |
| 759 user_manager::UserManager::UserAccountData(display_name_, given_name_, | 770 user_manager::UserManager::UserAccountData(display_name_, given_name_, |
| 760 std::string() /* locale */)); | 771 std::string() /* locale */)); |
| 761 } | 772 } |
| 762 ClearRecordedNames(); | 773 ClearRecordedNames(); |
| 763 | 774 |
| 764 if (g_browser_process->platform_part() | 775 if (is_enterprise_managed) { |
| 765 ->browser_policy_connector_chromeos() | |
| 766 ->IsEnterpriseManaged()) { | |
| 767 enterprise_user_session_metrics::RecordSignInEvent( | 776 enterprise_user_session_metrics::RecordSignInEvent( |
| 768 user_context, last_login_attempt_was_auto_login_); | 777 user_context, last_login_attempt_was_auto_login_); |
| 769 } | 778 } |
| 770 } | 779 } |
| 771 | 780 |
| 772 void ExistingUserController::OnProfilePrepared(Profile* profile, | 781 void ExistingUserController::OnProfilePrepared(Profile* profile, |
| 773 bool browser_launched) { | 782 bool browser_launched) { |
| 774 // Reenable clicking on other windows and status area. | 783 // Reenable clicking on other windows and status area. |
| 775 login_display_->SetUIEnabled(true); | 784 login_display_->SetUIEnabled(true); |
| 776 | 785 |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1401 login_display_->ShowUnrecoverableCrypthomeErrorDialog(); | 1410 login_display_->ShowUnrecoverableCrypthomeErrorDialog(); |
| 1402 } | 1411 } |
| 1403 | 1412 |
| 1404 void ExistingUserController::ClearRecordedNames() { | 1413 void ExistingUserController::ClearRecordedNames() { |
| 1405 display_email_.clear(); | 1414 display_email_.clear(); |
| 1406 display_name_.clear(); | 1415 display_name_.clear(); |
| 1407 given_name_.clear(); | 1416 given_name_.clear(); |
| 1408 } | 1417 } |
| 1409 | 1418 |
| 1410 } // namespace chromeos | 1419 } // namespace chromeos |
| OLD | NEW |