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

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

Issue 10754014: Wallpaper manager backend APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix thread violation Created 8 years, 5 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_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 static WallpaperManager* Get(); 26 static WallpaperManager* Get();
23 27
24 WallpaperManager(); 28 WallpaperManager();
25 29
26 // Adds PowerManagerClient observer. It needs to be added after 30 // Adds PowerManagerClient observer. It needs to be added after
27 // PowerManagerClient initialized. 31 // PowerManagerClient initialized.
28 void AddPowerManagerClientObserver(); 32 void AddPowerManagerClientObserver();
29 33
30 // Starts a one shot timer which calls BatchUpdateWallpaper at next midnight. 34 // Starts a one shot timer which calls BatchUpdateWallpaper at next midnight.
31 // Cancel any previous timer if any. 35 // Cancel any previous timer if any.
32 void RestartTimer(); 36 void RestartTimer();
33 37
34 // Sets last selected user on user pod row. 38 // Sets last selected user on user pod row.
35 void SetLastSelectedUser(const std::string& last_selected_user); 39 void SetLastSelectedUser(const std::string& last_selected_user);
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 // User was deselected at login screen, reset wallpaper if needed. 46 // User was deselected at login screen, reset wallpaper if needed.
38 void UserDeselected(); 47 void UserDeselected();
39 48
40 private: 49 private:
41 virtual ~WallpaperManager(); 50 virtual ~WallpaperManager();
42 51
52 void OnCustomWallpaperLoaded(const std::string& email,
53 ash::WallpaperLayout layout,
54 const UserImage& user_image);
55
43 // Change the wallpapers for users who choose DAILY wallpaper type. Updates 56 // Change the wallpapers for users who choose DAILY wallpaper type. Updates
44 // current wallpaper if it changed. This function should be called at exactly 57 // current wallpaper if it changed. This function should be called at exactly
45 // at 0am if chromeos device is on. 58 // at 0am if chromeos device is on.
46 void BatchUpdateWallpaper(); 59 void BatchUpdateWallpaper();
47 60
61 // Loads user image from its file.
62 scoped_refptr<UserImageLoader> image_loader_;
63
48 // Overridden from chromeos::ResumeObserver 64 // Overridden from chromeos::ResumeObserver
49 virtual void SystemResumed() OVERRIDE; 65 virtual void SystemResumed() OVERRIDE;
50 66
51 // Overridden from system::TimezoneSettings::Observer. 67 // Overridden from system::TimezoneSettings::Observer.
52 virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE; 68 virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE;
53 69
54 // The last selected user on user pod row. 70 // The last selected user on user pod row.
55 std::string last_selected_user_; 71 std::string last_selected_user_;
56 72
57 base::OneShotTimer<WallpaperManager> timer_; 73 base::OneShotTimer<WallpaperManager> timer_;
58 74
59 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); 75 DISALLOW_COPY_AND_ASSIGN(WallpaperManager);
60 }; 76 };
61 77
62 } // namespace chromeos 78 } // namespace chromeos
63 79
64 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ 80 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698