Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Side by Side Diff: chrome/browser/chromeos/login/user_manager_impl.h

Issue 10454044: Added support for animated/nonanimated user image. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_IMPL_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 14 matching lines...) Expand all
25 25
26 class SkBitmap; 26 class SkBitmap;
27 class FilePath; 27 class FilePath;
28 class PrefService; 28 class PrefService;
29 class ProfileDownloader; 29 class ProfileDownloader;
30 class ProfileSyncService; 30 class ProfileSyncService;
31 31
32 namespace chromeos { 32 namespace chromeos {
33 33
34 class RemoveUserDelegate; 34 class RemoveUserDelegate;
35 class UserImage;
35 36
36 // Implementation of the UserManager. 37 // Implementation of the UserManager.
37 class UserManagerImpl : public UserManager, 38 class UserManagerImpl : public UserManager,
38 public ProfileDownloaderDelegate, 39 public ProfileDownloaderDelegate,
39 public ProfileSyncServiceObserver, 40 public ProfileSyncServiceObserver,
40 public content::NotificationObserver { 41 public content::NotificationObserver {
41 public: 42 public:
42 // UserManager implementation: 43 // UserManager implementation:
43 virtual ~UserManagerImpl(); 44 virtual ~UserManagerImpl();
44 45
(...skipping 21 matching lines...) Expand all
66 virtual std::string GetUserDisplayEmail( 67 virtual std::string GetUserDisplayEmail(
67 const std::string& username) const OVERRIDE; 68 const std::string& username) const OVERRIDE;
68 virtual int GetLoggedInUserWallpaperIndex() OVERRIDE; 69 virtual int GetLoggedInUserWallpaperIndex() OVERRIDE;
69 virtual void GetLoggedInUserWallpaperProperties(User::WallpaperType* type, 70 virtual void GetLoggedInUserWallpaperProperties(User::WallpaperType* type,
70 int* index) OVERRIDE; 71 int* index) OVERRIDE;
71 virtual void SaveLoggedInUserWallpaperProperties(User::WallpaperType type, 72 virtual void SaveLoggedInUserWallpaperProperties(User::WallpaperType type,
72 int index) OVERRIDE; 73 int index) OVERRIDE;
73 virtual void SaveUserDefaultImageIndex(const std::string& username, 74 virtual void SaveUserDefaultImageIndex(const std::string& username,
74 int image_index) OVERRIDE; 75 int image_index) OVERRIDE;
75 virtual void SaveUserImage(const std::string& username, 76 virtual void SaveUserImage(const std::string& username,
76 const SkBitmap& image) OVERRIDE; 77 const UserImage& user_image) OVERRIDE;
77 virtual void SetLoggedInUserCustomWallpaperLayout( 78 virtual void SetLoggedInUserCustomWallpaperLayout(
78 ash::WallpaperLayout layout) OVERRIDE; 79 ash::WallpaperLayout layout) OVERRIDE;
79 virtual void SaveUserImageFromFile(const std::string& username, 80 virtual void SaveUserImageFromFile(const std::string& username,
80 const FilePath& path) OVERRIDE; 81 const FilePath& path) OVERRIDE;
81 virtual void SaveUserWallpaperFromFile(const std::string& username, 82 virtual void SaveUserWallpaperFromFile(const std::string& username,
82 const FilePath& path, 83 const FilePath& path,
83 ash::WallpaperLayout layout, 84 ash::WallpaperLayout layout,
84 WallpaperDelegate* delegate) OVERRIDE; 85 WallpaperDelegate* delegate) OVERRIDE;
85 virtual void SaveUserImageFromProfileImage( 86 virtual void SaveUserImageFromProfileImage(
86 const std::string& username) OVERRIDE; 87 const std::string& username) OVERRIDE;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // The new wallpaper structure is: 166 // The new wallpaper structure is:
166 // { WallpaperType: RANDOM|CUSTOMIZED|DEFAULT, 167 // { WallpaperType: RANDOM|CUSTOMIZED|DEFAULT,
167 // index: index of the default wallpapers } 168 // index: index of the default wallpapers }
168 void MigrateWallpaperData(); 169 void MigrateWallpaperData();
169 170
170 // Sets image for user |username| and sends LOGIN_USER_IMAGE_CHANGED 171 // Sets image for user |username| and sends LOGIN_USER_IMAGE_CHANGED
171 // notification unless this is a new user and image is set for the first time. 172 // notification unless this is a new user and image is set for the first time.
172 // If |image| is empty, sets a stub image for the user. 173 // If |image| is empty, sets a stub image for the user.
173 void SetUserImage(const std::string& username, 174 void SetUserImage(const std::string& username,
174 int image_index, 175 int image_index,
175 const SkBitmap& image); 176 const UserImage& user_image);
176 177
177 void GetUserWallpaperProperties(const std::string& username, 178 void GetUserWallpaperProperties(const std::string& username,
178 User::WallpaperType* type, 179 User::WallpaperType* type,
179 int* index); 180 int* index);
180 void SaveUserWallpaperProperties(const std::string& username, 181 void SaveUserWallpaperProperties(const std::string& username,
181 User::WallpaperType type, 182 User::WallpaperType type,
182 int index); 183 int index);
183 184
184 // Saves image to file, updates local state preferences to given image index 185 // Saves image to file, updates local state preferences to given image index
185 // and sends LOGIN_USER_IMAGE_CHANGED notification. 186 // and sends LOGIN_USER_IMAGE_CHANGED notification.
186 void SaveUserImageInternal(const std::string& username, 187 void SaveUserImageInternal(const std::string& username,
187 int image_index, 188 int image_index,
188 const SkBitmap& image); 189 const UserImage& user_image);
189 190
190 // Saves wallpaper to file, post task to generate thumbnail and updates local 191 // Saves wallpaper to file, post task to generate thumbnail and updates local
191 // state preferences. 192 // state preferences.
192 void SaveUserWallpaperInternal(const std::string& username, 193 void SaveUserWallpaperInternal(const std::string& username,
193 ash::WallpaperLayout layout, 194 ash::WallpaperLayout layout,
194 User::WallpaperType type, 195 User::WallpaperType type,
195 WallpaperDelegate* delegate, 196 WallpaperDelegate* delegate,
196 const SkBitmap& image); 197 const UserImage& user_image);
197 198
198 // Loads custom wallpaper thumbnail asynchronously. 199 // Loads custom wallpaper thumbnail asynchronously.
199 void LoadCustomWallpaperThumbnail(const std::string& email, 200 void LoadCustomWallpaperThumbnail(const std::string& email,
200 ash::WallpaperLayout layout, 201 ash::WallpaperLayout layout,
201 const SkBitmap& wallpaper); 202 const UserImage& user_image);
202 203
203 // Caches the loaded wallpaper for the given user. 204 // Caches the loaded wallpaper for the given user.
204 void OnCustomWallpaperThumbnailLoaded(const std::string& email, 205 void OnCustomWallpaperThumbnailLoaded(const std::string& email,
205 const SkBitmap& wallpaper); 206 const UserImage& user_image);
206 207
207 // Updates the custom wallpaper thumbnail in wallpaper picker UI. 208 // Updates the custom wallpaper thumbnail in wallpaper picker UI.
208 void OnThumbnailUpdated(WallpaperDelegate* delegate); 209 void OnThumbnailUpdated(WallpaperDelegate* delegate);
209 210
210 // Generates a 128x80 thumbnail and saves it to local file system. 211 // Generates a 128x80 thumbnail and saves it to local file system.
211 void GenerateUserWallpaperThumbnail(const std::string& username, 212 void GenerateUserWallpaperThumbnail(const std::string& username,
212 User::WallpaperType type, 213 User::WallpaperType type,
213 WallpaperDelegate* delegate, 214 WallpaperDelegate* delegate,
214 const SkBitmap& wallpaper); 215 const SkBitmap& wallpaper);
215 216
216 // Saves image to file with specified path and sends LOGIN_USER_IMAGE_CHANGED 217 // Saves image to file with specified path and sends LOGIN_USER_IMAGE_CHANGED
217 // notification. Runs on FILE thread. Posts task for saving image info to 218 // notification. Runs on FILE thread. Posts task for saving image info to
218 // Local State on UI thread. 219 // Local State on UI thread.
219 void SaveImageToFile(const std::string& username, 220 void SaveImageToFile(const std::string& username,
220 const SkBitmap& image, 221 const UserImage& user_image,
221 const FilePath& image_path, 222 const FilePath& image_path,
222 int image_index); 223 int image_index);
223 224
224 // Saves wallpaper to file with specified path. Runs on FILE thread. Posts 225 // Saves wallpaper to file with specified path. Runs on FILE thread. Posts
225 // task for saving wallpaper info to Local State on UI thread. 226 // task for saving wallpaper info to Local State on UI thread.
226 void SaveWallpaperToFile(const std::string& username, 227 void SaveWallpaperToFile(const std::string& username,
227 const SkBitmap& wallpaper, 228 const SkBitmap& wallpaper,
228 const FilePath& wallpaper_path, 229 const FilePath& wallpaper_path,
229 ash::WallpaperLayout layout, 230 ash::WallpaperLayout layout,
230 User::WallpaperType type); 231 User::WallpaperType type);
231 232
232 // Stores path to the image and its index in local state. Runs on UI thread. 233 // Stores path to the image and its index in local state. Runs on UI thread.
233 // If |is_async| is true, it has been posted from the FILE thread after 234 // If |is_async| is true, it has been posted from the FILE thread after
234 // saving the image. 235 // saving the image.
235 void SaveImageToLocalState(const std::string& username, 236 void SaveImageToLocalState(const std::string& username,
236 const std::string& image_path, 237 const std::string& image_path,
237 int image_index, 238 int image_index,
238 bool is_async); 239 bool is_async);
239 240
240 // Stores layout and type preference in local state. Runs on UI thread. 241 // Stores layout and type preference in local state. Runs on UI thread.
241 void SaveWallpaperToLocalState(const std::string& username, 242 void SaveWallpaperToLocalState(const std::string& username,
242 const std::string& wallpaper_path, 243 const std::string& wallpaper_path,
243 ash::WallpaperLayout layout, 244 ash::WallpaperLayout layout,
244 User::WallpaperType type); 245 User::WallpaperType type);
245 246
246 // Saves |image| to the specified |image_path|. Runs on FILE thread. 247 // Saves |image| to the specified |image_path|. Runs on FILE thread.
247 bool SaveBitmapToFile(const SkBitmap& image, 248 bool SaveBitmapToFile(const UserImage& user_image,
248 const FilePath& image_path); 249 const FilePath& image_path);
249 250
250 // Initializes |downloaded_profile_picture_| with the picture of the logged-in 251 // Initializes |downloaded_profile_picture_| with the picture of the logged-in
251 // user. 252 // user.
252 void InitDownloadedProfileImage(); 253 void InitDownloadedProfileImage();
253 254
254 // Deletes user's image file. Runs on FILE thread. 255 // Deletes user's image file. Runs on FILE thread.
255 void DeleteUserImage(const FilePath& image_path); 256 void DeleteUserImage(const FilePath& image_path);
256 257
257 // Updates current user ownership on UI thread. 258 // Updates current user ownership on UI thread.
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 350
350 // Data URL for |downloaded_profile_image_|. 351 // Data URL for |downloaded_profile_image_|.
351 std::string downloaded_profile_image_data_url_; 352 std::string downloaded_profile_image_data_url_;
352 353
353 DISALLOW_COPY_AND_ASSIGN(UserManagerImpl); 354 DISALLOW_COPY_AND_ASSIGN(UserManagerImpl);
354 }; 355 };
355 356
356 } // namespace chromeos 357 } // namespace chromeos
357 358
358 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_ 359 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698