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_USER_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USERS_USER_MANAGER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_USER_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_USER_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/chromeos/login/user_flow.h" | 10 #include "chrome/browser/chromeos/login/user_flow.h" |
11 #include "components/user_manager/user.h" | 11 #include "components/user_manager/user.h" |
12 | 12 |
13 class PrefRegistrySimple; | 13 class PrefRegistrySimple; |
14 | 14 |
15 namespace chromeos { | 15 namespace chromeos { |
16 | 16 |
17 class MultiProfileUserController; | 17 class MultiProfileUserController; |
18 class RemoveUserDelegate; | 18 class RemoveUserDelegate; |
19 class UserImageManager; | 19 class UserImageManager; |
20 class SupervisedUserManager; | 20 class SupervisedUserManager; |
21 | 21 |
22 // Base class for UserManagerImpl - provides a mechanism for discovering users | 22 // Interface for UserManagerBase - provides a mechanism for discovering users |
23 // who have logged into this Chrome OS device before and updating that list. | 23 // who have logged into this Chrome OS device before and updating that list. |
24 class UserManager { | 24 class UserManager { |
25 public: | 25 public: |
26 // Interface that observers of UserManager must implement in order | 26 // Interface that observers of UserManager must implement in order |
27 // to receive notification when local state preferences is changed | 27 // to receive notification when local state preferences is changed |
28 class Observer { | 28 class Observer { |
29 public: | 29 public: |
30 // Called when the local state preferences is changed. | 30 // Called when the local state preferences is changed. |
31 virtual void LocalStateChanged(UserManager* user_manager); | 31 virtual void LocalStateChanged(UserManager* user_manager); |
32 | 32 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // Returns an empty list in case when primary user is not a regular one or | 115 // Returns an empty list in case when primary user is not a regular one or |
116 // has a policy that prohibids it to be part of multi-profile session. | 116 // has a policy that prohibids it to be part of multi-profile session. |
117 virtual user_manager::UserList GetUsersAdmittedForMultiProfile() const = 0; | 117 virtual user_manager::UserList GetUsersAdmittedForMultiProfile() const = 0; |
118 | 118 |
119 // Returns a list of users who are currently logged in. | 119 // Returns a list of users who are currently logged in. |
120 virtual const user_manager::UserList& GetLoggedInUsers() const = 0; | 120 virtual const user_manager::UserList& GetLoggedInUsers() const = 0; |
121 | 121 |
122 // Returns a list of users who are currently logged in in the LRU order - | 122 // Returns a list of users who are currently logged in in the LRU order - |
123 // so the active user is the first one in the list. If there is no user logged | 123 // so the active user is the first one in the list. If there is no user logged |
124 // in, the current user will be returned. | 124 // in, the current user will be returned. |
125 virtual const user_manager::UserList& GetLRULoggedInUsers() = 0; | 125 virtual const user_manager::UserList& GetLRULoggedInUsers() const = 0; |
126 | 126 |
127 // Returns a list of users who can unlock the device. | 127 // Returns a list of users who can unlock the device. |
128 // This list is based on policy and whether user is able to do unlock. | 128 // This list is based on policy and whether user is able to do unlock. |
129 // Policy: | 129 // Policy: |
130 // * If user has primary-only policy then it is the only user in unlock users. | 130 // * If user has primary-only policy then it is the only user in unlock users. |
131 // * Otherwise all users with unrestricted policy are added to this list. | 131 // * Otherwise all users with unrestricted policy are added to this list. |
132 // All users that are unable to perform unlock are excluded from this list. | 132 // All users that are unable to perform unlock are excluded from this list. |
133 virtual user_manager::UserList GetUnlockUsers() const = 0; | 133 virtual user_manager::UserList GetUnlockUsers() const = 0; |
134 | 134 |
135 // Returns the email of the owner user. Returns an empty string if there is | 135 // Returns the email of the owner user. Returns an empty string if there is |
136 // no owner for the device. | 136 // no owner for the device. |
137 virtual const std::string& GetOwnerEmail() = 0; | 137 virtual const std::string& GetOwnerEmail() const = 0; |
138 | 138 |
139 // Indicates that a user with the given |user_id| has just logged in. The | 139 // Indicates that a user with the given |user_id| has just logged in. The |
140 // persistent list is updated accordingly if the user is not ephemeral. | 140 // persistent list is updated accordingly if the user is not ephemeral. |
141 // |browser_restart| is true when reloading Chrome after crash to distinguish | 141 // |browser_restart| is true when reloading Chrome after crash to distinguish |
142 // from normal sign in flow. | 142 // from normal sign in flow. |
143 // |username_hash| is used to identify homedir mount point. | 143 // |username_hash| is used to identify homedir mount point. |
144 virtual void UserLoggedIn(const std::string& user_id, | 144 virtual void UserLoggedIn(const std::string& user_id, |
145 const std::string& username_hash, | 145 const std::string& username_hash, |
146 bool browser_restart) = 0; | 146 bool browser_restart) = 0; |
147 | 147 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 ScopedTestUserManager(); | 344 ScopedTestUserManager(); |
345 ~ScopedTestUserManager(); | 345 ~ScopedTestUserManager(); |
346 | 346 |
347 private: | 347 private: |
348 DISALLOW_COPY_AND_ASSIGN(ScopedTestUserManager); | 348 DISALLOW_COPY_AND_ASSIGN(ScopedTestUserManager); |
349 }; | 349 }; |
350 | 350 |
351 } // namespace chromeos | 351 } // namespace chromeos |
352 | 352 |
353 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_USER_MANAGER_H_ | 353 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_USER_MANAGER_H_ |
OLD | NEW |