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