| 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/desktop_background/desktop_background_controller.h" | 5 #include "ash/desktop_background/desktop_background_controller.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/desktop_background/desktop_background_controller_observer.h" | 8 #include "ash/desktop_background/desktop_background_controller_observer.h" |
| 9 #include "ash/desktop_background/desktop_background_view.h" | 9 #include "ash/desktop_background/desktop_background_view.h" |
| 10 #include "ash/desktop_background/desktop_background_widget_controller.h" | 10 #include "ash/desktop_background/desktop_background_widget_controller.h" |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 Shell::RootWindowControllerList controllers = | 251 Shell::RootWindowControllerList controllers = |
| 252 Shell::GetAllRootWindowControllers(); | 252 Shell::GetAllRootWindowControllers(); |
| 253 for (Shell::RootWindowControllerList::iterator iter = controllers.begin(); | 253 for (Shell::RootWindowControllerList::iterator iter = controllers.begin(); |
| 254 iter != controllers.end(); ++iter) { | 254 iter != controllers.end(); ++iter) { |
| 255 RootWindowController* root_window_controller = *iter; | 255 RootWindowController* root_window_controller = *iter; |
| 256 // In the steady state (no animation playing) the background widget | 256 // In the steady state (no animation playing) the background widget |
| 257 // controller exists in the RootWindowController. | 257 // controller exists in the RootWindowController. |
| 258 DesktopBackgroundWidgetController* desktop_controller = | 258 DesktopBackgroundWidgetController* desktop_controller = |
| 259 root_window_controller->wallpaper_controller(); | 259 root_window_controller->wallpaper_controller(); |
| 260 if (desktop_controller) { | 260 if (desktop_controller) { |
| 261 moved |= desktop_controller->Reparent( | 261 moved |= |
| 262 root_window_controller->root_window(), | 262 desktop_controller->Reparent(root_window_controller->GetRootWindow(), |
| 263 src_container, | 263 src_container, |
| 264 dst_container); | 264 dst_container); |
| 265 } | 265 } |
| 266 // During desktop show animations the controller lives in | 266 // During desktop show animations the controller lives in |
| 267 // AnimatingDesktopController owned by RootWindowController. | 267 // AnimatingDesktopController owned by RootWindowController. |
| 268 // NOTE: If a wallpaper load happens during a desktop show animation there | 268 // NOTE: If a wallpaper load happens during a desktop show animation there |
| 269 // can temporarily be two desktop background widgets. We must reparent | 269 // can temporarily be two desktop background widgets. We must reparent |
| 270 // both of them - one above and one here. | 270 // both of them - one above and one here. |
| 271 DesktopBackgroundWidgetController* animating_controller = | 271 DesktopBackgroundWidgetController* animating_controller = |
| 272 root_window_controller->animating_wallpaper_controller() ? | 272 root_window_controller->animating_wallpaper_controller() ? |
| 273 root_window_controller->animating_wallpaper_controller()-> | 273 root_window_controller->animating_wallpaper_controller()-> |
| 274 GetController(false) : | 274 GetController(false) : |
| 275 NULL; | 275 NULL; |
| 276 if (animating_controller) { | 276 if (animating_controller) { |
| 277 moved |= animating_controller->Reparent( | 277 moved |= animating_controller->Reparent( |
| 278 root_window_controller->root_window(), | 278 root_window_controller->GetRootWindow(), |
| 279 src_container, | 279 src_container, |
| 280 dst_container); | 280 dst_container); |
| 281 } | 281 } |
| 282 } | 282 } |
| 283 return moved; | 283 return moved; |
| 284 } | 284 } |
| 285 | 285 |
| 286 int DesktopBackgroundController::GetBackgroundContainerId(bool locked) { | 286 int DesktopBackgroundController::GetBackgroundContainerId(bool locked) { |
| 287 return locked ? kShellWindowId_LockScreenBackgroundContainer | 287 return locked ? kShellWindowId_LockScreenBackgroundContainer |
| 288 : kShellWindowId_DesktopBackgroundContainer; | 288 : kShellWindowId_DesktopBackgroundContainer; |
| 289 } | 289 } |
| 290 | 290 |
| 291 void DesktopBackgroundController::UpdateWallpaper() { | 291 void DesktopBackgroundController::UpdateWallpaper() { |
| 292 current_wallpaper_.reset(NULL); | 292 current_wallpaper_.reset(NULL); |
| 293 ash::Shell::GetInstance()->user_wallpaper_delegate()-> | 293 ash::Shell::GetInstance()->user_wallpaper_delegate()-> |
| 294 UpdateWallpaper(true /* clear cache */); | 294 UpdateWallpaper(true /* clear cache */); |
| 295 } | 295 } |
| 296 | 296 |
| 297 } // namespace ash | 297 } // namespace ash |
| OLD | NEW |