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