| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 virtual void EnsureUsersLoaded(); | 147 virtual void EnsureUsersLoaded(); |
| 148 | 148 |
| 149 // Handle OAuth token |status| change for |account_id|. | 149 // Handle OAuth token |status| change for |account_id|. |
| 150 virtual void HandleUserOAuthTokenStatusChange( | 150 virtual void HandleUserOAuthTokenStatusChange( |
| 151 const AccountId& account_id, | 151 const AccountId& account_id, |
| 152 User::OAuthTokenStatus status) const = 0; | 152 User::OAuthTokenStatus status) const = 0; |
| 153 | 153 |
| 154 // Returns true if device is enterprise managed. | 154 // Returns true if device is enterprise managed. |
| 155 virtual bool IsEnterpriseManaged() const = 0; | 155 virtual bool IsEnterpriseManaged() const = 0; |
| 156 | 156 |
| 157 // Helper function that copies users from |users_list| to |users_vector| and | 157 // Loads device local accounts from the Local state and fills in |
| 158 // |users_set|. Duplicates and users already present in |existing_users| are | 158 // |device_local_accounts_set|. |
| 159 // skipped. | 159 virtual void LoadDeviceLocalAccounts( |
| 160 // Loads public accounts from the Local state and fills in | 160 std::set<AccountId>* device_local_accounts_set) = 0; |
| 161 // |public_sessions_set|. | |
| 162 virtual void LoadPublicAccounts(std::set<AccountId>* public_sessions_set) = 0; | |
| 163 | 161 |
| 164 // Notifies that user has logged in. | 162 // Notifies that user has logged in. |
| 165 virtual void NotifyOnLogin(); | 163 virtual void NotifyOnLogin(); |
| 166 | 164 |
| 167 // Notifies observers that another user was added to the session. | 165 // Notifies observers that another user was added to the session. |
| 168 // If |user_switch_pending| is true this means that user has not been fully | 166 // If |user_switch_pending| is true this means that user has not been fully |
| 169 // initialized yet like waiting for profile to be loaded. | 167 // initialized yet like waiting for profile to be loaded. |
| 170 virtual void NotifyUserAddedToSession(const User* added_user, | 168 virtual void NotifyUserAddedToSession(const User* added_user, |
| 171 bool user_switch_pending); | 169 bool user_switch_pending); |
| 172 | 170 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 200 | 198 |
| 201 // Removes data stored or cached outside the user's cryptohome (wallpaper, | 199 // Removes data stored or cached outside the user's cryptohome (wallpaper, |
| 202 // avatar, OAuth token status, display name, display email). | 200 // avatar, OAuth token status, display name, display email). |
| 203 virtual void RemoveNonCryptohomeData(const AccountId& account_id); | 201 virtual void RemoveNonCryptohomeData(const AccountId& account_id); |
| 204 | 202 |
| 205 // Check for a particular user type. | 203 // Check for a particular user type. |
| 206 | 204 |
| 207 // Returns true if |account_id| represents demo app. | 205 // Returns true if |account_id| represents demo app. |
| 208 virtual bool IsDemoApp(const AccountId& account_id) const = 0; | 206 virtual bool IsDemoApp(const AccountId& account_id) const = 0; |
| 209 | 207 |
| 210 // Returns true if |account_id| represents kiosk app. | 208 // Returns true if |account_id| represents a device local account that has |
| 211 virtual bool IsKioskApp(const AccountId& account_id) const = 0; | 209 // been marked for deletion. |
| 212 | 210 virtual bool IsDeviceLocalAccountMarkedForRemoval( |
| 213 // Returns true if |account_id| represents public account that has been marked | |
| 214 // for deletion. | |
| 215 virtual bool IsPublicAccountMarkedForRemoval( | |
| 216 const AccountId& account_id) const = 0; | 211 const AccountId& account_id) const = 0; |
| 217 | 212 |
| 218 // These methods are called when corresponding user type has signed in. | 213 // These methods are called when corresponding user type has signed in. |
| 219 | 214 |
| 220 // Indicates that the demo account has just logged in. | 215 // Indicates that the demo account has just logged in. |
| 221 virtual void DemoAccountLoggedIn() = 0; | 216 virtual void DemoAccountLoggedIn() = 0; |
| 222 | 217 |
| 223 // Indicates that a user just logged in as guest. | 218 // Indicates that a user just logged in as guest. |
| 224 virtual void GuestUserLoggedIn(); | 219 virtual void GuestUserLoggedIn(); |
| 225 | 220 |
| 226 // Indicates that a kiosk app robot just logged in. | 221 // Indicates that a kiosk app robot just logged in. |
| 227 virtual void KioskAppLoggedIn(const AccountId& kiosk_app_account_id) = 0; | 222 virtual void KioskAppLoggedIn(User* user) = 0; |
| 228 | 223 |
| 229 // Indicates that a user just logged into a public session. | 224 // Indicates that a user just logged into a public session. |
| 230 virtual void PublicAccountUserLoggedIn(User* user) = 0; | 225 virtual void PublicAccountUserLoggedIn(User* user) = 0; |
| 231 | 226 |
| 232 // Indicates that a regular user just logged in. | 227 // Indicates that a regular user just logged in. |
| 233 virtual void RegularUserLoggedIn(const AccountId& account_id); | 228 virtual void RegularUserLoggedIn(const AccountId& account_id); |
| 234 | 229 |
| 235 // Indicates that a regular user just logged in as ephemeral. | 230 // Indicates that a regular user just logged in as ephemeral. |
| 236 virtual void RegularUserLoggedInAsEphemeral(const AccountId& account_id); | 231 virtual void RegularUserLoggedInAsEphemeral(const AccountId& account_id); |
| 237 | 232 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 262 // NULL until a user has logged in, then points to one | 257 // NULL until a user has logged in, then points to one |
| 263 // of the User instances in |users_|, the |guest_user_| instance or an | 258 // of the User instances in |users_|, the |guest_user_| instance or an |
| 264 // ephemeral user instance. | 259 // ephemeral user instance. |
| 265 User* active_user_ = nullptr; | 260 User* active_user_ = nullptr; |
| 266 | 261 |
| 267 // The primary user of the current session. It is recorded for the first | 262 // The primary user of the current session. It is recorded for the first |
| 268 // signed-in user and does not change thereafter. | 263 // signed-in user and does not change thereafter. |
| 269 User* primary_user_ = nullptr; | 264 User* primary_user_ = nullptr; |
| 270 | 265 |
| 271 // List of all known users. User instances are owned by |this|. Regular users | 266 // List of all known users. User instances are owned by |this|. Regular users |
| 272 // are removed by |RemoveUserFromList|, public accounts by | 267 // are removed by |RemoveUserFromList|, device local accounts by |
| 273 // |UpdateAndCleanUpPublicAccounts|. | 268 // |UpdateAndCleanUpDeviceLocalAccounts|. |
| 274 UserList users_; | 269 UserList users_; |
| 275 | 270 |
| 276 // List of all users that are logged in current session. These point to User | 271 // List of all users that are logged in current session. These point to User |
| 277 // instances in |users_|. Only one of them could be marked as active. | 272 // instances in |users_|. Only one of them could be marked as active. |
| 278 UserList logged_in_users_; | 273 UserList logged_in_users_; |
| 279 | 274 |
| 280 // A list of all users that are logged in the current session. In contrast to | 275 // A list of all users that are logged in the current session. In contrast to |
| 281 // |logged_in_users|, the order of this list is least recently used so that | 276 // |logged_in_users|, the order of this list is least recently used so that |
| 282 // the active user should always be the first one in the list. | 277 // the active user should always be the first one in the list. |
| 283 UserList lru_logged_in_users_; | 278 UserList lru_logged_in_users_; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 scoped_refptr<base::TaskRunner> task_runner_; | 384 scoped_refptr<base::TaskRunner> task_runner_; |
| 390 | 385 |
| 391 base::WeakPtrFactory<UserManagerBase> weak_factory_; | 386 base::WeakPtrFactory<UserManagerBase> weak_factory_; |
| 392 | 387 |
| 393 DISALLOW_COPY_AND_ASSIGN(UserManagerBase); | 388 DISALLOW_COPY_AND_ASSIGN(UserManagerBase); |
| 394 }; | 389 }; |
| 395 | 390 |
| 396 } // namespace user_manager | 391 } // namespace user_manager |
| 397 | 392 |
| 398 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_ | 393 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_ |
| OLD | NEW |