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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 NOTREACHED(); | 591 NOTREACHED(); |
592 break; | 592 break; |
593 } | 593 } |
594 } | 594 } |
595 | 595 |
596 void UserSessionManager::InitProfilePreferences(Profile* profile, | 596 void UserSessionManager::InitProfilePreferences(Profile* profile, |
597 const std::string& user_id) { | 597 const std::string& user_id) { |
598 if (UserManager::Get()->IsCurrentUserNew()) | 598 if (UserManager::Get()->IsCurrentUserNew()) |
599 SetFirstLoginPrefs(profile->GetPrefs()); | 599 SetFirstLoginPrefs(profile->GetPrefs()); |
600 | 600 |
601 if (UserManager::Get()->IsLoggedInAsLocallyManagedUser()) { | 601 if (UserManager::Get()->IsLoggedInAsSupervisedUser()) { |
602 User* active_user = UserManager::Get()->GetActiveUser(); | 602 User* active_user = UserManager::Get()->GetActiveUser(); |
603 std::string managed_user_sync_id = | 603 std::string supervised_user_sync_id = |
604 UserManager::Get()->GetSupervisedUserManager()-> | 604 UserManager::Get()->GetSupervisedUserManager()-> |
605 GetUserSyncId(active_user->email()); | 605 GetUserSyncId(active_user->email()); |
606 profile->GetPrefs()->SetString(prefs::kSupervisedUserId, | 606 profile->GetPrefs()->SetString(prefs::kSupervisedUserId, |
607 managed_user_sync_id); | 607 supervised_user_sync_id); |
608 } else if (UserManager::Get()->IsLoggedInAsRegularUser()) { | 608 } else if (UserManager::Get()->IsLoggedInAsRegularUser()) { |
609 // Make sure that the google service username is properly set (we do this | 609 // Make sure that the google service username is properly set (we do this |
610 // on every sign in, not just the first login, to deal with existing | 610 // on every sign in, not just the first login, to deal with existing |
611 // profiles that might not have it set yet). | 611 // profiles that might not have it set yet). |
612 SigninManagerBase* signin_manager = | 612 SigninManagerBase* signin_manager = |
613 SigninManagerFactory::GetForProfile(profile); | 613 SigninManagerFactory::GetForProfile(profile); |
614 signin_manager->SetAuthenticatedUsername(user_id); | 614 signin_manager->SetAuthenticatedUsername(user_id); |
615 } | 615 } |
616 } | 616 } |
617 | 617 |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 | 894 |
895 void UserSessionManager::NotifyPendingUserSessionsRestoreFinished() { | 895 void UserSessionManager::NotifyPendingUserSessionsRestoreFinished() { |
896 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 896 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
897 user_sessions_restored_ = true; | 897 user_sessions_restored_ = true; |
898 FOR_EACH_OBSERVER(UserSessionStateObserver, | 898 FOR_EACH_OBSERVER(UserSessionStateObserver, |
899 session_state_observer_list_, | 899 session_state_observer_list_, |
900 PendingUserSessionsRestoreFinished()); | 900 PendingUserSessionsRestoreFinished()); |
901 } | 901 } |
902 | 902 |
903 } // namespace chromeos | 903 } // namespace chromeos |
OLD | NEW |