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

Side by Side Diff: ash/ash_touch_exploration_manager_chromeos.cc

Issue 2535723008: Revert "Toggle spoken feedback if two fingers are held down." (Closed)
Patch Set: Don't revert metrics changes Created 4 years 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
116 void AshTouchExplorationManager::OnWindowActivated( 105 void AshTouchExplorationManager::OnWindowActivated(
117 aura::client::ActivationChangeObserver::ActivationReason reason, 106 aura::client::ActivationChangeObserver::ActivationReason reason,
118 aura::Window* gained_active, 107 aura::Window* gained_active,
119 aura::Window* lost_active) { 108 aura::Window* lost_active) {
120 UpdateTouchExplorationState(); 109 UpdateTouchExplorationState();
121 } 110 }
122 111
123 void AshTouchExplorationManager::SetTouchAccessibilityAnchorPoint( 112 void AshTouchExplorationManager::SetTouchAccessibilityAnchorPoint(
124 const gfx::Point& anchor_point) { 113 const gfx::Point& anchor_point) {
125 if (touch_exploration_controller_) { 114 if (touch_exploration_controller_) {
126 touch_exploration_controller_->SetTouchAccessibilityAnchorPoint( 115 touch_exploration_controller_->SetTouchAccessibilityAnchorPoint(
127 anchor_point); 116 anchor_point);
128 } 117 }
129 } 118 }
130 119
131 void AshTouchExplorationManager::UpdateTouchExplorationState() { 120 void AshTouchExplorationManager::UpdateTouchExplorationState() {
132 // Comes from components/exo/shell_surface.cc. 121 // Comes from components/exo/shell_surface.cc.
133 const char kExoShellSurfaceWindowName[] = "ExoShellSurface"; 122 const char kExoShellSurfaceWindowName[] = "ExoShellSurface";
134 123
135 // See crbug.com/603745 for more details. 124 // See crbug.com/603745 for more details.
136 const bool pass_through_surface = 125 const bool pass_through_surface =
137 wm::GetActiveWindow() && 126 wm::GetActiveWindow() &&
138 wm::GetActiveWindow()->GetName() == kExoShellSurfaceWindowName; 127 wm::GetActiveWindow()->GetName() == kExoShellSurfaceWindowName;
139 128
140 const bool spoken_feedback_enabled = 129 const bool spoken_feedback_enabled =
141 WmShell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled(); 130 WmShell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled();
142 131
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
149 if (spoken_feedback_enabled) { 132 if (spoken_feedback_enabled) {
150 if (!touch_exploration_controller_.get()) { 133 if (!touch_exploration_controller_.get()) {
151 touch_exploration_controller_ = 134 touch_exploration_controller_ =
152 base::MakeUnique<ui::TouchExplorationController>( 135 base::MakeUnique<ui::TouchExplorationController>(
153 root_window_controller_->GetRootWindow(), this, 136 root_window_controller_->GetRootWindow(), this);
154 touch_accessibility_enabler_.get());
155 } 137 }
156 if (pass_through_surface) { 138 if (pass_through_surface) {
157 const gfx::Rect& work_area = 139 const gfx::Rect& work_area =
158 root_window_controller_->wm_root_window_controller() 140 root_window_controller_->wm_root_window_controller()
159 ->GetWindow() 141 ->GetWindow()
160 ->GetDisplayNearestWindow() 142 ->GetDisplayNearestWindow()
161 .work_area(); 143 .work_area();
162 touch_exploration_controller_->SetExcludeBounds(work_area); 144 touch_exploration_controller_->SetExcludeBounds(work_area);
163 SilenceSpokenFeedback(); 145 SilenceSpokenFeedback();
164 WmShell::Get()->accessibility_delegate()->ClearFocusHighlight(); 146 WmShell::Get()->accessibility_delegate()->ClearFocusHighlight();
165 } else { 147 } else {
166 touch_exploration_controller_->SetExcludeBounds(gfx::Rect()); 148 touch_exploration_controller_->SetExcludeBounds(gfx::Rect());
167 } 149 }
168 } else { 150 } else {
169 touch_exploration_controller_.reset(); 151 touch_exploration_controller_.reset();
170 } 152 }
171 } 153 }
172 154
173 bool AshTouchExplorationManager::VolumeAdjustSoundEnabled() { 155 bool AshTouchExplorationManager::VolumeAdjustSoundEnabled() {
174 return !base::CommandLine::ForCurrentProcess()->HasSwitch( 156 return !base::CommandLine::ForCurrentProcess()->HasSwitch(
175 chromeos::switches::kDisableVolumeAdjustSound); 157 chromeos::switches::kDisableVolumeAdjustSound);
176 } 158 }
177 159
178 } // namespace ash 160 } // 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