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 <queue> | 7 #include <queue> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_constants.h" | 10 #include "ash/ash_constants.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "ash/shelf/shelf_layout_manager.h" | 21 #include "ash/shelf/shelf_layout_manager.h" |
22 #include "ash/shelf/shelf_types.h" | 22 #include "ash/shelf/shelf_types.h" |
23 #include "ash/shelf/shelf_widget.h" | 23 #include "ash/shelf/shelf_widget.h" |
24 #include "ash/shell.h" | 24 #include "ash/shell.h" |
25 #include "ash/shell_delegate.h" | 25 #include "ash/shell_delegate.h" |
26 #include "ash/shell_factory.h" | 26 #include "ash/shell_factory.h" |
27 #include "ash/shell_window_ids.h" | 27 #include "ash/shell_window_ids.h" |
28 #include "ash/switchable_windows.h" | 28 #include "ash/switchable_windows.h" |
29 #include "ash/system/status_area_widget.h" | 29 #include "ash/system/status_area_widget.h" |
30 #include "ash/system/tray/system_tray_delegate.h" | 30 #include "ash/system/tray/system_tray_delegate.h" |
| 31 #include "ash/system/tray/system_tray_notifier.h" |
31 #include "ash/touch/touch_hud_debug.h" | 32 #include "ash/touch/touch_hud_debug.h" |
32 #include "ash/touch/touch_hud_projection.h" | 33 #include "ash/touch/touch_hud_projection.h" |
33 #include "ash/touch/touch_observer_hud.h" | 34 #include "ash/touch/touch_observer_hud.h" |
34 #include "ash/wm/always_on_top_controller.h" | 35 #include "ash/wm/always_on_top_controller.h" |
35 #include "ash/wm/dock/docked_window_layout_manager.h" | 36 #include "ash/wm/dock/docked_window_layout_manager.h" |
36 #include "ash/wm/panels/attached_panel_window_targeter.h" | 37 #include "ash/wm/panels/attached_panel_window_targeter.h" |
37 #include "ash/wm/panels/panel_layout_manager.h" | 38 #include "ash/wm/panels/panel_layout_manager.h" |
38 #include "ash/wm/panels/panel_window_event_handler.h" | 39 #include "ash/wm/panels/panel_window_event_handler.h" |
39 #include "ash/wm/root_window_layout_manager.h" | 40 #include "ash/wm/root_window_layout_manager.h" |
40 #include "ash/wm/screen_dimmer.h" | 41 #include "ash/wm/screen_dimmer.h" |
(...skipping 27 matching lines...) Expand all Loading... |
68 #include "ui/wm/core/capture_controller.h" | 69 #include "ui/wm/core/capture_controller.h" |
69 #include "ui/wm/core/easy_resize_window_targeter.h" | 70 #include "ui/wm/core/easy_resize_window_targeter.h" |
70 #include "ui/wm/core/visibility_controller.h" | 71 #include "ui/wm/core/visibility_controller.h" |
71 #include "ui/wm/core/window_util.h" | 72 #include "ui/wm/core/window_util.h" |
72 #include "ui/wm/public/drag_drop_client.h" | 73 #include "ui/wm/public/drag_drop_client.h" |
73 #include "ui/wm/public/tooltip_client.h" | 74 #include "ui/wm/public/tooltip_client.h" |
74 #include "ui/wm/public/window_types.h" | 75 #include "ui/wm/public/window_types.h" |
75 | 76 |
76 #if defined(OS_CHROMEOS) | 77 #if defined(OS_CHROMEOS) |
77 #include "ash/wm/boot_splash_screen_chromeos.h" | 78 #include "ash/wm/boot_splash_screen_chromeos.h" |
| 79 #include "ui/chromeos/touch_exploration_controller.h" |
78 #endif | 80 #endif |
79 | 81 |
80 namespace ash { | 82 namespace ash { |
81 namespace { | 83 namespace { |
82 | 84 |
83 #if defined(OS_CHROMEOS) | 85 #if defined(OS_CHROMEOS) |
84 // Duration for the animation that hides the boot splash screen, in | 86 // Duration for the animation that hides the boot splash screen, in |
85 // milliseconds. This should be short enough in relation to | 87 // milliseconds. This should be short enough in relation to |
86 // wm/window_animation.cc's brightness/grayscale fade animation that the login | 88 // wm/window_animation.cc's brightness/grayscale fade animation that the login |
87 // background image animation isn't hidden by the splash screen animation. | 89 // background image animation isn't hidden by the splash screen animation. |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 } | 334 } |
333 | 335 |
334 void RootWindowController::SetAnimatingWallpaperController( | 336 void RootWindowController::SetAnimatingWallpaperController( |
335 AnimatingDesktopController* controller) { | 337 AnimatingDesktopController* controller) { |
336 if (animating_wallpaper_controller_.get()) | 338 if (animating_wallpaper_controller_.get()) |
337 animating_wallpaper_controller_->StopAnimating(); | 339 animating_wallpaper_controller_->StopAnimating(); |
338 animating_wallpaper_controller_.reset(controller); | 340 animating_wallpaper_controller_.reset(controller); |
339 } | 341 } |
340 | 342 |
341 void RootWindowController::Shutdown() { | 343 void RootWindowController::Shutdown() { |
342 Shell::GetInstance()->RemoveShellObserver(this); | 344 Shell* shell = Shell::GetInstance(); |
| 345 shell->RemoveShellObserver(this); |
| 346 |
| 347 #if defined(OS_CHROMEOS) |
| 348 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 349 switches::kAshDisableTouchExplorationMode)) { |
| 350 if (shell->system_tray_notifier()) |
| 351 shell->system_tray_notifier()->RemoveAccessibilityObserver(this); |
| 352 touch_exploration_controller_.reset(); |
| 353 } |
| 354 #endif |
343 | 355 |
344 if (animating_wallpaper_controller_.get()) | 356 if (animating_wallpaper_controller_.get()) |
345 animating_wallpaper_controller_->StopAnimating(); | 357 animating_wallpaper_controller_->StopAnimating(); |
346 wallpaper_controller_.reset(); | 358 wallpaper_controller_.reset(); |
347 animating_wallpaper_controller_.reset(); | 359 animating_wallpaper_controller_.reset(); |
348 aura::Window* root_window = GetRootWindow(); | 360 aura::Window* root_window = GetRootWindow(); |
349 // Change the target root window before closing child windows. If any child | 361 // Change the target root window before closing child windows. If any child |
350 // being removed triggers a relayout of the shelf it will try to build a | 362 // being removed triggers a relayout of the shelf it will try to build a |
351 // window list adding windows from the target root window's containers which | 363 // window list adding windows from the target root window's containers which |
352 // may have already gone away. | 364 // may have already gone away. |
353 if (Shell::GetTargetRootWindow() == root_window) { | 365 if (Shell::GetTargetRootWindow() == root_window) { |
354 Shell::GetInstance()->set_target_root_window( | 366 shell->set_target_root_window( |
355 Shell::GetPrimaryRootWindow() == root_window | 367 Shell::GetPrimaryRootWindow() == root_window |
356 ? NULL | 368 ? NULL |
357 : Shell::GetPrimaryRootWindow()); | 369 : Shell::GetPrimaryRootWindow()); |
358 } | 370 } |
359 | 371 |
360 CloseChildWindows(); | 372 CloseChildWindows(); |
361 GetRootWindowSettings(root_window)->controller = NULL; | 373 GetRootWindowSettings(root_window)->controller = NULL; |
362 screen_dimmer_.reset(); | 374 screen_dimmer_.reset(); |
363 workspace_controller_.reset(); | 375 workspace_controller_.reset(); |
364 // Forget with the display ID so that display lookup | 376 // Forget with the display ID so that display lookup |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 root_window_layout()->OnWindowResized(); | 741 root_window_layout()->OnWindowResized(); |
730 ash_host_->AsWindowTreeHost()->Show(); | 742 ash_host_->AsWindowTreeHost()->Show(); |
731 | 743 |
732 // Create a shelf if a user is already logged in. | 744 // Create a shelf if a user is already logged in. |
733 if (shell->session_state_delegate()->NumberOfLoggedInUsers()) | 745 if (shell->session_state_delegate()->NumberOfLoggedInUsers()) |
734 shelf()->CreateShelf(); | 746 shelf()->CreateShelf(); |
735 | 747 |
736 // Notify shell observers about new root window. | 748 // Notify shell observers about new root window. |
737 shell->OnRootWindowAdded(root_window); | 749 shell->OnRootWindowAdded(root_window); |
738 } | 750 } |
| 751 |
| 752 #if defined(OS_CHROMEOS) |
| 753 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 754 switches::kAshDisableTouchExplorationMode)) { |
| 755 Shell::GetInstance()->system_tray_notifier()-> |
| 756 AddAccessibilityObserver(this); |
| 757 UpdateTouchExplorationState(); |
| 758 } |
| 759 #endif |
739 } | 760 } |
740 | 761 |
741 void RootWindowController::InitLayoutManagers() { | 762 void RootWindowController::InitLayoutManagers() { |
742 aura::Window* root_window = GetRootWindow(); | 763 aura::Window* root_window = GetRootWindow(); |
743 root_window_layout_ = new RootWindowLayoutManager(root_window); | 764 root_window_layout_ = new RootWindowLayoutManager(root_window); |
744 root_window->SetLayoutManager(root_window_layout_); | 765 root_window->SetLayoutManager(root_window_layout_); |
745 | 766 |
746 aura::Window* default_container = | 767 aura::Window* default_container = |
747 GetContainer(kShellWindowId_DefaultContainer); | 768 GetContainer(kShellWindowId_DefaultContainer); |
748 // Workspace manager has its own layout managers. | 769 // Workspace manager has its own layout managers. |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 kShellWindowId_MouseCursorContainer, | 1022 kShellWindowId_MouseCursorContainer, |
1002 "MouseCursorContainer", | 1023 "MouseCursorContainer", |
1003 root_window); | 1024 root_window); |
1004 SetUsesScreenCoordinates(mouse_cursor_container); | 1025 SetUsesScreenCoordinates(mouse_cursor_container); |
1005 #endif | 1026 #endif |
1006 | 1027 |
1007 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, | 1028 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, |
1008 "PowerButtonAnimationContainer", root_window); | 1029 "PowerButtonAnimationContainer", root_window); |
1009 } | 1030 } |
1010 | 1031 |
| 1032 #if defined(OS_CHROMEOS) |
| 1033 void RootWindowController::UpdateTouchExplorationState() { |
| 1034 AccessibilityDelegate* delegate = |
| 1035 Shell::GetInstance()->accessibility_delegate(); |
| 1036 bool enabled = delegate->IsSpokenFeedbackEnabled(); |
| 1037 |
| 1038 if (enabled && !touch_exploration_controller_.get()) { |
| 1039 touch_exploration_controller_.reset( |
| 1040 new ui::TouchExplorationController(GetRootWindow())); |
| 1041 } else if (!enabled && touch_exploration_controller_.get()) { |
| 1042 touch_exploration_controller_.reset(); |
| 1043 } |
| 1044 } |
| 1045 #endif |
| 1046 |
1011 void RootWindowController::EnableTouchHudProjection() { | 1047 void RootWindowController::EnableTouchHudProjection() { |
1012 if (touch_hud_projection_) | 1048 if (touch_hud_projection_) |
1013 return; | 1049 return; |
1014 set_touch_hud_projection(new TouchHudProjection(GetRootWindow())); | 1050 set_touch_hud_projection(new TouchHudProjection(GetRootWindow())); |
1015 } | 1051 } |
1016 | 1052 |
1017 void RootWindowController::DisableTouchHudProjection() { | 1053 void RootWindowController::DisableTouchHudProjection() { |
1018 if (!touch_hud_projection_) | 1054 if (!touch_hud_projection_) |
1019 return; | 1055 return; |
1020 touch_hud_projection_->Remove(); | 1056 touch_hud_projection_->Remove(); |
1021 } | 1057 } |
1022 | 1058 |
1023 void RootWindowController::OnLoginStateChanged(user::LoginStatus status) { | 1059 void RootWindowController::OnLoginStateChanged(user::LoginStatus status) { |
1024 shelf_->shelf_layout_manager()->UpdateVisibilityState(); | 1060 shelf_->shelf_layout_manager()->UpdateVisibilityState(); |
1025 } | 1061 } |
1026 | 1062 |
1027 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) { | 1063 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) { |
1028 if (enabled) | 1064 if (enabled) |
1029 EnableTouchHudProjection(); | 1065 EnableTouchHudProjection(); |
1030 else | 1066 else |
1031 DisableTouchHudProjection(); | 1067 DisableTouchHudProjection(); |
1032 } | 1068 } |
1033 | 1069 |
| 1070 #if defined(OS_CHROMEOS) |
| 1071 void RootWindowController::OnAccessibilityModeChanged( |
| 1072 AccessibilityNotificationVisibility notify) { |
| 1073 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 1074 switches::kAshDisableTouchExplorationMode)) { |
| 1075 UpdateTouchExplorationState(); |
| 1076 } |
| 1077 } |
| 1078 #endif |
| 1079 |
1034 RootWindowController* GetRootWindowController( | 1080 RootWindowController* GetRootWindowController( |
1035 const aura::Window* root_window) { | 1081 const aura::Window* root_window) { |
1036 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; | 1082 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; |
1037 } | 1083 } |
1038 | 1084 |
1039 } // namespace ash | 1085 } // namespace ash |
OLD | NEW |