OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 ASH_WALLPAPER_WALLPAPER_CONTROLLER_H_ | 5 #ifndef ASH_COMMON_WALLPAPER_WALLPAPER_CONTROLLER_H_ |
6 #define ASH_WALLPAPER_WALLPAPER_CONTROLLER_H_ | 6 #define ASH_COMMON_WALLPAPER_WALLPAPER_CONTROLLER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
11 #include "ash/common/shell_observer.h" | 11 #include "ash/common/shell_observer.h" |
12 #include "ash/common/wm_display_observer.h" | 12 #include "ash/common/wm_display_observer.h" |
| 13 #include "base/memory/ref_counted.h" |
13 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
14 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
15 #include "components/wallpaper/wallpaper_layout.h" | 16 #include "components/wallpaper/wallpaper_layout.h" |
16 #include "ui/gfx/image/image_skia.h" | 17 #include "ui/gfx/image/image_skia.h" |
17 | 18 |
18 namespace base { | 19 namespace base { |
19 class SequencedWorkerPool; | 20 class TaskRunner; |
20 } | 21 } |
21 | 22 |
22 namespace wallpaper { | 23 namespace wallpaper { |
23 class WallpaperResizer; | 24 class WallpaperResizer; |
24 } | 25 } |
25 | 26 |
26 namespace ash { | 27 namespace ash { |
27 | 28 |
28 class WallpaperControllerObserver; | 29 class WallpaperControllerObserver; |
29 | 30 |
30 // Controls the desktop background wallpaper. | 31 // Controls the desktop background wallpaper. |
31 class ASH_EXPORT WallpaperController : public WmDisplayObserver, | 32 class ASH_EXPORT WallpaperController : public WmDisplayObserver, |
32 public ShellObserver { | 33 public ShellObserver { |
33 public: | 34 public: |
34 enum WallpaperMode { WALLPAPER_NONE, WALLPAPER_IMAGE }; | 35 enum WallpaperMode { WALLPAPER_NONE, WALLPAPER_IMAGE }; |
35 | 36 |
36 explicit WallpaperController(base::SequencedWorkerPool* blocking_pool); | 37 explicit WallpaperController( |
| 38 const scoped_refptr<base::TaskRunner>& task_runner); |
37 ~WallpaperController() override; | 39 ~WallpaperController() override; |
38 | 40 |
39 // Add/Remove observers. | 41 // Add/Remove observers. |
40 void AddObserver(WallpaperControllerObserver* observer); | 42 void AddObserver(WallpaperControllerObserver* observer); |
41 void RemoveObserver(WallpaperControllerObserver* observer); | 43 void RemoveObserver(WallpaperControllerObserver* observer); |
42 | 44 |
43 // Provides current image on the wallpaper, or empty gfx::ImageSkia if there | 45 // Provides current image on the wallpaper, or empty gfx::ImageSkia if there |
44 // is no image, e.g. wallpaper is none. | 46 // is no image, e.g. wallpaper is none. |
45 gfx::ImageSkia GetWallpaper() const; | 47 gfx::ImageSkia GetWallpaper() const; |
46 | 48 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 base::ObserverList<WallpaperControllerObserver> observers_; | 119 base::ObserverList<WallpaperControllerObserver> observers_; |
118 | 120 |
119 std::unique_ptr<wallpaper::WallpaperResizer> current_wallpaper_; | 121 std::unique_ptr<wallpaper::WallpaperResizer> current_wallpaper_; |
120 | 122 |
121 gfx::Size current_max_display_size_; | 123 gfx::Size current_max_display_size_; |
122 | 124 |
123 base::OneShotTimer timer_; | 125 base::OneShotTimer timer_; |
124 | 126 |
125 int wallpaper_reload_delay_; | 127 int wallpaper_reload_delay_; |
126 | 128 |
127 base::SequencedWorkerPool* blocking_pool_; | 129 scoped_refptr<base::TaskRunner> task_runner_; |
128 | 130 |
129 DISALLOW_COPY_AND_ASSIGN(WallpaperController); | 131 DISALLOW_COPY_AND_ASSIGN(WallpaperController); |
130 }; | 132 }; |
131 | 133 |
132 } // namespace ash | 134 } // namespace ash |
133 | 135 |
134 #endif // ASH_WALLPAPER_WALLPAPER_CONTROLLER_H_ | 136 #endif // ASH_COMMON_WALLPAPER_WALLPAPER_CONTROLLER_H_ |
OLD | NEW |