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