| 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 COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_ | 5 #ifndef COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_ |
| 6 #define COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_ | 6 #define COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 ~UserManagerBase() override; | 44 ~UserManagerBase() override; |
| 45 | 45 |
| 46 // Registers UserManagerBase preferences. | 46 // Registers UserManagerBase preferences. |
| 47 static void RegisterPrefs(PrefRegistrySimple* registry); | 47 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 48 | 48 |
| 49 // UserManager implementation: | 49 // UserManager implementation: |
| 50 void Shutdown() override; | 50 void Shutdown() override; |
| 51 const UserList& GetUsers() const override; | 51 const UserList& GetUsers() const override; |
| 52 const UserList& GetLoggedInUsers() const override; | 52 const UserList& GetLoggedInUsers() const override; |
| 53 const UserList& GetLRULoggedInUsers() const override; | 53 const UserList& GetLRULoggedInUsers() const override; |
| 54 const std::string& GetOwnerEmail() const override; | 54 const UserID& GetOwnerID() const override; |
| 55 void UserLoggedIn(const std::string& user_id, | 55 void UserLoggedIn(const UserID& user_id, |
| 56 const std::string& user_id_hash, | 56 const std::string& user_id_hash, |
| 57 bool browser_restart) override; | 57 bool browser_restart) override; |
| 58 void SwitchActiveUser(const std::string& user_id) override; | 58 void SwitchActiveUser(const UserID& user_id) override; |
| 59 void SwitchToLastActiveUser() override; | 59 void SwitchToLastActiveUser() override; |
| 60 void SessionStarted() override; | 60 void SessionStarted() override; |
| 61 void RemoveUser(const std::string& user_id, | 61 void RemoveUser(const UserID& user_id, |
| 62 RemoveUserDelegate* delegate) override; | 62 RemoveUserDelegate* delegate) override; |
| 63 void RemoveUserFromList(const std::string& user_id) override; | 63 void RemoveUserFromList(const UserID& user_id) override; |
| 64 bool IsKnownUser(const std::string& user_id) const override; | 64 bool IsKnownUser(const UserID& user_id) const override; |
| 65 const User* FindUser(const std::string& user_id) const override; | 65 const User* FindUser(const UserID& user_id) const override; |
| 66 User* FindUserAndModify(const std::string& user_id) override; | 66 User* FindUserAndModify(const UserID& user_id) override; |
| 67 const User* GetLoggedInUser() const override; | 67 const User* GetLoggedInUser() const override; |
| 68 User* GetLoggedInUser() override; | 68 User* GetLoggedInUser() override; |
| 69 const User* GetActiveUser() const override; | 69 const User* GetActiveUser() const override; |
| 70 User* GetActiveUser() override; | 70 User* GetActiveUser() override; |
| 71 const User* GetPrimaryUser() const override; | 71 const User* GetPrimaryUser() const override; |
| 72 void SaveUserOAuthStatus(const std::string& user_id, | 72 void SaveUserOAuthStatus(const UserID& user_id, |
| 73 User::OAuthTokenStatus oauth_token_status) override; | 73 User::OAuthTokenStatus oauth_token_status) override; |
| 74 void SaveForceOnlineSignin(const std::string& user_id, | 74 void SaveForceOnlineSignin(const UserID& user_id, |
| 75 bool force_online_signin) override; | 75 bool force_online_signin) override; |
| 76 void SaveUserDisplayName(const std::string& user_id, | 76 void SaveUserDisplayName(const UserID& user_id, |
| 77 const base::string16& display_name) override; | 77 const base::string16& display_name) override; |
| 78 base::string16 GetUserDisplayName(const std::string& user_id) const override; | 78 base::string16 GetUserDisplayName(const UserID& user_id) const override; |
| 79 void SaveUserDisplayEmail(const std::string& user_id, | 79 void SaveUserDisplayEmail(const UserID& user_id, |
| 80 const std::string& display_email) override; | 80 const std::string& display_email) override; |
| 81 std::string GetUserDisplayEmail(const std::string& user_id) const override; | 81 std::string GetUserDisplayEmail(const UserID& user_id) const override; |
| 82 void SaveUserType(const std::string& user_id, | 82 void SaveUserType(const UserID& user_id, |
| 83 const UserType& user_type) override; | 83 const UserType& user_type) override; |
| 84 void UpdateUserAccountData(const std::string& user_id, | 84 void UpdateUserAccountData(const UserID& user_id, |
| 85 const UserAccountData& account_data) override; | 85 const UserAccountData& account_data) override; |
| 86 bool IsCurrentUserOwner() const override; | 86 bool IsCurrentUserOwner() const override; |
| 87 bool IsCurrentUserNew() const override; | 87 bool IsCurrentUserNew() const override; |
| 88 bool IsCurrentUserNonCryptohomeDataEphemeral() const override; | 88 bool IsCurrentUserNonCryptohomeDataEphemeral() const override; |
| 89 bool CanCurrentUserLock() const override; | 89 bool CanCurrentUserLock() const override; |
| 90 bool IsUserLoggedIn() const override; | 90 bool IsUserLoggedIn() const override; |
| 91 bool IsLoggedInAsUserWithGaiaAccount() const override; | 91 bool IsLoggedInAsUserWithGaiaAccount() const override; |
| 92 bool IsLoggedInAsChildUser() const override; | 92 bool IsLoggedInAsChildUser() const override; |
| 93 bool IsLoggedInAsPublicAccount() const override; | 93 bool IsLoggedInAsPublicAccount() const override; |
| 94 bool IsLoggedInAsGuest() const override; | 94 bool IsLoggedInAsGuest() const override; |
| 95 bool IsLoggedInAsSupervisedUser() const override; | 95 bool IsLoggedInAsSupervisedUser() const override; |
| 96 bool IsLoggedInAsKioskApp() const override; | 96 bool IsLoggedInAsKioskApp() const override; |
| 97 bool IsLoggedInAsStub() const override; | 97 bool IsLoggedInAsStub() const override; |
| 98 bool IsSessionStarted() const override; | 98 bool IsSessionStarted() const override; |
| 99 bool IsUserNonCryptohomeDataEphemeral( | 99 bool IsUserNonCryptohomeDataEphemeral( |
| 100 const std::string& user_id) const override; | 100 const UserID& user_id) const override; |
| 101 void AddObserver(UserManager::Observer* obs) override; | 101 void AddObserver(UserManager::Observer* obs) override; |
| 102 void RemoveObserver(UserManager::Observer* obs) override; | 102 void RemoveObserver(UserManager::Observer* obs) override; |
| 103 void AddSessionStateObserver( | 103 void AddSessionStateObserver( |
| 104 UserManager::UserSessionStateObserver* obs) override; | 104 UserManager::UserSessionStateObserver* obs) override; |
| 105 void RemoveSessionStateObserver( | 105 void RemoveSessionStateObserver( |
| 106 UserManager::UserSessionStateObserver* obs) override; | 106 UserManager::UserSessionStateObserver* obs) override; |
| 107 void NotifyLocalStateChanged() override; | 107 void NotifyLocalStateChanged() override; |
| 108 void ChangeUserChildStatus(User* user, bool is_child) override; | 108 void ChangeUserChildStatus(User* user, bool is_child) override; |
| 109 bool FindKnownUserPrefs(const UserID& user_id, | 109 bool FindKnownUserPrefs(const UserID& user_id, |
| 110 const base::DictionaryValue** out_value) override; | 110 const base::DictionaryValue** out_value) override; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 124 const std::string& path, | 124 const std::string& path, |
| 125 const bool in_value) override; | 125 const bool in_value) override; |
| 126 bool GetKnownUserIntegerPref(const UserID& user_id, | 126 bool GetKnownUserIntegerPref(const UserID& user_id, |
| 127 const std::string& path, | 127 const std::string& path, |
| 128 int* out_value) override; | 128 int* out_value) override; |
| 129 void SetKnownUserIntegerPref(const UserID& user_id, | 129 void SetKnownUserIntegerPref(const UserID& user_id, |
| 130 const std::string& path, | 130 const std::string& path, |
| 131 const int in_value) override; | 131 const int in_value) override; |
| 132 void UpdateGaiaID(const UserID& user_id, const std::string& gaia_id) override; | 132 void UpdateGaiaID(const UserID& user_id, const std::string& gaia_id) override; |
| 133 bool FindGaiaID(const UserID& user_id, std::string* out_value) override; | 133 bool FindGaiaID(const UserID& user_id, std::string* out_value) override; |
| 134 void UpdateUsingSAML(const std::string& user_id, | 134 void UpdateUsingSAML(const UserID& user_id, |
| 135 const bool using_saml) override; | 135 const bool using_saml) override; |
| 136 bool FindUsingSAML(const std::string& user_id) override; | 136 bool FindUsingSAML(const UserID& user_id) override; |
| 137 void SetKnownUserDeviceId(const UserID& user_id, | 137 void SetKnownUserDeviceId(const UserID& user_id, |
| 138 const std::string& device_id) override; | 138 const std::string& device_id) override; |
| 139 std::string GetKnownUserDeviceId(const UserID& user_id) override; | 139 std::string GetKnownUserDeviceId(const UserID& user_id) override; |
| 140 void UpdateReauthReason(const std::string& user_id, | 140 void UpdateReauthReason(const UserID& user_id, |
| 141 const int reauth_reason) override; | 141 const int reauth_reason) override; |
| 142 bool FindReauthReason(const std::string& user_id, int* out_value) override; | 142 bool FindReauthReason(const UserID& user_id, int* out_value) override; |
| 143 | 143 |
| 144 virtual void SetIsCurrentUserNew(bool is_new); | 144 virtual void SetIsCurrentUserNew(bool is_new); |
| 145 | 145 |
| 146 // TODO(xiyuan): Figure out a better way to expose this info. | 146 // TODO(xiyuan): Figure out a better way to expose this info. |
| 147 virtual bool HasPendingBootstrap(const std::string& user_id) const; | 147 virtual bool HasPendingBootstrap(const UserID& user_id) const; |
| 148 | 148 |
| 149 // Helper function that copies users from |users_list| to |users_vector| and | 149 // Helper function that copies users from |users_list| to |users_vector| and |
| 150 // |users_set|. Duplicates and users already present in |existing_users| are | 150 // |users_set|. Duplicates and users already present in |existing_users| are |
| 151 // skipped. | 151 // skipped. |
| 152 static void ParseUserList(const base::ListValue& users_list, | 152 static void ParseUserList(const base::ListValue& users_list, |
| 153 const std::set<std::string>& existing_users, | 153 const std::set<std::string>& existing_users, |
| 154 std::vector<std::string>* users_vector, | 154 std::vector<std::string>* users_vector, |
| 155 std::set<std::string>* users_set); | 155 std::set<std::string>* users_set); |
| 156 | 156 |
| 157 // Returns true if trusted device policies have successfully been retrieved | 157 // Returns true if trusted device policies have successfully been retrieved |
| (...skipping 17 matching lines...) Expand all Loading... |
| 175 | 175 |
| 176 // Returns "Local State" PrefService instance. | 176 // Returns "Local State" PrefService instance. |
| 177 virtual PrefService* GetLocalState() const = 0; | 177 virtual PrefService* GetLocalState() const = 0; |
| 178 | 178 |
| 179 // Loads |users_| from Local State if the list has not been loaded yet. | 179 // Loads |users_| from Local State if the list has not been loaded yet. |
| 180 // Subsequent calls have no effect. Must be called on the UI thread. | 180 // Subsequent calls have no effect. Must be called on the UI thread. |
| 181 virtual void EnsureUsersLoaded(); | 181 virtual void EnsureUsersLoaded(); |
| 182 | 182 |
| 183 // Handle OAuth token |status| change for |user_id|. | 183 // Handle OAuth token |status| change for |user_id|. |
| 184 virtual void HandleUserOAuthTokenStatusChange( | 184 virtual void HandleUserOAuthTokenStatusChange( |
| 185 const std::string& user_id, | 185 const UserID& user_id, |
| 186 User::OAuthTokenStatus status) const = 0; | 186 User::OAuthTokenStatus status) const = 0; |
| 187 | 187 |
| 188 // Returns true if device is enterprise managed. | 188 // Returns true if device is enterprise managed. |
| 189 virtual bool IsEnterpriseManaged() const = 0; | 189 virtual bool IsEnterpriseManaged() const = 0; |
| 190 | 190 |
| 191 // Helper function that copies users from |users_list| to |users_vector| and | 191 // Helper function that copies users from |users_list| to |users_vector| and |
| 192 // |users_set|. Duplicates and users already present in |existing_users| are | 192 // |users_set|. Duplicates and users already present in |existing_users| are |
| 193 // skipped. | 193 // skipped. |
| 194 // Loads public accounts from the Local state and fills in | 194 // Loads public accounts from the Local state and fills in |
| 195 // |public_sessions_set|. | 195 // |public_sessions_set|. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 212 virtual void PerformPostUserListLoadingActions() = 0; | 212 virtual void PerformPostUserListLoadingActions() = 0; |
| 213 | 213 |
| 214 // Performs any additional actions after UserLoggedIn() execution has been | 214 // Performs any additional actions after UserLoggedIn() execution has been |
| 215 // completed. | 215 // completed. |
| 216 // |browser_restart| is true when reloading Chrome after crash to distinguish | 216 // |browser_restart| is true when reloading Chrome after crash to distinguish |
| 217 // from normal sign in flow. | 217 // from normal sign in flow. |
| 218 virtual void PerformPostUserLoggedInActions(bool browser_restart) = 0; | 218 virtual void PerformPostUserLoggedInActions(bool browser_restart) = 0; |
| 219 | 219 |
| 220 // Implementation for RemoveUser method. It is synchronous. It is called from | 220 // Implementation for RemoveUser method. It is synchronous. It is called from |
| 221 // RemoveUserInternal after owner check. | 221 // RemoveUserInternal after owner check. |
| 222 virtual void RemoveNonOwnerUserInternal(const std::string& user_email, | 222 virtual void RemoveNonOwnerUserInternal(const UserID& user_id, |
| 223 RemoveUserDelegate* delegate); | 223 RemoveUserDelegate* delegate); |
| 224 | 224 |
| 225 // Removes a regular or supervised user from the user list. | 225 // Removes a regular or supervised user from the user list. |
| 226 // Returns the user if found or NULL otherwise. | 226 // Returns the user if found or NULL otherwise. |
| 227 // Also removes the user from the persistent user list. | 227 // Also removes the user from the persistent user list. |
| 228 User* RemoveRegularOrSupervisedUserFromList(const std::string& user_id); | 228 User* RemoveRegularOrSupervisedUserFromList(const UserID& user_id); |
| 229 | 229 |
| 230 // Implementation for RemoveUser method. This is an asynchronous part of the | 230 // Implementation for RemoveUser method. This is an asynchronous part of the |
| 231 // method, that verifies that owner will not get deleted, and calls | 231 // method, that verifies that owner will not get deleted, and calls |
| 232 // |RemoveNonOwnerUserInternal|. | 232 // |RemoveNonOwnerUserInternal|. |
| 233 virtual void RemoveUserInternal(const std::string& user_email, | 233 virtual void RemoveUserInternal(const UserID& user_id, |
| 234 RemoveUserDelegate* delegate); | 234 RemoveUserDelegate* delegate); |
| 235 | 235 |
| 236 // Removes data stored or cached outside the user's cryptohome (wallpaper, | 236 // Removes data stored or cached outside the user's cryptohome (wallpaper, |
| 237 // avatar, OAuth token status, display name, display email). | 237 // avatar, OAuth token status, display name, display email). |
| 238 virtual void RemoveNonCryptohomeData(const std::string& user_id); | 238 virtual void RemoveNonCryptohomeData(const UserID& user_id); |
| 239 | 239 |
| 240 // Check for a particular user type. | 240 // Check for a particular user type. |
| 241 | 241 |
| 242 // Returns true if |user_id| represents demo app. | 242 // Returns true if |user_id| represents demo app. |
| 243 virtual bool IsDemoApp(const std::string& user_id) const = 0; | 243 virtual bool IsDemoApp(const UserID& user_id) const = 0; |
| 244 | 244 |
| 245 // Returns true if |user_id| represents kiosk app. | 245 // Returns true if |user_id| represents kiosk app. |
| 246 virtual bool IsKioskApp(const std::string& user_id) const = 0; | 246 virtual bool IsKioskApp(const UserID& user_id) const = 0; |
| 247 | 247 |
| 248 // Returns true if |user_id| represents public account that has been marked | 248 // Returns true if |user_id| represents public account that has been marked |
| 249 // for deletion. | 249 // for deletion. |
| 250 virtual bool IsPublicAccountMarkedForRemoval( | 250 virtual bool IsPublicAccountMarkedForRemoval( |
| 251 const std::string& user_id) const = 0; | 251 const UserID& user_id) const = 0; |
| 252 | 252 |
| 253 // These methods are called when corresponding user type has signed in. | 253 // These methods are called when corresponding user type has signed in. |
| 254 | 254 |
| 255 // Indicates that the demo account has just logged in. | 255 // Indicates that the demo account has just logged in. |
| 256 virtual void DemoAccountLoggedIn() = 0; | 256 virtual void DemoAccountLoggedIn() = 0; |
| 257 | 257 |
| 258 // Indicates that a user just logged in as guest. | 258 // Indicates that a user just logged in as guest. |
| 259 virtual void GuestUserLoggedIn(); | 259 virtual void GuestUserLoggedIn(); |
| 260 | 260 |
| 261 // Indicates that a kiosk app robot just logged in. | 261 // Indicates that a kiosk app robot just logged in. |
| 262 virtual void KioskAppLoggedIn(const std::string& app_id) = 0; | 262 virtual void KioskAppLoggedIn(const std::string& app_id) = 0; |
| 263 | 263 |
| 264 // Indicates that a user just logged into a public session. | 264 // Indicates that a user just logged into a public session. |
| 265 virtual void PublicAccountUserLoggedIn(User* user) = 0; | 265 virtual void PublicAccountUserLoggedIn(User* user) = 0; |
| 266 | 266 |
| 267 // Indicates that a regular user just logged in. | 267 // Indicates that a regular user just logged in. |
| 268 virtual void RegularUserLoggedIn(const std::string& user_id); | 268 virtual void RegularUserLoggedIn(const UserID& user_id); |
| 269 | 269 |
| 270 // Indicates that a regular user just logged in as ephemeral. | 270 // Indicates that a regular user just logged in as ephemeral. |
| 271 virtual void RegularUserLoggedInAsEphemeral(const std::string& user_id); | 271 virtual void RegularUserLoggedInAsEphemeral(const UserID& user_id); |
| 272 | 272 |
| 273 // Indicates that a supervised user just logged in. | 273 // Indicates that a supervised user just logged in. |
| 274 virtual void SupervisedUserLoggedIn(const std::string& user_id) = 0; | 274 virtual void SupervisedUserLoggedIn(const UserID& user_id) = 0; |
| 275 | 275 |
| 276 // Getters/setters for private members. | 276 // Getters/setters for private members. |
| 277 | 277 |
| 278 virtual void SetCurrentUserIsOwner(bool is_current_user_owner); | 278 virtual void SetCurrentUserIsOwner(bool is_current_user_owner); |
| 279 | 279 |
| 280 virtual bool GetEphemeralUsersEnabled() const; | 280 virtual bool GetEphemeralUsersEnabled() const; |
| 281 virtual void SetEphemeralUsersEnabled(bool enabled); | 281 virtual void SetEphemeralUsersEnabled(bool enabled); |
| 282 | 282 |
| 283 virtual void SetOwnerEmail(std::string owner_user_id); | 283 virtual void SetOwnerID(const UserID& owner_user_id); |
| 284 | 284 |
| 285 virtual const std::string& GetPendingUserSwitchID() const; | 285 virtual const UserID& GetPendingUserSwitchID() const; |
| 286 virtual void SetPendingUserSwitchID(std::string user_id); | 286 virtual void SetPendingUserSwitchID(const UserID& user_id); |
| 287 | 287 |
| 288 // The logged-in user that is currently active in current session. | 288 // The logged-in user that is currently active in current session. |
| 289 // NULL until a user has logged in, then points to one | 289 // NULL until a user has logged in, then points to one |
| 290 // of the User instances in |users_|, the |guest_user_| instance or an | 290 // of the User instances in |users_|, the |guest_user_| instance or an |
| 291 // ephemeral user instance. | 291 // ephemeral user instance. |
| 292 User* active_user_; | 292 User* active_user_; |
| 293 | 293 |
| 294 // The primary user of the current session. It is recorded for the first | 294 // The primary user of the current session. It is recorded for the first |
| 295 // signed-in user and does not change thereafter. | 295 // signed-in user and does not change thereafter. |
| 296 User* primary_user_; | 296 User* primary_user_; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 313 // Stages of loading user list from preferences. Some methods can have | 313 // Stages of loading user list from preferences. Some methods can have |
| 314 // different behavior depending on stage. | 314 // different behavior depending on stage. |
| 315 enum UserLoadStage { STAGE_NOT_LOADED = 0, STAGE_LOADING, STAGE_LOADED }; | 315 enum UserLoadStage { STAGE_NOT_LOADED = 0, STAGE_LOADING, STAGE_LOADED }; |
| 316 | 316 |
| 317 // Returns a list of users who have logged into this device previously. | 317 // Returns a list of users who have logged into this device previously. |
| 318 // Same as GetUsers but used if you need to modify User from that list. | 318 // Same as GetUsers but used if you need to modify User from that list. |
| 319 UserList& GetUsersAndModify(); | 319 UserList& GetUsersAndModify(); |
| 320 | 320 |
| 321 // Returns the user with the given email address if found in the persistent | 321 // Returns the user with the given email address if found in the persistent |
| 322 // list. Returns |NULL| otherwise. | 322 // list. Returns |NULL| otherwise. |
| 323 const User* FindUserInList(const std::string& user_id) const; | 323 const User* FindUserInList(const UserID& user_id) const; |
| 324 | 324 |
| 325 // Returns |true| if user with the given id is found in the persistent list. | 325 // Returns |true| if user with the given id is found in the persistent list. |
| 326 // Returns |false| otherwise. Does not trigger user loading. | 326 // Returns |false| otherwise. Does not trigger user loading. |
| 327 bool UserExistsInList(const std::string& user_id) const; | 327 bool UserExistsInList(const UserID& user_id) const; |
| 328 | 328 |
| 329 // Same as FindUserInList but returns non-const pointer to User object. | 329 // Same as FindUserInList but returns non-const pointer to User object. |
| 330 User* FindUserInListAndModify(const std::string& user_id); | 330 User* FindUserInListAndModify(const UserID& user_id); |
| 331 | 331 |
| 332 // Reads user's oauth token status from local state preferences. | 332 // Reads user's oauth token status from local state preferences. |
| 333 User::OAuthTokenStatus LoadUserOAuthStatus(const std::string& user_id) const; | 333 User::OAuthTokenStatus LoadUserOAuthStatus(const UserID& user_id) const; |
| 334 | 334 |
| 335 // Read a flag indicating whether online authentication against GAIA should | 335 // Read a flag indicating whether online authentication against GAIA should |
| 336 // be enforced during the user's next sign-in from local state preferences. | 336 // be enforced during the user's next sign-in from local state preferences. |
| 337 bool LoadForceOnlineSignin(const std::string& user_id) const; | 337 bool LoadForceOnlineSignin(const UserID& user_id) const; |
| 338 | 338 |
| 339 // Notifies observers that merge session state had changed. | 339 // Notifies observers that merge session state had changed. |
| 340 void NotifyMergeSessionStateChanged(); | 340 void NotifyMergeSessionStateChanged(); |
| 341 | 341 |
| 342 // Notifies observers that active user has changed. | 342 // Notifies observers that active user has changed. |
| 343 void NotifyActiveUserChanged(const User* active_user); | 343 void NotifyActiveUserChanged(const User* active_user); |
| 344 | 344 |
| 345 // Notifies observers that active user_id hash has changed. | 345 // Notifies observers that active user_id hash has changed. |
| 346 void NotifyActiveUserHashChanged(const std::string& hash); | 346 void NotifyActiveUserHashChanged(const std::string& hash); |
| 347 | 347 |
| 348 // Update the global LoginState. | 348 // Update the global LoginState. |
| 349 void UpdateLoginState(); | 349 void UpdateLoginState(); |
| 350 | 350 |
| 351 // Insert |user| at the front of the LRU user list. | 351 // Insert |user| at the front of the LRU user list. |
| 352 void SetLRUUser(User* user); | 352 void SetLRUUser(User* user); |
| 353 | 353 |
| 354 // Sends metrics in response to a user with gaia account (regular) logging in. | 354 // Sends metrics in response to a user with gaia account (regular) logging in. |
| 355 void SendGaiaUserLoginMetrics(const std::string& user_id); | 355 void SendGaiaUserLoginMetrics(const UserID& user_id); |
| 356 | 356 |
| 357 // Sets account locale for user with id |user_id|. | 357 // Sets account locale for user with id |user_id|. |
| 358 virtual void UpdateUserAccountLocale(const std::string& user_id, | 358 virtual void UpdateUserAccountLocale(const UserID& user_id, |
| 359 const std::string& locale); | 359 const std::string& locale); |
| 360 | 360 |
| 361 // Updates user account after locale was resolved. | 361 // Updates user account after locale was resolved. |
| 362 void DoUpdateAccountLocale(const std::string& user_id, | 362 void DoUpdateAccountLocale(const UserID& user_id, |
| 363 scoped_ptr<std::string> resolved_locale); | 363 scoped_ptr<std::string> resolved_locale); |
| 364 | 364 |
| 365 // Removes all user preferences associated with |user_id|. | 365 // Removes all user preferences associated with |user_id|. |
| 366 void RemoveKnownUserPrefs(const UserID& user_id); | 366 void RemoveKnownUserPrefs(const UserID& user_id); |
| 367 | 367 |
| 368 // Indicates stage of loading user from prefs. | 368 // Indicates stage of loading user from prefs. |
| 369 UserLoadStage user_loading_stage_; | 369 UserLoadStage user_loading_stage_; |
| 370 | 370 |
| 371 // True if SessionStarted() has been called. | 371 // True if SessionStarted() has been called. |
| 372 bool session_started_; | 372 bool session_started_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 385 // such users by not adding them to the persistent user list, not downloading | 385 // such users by not adding them to the persistent user list, not downloading |
| 386 // their custom avatars and mounting their cryptohomes using tmpfs. Defaults | 386 // their custom avatars and mounting their cryptohomes using tmpfs. Defaults |
| 387 // to |false|. | 387 // to |false|. |
| 388 bool is_current_user_ephemeral_regular_user_; | 388 bool is_current_user_ephemeral_regular_user_; |
| 389 | 389 |
| 390 // Cached flag indicating whether the ephemeral user policy is enabled. | 390 // Cached flag indicating whether the ephemeral user policy is enabled. |
| 391 // Defaults to |false| if the value has not been read from trusted device | 391 // Defaults to |false| if the value has not been read from trusted device |
| 392 // policy yet. | 392 // policy yet. |
| 393 bool ephemeral_users_enabled_; | 393 bool ephemeral_users_enabled_; |
| 394 | 394 |
| 395 // Cached name of device owner. Defaults to empty string if the value has not | 395 // Cached id of device owner. Defaults to empty id if the value has not |
| 396 // been read from trusted device policy yet. | 396 // been read from trusted device policy yet. |
| 397 std::string owner_email_; | 397 UserID owner_id_; |
| 398 | 398 |
| 399 ObserverList<UserManager::Observer> observer_list_; | 399 ObserverList<UserManager::Observer> observer_list_; |
| 400 | 400 |
| 401 // TODO(nkostylev): Merge with session state refactoring CL. | 401 // TODO(nkostylev): Merge with session state refactoring CL. |
| 402 ObserverList<UserManager::UserSessionStateObserver> | 402 ObserverList<UserManager::UserSessionStateObserver> |
| 403 session_state_observer_list_; | 403 session_state_observer_list_; |
| 404 | 404 |
| 405 // Time at which this object was created. | 405 // Time at which this object was created. |
| 406 base::TimeTicks manager_creation_time_; | 406 base::TimeTicks manager_creation_time_; |
| 407 | 407 |
| 408 // ID of the user just added to the session that needs to be activated | 408 // ID of the user just added to the session that needs to be activated |
| 409 // as soon as user's profile is loaded. | 409 // as soon as user's profile is loaded. |
| 410 std::string pending_user_switch_; | 410 user_manager::UserID pending_user_switch_; |
| 411 | 411 |
| 412 // ID of the user that was active in the previous session. | 412 // ID of the user that was active in the previous session. |
| 413 // Preference value is stored here before first user signs in | 413 // Preference value is stored here before first user signs in |
| 414 // because pref will be overidden once session restore starts. | 414 // because pref will be overidden once session restore starts. |
| 415 std::string last_session_active_user_; | 415 user_manager::UserID last_session_active_user_; |
| 416 bool last_session_active_user_initialized_; | 416 bool last_session_active_user_initialized_; |
| 417 | 417 |
| 418 // TaskRunner for UI thread. | 418 // TaskRunner for UI thread. |
| 419 scoped_refptr<base::TaskRunner> task_runner_; | 419 scoped_refptr<base::TaskRunner> task_runner_; |
| 420 | 420 |
| 421 // TaskRunner for SequencedWorkerPool. | 421 // TaskRunner for SequencedWorkerPool. |
| 422 scoped_refptr<base::TaskRunner> blocking_task_runner_; | 422 scoped_refptr<base::TaskRunner> blocking_task_runner_; |
| 423 | 423 |
| 424 base::WeakPtrFactory<UserManagerBase> weak_factory_; | 424 base::WeakPtrFactory<UserManagerBase> weak_factory_; |
| 425 | 425 |
| 426 DISALLOW_COPY_AND_ASSIGN(UserManagerBase); | 426 DISALLOW_COPY_AND_ASSIGN(UserManagerBase); |
| 427 }; | 427 }; |
| 428 | 428 |
| 429 } // namespace user_manager | 429 } // namespace user_manager |
| 430 | 430 |
| 431 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_ | 431 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_ |
| OLD | NEW |