| 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 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 user_context.GetAuthFlow() != UserContext::AUTH_FLOW_EASY_BOOTSTRAP; | 721 user_context.GetAuthFlow() != UserContext::AUTH_FLOW_EASY_BOOTSTRAP; |
| 722 | 722 |
| 723 // LoginPerformer instance will delete itself in case of successful auth. | 723 // LoginPerformer instance will delete itself in case of successful auth. |
| 724 login_performer_->set_delegate(nullptr); | 724 login_performer_->set_delegate(nullptr); |
| 725 ignore_result(login_performer_.release()); | 725 ignore_result(login_performer_.release()); |
| 726 | 726 |
| 727 if (user_context.GetAuthFlow() == UserContext::AUTH_FLOW_OFFLINE) | 727 if (user_context.GetAuthFlow() == UserContext::AUTH_FLOW_OFFLINE) |
| 728 UMA_HISTOGRAM_COUNTS_100("Login.OfflineSuccess.Attempts", | 728 UMA_HISTOGRAM_COUNTS_100("Login.OfflineSuccess.Attempts", |
| 729 num_login_attempts_); | 729 num_login_attempts_); |
| 730 | 730 |
| 731 const bool is_enterprise_managed = g_browser_process->platform_part() |
| 732 ->browser_policy_connector_chromeos() |
| 733 ->IsEnterpriseManaged(); |
| 734 |
| 735 // Mark device will be consumer owned if the device is not managed and this is |
| 736 // the first user on the device. |
| 737 if (!is_enterprise_managed && |
| 738 user_manager::UserManager::Get()->GetUsers().empty()) { |
| 739 DeviceSettingsService::Get()->MarkWillEstablishConsumerOwnership(); |
| 740 } |
| 741 |
| 731 UserSessionManager::StartSessionType start_session_type = | 742 UserSessionManager::StartSessionType start_session_type = |
| 732 UserAddingScreen::Get()->IsRunning() | 743 UserAddingScreen::Get()->IsRunning() |
| 733 ? UserSessionManager::SECONDARY_USER_SESSION | 744 ? UserSessionManager::SECONDARY_USER_SESSION |
| 734 : UserSessionManager::PRIMARY_USER_SESSION; | 745 : UserSessionManager::PRIMARY_USER_SESSION; |
| 735 UserSessionManager::GetInstance()->StartSession( | 746 UserSessionManager::GetInstance()->StartSession( |
| 736 user_context, start_session_type, has_auth_cookies, | 747 user_context, start_session_type, has_auth_cookies, |
| 737 false, // Start session for user. | 748 false, // Start session for user. |
| 738 this); | 749 this); |
| 739 | 750 |
| 740 // Update user's displayed email. | 751 // Update user's displayed email. |
| 741 if (!display_email_.empty()) { | 752 if (!display_email_.empty()) { |
| 742 user_manager::UserManager::Get()->SaveUserDisplayEmail( | 753 user_manager::UserManager::Get()->SaveUserDisplayEmail( |
| 743 user_context.GetAccountId(), display_email_); | 754 user_context.GetAccountId(), display_email_); |
| 744 } | 755 } |
| 745 if (!display_name_.empty() || !given_name_.empty()) { | 756 if (!display_name_.empty() || !given_name_.empty()) { |
| 746 user_manager::UserManager::Get()->UpdateUserAccountData( | 757 user_manager::UserManager::Get()->UpdateUserAccountData( |
| 747 user_context.GetAccountId(), | 758 user_context.GetAccountId(), |
| 748 user_manager::UserManager::UserAccountData(display_name_, given_name_, | 759 user_manager::UserManager::UserAccountData(display_name_, given_name_, |
| 749 std::string() /* locale */)); | 760 std::string() /* locale */)); |
| 750 } | 761 } |
| 751 ClearRecordedNames(); | 762 ClearRecordedNames(); |
| 752 | 763 |
| 753 if (g_browser_process->platform_part() | 764 if (is_enterprise_managed) { |
| 754 ->browser_policy_connector_chromeos() | |
| 755 ->IsEnterpriseManaged()) { | |
| 756 enterprise_user_session_metrics::RecordSignInEvent( | 765 enterprise_user_session_metrics::RecordSignInEvent( |
| 757 user_context, last_login_attempt_was_auto_login_); | 766 user_context, last_login_attempt_was_auto_login_); |
| 758 } | 767 } |
| 759 } | 768 } |
| 760 | 769 |
| 761 void ExistingUserController::OnProfilePrepared(Profile* profile, | 770 void ExistingUserController::OnProfilePrepared(Profile* profile, |
| 762 bool browser_launched) { | 771 bool browser_launched) { |
| 763 // Reenable clicking on other windows and status area. | 772 // Reenable clicking on other windows and status area. |
| 764 login_display_->SetUIEnabled(true); | 773 login_display_->SetUIEnabled(true); |
| 765 | 774 |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1385 login_display_->ShowUnrecoverableCrypthomeErrorDialog(); | 1394 login_display_->ShowUnrecoverableCrypthomeErrorDialog(); |
| 1386 } | 1395 } |
| 1387 | 1396 |
| 1388 void ExistingUserController::ClearRecordedNames() { | 1397 void ExistingUserController::ClearRecordedNames() { |
| 1389 display_email_.clear(); | 1398 display_email_.clear(); |
| 1390 display_name_.clear(); | 1399 display_name_.clear(); |
| 1391 given_name_.clear(); | 1400 given_name_.clear(); |
| 1392 } | 1401 } |
| 1393 | 1402 |
| 1394 } // namespace chromeos | 1403 } // namespace chromeos |
| OLD | NEW |