| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // Reads user's oauth token status from local state preferences. | 179 // Reads user's oauth token status from local state preferences. |
| 180 User::OAuthTokenStatus LoadUserOAuthStatus(const std::string& username) const; | 180 User::OAuthTokenStatus LoadUserOAuthStatus(const std::string& username) const; |
| 181 | 181 |
| 182 // 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 |
| 183 // setting in local state. | 183 // setting in local state. |
| 184 // Does not send LOGIN_USER_IMAGE_CHANGED notification. | 184 // Does not send LOGIN_USER_IMAGE_CHANGED notification. |
| 185 void SetInitialUserImage(const std::string& username); | 185 void SetInitialUserImage(const std::string& username); |
| 186 | 186 |
| 187 // Sets image for user |username| and sends LOGIN_USER_IMAGE_CHANGED | 187 // Sets image for user |username| and sends LOGIN_USER_IMAGE_CHANGED |
| 188 // 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. |
| 189 // If |image| is empty, sets a stub image for the user. |
| 189 void SetUserImage(const std::string& username, | 190 void SetUserImage(const std::string& username, |
| 190 int image_index, | 191 int image_index, |
| 191 const SkBitmap& image); | 192 const SkBitmap& image); |
| 192 | 193 |
| 193 // Saves image to file, updates local state preferences to given image index | 194 // Saves image to file, updates local state preferences to given image index |
| 194 // and sends LOGIN_USER_IMAGE_CHANGED notification. | 195 // and sends LOGIN_USER_IMAGE_CHANGED notification. |
| 195 void SaveUserImageInternal(const std::string& username, | 196 void SaveUserImageInternal(const std::string& username, |
| 196 int image_index, | 197 int image_index, |
| 197 const SkBitmap& image); | 198 const SkBitmap& image); |
| 198 | 199 |
| 199 // Saves image to file with specified path and sends LOGIN_USER_IMAGE_CHANGED | 200 // Saves image to file with specified path and sends LOGIN_USER_IMAGE_CHANGED |
| 200 // notification. Runs on FILE thread. Posts task for saving image info to | 201 // notification. Runs on FILE thread. Posts task for saving image info to |
| 201 // Local State on UI thread. | 202 // Local State on UI thread. |
| 202 void SaveImageToFile(const std::string& username, | 203 void SaveImageToFile(const std::string& username, |
| 203 const SkBitmap& image, | 204 const SkBitmap& image, |
| 204 const FilePath& image_path, | 205 const FilePath& image_path, |
| 205 int image_index); | 206 int image_index); |
| 206 | 207 |
| 207 // Stores path to the image and its index in local state. Runs on UI thread. | 208 // Stores path to the image and its index in local state. Runs on UI thread. |
| 208 // If |is_async| is true, it has been posted from the FILE thread after | 209 // If |is_async| is true, it has been posted from the FILE thread after |
| 209 // saving the image. | 210 // saving the image. |
| 210 void SaveImageToLocalState(const std::string& username, | 211 void SaveImageToLocalState(const std::string& username, |
| 211 const std::string& image_path, | 212 const std::string& image_path, |
| 212 int image_index, | 213 int image_index, |
| 213 bool is_async); | 214 bool is_async); |
| 214 | 215 |
| 216 // Initializes |downloaded_profile_picture_| with the picture of the logged-in |
| 217 // user. |
| 218 void InitDownloadedProfileImage(); |
| 219 |
| 215 // Deletes user's image file. Runs on FILE thread. | 220 // Deletes user's image file. Runs on FILE thread. |
| 216 void DeleteUserImage(const FilePath& image_path); | 221 void DeleteUserImage(const FilePath& image_path); |
| 217 | 222 |
| 218 // Updates current user ownership on UI thread. | 223 // Updates current user ownership on UI thread. |
| 219 void UpdateOwnership(bool is_owner); | 224 void UpdateOwnership(bool is_owner); |
| 220 | 225 |
| 221 // Checks current user's ownership on file thread. | 226 // Checks current user's ownership on file thread. |
| 222 void CheckOwnership(); | 227 void CheckOwnership(); |
| 223 | 228 |
| 224 // ProfileDownloaderDelegate implementation. | 229 // ProfileDownloaderDelegate implementation. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 | 292 |
| 288 // Data URL for |downloaded_profile_image_|. | 293 // Data URL for |downloaded_profile_image_|. |
| 289 std::string downloaded_profile_image_data_url_; | 294 std::string downloaded_profile_image_data_url_; |
| 290 | 295 |
| 291 DISALLOW_COPY_AND_ASSIGN(UserManager); | 296 DISALLOW_COPY_AND_ASSIGN(UserManager); |
| 292 }; | 297 }; |
| 293 | 298 |
| 294 } // namespace chromeos | 299 } // namespace chromeos |
| 295 | 300 |
| 296 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ | 301 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ |
| OLD | NEW |