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_SUPERVISED_USER_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USERS_SUPERVISED_USER_MANAGER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_SUPERVISED_USER_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_SUPERVISED_USER_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 | 15 |
16 class PrefRegistrySimple; | 16 class PrefRegistrySimple; |
17 | 17 |
| 18 namespace user_manager { |
| 19 class User; |
| 20 } |
| 21 |
18 namespace chromeos { | 22 namespace chromeos { |
19 | 23 |
20 class User; | |
21 class SupervisedUserAuthentication; | 24 class SupervisedUserAuthentication; |
22 | 25 |
23 // Keys in dictionary with supervised password information. | 26 // Keys in dictionary with supervised password information. |
24 extern const char kSchemaVersion[]; | 27 extern const char kSchemaVersion[]; |
25 extern const char kPasswordRevision[]; | 28 extern const char kPasswordRevision[]; |
26 extern const char kSalt[]; | 29 extern const char kSalt[]; |
27 extern const char kRequirePasswordUpdate[]; | 30 extern const char kRequirePasswordUpdate[]; |
28 extern const char kHasIncompleteKey[]; | 31 extern const char kHasIncompleteKey[]; |
29 extern const int kMinPasswordRevision; | 32 extern const int kMinPasswordRevision; |
30 | 33 |
(...skipping 22 matching lines...) Expand all Loading... |
53 // Checks if given user have supervised users on this device. | 56 // Checks if given user have supervised users on this device. |
54 | 57 |
55 virtual bool HasSupervisedUsers(const std::string& manager_id) const = 0; | 58 virtual bool HasSupervisedUsers(const std::string& manager_id) const = 0; |
56 | 59 |
57 // Creates supervised user with given |display_name| and |local_user_id| | 60 // Creates supervised user with given |display_name| and |local_user_id| |
58 // and persists that to user list. Also links this user identified by | 61 // and persists that to user list. Also links this user identified by |
59 // |sync_user_id| to manager with a |manager_id|. | 62 // |sync_user_id| to manager with a |manager_id|. |
60 // Returns created user, or existing user if there already | 63 // Returns created user, or existing user if there already |
61 // was a supervised user with such display name. | 64 // was a supervised user with such display name. |
62 // TODO(antrim): Refactor into a single struct to have only 1 getter. | 65 // TODO(antrim): Refactor into a single struct to have only 1 getter. |
63 virtual const User* CreateUserRecord( | 66 virtual const user_manager::User* CreateUserRecord( |
64 const std::string& manager_id, | 67 const std::string& manager_id, |
65 const std::string& local_user_id, | 68 const std::string& local_user_id, |
66 const std::string& sync_user_id, | 69 const std::string& sync_user_id, |
67 const base::string16& display_name) = 0; | 70 const base::string16& display_name) = 0; |
68 | 71 |
69 // Generates unique user ID for supervised user. | 72 // Generates unique user ID for supervised user. |
70 virtual std::string GenerateUserId() = 0; | 73 virtual std::string GenerateUserId() = 0; |
71 | 74 |
72 // Returns the supervised user with the given |display_name| if found in | 75 // Returns the supervised user with the given |display_name| if found in |
73 // the persistent list. Returns |NULL| otherwise. | 76 // the persistent list. Returns |NULL| otherwise. |
74 virtual const User* FindByDisplayName( | 77 virtual const user_manager::User* FindByDisplayName( |
75 const base::string16& display_name) const = 0; | 78 const base::string16& display_name) const = 0; |
76 | 79 |
77 // Returns the supervised user with the given |sync_id| if found in | 80 // Returns the supervised user with the given |sync_id| if found in |
78 // the persistent list. Returns |NULL| otherwise. | 81 // the persistent list. Returns |NULL| otherwise. |
79 virtual const User* FindBySyncId(const std::string& sync_id) const = 0; | 82 virtual const user_manager::User* FindBySyncId( |
| 83 const std::string& sync_id) const = 0; |
80 | 84 |
81 // Returns sync_user_id for supervised user with |user_id| or empty string if | 85 // Returns sync_user_id for supervised user with |user_id| or empty string if |
82 // such user is not found or it doesn't have user_id defined. | 86 // such user is not found or it doesn't have user_id defined. |
83 virtual std::string GetUserSyncId(const std::string& user_id) const = 0; | 87 virtual std::string GetUserSyncId(const std::string& user_id) const = 0; |
84 | 88 |
85 // Returns the display name for manager of user |user_id| if it is known | 89 // Returns the display name for manager of user |user_id| if it is known |
86 // (was previously set by a |SaveUserDisplayName| call). | 90 // (was previously set by a |SaveUserDisplayName| call). |
87 // Otherwise, returns a manager id. | 91 // Otherwise, returns a manager id. |
88 virtual base::string16 GetManagerDisplayName( | 92 virtual base::string16 GetManagerDisplayName( |
89 const std::string& user_id) const = 0; | 93 const std::string& user_id) const = 0; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 virtual void ConfigureSyncWithToken(Profile* profile, | 134 virtual void ConfigureSyncWithToken(Profile* profile, |
131 const std::string& token) = 0; | 135 const std::string& token) = 0; |
132 | 136 |
133 private: | 137 private: |
134 DISALLOW_COPY_AND_ASSIGN(SupervisedUserManager); | 138 DISALLOW_COPY_AND_ASSIGN(SupervisedUserManager); |
135 }; | 139 }; |
136 | 140 |
137 } // namespace chromeos | 141 } // namespace chromeos |
138 | 142 |
139 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_SUPERVISED_USER_MANAGER_H_ | 143 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_SUPERVISED_USER_MANAGER_H_ |
OLD | NEW |