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

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

Issue 10375010: Implement user selected wallpaper feature. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: James' review Created 8 years, 7 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 | Annotate | Revision Log
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 const std::string& username) const OVERRIDE; 67 const std::string& username) const OVERRIDE;
68 virtual int GetLoggedInUserWallpaperIndex() OVERRIDE; 68 virtual int GetLoggedInUserWallpaperIndex() OVERRIDE;
69 virtual void GetLoggedInUserWallpaperProperties(User::WallpaperType& type, 69 virtual void GetLoggedInUserWallpaperProperties(User::WallpaperType& type,
70 int& index) OVERRIDE; 70 int& index) OVERRIDE;
71 virtual void SaveLoggedInUserWallpaperProperties(User::WallpaperType type, 71 virtual void SaveLoggedInUserWallpaperProperties(User::WallpaperType type,
72 int index) OVERRIDE; 72 int index) OVERRIDE;
73 virtual void SaveUserDefaultImageIndex(const std::string& username, 73 virtual void SaveUserDefaultImageIndex(const std::string& username,
74 int image_index) OVERRIDE; 74 int image_index) OVERRIDE;
75 virtual void SaveUserImage(const std::string& username, 75 virtual void SaveUserImage(const std::string& username,
76 const SkBitmap& image) OVERRIDE; 76 const SkBitmap& image) OVERRIDE;
77 virtual void SetLoggedInUserCustomWallpaperLayout(
78 ash::WallpaperLayout layout) OVERRIDE;
77 virtual void SaveUserImageFromFile(const std::string& username, 79 virtual void SaveUserImageFromFile(const std::string& username,
78 const FilePath& path) OVERRIDE; 80 const FilePath& path) OVERRIDE;
81 virtual void SaveUserWallpaperFromFile(const std::string& username,
82 const FilePath& path,
83 ash::WallpaperLayout layout,
84 WallpaperDelegate* delegate) OVERRIDE;
79 virtual void SaveUserImageFromProfileImage( 85 virtual void SaveUserImageFromProfileImage(
80 const std::string& username) OVERRIDE; 86 const std::string& username) OVERRIDE;
81 virtual void DownloadProfileImage(const std::string& reason) OVERRIDE; 87 virtual void DownloadProfileImage(const std::string& reason) OVERRIDE;
82 virtual void LoadKeyStore() OVERRIDE; 88 virtual void LoadKeyStore() OVERRIDE;
83 virtual bool IsCurrentUserOwner() const OVERRIDE; 89 virtual bool IsCurrentUserOwner() const OVERRIDE;
84 virtual bool IsCurrentUserNew() const OVERRIDE; 90 virtual bool IsCurrentUserNew() const OVERRIDE;
85 virtual bool IsCurrentUserEphemeral() const OVERRIDE; 91 virtual bool IsCurrentUserEphemeral() const OVERRIDE;
86 virtual bool IsUserLoggedIn() const OVERRIDE; 92 virtual bool IsUserLoggedIn() const OVERRIDE;
87 virtual bool IsLoggedInAsDemoUser() const OVERRIDE; 93 virtual bool IsLoggedInAsDemoUser() const OVERRIDE;
88 virtual bool IsLoggedInAsGuest() const OVERRIDE; 94 virtual bool IsLoggedInAsGuest() const OVERRIDE;
(...skipping 11 matching lines...) Expand all
100 106
101 // ProfileSyncServiceObserver implementation. 107 // ProfileSyncServiceObserver implementation.
102 virtual void OnStateChanged() OVERRIDE; 108 virtual void OnStateChanged() OVERRIDE;
103 109
104 protected: 110 protected:
105 UserManagerImpl(); 111 UserManagerImpl();
106 112
107 // Returns image filepath for the given user. 113 // Returns image filepath for the given user.
108 FilePath GetImagePathForUser(const std::string& username); 114 FilePath GetImagePathForUser(const std::string& username);
109 115
116 // Returns wallpaper/thumbnail filepath for the given user.
117 FilePath GetWallpaperPathForUser(const std::string& username,
118 bool is_thumbnail);
119
110 private: 120 private:
111 friend class UserManagerImplWrapper; 121 friend class UserManagerImplWrapper;
112 friend class UserManagerTest; 122 friend class UserManagerTest;
113 123
114 // Loads |users_| from Local State if the list has not been loaded yet. 124 // Loads |users_| from Local State if the list has not been loaded yet.
115 // Subsequent calls have no effect. Must be called on the UI thread. 125 // Subsequent calls have no effect. Must be called on the UI thread.
116 void EnsureUsersLoaded(); 126 void EnsureUsersLoaded();
117 127
118 // Retrieves trusted device policies and removes users from the persistent 128 // Retrieves trusted device policies and removes users from the persistent
119 // list if ephemeral users are enabled. Schedules a callback to itself if 129 // list if ephemeral users are enabled. Schedules a callback to itself if
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 void SaveUserWallpaperProperties(const std::string& username, 181 void SaveUserWallpaperProperties(const std::string& username,
172 User::WallpaperType type, 182 User::WallpaperType type,
173 int index); 183 int index);
174 184
175 // 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
176 // and sends LOGIN_USER_IMAGE_CHANGED notification. 186 // and sends LOGIN_USER_IMAGE_CHANGED notification.
177 void SaveUserImageInternal(const std::string& username, 187 void SaveUserImageInternal(const std::string& username,
178 int image_index, 188 int image_index,
179 const SkBitmap& image); 189 const SkBitmap& image);
180 190
191 // Saves wallpaper to file, post task to generate thumbnail and updates local
192 // state preferences.
193 void SaveUserWallpaperInternal(const std::string& username,
194 ash::WallpaperLayout layout,
195 User::WallpaperType type,
196 WallpaperDelegate* delegate,
197 const SkBitmap& image);
198
199 // Loads custom wallpaper thumbnail asynchronously.
200 void LoadCustomWallpaperThumbnail(const std::string& email,
201 ash::WallpaperLayout layout,
202 const SkBitmap& wallpaper);
203
204 // Caches the loaded wallpaper for the given user.
205 void OnCustomWallpaperThumbnailLoaded(const std::string& email,
206 const SkBitmap& wallpaper);
207
208 // Updates the custom wallpaper thumbnail in wallpaper picker UI.
209 void OnThumbnailUpdated(WallpaperDelegate* delegate);
210
211 // Generates a 128x80 thumbnail and saves it to local file system.
212 void GenerateUserWallpaperThumbnail(const std::string& username,
213 User::WallpaperType type,
214 WallpaperDelegate* delegate,
215 const SkBitmap& wallpaper);
216
181 // 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
182 // 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
183 // Local State on UI thread. 219 // Local State on UI thread.
184 void SaveImageToFile(const std::string& username, 220 void SaveImageToFile(const std::string& username,
185 const SkBitmap& image, 221 const SkBitmap& image,
186 const FilePath& image_path, 222 const FilePath& image_path,
187 int image_index); 223 int image_index);
188 224
225 // Saves wallpaper to file with specified path. Runs on FILE thread. Posts
226 // task for saving wallpaper info to Local State on UI thread.
227 void SaveWallpaperToFile(const std::string& username,
228 const SkBitmap& wallpaper,
229 const FilePath& wallpaper_path,
230 ash::WallpaperLayout layout,
231 User::WallpaperType type);
232
189 // 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.
190 // 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
191 // saving the image. 235 // saving the image.
192 void SaveImageToLocalState(const std::string& username, 236 void SaveImageToLocalState(const std::string& username,
193 const std::string& image_path, 237 const std::string& image_path,
194 int image_index, 238 int image_index,
195 bool is_async); 239 bool is_async);
196 240
241 // Stores layout and type preference in local state. Runs on UI thread.
242 void SaveWallpaperToLocalState(const std::string& username,
243 const std::string& wallpaper_path,
244 ash::WallpaperLayout layout,
245 User::WallpaperType type);
246
247 // Saves |image| to the specified |image_path|. Runs on FILE thread.
248 bool SaveBitmapToFile(const SkBitmap& image,
249 const FilePath& image_path);
250
197 // Initializes |downloaded_profile_picture_| with the picture of the logged-in 251 // Initializes |downloaded_profile_picture_| with the picture of the logged-in
198 // user. 252 // user.
199 void InitDownloadedProfileImage(); 253 void InitDownloadedProfileImage();
200 254
201 // Deletes user's image file. Runs on FILE thread. 255 // Deletes user's image file. Runs on FILE thread.
202 void DeleteUserImage(const FilePath& image_path); 256 void DeleteUserImage(const FilePath& image_path);
203 257
204 // Updates current user ownership on UI thread. 258 // Updates current user ownership on UI thread.
205 void UpdateOwnership(bool is_owner); 259 void UpdateOwnership(bool is_owner);
206 260
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 354
301 // Data URL for |downloaded_profile_image_|. 355 // Data URL for |downloaded_profile_image_|.
302 std::string downloaded_profile_image_data_url_; 356 std::string downloaded_profile_image_data_url_;
303 357
304 DISALLOW_COPY_AND_ASSIGN(UserManagerImpl); 358 DISALLOW_COPY_AND_ASSIGN(UserManagerImpl);
305 }; 359 };
306 360
307 } // namespace chromeos 361 } // namespace chromeos
308 362
309 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_ 363 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698