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..cc6bd148be12ee5f7f1ac20dba33481649db0bb0 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); |
| + Shell::GetInstance()->display_manager()->AddObserver(this); |
|
sky
2016/09/30 15:39:58
Use WmShell::Get()->Add/RemoveDisplayObserver (tha
erosky
2016/09/30 20:27:23
WmDisplayObserver::OnDisplayConfigurationChanged t
|
| UpdateTouchExplorationState(); |
| } |
| @@ -34,6 +38,7 @@ AshTouchExplorationManager::~AshTouchExplorationManager() { |
| if (system_tray_notifier) |
| system_tray_notifier->RemoveAccessibilityObserver(this); |
| Shell::GetInstance()->activation_client()->RemoveObserver(this); |
| + Shell::GetInstance()->display_manager()->RemoveObserver(this); |
| } |
| void AshTouchExplorationManager::OnAccessibilityModeChanged( |
| @@ -88,6 +93,15 @@ 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()) { |
|
sky
2016/09/30 15:39:58
no {}
erosky
2016/09/30 20:27:23
Done.
|
| + UpdateTouchExplorationState(); |
| + } |
| +} |
| + |
| void AshTouchExplorationManager::OnWindowActivated( |
| aura::client::ActivationChangeObserver::ActivationReason reason, |
| aura::Window* gained_active, |
| @@ -115,11 +129,23 @@ 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_.reset(new ui::TouchExplorationController( |
|
sky
2016/09/30 15:39:58
Use MakeUnique (see threads on chromium-dev).
erosky
2016/09/30 20:27:23
Done.
|
| + 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() |
| + ->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(); |
| } |
| } |