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

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: Rob and James reivew 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) OVERRIDE;
79 virtual void SaveUserImageFromProfileImage( 84 virtual void SaveUserImageFromProfileImage(
80 const std::string& username) OVERRIDE; 85 const std::string& username) OVERRIDE;
81 virtual void DownloadProfileImage(const std::string& reason) OVERRIDE; 86 virtual void DownloadProfileImage(const std::string& reason) OVERRIDE;
82 virtual void LoadKeyStore() OVERRIDE; 87 virtual void LoadKeyStore() OVERRIDE;
83 virtual bool IsCurrentUserOwner() const OVERRIDE; 88 virtual bool IsCurrentUserOwner() const OVERRIDE;
84 virtual bool IsCurrentUserNew() const OVERRIDE; 89 virtual bool IsCurrentUserNew() const OVERRIDE;
85 virtual bool IsCurrentUserEphemeral() const OVERRIDE; 90 virtual bool IsCurrentUserEphemeral() const OVERRIDE;
86 virtual bool IsUserLoggedIn() const OVERRIDE; 91 virtual bool IsUserLoggedIn() const OVERRIDE;
87 virtual bool IsLoggedInAsDemoUser() const OVERRIDE; 92 virtual bool IsLoggedInAsDemoUser() const OVERRIDE;
88 virtual bool IsLoggedInAsGuest() const OVERRIDE; 93 virtual bool IsLoggedInAsGuest() const OVERRIDE;
(...skipping 11 matching lines...) Expand all
100 105
101 // ProfileSyncServiceObserver implementation. 106 // ProfileSyncServiceObserver implementation.
102 virtual void OnStateChanged() OVERRIDE; 107 virtual void OnStateChanged() OVERRIDE;
103 108
104 protected: 109 protected:
105 UserManagerImpl(); 110 UserManagerImpl();
106 111
107 // Returns image filepath for the given user. 112 // Returns image filepath for the given user.
108 FilePath GetImagePathForUser(const std::string& username); 113 FilePath GetImagePathForUser(const std::string& username);
109 114
115 // Returns wallpaper/thumbnail filepath for the given user.
116 FilePath GetWallpaperPathForUser(const std::string& username,
117 bool is_thumbnail);
118
110 private: 119 private:
111 friend class UserManagerImplWrapper; 120 friend class UserManagerImplWrapper;
112 friend class UserManagerTest; 121 friend class UserManagerTest;
113 122
114 // Loads |users_| from Local State if the list has not been loaded yet. 123 // 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. 124 // Subsequent calls have no effect. Must be called on the UI thread.
116 void EnsureUsersLoaded(); 125 void EnsureUsersLoaded();
117 126
118 // Retrieves trusted device policies and removes users from the persistent 127 // Retrieves trusted device policies and removes users from the persistent
119 // list if ephemeral users are enabled. Schedules a callback to itself if 128 // list if ephemeral users are enabled. Schedules a callback to itself if
(...skipping 11 matching lines...) Expand all
131 // Returns the user with the given email address if found in the persistent 140 // Returns the user with the given email address if found in the persistent
132 // list. Returns |NULL| otherwise. 141 // list. Returns |NULL| otherwise.
133 const User* FindUserInList(const std::string& email) const; 142 const User* FindUserInList(const std::string& email) const;
134 143
135 // Makes stub user the current logged-in user (for test paths). 144 // Makes stub user the current logged-in user (for test paths).
136 void StubUserLoggedIn(); 145 void StubUserLoggedIn();
137 146
138 // Notifies on new user session. 147 // Notifies on new user session.
139 void NotifyOnLogin(); 148 void NotifyOnLogin();
140 149
150 // Notifies the custom wallpaper thumbnail has ready.
151 void NotifyThumbnailUpdated();
152
141 // Reads user's oauth token status from local state preferences. 153 // Reads user's oauth token status from local state preferences.
142 User::OAuthTokenStatus LoadUserOAuthStatus(const std::string& username) const; 154 User::OAuthTokenStatus LoadUserOAuthStatus(const std::string& username) const;
143 155
144 void SetCurrentUserIsOwner(bool is_current_user_owner); 156 void SetCurrentUserIsOwner(bool is_current_user_owner);
145 157
146 // Sets one of the default images for the specified user and saves this 158 // Sets one of the default images for the specified user and saves this
147 // setting in local state. 159 // setting in local state.
148 // Does not send LOGIN_USER_IMAGE_CHANGED notification. 160 // Does not send LOGIN_USER_IMAGE_CHANGED notification.
149 void SetInitialUserImage(const std::string& username); 161 void SetInitialUserImage(const std::string& username);
150 162
(...skipping 20 matching lines...) Expand all
171 void SaveUserWallpaperProperties(const std::string& username, 183 void SaveUserWallpaperProperties(const std::string& username,
172 User::WallpaperType type, 184 User::WallpaperType type,
173 int index); 185 int index);
174 186
175 // Saves image to file, updates local state preferences to given image index 187 // Saves image to file, updates local state preferences to given image index
176 // and sends LOGIN_USER_IMAGE_CHANGED notification. 188 // and sends LOGIN_USER_IMAGE_CHANGED notification.
177 void SaveUserImageInternal(const std::string& username, 189 void SaveUserImageInternal(const std::string& username,
178 int image_index, 190 int image_index,
179 const SkBitmap& image); 191 const SkBitmap& image);
180 192
193 // Saves wallpaper to file, post task to generate thumbnail and updates local
194 // state preferences.
195 void SaveUserWallpaperInternal(const std::string& username,
196 ash::WallpaperLayout layout,
197 User::WallpaperType type,
198 const SkBitmap& image);
199
200 // Loads custom wallpaper thumbnail asynchronously.
201 void LoadCustomWallpaperThumbnail(const std::string& email,
202 ash::WallpaperLayout layout,
203 const SkBitmap& wallpaper);
204
205 // Caches the loaded wallpaper for the given user.
206 void OnCustomWallpaperThumbnailLoaded(const std::string& email,
207 const SkBitmap& wallpaper);
208
209 // Generates a 128x80 thumbnail and saves it to local file system.
210 void GenerateUserWallpaperThumbnail(const std::string& username,
211 User::WallpaperType type,
212 const SkBitmap& wallpaper);
213
181 // Saves image to file with specified path and sends LOGIN_USER_IMAGE_CHANGED 214 // 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 215 // notification. Runs on FILE thread. Posts task for saving image info to
183 // Local State on UI thread. 216 // Local State on UI thread.
184 void SaveImageToFile(const std::string& username, 217 void SaveImageToFile(const std::string& username,
185 const SkBitmap& image, 218 const SkBitmap& image,
186 const FilePath& image_path, 219 const FilePath& image_path,
187 int image_index); 220 int image_index);
188 221
222 // Saves wallpaper to file with specified path. Runs on FILE thread. Posts
223 // task for saving wallpaper info to Local State on UI thread.
224 void SaveWallpaperToFile(const std::string& username,
225 const SkBitmap& wallpaper,
226 const FilePath& wallpaper_path,
227 ash::WallpaperLayout layout,
228 User::WallpaperType type);
229
189 // Stores path to the image and its index in local state. Runs on UI thread. 230 // 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 231 // If |is_async| is true, it has been posted from the FILE thread after
191 // saving the image. 232 // saving the image.
192 void SaveImageToLocalState(const std::string& username, 233 void SaveImageToLocalState(const std::string& username,
193 const std::string& image_path, 234 const std::string& image_path,
194 int image_index, 235 int image_index,
195 bool is_async); 236 bool is_async);
196 237
238 // Stores layout and type preference in local state. Runs on UI thread.
239 void SaveWallpaperToLocalState(const std::string& username,
240 const std::string& wallpaper_path,
241 ash::WallpaperLayout layout,
242 User::WallpaperType type);
243
244 // Saves |image| to the specified |image_path|. Runs on FILE thread.
245 bool SaveBitmapToFile(const SkBitmap& image,
246 const FilePath& image_path);
247
197 // Initializes |downloaded_profile_picture_| with the picture of the logged-in 248 // Initializes |downloaded_profile_picture_| with the picture of the logged-in
198 // user. 249 // user.
199 void InitDownloadedProfileImage(); 250 void InitDownloadedProfileImage();
200 251
201 // Deletes user's image file. Runs on FILE thread. 252 // Deletes user's image file. Runs on FILE thread.
202 void DeleteUserImage(const FilePath& image_path); 253 void DeleteUserImage(const FilePath& image_path);
203 254
204 // Updates current user ownership on UI thread. 255 // Updates current user ownership on UI thread.
205 void UpdateOwnership(bool is_owner); 256 void UpdateOwnership(bool is_owner);
206 257
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 351
301 // Data URL for |downloaded_profile_image_|. 352 // Data URL for |downloaded_profile_image_|.
302 std::string downloaded_profile_image_data_url_; 353 std::string downloaded_profile_image_data_url_;
303 354
304 DISALLOW_COPY_AND_ASSIGN(UserManagerImpl); 355 DISALLOW_COPY_AND_ASSIGN(UserManagerImpl);
305 }; 356 };
306 357
307 } // namespace chromeos 358 } // namespace chromeos
308 359
309 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_ 360 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698