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