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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USERS_FAKE_USER_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USERS_FAKE_USER_MANAGER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_FAKE_USER_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_FAKE_USER_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 // Create and add a public account user. | 34 // Create and add a public account user. |
35 const user_manager::User* AddPublicAccountUser(const std::string& email); | 35 const user_manager::User* AddPublicAccountUser(const std::string& email); |
36 | 36 |
37 // Calculates the user name hash and calls UserLoggedIn to login a user. | 37 // Calculates the user name hash and calls UserLoggedIn to login a user. |
38 void LoginUser(const std::string& email); | 38 void LoginUser(const std::string& email); |
39 | 39 |
40 // ChromeUserManager overrides. | 40 // ChromeUserManager overrides. |
41 MultiProfileUserController* GetMultiProfileUserController() override; | 41 MultiProfileUserController* GetMultiProfileUserController() override; |
42 UserImageManager* GetUserImageManager(const std::string& user_id) override; | 42 UserImageManager* GetUserImageManager(const std::string& user_id) override; |
43 SupervisedUserManager* GetSupervisedUserManager() override; | 43 SupervisedUserManager* GetSupervisedUserManager() override; |
44 void SetUserFlow(const std::string& email, UserFlow* flow) override {} | 44 void SetUserFlow(const std::string& email, UserFlow* flow) override; |
45 UserFlow* GetCurrentUserFlow() const override; | 45 UserFlow* GetCurrentUserFlow() const override; |
46 UserFlow* GetUserFlow(const std::string& email) const override; | 46 UserFlow* GetUserFlow(const std::string& email) const override; |
47 void ResetUserFlow(const std::string& email) override {} | 47 void ResetUserFlow(const std::string& email) override; |
48 | 48 |
49 // UserManager overrides. | 49 // UserManager overrides. |
50 const user_manager::UserList& GetUsers() const override; | 50 const user_manager::UserList& GetUsers() const override; |
51 user_manager::UserList GetUsersAllowedForMultiProfile() const override; | 51 user_manager::UserList GetUsersAllowedForMultiProfile() const override; |
52 user_manager::UserList GetUsersAllowedForSupervisedUsersCreation() | 52 user_manager::UserList GetUsersAllowedForSupervisedUsersCreation() |
53 const override; | 53 const override; |
54 const user_manager::UserList& GetLoggedInUsers() const override; | 54 const user_manager::UserList& GetLoggedInUsers() const override; |
55 | 55 |
56 // Set the user as logged in. | 56 // Set the user as logged in. |
57 void UserLoggedIn(const std::string& email, | 57 void UserLoggedIn(const std::string& email, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 void set_multi_profile_user_controller( | 140 void set_multi_profile_user_controller( |
141 MultiProfileUserController* controller) { | 141 MultiProfileUserController* controller) { |
142 multi_profile_user_controller_ = controller; | 142 multi_profile_user_controller_ = controller; |
143 } | 143 } |
144 | 144 |
145 private: | 145 private: |
146 // We use this internal function for const-correctness. | 146 // We use this internal function for const-correctness. |
147 user_manager::User* GetActiveUserInternal() const; | 147 user_manager::User* GetActiveUserInternal() const; |
148 | 148 |
| 149 // Lazily creates default user flow. |
| 150 UserFlow* GetDefaultUserFlow() const; |
| 151 |
149 scoped_ptr<FakeSupervisedUserManager> supervised_user_manager_; | 152 scoped_ptr<FakeSupervisedUserManager> supervised_user_manager_; |
150 user_manager::UserList user_list_; | 153 user_manager::UserList user_list_; |
151 user_manager::UserList logged_in_users_; | 154 user_manager::UserList logged_in_users_; |
152 std::string owner_email_; | 155 std::string owner_email_; |
153 user_manager::User* primary_user_; | 156 user_manager::User* primary_user_; |
154 | 157 |
155 // If set this is the active user. If empty, the first created user is the | 158 // If set this is the active user. If empty, the first created user is the |
156 // active user. | 159 // active user. |
157 std::string active_user_id_; | 160 std::string active_user_id_; |
158 MultiProfileUserController* multi_profile_user_controller_; | 161 MultiProfileUserController* multi_profile_user_controller_; |
159 | 162 |
| 163 typedef std::map<std::string, UserFlow*> FlowMap; |
| 164 |
| 165 // Lazy-initialized default flow. |
| 166 mutable scoped_ptr<UserFlow> default_flow_; |
| 167 |
| 168 // Specific flows by user e-mail. |
| 169 // Keys should be canonicalized before access. |
| 170 FlowMap specific_flows_; |
| 171 |
160 DISALLOW_COPY_AND_ASSIGN(FakeUserManager); | 172 DISALLOW_COPY_AND_ASSIGN(FakeUserManager); |
161 }; | 173 }; |
162 | 174 |
163 } // namespace chromeos | 175 } // namespace chromeos |
164 | 176 |
165 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_FAKE_USER_MANAGER_H_ | 177 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_FAKE_USER_MANAGER_H_ |
OLD | NEW |