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/accelerators/accelerator_controller.h" |
7 #include "ash/accessibility_delegate.h" | 8 #include "ash/accessibility_delegate.h" |
8 #include "ash/audio/sounds.h" | 9 #include "ash/audio/sounds.h" |
9 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
10 #include "ash/shell.h" | 11 #include "ash/shell.h" |
11 #include "ash/system/tray/system_tray_notifier.h" | 12 #include "ash/system/tray/system_tray_notifier.h" |
12 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/metrics/user_metrics.h" |
13 #include "chromeos/audio/chromeos_sounds.h" | 15 #include "chromeos/audio/chromeos_sounds.h" |
14 #include "chromeos/audio/cras_audio_handler.h" | 16 #include "chromeos/audio/cras_audio_handler.h" |
15 #include "chromeos/chromeos_switches.h" | 17 #include "chromeos/chromeos_switches.h" |
16 #include "ui/chromeos/touch_exploration_controller.h" | 18 #include "ui/chromeos/touch_exploration_controller.h" |
17 | 19 |
18 namespace ash { | 20 namespace ash { |
19 | 21 |
20 AshTouchExplorationManager::AshTouchExplorationManager( | 22 AshTouchExplorationManager::AshTouchExplorationManager( |
21 RootWindowController* root_window_controller) | 23 RootWindowController* root_window_controller) |
22 : root_window_controller_(root_window_controller), | 24 : root_window_controller_(root_window_controller), |
(...skipping 27 matching lines...) Expand all Loading... |
50 if (audio_handler_->IsOutputMuted()) { | 52 if (audio_handler_->IsOutputMuted()) { |
51 audio_handler_->SetOutputMute(false); | 53 audio_handler_->SetOutputMute(false); |
52 } | 54 } |
53 } | 55 } |
54 audio_handler_->SetOutputVolumePercent(volume); | 56 audio_handler_->SetOutputVolumePercent(volume); |
55 // Avoid negative volume. | 57 // Avoid negative volume. |
56 if (audio_handler_->IsOutputVolumeBelowDefaultMuteLevel()) | 58 if (audio_handler_->IsOutputVolumeBelowDefaultMuteLevel()) |
57 audio_handler_->SetOutputMute(true); | 59 audio_handler_->SetOutputMute(true); |
58 } | 60 } |
59 | 61 |
| 62 void AshTouchExplorationManager::SilenceSpokenFeedback() { |
| 63 AccessibilityDelegate* delegate = |
| 64 Shell::GetInstance()->accessibility_delegate(); |
| 65 if (!delegate->IsSpokenFeedbackEnabled()) |
| 66 return; |
| 67 delegate->SilenceSpokenFeedback(); |
| 68 } |
| 69 |
60 void AshTouchExplorationManager::UpdateTouchExplorationState() { | 70 void AshTouchExplorationManager::UpdateTouchExplorationState() { |
61 AccessibilityDelegate* delegate = | 71 AccessibilityDelegate* delegate = |
62 Shell::GetInstance()->accessibility_delegate(); | 72 Shell::GetInstance()->accessibility_delegate(); |
63 bool enabled = delegate->IsSpokenFeedbackEnabled(); | 73 bool enabled = delegate->IsSpokenFeedbackEnabled(); |
64 | 74 |
65 if (enabled && !touch_exploration_controller_.get()) { | 75 if (enabled && !touch_exploration_controller_.get()) { |
66 touch_exploration_controller_.reset(new ui::TouchExplorationController( | 76 touch_exploration_controller_.reset(new ui::TouchExplorationController( |
67 root_window_controller_->GetRootWindow(), this)); | 77 root_window_controller_->GetRootWindow(), this)); |
68 } else if (!enabled) { | 78 } else if (!enabled) { |
69 touch_exploration_controller_.reset(); | 79 touch_exploration_controller_.reset(); |
70 } | 80 } |
71 } | 81 } |
72 | 82 |
73 bool AshTouchExplorationManager::VolumeAdjustSoundEnabled() { | 83 bool AshTouchExplorationManager::VolumeAdjustSoundEnabled() { |
74 return !CommandLine::ForCurrentProcess()->HasSwitch( | 84 return !CommandLine::ForCurrentProcess()->HasSwitch( |
75 chromeos::switches::kDisableVolumeAdjustSound); | 85 chromeos::switches::kDisableVolumeAdjustSound); |
76 } | 86 } |
77 | 87 |
78 } // namespace ash | 88 } // namespace ash |
OLD | NEW |