| 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" |
| 11 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/timer.h" | 12 #include "base/timer.h" |
| 13 #include "chrome/browser/chromeos/login/user_image.h" |
| 14 #include "chrome/browser/chromeos/login/user_image_loader.h" |
| 11 #include "chrome/browser/chromeos/power/resume_observer.h" | 15 #include "chrome/browser/chromeos/power/resume_observer.h" |
| 12 #include "chrome/browser/chromeos/system/timezone_settings.h" | 16 #include "chrome/browser/chromeos/system/timezone_settings.h" |
| 13 #include "unicode/timezone.h" | 17 #include "unicode/timezone.h" |
| 14 | 18 |
| 15 namespace chromeos { | 19 namespace chromeos { |
| 16 | 20 |
| 17 // This class maintains wallpapers for users who have logged into this Chrome | 21 // This class maintains wallpapers for users who have logged into this Chrome |
| 18 // OS device. | 22 // OS device. |
| 19 class WallpaperManager: public system::TimezoneSettings::Observer, | 23 class WallpaperManager: public system::TimezoneSettings::Observer, |
| 20 public chromeos::ResumeObserver { | 24 public chromeos::ResumeObserver { |
| 21 public: | 25 public: |
| 22 WallpaperManager(); | 26 WallpaperManager(); |
| 23 | 27 |
| 24 static WallpaperManager* Get(); | 28 static WallpaperManager* Get(); |
| 25 | 29 |
| 26 // Sets last selected user on user pod row. | 30 // Sets last selected user on user pod row. |
| 27 void SetLastSelectedUser(std::string last_selected_user); | 31 void SetLastSelectedUser(std::string last_selected_user); |
| 28 | 32 |
| 29 // Adds PowerManagerClient observer. It needs to be added after | 33 // Adds PowerManagerClient observer. It needs to be added after |
| 30 // PowerManagerClient initialized. | 34 // PowerManagerClient initialized. |
| 31 void AddPowerManagerClientObserver(); | 35 void AddPowerManagerClientObserver(); |
| 32 | 36 |
| 33 // Starts a one shot timer which calls BatchUpdateWallpaper at next midnight. | 37 // Starts a one shot timer which calls BatchUpdateWallpaper at next midnight. |
| 34 // Cancel any previous timer if any. | 38 // Cancel any previous timer if any. |
| 35 void RestartTimer(); | 39 void RestartTimer(); |
| 36 | 40 |
| 41 // Sets wallpaper to the image file |path| points to. |
| 42 void SetWallpaperFromFile(std::string email, |
| 43 const std::string& path, |
| 44 ash::WallpaperLayout layout); |
| 45 |
| 37 private: | 46 private: |
| 38 virtual ~WallpaperManager(); | 47 virtual ~WallpaperManager(); |
| 39 | 48 |
| 40 // Overridden from system::TimezoneSettings::Observer. | 49 // Overridden from system::TimezoneSettings::Observer. |
| 41 virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE; | 50 virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE; |
| 42 | 51 |
| 43 // Overridden from chromeos::ResumeObserver | 52 // Overridden from chromeos::ResumeObserver |
| 44 virtual void SystemResumed() OVERRIDE; | 53 virtual void SystemResumed() OVERRIDE; |
| 45 | 54 |
| 55 void OnCustomWallpaperLoaded(const std::string& email, |
| 56 ash::WallpaperLayout layout, |
| 57 const UserImage& user_image); |
| 58 |
| 46 // Change the wallpapers for users who choose DAILY wallpaper type. Updates | 59 // Change the wallpapers for users who choose DAILY wallpaper type. Updates |
| 47 // current wallpaper if it changed. This function should be called at exactly | 60 // current wallpaper if it changed. This function should be called at exactly |
| 48 // at 0am if chromeos device is on. | 61 // at 0am if chromeos device is on. |
| 49 void BatchUpdateWallpaper(); | 62 void BatchUpdateWallpaper(); |
| 50 | 63 |
| 64 // Loads user image from its file. |
| 65 scoped_refptr<UserImageLoader> image_loader_; |
| 66 |
| 51 // The last selected user on user pod row. | 67 // The last selected user on user pod row. |
| 52 std::string last_selected_user_; | 68 std::string last_selected_user_; |
| 53 | 69 |
| 54 base::OneShotTimer<WallpaperManager> timer_; | 70 base::OneShotTimer<WallpaperManager> timer_; |
| 55 | 71 |
| 56 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); | 72 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); |
| 57 }; | 73 }; |
| 58 | 74 |
| 59 } // namespace chromeos | 75 } // namespace chromeos |
| 60 | 76 |
| 61 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ | 77 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ |
| OLD | NEW |