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 #include "ash/common/wallpaper/wallpaper_controller.h" | 5 #include "ash/common/wallpaper/wallpaper_controller.h" |
6 | 6 |
7 #include "ash/common/wallpaper/wallpaper_controller_observer.h" | 7 #include "ash/common/wallpaper/wallpaper_controller_observer.h" |
8 #include "ash/common/wallpaper/wallpaper_delegate.h" | 8 #include "ash/common/wallpaper/wallpaper_delegate.h" |
9 #include "ash/common/wallpaper/wallpaper_view.h" | 9 #include "ash/common/wallpaper/wallpaper_view.h" |
10 #include "ash/common/wallpaper/wallpaper_widget_controller.h" | 10 #include "ash/common/wallpaper/wallpaper_widget_controller.h" |
11 #include "ash/common/wm_root_window_controller.h" | |
12 #include "ash/common/wm_shell.h" | 11 #include "ash/common/wm_shell.h" |
13 #include "ash/common/wm_window.h" | 12 #include "ash/common/wm_window.h" |
14 #include "ash/public/cpp/shell_window_ids.h" | 13 #include "ash/public/cpp/shell_window_ids.h" |
| 14 #include "ash/root_window_controller.h" |
15 #include "base/bind.h" | 15 #include "base/bind.h" |
16 #include "base/logging.h" | 16 #include "base/logging.h" |
17 #include "base/task_runner.h" | 17 #include "base/task_runner.h" |
18 #include "components/wallpaper/wallpaper_resizer.h" | 18 #include "components/wallpaper/wallpaper_resizer.h" |
19 #include "ui/display/manager/managed_display_info.h" | 19 #include "ui/display/manager/managed_display_info.h" |
20 #include "ui/display/screen.h" | 20 #include "ui/display/screen.h" |
21 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
22 | 22 |
23 namespace ash { | 23 namespace ash { |
24 namespace { | 24 namespace { |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 case WALLPAPER_IMAGE: { | 213 case WALLPAPER_IMAGE: { |
214 component = new WallpaperWidgetController( | 214 component = new WallpaperWidgetController( |
215 CreateWallpaper(root_window, container_id)); | 215 CreateWallpaper(root_window, container_id)); |
216 break; | 216 break; |
217 } | 217 } |
218 case WALLPAPER_NONE: | 218 case WALLPAPER_NONE: |
219 NOTREACHED(); | 219 NOTREACHED(); |
220 return; | 220 return; |
221 } | 221 } |
222 | 222 |
223 WmRootWindowController* controller = root_window->GetRootWindowController(); | 223 RootWindowController* controller = root_window->GetRootWindowController(); |
224 controller->SetAnimatingWallpaperWidgetController( | 224 controller->SetAnimatingWallpaperWidgetController( |
225 new AnimatingWallpaperWidgetController(component)); | 225 new AnimatingWallpaperWidgetController(component)); |
226 component->StartAnimating(controller); | 226 component->StartAnimating(controller); |
227 } | 227 } |
228 | 228 |
229 void WallpaperController::InstallDesktopControllerForAllWindows() { | 229 void WallpaperController::InstallDesktopControllerForAllWindows() { |
230 for (WmWindow* root : WmShell::Get()->GetAllRootWindows()) | 230 for (WmWindow* root : WmShell::Get()->GetAllRootWindows()) |
231 InstallDesktopController(root); | 231 InstallDesktopController(root); |
232 current_max_display_size_ = GetMaxDisplaySizeInNative(); | 232 current_max_display_size_ = GetMaxDisplaySizeInNative(); |
233 } | 233 } |
234 | 234 |
235 bool WallpaperController::ReparentWallpaper(int container) { | 235 bool WallpaperController::ReparentWallpaper(int container) { |
236 bool moved = false; | 236 bool moved = false; |
237 for (WmWindow* root_window : WmShell::Get()->GetAllRootWindows()) { | 237 for (WmWindow* root_window : WmShell::Get()->GetAllRootWindows()) { |
238 WmRootWindowController* root_window_controller = | 238 RootWindowController* root_window_controller = |
239 root_window->GetRootWindowController(); | 239 root_window->GetRootWindowController(); |
240 // In the steady state (no animation playing) the wallpaper widget | 240 // In the steady state (no animation playing) the wallpaper widget |
241 // controller exists in the RootWindowController. | 241 // controller exists in the RootWindowController. |
242 WallpaperWidgetController* wallpaper_widget_controller = | 242 WallpaperWidgetController* wallpaper_widget_controller = |
243 root_window_controller->wallpaper_widget_controller(); | 243 root_window_controller->wallpaper_widget_controller(); |
244 if (wallpaper_widget_controller) { | 244 if (wallpaper_widget_controller) { |
245 moved |= wallpaper_widget_controller->Reparent( | 245 moved |= wallpaper_widget_controller->Reparent( |
246 root_window_controller->GetWindow(), container); | 246 root_window_controller->GetWindow(), container); |
247 } | 247 } |
248 // During wallpaper show animations the controller lives in | 248 // During wallpaper show animations the controller lives in |
(...skipping 18 matching lines...) Expand all Loading... |
267 return locked ? kShellWindowId_LockScreenWallpaperContainer | 267 return locked ? kShellWindowId_LockScreenWallpaperContainer |
268 : kShellWindowId_WallpaperContainer; | 268 : kShellWindowId_WallpaperContainer; |
269 } | 269 } |
270 | 270 |
271 void WallpaperController::UpdateWallpaper(bool clear_cache) { | 271 void WallpaperController::UpdateWallpaper(bool clear_cache) { |
272 current_wallpaper_.reset(); | 272 current_wallpaper_.reset(); |
273 WmShell::Get()->wallpaper_delegate()->UpdateWallpaper(clear_cache); | 273 WmShell::Get()->wallpaper_delegate()->UpdateWallpaper(clear_cache); |
274 } | 274 } |
275 | 275 |
276 } // namespace ash | 276 } // namespace ash |
OLD | NEW |