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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 void SaveLastLoadTime(const base::TimeDelta elapsed); | 473 void SaveLastLoadTime(const base::TimeDelta elapsed); |
473 | 474 |
474 // Notify all registered observers. | 475 // Notify all registered observers. |
475 void NotifyAnimationFinished(); | 476 void NotifyAnimationFinished(); |
476 | 477 |
477 // Returns modifiable PendingWallpaper. | 478 // Returns modifiable PendingWallpaper. |
478 // Returns pending_inactive_ or creates new PendingWallpaper if necessary. | 479 // Returns pending_inactive_ or creates new PendingWallpaper if necessary. |
479 PendingWallpaper* GetPendingWallpaper(const std::string& user_id, | 480 PendingWallpaper* GetPendingWallpaper(const std::string& user_id, |
480 bool delayed); | 481 bool delayed); |
481 | 482 |
| 483 // This is called by PendingWallpaper when load is finished. |
| 484 void RemovePendingWallpaperFromList(PendingWallpaper* pending); |
| 485 |
482 // Calculate delay for next wallpaper load. | 486 // Calculate delay for next wallpaper load. |
483 // It is usually average wallpaper load time. | 487 // It is usually average wallpaper load time. |
484 // If last wallpaper load happened long ago, timeout should be reduced by | 488 // 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 | 489 // the time passed after last wallpaper load. So usual user experience results |
486 // in zero delay. | 490 // in zero delay. |
487 base::TimeDelta GetWallpaperLoadDelay() const; | 491 base::TimeDelta GetWallpaperLoadDelay() const; |
488 | 492 |
489 // This is called after we check that supplied default wallpaper files exist. | 493 // This is called after we check that supplied default wallpaper files exist. |
490 void SetCustomizedDefaultWallpaperAfterCheck( | 494 void SetCustomizedDefaultWallpaperAfterCheck( |
491 const GURL& wallpaper_url, | 495 const GURL& wallpaper_url, |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 | 604 |
601 // Current decoded default image is stored in cache. | 605 // Current decoded default image is stored in cache. |
602 scoped_ptr<UserImage> default_wallpaper_image_; | 606 scoped_ptr<UserImage> default_wallpaper_image_; |
603 | 607 |
604 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); | 608 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); |
605 }; | 609 }; |
606 | 610 |
607 } // namespace chromeos | 611 } // namespace chromeos |
608 | 612 |
609 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ | 613 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ |
OLD | NEW |