OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_USER_MANAGER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
| 10 #include <vector> |
10 | 11 |
11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/singleton.h" | |
14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
16 #include "base/values.h" | |
17 #include "chrome/browser/chromeos/login/user.h" | 16 #include "chrome/browser/chromeos/login/user.h" |
18 #include "chrome/browser/chromeos/login/user_image_manager_impl.h" | 17 #include "chrome/browser/chromeos/login/user_image_manager_impl.h" |
19 #include "chrome/browser/chromeos/login/user_manager.h" | 18 #include "chrome/browser/chromeos/login/user_manager.h" |
20 #include "chrome/browser/chromeos/login/wallpaper_manager.h" | 19 #include "chrome/browser/chromeos/login/wallpaper_manager.h" |
21 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" | 20 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" |
22 #include "chrome/browser/chromeos/settings/cros_settings.h" | 21 #include "chrome/browser/chromeos/settings/cros_settings.h" |
23 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 22 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
24 #include "chrome/browser/sync/profile_sync_service_observer.h" | 23 #include "chrome/browser/sync/profile_sync_service_observer.h" |
25 #include "content/public/browser/notification_observer.h" | 24 #include "content/public/browser/notification_observer.h" |
26 #include "content/public/browser/notification_registrar.h" | 25 #include "content/public/browser/notification_registrar.h" |
27 | 26 |
28 class PrefService; | 27 class PrefService; |
29 class ProfileSyncService; | 28 class ProfileSyncService; |
30 | 29 |
| 30 namespace policy { |
| 31 class DeviceLocalAccount; |
| 32 } |
| 33 |
31 namespace chromeos { | 34 namespace chromeos { |
32 | 35 |
33 class RemoveUserDelegate; | 36 class RemoveUserDelegate; |
34 class SessionLengthLimiter; | 37 class SessionLengthLimiter; |
35 | 38 |
36 // Implementation of the UserManager. | 39 // Implementation of the UserManager. |
37 class UserManagerImpl | 40 class UserManagerImpl |
38 : public UserManager, | 41 : public UserManager, |
39 public ProfileSyncServiceObserver, | 42 public ProfileSyncServiceObserver, |
40 public content::NotificationObserver, | 43 public content::NotificationObserver, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 127 |
125 // content::NotificationObserver implementation. | 128 // content::NotificationObserver implementation. |
126 virtual void Observe(int type, | 129 virtual void Observe(int type, |
127 const content::NotificationSource& source, | 130 const content::NotificationSource& source, |
128 const content::NotificationDetails& details) OVERRIDE; | 131 const content::NotificationDetails& details) OVERRIDE; |
129 | 132 |
130 // ProfileSyncServiceObserver implementation. | 133 // ProfileSyncServiceObserver implementation. |
131 virtual void OnStateChanged() OVERRIDE; | 134 virtual void OnStateChanged() OVERRIDE; |
132 | 135 |
133 // policy::DeviceLocalAccountPolicyService::Observer implementation. | 136 // policy::DeviceLocalAccountPolicyService::Observer implementation. |
134 virtual void OnPolicyUpdated(const std::string& account_id) OVERRIDE; | 137 virtual void OnPolicyUpdated(const std::string& user_id) OVERRIDE; |
135 virtual void OnDeviceLocalAccountsChanged() OVERRIDE; | 138 virtual void OnDeviceLocalAccountsChanged() OVERRIDE; |
136 | 139 |
137 private: | 140 private: |
138 friend class UserManager; | 141 friend class UserManager; |
139 friend class WallpaperManager; | 142 friend class WallpaperManager; |
140 friend class UserManagerTest; | 143 friend class UserManagerTest; |
141 | 144 |
142 UserManagerImpl(); | 145 UserManagerImpl(); |
143 | 146 |
144 // Loads |users_| from Local State if the list has not been loaded yet. | 147 // Loads |users_| from Local State if the list has not been loaded yet. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 212 |
210 // Removes data stored or cached outside the user's cryptohome (wallpaper, | 213 // Removes data stored or cached outside the user's cryptohome (wallpaper, |
211 // avatar, OAuth token status, display name, display email). | 214 // avatar, OAuth token status, display name, display email). |
212 void RemoveNonCryptohomeData(const std::string& email); | 215 void RemoveNonCryptohomeData(const std::string& email); |
213 | 216 |
214 // Removes a regular or locally managed user from the user list. | 217 // Removes a regular or locally managed user from the user list. |
215 // Returns the user if found or NULL otherwise. | 218 // Returns the user if found or NULL otherwise. |
216 // Also removes the user from the persistent user list. | 219 // Also removes the user from the persistent user list. |
217 User* RemoveRegularOrLocallyManagedUserFromList(const std::string& username); | 220 User* RemoveRegularOrLocallyManagedUserFromList(const std::string& username); |
218 | 221 |
219 // Replaces the list of public accounts with |public_accounts|. Ensures that | 222 // Replaces the list of public accounts with those found in |
220 // data belonging to accounts no longer on the list is removed. Returns |true| | 223 // |device_local_accounts|. Ensures that data belonging to accounts no longer |
221 // if the list has changed. | 224 // on the list is removed. Returns |true| if the list has changed. |
222 // Public accounts are defined by policy. This method is called whenever an | 225 // Public accounts are defined by policy. This method is called whenever an |
223 // updated list of public accounts is received from policy. | 226 // updated list of public accounts is received from policy. |
224 bool UpdateAndCleanUpPublicAccounts(const base::ListValue& public_accounts); | 227 bool UpdateAndCleanUpPublicAccounts( |
| 228 const std::vector<policy::DeviceLocalAccount>& device_local_accounts); |
225 | 229 |
226 // Updates the display name for public account |username| from policy settings | 230 // Updates the display name for public account |username| from policy settings |
227 // associated with that username. | 231 // associated with that username. |
228 void UpdatePublicAccountDisplayName(const std::string& username); | 232 void UpdatePublicAccountDisplayName(const std::string& username); |
229 | 233 |
230 // Notifies the UI about a change to the user list. | 234 // Notifies the UI about a change to the user list. |
231 void NotifyUserListChanged(); | 235 void NotifyUserListChanged(); |
232 | 236 |
233 // Notifies observers that merge session state had changed. | 237 // Notifies observers that merge session state had changed. |
234 void NotifyMergeSessionStateChanged(); | 238 void NotifyMergeSessionStateChanged(); |
235 | 239 |
236 // Notifies observers that active user_id hash has changed. | 240 // Notifies observers that active user_id hash has changed. |
237 void NotifyActiveUserHashChanged(const std::string& hash); | 241 void NotifyActiveUserHashChanged(const std::string& hash); |
238 | 242 |
239 // Returns true if there is non-committed user creation transaction. | 243 // Returns true if there is non-committed user creation transaction. |
240 bool HasFailedLocallyManagedUserCreationTransaction(); | 244 bool HasFailedLocallyManagedUserCreationTransaction(); |
241 | 245 |
242 // Attempts to clean up data that could be left from failed user creation. | 246 // Attempts to clean up data that could be left from failed user creation. |
243 void RollbackLocallyManagedUserCreationTransaction(); | 247 void RollbackLocallyManagedUserCreationTransaction(); |
244 | 248 |
245 // Lazily creates default user flow. | 249 // Lazily creates default user flow. |
246 UserFlow* GetDefaultUserFlow() const; | 250 UserFlow* GetDefaultUserFlow() const; |
247 | 251 |
248 // Update the global LoginState. | 252 // Update the global LoginState. |
249 void UpdateLoginState(); | 253 void UpdateLoginState(); |
250 | 254 |
251 // Gets the list of public accounts defined in device settings. | |
252 void ReadPublicAccounts(base::ListValue* public_accounts); | |
253 | |
254 // Interface to the signed settings store. | 255 // Interface to the signed settings store. |
255 CrosSettings* cros_settings_; | 256 CrosSettings* cros_settings_; |
256 | 257 |
257 // Interface to device-local account definitions and associated policy. | 258 // Interface to device-local account definitions and associated policy. |
258 policy::DeviceLocalAccountPolicyService* device_local_account_policy_service_; | 259 policy::DeviceLocalAccountPolicyService* device_local_account_policy_service_; |
259 | 260 |
260 // True if users have been loaded from prefs already. | 261 // True if users have been loaded from prefs already. |
261 bool users_loaded_; | 262 bool users_loaded_; |
262 | 263 |
263 // List of all known users. User instances are owned by |this|. Regular users | 264 // List of all known users. User instances are owned by |this|. Regular users |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 337 |
337 // Specific flows by user e-mail. | 338 // Specific flows by user e-mail. |
338 FlowMap specific_flows_; | 339 FlowMap specific_flows_; |
339 | 340 |
340 DISALLOW_COPY_AND_ASSIGN(UserManagerImpl); | 341 DISALLOW_COPY_AND_ASSIGN(UserManagerImpl); |
341 }; | 342 }; |
342 | 343 |
343 } // namespace chromeos | 344 } // namespace chromeos |
344 | 345 |
345 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_ | 346 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_ |
OLD | NEW |