| 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_USER_MANAGER_BASE_H_ | 5 #ifndef COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_USER_MANAGER_BASE_H_ | 6 #define COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.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/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
| 18 #include "components/user_manager/user.h" | 17 #include "components/user_manager/user.h" |
| 18 #include "components/user_manager/user_manager.h" |
| 19 #include "components/user_manager/user_manager_export.h" |
| 19 | 20 |
| 20 class PrefService; | 21 class PrefService; |
| 21 class PrefRegistrySimple; | 22 class PrefRegistrySimple; |
| 22 | 23 |
| 23 namespace chromeos { | 24 namespace base { |
| 25 class ListValue; |
| 26 class TaskRunner; |
| 27 } |
| 28 |
| 29 namespace user_manager { |
| 24 | 30 |
| 25 class RemoveUserDelegate; | 31 class RemoveUserDelegate; |
| 26 | 32 |
| 27 // Base implementation of the UserManager interface. | 33 // Base implementation of the UserManager interface. |
| 28 class UserManagerBase : public UserManager { | 34 class USER_MANAGER_EXPORT UserManagerBase : public UserManager { |
| 29 public: | 35 public: |
| 36 UserManagerBase(scoped_refptr<base::TaskRunner> task_runner, |
| 37 scoped_refptr<base::TaskRunner> blocking_task_runner); |
| 30 virtual ~UserManagerBase(); | 38 virtual ~UserManagerBase(); |
| 31 | 39 |
| 32 // Registers UserManagerBase preferences. | 40 // Registers UserManagerBase preferences. |
| 33 static void RegisterPrefs(PrefRegistrySimple* registry); | 41 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 34 | 42 |
| 35 // UserManager implementation: | 43 // UserManager implementation: |
| 36 virtual void Shutdown() OVERRIDE; | 44 virtual void Shutdown() OVERRIDE; |
| 37 virtual const user_manager::UserList& GetUsers() const OVERRIDE; | 45 virtual const UserList& GetUsers() const OVERRIDE; |
| 38 virtual const user_manager::UserList& GetLoggedInUsers() const OVERRIDE; | 46 virtual const UserList& GetLoggedInUsers() const OVERRIDE; |
| 39 virtual const user_manager::UserList& GetLRULoggedInUsers() const OVERRIDE; | 47 virtual const UserList& GetLRULoggedInUsers() const OVERRIDE; |
| 40 virtual const std::string& GetOwnerEmail() const OVERRIDE; | 48 virtual const std::string& GetOwnerEmail() const OVERRIDE; |
| 41 virtual void UserLoggedIn(const std::string& user_id, | 49 virtual void UserLoggedIn(const std::string& user_id, |
| 42 const std::string& user_id_hash, | 50 const std::string& user_id_hash, |
| 43 bool browser_restart) OVERRIDE; | 51 bool browser_restart) OVERRIDE; |
| 44 virtual void SwitchActiveUser(const std::string& user_id) OVERRIDE; | 52 virtual void SwitchActiveUser(const std::string& user_id) OVERRIDE; |
| 45 virtual void SessionStarted() OVERRIDE; | 53 virtual void SessionStarted() OVERRIDE; |
| 46 virtual void RemoveUser(const std::string& user_id, | 54 virtual void RemoveUser(const std::string& user_id, |
| 47 RemoveUserDelegate* delegate) OVERRIDE; | 55 RemoveUserDelegate* delegate) OVERRIDE; |
| 48 virtual void RemoveUserFromList(const std::string& user_id) OVERRIDE; | 56 virtual void RemoveUserFromList(const std::string& user_id) OVERRIDE; |
| 49 virtual bool IsKnownUser(const std::string& user_id) const OVERRIDE; | 57 virtual bool IsKnownUser(const std::string& user_id) const OVERRIDE; |
| 50 virtual const user_manager::User* FindUser( | 58 virtual const User* FindUser(const std::string& user_id) const OVERRIDE; |
| 51 const std::string& user_id) const OVERRIDE; | 59 virtual User* FindUserAndModify(const std::string& user_id) OVERRIDE; |
| 52 virtual user_manager::User* FindUserAndModify( | 60 virtual const User* GetLoggedInUser() const OVERRIDE; |
| 53 const std::string& user_id) OVERRIDE; | 61 virtual User* GetLoggedInUser() OVERRIDE; |
| 54 virtual const user_manager::User* GetLoggedInUser() const OVERRIDE; | 62 virtual const User* GetActiveUser() const OVERRIDE; |
| 55 virtual user_manager::User* GetLoggedInUser() OVERRIDE; | 63 virtual User* GetActiveUser() OVERRIDE; |
| 56 virtual const user_manager::User* GetActiveUser() const OVERRIDE; | 64 virtual const User* GetPrimaryUser() const OVERRIDE; |
| 57 virtual user_manager::User* GetActiveUser() OVERRIDE; | |
| 58 virtual const user_manager::User* GetPrimaryUser() const OVERRIDE; | |
| 59 virtual void SaveUserOAuthStatus( | 65 virtual void SaveUserOAuthStatus( |
| 60 const std::string& user_id, | 66 const std::string& user_id, |
| 61 user_manager::User::OAuthTokenStatus oauth_token_status) OVERRIDE; | 67 User::OAuthTokenStatus oauth_token_status) OVERRIDE; |
| 62 virtual void SaveForceOnlineSignin(const std::string& user_id, | 68 virtual void SaveForceOnlineSignin(const std::string& user_id, |
| 63 bool force_online_signin) OVERRIDE; | 69 bool force_online_signin) OVERRIDE; |
| 64 virtual void SaveUserDisplayName(const std::string& user_id, | 70 virtual void SaveUserDisplayName(const std::string& user_id, |
| 65 const base::string16& display_name) OVERRIDE; | 71 const base::string16& display_name) OVERRIDE; |
| 66 virtual base::string16 GetUserDisplayName( | 72 virtual base::string16 GetUserDisplayName( |
| 67 const std::string& user_id) const OVERRIDE; | 73 const std::string& user_id) const OVERRIDE; |
| 68 virtual void SaveUserDisplayEmail(const std::string& user_id, | 74 virtual void SaveUserDisplayEmail(const std::string& user_id, |
| 69 const std::string& display_email) OVERRIDE; | 75 const std::string& display_email) OVERRIDE; |
| 70 virtual std::string GetUserDisplayEmail( | 76 virtual std::string GetUserDisplayEmail( |
| 71 const std::string& user_id) const OVERRIDE; | 77 const std::string& user_id) const OVERRIDE; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 101 static void ParseUserList(const base::ListValue& users_list, | 107 static void ParseUserList(const base::ListValue& users_list, |
| 102 const std::set<std::string>& existing_users, | 108 const std::set<std::string>& existing_users, |
| 103 std::vector<std::string>* users_vector, | 109 std::vector<std::string>* users_vector, |
| 104 std::set<std::string>* users_set); | 110 std::set<std::string>* users_set); |
| 105 | 111 |
| 106 protected: | 112 protected: |
| 107 UserManagerBase(); | 113 UserManagerBase(); |
| 108 | 114 |
| 109 // Adds |user| to users list, and adds it to front of LRU list. It is assumed | 115 // Adds |user| to users list, and adds it to front of LRU list. It is assumed |
| 110 // that there is no user with same id. | 116 // that there is no user with same id. |
| 111 virtual void AddUserRecord(user_manager::User* user); | 117 virtual void AddUserRecord(User* user); |
| 112 | 118 |
| 113 // Returns true if trusted device policies have successfully been retrieved | 119 // Returns true if trusted device policies have successfully been retrieved |
| 114 // and ephemeral users are enabled. | 120 // and ephemeral users are enabled. |
| 115 virtual bool AreEphemeralUsersEnabled() const = 0; | 121 virtual bool AreEphemeralUsersEnabled() const = 0; |
| 116 | 122 |
| 117 // Returns true if user may be removed. | 123 // Returns true if user may be removed. |
| 118 virtual bool CanUserBeRemoved(const user_manager::User* user) const; | 124 virtual bool CanUserBeRemoved(const User* user) const; |
| 119 | 125 |
| 120 // A wrapper around C++ delete operator. Deletes |user|, and when |user| | 126 // A wrapper around C++ delete operator. Deletes |user|, and when |user| |
| 121 // equals to active_user_, active_user_ is reset to NULL. | 127 // equals to active_user_, active_user_ is reset to NULL. |
| 122 virtual void DeleteUser(user_manager::User* user); | 128 virtual void DeleteUser(User* user); |
| 123 | 129 |
| 124 // Returns the locale used by the application. | 130 // Returns the locale used by the application. |
| 125 virtual const std::string& GetApplicationLocale() const = 0; | 131 virtual const std::string& GetApplicationLocale() const = 0; |
| 126 | 132 |
| 127 // Returns "Local State" PrefService instance. | 133 // Returns "Local State" PrefService instance. |
| 128 virtual PrefService* GetLocalState() const = 0; | 134 virtual PrefService* GetLocalState() const = 0; |
| 129 | 135 |
| 130 // Loads |users_| from Local State if the list has not been loaded yet. | 136 // Loads |users_| from Local State if the list has not been loaded yet. |
| 131 // Subsequent calls have no effect. Must be called on the UI thread. | 137 // Subsequent calls have no effect. Must be called on the UI thread. |
| 132 void EnsureUsersLoaded(); | 138 void EnsureUsersLoaded(); |
| 133 | 139 |
| 140 // Handle OAuth token |status| change for |user_id|. |
| 141 virtual void HandleUserOAuthTokenStatusChange( |
| 142 const std::string& user_id, |
| 143 User::OAuthTokenStatus status) const = 0; |
| 144 |
| 134 // Returns true if device is enterprise managed. | 145 // Returns true if device is enterprise managed. |
| 135 virtual bool IsEnterpriseManaged() const = 0; | 146 virtual bool IsEnterpriseManaged() const = 0; |
| 136 | 147 |
| 137 // Helper function that copies users from |users_list| to |users_vector| and | 148 // Helper function that copies users from |users_list| to |users_vector| and |
| 138 // |users_set|. Duplicates and users already present in |existing_users| are | 149 // |users_set|. Duplicates and users already present in |existing_users| are |
| 139 // skipped. | 150 // skipped. |
| 140 // Loads public accounts from the Local state and fills in | 151 // Loads public accounts from the Local state and fills in |
| 141 // |public_sessions_set|. | 152 // |public_sessions_set|. |
| 142 virtual void LoadPublicAccounts( | 153 virtual void LoadPublicAccounts( |
| 143 std::set<std::string>* public_sessions_set) = 0; | 154 std::set<std::string>* public_sessions_set) = 0; |
| 144 | 155 |
| 145 // Notifies that user has logged in. | 156 // Notifies that user has logged in. |
| 146 virtual void NotifyOnLogin(); | 157 virtual void NotifyOnLogin(); |
| 147 | 158 |
| 148 // Notifies observers that another user was added to the session. | 159 // Notifies observers that another user was added to the session. |
| 149 // If |user_switch_pending| is true this means that user has not been fully | 160 // If |user_switch_pending| is true this means that user has not been fully |
| 150 // initialized yet like waiting for profile to be loaded. | 161 // initialized yet like waiting for profile to be loaded. |
| 151 virtual void NotifyUserAddedToSession(const user_manager::User* added_user, | 162 virtual void NotifyUserAddedToSession(const User* added_user, |
| 152 bool user_switch_pending); | 163 bool user_switch_pending); |
| 153 | 164 |
| 154 // Performs any additional actions before user list is loaded. | 165 // Performs any additional actions before user list is loaded. |
| 155 virtual void PerformPreUserListLoadingActions() = 0; | 166 virtual void PerformPreUserListLoadingActions() = 0; |
| 156 | 167 |
| 157 // Performs any additional actions after user list is loaded. | 168 // Performs any additional actions after user list is loaded. |
| 158 virtual void PerformPostUserListLoadingActions() = 0; | 169 virtual void PerformPostUserListLoadingActions() = 0; |
| 159 | 170 |
| 160 // Performs any additional actions after UserLoggedIn() execution has been | 171 // Performs any additional actions after UserLoggedIn() execution has been |
| 161 // completed. | 172 // completed. |
| 162 // |browser_restart| is true when reloading Chrome after crash to distinguish | 173 // |browser_restart| is true when reloading Chrome after crash to distinguish |
| 163 // from normal sign in flow. | 174 // from normal sign in flow. |
| 164 virtual void PerformPostUserLoggedInActions(bool browser_restart) = 0; | 175 virtual void PerformPostUserLoggedInActions(bool browser_restart) = 0; |
| 165 | 176 |
| 166 // Implementation for RemoveUser method. It is synchronous. It is called from | 177 // Implementation for RemoveUser method. It is synchronous. It is called from |
| 167 // RemoveUserInternal after owner check. | 178 // RemoveUserInternal after owner check. |
| 168 virtual void RemoveNonOwnerUserInternal(const std::string& user_email, | 179 virtual void RemoveNonOwnerUserInternal(const std::string& user_email, |
| 169 RemoveUserDelegate* delegate); | 180 RemoveUserDelegate* delegate); |
| 170 | 181 |
| 171 // Removes a regular or supervised user from the user list. | 182 // Removes a regular or supervised user from the user list. |
| 172 // Returns the user if found or NULL otherwise. | 183 // Returns the user if found or NULL otherwise. |
| 173 // Also removes the user from the persistent user list. | 184 // Also removes the user from the persistent user list. |
| 174 user_manager::User* RemoveRegularOrSupervisedUserFromList( | 185 User* RemoveRegularOrSupervisedUserFromList(const std::string& user_id); |
| 175 const std::string& user_id); | |
| 176 | 186 |
| 177 // Implementation for RemoveUser method. This is an asynchronous part of the | 187 // Implementation for RemoveUser method. This is an asynchronous part of the |
| 178 // method, that verifies that owner will not get deleted, and calls | 188 // method, that verifies that owner will not get deleted, and calls |
| 179 // |RemoveNonOwnerUserInternal|. | 189 // |RemoveNonOwnerUserInternal|. |
| 180 virtual void RemoveUserInternal(const std::string& user_email, | 190 virtual void RemoveUserInternal(const std::string& user_email, |
| 181 RemoveUserDelegate* delegate); | 191 RemoveUserDelegate* delegate); |
| 182 | 192 |
| 183 // Removes data stored or cached outside the user's cryptohome (wallpaper, | 193 // Removes data stored or cached outside the user's cryptohome (wallpaper, |
| 184 // avatar, OAuth token status, display name, display email). | 194 // avatar, OAuth token status, display name, display email). |
| 185 virtual void RemoveNonCryptohomeData(const std::string& user_id); | 195 virtual void RemoveNonCryptohomeData(const std::string& user_id); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 202 // Indicates that the demo account has just logged in. | 212 // Indicates that the demo account has just logged in. |
| 203 virtual void DemoAccountLoggedIn() = 0; | 213 virtual void DemoAccountLoggedIn() = 0; |
| 204 | 214 |
| 205 // Indicates that a user just logged in as guest. | 215 // Indicates that a user just logged in as guest. |
| 206 virtual void GuestUserLoggedIn(); | 216 virtual void GuestUserLoggedIn(); |
| 207 | 217 |
| 208 // Indicates that a kiosk app robot just logged in. | 218 // Indicates that a kiosk app robot just logged in. |
| 209 virtual void KioskAppLoggedIn(const std::string& app_id) = 0; | 219 virtual void KioskAppLoggedIn(const std::string& app_id) = 0; |
| 210 | 220 |
| 211 // Indicates that a user just logged into a public session. | 221 // Indicates that a user just logged into a public session. |
| 212 virtual void PublicAccountUserLoggedIn(user_manager::User* user) = 0; | 222 virtual void PublicAccountUserLoggedIn(User* user) = 0; |
| 213 | 223 |
| 214 // Indicates that a regular user just logged in. | 224 // Indicates that a regular user just logged in. |
| 215 virtual void RegularUserLoggedIn(const std::string& user_id); | 225 virtual void RegularUserLoggedIn(const std::string& user_id); |
| 216 | 226 |
| 217 // Indicates that a regular user just logged in as ephemeral. | 227 // Indicates that a regular user just logged in as ephemeral. |
| 218 virtual void RegularUserLoggedInAsEphemeral(const std::string& user_id); | 228 virtual void RegularUserLoggedInAsEphemeral(const std::string& user_id); |
| 219 | 229 |
| 220 // Indicates that a user just logged into a retail mode session. | 230 // Indicates that a user just logged into a retail mode session. |
| 221 virtual void RetailModeUserLoggedIn() = 0; | 231 virtual void RetailModeUserLoggedIn() = 0; |
| 222 | 232 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 234 | 244 |
| 235 virtual void SetOwnerEmail(std::string owner_user_id); | 245 virtual void SetOwnerEmail(std::string owner_user_id); |
| 236 | 246 |
| 237 virtual const std::string& GetPendingUserSwitchID() const; | 247 virtual const std::string& GetPendingUserSwitchID() const; |
| 238 virtual void SetPendingUserSwitchID(std::string user_id); | 248 virtual void SetPendingUserSwitchID(std::string user_id); |
| 239 | 249 |
| 240 // The logged-in user that is currently active in current session. | 250 // The logged-in user that is currently active in current session. |
| 241 // NULL until a user has logged in, then points to one | 251 // NULL until a user has logged in, then points to one |
| 242 // of the User instances in |users_|, the |guest_user_| instance or an | 252 // of the User instances in |users_|, the |guest_user_| instance or an |
| 243 // ephemeral user instance. | 253 // ephemeral user instance. |
| 244 user_manager::User* active_user_; | 254 User* active_user_; |
| 245 | 255 |
| 246 // The primary user of the current session. It is recorded for the first | 256 // The primary user of the current session. It is recorded for the first |
| 247 // signed-in user and does not change thereafter. | 257 // signed-in user and does not change thereafter. |
| 248 user_manager::User* primary_user_; | 258 User* primary_user_; |
| 249 | 259 |
| 250 // List of all known users. User instances are owned by |this|. Regular users | 260 // List of all known users. User instances are owned by |this|. Regular users |
| 251 // are removed by |RemoveUserFromList|, public accounts by | 261 // are removed by |RemoveUserFromList|, public accounts by |
| 252 // |UpdateAndCleanUpPublicAccounts|. | 262 // |UpdateAndCleanUpPublicAccounts|. |
| 253 user_manager::UserList users_; | 263 UserList users_; |
| 254 | 264 |
| 255 private: | 265 private: |
| 256 // Stages of loading user list from preferences. Some methods can have | 266 // Stages of loading user list from preferences. Some methods can have |
| 257 // different behavior depending on stage. | 267 // different behavior depending on stage. |
| 258 enum UserLoadStage { STAGE_NOT_LOADED = 0, STAGE_LOADING, STAGE_LOADED }; | 268 enum UserLoadStage { STAGE_NOT_LOADED = 0, STAGE_LOADING, STAGE_LOADED }; |
| 259 | 269 |
| 260 // Returns a list of users who have logged into this device previously. | 270 // Returns a list of users who have logged into this device previously. |
| 261 // Same as GetUsers but used if you need to modify User from that list. | 271 // Same as GetUsers but used if you need to modify User from that list. |
| 262 user_manager::UserList& GetUsersAndModify(); | 272 UserList& GetUsersAndModify(); |
| 263 | 273 |
| 264 // Returns the user with the given email address if found in the persistent | 274 // Returns the user with the given email address if found in the persistent |
| 265 // list. Returns |NULL| otherwise. | 275 // list. Returns |NULL| otherwise. |
| 266 const user_manager::User* FindUserInList(const std::string& user_id) const; | 276 const User* FindUserInList(const std::string& user_id) const; |
| 267 | 277 |
| 268 // Returns |true| if user with the given id is found in the persistent list. | 278 // Returns |true| if user with the given id is found in the persistent list. |
| 269 // Returns |false| otherwise. Does not trigger user loading. | 279 // Returns |false| otherwise. Does not trigger user loading. |
| 270 const bool UserExistsInList(const std::string& user_id) const; | 280 const bool UserExistsInList(const std::string& user_id) const; |
| 271 | 281 |
| 272 // Same as FindUserInList but returns non-const pointer to User object. | 282 // Same as FindUserInList but returns non-const pointer to User object. |
| 273 user_manager::User* FindUserInListAndModify(const std::string& user_id); | 283 User* FindUserInListAndModify(const std::string& user_id); |
| 274 | 284 |
| 275 // Reads user's oauth token status from local state preferences. | 285 // Reads user's oauth token status from local state preferences. |
| 276 user_manager::User::OAuthTokenStatus LoadUserOAuthStatus( | 286 User::OAuthTokenStatus LoadUserOAuthStatus(const std::string& user_id) const; |
| 277 const std::string& user_id) const; | |
| 278 | 287 |
| 279 // Read a flag indicating whether online authentication against GAIA should | 288 // Read a flag indicating whether online authentication against GAIA should |
| 280 // be enforced during the user's next sign-in from local state preferences. | 289 // be enforced during the user's next sign-in from local state preferences. |
| 281 bool LoadForceOnlineSignin(const std::string& user_id) const; | 290 bool LoadForceOnlineSignin(const std::string& user_id) const; |
| 282 | 291 |
| 283 // Notifies observers that merge session state had changed. | 292 // Notifies observers that merge session state had changed. |
| 284 void NotifyMergeSessionStateChanged(); | 293 void NotifyMergeSessionStateChanged(); |
| 285 | 294 |
| 286 // Notifies observers that active user has changed. | 295 // Notifies observers that active user has changed. |
| 287 void NotifyActiveUserChanged(const user_manager::User* active_user); | 296 void NotifyActiveUserChanged(const User* active_user); |
| 288 | 297 |
| 289 // Notifies observers that active user_id hash has changed. | 298 // Notifies observers that active user_id hash has changed. |
| 290 void NotifyActiveUserHashChanged(const std::string& hash); | 299 void NotifyActiveUserHashChanged(const std::string& hash); |
| 291 | 300 |
| 292 // Update the global LoginState. | 301 // Update the global LoginState. |
| 293 void UpdateLoginState(); | 302 void UpdateLoginState(); |
| 294 | 303 |
| 295 // Insert |user| at the front of the LRU user list. | 304 // Insert |user| at the front of the LRU user list. |
| 296 void SetLRUUser(user_manager::User* user); | 305 void SetLRUUser(User* user); |
| 297 | 306 |
| 298 // Sends metrics in response to a regular user logging in. | 307 // Sends metrics in response to a regular user logging in. |
| 299 void SendRegularUserLoginMetrics(const std::string& user_id); | 308 void SendRegularUserLoginMetrics(const std::string& user_id); |
| 300 | 309 |
| 301 // Sets account locale for user with id |user_id|. | 310 // Sets account locale for user with id |user_id|. |
| 302 virtual void UpdateUserAccountLocale(const std::string& user_id, | 311 virtual void UpdateUserAccountLocale(const std::string& user_id, |
| 303 const std::string& locale); | 312 const std::string& locale); |
| 304 | 313 |
| 314 // Runs on SequencedWorkerPool thread. Passes resolved locale to |
| 315 // |on_resolve_callback| on UI thread. |
| 316 void ResolveLocale( |
| 317 const std::string& raw_locale, |
| 318 base::Callback<void(const std::string&)> on_resolve_callback); |
| 319 |
| 305 // Updates user account after locale was resolved. | 320 // Updates user account after locale was resolved. |
| 306 void DoUpdateAccountLocale(const std::string& user_id, | 321 void DoUpdateAccountLocale(const std::string& user_id, |
| 307 const std::string& resolved_locale); | 322 const std::string& resolved_locale); |
| 308 | 323 |
| 309 // Indicates stage of loading user from prefs. | 324 // Indicates stage of loading user from prefs. |
| 310 UserLoadStage user_loading_stage_; | 325 UserLoadStage user_loading_stage_; |
| 311 | 326 |
| 312 // List of all users that are logged in current session. These point to User | 327 // List of all users that are logged in current session. These point to User |
| 313 // instances in |users_|. Only one of them could be marked as active. | 328 // instances in |users_|. Only one of them could be marked as active. |
| 314 user_manager::UserList logged_in_users_; | 329 UserList logged_in_users_; |
| 315 | 330 |
| 316 // A list of all users that are logged in the current session. In contrast to | 331 // A list of all users that are logged in the current session. In contrast to |
| 317 // |logged_in_users|, the order of this list is least recently used so that | 332 // |logged_in_users|, the order of this list is least recently used so that |
| 318 // the active user should always be the first one in the list. | 333 // the active user should always be the first one in the list. |
| 319 user_manager::UserList lru_logged_in_users_; | 334 UserList lru_logged_in_users_; |
| 320 | 335 |
| 321 // True if SessionStarted() has been called. | 336 // True if SessionStarted() has been called. |
| 322 bool session_started_; | 337 bool session_started_; |
| 323 | 338 |
| 324 // Cached flag of whether currently logged-in user is owner or not. | 339 // Cached flag of whether currently logged-in user is owner or not. |
| 325 // May be accessed on different threads, requires locking. | 340 // May be accessed on different threads, requires locking. |
| 326 bool is_current_user_owner_; | 341 bool is_current_user_owner_; |
| 327 mutable base::Lock is_current_user_owner_lock_; | 342 mutable base::Lock is_current_user_owner_lock_; |
| 328 | 343 |
| 329 // Cached flag of whether the currently logged-in user existed before this | 344 // Cached flag of whether the currently logged-in user existed before this |
| (...skipping 22 matching lines...) Expand all Loading... |
| 352 ObserverList<UserManager::UserSessionStateObserver> | 367 ObserverList<UserManager::UserSessionStateObserver> |
| 353 session_state_observer_list_; | 368 session_state_observer_list_; |
| 354 | 369 |
| 355 // Time at which this object was created. | 370 // Time at which this object was created. |
| 356 base::TimeTicks manager_creation_time_; | 371 base::TimeTicks manager_creation_time_; |
| 357 | 372 |
| 358 // ID of the user just added to the session that needs to be activated | 373 // ID of the user just added to the session that needs to be activated |
| 359 // as soon as user's profile is loaded. | 374 // as soon as user's profile is loaded. |
| 360 std::string pending_user_switch_; | 375 std::string pending_user_switch_; |
| 361 | 376 |
| 377 scoped_refptr<base::TaskRunner> task_runner_; |
| 378 scoped_refptr<base::TaskRunner> blocking_task_runner_; |
| 379 |
| 362 base::WeakPtrFactory<UserManagerBase> weak_factory_; | 380 base::WeakPtrFactory<UserManagerBase> weak_factory_; |
| 363 | 381 |
| 364 DISALLOW_COPY_AND_ASSIGN(UserManagerBase); | 382 DISALLOW_COPY_AND_ASSIGN(UserManagerBase); |
| 365 }; | 383 }; |
| 366 | 384 |
| 367 } // namespace chromeos | 385 } // namespace user_manager |
| 368 | 386 |
| 369 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_USER_MANAGER_BASE_H_ | 387 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_ |
| OLD | NEW |