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 } | |
176 } | 170 } |
177 | 171 |
178 void FakeUserManager::SaveUserDisplayName( | 172 void FakeUserManager::SaveUserDisplayName( |
179 const std::string& username, | 173 const std::string& username, |
180 const base::string16& display_name) { | 174 const base::string16& display_name) { |
181 for (user_manager::UserList::iterator it = user_list_.begin(); | 175 for (user_manager::UserList::iterator it = user_list_.begin(); |
182 it != user_list_.end(); | 176 it != user_list_.end(); |
183 ++it) { | 177 ++it) { |
184 if ((*it)->email() == username) { | 178 if ((*it)->email() == username) { |
185 (*it)->set_display_name(display_name); | 179 (*it)->set_display_name(display_name); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 bool FakeUserManager::IsKioskApp(const std::string& user_id) const { | 346 bool FakeUserManager::IsKioskApp(const std::string& user_id) const { |
353 return false; | 347 return false; |
354 } | 348 } |
355 | 349 |
356 bool FakeUserManager::IsPublicAccountMarkedForRemoval( | 350 bool FakeUserManager::IsPublicAccountMarkedForRemoval( |
357 const std::string& user_id) const { | 351 const std::string& user_id) const { |
358 return false; | 352 return false; |
359 } | 353 } |
360 | 354 |
361 } // namespace chromeos | 355 } // namespace chromeos |
OLD | NEW |