Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: chrome/browser/chromeos/login/user_manager_impl.h

Issue 11419184: Add public accounts to UserManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Made comment easier to understand. Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/singleton.h" 12 #include "base/memory/singleton.h"
13 #include "base/observer_list.h" 13 #include "base/observer_list.h"
14 #include "base/synchronization/lock.h" 14 #include "base/synchronization/lock.h"
15 #include "base/values.h"
15 #include "chrome/browser/api/sync/profile_sync_service_observer.h" 16 #include "chrome/browser/api/sync/profile_sync_service_observer.h"
16 #include "chrome/browser/chromeos/login/user.h" 17 #include "chrome/browser/chromeos/login/user.h"
17 #include "chrome/browser/chromeos/login/user_image_manager_impl.h" 18 #include "chrome/browser/chromeos/login/user_image_manager_impl.h"
18 #include "chrome/browser/chromeos/login/user_manager.h" 19 #include "chrome/browser/chromeos/login/user_manager.h"
19 #include "chrome/browser/chromeos/login/wallpaper_manager.h" 20 #include "chrome/browser/chromeos/login/wallpaper_manager.h"
21 #include "chrome/browser/chromeos/settings/cros_settings.h"
20 #include "chrome/browser/chromeos/settings/device_settings_service.h" 22 #include "chrome/browser/chromeos/settings/device_settings_service.h"
21 #include "content/public/browser/notification_observer.h" 23 #include "content/public/browser/notification_observer.h"
22 #include "content/public/browser/notification_registrar.h" 24 #include "content/public/browser/notification_registrar.h"
23 25
24 class FilePath; 26 class FilePath;
25 class PrefService; 27 class PrefService;
26 class ProfileSyncService; 28 class ProfileSyncService;
27 29
28 namespace chromeos { 30 namespace chromeos {
29 31
30 class RemoveUserDelegate; 32 class RemoveUserDelegate;
31 33
32 // Implementation of the UserManager. 34 // Implementation of the UserManager.
33 class UserManagerImpl : public UserManager, 35 class UserManagerImpl : public UserManager,
34 public ProfileSyncServiceObserver, 36 public ProfileSyncServiceObserver,
35 public content::NotificationObserver { 37 public content::NotificationObserver {
36 public: 38 public:
37 virtual ~UserManagerImpl(); 39 virtual ~UserManagerImpl();
38 40
39 // UserManager implementation: 41 // UserManager implementation:
42 virtual void Shutdown() OVERRIDE;
40 virtual UserImageManager* GetUserImageManager() OVERRIDE; 43 virtual UserImageManager* GetUserImageManager() OVERRIDE;
41 virtual const UserList& GetUsers() const OVERRIDE; 44 virtual const UserList& GetUsers() const OVERRIDE;
42 virtual void UserLoggedIn(const std::string& email, 45 virtual void UserLoggedIn(const std::string& email,
43 bool browser_restart) OVERRIDE; 46 bool browser_restart) OVERRIDE;
44 virtual void RetailModeUserLoggedIn() OVERRIDE; 47 virtual void RetailModeUserLoggedIn() OVERRIDE;
45 virtual void GuestUserLoggedIn() OVERRIDE; 48 virtual void GuestUserLoggedIn() OVERRIDE;
46 virtual void EphemeralUserLoggedIn(const std::string& email) OVERRIDE; 49 virtual void EphemeralUserLoggedIn(const std::string& email) OVERRIDE;
47 virtual void SessionStarted() OVERRIDE; 50 virtual void SessionStarted() OVERRIDE;
48 virtual void RemoveUser(const std::string& email, 51 virtual void RemoveUser(const std::string& email,
49 RemoveUserDelegate* delegate) OVERRIDE; 52 RemoveUserDelegate* delegate) OVERRIDE;
(...skipping 11 matching lines...) Expand all
61 const std::string& username) const OVERRIDE; 64 const std::string& username) const OVERRIDE;
62 virtual void SaveUserDisplayEmail(const std::string& username, 65 virtual void SaveUserDisplayEmail(const std::string& username,
63 const std::string& display_email) OVERRIDE; 66 const std::string& display_email) OVERRIDE;
64 virtual std::string GetUserDisplayEmail( 67 virtual std::string GetUserDisplayEmail(
65 const std::string& username) const OVERRIDE; 68 const std::string& username) const OVERRIDE;
66 virtual bool IsCurrentUserOwner() const OVERRIDE; 69 virtual bool IsCurrentUserOwner() const OVERRIDE;
67 virtual bool IsCurrentUserNew() const OVERRIDE; 70 virtual bool IsCurrentUserNew() const OVERRIDE;
68 virtual bool IsCurrentUserEphemeral() const OVERRIDE; 71 virtual bool IsCurrentUserEphemeral() const OVERRIDE;
69 virtual bool CanCurrentUserLock() const OVERRIDE; 72 virtual bool CanCurrentUserLock() const OVERRIDE;
70 virtual bool IsUserLoggedIn() const OVERRIDE; 73 virtual bool IsUserLoggedIn() const OVERRIDE;
74 virtual bool IsLoggedInAsRegularUser() const OVERRIDE;
71 virtual bool IsLoggedInAsDemoUser() const OVERRIDE; 75 virtual bool IsLoggedInAsDemoUser() const OVERRIDE;
72 virtual bool IsLoggedInAsPublicAccount() const OVERRIDE; 76 virtual bool IsLoggedInAsPublicAccount() const OVERRIDE;
73 virtual bool IsLoggedInAsGuest() const OVERRIDE; 77 virtual bool IsLoggedInAsGuest() const OVERRIDE;
74 virtual bool IsLoggedInAsStub() const OVERRIDE; 78 virtual bool IsLoggedInAsStub() const OVERRIDE;
75 virtual bool IsSessionStarted() const OVERRIDE; 79 virtual bool IsSessionStarted() const OVERRIDE;
76 virtual bool IsEphemeralUser(const std::string& email) const OVERRIDE; 80 virtual bool IsEphemeralUser(const std::string& email) const OVERRIDE;
77 virtual void AddObserver(UserManager::Observer* obs) OVERRIDE; 81 virtual void AddObserver(UserManager::Observer* obs) OVERRIDE;
78 virtual void RemoveObserver(UserManager::Observer* obs) OVERRIDE; 82 virtual void RemoveObserver(UserManager::Observer* obs) OVERRIDE;
79 virtual void NotifyLocalStateChanged() OVERRIDE; 83 virtual void NotifyLocalStateChanged() OVERRIDE;
80 84
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 122
119 void SetCurrentUserIsOwner(bool is_current_user_owner); 123 void SetCurrentUserIsOwner(bool is_current_user_owner);
120 124
121 // Updates current user ownership on UI thread. 125 // Updates current user ownership on UI thread.
122 void UpdateOwnership(DeviceSettingsService::OwnershipStatus status, 126 void UpdateOwnership(DeviceSettingsService::OwnershipStatus status,
123 bool is_owner); 127 bool is_owner);
124 128
125 // Triggers an asynchronous ownership check. 129 // Triggers an asynchronous ownership check.
126 void CheckOwnership(); 130 void CheckOwnership();
127 131
128 // Removes the user from the persistent list only. Also removes the user's 132 // Removes data stored or cached outside the user's cryptohome (wallpaper,
129 // picture. 133 // avatar, OAuth token status, display name, display email).
130 void RemoveUserFromListInternal(const std::string& email); 134 void RemoveNonCryptohomeData(const std::string& email);
131 135
132 // List of all known users. User instances are owned by |this| and deleted 136 // Removes a regular user from the user list. Returns the user if found or
133 // when users are removed by |RemoveUserFromListInternal|. 137 // NULL otherwise. Also removes the user from the persistent regular user
134 mutable UserList users_; 138 // list.
139 User *RemoveRegularUserFromList(const std::string& email);
140
141 // Replaces the list of public accounts with |public_accounts|. Ensures that
142 // data belonging to accounts no longer on the list is removed. Returns |true|
143 // if the list has changed.
144 // Public accounts are defined by policy. This method is called whenever an
145 // updated list of public accounts is received from policy.
146 bool UpdateAndCleanUpPublicAccounts(const base::ListValue& public_accounts);
147
148 // Interface to the signed settings store.
149 CrosSettings* cros_settings_;
150
151 // True if users have been loaded from prefs already.
152 bool users_loaded_;
153
154 // List of all known users. User instances are owned by |this|. Regular users
155 // are removed by |RemoveUserFromList|, public accounts by
156 // |UpdateAndCleanUpPublicAccounts|.
157 UserList users_;
135 158
136 // The logged-in user. NULL until a user has logged in, then points to one 159 // The logged-in user. NULL until a user has logged in, then points to one
137 // of the User instances in |users_|, the |guest_user_| instance or an 160 // of the User instances in |users_|, the |guest_user_| instance or an
138 // ephemeral user instance. 161 // ephemeral user instance.
139 User* logged_in_user_; 162 User* logged_in_user_;
140 163
141 // True if SessionStarted() has been called. 164 // True if SessionStarted() has been called.
142 bool session_started_; 165 bool session_started_;
143 166
144 // Cached flag of whether currently logged-in user is owner or not. 167 // Cached flag of whether currently logged-in user is owner or not.
(...skipping 24 matching lines...) Expand all
169 192
170 content::NotificationRegistrar registrar_; 193 content::NotificationRegistrar registrar_;
171 194
172 // Profile sync service which is observed to take actions after sync 195 // Profile sync service which is observed to take actions after sync
173 // errors appear. NOTE: there is no guarantee that it is the current sync 196 // errors appear. NOTE: there is no guarantee that it is the current sync
174 // service, so do NOT use it outside |OnStateChanged| method. 197 // service, so do NOT use it outside |OnStateChanged| method.
175 ProfileSyncService* observed_sync_service_; 198 ProfileSyncService* observed_sync_service_;
176 199
177 ObserverList<UserManager::Observer> observer_list_; 200 ObserverList<UserManager::Observer> observer_list_;
178 201
202 // User avatar manager.
179 scoped_ptr<UserImageManagerImpl> user_image_manager_; 203 scoped_ptr<UserImageManagerImpl> user_image_manager_;
180 204
181 DISALLOW_COPY_AND_ASSIGN(UserManagerImpl); 205 DISALLOW_COPY_AND_ASSIGN(UserManagerImpl);
182 }; 206 };
183 207
184 } // namespace chromeos 208 } // namespace chromeos
185 209
186 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_ 210 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_manager.h ('k') | chrome/browser/chromeos/login/user_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698