blob: c3c9183550b8de92a4d8277c94ea7a7e59b8879a [file] [log] [blame]
[email protected]babc1482014-08-02 05:44:131// Copyright 2014 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
[email protected]4d390782014-08-15 09:22:585#ifndef COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_
6#define COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_
[email protected]babc1482014-08-02 05:44:137
alemate16e470e2015-04-14 15:55:408#include <map>
dcheng3f767dc32016-04-25 22:54:229#include <memory>
[email protected]babc1482014-08-02 05:44:1310#include <set>
11#include <string>
12#include <vector>
13
Danan S1a1d1752018-12-18 18:09:1614#include "base/feature_list.h"
avi5dd91f82015-12-25 22:30:4615#include "base/macros.h"
Gabriel Charettee926fc12019-12-16 19:00:0216#include "base/memory/scoped_refptr.h"
[email protected]babc1482014-08-02 05:44:1317#include "base/memory/weak_ptr.h"
18#include "base/observer_list.h"
19#include "base/synchronization/lock.h"
20#include "base/time/time.h"
Alexander Alekseev3f09a8f2018-05-03 02:52:1021#include "components/account_id/account_id.h"
[email protected]babc1482014-08-02 05:44:1322#include "components/user_manager/user.h"
[email protected]4d390782014-08-15 09:22:5823#include "components/user_manager/user_manager.h"
24#include "components/user_manager/user_manager_export.h"
merkulovab82b7132014-11-17 11:06:5025#include "components/user_manager/user_type.h"
[email protected]babc1482014-08-02 05:44:1326
[email protected]babc1482014-08-02 05:44:1327class PrefRegistrySimple;
28
[email protected]4d390782014-08-15 09:22:5829namespace base {
30class ListValue;
Gabriel Charettee926fc12019-12-16 19:00:0231class SingleThreadTaskRunner;
[email protected]4d390782014-08-15 09:22:5832}
33
34namespace user_manager {
[email protected]babc1482014-08-02 05:44:1335
36class RemoveUserDelegate;
37
38// Base implementation of the UserManager interface.
[email protected]4d390782014-08-15 09:22:5839class USER_MANAGER_EXPORT UserManagerBase : public UserManager {
[email protected]babc1482014-08-02 05:44:1340 public:
Toby Huang5afdfe22021-04-20 20:13:1641 // These enum values represent a legacy supervised user's (LSU) status on the
42 // sign in screen.
43 // TODO(crbug/1155729): Remove once all LSUs deleted in the wild. LSUs were
44 // first hidden on the login screen in M74. Assuming a five year AUE, we
45 // should stop supporting devices with LSUs by 2024.
46 // These values are logged to UMA. Entries should not be renumbered and
47 // numeric values should never be reused. Please keep in sync with
48 // "LegacySupervisedUserStatus" in src/tools/metrics/histograms/enums.xml.
49 enum class LegacySupervisedUserStatus {
50 // Non-LSU Gaia user displayed on login screen.
51 kGaiaUserDisplayed = 0,
52 // LSU hidden on login screen. Expect this count to decline to zero over
53 // time as we delete LSUs.
54 kLSUHidden = 1,
55 // LSU attempted to delete cryptohome. Expect this count to decline to zero
56 // over time as we delete LSUs.
57 kLSUDeleted = 2,
58 // Add future entires above this comment, in sync with
59 // "LegacySupervisedUserStatus" in src/tools/metrics/histograms/enums.xml.
60 // Update kMaxValue to the last value.
61 kMaxValue = kLSUDeleted
62 };
63
Gabriel Charettee926fc12019-12-16 19:00:0264 // Creates UserManagerBase with |task_runner| for UI thread.
65 explicit UserManagerBase(
66 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
dchengbd5bd4f2015-01-23 16:01:3867 ~UserManagerBase() override;
[email protected]babc1482014-08-02 05:44:1368
Toby Huang5afdfe22021-04-20 20:13:1669 // Histogram for tracking the number of deprecated legacy supervised user
70 // cryptohomes remaining in the wild.
71 static const char kLegacySupervisedUsersHistogramName[];
72 // Feature that removes legacy supervised users.
73 static const base::Feature kRemoveLegacySupervisedUsersOnStartup;
74
[email protected]babc1482014-08-02 05:44:1375 // Registers UserManagerBase preferences.
76 static void RegisterPrefs(PrefRegistrySimple* registry);
77
78 // UserManager implementation:
dchengbd5bd4f2015-01-23 16:01:3879 void Shutdown() override;
80 const UserList& GetUsers() const override;
81 const UserList& GetLoggedInUsers() const override;
82 const UserList& GetLRULoggedInUsers() const override;
alemate3ffbde6f2015-11-03 02:02:5583 const AccountId& GetOwnerAccountId() const override;
84 void UserLoggedIn(const AccountId& account_id,
dchengbd5bd4f2015-01-23 16:01:3885 const std::string& user_id_hash,
Alexander Alekseev2a5efd62017-12-06 07:27:2886 bool browser_restart,
87 bool is_child) override;
alemate3ffbde6f2015-11-03 02:02:5588 void SwitchActiveUser(const AccountId& account_id) override;
dchengbd5bd4f2015-01-23 16:01:3889 void SwitchToLastActiveUser() override;
xiyuan834f3bc2016-10-26 19:40:5390 void OnSessionStarted() override;
alemate3ffbde6f2015-11-03 02:02:5591 void RemoveUser(const AccountId& account_id,
dchengbd5bd4f2015-01-23 16:01:3892 RemoveUserDelegate* delegate) override;
alemate3ffbde6f2015-11-03 02:02:5593 void RemoveUserFromList(const AccountId& account_id) override;
94 bool IsKnownUser(const AccountId& account_id) const override;
95 const User* FindUser(const AccountId& account_id) const override;
96 User* FindUserAndModify(const AccountId& account_id) override;
dchengbd5bd4f2015-01-23 16:01:3897 const User* GetActiveUser() const override;
98 User* GetActiveUser() override;
99 const User* GetPrimaryUser() const override;
alemate3ffbde6f2015-11-03 02:02:55100 void SaveUserOAuthStatus(const AccountId& account_id,
dchengbd5bd4f2015-01-23 16:01:38101 User::OAuthTokenStatus oauth_token_status) override;
alemate3ffbde6f2015-11-03 02:02:55102 void SaveForceOnlineSignin(const AccountId& account_id,
dchengbd5bd4f2015-01-23 16:01:38103 bool force_online_signin) override;
alemate3ffbde6f2015-11-03 02:02:55104 void SaveUserDisplayName(const AccountId& account_id,
Jan Wilken Dörriefa241ba2021-03-11 17:57:01105 const std::u16string& display_name) override;
106 std::u16string GetUserDisplayName(const AccountId& account_id) const override;
alemate3ffbde6f2015-11-03 02:02:55107 void SaveUserDisplayEmail(const AccountId& account_id,
dchengbd5bd4f2015-01-23 16:01:38108 const std::string& display_email) override;
Alexander Alekseev2a5efd62017-12-06 07:27:28109 void SaveUserType(const User* user) override;
alemate3ffbde6f2015-11-03 02:02:55110 void UpdateUserAccountData(const AccountId& account_id,
dchengbd5bd4f2015-01-23 16:01:38111 const UserAccountData& account_data) override;
112 bool IsCurrentUserOwner() const override;
113 bool IsCurrentUserNew() const override;
114 bool IsCurrentUserNonCryptohomeDataEphemeral() const override;
rsorokin79e93442016-04-29 07:54:12115 bool IsCurrentUserCryptohomeDataEphemeral() const override;
dchengbd5bd4f2015-01-23 16:01:38116 bool CanCurrentUserLock() const override;
117 bool IsUserLoggedIn() const override;
118 bool IsLoggedInAsUserWithGaiaAccount() const override;
119 bool IsLoggedInAsChildUser() const override;
120 bool IsLoggedInAsPublicAccount() const override;
121 bool IsLoggedInAsGuest() const override;
dchengbd5bd4f2015-01-23 16:01:38122 bool IsLoggedInAsKioskApp() const override;
peletskyi53c440d2016-10-25 15:09:55123 bool IsLoggedInAsArcKioskApp() const override;
Anatoliy Potapchuk21052562019-11-13 16:27:24124 bool IsLoggedInAsWebKioskApp() const override;
Anatoliy Potapchuk42665fb2019-10-30 00:11:42125 bool IsLoggedInAsAnyKioskApp() const override;
dchengbd5bd4f2015-01-23 16:01:38126 bool IsLoggedInAsStub() const override;
dchengbd5bd4f2015-01-23 16:01:38127 bool IsUserNonCryptohomeDataEphemeral(
alemate3ffbde6f2015-11-03 02:02:55128 const AccountId& account_id) const override;
rsorokin79e93442016-04-29 07:54:12129 bool IsUserCryptohomeDataEphemeral(
130 const AccountId& account_id) const override;
dchengbd5bd4f2015-01-23 16:01:38131 void AddObserver(UserManager::Observer* obs) override;
132 void RemoveObserver(UserManager::Observer* obs) override;
133 void AddSessionStateObserver(
mostynbfe59f482014-10-06 15:04:46134 UserManager::UserSessionStateObserver* obs) override;
dchengbd5bd4f2015-01-23 16:01:38135 void RemoveSessionStateObserver(
mostynbfe59f482014-10-06 15:04:46136 UserManager::UserSessionStateObserver* obs) override;
dchengbd5bd4f2015-01-23 16:01:38137 void NotifyLocalStateChanged() override;
xiyuan66e41772016-12-13 21:57:58138 void NotifyUserImageChanged(const User& user) override;
139 void NotifyUserProfileImageUpdateFailed(const User& user) override;
140 void NotifyUserProfileImageUpdated(
141 const User& user,
142 const gfx::ImageSkia& profile_image) override;
Daria Yakovlevaea3ce4b2017-10-11 19:51:59143 void NotifyUsersSignInConstraintsChanged() override;
alemate33433e22016-01-13 14:50:30144 void Initialize() override;
[email protected]babc1482014-08-02 05:44:13145
alemate3ffbde6f2015-11-03 02:02:55146 // This method updates "User was added to the device in this session nad is
147 // not full initialized yet" flag.
alematee66a4962015-02-26 16:12:00148 virtual void SetIsCurrentUserNew(bool is_new);
149
hcarmonab1723ed32015-11-18 21:52:58150 // Helper function that converts users from |users_list| to |users_vector| and
[email protected]babc1482014-08-02 05:44:13151 // |users_set|. Duplicates and users already present in |existing_users| are
152 // skipped.
hcarmonab1723ed32015-11-18 21:52:58153 void ParseUserList(const base::ListValue& users_list,
154 const std::set<AccountId>& existing_users,
155 std::vector<AccountId>* users_vector,
156 std::set<AccountId>* users_set);
[email protected]babc1482014-08-02 05:44:13157
alemate0242b472015-04-20 09:53:40158 // Returns true if trusted device policies have successfully been retrieved
159 // and ephemeral users are enabled.
160 virtual bool AreEphemeralUsersEnabled() const = 0;
161
isandrk98a3e4a12017-05-26 21:14:50162 void AddUserRecordForTesting(User* user) {
163 return AddUserRecord(user);
164 }
165
Jia08639632018-01-12 00:32:41166 // Returns true if device is enterprise managed.
167 virtual bool IsEnterpriseManaged() const = 0;
168
[email protected]babc1482014-08-02 05:44:13169 protected:
[email protected]babc1482014-08-02 05:44:13170 // Adds |user| to users list, and adds it to front of LRU list. It is assumed
171 // that there is no user with same id.
[email protected]4d390782014-08-15 09:22:58172 virtual void AddUserRecord(User* user);
[email protected]babc1482014-08-02 05:44:13173
[email protected]babc1482014-08-02 05:44:13174 // Returns true if user may be removed.
[email protected]4d390782014-08-15 09:22:58175 virtual bool CanUserBeRemoved(const User* user) const;
[email protected]babc1482014-08-02 05:44:13176
177 // A wrapper around C++ delete operator. Deletes |user|, and when |user|
178 // equals to active_user_, active_user_ is reset to NULL.
[email protected]4d390782014-08-15 09:22:58179 virtual void DeleteUser(User* user);
[email protected]babc1482014-08-02 05:44:13180
181 // Returns the locale used by the application.
182 virtual const std::string& GetApplicationLocale() const = 0;
183
[email protected]babc1482014-08-02 05:44:13184 // Loads |users_| from Local State if the list has not been loaded yet.
185 // Subsequent calls have no effect. Must be called on the UI thread.
merkulova793f3022015-02-04 10:18:30186 virtual void EnsureUsersLoaded();
[email protected]babc1482014-08-02 05:44:13187
xiyuand4f04572016-04-19 18:22:53188 // Loads device local accounts from the Local state and fills in
189 // |device_local_accounts_set|.
190 virtual void LoadDeviceLocalAccounts(
191 std::set<AccountId>* device_local_accounts_set) = 0;
[email protected]babc1482014-08-02 05:44:13192
Tony de Lunac07af6a2019-01-14 23:34:03193 // Notifies observers that active user has changed.
Evan Stade0881dea2019-09-04 18:22:49194 void NotifyActiveUserChanged(User* active_user);
Tony de Lunac07af6a2019-01-14 23:34:03195
[email protected]babc1482014-08-02 05:44:13196 // Notifies that user has logged in.
197 virtual void NotifyOnLogin();
198
199 // Notifies observers that another user was added to the session.
200 // If |user_switch_pending| is true this means that user has not been fully
201 // initialized yet like waiting for profile to be loaded.
[email protected]4d390782014-08-15 09:22:58202 virtual void NotifyUserAddedToSession(const User* added_user,
[email protected]babc1482014-08-02 05:44:13203 bool user_switch_pending);
204
[email protected]babc1482014-08-02 05:44:13205 // Performs any additional actions after user list is loaded.
206 virtual void PerformPostUserListLoadingActions() = 0;
207
208 // Performs any additional actions after UserLoggedIn() execution has been
209 // completed.
210 // |browser_restart| is true when reloading Chrome after crash to distinguish
211 // from normal sign in flow.
212 virtual void PerformPostUserLoggedInActions(bool browser_restart) = 0;
213
214 // Implementation for RemoveUser method. It is synchronous. It is called from
215 // RemoveUserInternal after owner check.
alemate3ffbde6f2015-11-03 02:02:55216 virtual void RemoveNonOwnerUserInternal(const AccountId& account_id,
[email protected]babc1482014-08-02 05:44:13217 RemoveUserDelegate* delegate);
218
219 // Removes a regular or supervised user from the user list.
220 // Returns the user if found or NULL otherwise.
221 // Also removes the user from the persistent user list.
Sergey Poromov38f7af82018-02-12 10:59:05222 // |notify| is true when OnUserRemoved() should be triggered,
223 // meaning that the user won't be added after the removal.
224 User* RemoveRegularOrSupervisedUserFromList(const AccountId& account_id,
225 bool notify);
[email protected]babc1482014-08-02 05:44:13226
227 // Implementation for RemoveUser method. This is an asynchronous part of the
228 // method, that verifies that owner will not get deleted, and calls
229 // |RemoveNonOwnerUserInternal|.
alemate3ffbde6f2015-11-03 02:02:55230 virtual void RemoveUserInternal(const AccountId& account_id,
[email protected]babc1482014-08-02 05:44:13231 RemoveUserDelegate* delegate);
232
233 // Removes data stored or cached outside the user's cryptohome (wallpaper,
234 // avatar, OAuth token status, display name, display email).
alemate3ffbde6f2015-11-03 02:02:55235 virtual void RemoveNonCryptohomeData(const AccountId& account_id);
[email protected]babc1482014-08-02 05:44:13236
237 // Check for a particular user type.
238
[email protected]babc1482014-08-02 05:44:13239 // These methods are called when corresponding user type has signed in.
240
[email protected]babc1482014-08-02 05:44:13241 // Indicates that a user just logged in as guest.
242 virtual void GuestUserLoggedIn();
243
244 // Indicates that a kiosk app robot just logged in.
xiyuand4f04572016-04-19 18:22:53245 virtual void KioskAppLoggedIn(User* user) = 0;
[email protected]babc1482014-08-02 05:44:13246
[email protected]babc1482014-08-02 05:44:13247 // Indicates that a user just logged into a public session.
[email protected]4d390782014-08-15 09:22:58248 virtual void PublicAccountUserLoggedIn(User* user) = 0;
[email protected]babc1482014-08-02 05:44:13249
250 // Indicates that a regular user just logged in.
Alexander Alekseev2a5efd62017-12-06 07:27:28251 virtual void RegularUserLoggedIn(const AccountId& account_id,
252 const UserType user_type);
[email protected]babc1482014-08-02 05:44:13253
254 // Indicates that a regular user just logged in as ephemeral.
Alexander Alekseev2a5efd62017-12-06 07:27:28255 virtual void RegularUserLoggedInAsEphemeral(const AccountId& account_id,
256 const UserType user_type);
[email protected]babc1482014-08-02 05:44:13257
peletskyi2b8c9d232015-07-31 16:23:58258 // Should be called when regular user was removed.
alemate3ffbde6f2015-11-03 02:02:55259 virtual void OnUserRemoved(const AccountId& account_id) = 0;
peletskyi2b8c9d232015-07-31 16:23:58260
alemate33433e22016-01-13 14:50:30261 // Update the global LoginState.
262 virtual void UpdateLoginState(const User* active_user,
263 const User* primary_user,
264 bool is_current_user_owner) const = 0;
265
[email protected]babc1482014-08-02 05:44:13266 // Getters/setters for private members.
267
[email protected]babc1482014-08-02 05:44:13268 virtual bool GetEphemeralUsersEnabled() const;
269 virtual void SetEphemeralUsersEnabled(bool enabled);
270
alemate3ffbde6f2015-11-03 02:02:55271 virtual void SetOwnerId(const AccountId& owner_account_id);
[email protected]babc1482014-08-02 05:44:13272
alemate3ffbde6f2015-11-03 02:02:55273 virtual const AccountId& GetPendingUserSwitchID() const;
274 virtual void SetPendingUserSwitchId(const AccountId& account_id);
[email protected]babc1482014-08-02 05:44:13275
276 // The logged-in user that is currently active in current session.
277 // NULL until a user has logged in, then points to one
278 // of the User instances in |users_|, the |guest_user_| instance or an
279 // ephemeral user instance.
alemate3ffbde6f2015-11-03 02:02:55280 User* active_user_ = nullptr;
[email protected]babc1482014-08-02 05:44:13281
282 // The primary user of the current session. It is recorded for the first
283 // signed-in user and does not change thereafter.
alemate3ffbde6f2015-11-03 02:02:55284 User* primary_user_ = nullptr;
[email protected]babc1482014-08-02 05:44:13285
286 // List of all known users. User instances are owned by |this|. Regular users
xiyuand4f04572016-04-19 18:22:53287 // are removed by |RemoveUserFromList|, device local accounts by
288 // |UpdateAndCleanUpDeviceLocalAccounts|.
[email protected]4d390782014-08-15 09:22:58289 UserList users_;
[email protected]babc1482014-08-02 05:44:13290
merkulova793f3022015-02-04 10:18:30291 // List of all users that are logged in current session. These point to User
292 // instances in |users_|. Only one of them could be marked as active.
293 UserList logged_in_users_;
294
295 // A list of all users that are logged in the current session. In contrast to
296 // |logged_in_users|, the order of this list is least recently used so that
297 // the active user should always be the first one in the list.
298 UserList lru_logged_in_users_;
299
[email protected]babc1482014-08-02 05:44:13300 private:
301 // Stages of loading user list from preferences. Some methods can have
302 // different behavior depending on stage.
303 enum UserLoadStage { STAGE_NOT_LOADED = 0, STAGE_LOADING, STAGE_LOADED };
304
305 // Returns a list of users who have logged into this device previously.
306 // Same as GetUsers but used if you need to modify User from that list.
[email protected]4d390782014-08-15 09:22:58307 UserList& GetUsersAndModify();
[email protected]babc1482014-08-02 05:44:13308
309 // Returns the user with the given email address if found in the persistent
310 // list. Returns |NULL| otherwise.
alemate3ffbde6f2015-11-03 02:02:55311 const User* FindUserInList(const AccountId& account_id) const;
[email protected]babc1482014-08-02 05:44:13312
313 // Returns |true| if user with the given id is found in the persistent list.
314 // Returns |false| otherwise. Does not trigger user loading.
alemate3ffbde6f2015-11-03 02:02:55315 bool UserExistsInList(const AccountId& account_id) const;
[email protected]babc1482014-08-02 05:44:13316
317 // Same as FindUserInList but returns non-const pointer to User object.
alemate3ffbde6f2015-11-03 02:02:55318 User* FindUserInListAndModify(const AccountId& account_id);
[email protected]babc1482014-08-02 05:44:13319
320 // Reads user's oauth token status from local state preferences.
alemate3ffbde6f2015-11-03 02:02:55321 User::OAuthTokenStatus LoadUserOAuthStatus(const AccountId& account_id) const;
[email protected]babc1482014-08-02 05:44:13322
323 // Read a flag indicating whether online authentication against GAIA should
324 // be enforced during the user's next sign-in from local state preferences.
alemate3ffbde6f2015-11-03 02:02:55325 bool LoadForceOnlineSignin(const AccountId& account_id) const;
[email protected]babc1482014-08-02 05:44:13326
atwilsond5a7eabf2017-03-09 13:18:39327 // Read a flag indicating whether session initialization has completed at
328 // least once.
329 bool LoadSessionInitialized(const AccountId& account_id) const;
330
[email protected]babc1482014-08-02 05:44:13331 // Notifies observers that merge session state had changed.
332 void NotifyMergeSessionStateChanged();
333
alemate3ffbde6f2015-11-03 02:02:55334 // Notifies observers that active account_id hash has changed.
[email protected]babc1482014-08-02 05:44:13335 void NotifyActiveUserHashChanged(const std::string& hash);
336
alemate33433e22016-01-13 14:50:30337 // Call UpdateLoginState.
338 void CallUpdateLoginState();
[email protected]babc1482014-08-02 05:44:13339
340 // Insert |user| at the front of the LRU user list.
[email protected]4d390782014-08-15 09:22:58341 void SetLRUUser(User* user);
[email protected]babc1482014-08-02 05:44:13342
merkulovac3ae44d2014-11-17 09:35:07343 // Sends metrics in response to a user with gaia account (regular) logging in.
alemate3ffbde6f2015-11-03 02:02:55344 void SendGaiaUserLoginMetrics(const AccountId& account_id);
[email protected]babc1482014-08-02 05:44:13345
alemate3ffbde6f2015-11-03 02:02:55346 // Sets account locale for user with id |account_id|.
347 virtual void UpdateUserAccountLocale(const AccountId& account_id,
[email protected]babc1482014-08-02 05:44:13348 const std::string& locale);
349
350 // Updates user account after locale was resolved.
alemate3ffbde6f2015-11-03 02:02:55351 void DoUpdateAccountLocale(const AccountId& account_id,
dcheng3f767dc32016-04-25 22:54:22352 std::unique_ptr<std::string> resolved_locale);
[email protected]babc1482014-08-02 05:44:13353
Toby Huang5afdfe22021-04-20 20:13:16354 void RemoveLegacySupervisedUser(const AccountId& account_id);
355
[email protected]babc1482014-08-02 05:44:13356 // Indicates stage of loading user from prefs.
alemate3ffbde6f2015-11-03 02:02:55357 UserLoadStage user_loading_stage_ = STAGE_NOT_LOADED;
[email protected]babc1482014-08-02 05:44:13358
[email protected]babc1482014-08-02 05:44:13359 // Cached flag of whether the currently logged-in user existed before this
360 // login.
alemate3ffbde6f2015-11-03 02:02:55361 bool is_current_user_new_ = false;
[email protected]babc1482014-08-02 05:44:13362
363 // Cached flag of whether the currently logged-in user is a regular user who
364 // logged in as ephemeral. Storage of persistent information is avoided for
365 // such users by not adding them to the persistent user list, not downloading
366 // their custom avatars and mounting their cryptohomes using tmpfs. Defaults
367 // to |false|.
alemate3ffbde6f2015-11-03 02:02:55368 bool is_current_user_ephemeral_regular_user_ = false;
[email protected]babc1482014-08-02 05:44:13369
370 // Cached flag indicating whether the ephemeral user policy is enabled.
371 // Defaults to |false| if the value has not been read from trusted device
372 // policy yet.
alemate3ffbde6f2015-11-03 02:02:55373 bool ephemeral_users_enabled_ = false;
[email protected]babc1482014-08-02 05:44:13374
alemate3ffbde6f2015-11-03 02:02:55375 // Cached name of device owner. Defaults to empty if the value has not
[email protected]babc1482014-08-02 05:44:13376 // been read from trusted device policy yet.
alemate3ffbde6f2015-11-03 02:02:55377 AccountId owner_account_id_ = EmptyAccountId();
[email protected]babc1482014-08-02 05:44:13378
Trent Apteda250ec3ab2018-08-19 08:52:19379 base::ObserverList<UserManager::Observer>::Unchecked observer_list_;
[email protected]babc1482014-08-02 05:44:13380
381 // TODO(nkostylev): Merge with session state refactoring CL.
Trent Apteda250ec3ab2018-08-19 08:52:19382 base::ObserverList<UserManager::UserSessionStateObserver>::Unchecked
[email protected]babc1482014-08-02 05:44:13383 session_state_observer_list_;
384
385 // Time at which this object was created.
alemate3ffbde6f2015-11-03 02:02:55386 base::TimeTicks manager_creation_time_ = base::TimeTicks::Now();
[email protected]babc1482014-08-02 05:44:13387
388 // ID of the user just added to the session that needs to be activated
389 // as soon as user's profile is loaded.
alemate3ffbde6f2015-11-03 02:02:55390 AccountId pending_user_switch_ = EmptyAccountId();
[email protected]babc1482014-08-02 05:44:13391
nkostylev5df7e992014-09-26 09:03:47392 // ID of the user that was active in the previous session.
393 // Preference value is stored here before first user signs in
394 // because pref will be overidden once session restore starts.
alemate3ffbde6f2015-11-03 02:02:55395 AccountId last_session_active_account_id_ = EmptyAccountId();
396 bool last_session_active_account_id_initialized_ = false;
nkostylev5df7e992014-09-26 09:03:47397
[email protected]ac58eaf72014-08-19 13:06:42398 // TaskRunner for UI thread.
Gabriel Charettee926fc12019-12-16 19:00:02399 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
[email protected]ac58eaf72014-08-19 13:06:42400
Jeremy Roman47d432e2019-08-20 14:24:00401 base::WeakPtrFactory<UserManagerBase> weak_factory_{this};
[email protected]babc1482014-08-02 05:44:13402
403 DISALLOW_COPY_AND_ASSIGN(UserManagerBase);
404};
405
[email protected]4d390782014-08-15 09:22:58406} // namespace user_manager
[email protected]babc1482014-08-02 05:44:13407
[email protected]4d390782014-08-15 09:22:58408#endif // COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_