OLD | NEW |
1 // Copyright (c) 2013 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 <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 virtual ~TestApi(); | 79 virtual ~TestApi(); |
80 | 80 |
81 base::FilePath current_wallpaper_path(); | 81 base::FilePath current_wallpaper_path(); |
82 | 82 |
83 bool GetWallpaperFromCache(const std::string& user_id, | 83 bool GetWallpaperFromCache(const std::string& user_id, |
84 gfx::ImageSkia* image); | 84 gfx::ImageSkia* image); |
85 | 85 |
86 void SetWallpaperCache(const std::string& user_id, | 86 void SetWallpaperCache(const std::string& user_id, |
87 const gfx::ImageSkia& image); | 87 const gfx::ImageSkia& image); |
88 | 88 |
89 void ClearWallpaperCache(); | 89 void ClearDisposableWallpaperCache(); |
90 | 90 |
91 private: | 91 private: |
92 WallpaperManager* wallpaper_manager_; // not owned | 92 WallpaperManager* wallpaper_manager_; // not owned |
93 | 93 |
94 DISALLOW_COPY_AND_ASSIGN(TestApi); | 94 DISALLOW_COPY_AND_ASSIGN(TestApi); |
95 }; | 95 }; |
96 | 96 |
97 class Observer { | 97 class Observer { |
98 public: | 98 public: |
99 virtual ~Observer() {} | 99 virtual ~Observer() {} |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // Registers wallpaper manager preferences. | 182 // Registers wallpaper manager preferences. |
183 static void RegisterPrefs(PrefRegistrySimple* registry); | 183 static void RegisterPrefs(PrefRegistrySimple* registry); |
184 | 184 |
185 // Adds PowerManagerClient, TimeZoneSettings and CrosSettings observers. | 185 // Adds PowerManagerClient, TimeZoneSettings and CrosSettings observers. |
186 void AddObservers(); | 186 void AddObservers(); |
187 | 187 |
188 // Loads wallpaper asynchronously if the current wallpaper is not the | 188 // Loads wallpaper asynchronously if the current wallpaper is not the |
189 // wallpaper of logged in user. | 189 // wallpaper of logged in user. |
190 void EnsureLoggedInUserWallpaperLoaded(); | 190 void EnsureLoggedInUserWallpaperLoaded(); |
191 | 191 |
192 // Clears ONLINE and CUSTOM wallpaper cache. | 192 // Clears disposable ONLINE and CUSTOM wallpaper cache. At multi profile |
193 void ClearWallpaperCache(); | 193 // world, logged in users' wallpaper cache is not disposable. |
| 194 void ClearDisposableWallpaperCache(); |
194 | 195 |
195 // Returns custom wallpaper path. Append |sub_dir|, |user_id_hash| and |file| | 196 // Returns custom wallpaper path. Append |sub_dir|, |user_id_hash| and |file| |
196 // to custom wallpaper directory. | 197 // to custom wallpaper directory. |
197 base::FilePath GetCustomWallpaperPath(const char* sub_dir, | 198 base::FilePath GetCustomWallpaperPath(const char* sub_dir, |
198 const std::string& user_id_hash, | 199 const std::string& user_id_hash, |
199 const std::string& file); | 200 const std::string& file); |
200 | 201 |
201 // Returns filepath to save original custom wallpaper for the given user. | 202 // Returns filepath to save original custom wallpaper for the given user. |
202 base::FilePath GetOriginalWallpaperPathForUser(const std::string& user_id); | 203 base::FilePath GetOriginalWallpaperPathForUser(const std::string& user_id); |
203 | 204 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 274 |
274 // Sets wallpaper to |wallpaper| (asynchronously with zero delay). If | 275 // Sets wallpaper to |wallpaper| (asynchronously with zero delay). If |
275 // |update_wallpaper| is false, skip change wallpaper but only update cache. | 276 // |update_wallpaper| is false, skip change wallpaper but only update cache. |
276 void SetWallpaperFromImageSkia(const std::string& user_id, | 277 void SetWallpaperFromImageSkia(const std::string& user_id, |
277 const gfx::ImageSkia& wallpaper, | 278 const gfx::ImageSkia& wallpaper, |
278 ash::WallpaperLayout layout, | 279 ash::WallpaperLayout layout, |
279 bool update_wallpaper); | 280 bool update_wallpaper); |
280 | 281 |
281 // Updates current wallpaper. It may switch the size of wallpaper based on the | 282 // Updates current wallpaper. It may switch the size of wallpaper based on the |
282 // current display's resolution. (asynchronously with zero delay) | 283 // current display's resolution. (asynchronously with zero delay) |
283 void UpdateWallpaper(); | 284 void UpdateWallpaper(bool clear_cache); |
284 | 285 |
285 // Adds given observer to the list. | 286 // Adds given observer to the list. |
286 void AddObserver(Observer* observer); | 287 void AddObserver(Observer* observer); |
287 | 288 |
288 // Removes given observer from the list. | 289 // Removes given observer from the list. |
289 void RemoveObserver(Observer* observer); | 290 void RemoveObserver(Observer* observer); |
290 | 291 |
291 private: | 292 private: |
292 friend class TestApi; | 293 friend class TestApi; |
293 friend class WallpaperManagerBrowserTest; | 294 friend class WallpaperManagerBrowserTest; |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 // All pending will be finally deleted on destroy. | 496 // All pending will be finally deleted on destroy. |
496 typedef std::vector<scoped_refptr<PendingWallpaper> > PendingList; | 497 typedef std::vector<scoped_refptr<PendingWallpaper> > PendingList; |
497 PendingList loading_; | 498 PendingList loading_; |
498 | 499 |
499 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); | 500 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); |
500 }; | 501 }; |
501 | 502 |
502 } // namespace chromeos | 503 } // namespace chromeos |
503 | 504 |
504 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ | 505 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ |
OLD | NEW |