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_; } |
| 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. |image_index| may be |
| 75 // one of |kExternalImageIndex| or |kProfileImageIndex|. |
| 76 void SetStubImage(int image_index); |
71 | 77 |
72 void set_oauth_token_status(OAuthTokenStatus status) { | 78 void set_oauth_token_status(OAuthTokenStatus status) { |
73 oauth_token_status_ = status; | 79 oauth_token_status_ = status; |
74 } | 80 } |
75 | 81 |
76 void set_display_email(const std::string& display_email) { | 82 void set_display_email(const std::string& display_email) { |
77 display_email_ = display_email; | 83 display_email_ = display_email; |
78 } | 84 } |
79 | 85 |
80 std::string email_; | 86 std::string email_; |
81 // The displayed user email, defaults to |email_|. | 87 // The displayed user email, defaults to |email_|. |
82 std::string display_email_; | 88 std::string display_email_; |
83 SkBitmap image_; | 89 SkBitmap image_; |
84 OAuthTokenStatus oauth_token_status_; | 90 OAuthTokenStatus oauth_token_status_; |
85 | 91 |
86 // Either index of a default image for the user, |kExternalImageIndex| or | 92 // Either index of a default image for the user, |kExternalImageIndex| or |
87 // |kProfileImageIndex|. | 93 // |kProfileImageIndex|. |
88 int image_index_; | 94 int image_index_; |
89 | 95 |
| 96 // True if current user image is a stub set by a |SetStubImage| call. |
| 97 bool image_is_stub_; |
| 98 |
90 DISALLOW_COPY_AND_ASSIGN(User); | 99 DISALLOW_COPY_AND_ASSIGN(User); |
91 }; | 100 }; |
92 | 101 |
93 // List of known users. | 102 // List of known users. |
94 typedef std::vector<User*> UserList; | 103 typedef std::vector<User*> UserList; |
95 | 104 |
96 } // namespace chromeos | 105 } // namespace chromeos |
97 | 106 |
98 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ | 107 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ |
OLD | NEW |