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

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

Issue 10667034: [cros] Cache the URL of user's G+ profile photo to prevent redundant downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 | 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // The new wallpaper structure is: 173 // The new wallpaper structure is:
174 // { WallpaperType: RANDOM|CUSTOMIZED|DEFAULT, 174 // { WallpaperType: RANDOM|CUSTOMIZED|DEFAULT,
175 // index: index of the default wallpapers } 175 // index: index of the default wallpapers }
176 void MigrateWallpaperData(); 176 void MigrateWallpaperData();
177 177
178 // Sets image for user |username| and sends LOGIN_USER_IMAGE_CHANGED 178 // Sets image for user |username| and sends LOGIN_USER_IMAGE_CHANGED
179 // notification unless this is a new user and image is set for the first time. 179 // notification unless this is a new user and image is set for the first time.
180 // If |image| is empty, sets a stub image for the user. 180 // If |image| is empty, sets a stub image for the user.
181 void SetUserImage(const std::string& username, 181 void SetUserImage(const std::string& username,
182 int image_index, 182 int image_index,
183 const GURL& image_url,
183 const UserImage& user_image); 184 const UserImage& user_image);
184 185
185 void GetUserWallpaperProperties(const std::string& username, 186 void GetUserWallpaperProperties(const std::string& username,
186 User::WallpaperType* type, 187 User::WallpaperType* type,
187 int* index); 188 int* index);
188 void SaveUserWallpaperProperties(const std::string& username, 189 void SaveUserWallpaperProperties(const std::string& username,
189 User::WallpaperType type, 190 User::WallpaperType type,
190 int index); 191 int index);
191 192
192 // Saves image to file, updates local state preferences to given image index 193 // Saves image to file, updates local state preferences to given image index
193 // and sends LOGIN_USER_IMAGE_CHANGED notification. 194 // and sends LOGIN_USER_IMAGE_CHANGED notification.
194 void SaveUserImageInternal(const std::string& username, 195 void SaveUserImageInternal(const std::string& username,
195 int image_index, 196 int image_index,
197 const GURL& image_url,
196 const UserImage& user_image); 198 const UserImage& user_image);
197 199
198 // Saves wallpaper to file, post task to generate thumbnail and updates local 200 // Saves wallpaper to file, post task to generate thumbnail and updates local
199 // state preferences. 201 // state preferences.
200 void SaveUserWallpaperInternal(const std::string& username, 202 void SaveUserWallpaperInternal(const std::string& username,
201 ash::WallpaperLayout layout, 203 ash::WallpaperLayout layout,
202 User::WallpaperType type, 204 User::WallpaperType type,
203 WallpaperDelegate* delegate, 205 WallpaperDelegate* delegate,
204 const UserImage& user_image); 206 const UserImage& user_image);
205 207
(...skipping 15 matching lines...) Expand all
221 User::WallpaperType type, 223 User::WallpaperType type,
222 WallpaperDelegate* delegate, 224 WallpaperDelegate* delegate,
223 const SkBitmap& wallpaper); 225 const SkBitmap& wallpaper);
224 226
225 // Saves image to file with specified path and sends LOGIN_USER_IMAGE_CHANGED 227 // Saves image to file with specified path and sends LOGIN_USER_IMAGE_CHANGED
226 // notification. Runs on FILE thread. Posts task for saving image info to 228 // notification. Runs on FILE thread. Posts task for saving image info to
227 // Local State on UI thread. 229 // Local State on UI thread.
228 void SaveImageToFile(const std::string& username, 230 void SaveImageToFile(const std::string& username,
229 const UserImage& user_image, 231 const UserImage& user_image,
230 const FilePath& image_path, 232 const FilePath& image_path,
231 int image_index); 233 int image_index,
234 const GURL& image_url);
232 235
233 // Saves wallpaper to file with specified path. Runs on FILE thread. Posts 236 // Saves wallpaper to file with specified path. Runs on FILE thread. Posts
234 // task for saving wallpaper info to Local State on UI thread. 237 // task for saving wallpaper info to Local State on UI thread.
235 void SaveWallpaperToFile(const std::string& username, 238 void SaveWallpaperToFile(const std::string& username,
236 const SkBitmap& wallpaper, 239 const SkBitmap& wallpaper,
237 const FilePath& wallpaper_path, 240 const FilePath& wallpaper_path,
238 ash::WallpaperLayout layout, 241 ash::WallpaperLayout layout,
239 User::WallpaperType type); 242 User::WallpaperType type);
240 243
241 // Stores path to the image and its index in local state. Runs on UI thread. 244 // Stores path to the image and its index in local state. Runs on UI thread.
242 // If |is_async| is true, it has been posted from the FILE thread after 245 // If |is_async| is true, it has been posted from the FILE thread after
243 // saving the image. 246 // saving the image.
244 void SaveImageToLocalState(const std::string& username, 247 void SaveImageToLocalState(const std::string& username,
245 const std::string& image_path, 248 const std::string& image_path,
246 int image_index, 249 int image_index,
250 const GURL& image_url,
247 bool is_async); 251 bool is_async);
248 252
249 // Stores layout and type preference in local state. Runs on UI thread. 253 // Stores layout and type preference in local state. Runs on UI thread.
250 void SaveWallpaperToLocalState(const std::string& username, 254 void SaveWallpaperToLocalState(const std::string& username,
251 const std::string& wallpaper_path, 255 const std::string& wallpaper_path,
252 ash::WallpaperLayout layout, 256 ash::WallpaperLayout layout,
253 User::WallpaperType type); 257 User::WallpaperType type);
254 258
255 // Saves |image| to the specified |image_path|. Runs on FILE thread. 259 // Saves |image| to the specified |image_path|. Runs on FILE thread.
256 bool SaveBitmapToFile(const UserImage& user_image, 260 bool SaveBitmapToFile(const UserImage& user_image,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 // have been completed yet). This flag is used to avoid races when user image 352 // have been completed yet). This flag is used to avoid races when user image
349 // is first set with |SaveUserImage| and then with |SaveUserImagePath|. 353 // is first set with |SaveUserImage| and then with |SaveUserImagePath|.
350 bool last_image_set_async_; 354 bool last_image_set_async_;
351 355
352 // Result of the last successful profile image download, if any. 356 // Result of the last successful profile image download, if any.
353 SkBitmap downloaded_profile_image_; 357 SkBitmap downloaded_profile_image_;
354 358
355 // Data URL for |downloaded_profile_image_|. 359 // Data URL for |downloaded_profile_image_|.
356 std::string downloaded_profile_image_data_url_; 360 std::string downloaded_profile_image_data_url_;
357 361
362 // Original URL of |downloaded_profile_image_|, from which it was downloaded.
363 GURL profile_image_url_;
364
358 DISALLOW_COPY_AND_ASSIGN(UserManagerImpl); 365 DISALLOW_COPY_AND_ASSIGN(UserManagerImpl);
359 }; 366 };
360 367
361 } // namespace chromeos 368 } // namespace chromeos
362 369
363 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_ 370 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_image.h ('k') | chrome/browser/chromeos/login/user_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698