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

Side by Side Diff: ash/ash_touch_exploration_manager_chromeos.cc

Issue 410783002: Corner Passthrough for Accessibility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@side-gestures
Patch Set: Removed extra comment Created 6 years, 4 months 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/default_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/accessibility_delegate.h" 7 #include "ash/accessibility_delegate.h"
8 #include "ash/audio/sounds.h" 8 #include "ash/audio/sounds.h"
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 19 matching lines...) Expand all
30 Shell::GetInstance()->system_tray_notifier(); 30 Shell::GetInstance()->system_tray_notifier();
31 if (system_tray_notifier) 31 if (system_tray_notifier)
32 system_tray_notifier->RemoveAccessibilityObserver(this); 32 system_tray_notifier->RemoveAccessibilityObserver(this);
33 } 33 }
34 34
35 void AshTouchExplorationManager::OnAccessibilityModeChanged( 35 void AshTouchExplorationManager::OnAccessibilityModeChanged(
36 AccessibilityNotificationVisibility notify) { 36 AccessibilityNotificationVisibility notify) {
37 UpdateTouchExplorationState(); 37 UpdateTouchExplorationState();
38 } 38 }
39 39
40 void AshTouchExplorationManager::PlayVolumeAdjustSound() {
41 if (!VolumeAdjustSoundEnabled())
42 return;
43 if ((!audio_handler_->IsOutputMuted()) ||
44 !(audio_handler_->GetOutputVolumePercent() == 100))
45 PlaySystemSoundIfSpokenFeedback(chromeos::SOUND_VOLUME_ADJUST);
46 }
47
48 void AshTouchExplorationManager::SetOutputLevel(int volume) { 40 void AshTouchExplorationManager::SetOutputLevel(int volume) {
49 if (volume > 0) { 41 if (volume > 0) {
50 if (audio_handler_->IsOutputMuted()) { 42 if (audio_handler_->IsOutputMuted()) {
51 audio_handler_->SetOutputMute(false); 43 audio_handler_->SetOutputMute(false);
52 } 44 }
53 } 45 }
54 audio_handler_->SetOutputVolumePercent(volume); 46 audio_handler_->SetOutputVolumePercent(volume);
55 // Avoid negative volume. 47 // Avoid negative volume.
56 if (audio_handler_->IsOutputVolumeBelowDefaultMuteLevel()) 48 if (audio_handler_->IsOutputVolumeBelowDefaultMuteLevel())
57 audio_handler_->SetOutputMute(true); 49 audio_handler_->SetOutputMute(true);
58 } 50 }
59 51
60 void AshTouchExplorationManager::SilenceSpokenFeedback() { 52 void AshTouchExplorationManager::SilenceSpokenFeedback() {
61 AccessibilityDelegate* delegate = 53 AccessibilityDelegate* delegate =
62 Shell::GetInstance()->accessibility_delegate(); 54 Shell::GetInstance()->accessibility_delegate();
63 if (!delegate->IsSpokenFeedbackEnabled()) 55 if (!delegate->IsSpokenFeedbackEnabled())
64 return; 56 return;
65 delegate->SilenceSpokenFeedback(); 57 delegate->SilenceSpokenFeedback();
66 } 58 }
67 59
60 void AshTouchExplorationManager::PlayVolumeAdjustEarcon() {
61 if (!VolumeAdjustSoundEnabled())
62 return;
63 if (!audio_handler_->IsOutputMuted() &&
64 audio_handler_->GetOutputVolumePercent() != 100)
65 PlaySystemSoundIfSpokenFeedback(chromeos::SOUND_VOLUME_ADJUST);
66 }
67
68 void AshTouchExplorationManager::PlayPassthroughEarcon() {
69 Shell::GetInstance()->accessibility_delegate()->PlayEarcon(
70 chromeos::SOUND_PASSTHROUGH);
71 }
72
73 void AshTouchExplorationManager::PlayExitScreenEarcon() {
74 Shell::GetInstance()->accessibility_delegate()->PlayEarcon(
75 chromeos::SOUND_EXIT_SCREEN);
76 }
77
78 void AshTouchExplorationManager::PlayEnterScreenEarcon() {
79 Shell::GetInstance()->accessibility_delegate()->PlayEarcon(
80 chromeos::SOUND_ENTER_SCREEN);
81 }
82
68 void AshTouchExplorationManager::UpdateTouchExplorationState() { 83 void AshTouchExplorationManager::UpdateTouchExplorationState() {
69 AccessibilityDelegate* delegate = 84 AccessibilityDelegate* delegate =
70 Shell::GetInstance()->accessibility_delegate(); 85 Shell::GetInstance()->accessibility_delegate();
71 bool enabled = delegate->IsSpokenFeedbackEnabled(); 86 bool enabled = delegate->IsSpokenFeedbackEnabled();
72 87
73 if (enabled && !touch_exploration_controller_.get()) { 88 if (enabled && !touch_exploration_controller_.get()) {
74 touch_exploration_controller_.reset(new ui::TouchExplorationController( 89 touch_exploration_controller_.reset(new ui::TouchExplorationController(
75 root_window_controller_->GetRootWindow(), this)); 90 root_window_controller_->GetRootWindow(), this));
76 } else if (!enabled) { 91 } else if (!enabled) {
77 touch_exploration_controller_.reset(); 92 touch_exploration_controller_.reset();
78 } 93 }
79 } 94 }
80 95
81 bool AshTouchExplorationManager::VolumeAdjustSoundEnabled() { 96 bool AshTouchExplorationManager::VolumeAdjustSoundEnabled() {
82 return !CommandLine::ForCurrentProcess()->HasSwitch( 97 return !CommandLine::ForCurrentProcess()->HasSwitch(
83 chromeos::switches::kDisableVolumeAdjustSound); 98 chromeos::switches::kDisableVolumeAdjustSound);
84 } 99 }
85 100
86 } // namespace ash 101 } // namespace ash
OLDNEW
« no previous file with comments | « ash/ash_touch_exploration_manager_chromeos.h ('k') | ash/default_accessibility_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698