Chromium Code Reviews| Index: ash/ash_touch_exploration_manager_chromeos.cc |
| diff --git a/ash/ash_touch_exploration_manager_chromeos.cc b/ash/ash_touch_exploration_manager_chromeos.cc |
| index 058553043f958349afe4d30cf0027243aa344ea8..b37fc29f4c4db7e3df0690ea4e1392c2f6f6c42a 100644 |
| --- a/ash/ash_touch_exploration_manager_chromeos.cc |
| +++ b/ash/ash_touch_exploration_manager_chromeos.cc |
| @@ -7,8 +7,11 @@ |
| #include "ash/common/accessibility_delegate.h" |
| #include "ash/common/system/tray/system_tray_notifier.h" |
| #include "ash/common/wm_shell.h" |
| +#include "ash/display/display_manager.h" |
| #include "ash/root_window_controller.h" |
| +#include "ash/root_window_settings.h" |
| #include "ash/shell.h" |
| +#include "ash/wm/window_state_aura.h" |
| #include "ash/wm/window_util.h" |
| #include "base/command_line.h" |
| #include "chromeos/audio/chromeos_sounds.h" |
| @@ -25,6 +28,7 @@ AshTouchExplorationManager::AshTouchExplorationManager( |
| audio_handler_(chromeos::CrasAudioHandler::Get()) { |
| WmShell::Get()->system_tray_notifier()->AddAccessibilityObserver(this); |
| Shell::GetInstance()->activation_client()->AddObserver(this); |
| + display::Screen::GetScreen()->AddObserver(this); |
| UpdateTouchExplorationState(); |
| } |
| @@ -34,6 +38,7 @@ AshTouchExplorationManager::~AshTouchExplorationManager() { |
| if (system_tray_notifier) |
| system_tray_notifier->RemoveAccessibilityObserver(this); |
| Shell::GetInstance()->activation_client()->RemoveObserver(this); |
| + display::Screen::GetScreen()->RemoveObserver(this); |
| } |
| void AshTouchExplorationManager::OnAccessibilityModeChanged( |
| @@ -88,6 +93,14 @@ void AshTouchExplorationManager::HandleAccessibilityGesture( |
| WmShell::Get()->accessibility_delegate()->HandleAccessibilityGesture(gesture); |
| } |
| +void AshTouchExplorationManager::OnDisplayMetricsChanged( |
| + const display::Display& display, |
| + uint32_t changed_metrics) { |
| + aura::Window* root_window = root_window_controller_->GetRootWindow(); |
| + if (ash::GetRootWindowSettings(root_window)->display_id == display.id()) |
| + UpdateTouchExplorationState(); |
| +} |
| + |
| void AshTouchExplorationManager::OnWindowActivated( |
| aura::client::ActivationChangeObserver::ActivationReason reason, |
| aura::Window* gained_active, |
| @@ -115,11 +128,24 @@ void AshTouchExplorationManager::UpdateTouchExplorationState() { |
| const bool spoken_feedback_enabled = |
| WmShell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled(); |
| - if (!pass_through_surface && spoken_feedback_enabled && |
| - !touch_exploration_controller_.get()) { |
| - touch_exploration_controller_.reset(new ui::TouchExplorationController( |
| - root_window_controller_->GetRootWindow(), this)); |
| - } else if (!spoken_feedback_enabled || pass_through_surface) { |
| + if (spoken_feedback_enabled) { |
| + if (!touch_exploration_controller_.get()) { |
| + touch_exploration_controller_ = |
| + base::MakeUnique<ui::TouchExplorationController>( |
| + root_window_controller_->GetRootWindow(), this); |
| + } |
| + if (pass_through_surface) { |
| + aura::Window* root_window = root_window_controller_->GetRootWindow(); |
| + int64_t display_id = ash::GetRootWindowSettings(root_window)->display_id; |
| + const gfx::Rect& work_area = ash::Shell::GetInstance() |
|
sky
2016/10/06 15:56:19
root_window_controller_->wm_root_window_controller
erosky
2016/10/07 23:05:30
Done. Thanks for explaining!
|
| + ->display_manager() |
| + ->GetDisplayForId(display_id) |
| + .work_area(); |
| + touch_exploration_controller_->SetExcludeBounds(work_area); |
| + } else { |
| + touch_exploration_controller_->SetExcludeBounds(gfx::Rect()); |
| + } |
| + } else { |
| touch_exploration_controller_.reset(); |
| } |
| } |