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

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

Issue 10854061: Revert 150726 - Preload default wallpaper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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" 10 #include "ash/desktop_background/desktop_background_resources.h"
(...skipping 27 matching lines...) Expand all
38 38
39 WallpaperManager(); 39 WallpaperManager();
40 40
41 // Registers wallpaper manager preferences. 41 // Registers wallpaper manager preferences.
42 static void RegisterPrefs(PrefService* local_state); 42 static void RegisterPrefs(PrefService* local_state);
43 43
44 // Adds PowerManagerClient and TimeZoneSettings observers. It needs to be 44 // Adds PowerManagerClient and TimeZoneSettings observers. It needs to be
45 // added after PowerManagerClient initialized. 45 // added after PowerManagerClient initialized.
46 void AddObservers(); 46 void AddObservers();
47 47
48 // Caches |email|'s wallpaper to memory if it is custom wallpaper.
49 void CacheIfCustomWallpaper(const std::string& email);
50
48 // Loads wallpaper asynchronously if the current wallpaper is not the 51 // Loads wallpaper asynchronously if the current wallpaper is not the
49 // wallpaper of logged in user. 52 // wallpaper of logged in user.
50 void EnsureLoggedInUserWallpaperLoaded(); 53 void EnsureLoggedInUserWallpaperLoaded();
51 54
52 // Fetches |email|'s wallpaper from local disk. 55 // Fetches |email|'s wallpaper from local disk.
53 void FetchCustomWallpaper(const std::string& email); 56 void FetchCustomWallpaper(const std::string& email);
54 57
55 // Gets encoded custom wallpaper from cache. Returns true if success. 58 // Gets encoded custom wallpaper from cache. Returns true if success.
56 bool GetCustomWallpaperFromCache(const std::string& email, 59 bool GetCustomWallpaperFromCache(const std::string& email,
57 gfx::ImageSkia* wallpaper); 60 gfx::ImageSkia* wallpaper);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 private: 127 private:
125 typedef std::map<std::string, gfx::ImageSkia> CustomWallpaperMap; 128 typedef std::map<std::string, gfx::ImageSkia> CustomWallpaperMap;
126 129
127 virtual ~WallpaperManager(); 130 virtual ~WallpaperManager();
128 131
129 // Change the wallpapers for users who choose DAILY wallpaper type. Updates 132 // Change the wallpapers for users who choose DAILY wallpaper type. Updates
130 // current wallpaper if it changed. This function should be called at exactly 133 // current wallpaper if it changed. This function should be called at exactly
131 // at 0am if chromeos device is on. 134 // at 0am if chromeos device is on.
132 void BatchUpdateWallpaper(); 135 void BatchUpdateWallpaper();
133 136
134 // Cache all logged in users' wallpapers to memory at login screen. It should
135 // not compete with first wallpaper loading when boot up/initialize login
136 // WebUI page.
137 // There are two ways the first wallpaper might be loaded:
138 // 1. Loaded on boot. Login WebUI waits for it.
139 // 2. When flag --disable-boot-animation is passed. Login WebUI is loaded
140 // right away and in 500ms after. Wallpaper started to load.
141 // For case 2, should_cache_wallpaper_ is used to indicate if we need to
142 // cache wallpapers on wallpaper animation finished. The cache operation
143 // should be only executed once.
144 void CacheAllUsersWallpapers();
145
146 // Caches |email|'s wallpaper to memory.
147 void CacheUserWallpaper(const std::string& email);
148
149 // Caches the decoded wallpaper to memory. 137 // Caches the decoded wallpaper to memory.
150 void CacheWallpaper(const std::string& email, const UserImage& wallpaper); 138 void CacheWallpaper(const std::string& email, const UserImage& wallpaper);
151 139
152 // Generates a 128x80 thumbnail and caches it. 140 // Generates a 128x80 thumbnail and caches it.
153 void CacheThumbnail(const std::string& email, 141 void CacheThumbnail(const std::string& email,
154 const gfx::ImageSkia& wallpaper); 142 const gfx::ImageSkia& wallpaper);
155 143
156 // Sets wallpaper to the decoded wallpaper. 144 // Sets wallpaper to the decoded wallpaper.
157 void FetchWallpaper(const std::string& email, 145 void FetchWallpaper(const std::string& email,
158 ash::WallpaperLayout layout, 146 ash::WallpaperLayout layout,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 int current_user_wallpaper_index_; 193 int current_user_wallpaper_index_;
206 194
207 // Caches custom wallpapers of users. Accessed only on UI thread. 195 // Caches custom wallpapers of users. Accessed only on UI thread.
208 CustomWallpaperMap custom_wallpaper_cache_; 196 CustomWallpaperMap custom_wallpaper_cache_;
209 197
210 CustomWallpaperMap custom_wallpaper_thumbnail_cache_; 198 CustomWallpaperMap custom_wallpaper_thumbnail_cache_;
211 199
212 // The last selected user on user pod row. 200 // The last selected user on user pod row.
213 std::string last_selected_user_; 201 std::string last_selected_user_;
214 202
215 bool should_cache_wallpaper_;
216
217 base::WeakPtrFactory<WallpaperManager> weak_factory_; 203 base::WeakPtrFactory<WallpaperManager> weak_factory_;
218 204
219 content::NotificationRegistrar registrar_; 205 content::NotificationRegistrar registrar_;
220 206
221 base::OneShotTimer<WallpaperManager> timer_; 207 base::OneShotTimer<WallpaperManager> timer_;
222 208
223 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); 209 DISALLOW_COPY_AND_ASSIGN(WallpaperManager);
224 }; 210 };
225 211
226 } // namespace chromeos 212 } // namespace chromeos
227 213
228 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ 214 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_manager_impl.cc ('k') | chrome/browser/chromeos/login/wallpaper_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698