| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 // This should be public to allow access from functions in anonymous | 115 // This should be public to allow access from functions in anonymous |
| 116 // namespace. | 116 // namespace. |
| 117 class CustomizedWallpaperRescaledFiles; | 117 class CustomizedWallpaperRescaledFiles; |
| 118 | 118 |
| 119 class Observer { | 119 class Observer { |
| 120 public: | 120 public: |
| 121 virtual ~Observer() {} | 121 virtual ~Observer() {} |
| 122 virtual void OnWallpaperAnimationFinished(const std::string& user_id) = 0; | 122 virtual void OnWallpaperAnimationFinished(const std::string& user_id) = 0; |
| 123 virtual void OnUpdateWallpaperForTesting() {} | 123 virtual void OnUpdateWallpaperForTesting() {} |
| 124 virtual void OnPendingListEmptyForTesting() {} |
| 124 }; | 125 }; |
| 125 | 126 |
| 126 // This is "wallpaper either scheduled to load, or loading right now". | 127 // This is "wallpaper either scheduled to load, or loading right now". |
| 127 // | 128 // |
| 128 // While enqueued, it defines moment in the future, when it will be loaded. | 129 // While enqueued, it defines moment in the future, when it will be loaded. |
| 129 // Enqueued but not started request might be updated by subsequent load | 130 // Enqueued but not started request might be updated by subsequent load |
| 130 // request. Therefore it's created empty, and updated being enqueued. | 131 // request. Therefore it's created empty, and updated being enqueued. |
| 131 // | 132 // |
| 132 // PendingWallpaper is owned by WallpaperManager, but reference to this object | 133 // PendingWallpaper is owned by WallpaperManager, but reference to this object |
| 133 // is passed to other threads by PostTask() calls, therefore it is | 134 // is passed to other threads by PostTask() calls, therefore it is |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 // must be writable. | 339 // must be writable. |
| 339 void SetCustomizedDefaultWallpaper(const GURL& wallpaper_url, | 340 void SetCustomizedDefaultWallpaper(const GURL& wallpaper_url, |
| 340 const base::FilePath& downloaded_file, | 341 const base::FilePath& downloaded_file, |
| 341 const base::FilePath& resized_directory); | 342 const base::FilePath& resized_directory); |
| 342 | 343 |
| 343 private: | 344 private: |
| 344 friend class TestApi; | 345 friend class TestApi; |
| 345 friend class WallpaperManagerBrowserTest; | 346 friend class WallpaperManagerBrowserTest; |
| 346 friend class WallpaperManagerBrowserTestDefaultWallpaper; | 347 friend class WallpaperManagerBrowserTestDefaultWallpaper; |
| 347 friend class WallpaperManagerPolicyTest; | 348 friend class WallpaperManagerPolicyTest; |
| 349 friend class WallpaperManagerTestUtils; |
| 348 | 350 |
| 349 typedef std::map<std::string, gfx::ImageSkia> CustomWallpaperMap; | 351 typedef std::map<std::string, gfx::ImageSkia> CustomWallpaperMap; |
| 350 | 352 |
| 351 // Initialize wallpaper for the specified user to default and saves this | 353 // Initialize wallpaper for the specified user to default and saves this |
| 352 // settings in local state. | 354 // settings in local state. |
| 353 void InitInitialUserWallpaper(const std::string& user_id, bool is_persistent); | 355 void InitInitialUserWallpaper(const std::string& user_id, bool is_persistent); |
| 354 | 356 |
| 355 // Set wallpaper to |user_image| controlled by policy. (Takes a UserImage | 357 // Set wallpaper to |user_image| controlled by policy. (Takes a UserImage |
| 356 // because that's the callback interface provided by UserImageLoader.) | 358 // because that's the callback interface provided by UserImageLoader.) |
| 357 void SetPolicyControlledWallpaper(const std::string& user_id, | 359 void SetPolicyControlledWallpaper(const std::string& user_id, |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 void SaveLastLoadTime(const base::TimeDelta elapsed); | 474 void SaveLastLoadTime(const base::TimeDelta elapsed); |
| 473 | 475 |
| 474 // Notify all registered observers. | 476 // Notify all registered observers. |
| 475 void NotifyAnimationFinished(); | 477 void NotifyAnimationFinished(); |
| 476 | 478 |
| 477 // Returns modifiable PendingWallpaper. | 479 // Returns modifiable PendingWallpaper. |
| 478 // Returns pending_inactive_ or creates new PendingWallpaper if necessary. | 480 // Returns pending_inactive_ or creates new PendingWallpaper if necessary. |
| 479 PendingWallpaper* GetPendingWallpaper(const std::string& user_id, | 481 PendingWallpaper* GetPendingWallpaper(const std::string& user_id, |
| 480 bool delayed); | 482 bool delayed); |
| 481 | 483 |
| 484 // This is called by PendingWallpaper when load is finished. |
| 485 void RemovePendingWallpaperFromList(PendingWallpaper* pending); |
| 486 |
| 482 // Calculate delay for next wallpaper load. | 487 // Calculate delay for next wallpaper load. |
| 483 // It is usually average wallpaper load time. | 488 // It is usually average wallpaper load time. |
| 484 // If last wallpaper load happened long ago, timeout should be reduced by | 489 // If last wallpaper load happened long ago, timeout should be reduced by |
| 485 // the time passed after last wallpaper load. So usual user experience results | 490 // the time passed after last wallpaper load. So usual user experience results |
| 486 // in zero delay. | 491 // in zero delay. |
| 487 base::TimeDelta GetWallpaperLoadDelay() const; | 492 base::TimeDelta GetWallpaperLoadDelay() const; |
| 488 | 493 |
| 489 // This is called after we check that supplied default wallpaper files exist. | 494 // This is called after we check that supplied default wallpaper files exist. |
| 490 void SetCustomizedDefaultWallpaperAfterCheck( | 495 void SetCustomizedDefaultWallpaperAfterCheck( |
| 491 const GURL& wallpaper_url, | 496 const GURL& wallpaper_url, |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 | 605 |
| 601 // Current decoded default image is stored in cache. | 606 // Current decoded default image is stored in cache. |
| 602 scoped_ptr<UserImage> default_wallpaper_image_; | 607 scoped_ptr<UserImage> default_wallpaper_image_; |
| 603 | 608 |
| 604 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); | 609 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); |
| 605 }; | 610 }; |
| 606 | 611 |
| 607 } // namespace chromeos | 612 } // namespace chromeos |
| 608 | 613 |
| 609 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ | 614 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ |
| OLD | NEW |