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_IMPL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USERS_SUPERVISED_USER_MANAGER_IMPL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_SUPERVISED_USER_MANAGER_IMPL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_SUPERVISED_USER_MANAGER_IMPL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" | 12 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" |
13 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 13 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
14 | 14 |
15 namespace chromeos { | 15 namespace chromeos { |
16 | 16 |
17 class ChromeUserManagerImpl; | 17 class ChromeUserManagerImpl; |
18 class CrosSettings; | 18 class CrosSettings; |
19 class SupervisedUserTestBase; | 19 class SupervisedUserTestBase; |
20 | 20 |
21 // Implementation of the UserManager. | 21 // Implementation of the UserManager. |
22 class SupervisedUserManagerImpl | 22 class SupervisedUserManagerImpl |
23 : public SupervisedUserManager { | 23 : public SupervisedUserManager { |
24 public: | 24 public: |
25 ~SupervisedUserManagerImpl() override; | 25 ~SupervisedUserManagerImpl() override; |
26 | 26 |
27 bool HasSupervisedUsers(const std::string& manager_id) const override; | 27 bool HasSupervisedUsers(const user_manager::UserID& manager_id) const override
; |
28 const user_manager::User* CreateUserRecord( | 28 const user_manager::User* CreateUserRecord( |
29 const std::string& manager_id, | 29 const user_manager::UserID& manager_id, |
30 const std::string& local_user_id, | 30 const user_manager::UserID& local_user_id, |
31 const std::string& sync_user_id, | 31 const std::string& sync_user_id, |
32 const base::string16& display_name) override; | 32 const base::string16& display_name) override; |
33 std::string GenerateUserId() override; | 33 user_manager::UserID GenerateUserId() override; |
34 const user_manager::User* FindByDisplayName( | 34 const user_manager::User* FindByDisplayName( |
35 const base::string16& display_name) const override; | 35 const base::string16& display_name) const override; |
36 const user_manager::User* FindBySyncId( | 36 const user_manager::User* FindBySyncId( |
37 const std::string& sync_id) const override; | 37 const std::string& sync_id) const override; |
38 std::string GetUserSyncId(const std::string& user_id) const override; | 38 std::string GetUserSyncId(const user_manager::UserID& user_id) const override; |
39 base::string16 GetManagerDisplayName( | 39 base::string16 GetManagerDisplayName( |
40 const std::string& user_id) const override; | 40 const user_manager::UserID& user_id) const override; |
41 std::string GetManagerUserId(const std::string& user_id) const override; | 41 user_manager::UserID GetManagerUserId(const user_manager::UserID& user_id) con
st override; |
42 std::string GetManagerDisplayEmail(const std::string& user_id) const override; | 42 std::string GetManagerDisplayEmail(const user_manager::UserID& user_id) const
override; |
43 void StartCreationTransaction(const base::string16& display_name) override; | 43 void StartCreationTransaction(const base::string16& display_name) override; |
44 void SetCreationTransactionUserId(const std::string& user_id) override; | 44 void SetCreationTransactionUserId(const user_manager::UserID& user_id) overrid
e; |
45 void CommitCreationTransaction() override; | 45 void CommitCreationTransaction() override; |
46 SupervisedUserAuthentication* GetAuthentication() override; | 46 SupervisedUserAuthentication* GetAuthentication() override; |
47 void GetPasswordInformation(const std::string& user_id, | 47 void GetPasswordInformation(const user_manager::UserID& user_id, |
48 base::DictionaryValue* result) override; | 48 base::DictionaryValue* result) override; |
49 void SetPasswordInformation( | 49 void SetPasswordInformation( |
50 const std::string& user_id, | 50 const user_manager::UserID& user_id, |
51 const base::DictionaryValue* password_info) override; | 51 const base::DictionaryValue* password_info) override; |
52 void LoadSupervisedUserToken(Profile* profile, | 52 void LoadSupervisedUserToken(Profile* profile, |
53 const LoadTokenCallback& callback) override; | 53 const LoadTokenCallback& callback) override; |
54 void ConfigureSyncWithToken(Profile* profile, | 54 void ConfigureSyncWithToken(Profile* profile, |
55 const std::string& token) override; | 55 const std::string& token) override; |
56 | 56 |
57 private: | 57 private: |
58 friend class ChromeUserManagerImpl; | 58 friend class ChromeUserManagerImpl; |
59 friend class UserManager; | 59 friend class UserManager; |
60 friend class SupervisedUserTestBase; | 60 friend class SupervisedUserTestBase; |
61 | 61 |
62 explicit SupervisedUserManagerImpl(ChromeUserManagerImpl* owner); | 62 explicit SupervisedUserManagerImpl(ChromeUserManagerImpl* owner); |
63 | 63 |
64 // Returns true if there is non-committed user creation transaction. | 64 // Returns true if there is non-committed user creation transaction. |
65 bool HasFailedUserCreationTransaction(); | 65 bool HasFailedUserCreationTransaction(); |
66 | 66 |
67 // Attempts to clean up data that could be left from failed user creation. | 67 // Attempts to clean up data that could be left from failed user creation. |
68 void RollbackUserCreationTransaction(); | 68 void RollbackUserCreationTransaction(); |
69 | 69 |
70 void RemoveNonCryptohomeData(const std::string& user_id); | 70 void RemoveNonCryptohomeData(const user_manager::UserID& user_id); |
71 | 71 |
72 bool CheckForFirstRun(const std::string& user_id); | 72 bool CheckForFirstRun(const user_manager::UserID& user_id); |
73 | 73 |
74 // Update name if this user is manager of some managed users. | 74 // Update name if this user is manager of some managed users. |
75 void UpdateManagerName(const std::string& manager_id, | 75 void UpdateManagerName(const user_manager::UserID& manager_id, |
76 const base::string16& new_display_name); | 76 const base::string16& new_display_name); |
77 | 77 |
78 bool GetUserStringValue(const std::string& user_id, | 78 bool GetUserStringValue(const user_manager::UserID& user_id, |
79 const char* key, | 79 const char* key, |
80 std::string* out_value) const; | 80 std::string* out_value) const; |
81 | 81 |
82 void SetUserStringValue(const std::string& user_id, | 82 void SetUserStringValue(const user_manager::UserID& user_id, |
83 const char* key, | 83 const char* key, |
84 const std::string& value); | 84 const std::string& value); |
85 | 85 |
86 bool GetUserIntegerValue(const std::string& user_id, | 86 bool GetUserIntegerValue(const user_manager::UserID& user_id, |
87 const char* key, | 87 const char* key, |
88 int* out_value) const; | 88 int* out_value) const; |
89 | 89 |
90 void SetUserIntegerValue(const std::string& user_id, | 90 void SetUserIntegerValue(const user_manager::UserID& user_id, |
91 const char* key, | 91 const char* key, |
92 const int value); | 92 const int value); |
93 | 93 |
94 bool GetUserBooleanValue(const std::string& user_id, | 94 bool GetUserBooleanValue(const user_manager::UserID& user_id, |
95 const char* key, | 95 const char* key, |
96 bool* out_value) const; | 96 bool* out_value) const; |
97 | 97 |
98 void SetUserBooleanValue(const std::string& user_id, | 98 void SetUserBooleanValue(const user_manager::UserID& user_id, |
99 const char* key, | 99 const char* key, |
100 const bool value); | 100 const bool value); |
101 | 101 |
102 void CleanPref(const std::string& user_id, | 102 void CleanPref(const user_manager::UserID& user_id, |
103 const char* key); | 103 const char* key); |
104 | 104 |
105 ChromeUserManagerImpl* owner_; | 105 ChromeUserManagerImpl* owner_; |
106 | 106 |
107 // Interface to the signed settings store. | 107 // Interface to the signed settings store. |
108 CrosSettings* cros_settings_; | 108 CrosSettings* cros_settings_; |
109 | 109 |
110 scoped_ptr<SupervisedUserAuthentication> authentication_; | 110 scoped_ptr<SupervisedUserAuthentication> authentication_; |
111 | 111 |
112 DISALLOW_COPY_AND_ASSIGN(SupervisedUserManagerImpl); | 112 DISALLOW_COPY_AND_ASSIGN(SupervisedUserManagerImpl); |
113 }; | 113 }; |
114 | 114 |
115 } // namespace chromeos | 115 } // namespace chromeos |
116 | 116 |
117 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_SUPERVISED_USER_MANAGER_IMPL_H_ | 117 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_SUPERVISED_USER_MANAGER_IMPL_H_ |
OLD | NEW |