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

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

Issue 11968044: Fix login visual hitch on chromebook (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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) 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"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 // This class maintains wallpapers for users who have logged into this Chrome 57 // This class maintains wallpapers for users who have logged into this Chrome
58 // OS device. 58 // OS device.
59 class WallpaperManager: public system::TimezoneSettings::Observer, 59 class WallpaperManager: public system::TimezoneSettings::Observer,
60 public chromeos::PowerManagerClient::Observer, 60 public chromeos::PowerManagerClient::Observer,
61 public content::NotificationObserver { 61 public content::NotificationObserver {
62 public: 62 public:
63 static WallpaperManager* Get(); 63 static WallpaperManager* Get();
64 64
65 WallpaperManager(); 65 WallpaperManager();
66 virtual ~WallpaperManager();
67
68 // Indicates imminent shutdown, allowing the WallpaperManager to remove any
69 // observers it has registered.
70 void Shutdown();
66 71
67 // Registers wallpaper manager preferences. 72 // Registers wallpaper manager preferences.
68 static void RegisterPrefs(PrefServiceSimple* local_state); 73 static void RegisterPrefs(PrefServiceSimple* local_state);
69 74
70 // Adds PowerManagerClient and TimeZoneSettings observers. It needs to be
71 // added after PowerManagerClient has been initialized.
72 void AddObservers();
73
74 // Loads wallpaper asynchronously if the current wallpaper is not the 75 // Loads wallpaper asynchronously if the current wallpaper is not the
75 // wallpaper of logged in user. 76 // wallpaper of logged in user.
76 void EnsureLoggedInUserWallpaperLoaded(); 77 void EnsureLoggedInUserWallpaperLoaded();
77 78
78 // Clears ONLINE and CUSTOM wallpaper cache. 79 // Clears ONLINE and CUSTOM wallpaper cache.
79 void ClearWallpaperCache(); 80 void ClearWallpaperCache();
80 81
81 // Gets encoded wallpaper from cache. Returns true if success. 82 // Gets encoded wallpaper from cache. Returns true if success.
82 bool GetWallpaperFromCache(const std::string& email, 83 bool GetWallpaperFromCache(const std::string& email,
83 gfx::ImageSkia* wallpaper); 84 gfx::ImageSkia* wallpaper);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 ash::WallpaperLayout layout); 152 ash::WallpaperLayout layout);
152 153
153 // Updates current wallpaper. It may switch the size of wallpaper based on the 154 // Updates current wallpaper. It may switch the size of wallpaper based on the
154 // current display's resolution. 155 // current display's resolution.
155 void UpdateWallpaper(); 156 void UpdateWallpaper();
156 157
157 private: 158 private:
158 friend class WallpaperManagerBrowserTest; 159 friend class WallpaperManagerBrowserTest;
159 typedef std::map<std::string, gfx::ImageSkia> CustomWallpaperMap; 160 typedef std::map<std::string, gfx::ImageSkia> CustomWallpaperMap;
160 161
161 virtual ~WallpaperManager();
162
163 // The number of wallpapers have loaded. For test only. 162 // The number of wallpapers have loaded. For test only.
164 int loaded_wallpapers() const { return loaded_wallpapers_; } 163 int loaded_wallpapers() const { return loaded_wallpapers_; }
165 164
166 // Change the wallpapers for users who choose DAILY wallpaper type. Updates 165 // Change the wallpapers for users who choose DAILY wallpaper type. Updates
167 // current wallpaper if it changed. This function should be called at exactly 166 // current wallpaper if it changed. This function should be called at exactly
168 // at 0am if chromeos device is on. 167 // at 0am if chromeos device is on.
169 void BatchUpdateWallpaper(); 168 void BatchUpdateWallpaper();
170 169
171 // Cache some (or all) logged in users' wallpapers to memory at login 170 // Cache some (or all) logged in users' wallpapers to memory at login
172 // screen. It should not compete with first wallpaper loading when boot 171 // screen. It should not compete with first wallpaper loading when boot
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 // Old wallpaper names have a png extension name. However all new wallpapers 259 // Old wallpaper names have a png extension name. However all new wallpapers
261 // are saved in jpeg format. We have removed file extension to avoid 260 // are saved in jpeg format. We have removed file extension to avoid
262 // confusion in this CL (https://codereview.chromium.org/10950014). 261 // confusion in this CL (https://codereview.chromium.org/10950014).
263 // For wallpapers saved before it, we still need to append png extension to 262 // For wallpapers saved before it, we still need to append png extension to
264 // file name. 263 // file name.
265 void ValidateAndLoadWallpaper(const std::string& email, 264 void ValidateAndLoadWallpaper(const std::string& email,
266 const WallpaperInfo& info, 265 const WallpaperInfo& info,
267 bool update_wallpaper, 266 bool update_wallpaper,
268 const FilePath& wallpaper_path); 267 const FilePath& wallpaper_path);
269 268
269 // True if Shutdown function get called.
270 bool called_shutdown_;
271
270 // The number of loaded wallpapers. 272 // The number of loaded wallpapers.
271 int loaded_wallpapers_; 273 int loaded_wallpapers_;
272 274
273 // Sequence token associated with wallpaper operations. 275 // Sequence token associated with wallpaper operations.
274 base::SequencedWorkerPool::SequenceToken sequence_token_; 276 base::SequencedWorkerPool::SequenceToken sequence_token_;
275 277
276 // Wallpaper sequenced task runner. 278 // Wallpaper sequenced task runner.
277 scoped_refptr<base::SequencedTaskRunner> task_runner_; 279 scoped_refptr<base::SequencedTaskRunner> task_runner_;
278 280
279 // The file path of current loaded/loading custom/online wallpaper. 281 // The file path of current loaded/loading custom/online wallpaper.
(...skipping 18 matching lines...) Expand all
298 content::NotificationRegistrar registrar_; 300 content::NotificationRegistrar registrar_;
299 301
300 base::OneShotTimer<WallpaperManager> timer_; 302 base::OneShotTimer<WallpaperManager> timer_;
301 303
302 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); 304 DISALLOW_COPY_AND_ASSIGN(WallpaperManager);
303 }; 305 };
304 306
305 } // namespace chromeos 307 } // namespace chromeos
306 308
307 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ 309 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698