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_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 // The displayed (non-canonical) user email. | 151 // The displayed (non-canonical) user email. |
152 virtual std::string display_email() const; | 152 virtual std::string display_email() const; |
153 | 153 |
154 // True if the user's session can be locked (i.e. the user has a password with | 154 // True if the user's session can be locked (i.e. the user has a password with |
155 // which to unlock the session). | 155 // which to unlock the session). |
156 virtual bool can_lock() const; | 156 virtual bool can_lock() const; |
157 | 157 |
158 virtual std::string username_hash() const; | 158 virtual std::string username_hash() const; |
159 | 159 |
| 160 // True if current user is logged in. |
| 161 virtual bool is_logged_in() const; |
| 162 |
| 163 // True if current user is active within the current session. |
| 164 virtual bool is_active() const; |
| 165 |
160 protected: | 166 protected: |
161 friend class UserManagerImpl; | 167 friend class UserManagerImpl; |
162 friend class UserImageManagerImpl; | 168 friend class UserImageManagerImpl; |
163 // For testing: | 169 // For testing: |
164 friend class MockUserManager; | 170 friend class MockUserManager; |
165 | 171 |
166 // Do not allow anyone else to create new User instances. | 172 // Do not allow anyone else to create new User instances. |
167 static User* CreateRegularUser(const std::string& email); | 173 static User* CreateRegularUser(const std::string& email); |
168 static User* CreateGuestUser(); | 174 static User* CreateGuestUser(); |
169 static User* CreateKioskAppUser(const std::string& kiosk_app_username); | 175 static User* CreateKioskAppUser(const std::string& kiosk_app_username); |
(...skipping 25 matching lines...) Expand all Loading... |
195 void set_display_email(const std::string& display_email) { | 201 void set_display_email(const std::string& display_email) { |
196 display_email_ = display_email; | 202 display_email_ = display_email; |
197 } | 203 } |
198 | 204 |
199 const UserImage& user_image() const { return user_image_; } | 205 const UserImage& user_image() const { return user_image_; } |
200 | 206 |
201 void set_username_hash(const std::string& username_hash) { | 207 void set_username_hash(const std::string& username_hash) { |
202 username_hash_ = username_hash; | 208 username_hash_ = username_hash; |
203 } | 209 } |
204 | 210 |
| 211 void set_is_logged_in(bool is_logged_in) { |
| 212 is_logged_in_ = is_logged_in; |
| 213 } |
| 214 |
| 215 void set_is_active(bool is_active) { |
| 216 is_active_ = is_active; |
| 217 } |
| 218 |
205 private: | 219 private: |
206 std::string email_; | 220 std::string email_; |
207 string16 display_name_; | 221 string16 display_name_; |
208 // The displayed user email, defaults to |email_|. | 222 // The displayed user email, defaults to |email_|. |
209 std::string display_email_; | 223 std::string display_email_; |
210 UserImage user_image_; | 224 UserImage user_image_; |
211 OAuthTokenStatus oauth_token_status_; | 225 OAuthTokenStatus oauth_token_status_; |
212 | 226 |
213 // Used to identify homedir mount point. | 227 // Used to identify homedir mount point. |
214 std::string username_hash_; | 228 std::string username_hash_; |
215 | 229 |
216 // Either index of a default image for the user, |kExternalImageIndex| or | 230 // Either index of a default image for the user, |kExternalImageIndex| or |
217 // |kProfileImageIndex|. | 231 // |kProfileImageIndex|. |
218 int image_index_; | 232 int image_index_; |
219 | 233 |
220 // True if current user image is a stub set by a |SetStubImage| call. | 234 // True if current user image is a stub set by a |SetStubImage| call. |
221 bool image_is_stub_; | 235 bool image_is_stub_; |
222 | 236 |
223 // True if current user image is being loaded from file. | 237 // True if current user image is being loaded from file. |
224 bool image_is_loading_; | 238 bool image_is_loading_; |
225 | 239 |
| 240 // True if user is currently logged in in current session. |
| 241 bool is_logged_in_; |
| 242 |
| 243 // True if user is currently logged in and active in current session. |
| 244 bool is_active_; |
| 245 |
226 DISALLOW_COPY_AND_ASSIGN(User); | 246 DISALLOW_COPY_AND_ASSIGN(User); |
227 }; | 247 }; |
228 | 248 |
229 // List of known users. | 249 // List of known users. |
230 typedef std::vector<User*> UserList; | 250 typedef std::vector<User*> UserList; |
231 | 251 |
232 } // namespace chromeos | 252 } // namespace chromeos |
233 | 253 |
234 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ | 254 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ |
OLD | NEW |