Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: ash/ash_touch_exploration_manager_chromeos.cc

Issue 2476843003: Toggle spoken feedback if two fingers are held down. (Closed)
Patch Set: Address last nits Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/ash_touch_exploration_manager_chromeos.h ('k') | ash/common/accessibility_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/aura/wm_root_window_controller_aura.h" 7 #include "ash/aura/wm_root_window_controller_aura.h"
8 #include "ash/common/accessibility_delegate.h" 8 #include "ash/common/accessibility_delegate.h"
9 #include "ash/common/system/tray/system_tray_notifier.h" 9 #include "ash/common/system/tray/system_tray_notifier.h"
10 #include "ash/common/wm_shell.h" 10 #include "ash/common/wm_shell.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 void AshTouchExplorationManager::OnDisplayMetricsChanged( 95 void AshTouchExplorationManager::OnDisplayMetricsChanged(
96 const display::Display& display, 96 const display::Display& display,
97 uint32_t changed_metrics) { 97 uint32_t changed_metrics) {
98 if (root_window_controller_->wm_root_window_controller() 98 if (root_window_controller_->wm_root_window_controller()
99 ->GetWindow() 99 ->GetWindow()
100 ->GetDisplayNearestWindow() 100 ->GetDisplayNearestWindow()
101 .id() == display.id()) 101 .id() == display.id())
102 UpdateTouchExplorationState(); 102 UpdateTouchExplorationState();
103 } 103 }
104 104
105 void AshTouchExplorationManager::PlaySpokenFeedbackToggleCountdown(
106 int tick_count) {
107 WmShell::Get()->accessibility_delegate()->PlaySpokenFeedbackToggleCountdown(
108 tick_count);
109 }
110
111 void AshTouchExplorationManager::ToggleSpokenFeedback() {
112 WmShell::Get()->accessibility_delegate()->ToggleSpokenFeedback(
113 ash::A11Y_NOTIFICATION_SHOW);
114 }
115
105 void AshTouchExplorationManager::OnWindowActivated( 116 void AshTouchExplorationManager::OnWindowActivated(
106 aura::client::ActivationChangeObserver::ActivationReason reason, 117 aura::client::ActivationChangeObserver::ActivationReason reason,
107 aura::Window* gained_active, 118 aura::Window* gained_active,
108 aura::Window* lost_active) { 119 aura::Window* lost_active) {
109 UpdateTouchExplorationState(); 120 UpdateTouchExplorationState();
110 } 121 }
111 122
112 void AshTouchExplorationManager::SetTouchAccessibilityAnchorPoint( 123 void AshTouchExplorationManager::SetTouchAccessibilityAnchorPoint(
113 const gfx::Point& anchor_point) { 124 const gfx::Point& anchor_point) {
114 if (touch_exploration_controller_) { 125 if (touch_exploration_controller_) {
115 touch_exploration_controller_->SetTouchAccessibilityAnchorPoint( 126 touch_exploration_controller_->SetTouchAccessibilityAnchorPoint(
116 anchor_point); 127 anchor_point);
117 } 128 }
118 } 129 }
119 130
120 void AshTouchExplorationManager::UpdateTouchExplorationState() { 131 void AshTouchExplorationManager::UpdateTouchExplorationState() {
121 // Comes from components/exo/shell_surface.cc. 132 // Comes from components/exo/shell_surface.cc.
122 const char kExoShellSurfaceWindowName[] = "ExoShellSurface"; 133 const char kExoShellSurfaceWindowName[] = "ExoShellSurface";
123 134
124 // See crbug.com/603745 for more details. 135 // See crbug.com/603745 for more details.
125 const bool pass_through_surface = 136 const bool pass_through_surface =
126 wm::GetActiveWindow() && 137 wm::GetActiveWindow() &&
127 wm::GetActiveWindow()->name() == kExoShellSurfaceWindowName; 138 wm::GetActiveWindow()->name() == kExoShellSurfaceWindowName;
128 139
129 const bool spoken_feedback_enabled = 140 const bool spoken_feedback_enabled =
130 WmShell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled(); 141 WmShell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled();
131 142
143 if (!touch_accessibility_enabler_) {
144 // Always enable gesture to toggle spoken feedback.
145 touch_accessibility_enabler_.reset(new ui::TouchAccessibilityEnabler(
146 root_window_controller_->GetRootWindow(), this));
147 }
148
132 if (spoken_feedback_enabled) { 149 if (spoken_feedback_enabled) {
133 if (!touch_exploration_controller_.get()) { 150 if (!touch_exploration_controller_.get()) {
134 touch_exploration_controller_ = 151 touch_exploration_controller_ =
135 base::MakeUnique<ui::TouchExplorationController>( 152 base::MakeUnique<ui::TouchExplorationController>(
136 root_window_controller_->GetRootWindow(), this); 153 root_window_controller_->GetRootWindow(), this,
154 touch_accessibility_enabler_.get());
137 } 155 }
138 if (pass_through_surface) { 156 if (pass_through_surface) {
139 const gfx::Rect& work_area = 157 const gfx::Rect& work_area =
140 root_window_controller_->wm_root_window_controller() 158 root_window_controller_->wm_root_window_controller()
141 ->GetWindow() 159 ->GetWindow()
142 ->GetDisplayNearestWindow() 160 ->GetDisplayNearestWindow()
143 .work_area(); 161 .work_area();
144 touch_exploration_controller_->SetExcludeBounds(work_area); 162 touch_exploration_controller_->SetExcludeBounds(work_area);
145 SilenceSpokenFeedback(); 163 SilenceSpokenFeedback();
146 WmShell::Get()->accessibility_delegate()->ClearFocusHighlight(); 164 WmShell::Get()->accessibility_delegate()->ClearFocusHighlight();
147 } else { 165 } else {
148 touch_exploration_controller_->SetExcludeBounds(gfx::Rect()); 166 touch_exploration_controller_->SetExcludeBounds(gfx::Rect());
149 } 167 }
150 } else { 168 } else {
151 touch_exploration_controller_.reset(); 169 touch_exploration_controller_.reset();
152 } 170 }
153 } 171 }
154 172
155 bool AshTouchExplorationManager::VolumeAdjustSoundEnabled() { 173 bool AshTouchExplorationManager::VolumeAdjustSoundEnabled() {
156 return !base::CommandLine::ForCurrentProcess()->HasSwitch( 174 return !base::CommandLine::ForCurrentProcess()->HasSwitch(
157 chromeos::switches::kDisableVolumeAdjustSound); 175 chromeos::switches::kDisableVolumeAdjustSound);
158 } 176 }
159 177
160 } // namespace ash 178 } // namespace ash
OLDNEW
« no previous file with comments | « ash/ash_touch_exploration_manager_chromeos.h ('k') | ash/common/accessibility_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698