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/root_window_controller.h" | 5 #include "ash/root_window_controller.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/ash_constants.h" | 9 #include "ash/ash_constants.h" |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 RootWindowController* RootWindowController::ForWindow( | 196 RootWindowController* RootWindowController::ForWindow( |
197 const aura::Window* window) { | 197 const aura::Window* window) { |
198 return GetRootWindowController(window->GetRootWindow()); | 198 return GetRootWindowController(window->GetRootWindow()); |
199 } | 199 } |
200 | 200 |
201 // static | 201 // static |
202 RootWindowController* RootWindowController::ForActiveRootWindow() { | 202 RootWindowController* RootWindowController::ForActiveRootWindow() { |
203 return GetRootWindowController(Shell::GetActiveRootWindow()); | 203 return GetRootWindowController(Shell::GetActiveRootWindow()); |
204 } | 204 } |
205 | 205 |
206 void RootWindowController::EnableTouchHudProjection() { | |
207 if (touch_hud_projection_) | |
208 return; | |
209 set_touch_hud_projection(new TouchHudProjection(root_window_.get())); | |
210 } | |
211 | |
212 void RootWindowController::DisableTouchHudProjection() { | |
213 if (!touch_hud_projection_) | |
214 return; | |
215 touch_hud_projection_->Remove(); | |
216 } | |
217 | |
218 void RootWindowController::SetWallpaperController( | 206 void RootWindowController::SetWallpaperController( |
219 DesktopBackgroundWidgetController* controller) { | 207 DesktopBackgroundWidgetController* controller) { |
220 wallpaper_controller_.reset(controller); | 208 wallpaper_controller_.reset(controller); |
221 } | 209 } |
222 | 210 |
223 void RootWindowController::SetAnimatingWallpaperController( | 211 void RootWindowController::SetAnimatingWallpaperController( |
224 AnimatingDesktopController* controller) { | 212 AnimatingDesktopController* controller) { |
225 if (animating_wallpaper_controller_.get()) | 213 if (animating_wallpaper_controller_.get()) |
226 animating_wallpaper_controller_->StopAnimating(); | 214 animating_wallpaper_controller_->StopAnimating(); |
227 animating_wallpaper_controller_.reset(controller); | 215 animating_wallpaper_controller_.reset(controller); |
228 } | 216 } |
229 | 217 |
230 void RootWindowController::Shutdown() { | 218 void RootWindowController::Shutdown() { |
| 219 Shell::GetInstance()->RemoveShellObserver(this); |
| 220 |
231 if (animating_wallpaper_controller_.get()) | 221 if (animating_wallpaper_controller_.get()) |
232 animating_wallpaper_controller_->StopAnimating(); | 222 animating_wallpaper_controller_->StopAnimating(); |
233 wallpaper_controller_.reset(); | 223 wallpaper_controller_.reset(); |
234 animating_wallpaper_controller_.reset(); | 224 animating_wallpaper_controller_.reset(); |
235 | 225 |
236 CloseChildWindows(); | 226 CloseChildWindows(); |
237 if (Shell::GetActiveRootWindow() == root_window_) { | 227 if (Shell::GetActiveRootWindow() == root_window_) { |
238 Shell::GetInstance()->set_active_root_window( | 228 Shell::GetInstance()->set_active_root_window( |
239 Shell::GetPrimaryRootWindow() == root_window_.get() ? | 229 Shell::GetPrimaryRootWindow() == root_window_.get() ? |
240 NULL : Shell::GetPrimaryRootWindow()); | 230 NULL : Shell::GetPrimaryRootWindow()); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 CreateSystemBackground(first_run_after_boot); | 275 CreateSystemBackground(first_run_after_boot); |
286 | 276 |
287 InitLayoutManagers(); | 277 InitLayoutManagers(); |
288 InitKeyboard(); | 278 InitKeyboard(); |
289 InitTouchHuds(); | 279 InitTouchHuds(); |
290 | 280 |
291 if (Shell::GetPrimaryRootWindowController()-> | 281 if (Shell::GetPrimaryRootWindowController()-> |
292 GetSystemModalLayoutManager(NULL)->has_modal_background()) { | 282 GetSystemModalLayoutManager(NULL)->has_modal_background()) { |
293 GetSystemModalLayoutManager(NULL)->CreateModalBackground(); | 283 GetSystemModalLayoutManager(NULL)->CreateModalBackground(); |
294 } | 284 } |
| 285 |
| 286 Shell::GetInstance()->AddShellObserver(this); |
295 } | 287 } |
296 | 288 |
297 void RootWindowController::ShowLauncher() { | 289 void RootWindowController::ShowLauncher() { |
298 if (!shelf_->launcher()) | 290 if (!shelf_->launcher()) |
299 return; | 291 return; |
300 shelf_->launcher()->SetVisible(true); | 292 shelf_->launcher()->SetVisible(true); |
301 shelf_->status_area_widget()->Show(); | 293 shelf_->status_area_widget()->Show(); |
302 } | 294 } |
303 | 295 |
304 void RootWindowController::OnLauncherCreated() { | 296 void RootWindowController::OnLauncherCreated() { |
305 if (panel_layout_manager_) | 297 if (panel_layout_manager_) |
306 panel_layout_manager_->SetLauncher(shelf_->launcher()); | 298 panel_layout_manager_->SetLauncher(shelf_->launcher()); |
307 if (docked_layout_manager_) | 299 if (docked_layout_manager_) |
308 docked_layout_manager_->SetLauncher(shelf_->launcher()); | 300 docked_layout_manager_->SetLauncher(shelf_->launcher()); |
309 } | 301 } |
310 | 302 |
311 void RootWindowController::OnLoginStateChanged(user::LoginStatus status) { | |
312 shelf_->shelf_layout_manager()->UpdateVisibilityState(); | |
313 } | |
314 | |
315 void RootWindowController::UpdateAfterLoginStatusChange( | 303 void RootWindowController::UpdateAfterLoginStatusChange( |
316 user::LoginStatus status) { | 304 user::LoginStatus status) { |
317 if (shelf_->status_area_widget()) | 305 if (shelf_->status_area_widget()) |
318 shelf_->status_area_widget()->UpdateAfterLoginStatusChange(status); | 306 shelf_->status_area_widget()->UpdateAfterLoginStatusChange(status); |
319 } | 307 } |
320 | 308 |
321 void RootWindowController::HandleInitialDesktopBackgroundAnimationStarted() { | 309 void RootWindowController::HandleInitialDesktopBackgroundAnimationStarted() { |
322 if (CommandLine::ForCurrentProcess()->HasSwitch( | 310 if (CommandLine::ForCurrentProcess()->HasSwitch( |
323 switches::kAshAnimateFromBootSplashScreen) && | 311 switches::kAshAnimateFromBootSplashScreen) && |
324 boot_splash_screen_.get()) { | 312 boot_splash_screen_.get()) { |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 aura::Window* overlay_container = CreateContainer( | 681 aura::Window* overlay_container = CreateContainer( |
694 kShellWindowId_OverlayContainer, | 682 kShellWindowId_OverlayContainer, |
695 "OverlayContainer", | 683 "OverlayContainer", |
696 lock_screen_related_containers); | 684 lock_screen_related_containers); |
697 SetUsesScreenCoordinates(overlay_container); | 685 SetUsesScreenCoordinates(overlay_container); |
698 | 686 |
699 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, | 687 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, |
700 "PowerButtonAnimationContainer", root_window) ; | 688 "PowerButtonAnimationContainer", root_window) ; |
701 } | 689 } |
702 | 690 |
| 691 void RootWindowController::EnableTouchHudProjection() { |
| 692 if (touch_hud_projection_) |
| 693 return; |
| 694 set_touch_hud_projection(new TouchHudProjection(root_window_.get())); |
| 695 } |
| 696 |
| 697 void RootWindowController::DisableTouchHudProjection() { |
| 698 if (!touch_hud_projection_) |
| 699 return; |
| 700 touch_hud_projection_->Remove(); |
| 701 } |
| 702 |
| 703 void RootWindowController::OnLoginStateChanged(user::LoginStatus status) { |
| 704 shelf_->shelf_layout_manager()->UpdateVisibilityState(); |
| 705 } |
| 706 |
| 707 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) { |
| 708 if (enabled) |
| 709 EnableTouchHudProjection(); |
| 710 else |
| 711 DisableTouchHudProjection(); |
| 712 } |
| 713 |
703 } // namespace internal | 714 } // namespace internal |
704 } // namespace ash | 715 } // namespace ash |
OLD | NEW |