| 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/users/fake_user_manager.h" | 5 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" |
| 6 | 6 |
| 7 #include "base/task_runner.h" | 7 #include "base/task_runner.h" |
| 8 #include "chrome/browser/chromeos/login/users/fake_supervised_user_manager.h" | 8 #include "chrome/browser/chromeos/login/users/fake_supervised_user_manager.h" |
| 9 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 9 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 10 #include "chrome/grit/theme_resources.h" | 10 #include "chrome/grit/theme_resources.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 } | 160 } |
| 161 | 161 |
| 162 user_manager::User* FakeUserManager::GetActiveUser() { | 162 user_manager::User* FakeUserManager::GetActiveUser() { |
| 163 return GetActiveUserInternal(); | 163 return GetActiveUserInternal(); |
| 164 } | 164 } |
| 165 | 165 |
| 166 void FakeUserManager::SwitchActiveUser(const std::string& email) { | 166 void FakeUserManager::SwitchActiveUser(const std::string& email) { |
| 167 active_user_id_ = email; | 167 active_user_id_ = email; |
| 168 ProfileHelper::Get()->ActiveUserHashChanged( | 168 ProfileHelper::Get()->ActiveUserHashChanged( |
| 169 ProfileHelper::GetUserIdHashByUserIdForTesting(email)); | 169 ProfileHelper::GetUserIdHashByUserIdForTesting(email)); |
| 170 if (user_list_.size() && !active_user_id_.empty()) { |
| 171 for (user_manager::UserList::const_iterator it = user_list_.begin(); |
| 172 it != user_list_.end(); ++it) { |
| 173 (*it)->set_is_active((*it)->email() == active_user_id_); |
| 174 } |
| 175 } |
| 170 } | 176 } |
| 171 | 177 |
| 172 void FakeUserManager::SaveUserDisplayName( | 178 void FakeUserManager::SaveUserDisplayName( |
| 173 const std::string& username, | 179 const std::string& username, |
| 174 const base::string16& display_name) { | 180 const base::string16& display_name) { |
| 175 for (user_manager::UserList::iterator it = user_list_.begin(); | 181 for (user_manager::UserList::iterator it = user_list_.begin(); |
| 176 it != user_list_.end(); | 182 it != user_list_.end(); |
| 177 ++it) { | 183 ++it) { |
| 178 if ((*it)->email() == username) { | 184 if ((*it)->email() == username) { |
| 179 (*it)->set_display_name(display_name); | 185 (*it)->set_display_name(display_name); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 bool FakeUserManager::IsKioskApp(const std::string& user_id) const { | 352 bool FakeUserManager::IsKioskApp(const std::string& user_id) const { |
| 347 return false; | 353 return false; |
| 348 } | 354 } |
| 349 | 355 |
| 350 bool FakeUserManager::IsPublicAccountMarkedForRemoval( | 356 bool FakeUserManager::IsPublicAccountMarkedForRemoval( |
| 351 const std::string& user_id) const { | 357 const std::string& user_id) const { |
| 352 return false; | 358 return false; |
| 353 } | 359 } |
| 354 | 360 |
| 355 } // namespace chromeos | 361 } // namespace chromeos |
| OLD | NEW |