Chromium Code Reviews| Index: ash/root_window_controller.cc |
| diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc |
| index ba38e14a8db5b5697712a03377f0032dde2cc1ca..9b807e005476ca998e999171d0b199e13392b556 100644 |
| --- a/ash/root_window_controller.cc |
| +++ b/ash/root_window_controller.cc |
| @@ -28,6 +28,7 @@ |
| #include "ash/switchable_windows.h" |
| #include "ash/system/status_area_widget.h" |
| #include "ash/system/tray/system_tray_delegate.h" |
| +#include "ash/system/tray/system_tray_notifier.h" |
| #include "ash/touch/touch_hud_debug.h" |
| #include "ash/touch/touch_hud_projection.h" |
| #include "ash/touch/touch_observer_hud.h" |
| @@ -75,6 +76,7 @@ |
| #if defined(OS_CHROMEOS) |
| #include "ash/wm/boot_splash_screen_chromeos.h" |
| +#include "ui/chromeos/touch_exploration_controller.h" |
| #endif |
| namespace ash { |
| @@ -339,7 +341,17 @@ void RootWindowController::SetAnimatingWallpaperController( |
| } |
| void RootWindowController::Shutdown() { |
| - Shell::GetInstance()->RemoveShellObserver(this); |
| + Shell* shell = Shell::GetInstance(); |
| + shell->RemoveShellObserver(this); |
| + |
| +#if defined(OS_CHROMEOS) |
| + if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kAshDisableTouchExplorationMode)) { |
|
sadrul
2014/04/30 18:51:15
We should land with the feature disabled-by-defaul
|
| + if (shell->system_tray_notifier()) |
| + shell->system_tray_notifier()->RemoveAccessibilityObserver(this); |
| + touch_exploration_controller_.reset(); |
| + } |
| +#endif |
| if (animating_wallpaper_controller_.get()) |
| animating_wallpaper_controller_->StopAnimating(); |
| @@ -351,7 +363,7 @@ void RootWindowController::Shutdown() { |
| // window list adding windows from the target root window's containers which |
| // may have already gone away. |
| if (Shell::GetTargetRootWindow() == root_window) { |
| - Shell::GetInstance()->set_target_root_window( |
| + shell->set_target_root_window( |
| Shell::GetPrimaryRootWindow() == root_window |
| ? NULL |
| : Shell::GetPrimaryRootWindow()); |
| @@ -736,6 +748,15 @@ void RootWindowController::Init(RootWindowType root_window_type, |
| // Notify shell observers about new root window. |
| shell->OnRootWindowAdded(root_window); |
| } |
| + |
| +#if defined(OS_CHROMEOS) |
| + if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kAshDisableTouchExplorationMode)) { |
| + Shell::GetInstance()->system_tray_notifier()-> |
| + AddAccessibilityObserver(this); |
| + UpdateTouchExplorationState(); |
| + } |
| +#endif |
| } |
| void RootWindowController::InitLayoutManagers() { |
| @@ -1008,6 +1029,21 @@ void RootWindowController::CreateContainersInRootWindow( |
| "PowerButtonAnimationContainer", root_window); |
| } |
| +#if defined(OS_CHROMEOS) |
| +void RootWindowController::UpdateTouchExplorationState() { |
| + AccessibilityDelegate* delegate = |
| + Shell::GetInstance()->accessibility_delegate(); |
| + bool enabled = delegate->IsSpokenFeedbackEnabled(); |
| + |
| + if (enabled && !touch_exploration_controller_.get()) { |
| + touch_exploration_controller_.reset( |
| + new ui::TouchExplorationController(GetRootWindow())); |
| + } else if (!enabled && touch_exploration_controller_.get()) { |
| + touch_exploration_controller_.reset(); |
| + } |
| +} |
| +#endif |
| + |
| void RootWindowController::EnableTouchHudProjection() { |
| if (touch_hud_projection_) |
| return; |
| @@ -1031,6 +1067,16 @@ void RootWindowController::OnTouchHudProjectionToggled(bool enabled) { |
| DisableTouchHudProjection(); |
| } |
| +#if defined(OS_CHROMEOS) |
| +void RootWindowController::OnAccessibilityModeChanged( |
| + AccessibilityNotificationVisibility notify) { |
| + if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kAshDisableTouchExplorationMode)) { |
| + UpdateTouchExplorationState(); |
| + } |
| +} |
| +#endif |
| + |
| RootWindowController* GetRootWindowController( |
| const aura::Window* root_window) { |
| return root_window ? GetRootWindowSettings(root_window)->controller : NULL; |