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..d79710c775eee41b8e0170b1a8145cce9edeff84 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); |
+ WmShell::Get()->AddDisplayObserver(this); |
UpdateTouchExplorationState(); |
} |
@@ -34,6 +38,7 @@ AshTouchExplorationManager::~AshTouchExplorationManager() { |
if (system_tray_notifier) |
system_tray_notifier->RemoveAccessibilityObserver(this); |
Shell::GetInstance()->activation_client()->RemoveObserver(this); |
+ WmShell::Get()->RemoveDisplayObserver(this); |
} |
void AshTouchExplorationManager::OnAccessibilityModeChanged( |
@@ -88,6 +93,10 @@ void AshTouchExplorationManager::HandleAccessibilityGesture( |
WmShell::Get()->accessibility_delegate()->HandleAccessibilityGesture(gesture); |
} |
+void AshTouchExplorationManager::OnDisplayConfigurationChanged() { |
+ UpdateTouchExplorationState(); |
+} |
+ |
void AshTouchExplorationManager::OnWindowActivated( |
aura::client::ActivationChangeObserver::ActivationReason reason, |
aura::Window* gained_active, |
@@ -115,11 +124,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() |
+ ->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(); |
} |
} |