| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_USERS_WALLPAPER_WALLPAPER_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USERS_WALLPAPER_WALLPAPER_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_WALLPAPER_WALLPAPER_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_WALLPAPER_WALLPAPER_MANAGER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "ui/gfx/image/image_skia.h" | 30 #include "ui/gfx/image/image_skia.h" |
| 31 | 31 |
| 32 namespace chromeos { | 32 namespace chromeos { |
| 33 | 33 |
| 34 class WallpaperManager : | 34 class WallpaperManager : |
| 35 public wallpaper::WallpaperManagerBase, | 35 public wallpaper::WallpaperManagerBase, |
| 36 public user_manager::UserManager::UserSessionStateObserver { | 36 public user_manager::UserManager::UserSessionStateObserver { |
| 37 public: | 37 public: |
| 38 class PendingWallpaper; | 38 class PendingWallpaper; |
| 39 | 39 |
| 40 WallpaperManager(); | |
| 41 ~WallpaperManager() override; | 40 ~WallpaperManager() override; |
| 42 | 41 |
| 43 // Get pointer to singleton WallpaperManager instance, create it if necessary. | 42 // Get pointer to singleton WallpaperManager instance, create it if necessary. |
| 44 static WallpaperManager* Get(); | 43 static WallpaperManager* Get(); |
| 45 | 44 |
| 45 // Indicates imminent shutdown, allowing the WallpaperManager to remove any |
| 46 // observers it has registered. |
| 47 static void Shutdown(); |
| 48 |
| 46 // Returns the appropriate wallpaper resolution for all root windows. | 49 // Returns the appropriate wallpaper resolution for all root windows. |
| 47 WallpaperResolution GetAppropriateResolution() override; | 50 WallpaperResolution GetAppropriateResolution() override; |
| 48 | 51 |
| 49 // Indicates imminent shutdown, allowing the WallpaperManager to remove any | |
| 50 // observers it has registered. | |
| 51 void Shutdown() override; | |
| 52 | |
| 53 // Adds PowerManagerClient, TimeZoneSettings and CrosSettings observers. | 52 // Adds PowerManagerClient, TimeZoneSettings and CrosSettings observers. |
| 54 void AddObservers() override; | 53 void AddObservers() override; |
| 55 | 54 |
| 56 // Loads wallpaper asynchronously if the current wallpaper is not the | 55 // Loads wallpaper asynchronously if the current wallpaper is not the |
| 57 // wallpaper of logged in user. | 56 // wallpaper of logged in user. |
| 58 void EnsureLoggedInUserWallpaperLoaded() override; | 57 void EnsureLoggedInUserWallpaperLoaded() override; |
| 59 | 58 |
| 60 // Initializes wallpaper. If logged in, loads user's wallpaper. If not logged | 59 // Initializes wallpaper. If logged in, loads user's wallpaper. If not logged |
| 61 // in, uses a solid color wallpaper. If logged in as a stub user, uses an | 60 // in, uses a solid color wallpaper. If logged in as a stub user, uses an |
| 62 // empty wallpaper. | 61 // empty wallpaper. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 119 |
| 121 // Overridden from user_manager::UserManager::UserSessionStateObserver: | 120 // Overridden from user_manager::UserManager::UserSessionStateObserver: |
| 122 void UserChangedChildStatus(user_manager::User* user) override; | 121 void UserChangedChildStatus(user_manager::User* user) override; |
| 123 | 122 |
| 124 private: | 123 private: |
| 125 friend class TestApi; | 124 friend class TestApi; |
| 126 friend class WallpaperManagerBrowserTest; | 125 friend class WallpaperManagerBrowserTest; |
| 127 friend class WallpaperManagerBrowserTestDefaultWallpaper; | 126 friend class WallpaperManagerBrowserTestDefaultWallpaper; |
| 128 friend class WallpaperManagerPolicyTest; | 127 friend class WallpaperManagerPolicyTest; |
| 129 | 128 |
| 129 WallpaperManager(); |
| 130 |
| 130 // Returns modifiable PendingWallpaper. | 131 // Returns modifiable PendingWallpaper. |
| 131 // Returns pending_inactive_ or creates new PendingWallpaper if necessary. | 132 // Returns pending_inactive_ or creates new PendingWallpaper if necessary. |
| 132 PendingWallpaper* GetPendingWallpaper(const std::string& user_id, | 133 PendingWallpaper* GetPendingWallpaper(const std::string& user_id, |
| 133 bool delayed); | 134 bool delayed); |
| 134 | 135 |
| 135 // This is called by PendingWallpaper when load is finished. | 136 // This is called by PendingWallpaper when load is finished. |
| 136 void RemovePendingWallpaperFromList(PendingWallpaper* pending); | 137 void RemovePendingWallpaperFromList(PendingWallpaper* pending); |
| 137 | 138 |
| 138 // WallpaperManagerBase overrides: | 139 // WallpaperManagerBase overrides: |
| 139 void ClearObsoleteWallpaperPrefs() override; | 140 void ClearObsoleteWallpaperPrefs() override; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 typedef std::vector<scoped_refptr<PendingWallpaper> > PendingList; | 194 typedef std::vector<scoped_refptr<PendingWallpaper> > PendingList; |
| 194 PendingList loading_; | 195 PendingList loading_; |
| 195 | 196 |
| 196 base::WeakPtrFactory<WallpaperManager> weak_factory_; | 197 base::WeakPtrFactory<WallpaperManager> weak_factory_; |
| 197 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); | 198 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); |
| 198 }; | 199 }; |
| 199 | 200 |
| 200 } // namespace chromeos | 201 } // namespace chromeos |
| 201 | 202 |
| 202 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_WALLPAPER_WALLPAPER_MANAGER_H_ | 203 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_WALLPAPER_WALLPAPER_MANAGER_H_ |
| OLD | NEW |