Index: chrome/browser/chromeos/login/user_manager_impl.h |
diff --git a/chrome/browser/chromeos/login/user_manager_impl.h b/chrome/browser/chromeos/login/user_manager_impl.h |
index 93e32f07d9192a3941ccfe6cedf1c35cfd43fe95..9f967dd2917b30e3f05f31f6dceb97fb06f5985d 100644 |
--- a/chrome/browser/chromeos/login/user_manager_impl.h |
+++ b/chrome/browser/chromeos/login/user_manager_impl.h |
@@ -5,18 +5,22 @@ |
#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_ |
#define CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_ |
+#include <set> |
#include <string> |
+#include <vector> |
#include "base/basictypes.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/singleton.h" |
#include "base/observer_list.h" |
#include "base/synchronization/lock.h" |
+#include "base/values.h" |
#include "chrome/browser/api/sync/profile_sync_service_observer.h" |
#include "chrome/browser/chromeos/login/user.h" |
#include "chrome/browser/chromeos/login/user_image_manager_impl.h" |
#include "chrome/browser/chromeos/login/user_manager.h" |
#include "chrome/browser/chromeos/login/wallpaper_manager.h" |
+#include "chrome/browser/chromeos/settings/cros_settings.h" |
#include "chrome/browser/chromeos/settings/device_settings_service.h" |
#include "content/public/browser/notification_observer.h" |
#include "content/public/browser/notification_registrar.h" |
@@ -37,6 +41,7 @@ class UserManagerImpl : public UserManager, |
virtual ~UserManagerImpl(); |
// UserManager implementation: |
+ virtual void Shutdown() OVERRIDE; |
virtual UserImageManager* GetUserImageManager() OVERRIDE; |
virtual const UserList& GetUsers() const OVERRIDE; |
virtual void UserLoggedIn(const std::string& email, |
@@ -68,6 +73,7 @@ class UserManagerImpl : public UserManager, |
virtual bool IsCurrentUserEphemeral() const OVERRIDE; |
virtual bool CanCurrentUserLock() const OVERRIDE; |
virtual bool IsUserLoggedIn() const OVERRIDE; |
+ virtual bool IsLoggedInAsRegularUser() const OVERRIDE; |
virtual bool IsLoggedInAsDemoUser() const OVERRIDE; |
virtual bool IsLoggedInAsPublicAccount() const OVERRIDE; |
virtual bool IsLoggedInAsGuest() const OVERRIDE; |
@@ -93,9 +99,19 @@ class UserManagerImpl : public UserManager, |
UserManagerImpl(); |
+ // Helper function that copies users from |users_list| to |users_vector| and |
+ // |users_set|. Duplicates and users already present in |existing_users| are |
+ // skipped. The |logged_in_user| is also skipped and the return value |
+ // indicates whether that user was found in |users_list|. |
+ bool ParseUserList(const ListValue& users_list, |
+ const std::set<std::string>& existing_users, |
+ const std::string& logged_in_user, |
+ std::vector<std::string>* users_vector, |
+ std::set<std::string>* users_set) const; |
+ |
// Loads |users_| from Local State if the list has not been loaded yet. |
// Subsequent calls have no effect. Must be called on the UI thread. |
- void EnsureUsersLoaded(); |
+ void EnsureUsersLoaded() const; |
Ivan Korotkov
2012/11/28 21:40:53
const here doesn't look right. In GetUsers() it's
bartfab (slow)
2012/11/29 14:18:09
This was requested by Julian in his review. I agre
Ivan Korotkov
2012/11/29 17:25:33
Yes, I still think it's better to leave it non-con
bartfab (slow)
2012/11/29 18:56:17
Done.
|
// Retrieves trusted device policies and removes users from the persistent |
// list if ephemeral users are enabled. Schedules a callback to itself if |
@@ -125,12 +141,30 @@ class UserManagerImpl : public UserManager, |
// Triggers an asynchronous ownership check. |
void CheckOwnership(); |
- // Removes the user from the persistent list only. Also removes the user's |
- // picture. |
- void RemoveUserFromListInternal(const std::string& email); |
+ // Removes data stored or cached outside the user's cryptohome (wallpaper, |
+ // avatar, OAuth token status, display name, display email). |
+ void RemoveNonCryptohomeData(const std::string& email); |
+ |
+ // Removes a user from the user list. Returns the user if found or NULL |
+ // otherwise. Also removes the user from the persistent user list. |
+ User *RemoveUserFromListInternal(const std::string& email); |
+ |
+ // Replaces the list of device-local users with |local_users_list|. Ensures |
+ // that data stored outside their cryptohomes is removed for any users who are |
+ // no longer on the list. Returns |true| if the user list has changed. |
+ bool UpdateLocalUsers(const base::ListValue& local_users_list); |
Ivan Korotkov
2012/11/28 21:40:53
Please rename to indicate that pending removal is
bartfab (slow)
2012/11/29 14:18:09
Done.
|
+ |
+ // Interface to the signed settings store. |
+ CrosSettings* cros_settings_; |
+ |
+ // True if users have been loaded from prefs already. Mutable so that |
+ // |EnsureUsersLoaded| can lazily load the user list. |
+ mutable bool users_loaded_; |
- // List of all known users. User instances are owned by |this| and deleted |
- // when users are removed by |RemoveUserFromListInternal|. |
+ // List of all known users. User instances are owned by |this|. Regular users |
+ // are removed by |RemoveUserFromList|, device-local users by |
+ // |UpdateLocalUsers|. Mutable so that |EnsureUsersLoaded| can lazily load the |
+ // user list. |
mutable UserList users_; |
// The logged-in user. NULL until a user has logged in, then points to one |
@@ -176,7 +210,9 @@ class UserManagerImpl : public UserManager, |
ObserverList<UserManager::Observer> observer_list_; |
- scoped_ptr<UserImageManagerImpl> user_image_manager_; |
+ // User avatar manager. Mutable so that |EnsureUsersLoaded| can request |
+ // avatars to be loaded when lazily loading the user list. |
+ mutable scoped_ptr<UserImageManagerImpl> user_image_manager_; |
DISALLOW_COPY_AND_ASSIGN(UserManagerImpl); |
}; |