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_CHROME_USER_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USERS_CHROME_USER_MANAGER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_CHROME_USER_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_CHROME_USER_MANAGER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "components/user_manager/user.h" |
9 #include "components/user_manager/user_manager_base.h" | 10 #include "components/user_manager/user_manager_base.h" |
10 | 11 |
11 namespace base { | 12 namespace base { |
12 class TaskRunner; | 13 class TaskRunner; |
13 } | 14 } |
14 | 15 |
15 namespace chromeos { | 16 namespace chromeos { |
16 | 17 |
17 class MultiProfileUserController; | 18 class MultiProfileUserController; |
18 class SupervisedUserManager; | 19 class SupervisedUserManager; |
19 class UserFlow; | 20 class UserFlow; |
20 class UserImageManager; | 21 class UserImageManager; |
21 | 22 |
22 // Chrome specific interface of the UserManager. | 23 // Chrome specific interface of the UserManager. |
23 class ChromeUserManager : public user_manager::UserManagerBase { | 24 class ChromeUserManager : public user_manager::UserManagerBase { |
24 public: | 25 public: |
25 ChromeUserManager(scoped_refptr<base::TaskRunner> task_runner, | 26 ChromeUserManager(scoped_refptr<base::TaskRunner> task_runner, |
26 scoped_refptr<base::TaskRunner> blocking_task_runner); | 27 scoped_refptr<base::TaskRunner> blocking_task_runner); |
27 virtual ~ChromeUserManager(); | 28 virtual ~ChromeUserManager(); |
28 | 29 |
29 // Returns current ChromeUserManager or NULL if instance hasn't been | 30 // Returns current ChromeUserManager or NULL if instance hasn't been |
30 // yet initialized. | 31 // yet initialized. |
31 static ChromeUserManager* Get(); | 32 static ChromeUserManager* Get(); |
32 | 33 |
| 34 // Helper method for sorting out of user list only users that can create |
| 35 // supervised users. |
| 36 static user_manager::UserList GetUsersAllowedAsSupervisedUserManagers( |
| 37 const user_manager::UserList& user_list); |
| 38 |
33 virtual MultiProfileUserController* GetMultiProfileUserController() = 0; | 39 virtual MultiProfileUserController* GetMultiProfileUserController() = 0; |
34 virtual UserImageManager* GetUserImageManager(const std::string& user_id) = 0; | 40 virtual UserImageManager* GetUserImageManager(const std::string& user_id) = 0; |
35 virtual SupervisedUserManager* GetSupervisedUserManager() = 0; | 41 virtual SupervisedUserManager* GetSupervisedUserManager() = 0; |
36 | 42 |
37 // Method that allows to set |flow| for user identified by |user_id|. | 43 // Method that allows to set |flow| for user identified by |user_id|. |
38 // Flow should be set before login attempt. | 44 // Flow should be set before login attempt. |
39 // Takes ownership of the |flow|, |flow| will be deleted in case of login | 45 // Takes ownership of the |flow|, |flow| will be deleted in case of login |
40 // failure. | 46 // failure. |
41 virtual void SetUserFlow(const std::string& user_id, UserFlow* flow) = 0; | 47 virtual void SetUserFlow(const std::string& user_id, UserFlow* flow) = 0; |
42 | 48 |
43 // Return user flow for current user. Returns instance of DefaultUserFlow if | 49 // Return user flow for current user. Returns instance of DefaultUserFlow if |
44 // no flow was defined for current user, or user is not logged in. | 50 // no flow was defined for current user, or user is not logged in. |
45 // Returned value should not be cached. | 51 // Returned value should not be cached. |
46 virtual UserFlow* GetCurrentUserFlow() const = 0; | 52 virtual UserFlow* GetCurrentUserFlow() const = 0; |
47 | 53 |
48 // Return user flow for user identified by |user_id|. Returns instance of | 54 // Return user flow for user identified by |user_id|. Returns instance of |
49 // DefaultUserFlow if no flow was defined for user. | 55 // DefaultUserFlow if no flow was defined for user. |
50 // Returned value should not be cached. | 56 // Returned value should not be cached. |
51 virtual UserFlow* GetUserFlow(const std::string& user_id) const = 0; | 57 virtual UserFlow* GetUserFlow(const std::string& user_id) const = 0; |
52 | 58 |
53 // Resets user flow for user identified by |user_id|. | 59 // Resets user flow for user identified by |user_id|. |
54 virtual void ResetUserFlow(const std::string& user_id) = 0; | 60 virtual void ResetUserFlow(const std::string& user_id) = 0; |
55 | 61 |
56 DISALLOW_COPY_AND_ASSIGN(ChromeUserManager); | 62 DISALLOW_COPY_AND_ASSIGN(ChromeUserManager); |
57 }; | 63 }; |
58 | 64 |
59 } // namespace chromeos | 65 } // namespace chromeos |
60 | 66 |
61 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_CHROME_USER_MANAGER_H_ | 67 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_CHROME_USER_MANAGER_H_ |
OLD | NEW |