| OLD | NEW |
| 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_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_resources.h" | 10 #include "ash/desktop_background/desktop_background_resources.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 // NotificationObserver overrides: | 96 // NotificationObserver overrides: |
| 97 virtual void Observe(int type, | 97 virtual void Observe(int type, |
| 98 const content::NotificationSource& source, | 98 const content::NotificationSource& source, |
| 99 const content::NotificationDetails& details) OVERRIDE; | 99 const content::NotificationDetails& details) OVERRIDE; |
| 100 | 100 |
| 101 // Starts a one shot timer which calls BatchUpdateWallpaper at next midnight. | 101 // Starts a one shot timer which calls BatchUpdateWallpaper at next midnight. |
| 102 // Cancel any previous timer if any. | 102 // Cancel any previous timer if any. |
| 103 void RestartTimer(); | 103 void RestartTimer(); |
| 104 | 104 |
| 105 // Saves custom wallpaper to file, post task to generate thumbnail and updates |
| 106 // local state preferences. |
| 107 void SetCustomWallpaper(const std::string& username, |
| 108 ash::WallpaperLayout layout, |
| 109 User::WallpaperType type, |
| 110 base::WeakPtr<WallpaperDelegate> delegate, |
| 111 const UserImage& wallpaper); |
| 112 |
| 105 // Tries to load user image from disk; if successful, sets it for the user, | 113 // Tries to load user image from disk; if successful, sets it for the user, |
| 106 // and updates Local State. | 114 // and updates Local State. |
| 107 void SetUserWallpaperFromFile(const std::string& username, | 115 void SetUserWallpaperFromFile(const std::string& username, |
| 108 const FilePath& path, | 116 const FilePath& path, |
| 109 ash::WallpaperLayout layout, | 117 ash::WallpaperLayout layout, |
| 110 base::WeakPtr<WallpaperDelegate> delegate); | 118 base::WeakPtr<WallpaperDelegate> delegate); |
| 111 | 119 |
| 112 // Sets selected wallpaper properties for |username| and saves it to Local | 120 // Sets selected wallpaper properties for |username| and saves it to Local |
| 113 // State if |is_persistent| is true. | 121 // State if |is_persistent| is true. |
| 114 void SetUserWallpaperProperties(const std::string& email, | 122 void SetUserWallpaperProperties(const std::string& email, |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 // Saves original custom wallpaper to |path| (absolute path) on filesystem | 238 // Saves original custom wallpaper to |path| (absolute path) on filesystem |
| 231 // and starts resizing operation of the custom wallpaper if necessary. | 239 // and starts resizing operation of the custom wallpaper if necessary. |
| 232 void SaveCustomWallpaper(const std::string& email, | 240 void SaveCustomWallpaper(const std::string& email, |
| 233 const FilePath& path, | 241 const FilePath& path, |
| 234 ash::WallpaperLayout layout, | 242 ash::WallpaperLayout layout, |
| 235 const UserImage& wallpaper); | 243 const UserImage& wallpaper); |
| 236 | 244 |
| 237 // Saves wallpaper image raw |data| to |path| (absolute path) in file system. | 245 // Saves wallpaper image raw |data| to |path| (absolute path) in file system. |
| 238 void SaveWallpaperInternal(const FilePath& path, const char* data, int size); | 246 void SaveWallpaperInternal(const FilePath& path, const char* data, int size); |
| 239 | 247 |
| 240 // Saves custom wallpaper to file, post task to generate thumbnail and updates | |
| 241 // local state preferences. | |
| 242 void SetCustomWallpaper(const std::string& username, | |
| 243 ash::WallpaperLayout layout, | |
| 244 User::WallpaperType type, | |
| 245 base::WeakPtr<WallpaperDelegate> delegate, | |
| 246 const UserImage& wallpaper); | |
| 247 | |
| 248 // Whether wallpaper data should be persisted for user |email|. | 248 // Whether wallpaper data should be persisted for user |email|. |
| 249 // Note: this function can not be called in SetUserWallpaperProperties. It | 249 // Note: this function can not be called in SetUserWallpaperProperties. It |
| 250 // will create a deadlock. (issue 142440) | 250 // will create a deadlock. (issue 142440) |
| 251 bool ShouldPersistDataForUser(const std::string& email); | 251 bool ShouldPersistDataForUser(const std::string& email); |
| 252 | 252 |
| 253 // Sets wallpaper to image in |user_image| with |layout|. | 253 // Sets wallpaper to image in |user_image| with |layout|. |
| 254 void OnWallpaperLoaded(ash::WallpaperLayout layout, | 254 void OnWallpaperLoaded(ash::WallpaperLayout layout, |
| 255 const UserImage& user_image); | 255 const UserImage& user_image); |
| 256 | 256 |
| 257 // Overridden from chromeos::ResumeObserver | 257 // Overridden from chromeos::ResumeObserver |
| (...skipping 29 matching lines...) Expand all Loading... |
| 287 content::NotificationRegistrar registrar_; | 287 content::NotificationRegistrar registrar_; |
| 288 | 288 |
| 289 base::OneShotTimer<WallpaperManager> timer_; | 289 base::OneShotTimer<WallpaperManager> timer_; |
| 290 | 290 |
| 291 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); | 291 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); |
| 292 }; | 292 }; |
| 293 | 293 |
| 294 } // namespace chromeos | 294 } // namespace chromeos |
| 295 | 295 |
| 296 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ | 296 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ |
| OLD | NEW |