Chromium Code Reviews| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 static User* CreateRegularUser(const std::string& email); | 169 static User* CreateRegularUser(const std::string& email); |
| 170 static User* CreateGuestUser(); | 170 static User* CreateGuestUser(); |
| 171 static User* CreateKioskAppUser(const std::string& kiosk_app_username); | 171 static User* CreateKioskAppUser(const std::string& kiosk_app_username); |
| 172 static User* CreateLocallyManagedUser(const std::string& username); | 172 static User* CreateLocallyManagedUser(const std::string& username); |
| 173 static User* CreateRetailModeUser(); | 173 static User* CreateRetailModeUser(); |
| 174 static User* CreatePublicAccountUser(const std::string& email); | 174 static User* CreatePublicAccountUser(const std::string& email); |
| 175 | 175 |
| 176 explicit User(const std::string& email); | 176 explicit User(const std::string& email); |
| 177 virtual ~User(); | 177 virtual ~User(); |
| 178 | 178 |
| 179 // Used only by UserManagerImpl | |
|
Dmitry Polukhin
2013/09/06 20:30:05
Do we need such comment? It will be outdated very
Alexander Alekseev
2013/09/11 18:53:02
Done.
| |
| 180 bool is_profile_created() const { | |
| 181 return profile_is_created_; | |
| 182 } | |
| 183 | |
| 184 const std::string* GetAccountLocale() const { | |
| 185 return account_locale_.get(); | |
| 186 } | |
| 187 | |
| 179 // Setters are private so only UserManager can call them. | 188 // Setters are private so only UserManager can call them. |
| 189 void SetAccountLocale(const std::string& raw_account_locale); | |
| 190 | |
| 180 void SetImage(const UserImage& user_image, int image_index); | 191 void SetImage(const UserImage& user_image, int image_index); |
| 181 | 192 |
| 182 void SetImageURL(const GURL& image_url); | 193 void SetImageURL(const GURL& image_url); |
| 183 | 194 |
| 184 // Sets a stub image until the next |SetImage| call. |image_index| may be | 195 // Sets a stub image until the next |SetImage| call. |image_index| may be |
| 185 // one of |kExternalImageIndex| or |kProfileImageIndex|. | 196 // one of |kExternalImageIndex| or |kProfileImageIndex|. |
| 186 // If |is_loading| is |true|, that means user image is being loaded from file. | 197 // If |is_loading| is |true|, that means user image is being loaded from file. |
| 187 void SetStubImage(int image_index, bool is_loading); | 198 void SetStubImage(int image_index, bool is_loading); |
| 188 | 199 |
| 189 void set_oauth_token_status(OAuthTokenStatus status) { | 200 void set_oauth_token_status(OAuthTokenStatus status) { |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 205 } | 216 } |
| 206 | 217 |
| 207 void set_is_logged_in(bool is_logged_in) { | 218 void set_is_logged_in(bool is_logged_in) { |
| 208 is_logged_in_ = is_logged_in; | 219 is_logged_in_ = is_logged_in; |
| 209 } | 220 } |
| 210 | 221 |
| 211 void set_is_active(bool is_active) { | 222 void set_is_active(bool is_active) { |
| 212 is_active_ = is_active; | 223 is_active_ = is_active; |
| 213 } | 224 } |
| 214 | 225 |
| 226 void set_profile_is_created() { | |
| 227 profile_is_created_ = true; | |
| 228 } | |
| 229 | |
| 230 // True if user has google account (not a guest or managed user). | |
| 231 bool has_account() const; | |
|
Dmitry Polukhin
2013/09/06 20:30:05
I would call it has_gaia_account to make it clear
Alexander Alekseev
2013/09/11 18:53:02
Done.
| |
| 232 | |
| 215 private: | 233 private: |
| 216 std::string email_; | 234 std::string email_; |
| 217 string16 display_name_; | 235 string16 display_name_; |
| 218 // The displayed user email, defaults to |email_|. | 236 // The displayed user email, defaults to |email_|. |
| 219 std::string display_email_; | 237 std::string display_email_; |
| 220 UserImage user_image_; | 238 UserImage user_image_; |
| 221 OAuthTokenStatus oauth_token_status_; | 239 OAuthTokenStatus oauth_token_status_; |
| 222 | 240 |
| 241 // This is set to chromeos locale if account data has been downloaded. | |
| 242 // (Or failed to download, but at least one download attempt finished). | |
| 243 // An empty string indicates error in data load, or in | |
| 244 // translation of Account locale to chromeos locale. | |
| 245 scoped_ptr<std::string> account_locale_; | |
| 246 | |
| 223 // Used to identify homedir mount point. | 247 // Used to identify homedir mount point. |
| 224 std::string username_hash_; | 248 std::string username_hash_; |
| 225 | 249 |
| 226 // Either index of a default image for the user, |kExternalImageIndex| or | 250 // Either index of a default image for the user, |kExternalImageIndex| or |
| 227 // |kProfileImageIndex|. | 251 // |kProfileImageIndex|. |
| 228 int image_index_; | 252 int image_index_; |
| 229 | 253 |
| 230 // True if current user image is a stub set by a |SetStubImage| call. | 254 // True if current user image is a stub set by a |SetStubImage| call. |
| 231 bool image_is_stub_; | 255 bool image_is_stub_; |
| 232 | 256 |
| 233 // True if current user image is being loaded from file. | 257 // True if current user image is being loaded from file. |
| 234 bool image_is_loading_; | 258 bool image_is_loading_; |
| 235 | 259 |
| 236 // True if user is currently logged in in current session. | 260 // True if user is currently logged in in current session. |
| 237 bool is_logged_in_; | 261 bool is_logged_in_; |
| 238 | 262 |
| 239 // True if user is currently logged in and active in current session. | 263 // True if user is currently logged in and active in current session. |
| 240 bool is_active_; | 264 bool is_active_; |
| 241 | 265 |
| 266 // True if user Profile is created | |
| 267 bool profile_is_created_; | |
| 268 | |
| 242 DISALLOW_COPY_AND_ASSIGN(User); | 269 DISALLOW_COPY_AND_ASSIGN(User); |
| 243 }; | 270 }; |
| 244 | 271 |
| 245 // List of known users. | 272 // List of known users. |
| 246 typedef std::vector<User*> UserList; | 273 typedef std::vector<User*> UserList; |
| 247 | 274 |
| 248 } // namespace chromeos | 275 } // namespace chromeos |
| 249 | 276 |
| 250 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ | 277 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ |
| OLD | NEW |