| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 // Enable surprise me wallpaper mode. | 337 // Enable surprise me wallpaper mode. |
| 337 void EnableSurpriseMe(); | 338 void EnableSurpriseMe(); |
| 338 | 339 |
| 339 // This is called from CustomizationDocument. | 340 // This is called from CustomizationDocument. |
| 340 // |resized_directory| is the directory where resized versions are stored and | 341 // |resized_directory| is the directory where resized versions are stored and |
| 341 // must be writable. | 342 // must be writable. |
| 342 void SetCustomizedDefaultWallpaper(const GURL& wallpaper_url, | 343 void SetCustomizedDefaultWallpaper(const GURL& wallpaper_url, |
| 343 const base::FilePath& downloaded_file, | 344 const base::FilePath& downloaded_file, |
| 344 const base::FilePath& resized_directory); | 345 const base::FilePath& resized_directory); |
| 345 | 346 |
| 347 // Returns queue size. |
| 348 size_t GetPendingListSizeForTesting() const; |
| 349 |
| 346 private: | 350 private: |
| 347 friend class TestApi; | 351 friend class TestApi; |
| 348 friend class WallpaperManagerBrowserTest; | 352 friend class WallpaperManagerBrowserTest; |
| 349 friend class WallpaperManagerBrowserTestDefaultWallpaper; | 353 friend class WallpaperManagerBrowserTestDefaultWallpaper; |
| 350 friend class WallpaperManagerPolicyTest; | 354 friend class WallpaperManagerPolicyTest; |
| 351 | 355 |
| 352 typedef std::map<std::string, gfx::ImageSkia> CustomWallpaperMap; | 356 typedef std::map<std::string, gfx::ImageSkia> CustomWallpaperMap; |
| 353 | 357 |
| 354 // Initialize wallpaper for the specified user to default and saves this | 358 // Initialize wallpaper for the specified user to default and saves this |
| 355 // settings in local state. | 359 // settings in local state. |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 void SaveLastLoadTime(const base::TimeDelta elapsed); | 479 void SaveLastLoadTime(const base::TimeDelta elapsed); |
| 476 | 480 |
| 477 // Notify all registered observers. | 481 // Notify all registered observers. |
| 478 void NotifyAnimationFinished(); | 482 void NotifyAnimationFinished(); |
| 479 | 483 |
| 480 // Returns modifiable PendingWallpaper. | 484 // Returns modifiable PendingWallpaper. |
| 481 // Returns pending_inactive_ or creates new PendingWallpaper if necessary. | 485 // Returns pending_inactive_ or creates new PendingWallpaper if necessary. |
| 482 PendingWallpaper* GetPendingWallpaper(const std::string& user_id, | 486 PendingWallpaper* GetPendingWallpaper(const std::string& user_id, |
| 483 bool delayed); | 487 bool delayed); |
| 484 | 488 |
| 489 // This is called by PendingWallpaper when load is finished. |
| 490 void RemovePendingWallpaperFromList(PendingWallpaper* pending); |
| 491 |
| 485 // Calculate delay for next wallpaper load. | 492 // Calculate delay for next wallpaper load. |
| 486 // It is usually average wallpaper load time. | 493 // It is usually average wallpaper load time. |
| 487 // If last wallpaper load happened long ago, timeout should be reduced by | 494 // If last wallpaper load happened long ago, timeout should be reduced by |
| 488 // the time passed after last wallpaper load. So usual user experience results | 495 // the time passed after last wallpaper load. So usual user experience results |
| 489 // in zero delay. | 496 // in zero delay. |
| 490 base::TimeDelta GetWallpaperLoadDelay() const; | 497 base::TimeDelta GetWallpaperLoadDelay() const; |
| 491 | 498 |
| 492 // This is called after we check that supplied default wallpaper files exist. | 499 // This is called after we check that supplied default wallpaper files exist. |
| 493 void SetCustomizedDefaultWallpaperAfterCheck( | 500 void SetCustomizedDefaultWallpaperAfterCheck( |
| 494 const GURL& wallpaper_url, | 501 const GURL& wallpaper_url, |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 | 610 |
| 604 // Current decoded default image is stored in cache. | 611 // Current decoded default image is stored in cache. |
| 605 scoped_ptr<UserImage> default_wallpaper_image_; | 612 scoped_ptr<UserImage> default_wallpaper_image_; |
| 606 | 613 |
| 607 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); | 614 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); |
| 608 }; | 615 }; |
| 609 | 616 |
| 610 } // namespace chromeos | 617 } // namespace chromeos |
| 611 | 618 |
| 612 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ | 619 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ |
| OLD | NEW |