Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 // this user from the other one with the same display name. | 46 // this user from the other one with the same display name. |
| 47 std::string GetNameTooltip() const; | 47 std::string GetNameTooltip() const; |
| 48 | 48 |
| 49 // Returns true if some users have same display name. | 49 // Returns true if some users have same display name. |
| 50 bool NeedsNameTooltip() const; | 50 bool NeedsNameTooltip() const; |
| 51 | 51 |
| 52 // The image for this user. | 52 // The image for this user. |
| 53 const SkBitmap& image() const { return image_; } | 53 const SkBitmap& image() const { return image_; } |
| 54 int image_index() const { return image_index_; } | 54 int image_index() const { return image_index_; } |
| 55 | 55 |
| 56 // True if user image is a stub (while real image is being loaded from file). | |
| 57 bool image_is_stub() const { return image_is_stub_; } | |
|
whywhat
2011/12/06 17:51:31
optional: rename method to is_image_downloading()?
Ivan Korotkov
2011/12/08 10:52:20
This isn't actually User's knowledge if image is d
| |
| 58 | |
| 56 // OAuth token status for this user. | 59 // OAuth token status for this user. |
| 57 OAuthTokenStatus oauth_token_status() const { return oauth_token_status_; } | 60 OAuthTokenStatus oauth_token_status() const { return oauth_token_status_; } |
| 58 | 61 |
| 59 // The displayed (non-canonical) user email. | 62 // The displayed (non-canonical) user email. |
| 60 std::string display_email() const { return display_email_; } | 63 std::string display_email() const { return display_email_; } |
| 61 | 64 |
| 62 private: | 65 private: |
| 63 friend class UserManager; | 66 friend class UserManager; |
| 64 | 67 |
| 65 // Do not allow anyone else to create new User instances. | 68 // Do not allow anyone else to create new User instances. |
| 66 explicit User(const std::string& email); | 69 explicit User(const std::string& email); |
| 67 ~User(); | 70 ~User(); |
| 68 | 71 |
| 69 // Setters are private so only UserManager can call them. | 72 // Setters are private so only UserManager can call them. |
| 70 void SetImage(const SkBitmap& image, int image_index); | 73 void SetImage(const SkBitmap& image, int image_index); |
| 74 // Sets a stub image until the next |SetImage| call. | |
| 75 void SetStubImage(int image_index); | |
|
whywhat
2011/12/06 17:51:31
Document what index is.
Ivan Korotkov
2011/12/08 10:52:20
Done.
| |
| 71 | 76 |
| 72 void set_oauth_token_status(OAuthTokenStatus status) { | 77 void set_oauth_token_status(OAuthTokenStatus status) { |
| 73 oauth_token_status_ = status; | 78 oauth_token_status_ = status; |
| 74 } | 79 } |
| 75 | 80 |
| 76 void set_display_email(const std::string& display_email) { | 81 void set_display_email(const std::string& display_email) { |
| 77 display_email_ = display_email; | 82 display_email_ = display_email; |
| 78 } | 83 } |
| 79 | 84 |
| 80 std::string email_; | 85 std::string email_; |
| 81 // The displayed user email, defaults to |email_|. | 86 // The displayed user email, defaults to |email_|. |
| 82 std::string display_email_; | 87 std::string display_email_; |
| 83 SkBitmap image_; | 88 SkBitmap image_; |
| 84 OAuthTokenStatus oauth_token_status_; | 89 OAuthTokenStatus oauth_token_status_; |
| 85 | 90 |
| 86 // Either index of a default image for the user, |kExternalImageIndex| or | 91 // Either index of a default image for the user, |kExternalImageIndex| or |
| 87 // |kProfileImageIndex|. | 92 // |kProfileImageIndex|. |
| 88 int image_index_; | 93 int image_index_; |
| 89 | 94 |
| 95 // This is true after a |SetStubImage| call and until a |SetImage| call. | |
|
whywhat
2011/12/06 17:51:31
nit: sounds kind of hacky, no? Could it be "True i
Ivan Korotkov
2011/12/08 10:52:20
Rephrased.
| |
| 96 bool image_is_stub_; | |
| 97 | |
| 90 DISALLOW_COPY_AND_ASSIGN(User); | 98 DISALLOW_COPY_AND_ASSIGN(User); |
| 91 }; | 99 }; |
| 92 | 100 |
| 93 // List of known users. | 101 // List of known users. |
| 94 typedef std::vector<User*> UserList; | 102 typedef std::vector<User*> UserList; |
| 95 | 103 |
| 96 } // namespace chromeos | 104 } // namespace chromeos |
| 97 | 105 |
| 98 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ | 106 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ |
| OLD | NEW |