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 | 10 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 const User& logged_in_user() const { return *logged_in_user_; } | 76 const User& logged_in_user() const { return *logged_in_user_; } |
77 User& logged_in_user() { return *logged_in_user_; } | 77 User& logged_in_user() { return *logged_in_user_; } |
78 | 78 |
79 // Returns true if given display name is unique. | 79 // Returns true if given display name is unique. |
80 bool IsDisplayNameUnique(const std::string& display_name) const; | 80 bool IsDisplayNameUnique(const std::string& display_name) const; |
81 | 81 |
82 // Saves user's oauth token status in local state preferences. | 82 // Saves user's oauth token status in local state preferences. |
83 void SaveUserOAuthStatus(const std::string& username, | 83 void SaveUserOAuthStatus(const std::string& username, |
84 User::OAuthTokenStatus oauth_token_status); | 84 User::OAuthTokenStatus oauth_token_status); |
85 | 85 |
86 // Gets user's oauth token status in local state preferences. | 86 // Save user's displayed (non-canonical) email in local state preferences. |
87 User::OAuthTokenStatus GetUserOAuthStatus(const std::string& username) const; | 87 // Ignored If there is no such user. |
| 88 void SaveUserDisplayEmail(const std::string& username, |
| 89 const std::string& display_email); |
| 90 |
| 91 // Returns the display email for user |username| if it is known (was |
| 92 // previously set by a |SaveUserDisplayEmail| call). |
| 93 // Otherwise, returns |username| itself. |
| 94 std::string GetUserDisplayEmail(const std::string& username) const; |
88 | 95 |
89 // Sets user image to the default image with index |image_index|, sends | 96 // Sets user image to the default image with index |image_index|, sends |
90 // LOGIN_USER_IMAGE_CHANGED notification and updates Local State. | 97 // LOGIN_USER_IMAGE_CHANGED notification and updates Local State. |
91 void SaveUserDefaultImageIndex(const std::string& username, int image_index); | 98 void SaveUserDefaultImageIndex(const std::string& username, int image_index); |
92 | 99 |
93 // Saves image to file, sends LOGIN_USER_IMAGE_CHANGED notification and | 100 // Saves image to file, sends LOGIN_USER_IMAGE_CHANGED notification and |
94 // updates Local State. | 101 // updates Local State. |
95 void SaveUserImage(const std::string& username, const SkBitmap& image); | 102 void SaveUserImage(const std::string& username, const SkBitmap& image); |
96 | 103 |
97 // Tries to load user image from disk; if successful, sets it for the user, | 104 // Tries to load user image from disk; if successful, sets it for the user, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // Loads |users_| from Local State if the list has not been loaded yet. | 169 // Loads |users_| from Local State if the list has not been loaded yet. |
163 // Subsequent calls have no effect. Must be called on the UI thread. | 170 // Subsequent calls have no effect. Must be called on the UI thread. |
164 void EnsureUsersLoaded(); | 171 void EnsureUsersLoaded(); |
165 | 172 |
166 // Makes stub user the current logged-in user (for test paths). | 173 // Makes stub user the current logged-in user (for test paths). |
167 void StubUserLoggedIn(); | 174 void StubUserLoggedIn(); |
168 | 175 |
169 // Notifies on new user session. | 176 // Notifies on new user session. |
170 void NotifyOnLogin(); | 177 void NotifyOnLogin(); |
171 | 178 |
| 179 // Reads user's oauth token status from local state preferences. |
| 180 User::OAuthTokenStatus LoadUserOAuthStatus(const std::string& username) const; |
| 181 |
172 // Sets one of the default images for the specified user and saves this | 182 // Sets one of the default images for the specified user and saves this |
173 // setting in local state. | 183 // setting in local state. |
174 // Does not send LOGIN_USER_IMAGE_CHANGED notification. | 184 // Does not send LOGIN_USER_IMAGE_CHANGED notification. |
175 void SetInitialUserImage(const std::string& username); | 185 void SetInitialUserImage(const std::string& username); |
176 | 186 |
177 // Sets image for user |username| and sends LOGIN_USER_IMAGE_CHANGED | 187 // Sets image for user |username| and sends LOGIN_USER_IMAGE_CHANGED |
178 // notification unless this is a new user and image is set for the first time. | 188 // notification unless this is a new user and image is set for the first time. |
179 void SetUserImage(const std::string& username, | 189 void SetUserImage(const std::string& username, |
180 int image_index, | 190 int image_index, |
181 const SkBitmap& image); | 191 const SkBitmap& image); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 | 287 |
278 // Data URL for |downloaded_profile_image_|. | 288 // Data URL for |downloaded_profile_image_|. |
279 std::string downloaded_profile_image_data_url_; | 289 std::string downloaded_profile_image_data_url_; |
280 | 290 |
281 DISALLOW_COPY_AND_ASSIGN(UserManager); | 291 DISALLOW_COPY_AND_ASSIGN(UserManager); |
282 }; | 292 }; |
283 | 293 |
284 } // namespace chromeos | 294 } // namespace chromeos |
285 | 295 |
286 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ | 296 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ |
OLD | NEW |