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/accessibility_delegate.h" | 7 #include "ash/accessibility_delegate.h" |
8 #include "ash/keyboard/keyboard_observer_register.h" | 8 #include "ash/keyboard/keyboard_observer_register.h" |
9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
10 #include "ash/shared/app_types.h" | 10 #include "ash/shared/app_types.h" |
11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
12 #include "ash/system/tray/system_tray_notifier.h" | 12 #include "ash/system/tray/system_tray_notifier.h" |
13 #include "ash/wm/window_util.h" | 13 #include "ash/wm/window_util.h" |
14 #include "ash/wm_window.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" |
20 #include "ui/aura/client/aura_constants.h" | 19 #include "ui/aura/client/aura_constants.h" |
21 #include "ui/chromeos/touch_exploration_controller.h" | 20 #include "ui/chromeos/touch_exploration_controller.h" |
22 #include "ui/keyboard/keyboard_controller.h" | 21 #include "ui/keyboard/keyboard_controller.h" |
23 #include "ui/wm/public/activation_client.h" | 22 #include "ui/wm/public/activation_client.h" |
24 | 23 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 } | 96 } |
98 | 97 |
99 void AshTouchExplorationManager::HandleAccessibilityGesture( | 98 void AshTouchExplorationManager::HandleAccessibilityGesture( |
100 ui::AXGesture gesture) { | 99 ui::AXGesture gesture) { |
101 Shell::Get()->accessibility_delegate()->HandleAccessibilityGesture(gesture); | 100 Shell::Get()->accessibility_delegate()->HandleAccessibilityGesture(gesture); |
102 } | 101 } |
103 | 102 |
104 void AshTouchExplorationManager::OnDisplayMetricsChanged( | 103 void AshTouchExplorationManager::OnDisplayMetricsChanged( |
105 const display::Display& display, | 104 const display::Display& display, |
106 uint32_t changed_metrics) { | 105 uint32_t changed_metrics) { |
107 if (root_window_controller_->GetWindow()->GetDisplayNearestWindow().id() == | 106 const display::Display this_display = |
108 display.id()) | 107 display::Screen::GetScreen()->GetDisplayNearestWindow( |
108 root_window_controller_->GetRootWindow()); | |
109 if (this_display.id() == display.id()) | |
109 UpdateTouchExplorationState(); | 110 UpdateTouchExplorationState(); |
110 } | 111 } |
111 | 112 |
112 void AshTouchExplorationManager::OnTwoFingerTouchStart() { | 113 void AshTouchExplorationManager::OnTwoFingerTouchStart() { |
113 AccessibilityDelegate* delegate = Shell::Get()->accessibility_delegate(); | 114 AccessibilityDelegate* delegate = Shell::Get()->accessibility_delegate(); |
114 delegate->OnTwoFingerTouchStart(); | 115 delegate->OnTwoFingerTouchStart(); |
115 } | 116 } |
116 | 117 |
117 void AshTouchExplorationManager::OnTwoFingerTouchStop() { | 118 void AshTouchExplorationManager::OnTwoFingerTouchStop() { |
118 AccessibilityDelegate* delegate = Shell::Get()->accessibility_delegate(); | 119 AccessibilityDelegate* delegate = Shell::Get()->accessibility_delegate(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
183 } | 184 } |
184 | 185 |
185 if (spoken_feedback_enabled) { | 186 if (spoken_feedback_enabled) { |
186 if (!touch_exploration_controller_.get()) { | 187 if (!touch_exploration_controller_.get()) { |
187 touch_exploration_controller_ = | 188 touch_exploration_controller_ = |
188 base::MakeUnique<ui::TouchExplorationController>( | 189 base::MakeUnique<ui::TouchExplorationController>( |
189 root_window_controller_->GetRootWindow(), this, | 190 root_window_controller_->GetRootWindow(), this, |
190 touch_accessibility_enabler_.get()); | 191 touch_accessibility_enabler_.get()); |
191 } | 192 } |
192 if (pass_through_surface) { | 193 if (pass_through_surface) { |
193 const gfx::Rect work_area = root_window_controller_->GetWindow() | 194 const display::Display this_display = |
sky
2017/05/31 15:18:07
this_display -> display
varkha
2017/05/31 15:41:14
Done.
| |
194 ->GetDisplayNearestWindow() | 195 display::Screen::GetScreen()->GetDisplayNearestWindow( |
195 .work_area(); | 196 root_window_controller_->GetRootWindow()); |
197 const gfx::Rect work_area = this_display.work_area(); | |
196 touch_exploration_controller_->SetExcludeBounds(work_area); | 198 touch_exploration_controller_->SetExcludeBounds(work_area); |
197 SilenceSpokenFeedback(); | 199 SilenceSpokenFeedback(); |
198 Shell::Get()->accessibility_delegate()->ClearFocusHighlight(); | 200 Shell::Get()->accessibility_delegate()->ClearFocusHighlight(); |
199 } else { | 201 } else { |
200 touch_exploration_controller_->SetExcludeBounds(gfx::Rect()); | 202 touch_exploration_controller_->SetExcludeBounds(gfx::Rect()); |
201 } | 203 } |
202 | 204 |
203 // Virtual keyboard. | 205 // Virtual keyboard. |
204 keyboard::KeyboardController* keyboard_controller = | 206 keyboard::KeyboardController* keyboard_controller = |
205 keyboard::KeyboardController::GetInstance(); | 207 keyboard::KeyboardController::GetInstance(); |
206 if (keyboard_controller) { | 208 if (keyboard_controller) { |
207 touch_exploration_controller_->SetLiftActivationBounds( | 209 touch_exploration_controller_->SetLiftActivationBounds( |
208 keyboard_controller->current_keyboard_bounds()); | 210 keyboard_controller->current_keyboard_bounds()); |
209 } | 211 } |
210 } else { | 212 } else { |
211 touch_exploration_controller_.reset(); | 213 touch_exploration_controller_.reset(); |
212 } | 214 } |
213 } | 215 } |
214 | 216 |
215 bool AshTouchExplorationManager::VolumeAdjustSoundEnabled() { | 217 bool AshTouchExplorationManager::VolumeAdjustSoundEnabled() { |
216 return !base::CommandLine::ForCurrentProcess()->HasSwitch( | 218 return !base::CommandLine::ForCurrentProcess()->HasSwitch( |
217 chromeos::switches::kDisableVolumeAdjustSound); | 219 chromeos::switches::kDisableVolumeAdjustSound); |
218 } | 220 } |
219 | 221 |
220 } // namespace ash | 222 } // namespace ash |
OLD | NEW |