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