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

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

Issue 11415015: Remove use of index in wallpaper picker code and some refactor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix browser tests Created 8 years, 1 month 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_controller.h"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/memory/ref_counted_memory.h" 12 #include "base/memory/ref_counted_memory.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/time.h" 14 #include "base/time.h"
15 #include "base/timer.h" 15 #include "base/timer.h"
16 #include "chrome/browser/chromeos/login/user.h" 16 #include "chrome/browser/chromeos/login/user.h"
17 #include "chrome/browser/chromeos/login/user_image.h" 17 #include "chrome/browser/chromeos/login/user_image.h"
18 #include "chrome/browser/chromeos/login/user_image_loader.h" 18 #include "chrome/browser/chromeos/login/user_image_loader.h"
19 #include "chrome/browser/chromeos/system/timezone_settings.h" 19 #include "chrome/browser/chromeos/system/timezone_settings.h"
20 #include "chromeos/dbus/power_manager_client.h" 20 #include "chromeos/dbus/power_manager_client.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // Cancel any previous timer if any. 115 // Cancel any previous timer if any.
116 void RestartTimer(); 116 void RestartTimer();
117 117
118 // Saves custom wallpaper to file, post task to generate thumbnail and updates 118 // Saves custom wallpaper to file, post task to generate thumbnail and updates
119 // local state preferences. 119 // local state preferences.
120 void SetCustomWallpaper(const std::string& username, 120 void SetCustomWallpaper(const std::string& username,
121 ash::WallpaperLayout layout, 121 ash::WallpaperLayout layout,
122 User::WallpaperType type, 122 User::WallpaperType type,
123 const UserImage& wallpaper); 123 const UserImage& wallpaper);
124 124
125 // Sets wallpaper to default wallpaper at |index|. 125 // Sets wallpaper to default wallpaper.
126 void SetDefaultWallpaper(int index); 126 void SetDefaultWallpaper();
127 127
128 // Sets one of the default wallpapers for the specified user and saves this 128 // Sets one of the default wallpapers for the specified user and saves this
129 // settings in local state. 129 // settings in local state.
130 void SetInitialUserWallpaper(const std::string& username, bool is_persistent); 130 void SetInitialUserWallpaper(const std::string& username, bool is_persistent);
131 131
132 // Sets selected wallpaper information for |username| and saves it to Local 132 // Sets selected wallpaper information for |username| and saves it to Local
133 // State if |is_persistent| is true. 133 // State if |is_persistent| is true.
134 void SetUserWallpaperInfo(const std::string& username, 134 void SetUserWallpaperInfo(const std::string& username,
135 const WallpaperInfo& info, 135 const WallpaperInfo& info,
136 bool is_persistent); 136 bool is_persistent);
137 137
138 // Sets last selected user on user pod row. 138 // Sets last selected user on user pod row.
139 void SetLastSelectedUser(const std::string& last_selected_user); 139 void SetLastSelectedUser(const std::string& last_selected_user);
140 140
141 // Sets |email|'s wallpaper. 141 // Sets |email|'s wallpaper.
142 void SetUserWallpaper(const std::string& email); 142 void SetUserWallpaper(const std::string& email);
143 143
144 // Sets the default wallpaper for the sign-in screen.
145 void SetSigninWallpaper();
146
147 // Sets wallpaper to |wallpaper|. 144 // Sets wallpaper to |wallpaper|.
148 void SetWallpaperFromImageSkia(const gfx::ImageSkia& wallpaper, 145 void SetWallpaperFromImageSkia(const gfx::ImageSkia& wallpaper,
149 ash::WallpaperLayout layout); 146 ash::WallpaperLayout layout);
150 147
151 // Updates current wallpaper. It may switch the size of wallpaper based on the 148 // Updates current wallpaper. It may switch the size of wallpaper based on the
152 // current display's resolution. 149 // current display's resolution.
153 void UpdateWallpaper(); 150 void UpdateWallpaper();
154 151
155 private: 152 private:
156 friend class WallpaperManagerBrowserTest; 153 friend class WallpaperManagerBrowserTest;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 const WallpaperInfo& info, 276 const WallpaperInfo& info,
280 bool update_wallpaper, 277 bool update_wallpaper,
281 const FilePath& wallpaper_path); 278 const FilePath& wallpaper_path);
282 279
283 // The number of loaded wallpapers. 280 // The number of loaded wallpapers.
284 int loaded_wallpapers_; 281 int loaded_wallpapers_;
285 282
286 // The file path of current loaded/loading custom/online wallpaper. 283 // The file path of current loaded/loading custom/online wallpaper.
287 FilePath current_wallpaper_path_; 284 FilePath current_wallpaper_path_;
288 285
289 // The index of current loaded/loading default wallpaper.
290 int current_default_wallpaper_index_;
291
292 // Loads user wallpaper from its file. 286 // Loads user wallpaper from its file.
293 scoped_refptr<UserImageLoader> wallpaper_loader_; 287 scoped_refptr<UserImageLoader> wallpaper_loader_;
294 288
295 // Logged-in user wallpaper information. 289 // Logged-in user wallpaper information.
296 WallpaperInfo current_user_wallpaper_info_; 290 WallpaperInfo current_user_wallpaper_info_;
297 291
298 // Caches wallpapers of users. Accessed only on UI thread. 292 // Caches wallpapers of users. Accessed only on UI thread.
299 CustomWallpaperMap wallpaper_cache_; 293 CustomWallpaperMap wallpaper_cache_;
300 294
301 CustomWallpaperMap custom_wallpaper_thumbnail_cache_; 295 CustomWallpaperMap custom_wallpaper_thumbnail_cache_;
302 296
303 // The last selected user on user pod row. 297 // The last selected user on user pod row.
304 std::string last_selected_user_; 298 std::string last_selected_user_;
305 299
306 bool should_cache_wallpaper_; 300 bool should_cache_wallpaper_;
307 301
308 base::WeakPtrFactory<WallpaperManager> weak_factory_; 302 base::WeakPtrFactory<WallpaperManager> weak_factory_;
309 303
310 content::NotificationRegistrar registrar_; 304 content::NotificationRegistrar registrar_;
311 305
312 base::OneShotTimer<WallpaperManager> timer_; 306 base::OneShotTimer<WallpaperManager> timer_;
313 307
314 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); 308 DISALLOW_COPY_AND_ASSIGN(WallpaperManager);
315 }; 309 };
316 310
317 } // namespace chromeos 311 } // namespace chromeos
318 312
319 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ 313 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_manager.h ('k') | chrome/browser/chromeos/login/wallpaper_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698