| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_FAKE_USER_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_FAKE_USER_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_FAKE_USER_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_FAKE_USER_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/chromeos/login/user.h" | 10 #include "chrome/browser/chromeos/login/user.h" |
| 11 #include "chrome/browser/chromeos/login/user_flow.h" | 11 #include "chrome/browser/chromeos/login/user_flow.h" |
| 12 #include "chrome/browser/chromeos/login/user_image.h" | 12 #include "chrome/browser/chromeos/login/user_image.h" |
| 13 #include "chrome/browser/chromeos/login/user_manager.h" | 13 #include "chrome/browser/chromeos/login/user_manager.h" |
| 14 | 14 |
| 15 namespace chromeos { | 15 namespace chromeos { |
| 16 | 16 |
| 17 // Fake user manager with a barebones implementation. Users can be added | 17 // Fake user manager with a barebones implementation. Users can be added |
| 18 // and set as logged in, and those users can be returned. | 18 // and set as logged in, and those users can be returned. |
| 19 class FakeUserManager : public UserManager { | 19 class FakeUserManager : public UserManager { |
| 20 public: | 20 public: |
| 21 FakeUserManager(); | 21 FakeUserManager(); |
| 22 virtual ~FakeUserManager(); | 22 virtual ~FakeUserManager(); |
| 23 | 23 |
| 24 // Create and add a new user. | 24 // Create and add a new user. |
| 25 void AddUser(const std::string& email); | 25 void AddUser(const std::string& email); |
| 26 | 26 |
| 27 // Calculates the user name hash and calls UserLoggedIn to login a user. | 27 // Create and add a kiosk app user. |
| 28 void LoginUser(const std::string& email); | 28 void AddKioskAppUser(const std::string& kiosk_app_username); |
| 29 |
| 30 // Calculates the user name hash and calls UserLoggedIn to login a user. |
| 31 void LoginUser(const std::string& email); |
| 29 | 32 |
| 30 // UserManager overrides. | 33 // UserManager overrides. |
| 31 virtual const UserList& GetUsers() const OVERRIDE; | 34 virtual const UserList& GetUsers() const OVERRIDE; |
| 32 virtual UserList GetUsersAdmittedForMultiProfile() const OVERRIDE; | 35 virtual UserList GetUsersAdmittedForMultiProfile() const OVERRIDE; |
| 33 virtual const UserList& GetLoggedInUsers() const OVERRIDE; | 36 virtual const UserList& GetLoggedInUsers() const OVERRIDE; |
| 34 | 37 |
| 35 // Set the user as logged in. | 38 // Set the user as logged in. |
| 36 virtual void UserLoggedIn(const std::string& email, | 39 virtual void UserLoggedIn(const std::string& email, |
| 37 const std::string& username_hash, | 40 const std::string& username_hash, |
| 38 bool browser_restart) OVERRIDE; | 41 bool browser_restart) OVERRIDE; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 virtual void NotifyLocalStateChanged() OVERRIDE {} | 130 virtual void NotifyLocalStateChanged() OVERRIDE {} |
| 128 virtual bool AreLocallyManagedUsersAllowed() const OVERRIDE; | 131 virtual bool AreLocallyManagedUsersAllowed() const OVERRIDE; |
| 129 virtual base::FilePath GetUserProfileDir(const std::string& email) const | 132 virtual base::FilePath GetUserProfileDir(const std::string& email) const |
| 130 OVERRIDE; | 133 OVERRIDE; |
| 131 | 134 |
| 132 void set_owner_email(const std::string& owner_email) { | 135 void set_owner_email(const std::string& owner_email) { |
| 133 owner_email_ = owner_email; | 136 owner_email_ = owner_email; |
| 134 } | 137 } |
| 135 | 138 |
| 136 private: | 139 private: |
| 140 // We use this internal function for const-correctness. |
| 141 User* GetActiveUserInternal() const; |
| 142 |
| 137 UserList user_list_; | 143 UserList user_list_; |
| 138 UserList logged_in_users_; | 144 UserList logged_in_users_; |
| 139 std::string owner_email_; | 145 std::string owner_email_; |
| 140 User* primary_user_; | 146 User* primary_user_; |
| 141 | 147 |
| 142 DISALLOW_COPY_AND_ASSIGN(FakeUserManager); | 148 DISALLOW_COPY_AND_ASSIGN(FakeUserManager); |
| 143 }; | 149 }; |
| 144 | 150 |
| 145 } // namespace chromeos | 151 } // namespace chromeos |
| 146 | 152 |
| 147 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_FAKE_USER_MANAGER_H_ | 153 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_FAKE_USER_MANAGER_H_ |
| OLD | NEW |