| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/session/user_session_manager.h" | 5 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 | 416 |
| 417 PreStartSession(); | 417 PreStartSession(); |
| 418 CreateUserSession(user_context, has_auth_cookies); | 418 CreateUserSession(user_context, has_auth_cookies); |
| 419 | 419 |
| 420 if (!has_active_session) | 420 if (!has_active_session) |
| 421 StartCrosSession(); | 421 StartCrosSession(); |
| 422 | 422 |
| 423 // TODO(nkostylev): Notify UserLoggedIn() after profile is actually | 423 // TODO(nkostylev): Notify UserLoggedIn() after profile is actually |
| 424 // ready to be used (http://crbug.com/361528). | 424 // ready to be used (http://crbug.com/361528). |
| 425 NotifyUserLoggedIn(); | 425 NotifyUserLoggedIn(); |
| 426 |
| 427 if (!user_context.GetDeviceId().empty()) { |
| 428 user_manager::UserManager::Get()->SetKnownUserDeviceId( |
| 429 user_context.GetUserID(), user_context.GetDeviceId()); |
| 430 } |
| 431 |
| 426 PrepareProfile(); | 432 PrepareProfile(); |
| 427 } | 433 } |
| 428 | 434 |
| 429 void UserSessionManager::DelegateDeleted(UserSessionManagerDelegate* delegate) { | 435 void UserSessionManager::DelegateDeleted(UserSessionManagerDelegate* delegate) { |
| 430 if (delegate_ == delegate) | 436 if (delegate_ == delegate) |
| 431 delegate_ = nullptr; | 437 delegate_ = nullptr; |
| 432 } | 438 } |
| 433 | 439 |
| 434 void UserSessionManager::PerformPostUserLoggedInActions() { | 440 void UserSessionManager::PerformPostUserLoggedInActions() { |
| 435 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | 441 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 void UserSessionManager::InitProfilePreferences( | 895 void UserSessionManager::InitProfilePreferences( |
| 890 Profile* profile, | 896 Profile* profile, |
| 891 const UserContext& user_context) { | 897 const UserContext& user_context) { |
| 892 const user_manager::User* user = | 898 const user_manager::User* user = |
| 893 ProfileHelper::Get()->GetUserByProfile(profile); | 899 ProfileHelper::Get()->GetUserByProfile(profile); |
| 894 if (user->GetType() == user_manager::USER_TYPE_KIOSK_APP && | 900 if (user->GetType() == user_manager::USER_TYPE_KIOSK_APP && |
| 895 profile->IsNewProfile()) { | 901 profile->IsNewProfile()) { |
| 896 ChromeUserManager::Get()->SetIsCurrentUserNew(true); | 902 ChromeUserManager::Get()->SetIsCurrentUserNew(true); |
| 897 } | 903 } |
| 898 | 904 |
| 899 std::string device_id = profile->GetPrefs()->GetString( | |
| 900 prefs::kGoogleServicesSigninScopedDeviceId); | |
| 901 if (device_id.empty()) { | |
| 902 device_id = user_context.GetDeviceId(); | |
| 903 if (!device_id.empty()) { | |
| 904 profile->GetPrefs()->SetString(prefs::kGoogleServicesSigninScopedDeviceId, | |
| 905 device_id); | |
| 906 } | |
| 907 } | |
| 908 if (!device_id.empty()) { | |
| 909 user_manager::UserManager::Get()->SetKnownUserDeviceId(user->GetUserID(), | |
| 910 device_id); | |
| 911 } | |
| 912 | |
| 913 if (user->is_active()) { | 905 if (user->is_active()) { |
| 914 input_method::InputMethodManager* manager = | 906 input_method::InputMethodManager* manager = |
| 915 input_method::InputMethodManager::Get(); | 907 input_method::InputMethodManager::Get(); |
| 916 manager->SetState(GetDefaultIMEState(profile)); | 908 manager->SetState(GetDefaultIMEState(profile)); |
| 917 } | 909 } |
| 918 if (user_manager::UserManager::Get()->IsCurrentUserNew()) { | 910 if (user_manager::UserManager::Get()->IsCurrentUserNew()) { |
| 919 SetFirstLoginPrefs(profile, | 911 SetFirstLoginPrefs(profile, |
| 920 user_context.GetPublicSessionLocale(), | 912 user_context.GetPublicSessionLocale(), |
| 921 user_context.GetPublicSessionInputMethod()); | 913 user_context.GetPublicSessionInputMethod()); |
| 922 } | 914 } |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1666 if (is_enterprise_managed) | 1658 if (is_enterprise_managed) |
| 1667 display = USER_PODS_DISPLAY_DISABLED_MANAGED; | 1659 display = USER_PODS_DISPLAY_DISABLED_MANAGED; |
| 1668 else | 1660 else |
| 1669 display = USER_PODS_DISPLAY_DISABLED_REGULAR; | 1661 display = USER_PODS_DISPLAY_DISABLED_REGULAR; |
| 1670 } | 1662 } |
| 1671 UMA_HISTOGRAM_ENUMERATION("UserSessionManager.UserPodsDisplay", display, | 1663 UMA_HISTOGRAM_ENUMERATION("UserSessionManager.UserPodsDisplay", display, |
| 1672 NUM_USER_PODS_DISPLAY); | 1664 NUM_USER_PODS_DISPLAY); |
| 1673 } | 1665 } |
| 1674 | 1666 |
| 1675 } // namespace chromeos | 1667 } // namespace chromeos |
| OLD | NEW |