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