| 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> |
| 11 | 11 |
| 12 #include "ash/desktop_background/desktop_background_controller.h" | 12 #include "ash/desktop_background/desktop_background_controller.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/memory/ref_counted_memory.h" | 14 #include "base/memory/ref_counted_memory.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
| 18 #include "base/threading/sequenced_worker_pool.h" | 18 #include "base/threading/sequenced_worker_pool.h" |
| 19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 20 #include "chrome/browser/chromeos/login/users/avatar/user_image_loader.h" | 20 #include "chrome/browser/chromeos/login/users/avatar/user_image_loader.h" |
| 21 #include "chrome/browser/chromeos/settings/cros_settings.h" | 21 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 22 #include "components/user_manager/user.h" | 22 #include "components/user_manager/user.h" |
| 23 #include "components/user_manager/user_image/user_image.h" | 23 #include "components/user_manager/user_image/user_image.h" |
| 24 #include "components/user_manager/user_manager.h" |
| 24 #include "components/wallpaper/wallpaper_layout.h" | 25 #include "components/wallpaper/wallpaper_layout.h" |
| 25 #include "components/wallpaper/wallpaper_manager_base.h" | 26 #include "components/wallpaper/wallpaper_manager_base.h" |
| 26 #include "content/public/browser/notification_observer.h" | 27 #include "content/public/browser/notification_observer.h" |
| 27 #include "content/public/browser/notification_registrar.h" | 28 #include "content/public/browser/notification_registrar.h" |
| 28 #include "third_party/icu/source/i18n/unicode/timezone.h" | 29 #include "third_party/icu/source/i18n/unicode/timezone.h" |
| 29 #include "ui/gfx/image/image_skia.h" | 30 #include "ui/gfx/image/image_skia.h" |
| 30 | 31 |
| 31 namespace chromeos { | 32 namespace chromeos { |
| 32 | 33 |
| 33 class WallpaperManager : public wallpaper::WallpaperManagerBase { | 34 class WallpaperManager : |
| 35 public wallpaper::WallpaperManagerBase, |
| 36 public user_manager::UserManager::UserSessionStateObserver { |
| 34 public: | 37 public: |
| 35 class PendingWallpaper; | 38 class PendingWallpaper; |
| 36 | 39 |
| 37 WallpaperManager(); | 40 WallpaperManager(); |
| 38 ~WallpaperManager() override; | 41 ~WallpaperManager() override; |
| 39 | 42 |
| 40 // Get pointer to singleton WallpaperManager instance, create it if necessary. | 43 // Get pointer to singleton WallpaperManager instance, create it if necessary. |
| 41 static WallpaperManager* Get(); | 44 static WallpaperManager* Get(); |
| 42 | 45 |
| 43 // Returns the appropriate wallpaper resolution for all root windows. | 46 // Returns the appropriate wallpaper resolution for all root windows. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // Sets wallpaper to |image| (asynchronously with zero delay). If | 111 // Sets wallpaper to |image| (asynchronously with zero delay). If |
| 109 // |update_wallpaper| is false, skip change wallpaper but only update cache. | 112 // |update_wallpaper| is false, skip change wallpaper but only update cache. |
| 110 void SetWallpaperFromImageSkia(const std::string& user_id, | 113 void SetWallpaperFromImageSkia(const std::string& user_id, |
| 111 const gfx::ImageSkia& image, | 114 const gfx::ImageSkia& image, |
| 112 wallpaper::WallpaperLayout layout, | 115 wallpaper::WallpaperLayout layout, |
| 113 bool update_wallpaper) override; | 116 bool update_wallpaper) override; |
| 114 | 117 |
| 115 // Returns queue size. | 118 // Returns queue size. |
| 116 size_t GetPendingListSizeForTesting() const override; | 119 size_t GetPendingListSizeForTesting() const override; |
| 117 | 120 |
| 121 // Overridden from user_manager::UserManager::UserSessionStateObserver: |
| 122 void UserChangedChildStatus(user_manager::User* user) override; |
| 123 |
| 118 private: | 124 private: |
| 119 friend class TestApi; | 125 friend class TestApi; |
| 120 friend class WallpaperManagerBrowserTest; | 126 friend class WallpaperManagerBrowserTest; |
| 121 friend class WallpaperManagerBrowserTestDefaultWallpaper; | 127 friend class WallpaperManagerBrowserTestDefaultWallpaper; |
| 122 friend class WallpaperManagerPolicyTest; | 128 friend class WallpaperManagerPolicyTest; |
| 123 | 129 |
| 124 // Clears all obsolete wallpaper prefs from old version wallpaper pickers. | 130 // Clears all obsolete wallpaper prefs from old version wallpaper pickers. |
| 125 void ClearObsoleteWallpaperPrefs() override; | 131 void ClearObsoleteWallpaperPrefs() override; |
| 126 | 132 |
| 127 // Initialize wallpaper of registered device after device policy is trusted. | 133 // Initialize wallpaper of registered device after device policy is trusted. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 typedef std::vector<scoped_refptr<PendingWallpaper> > PendingList; | 221 typedef std::vector<scoped_refptr<PendingWallpaper> > PendingList; |
| 216 PendingList loading_; | 222 PendingList loading_; |
| 217 | 223 |
| 218 base::WeakPtrFactory<WallpaperManager> weak_factory_; | 224 base::WeakPtrFactory<WallpaperManager> weak_factory_; |
| 219 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); | 225 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); |
| 220 }; | 226 }; |
| 221 | 227 |
| 222 } // namespace chromeos | 228 } // namespace chromeos |
| 223 | 229 |
| 224 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_WALLPAPER_WALLPAPER_MANAGER_H_ | 230 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_WALLPAPER_WALLPAPER_MANAGER_H_ |
| OLD | NEW |