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 | 10 |
(...skipping 28 matching lines...) Expand all Loading... | |
39 public ProfileSyncServiceObserver, | 39 public ProfileSyncServiceObserver, |
40 public content::NotificationObserver, | 40 public content::NotificationObserver, |
41 public policy::DeviceLocalAccountPolicyService::Observer { | 41 public policy::DeviceLocalAccountPolicyService::Observer { |
42 public: | 42 public: |
43 virtual ~UserManagerImpl(); | 43 virtual ~UserManagerImpl(); |
44 | 44 |
45 // UserManager implementation: | 45 // UserManager implementation: |
46 virtual void Shutdown() OVERRIDE; | 46 virtual void Shutdown() OVERRIDE; |
47 virtual UserImageManager* GetUserImageManager() OVERRIDE; | 47 virtual UserImageManager* GetUserImageManager() OVERRIDE; |
48 virtual const UserList& GetUsers() const OVERRIDE; | 48 virtual const UserList& GetUsers() const OVERRIDE; |
49 virtual const UserList& GetLoggedInUsers() const OVERRIDE; | |
49 virtual void UserLoggedIn(const std::string& email, | 50 virtual void UserLoggedIn(const std::string& email, |
50 const std::string& username_hash, | 51 const std::string& username_hash, |
51 bool browser_restart) OVERRIDE; | 52 bool browser_restart) OVERRIDE; |
53 virtual void SwitchActiveUser(const std::string& email) OVERRIDE; | |
52 virtual void RetailModeUserLoggedIn() OVERRIDE; | 54 virtual void RetailModeUserLoggedIn() OVERRIDE; |
53 virtual void GuestUserLoggedIn() OVERRIDE; | 55 virtual void GuestUserLoggedIn() OVERRIDE; |
54 virtual void KioskAppLoggedIn(const std::string& username) OVERRIDE; | 56 virtual void KioskAppLoggedIn(const std::string& username) OVERRIDE; |
55 virtual void LocallyManagedUserLoggedIn(const std::string& username) OVERRIDE; | 57 virtual void LocallyManagedUserLoggedIn(const std::string& username) OVERRIDE; |
56 virtual void PublicAccountUserLoggedIn(User* user) OVERRIDE; | 58 virtual void PublicAccountUserLoggedIn(User* user) OVERRIDE; |
57 virtual void RegularUserLoggedIn(const std::string& email, | 59 virtual void RegularUserLoggedIn(const std::string& email, |
58 bool browser_restart) OVERRIDE; | 60 bool browser_restart) OVERRIDE; |
59 virtual void RegularUserLoggedInAsEphemeral( | 61 virtual void RegularUserLoggedInAsEphemeral( |
60 const std::string& email) OVERRIDE; | 62 const std::string& email) OVERRIDE; |
61 virtual void SessionStarted() OVERRIDE; | 63 virtual void SessionStarted() OVERRIDE; |
62 virtual void RemoveUser(const std::string& email, | 64 virtual void RemoveUser(const std::string& email, |
63 RemoveUserDelegate* delegate) OVERRIDE; | 65 RemoveUserDelegate* delegate) OVERRIDE; |
64 virtual void RemoveUserFromList(const std::string& email) OVERRIDE; | 66 virtual void RemoveUserFromList(const std::string& email) OVERRIDE; |
65 virtual bool IsKnownUser(const std::string& email) const OVERRIDE; | 67 virtual bool IsKnownUser(const std::string& email) const OVERRIDE; |
66 virtual const User* FindUser(const std::string& email) const OVERRIDE; | 68 virtual const User* FindUser(const std::string& email) const OVERRIDE; |
67 virtual const User* FindLocallyManagedUser( | 69 virtual const User* FindLocallyManagedUser( |
68 const string16& display_name) const OVERRIDE; | 70 const string16& display_name) const OVERRIDE; |
69 virtual const User* GetLoggedInUser() const OVERRIDE; | 71 virtual const User* GetLoggedInUser() const OVERRIDE; |
70 virtual User* GetLoggedInUser() OVERRIDE; | 72 virtual User* GetLoggedInUser() OVERRIDE; |
73 virtual const User* GetActiveUser() const OVERRIDE; | |
74 virtual User* GetActiveUser() OVERRIDE; | |
71 virtual void SaveUserOAuthStatus( | 75 virtual void SaveUserOAuthStatus( |
72 const std::string& username, | 76 const std::string& username, |
73 User::OAuthTokenStatus oauth_token_status) OVERRIDE; | 77 User::OAuthTokenStatus oauth_token_status) OVERRIDE; |
74 virtual void SaveUserDisplayName(const std::string& username, | 78 virtual void SaveUserDisplayName(const std::string& username, |
75 const string16& display_name) OVERRIDE; | 79 const string16& display_name) OVERRIDE; |
76 virtual string16 GetUserDisplayName( | 80 virtual string16 GetUserDisplayName( |
77 const std::string& username) const OVERRIDE; | 81 const std::string& username) const OVERRIDE; |
78 virtual void SaveUserDisplayEmail(const std::string& username, | 82 virtual void SaveUserDisplayEmail(const std::string& username, |
79 const std::string& display_email) OVERRIDE; | 83 const std::string& display_email) OVERRIDE; |
80 virtual std::string GetUserDisplayEmail( | 84 virtual std::string GetUserDisplayEmail( |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
150 void RetrieveTrustedDevicePolicies(); | 154 void RetrieveTrustedDevicePolicies(); |
151 | 155 |
152 // Returns true if trusted device policies have successfully been retrieved | 156 // Returns true if trusted device policies have successfully been retrieved |
153 // and ephemeral users are enabled. | 157 // and ephemeral users are enabled. |
154 bool AreEphemeralUsersEnabled() const; | 158 bool AreEphemeralUsersEnabled() const; |
155 | 159 |
156 // Returns the user with the given email address if found in the persistent | 160 // Returns the user with the given email address if found in the persistent |
157 // list. Returns |NULL| otherwise. | 161 // list. Returns |NULL| otherwise. |
158 const User* FindUserInList(const std::string& email) const; | 162 const User* FindUserInList(const std::string& email) const; |
159 | 163 |
160 // Notifies that new user session has started. | 164 // Notifies that user has logged in. |
165 // Sends NOTIFICATION_LOGIN_USER_CHANGED notification. | |
161 void NotifyOnLogin(); | 166 void NotifyOnLogin(); |
162 | 167 |
163 // Reads user's oauth token status from local state preferences. | 168 // Reads user's oauth token status from local state preferences. |
164 User::OAuthTokenStatus LoadUserOAuthStatus(const std::string& username) const; | 169 User::OAuthTokenStatus LoadUserOAuthStatus(const std::string& username) const; |
165 | 170 |
166 void SetCurrentUserIsOwner(bool is_current_user_owner); | 171 void SetCurrentUserIsOwner(bool is_current_user_owner); |
167 | 172 |
168 // Updates current user ownership on UI thread. | 173 // Updates current user ownership on UI thread. |
169 void UpdateOwnership(DeviceSettingsService::OwnershipStatus status, | 174 void UpdateOwnership(DeviceSettingsService::OwnershipStatus status, |
170 bool is_owner); | 175 bool is_owner); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 policy::DeviceLocalAccountPolicyService* device_local_account_policy_service_; | 219 policy::DeviceLocalAccountPolicyService* device_local_account_policy_service_; |
215 | 220 |
216 // True if users have been loaded from prefs already. | 221 // True if users have been loaded from prefs already. |
217 bool users_loaded_; | 222 bool users_loaded_; |
218 | 223 |
219 // List of all known users. User instances are owned by |this|. Regular users | 224 // List of all known users. User instances are owned by |this|. Regular users |
220 // are removed by |RemoveUserFromList|, public accounts by | 225 // are removed by |RemoveUserFromList|, public accounts by |
221 // |UpdateAndCleanUpPublicAccounts|. | 226 // |UpdateAndCleanUpPublicAccounts|. |
222 UserList users_; | 227 UserList users_; |
223 | 228 |
224 // The logged-in user. NULL until a user has logged in, then points to one | 229 // List of all users that are logged in current session. These point to User |
230 // instances in |users_|. Only one of them could be marked as active. | |
231 UserList logged_in_users_; | |
232 | |
233 // The logged-in user that is currently active in current session. | |
234 // NULL until a user has logged in, then points to one | |
225 // of the User instances in |users_|, the |guest_user_| instance or an | 235 // of the User instances in |users_|, the |guest_user_| instance or an |
226 // ephemeral user instance. | 236 // ephemeral user instance. |
227 User* logged_in_user_; | 237 User* active_user_; |
Dmitry Polukhin
2013/04/11 13:34:15
FYI, perhaps we will need to switch to linked_ptr
Nikita (slow)
2013/04/12 15:41:25
I'll do that in a separate CL as I've looked over
| |
228 | 238 |
229 // True if SessionStarted() has been called. | 239 // True if SessionStarted() has been called. |
230 bool session_started_; | 240 bool session_started_; |
231 | 241 |
232 // Cached flag of whether currently logged-in user is owner or not. | 242 // Cached flag of whether currently logged-in user is owner or not. |
233 // May be accessed on different threads, requires locking. | 243 // May be accessed on different threads, requires locking. |
234 bool is_current_user_owner_; | 244 bool is_current_user_owner_; |
235 mutable base::Lock is_current_user_owner_lock_; | 245 mutable base::Lock is_current_user_owner_lock_; |
236 | 246 |
237 // Cached flag of whether the currently logged-in user existed before this | 247 // Cached flag of whether the currently logged-in user existed before this |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
283 | 293 |
284 // Specific flows by user e-mail. | 294 // Specific flows by user e-mail. |
285 FlowMap specific_flows_; | 295 FlowMap specific_flows_; |
286 | 296 |
287 DISALLOW_COPY_AND_ASSIGN(UserManagerImpl); | 297 DISALLOW_COPY_AND_ASSIGN(UserManagerImpl); |
288 }; | 298 }; |
289 | 299 |
290 } // namespace chromeos | 300 } // namespace chromeos |
291 | 301 |
292 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_ | 302 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_ |
OLD | NEW |