| 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_COMMON_WALLPAPER_WALLPAPER_CONTROLLER_H_ | 5 #ifndef ASH_COMMON_WALLPAPER_WALLPAPER_CONTROLLER_H_ |
| 6 #define ASH_COMMON_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 "ash/public/interfaces/wallpaper.mojom.h" | 13 #include "ash/public/interfaces/wallpaper.mojom.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
| 17 #include "base/timer/timer.h" | 17 #include "base/timer/timer.h" |
| 18 #include "components/wallpaper/wallpaper_color_calculator_observer.h" | 18 #include "components/wallpaper/wallpaper_color_calculator_observer.h" |
| 19 #include "components/wallpaper/wallpaper_layout.h" | 19 #include "components/wallpaper/wallpaper_layout.h" |
| 20 #include "components/wallpaper/wallpaper_resizer_observer.h" | 20 #include "components/wallpaper/wallpaper_resizer_observer.h" |
| 21 #include "mojo/public/cpp/bindings/binding_set.h" | 21 #include "mojo/public/cpp/bindings/binding_set.h" |
| 22 #include "ui/gfx/color_analysis.h" | 22 #include "ui/gfx/color_analysis.h" |
| 23 #include "ui/gfx/image/image_skia.h" | 23 #include "ui/gfx/image/image_skia.h" |
| 24 | |
| 25 namespace base { | 24 namespace base { |
| 26 class TaskRunner; | 25 class TaskRunner; |
| 27 } | 26 } |
| 28 | 27 |
| 29 namespace wallpaper { | 28 namespace wallpaper { |
| 29 class WallpaperColorCache; |
| 30 class WallpaperColorCalculator; | 30 class WallpaperColorCalculator; |
| 31 class WallpaperResizer; | 31 class WallpaperResizer; |
| 32 } | 32 } |
| 33 | 33 |
| 34 namespace ash { | 34 namespace ash { |
| 35 | 35 |
| 36 class WallpaperControllerObserver; | 36 class WallpaperControllerObserver; |
| 37 | 37 |
| 38 // Controls the desktop background wallpaper. | 38 // Controls the desktop background wallpaper. |
| 39 class ASH_EXPORT WallpaperController | 39 class ASH_EXPORT WallpaperController |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 bool compare_layouts, | 104 bool compare_layouts, |
| 105 wallpaper::WallpaperLayout layout) const; | 105 wallpaper::WallpaperLayout layout) const; |
| 106 | 106 |
| 107 void set_wallpaper_reload_delay_for_test(int value) { | 107 void set_wallpaper_reload_delay_for_test(int value) { |
| 108 wallpaper_reload_delay_ = value; | 108 wallpaper_reload_delay_ = value; |
| 109 } | 109 } |
| 110 | 110 |
| 111 // Opens the set wallpaper page in the browser. | 111 // Opens the set wallpaper page in the browser. |
| 112 void OpenSetWallpaperPage(); | 112 void OpenSetWallpaperPage(); |
| 113 | 113 |
| 114 // TODO(bruthig) Document me. |
| 115 void SetWallpaperColorCache(wallpaper::WallpaperColorCache* color_cache); |
| 116 |
| 114 // mojom::WallpaperController overrides: | 117 // mojom::WallpaperController overrides: |
| 115 void SetWallpaperPicker(mojom::WallpaperPickerPtr picker) override; | 118 void SetWallpaperPicker(mojom::WallpaperPickerPtr picker) override; |
| 119 // TODO(bruthig): Add an std::string |image_id| field. |
| 116 void SetWallpaper(const SkBitmap& wallpaper, | 120 void SetWallpaper(const SkBitmap& wallpaper, |
| 117 wallpaper::WallpaperLayout layout) override; | 121 wallpaper::WallpaperLayout layout) override; |
| 118 | 122 |
| 119 // WallpaperResizerObserver: | 123 // WallpaperResizerObserver: |
| 120 void OnWallpaperResized() override; | 124 void OnWallpaperResized() override; |
| 121 | 125 |
| 122 // WallpaperColorCalculatorObserver: | 126 // WallpaperColorCalculatorObserver: |
| 123 void OnColorCalculationComplete() override; | 127 void OnColorCalculationComplete() override; |
| 124 | 128 |
| 125 private: | 129 private: |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // Bindings for the WallpaperController interface. | 167 // Bindings for the WallpaperController interface. |
| 164 mojo::BindingSet<mojom::WallpaperController> bindings_; | 168 mojo::BindingSet<mojom::WallpaperController> bindings_; |
| 165 | 169 |
| 166 base::ObserverList<WallpaperControllerObserver> observers_; | 170 base::ObserverList<WallpaperControllerObserver> observers_; |
| 167 | 171 |
| 168 std::unique_ptr<wallpaper::WallpaperResizer> current_wallpaper_; | 172 std::unique_ptr<wallpaper::WallpaperResizer> current_wallpaper_; |
| 169 | 173 |
| 170 // Asynchronous task to extract colors from the wallpaper. | 174 // Asynchronous task to extract colors from the wallpaper. |
| 171 std::unique_ptr<wallpaper::WallpaperColorCalculator> color_calculator_; | 175 std::unique_ptr<wallpaper::WallpaperColorCalculator> color_calculator_; |
| 172 | 176 |
| 177 // TODO(bruthig) Document me. |
| 178 wallpaper::WallpaperColorCache* color_cache_; |
| 179 |
| 173 // The prominent color extracted from the current wallpaper. | 180 // The prominent color extracted from the current wallpaper. |
| 174 // SK_ColorTRANSPARENT is used by default or if extracting colors fails. | 181 // SK_ColorTRANSPARENT is used by default or if extracting colors fails. |
| 175 SkColor prominent_color_; | 182 SkColor prominent_color_; |
| 176 | 183 |
| 177 gfx::Size current_max_display_size_; | 184 gfx::Size current_max_display_size_; |
| 178 | 185 |
| 179 base::OneShotTimer timer_; | 186 base::OneShotTimer timer_; |
| 180 | 187 |
| 181 int wallpaper_reload_delay_; | 188 int wallpaper_reload_delay_; |
| 182 | 189 |
| 183 scoped_refptr<base::TaskRunner> task_runner_; | 190 scoped_refptr<base::TaskRunner> task_runner_; |
| 184 | 191 |
| 185 DISALLOW_COPY_AND_ASSIGN(WallpaperController); | 192 DISALLOW_COPY_AND_ASSIGN(WallpaperController); |
| 186 }; | 193 }; |
| 187 | 194 |
| 188 } // namespace ash | 195 } // namespace ash |
| 189 | 196 |
| 190 #endif // ASH_COMMON_WALLPAPER_WALLPAPER_CONTROLLER_H_ | 197 #endif // ASH_COMMON_WALLPAPER_WALLPAPER_CONTROLLER_H_ |
| OLD | NEW |