| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_WALLPAPER_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ash/desktop_background/desktop_background_controller.h" | 10 #include "ash/desktop_background/desktop_background_controller.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 121 |
| 122 // NotificationObserver overrides: | 122 // NotificationObserver overrides: |
| 123 virtual void Observe(int type, | 123 virtual void Observe(int type, |
| 124 const content::NotificationSource& source, | 124 const content::NotificationSource& source, |
| 125 const content::NotificationDetails& details) OVERRIDE; | 125 const content::NotificationDetails& details) OVERRIDE; |
| 126 | 126 |
| 127 // Removes all |email| related wallpaper info and saved wallpapers. | 127 // Removes all |email| related wallpaper info and saved wallpapers. |
| 128 void RemoveUserWallpaperInfo(const std::string& email); | 128 void RemoveUserWallpaperInfo(const std::string& email); |
| 129 | 129 |
| 130 // Resizes |wallpaper| to a resolution which is nearest to |preferred_width| | 130 // Resizes |wallpaper| to a resolution which is nearest to |preferred_width| |
| 131 // and |preferred_height| while maintaining aspect ratio. |
| 132 bool ResizeWallpaper(const UserImage& wallpaper, |
| 133 ash::WallpaperLayout layout, |
| 134 int preferred_width, |
| 135 int preferred_height, |
| 136 scoped_refptr<base::RefCountedBytes>* output); |
| 137 |
| 138 // Resizes |wallpaper| to a resolution which is nearest to |preferred_width| |
| 131 // and |preferred_height| while maintaining aspect ratio. And saves the | 139 // and |preferred_height| while maintaining aspect ratio. And saves the |
| 132 // resized wallpaper to |path|. | 140 // resized wallpaper to |path|. |
| 133 void ResizeAndSaveWallpaper(const UserImage& wallpaper, | 141 void ResizeAndSaveWallpaper(const UserImage& wallpaper, |
| 134 const base::FilePath& path, | 142 const base::FilePath& path, |
| 135 ash::WallpaperLayout layout, | 143 ash::WallpaperLayout layout, |
| 136 int preferred_width, | 144 int preferred_width, |
| 137 int preferred_height); | 145 int preferred_height); |
| 138 | 146 |
| 139 // Starts a one shot timer which calls BatchUpdateWallpaper at next midnight. | 147 // Starts a one shot timer which calls BatchUpdateWallpaper at next midnight. |
| 140 // Cancel any previous timer if any. | 148 // Cancel any previous timer if any. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // cache wallpapers on wallpaper animation finished. The cache operation | 206 // cache wallpapers on wallpaper animation finished. The cache operation |
| 199 // should be only executed once. | 207 // should be only executed once. |
| 200 void CacheUsersWallpapers(); | 208 void CacheUsersWallpapers(); |
| 201 | 209 |
| 202 // Caches |email|'s wallpaper to memory. | 210 // Caches |email|'s wallpaper to memory. |
| 203 void CacheUserWallpaper(const std::string& email); | 211 void CacheUserWallpaper(const std::string& email); |
| 204 | 212 |
| 205 // Clears all obsolete wallpaper prefs from old version wallpaper pickers. | 213 // Clears all obsolete wallpaper prefs from old version wallpaper pickers. |
| 206 void ClearObsoleteWallpaperPrefs(); | 214 void ClearObsoleteWallpaperPrefs(); |
| 207 | 215 |
| 216 // Deletes everything else except |path| in the same directory. |
| 217 void DeleteAllExcept(const base::FilePath& path); |
| 218 |
| 208 // Deletes a list of wallpaper files in |file_list|. | 219 // Deletes a list of wallpaper files in |file_list|. |
| 209 void DeleteWallpaperInList(const std::vector<base::FilePath>& file_list); | 220 void DeleteWallpaperInList(const std::vector<base::FilePath>& file_list); |
| 210 | 221 |
| 211 // Deletes all |email| related custom or converted wallpapers. | 222 // Deletes all |email| related custom or converted wallpapers. |
| 212 void DeleteUserWallpapers(const std::string& email); | 223 void DeleteUserWallpapers(const std::string& email); |
| 213 | 224 |
| 214 // Creates all new custom wallpaper directories for |email| if not exist. | 225 // Creates all new custom wallpaper directories for |email| if not exist. |
| 215 void EnsureCustomWallpaperDirectories(const std::string& email); | 226 void EnsureCustomWallpaperDirectories(const std::string& email); |
| 216 | 227 |
| 217 // Loads custom wallpaper from old places and triggers move all custom | 228 // Loads custom wallpaper from old places and triggers move all custom |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 content::NotificationRegistrar registrar_; | 354 content::NotificationRegistrar registrar_; |
| 344 | 355 |
| 345 base::OneShotTimer<WallpaperManager> timer_; | 356 base::OneShotTimer<WallpaperManager> timer_; |
| 346 | 357 |
| 347 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); | 358 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); |
| 348 }; | 359 }; |
| 349 | 360 |
| 350 } // namespace chromeos | 361 } // namespace chromeos |
| 351 | 362 |
| 352 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ | 363 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ |
| OLD | NEW |