| OLD | NEW |
| 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_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 virtual void Shutdown() = 0; | 88 virtual void Shutdown() = 0; |
| 89 | 89 |
| 90 virtual ~UserManager(); | 90 virtual ~UserManager(); |
| 91 | 91 |
| 92 virtual UserImageManager* GetUserImageManager() = 0; | 92 virtual UserImageManager* GetUserImageManager() = 0; |
| 93 | 93 |
| 94 // Returns a list of users who have logged into this device previously. This | 94 // Returns a list of users who have logged into this device previously. This |
| 95 // is sorted by last login date with the most recent user at the beginning. | 95 // is sorted by last login date with the most recent user at the beginning. |
| 96 virtual const UserList& GetUsers() const = 0; | 96 virtual const UserList& GetUsers() const = 0; |
| 97 | 97 |
| 98 // Returns a list of users who are currently logged in. |
| 99 virtual const UserList& GetLoggedInUsers() const = 0; |
| 100 |
| 98 // Indicates that a user with the given |email| has just logged in. The | 101 // Indicates that a user with the given |email| has just logged in. The |
| 99 // persistent list is updated accordingly if the user is not ephemeral. | 102 // persistent list is updated accordingly if the user is not ephemeral. |
| 100 // |browser_restart| is true when reloading Chrome after crash to distinguish | 103 // |browser_restart| is true when reloading Chrome after crash to distinguish |
| 101 // from normal sign in flow. | 104 // from normal sign in flow. |
| 102 // |username_hash| is used to identify homedir mount point. | 105 // |username_hash| is used to identify homedir mount point. |
| 103 virtual void UserLoggedIn(const std::string& email, | 106 virtual void UserLoggedIn(const std::string& email, |
| 104 const std::string& username_hash, | 107 const std::string& username_hash, |
| 105 bool browser_restart) = 0; | 108 bool browser_restart) = 0; |
| 106 | 109 |
| 110 // Switches to active user identified by |email|. User has to be logged in. |
| 111 virtual void SwitchActiveUser(const std::string& email) = 0; |
| 112 |
| 107 // Indicates that user just logged on as the retail mode user. | 113 // Indicates that user just logged on as the retail mode user. |
| 108 virtual void RetailModeUserLoggedIn() = 0; | 114 virtual void RetailModeUserLoggedIn() = 0; |
| 109 | 115 |
| 110 // Indicates that user just started incognito session. | 116 // Indicates that user just started incognito session. |
| 111 virtual void GuestUserLoggedIn() = 0; | 117 virtual void GuestUserLoggedIn() = 0; |
| 112 | 118 |
| 113 // Indicates that a kiosk app robot just logged in. | 119 // Indicates that a kiosk app robot just logged in. |
| 114 virtual void KioskAppLoggedIn(const std::string& app_id) = 0; | 120 virtual void KioskAppLoggedIn(const std::string& app_id) = 0; |
| 115 | 121 |
| 116 // Indicates that a locally managed user just logged in. | 122 // Indicates that a locally managed user just logged in. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // Returns the user with the given email address if found in the persistent | 167 // Returns the user with the given email address if found in the persistent |
| 162 // list or currently logged in as ephemeral. Returns |NULL| otherwise. | 168 // list or currently logged in as ephemeral. Returns |NULL| otherwise. |
| 163 virtual const User* FindUser(const std::string& email) const = 0; | 169 virtual const User* FindUser(const std::string& email) const = 0; |
| 164 | 170 |
| 165 // Returns the locally managed user with the given |display_name| if found in | 171 // Returns the locally managed user with the given |display_name| if found in |
| 166 // the persistent list. Returns |NULL| otherwise. | 172 // the persistent list. Returns |NULL| otherwise. |
| 167 virtual const User* FindLocallyManagedUser( | 173 virtual const User* FindLocallyManagedUser( |
| 168 const string16& display_name) const = 0; | 174 const string16& display_name) const = 0; |
| 169 | 175 |
| 170 // Returns the logged-in user. | 176 // Returns the logged-in user. |
| 177 // TODO(nkostylev): Deprecate this call, move clients to GetActiveUser(). |
| 171 virtual const User* GetLoggedInUser() const = 0; | 178 virtual const User* GetLoggedInUser() const = 0; |
| 172 virtual User* GetLoggedInUser() = 0; | 179 virtual User* GetLoggedInUser() = 0; |
| 173 | 180 |
| 181 // Returns the logged-in user that is currently active within this session. |
| 182 // There could be multiple users logged in at the the same but for now |
| 183 // we support only one of them being active. |
| 184 virtual const User* GetActiveUser() const = 0; |
| 185 virtual User* GetActiveUser() = 0; |
| 186 |
| 174 // Saves user's oauth token status in local state preferences. | 187 // Saves user's oauth token status in local state preferences. |
| 175 virtual void SaveUserOAuthStatus( | 188 virtual void SaveUserOAuthStatus( |
| 176 const std::string& username, | 189 const std::string& username, |
| 177 User::OAuthTokenStatus oauth_token_status) = 0; | 190 User::OAuthTokenStatus oauth_token_status) = 0; |
| 178 | 191 |
| 179 // Saves user's displayed name in local state preferences. | 192 // Saves user's displayed name in local state preferences. |
| 180 // Ignored If there is no such user. | 193 // Ignored If there is no such user. |
| 181 virtual void SaveUserDisplayName(const std::string& username, | 194 virtual void SaveUserDisplayName(const std::string& username, |
| 182 const string16& display_name) = 0; | 195 const string16& display_name) = 0; |
| 183 | 196 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 206 | 219 |
| 207 // Returns true if data stored or cached for the current user outside that | 220 // Returns true if data stored or cached for the current user outside that |
| 208 // user's cryptohome (wallpaper, avatar, OAuth token status, display name, | 221 // user's cryptohome (wallpaper, avatar, OAuth token status, display name, |
| 209 // display email) is ephemeral. | 222 // display email) is ephemeral. |
| 210 virtual bool IsCurrentUserNonCryptohomeDataEphemeral() const = 0; | 223 virtual bool IsCurrentUserNonCryptohomeDataEphemeral() const = 0; |
| 211 | 224 |
| 212 // Returns true if the current user's session can be locked (i.e. the user has | 225 // Returns true if the current user's session can be locked (i.e. the user has |
| 213 // a password with which to unlock the session). | 226 // a password with which to unlock the session). |
| 214 virtual bool CanCurrentUserLock() const = 0; | 227 virtual bool CanCurrentUserLock() const = 0; |
| 215 | 228 |
| 216 // Returns true if user is signed in. | 229 // Returns true if at least one user has signed in. |
| 217 virtual bool IsUserLoggedIn() const = 0; | 230 virtual bool IsUserLoggedIn() const = 0; |
| 218 | 231 |
| 219 // Returns true if we're logged in as a regular user. | 232 // Returns true if we're logged in as a regular user. |
| 220 virtual bool IsLoggedInAsRegularUser() const = 0; | 233 virtual bool IsLoggedInAsRegularUser() const = 0; |
| 221 | 234 |
| 222 // Returns true if we're logged in as a demo user. | 235 // Returns true if we're logged in as a demo user. |
| 223 virtual bool IsLoggedInAsDemoUser() const = 0; | 236 virtual bool IsLoggedInAsDemoUser() const = 0; |
| 224 | 237 |
| 225 // Returns true if we're logged in as a public account. | 238 // Returns true if we're logged in as a public account. |
| 226 virtual bool IsLoggedInAsPublicAccount() const = 0; | 239 virtual bool IsLoggedInAsPublicAccount() const = 0; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 312 |
| 300 virtual void AddObserver(Observer* obs) = 0; | 313 virtual void AddObserver(Observer* obs) = 0; |
| 301 virtual void RemoveObserver(Observer* obs) = 0; | 314 virtual void RemoveObserver(Observer* obs) = 0; |
| 302 | 315 |
| 303 virtual void NotifyLocalStateChanged() = 0; | 316 virtual void NotifyLocalStateChanged() = 0; |
| 304 }; | 317 }; |
| 305 | 318 |
| 306 } // namespace chromeos | 319 } // namespace chromeos |
| 307 | 320 |
| 308 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ | 321 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ |
| OLD | NEW |