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_CHROME_USER_MANAGER_INTERFACE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_CHROME_USER_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_CHROME_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 ChromeUserManagerInterface { |
25 public: | 21 public: |
26 ChromeUserManager(scoped_refptr<base::TaskRunner> task_runner, | 22 ChromeUserManagerInterface() {} |
27 scoped_refptr<base::TaskRunner> blocking_task_runner); | 23 virtual ~ChromeUserManagerInterface() {} |
28 ~ChromeUserManager() override; | |
29 | |
30 // Returns current ChromeUserManager or NULL if instance hasn't been | |
31 // yet initialized. | |
32 static ChromeUserManager* Get(); | |
33 | 24 |
34 // Helper method for sorting out of user list only users that can create | 25 // Helper method for sorting out of user list only users that can create |
35 // supervised users. | 26 // supervised users. |
36 static user_manager::UserList GetUsersAllowedAsSupervisedUserManagers( | 27 static user_manager::UserList GetUsersAllowedAsSupervisedUserManagers( |
Nikita (slow)
2015/01/20 16:39:28
As discussed makes sense to leave in ChromeUserMan
merkulova
2015/01/21 14:10:33
Done.
| |
37 const user_manager::UserList& user_list); | 28 const user_manager::UserList& user_list) { |
29 user_manager::UserList result; | |
ygorshenin1
2015/01/20 18:33:40
Header files are usually used for declarations, no
merkulova
2015/01/21 14:10:33
Done.
| |
30 for (user_manager::User* user : user_list) { | |
31 if (user->GetType() == user_manager::USER_TYPE_REGULAR) { | |
32 result.push_back(user); | |
33 } | |
34 } | |
35 return result; | |
36 } | |
38 | 37 |
39 virtual MultiProfileUserController* GetMultiProfileUserController() = 0; | 38 virtual MultiProfileUserController* GetMultiProfileUserController() = 0; |
40 virtual UserImageManager* GetUserImageManager(const std::string& user_id) = 0; | 39 virtual UserImageManager* GetUserImageManager(const std::string& user_id) = 0; |
41 virtual SupervisedUserManager* GetSupervisedUserManager() = 0; | 40 virtual SupervisedUserManager* GetSupervisedUserManager() = 0; |
42 | 41 |
43 // Method that allows to set |flow| for user identified by |user_id|. | 42 // Method that allows to set |flow| for user identified by |user_id|. |
44 // Flow should be set before login attempt. | 43 // Flow should be set before login attempt. |
45 // Takes ownership of the |flow|, |flow| will be deleted in case of login | 44 // Takes ownership of the |flow|, |flow| will be deleted in case of login |
46 // failure. | 45 // failure. |
47 virtual void SetUserFlow(const std::string& user_id, UserFlow* flow) = 0; | 46 virtual void SetUserFlow(const std::string& user_id, UserFlow* flow) = 0; |
48 | 47 |
49 // Return user flow for current user. Returns instance of DefaultUserFlow if | 48 // 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. | 49 // no flow was defined for current user, or user is not logged in. |
51 // Returned value should not be cached. | 50 // Returned value should not be cached. |
52 virtual UserFlow* GetCurrentUserFlow() const = 0; | 51 virtual UserFlow* GetCurrentUserFlow() const = 0; |
53 | 52 |
54 // Return user flow for user identified by |user_id|. Returns instance of | 53 // Return user flow for user identified by |user_id|. Returns instance of |
55 // DefaultUserFlow if no flow was defined for user. | 54 // DefaultUserFlow if no flow was defined for user. |
56 // Returned value should not be cached. | 55 // Returned value should not be cached. |
57 virtual UserFlow* GetUserFlow(const std::string& user_id) const = 0; | 56 virtual UserFlow* GetUserFlow(const std::string& user_id) const = 0; |
58 | 57 |
59 // Resets user flow for user identified by |user_id|. | 58 // Resets user flow for user identified by |user_id|. |
60 virtual void ResetUserFlow(const std::string& user_id) = 0; | 59 virtual void ResetUserFlow(const std::string& user_id) = 0; |
61 | 60 |
62 DISALLOW_COPY_AND_ASSIGN(ChromeUserManager); | 61 // Returns list of users allowed for supervised user creation. |
62 // Returns an empty list in cases when supervised user creation or adding new | |
63 // users is restricted. | |
64 virtual user_manager::UserList | |
65 GetUsersAllowedForSupervisedUsersCreation() const = 0; | |
66 | |
67 DISALLOW_COPY_AND_ASSIGN(ChromeUserManagerInterface); | |
63 }; | 68 }; |
64 | 69 |
65 } // namespace chromeos | 70 } // namespace chromeos |
66 | 71 |
67 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_CHROME_USER_MANAGER_H_ | 72 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_CHROME_USER_MANAGER_INTERFACE_H_ |
OLD | NEW |