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/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/shared/app_types.h" | 9 #include "ash/shared/app_types.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
11 #include "ash/system/tray/system_tray_notifier.h" | 11 #include "ash/system/tray/system_tray_notifier.h" |
12 #include "ash/wm/window_util.h" | 12 #include "ash/wm/window_util.h" |
13 #include "ash/wm_window.h" | 13 #include "ash/wm_window.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
16 #include "chromeos/audio/chromeos_sounds.h" | 16 #include "chromeos/audio/chromeos_sounds.h" |
17 #include "chromeos/audio/cras_audio_handler.h" | 17 #include "chromeos/audio/cras_audio_handler.h" |
18 #include "chromeos/chromeos_switches.h" | 18 #include "chromeos/chromeos_switches.h" |
19 #include "ui/aura/client/aura_constants.h" | 19 #include "ui/aura/client/aura_constants.h" |
20 #include "ui/chromeos/touch_exploration_controller.h" | 20 #include "ui/chromeos/touch_exploration_controller.h" |
21 #include "ui/keyboard/keyboard_controller.h" | |
21 #include "ui/wm/public/activation_client.h" | 22 #include "ui/wm/public/activation_client.h" |
22 | 23 |
23 namespace ash { | 24 namespace ash { |
24 | 25 |
25 AshTouchExplorationManager::AshTouchExplorationManager( | 26 AshTouchExplorationManager::AshTouchExplorationManager( |
26 RootWindowController* root_window_controller) | 27 RootWindowController* root_window_controller) |
27 : root_window_controller_(root_window_controller), | 28 : root_window_controller_(root_window_controller), |
28 audio_handler_(chromeos::CrasAudioHandler::Get()), | 29 audio_handler_(chromeos::CrasAudioHandler::Get()), |
29 enable_chromevox_arc_support_( | 30 enable_chromevox_arc_support_( |
30 base::CommandLine::ForCurrentProcess()->HasSwitch( | 31 base::CommandLine::ForCurrentProcess()->HasSwitch( |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 } | 136 } |
136 | 137 |
137 void AshTouchExplorationManager::SetTouchAccessibilityAnchorPoint( | 138 void AshTouchExplorationManager::SetTouchAccessibilityAnchorPoint( |
138 const gfx::Point& anchor_point) { | 139 const gfx::Point& anchor_point) { |
139 if (touch_exploration_controller_) { | 140 if (touch_exploration_controller_) { |
140 touch_exploration_controller_->SetTouchAccessibilityAnchorPoint( | 141 touch_exploration_controller_->SetTouchAccessibilityAnchorPoint( |
141 anchor_point); | 142 anchor_point); |
142 } | 143 } |
143 } | 144 } |
144 | 145 |
146 void AshTouchExplorationManager::OnKeyboardBoundsChanging( | |
147 const gfx::Rect& new_bounds) { | |
148 UpdateTouchExplorationState(); | |
149 } | |
150 | |
151 void AshTouchExplorationManager::OnKeyboardClosed() { | |
152 UpdateTouchExplorationState(); | |
153 } | |
154 | |
145 void AshTouchExplorationManager::UpdateTouchExplorationState() { | 155 void AshTouchExplorationManager::UpdateTouchExplorationState() { |
146 // See crbug.com/603745 for more details. | 156 // See crbug.com/603745 for more details. |
147 const bool pass_through_surface = | 157 const bool pass_through_surface = |
148 wm::GetActiveWindow() && | 158 wm::GetActiveWindow() && |
149 wm::GetActiveWindow()->GetProperty(aura::client::kAppType) == | 159 wm::GetActiveWindow()->GetProperty(aura::client::kAppType) == |
150 static_cast<int>(ash::AppType::ARC_APP) && | 160 static_cast<int>(ash::AppType::ARC_APP) && |
151 !enable_chromevox_arc_support_; | 161 !enable_chromevox_arc_support_; |
152 | 162 |
153 const bool spoken_feedback_enabled = | 163 const bool spoken_feedback_enabled = |
154 Shell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled(); | 164 Shell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled(); |
(...skipping 14 matching lines...) Expand all Loading... | |
169 if (pass_through_surface) { | 179 if (pass_through_surface) { |
170 const gfx::Rect work_area = root_window_controller_->GetWindow() | 180 const gfx::Rect work_area = root_window_controller_->GetWindow() |
171 ->GetDisplayNearestWindow() | 181 ->GetDisplayNearestWindow() |
172 .work_area(); | 182 .work_area(); |
173 touch_exploration_controller_->SetExcludeBounds(work_area); | 183 touch_exploration_controller_->SetExcludeBounds(work_area); |
174 SilenceSpokenFeedback(); | 184 SilenceSpokenFeedback(); |
175 Shell::Get()->accessibility_delegate()->ClearFocusHighlight(); | 185 Shell::Get()->accessibility_delegate()->ClearFocusHighlight(); |
176 } else { | 186 } else { |
177 touch_exploration_controller_->SetExcludeBounds(gfx::Rect()); | 187 touch_exploration_controller_->SetExcludeBounds(gfx::Rect()); |
178 } | 188 } |
189 | |
190 // Virtual keyboard. | |
191 keyboard::KeyboardController* keyboard_controller = | |
192 keyboard::KeyboardController::GetInstance(); | |
193 if (keyboard_controller) { | |
194 if (!keyboard_controller->HasObserver(this)) | |
195 keyboard_controller->AddObserver(this); | |
oshima
2017/05/25 23:31:58
don't you have to remove it later?
Daniel Erat
2017/05/25 23:54:11
base::ScopedObserver is a good way to avoid bugs l
David Tseng
2017/05/26 16:05:15
Done.
| |
196 | |
197 touch_exploration_controller_->SetLiftActivationBounds( | |
198 keyboard_controller->current_keyboard_bounds()); | |
199 } | |
179 } else { | 200 } else { |
180 touch_exploration_controller_.reset(); | 201 touch_exploration_controller_.reset(); |
181 } | 202 } |
182 } | 203 } |
183 | 204 |
184 bool AshTouchExplorationManager::VolumeAdjustSoundEnabled() { | 205 bool AshTouchExplorationManager::VolumeAdjustSoundEnabled() { |
185 return !base::CommandLine::ForCurrentProcess()->HasSwitch( | 206 return !base::CommandLine::ForCurrentProcess()->HasSwitch( |
186 chromeos::switches::kDisableVolumeAdjustSound); | 207 chromeos::switches::kDisableVolumeAdjustSound); |
187 } | 208 } |
188 | 209 |
189 } // namespace ash | 210 } // namespace ash |
OLD | NEW |