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_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 std::string GetDisplayName() const; | 55 std::string GetDisplayName() const; |
56 | 56 |
57 // Tooltip contains user's display name and his email domain to distinguish | 57 // Tooltip contains user's display name and his email domain to distinguish |
58 // this user from the other one with the same display name. | 58 // this user from the other one with the same display name. |
59 std::string GetNameTooltip() const; | 59 std::string GetNameTooltip() const; |
60 | 60 |
61 // Returns true if some users have same display name. | 61 // Returns true if some users have same display name. |
62 bool NeedsNameTooltip() const; | 62 bool NeedsNameTooltip() const; |
63 | 63 |
64 // The image for this user. | 64 // The image for this user. |
65 void set_image(const SkBitmap& image) { image_ = image; } | 65 void SetImage(const SkBitmap& image, |
| 66 int default_image_index); |
66 const SkBitmap& image() const { return image_; } | 67 const SkBitmap& image() const { return image_; } |
| 68 int default_image_index() const { return default_image_index_; } |
67 | 69 |
68 // OAuth token status for this user. | 70 // OAuth token status for this user. |
69 OAuthTokenStatus oauth_token_status() const { return oauth_token_status_; } | 71 OAuthTokenStatus oauth_token_status() const { return oauth_token_status_; } |
70 void set_oauth_token_status(OAuthTokenStatus status) { | 72 void set_oauth_token_status(OAuthTokenStatus status) { |
71 oauth_token_status_ = status; | 73 oauth_token_status_ = status; |
72 } | 74 } |
73 | 75 |
74 private: | 76 private: |
75 friend class UserManager; | 77 friend class UserManager; |
76 | 78 |
77 std::string email_; | 79 std::string email_; |
78 SkBitmap image_; | 80 SkBitmap image_; |
79 OAuthTokenStatus oauth_token_status_; | 81 OAuthTokenStatus oauth_token_status_; |
80 | 82 |
81 // Cached flag of whether any users has same display name. | 83 // Cached flag of whether any users has same display name. |
82 bool is_displayname_unique_; | 84 bool is_displayname_unique_; |
| 85 |
| 86 // Index of the default image the user has set. -1 if it's some other |
| 87 // image. |
| 88 int default_image_index_; |
83 }; | 89 }; |
84 | 90 |
85 // Gets a shared instance of a UserManager. Not thread-safe...should | 91 // Gets a shared instance of a UserManager. Not thread-safe...should |
86 // only be called from the main UI thread. | 92 // only be called from the main UI thread. |
87 static UserManager* Get(); | 93 static UserManager* Get(); |
88 | 94 |
89 // Registers user manager preferences. | 95 // Registers user manager preferences. |
90 static void RegisterPrefs(PrefService* local_state); | 96 static void RegisterPrefs(PrefService* local_state); |
91 | 97 |
92 // Returns a list of the users who have logged into this device previously. | 98 // Returns a list of the users who have logged into this device previously. |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 ObserverList<Observer> observer_list_; | 229 ObserverList<Observer> observer_list_; |
224 | 230 |
225 DISALLOW_COPY_AND_ASSIGN(UserManager); | 231 DISALLOW_COPY_AND_ASSIGN(UserManager); |
226 }; | 232 }; |
227 | 233 |
228 typedef std::vector<UserManager::User> UserVector; | 234 typedef std::vector<UserManager::User> UserVector; |
229 | 235 |
230 } // namespace chromeos | 236 } // namespace chromeos |
231 | 237 |
232 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ | 238 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ |
OLD | NEW |