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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 WALLPAPER_TYPE_COUNT = 5 | 99 WALLPAPER_TYPE_COUNT = 5 |
100 }; | 100 }; |
101 | 101 |
102 // Returns the user type. | 102 // Returns the user type. |
103 virtual UserType GetType() const = 0; | 103 virtual UserType GetType() const = 0; |
104 | 104 |
105 // The email the user used to log in. | 105 // The email the user used to log in. |
106 const std::string& email() const { return email_; } | 106 const std::string& email() const { return email_; } |
107 | 107 |
108 // Returns the human name to display for this user. | 108 // Returns the human name to display for this user. |
109 string16 GetDisplayName() const; | 109 base::string16 GetDisplayName() const; |
110 | 110 |
111 // Returns given name of user, or empty string if given name is unknown. | 111 // Returns given name of user, or empty string if given name is unknown. |
112 const string16& given_name() const { return given_name_; } | 112 const base::string16& given_name() const { return given_name_; } |
113 | 113 |
114 // Returns the account name part of the email. Use the display form of the | 114 // Returns the account name part of the email. Use the display form of the |
115 // email if available and use_display_name == true. Otherwise use canonical. | 115 // email if available and use_display_name == true. Otherwise use canonical. |
116 std::string GetAccountName(bool use_display_email) const; | 116 std::string GetAccountName(bool use_display_email) const; |
117 | 117 |
118 // The image for this user. | 118 // The image for this user. |
119 const gfx::ImageSkia& image() const { return user_image_.image(); } | 119 const gfx::ImageSkia& image() const { return user_image_.image(); } |
120 | 120 |
121 // Whether the user has a default image. | 121 // Whether the user has a default image. |
122 bool HasDefaultImage() const; | 122 bool HasDefaultImage() const; |
(...skipping 24 matching lines...) Expand all Loading... |
147 // True if user image is a stub (while real image is being loaded from file). | 147 // True if user image is a stub (while real image is being loaded from file). |
148 bool image_is_stub() const { return image_is_stub_; } | 148 bool image_is_stub() const { return image_is_stub_; } |
149 | 149 |
150 // True if image is being loaded from file. | 150 // True if image is being loaded from file. |
151 bool image_is_loading() const { return image_is_loading_; } | 151 bool image_is_loading() const { return image_is_loading_; } |
152 | 152 |
153 // OAuth token status for this user. | 153 // OAuth token status for this user. |
154 OAuthTokenStatus oauth_token_status() const { return oauth_token_status_; } | 154 OAuthTokenStatus oauth_token_status() const { return oauth_token_status_; } |
155 | 155 |
156 // The displayed user name. | 156 // The displayed user name. |
157 string16 display_name() const { return display_name_; } | 157 base::string16 display_name() const { return display_name_; } |
158 | 158 |
159 // The displayed (non-canonical) user email. | 159 // The displayed (non-canonical) user email. |
160 virtual std::string display_email() const; | 160 virtual std::string display_email() const; |
161 | 161 |
162 // True if the user's session can be locked (i.e. the user has a password with | 162 // True if the user's session can be locked (i.e. the user has a password with |
163 // which to unlock the session). | 163 // which to unlock the session). |
164 virtual bool can_lock() const; | 164 virtual bool can_lock() const; |
165 | 165 |
166 virtual std::string username_hash() const; | 166 virtual std::string username_hash() const; |
167 | 167 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 207 |
208 // Sets a stub image until the next |SetImage| call. |image_index| may be | 208 // Sets a stub image until the next |SetImage| call. |image_index| may be |
209 // one of |kExternalImageIndex| or |kProfileImageIndex|. | 209 // one of |kExternalImageIndex| or |kProfileImageIndex|. |
210 // If |is_loading| is |true|, that means user image is being loaded from file. | 210 // If |is_loading| is |true|, that means user image is being loaded from file. |
211 void SetStubImage(int image_index, bool is_loading); | 211 void SetStubImage(int image_index, bool is_loading); |
212 | 212 |
213 void set_oauth_token_status(OAuthTokenStatus status) { | 213 void set_oauth_token_status(OAuthTokenStatus status) { |
214 oauth_token_status_ = status; | 214 oauth_token_status_ = status; |
215 } | 215 } |
216 | 216 |
217 void set_display_name(const string16& display_name) { | 217 void set_display_name(const base::string16& display_name) { |
218 display_name_ = display_name; | 218 display_name_ = display_name; |
219 } | 219 } |
220 | 220 |
221 void set_given_name(const string16& given_name) { given_name_ = given_name; } | 221 void set_given_name(const base::string16& given_name) { given_name_ = given_na
me; } |
222 | 222 |
223 void set_display_email(const std::string& display_email) { | 223 void set_display_email(const std::string& display_email) { |
224 display_email_ = display_email; | 224 display_email_ = display_email; |
225 } | 225 } |
226 | 226 |
227 const UserImage& user_image() const { return user_image_; } | 227 const UserImage& user_image() const { return user_image_; } |
228 | 228 |
229 void set_username_hash(const std::string& username_hash) { | 229 void set_username_hash(const std::string& username_hash) { |
230 username_hash_ = username_hash; | 230 username_hash_ = username_hash; |
231 } | 231 } |
232 | 232 |
233 void set_is_logged_in(bool is_logged_in) { | 233 void set_is_logged_in(bool is_logged_in) { |
234 is_logged_in_ = is_logged_in; | 234 is_logged_in_ = is_logged_in; |
235 } | 235 } |
236 | 236 |
237 void set_is_active(bool is_active) { | 237 void set_is_active(bool is_active) { |
238 is_active_ = is_active; | 238 is_active_ = is_active; |
239 } | 239 } |
240 | 240 |
241 void set_profile_is_created() { | 241 void set_profile_is_created() { |
242 profile_is_created_ = true; | 242 profile_is_created_ = true; |
243 } | 243 } |
244 | 244 |
245 // True if user has google account (not a guest or managed user). | 245 // True if user has google account (not a guest or managed user). |
246 bool has_gaia_account() const; | 246 bool has_gaia_account() const; |
247 | 247 |
248 private: | 248 private: |
249 std::string email_; | 249 std::string email_; |
250 string16 display_name_; | 250 base::string16 display_name_; |
251 string16 given_name_; | 251 base::string16 given_name_; |
252 // The displayed user email, defaults to |email_|. | 252 // The displayed user email, defaults to |email_|. |
253 std::string display_email_; | 253 std::string display_email_; |
254 UserImage user_image_; | 254 UserImage user_image_; |
255 OAuthTokenStatus oauth_token_status_; | 255 OAuthTokenStatus oauth_token_status_; |
256 | 256 |
257 // This is set to chromeos locale if account data has been downloaded. | 257 // This is set to chromeos locale if account data has been downloaded. |
258 // (Or failed to download, but at least one download attempt finished). | 258 // (Or failed to download, but at least one download attempt finished). |
259 // An empty string indicates error in data load, or in | 259 // An empty string indicates error in data load, or in |
260 // translation of Account locale to chromeos locale. | 260 // translation of Account locale to chromeos locale. |
261 scoped_ptr<std::string> account_locale_; | 261 scoped_ptr<std::string> account_locale_; |
(...skipping 22 matching lines...) Expand all Loading... |
284 | 284 |
285 DISALLOW_COPY_AND_ASSIGN(User); | 285 DISALLOW_COPY_AND_ASSIGN(User); |
286 }; | 286 }; |
287 | 287 |
288 // List of known users. | 288 // List of known users. |
289 typedef std::vector<User*> UserList; | 289 typedef std::vector<User*> UserList; |
290 | 290 |
291 } // namespace chromeos | 291 } // namespace chromeos |
292 | 292 |
293 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ | 293 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ |
OLD | NEW |