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()) | |
pavely
2015/05/13 00:05:52
nit: Consider using user_context instead of user_c
dzhioev (left Google)
2015/05/13 20:24:22
Done.
| |
428 user_manager::UserManager::Get()->SetKnownUserDeviceId( | |
429 user_context_.GetUserID(), user_context_.GetDeviceId()); | |
430 | |
426 PrepareProfile(); | 431 PrepareProfile(); |
427 } | 432 } |
428 | 433 |
429 void UserSessionManager::DelegateDeleted(UserSessionManagerDelegate* delegate) { | 434 void UserSessionManager::DelegateDeleted(UserSessionManagerDelegate* delegate) { |
430 if (delegate_ == delegate) | 435 if (delegate_ == delegate) |
431 delegate_ = nullptr; | 436 delegate_ = nullptr; |
432 } | 437 } |
433 | 438 |
434 void UserSessionManager::PerformPostUserLoggedInActions() { | 439 void UserSessionManager::PerformPostUserLoggedInActions() { |
435 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | 440 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( | 894 void UserSessionManager::InitProfilePreferences( |
890 Profile* profile, | 895 Profile* profile, |
891 const UserContext& user_context) { | 896 const UserContext& user_context) { |
892 const user_manager::User* user = | 897 const user_manager::User* user = |
893 ProfileHelper::Get()->GetUserByProfile(profile); | 898 ProfileHelper::Get()->GetUserByProfile(profile); |
894 if (user->GetType() == user_manager::USER_TYPE_KIOSK_APP && | 899 if (user->GetType() == user_manager::USER_TYPE_KIOSK_APP && |
895 profile->IsNewProfile()) { | 900 profile->IsNewProfile()) { |
896 ChromeUserManager::Get()->SetIsCurrentUserNew(true); | 901 ChromeUserManager::Get()->SetIsCurrentUserNew(true); |
897 } | 902 } |
898 | 903 |
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()) { | 904 if (user->is_active()) { |
914 input_method::InputMethodManager* manager = | 905 input_method::InputMethodManager* manager = |
915 input_method::InputMethodManager::Get(); | 906 input_method::InputMethodManager::Get(); |
916 manager->SetState(GetDefaultIMEState(profile)); | 907 manager->SetState(GetDefaultIMEState(profile)); |
917 } | 908 } |
918 if (user_manager::UserManager::Get()->IsCurrentUserNew()) { | 909 if (user_manager::UserManager::Get()->IsCurrentUserNew()) { |
919 SetFirstLoginPrefs(profile, | 910 SetFirstLoginPrefs(profile, |
920 user_context.GetPublicSessionLocale(), | 911 user_context.GetPublicSessionLocale(), |
921 user_context.GetPublicSessionInputMethod()); | 912 user_context.GetPublicSessionInputMethod()); |
922 } | 913 } |
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1666 if (is_enterprise_managed) | 1657 if (is_enterprise_managed) |
1667 display = USER_PODS_DISPLAY_DISABLED_MANAGED; | 1658 display = USER_PODS_DISPLAY_DISABLED_MANAGED; |
1668 else | 1659 else |
1669 display = USER_PODS_DISPLAY_DISABLED_REGULAR; | 1660 display = USER_PODS_DISPLAY_DISABLED_REGULAR; |
1670 } | 1661 } |
1671 UMA_HISTOGRAM_ENUMERATION("UserSessionManager.UserPodsDisplay", display, | 1662 UMA_HISTOGRAM_ENUMERATION("UserSessionManager.UserPodsDisplay", display, |
1672 NUM_USER_PODS_DISPLAY); | 1663 NUM_USER_PODS_DISPLAY); |
1673 } | 1664 } |
1674 | 1665 |
1675 } // namespace chromeos | 1666 } // namespace chromeos |
OLD | NEW |