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 // Returns modifiable PendingWallpaper. | 130 // Returns modifiable PendingWallpaper. |
125 // Returns pending_inactive_ or creates new PendingWallpaper if necessary. | 131 // Returns pending_inactive_ or creates new PendingWallpaper if necessary. |
126 PendingWallpaper* GetPendingWallpaper(const std::string& user_id, | 132 PendingWallpaper* GetPendingWallpaper(const std::string& user_id, |
127 bool delayed); | 133 bool delayed); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 typedef std::vector<scoped_refptr<PendingWallpaper> > PendingList; | 193 typedef std::vector<scoped_refptr<PendingWallpaper> > PendingList; |
188 PendingList loading_; | 194 PendingList loading_; |
189 | 195 |
190 base::WeakPtrFactory<WallpaperManager> weak_factory_; | 196 base::WeakPtrFactory<WallpaperManager> weak_factory_; |
191 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); | 197 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); |
192 }; | 198 }; |
193 | 199 |
194 } // namespace chromeos | 200 } // namespace chromeos |
195 | 201 |
196 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_WALLPAPER_WALLPAPER_MANAGER_H_ | 202 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_WALLPAPER_WALLPAPER_MANAGER_H_ |
OLD | NEW |