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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 | 305 |
306 bool FakeUserManager::IsSessionStarted() const { | 306 bool FakeUserManager::IsSessionStarted() const { |
307 return false; | 307 return false; |
308 } | 308 } |
309 | 309 |
310 bool FakeUserManager::IsUserNonCryptohomeDataEphemeral( | 310 bool FakeUserManager::IsUserNonCryptohomeDataEphemeral( |
311 const std::string& email) const { | 311 const std::string& email) const { |
312 return false; | 312 return false; |
313 } | 313 } |
314 | 314 |
| 315 void FakeUserManager::SetUserFlow(const std::string& email, UserFlow* flow) { |
| 316 ResetUserFlow(email); |
| 317 specific_flows_[email] = flow; |
| 318 } |
| 319 |
315 UserFlow* FakeUserManager::GetCurrentUserFlow() const { | 320 UserFlow* FakeUserManager::GetCurrentUserFlow() const { |
316 return NULL; | 321 if (!IsUserLoggedIn()) |
| 322 return GetDefaultUserFlow(); |
| 323 return GetUserFlow(GetLoggedInUser()->email()); |
317 } | 324 } |
318 | 325 |
319 UserFlow* FakeUserManager::GetUserFlow(const std::string& email) const { | 326 UserFlow* FakeUserManager::GetUserFlow(const std::string& email) const { |
320 return NULL; | 327 FlowMap::const_iterator it = specific_flows_.find(email); |
| 328 if (it != specific_flows_.end()) |
| 329 return it->second; |
| 330 return GetDefaultUserFlow(); |
| 331 } |
| 332 |
| 333 void FakeUserManager::ResetUserFlow(const std::string& email) { |
| 334 FlowMap::iterator it = specific_flows_.find(email); |
| 335 if (it != specific_flows_.end()) { |
| 336 delete it->second; |
| 337 specific_flows_.erase(it); |
| 338 } |
| 339 } |
| 340 |
| 341 UserFlow* FakeUserManager::GetDefaultUserFlow() const { |
| 342 if (!default_flow_.get()) |
| 343 default_flow_.reset(new DefaultUserFlow()); |
| 344 return default_flow_.get(); |
321 } | 345 } |
322 | 346 |
323 bool FakeUserManager::AreSupervisedUsersAllowed() const { | 347 bool FakeUserManager::AreSupervisedUsersAllowed() const { |
324 return true; | 348 return true; |
325 } | 349 } |
326 | 350 |
327 bool FakeUserManager::AreEphemeralUsersEnabled() const { | 351 bool FakeUserManager::AreEphemeralUsersEnabled() const { |
328 return false; | 352 return false; |
329 } | 353 } |
330 | 354 |
(...skipping 17 matching lines...) Expand all Loading... |
348 bool FakeUserManager::IsKioskApp(const std::string& user_id) const { | 372 bool FakeUserManager::IsKioskApp(const std::string& user_id) const { |
349 return false; | 373 return false; |
350 } | 374 } |
351 | 375 |
352 bool FakeUserManager::IsPublicAccountMarkedForRemoval( | 376 bool FakeUserManager::IsPublicAccountMarkedForRemoval( |
353 const std::string& user_id) const { | 377 const std::string& user_id) const { |
354 return false; | 378 return false; |
355 } | 379 } |
356 | 380 |
357 } // namespace chromeos | 381 } // namespace chromeos |
OLD | NEW |