OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ash_touch_exploration_manager_chromeos.h" | 5 #include "ash/ash_touch_exploration_manager_chromeos.h" |
6 | 6 |
7 #include "ash/common/accessibility_delegate.h" | 7 #include "ash/common/accessibility_delegate.h" |
8 #include "ash/common/system/tray/system_tray_notifier.h" | 8 #include "ash/common/system/tray/system_tray_notifier.h" |
9 #include "ash/common/wm_root_window_controller.h" | |
10 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
11 #include "ash/common/wm_window.h" | 10 #include "ash/common/wm_window.h" |
12 #include "ash/root_window_controller.h" | 11 #include "ash/root_window_controller.h" |
13 #include "ash/shell.h" | 12 #include "ash/shell.h" |
14 #include "ash/wm/window_util.h" | 13 #include "ash/wm/window_util.h" |
15 #include "base/command_line.h" | 14 #include "base/command_line.h" |
16 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
17 #include "chromeos/audio/chromeos_sounds.h" | 16 #include "chromeos/audio/chromeos_sounds.h" |
18 #include "chromeos/audio/cras_audio_handler.h" | 17 #include "chromeos/audio/cras_audio_handler.h" |
19 #include "chromeos/chromeos_switches.h" | 18 #include "chromeos/chromeos_switches.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 } | 88 } |
90 | 89 |
91 void AshTouchExplorationManager::HandleAccessibilityGesture( | 90 void AshTouchExplorationManager::HandleAccessibilityGesture( |
92 ui::AXGesture gesture) { | 91 ui::AXGesture gesture) { |
93 WmShell::Get()->accessibility_delegate()->HandleAccessibilityGesture(gesture); | 92 WmShell::Get()->accessibility_delegate()->HandleAccessibilityGesture(gesture); |
94 } | 93 } |
95 | 94 |
96 void AshTouchExplorationManager::OnDisplayMetricsChanged( | 95 void AshTouchExplorationManager::OnDisplayMetricsChanged( |
97 const display::Display& display, | 96 const display::Display& display, |
98 uint32_t changed_metrics) { | 97 uint32_t changed_metrics) { |
99 if (root_window_controller_->wm_root_window_controller() | 98 if (root_window_controller_->GetWindow()->GetDisplayNearestWindow().id() == |
100 ->GetWindow() | 99 display.id()) |
101 ->GetDisplayNearestWindow() | |
102 .id() == display.id()) | |
103 UpdateTouchExplorationState(); | 100 UpdateTouchExplorationState(); |
104 } | 101 } |
105 | 102 |
106 void AshTouchExplorationManager::PlaySpokenFeedbackToggleCountdown( | 103 void AshTouchExplorationManager::PlaySpokenFeedbackToggleCountdown( |
107 int tick_count) { | 104 int tick_count) { |
108 AccessibilityDelegate* delegate = WmShell::Get()->accessibility_delegate(); | 105 AccessibilityDelegate* delegate = WmShell::Get()->accessibility_delegate(); |
109 if (delegate->ShouldToggleSpokenFeedbackViaTouch()) | 106 if (delegate->ShouldToggleSpokenFeedbackViaTouch()) |
110 delegate->PlaySpokenFeedbackToggleCountdown(tick_count); | 107 delegate->PlaySpokenFeedbackToggleCountdown(tick_count); |
111 } | 108 } |
112 | 109 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 } | 147 } |
151 | 148 |
152 if (spoken_feedback_enabled) { | 149 if (spoken_feedback_enabled) { |
153 if (!touch_exploration_controller_.get()) { | 150 if (!touch_exploration_controller_.get()) { |
154 touch_exploration_controller_ = | 151 touch_exploration_controller_ = |
155 base::MakeUnique<ui::TouchExplorationController>( | 152 base::MakeUnique<ui::TouchExplorationController>( |
156 root_window_controller_->GetRootWindow(), this, | 153 root_window_controller_->GetRootWindow(), this, |
157 touch_accessibility_enabler_.get()); | 154 touch_accessibility_enabler_.get()); |
158 } | 155 } |
159 if (pass_through_surface) { | 156 if (pass_through_surface) { |
160 const gfx::Rect& work_area = | 157 const gfx::Rect& work_area = root_window_controller_->GetWindow() |
161 root_window_controller_->wm_root_window_controller() | 158 ->GetDisplayNearestWindow() |
162 ->GetWindow() | 159 .work_area(); |
163 ->GetDisplayNearestWindow() | |
164 .work_area(); | |
165 touch_exploration_controller_->SetExcludeBounds(work_area); | 160 touch_exploration_controller_->SetExcludeBounds(work_area); |
166 SilenceSpokenFeedback(); | 161 SilenceSpokenFeedback(); |
167 WmShell::Get()->accessibility_delegate()->ClearFocusHighlight(); | 162 WmShell::Get()->accessibility_delegate()->ClearFocusHighlight(); |
168 } else { | 163 } else { |
169 touch_exploration_controller_->SetExcludeBounds(gfx::Rect()); | 164 touch_exploration_controller_->SetExcludeBounds(gfx::Rect()); |
170 } | 165 } |
171 } else { | 166 } else { |
172 touch_exploration_controller_.reset(); | 167 touch_exploration_controller_.reset(); |
173 } | 168 } |
174 } | 169 } |
175 | 170 |
176 bool AshTouchExplorationManager::VolumeAdjustSoundEnabled() { | 171 bool AshTouchExplorationManager::VolumeAdjustSoundEnabled() { |
177 return !base::CommandLine::ForCurrentProcess()->HasSwitch( | 172 return !base::CommandLine::ForCurrentProcess()->HasSwitch( |
178 chromeos::switches::kDisableVolumeAdjustSound); | 173 chromeos::switches::kDisableVolumeAdjustSound); |
179 } | 174 } |
180 | 175 |
181 } // namespace ash | 176 } // namespace ash |
OLD | NEW |