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

Side by Side Diff: chrome/browser/ui/ash/volume_controller_chromeos.cc

Issue 212793003: Volume adjust sound is played only if spoken feedback is enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/ash/volume_controller_browsertest_chromeos.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/ash/volume_controller_chromeos.h" 5 #include "chrome/browser/ui/ash/volume_controller_chromeos.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/audio/sounds.h" 8 #include "ash/audio/sounds.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 12 matching lines...) Expand all
23 // Percent by which the volume should be changed when a volume key is pressed. 23 // Percent by which the volume should be changed when a volume key is pressed.
24 const double kStepPercentage = 4.0; 24 const double kStepPercentage = 4.0;
25 25
26 bool VolumeAdjustSoundEnabled() { 26 bool VolumeAdjustSoundEnabled() {
27 return !CommandLine::ForCurrentProcess()->HasSwitch( 27 return !CommandLine::ForCurrentProcess()->HasSwitch(
28 chromeos::switches::kDisableVolumeAdjustSound); 28 chromeos::switches::kDisableVolumeAdjustSound);
29 } 29 }
30 30
31 void PlayVolumeAdjustSound() { 31 void PlayVolumeAdjustSound() {
32 if (VolumeAdjustSoundEnabled()) 32 if (VolumeAdjustSoundEnabled())
33 ash::PlaySystemSoundAlways(chromeos::SOUND_VOLUME_ADJUST); 33 ash::PlaySystemSoundIfSpokenFeedback(chromeos::SOUND_VOLUME_ADJUST);
34 } 34 }
35 35
36 } // namespace 36 } // namespace
37 37
38 VolumeController::VolumeController() { 38 VolumeController::VolumeController() {
39 CrasAudioHandler::Get()->AddAudioObserver(this); 39 CrasAudioHandler::Get()->AddAudioObserver(this);
40 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 40 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
41 if (VolumeAdjustSoundEnabled()) { 41 if (VolumeAdjustSoundEnabled()) {
42 media::SoundsManager::Get()->Initialize( 42 media::SoundsManager::Get()->Initialize(
43 chromeos::SOUND_VOLUME_ADJUST, 43 chromeos::SOUND_VOLUME_ADJUST,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 audio_handler->GetOutputVolumePercent(), 101 audio_handler->GetOutputVolumePercent(),
102 audio_handler->IsOutputMuted()); 102 audio_handler->IsOutputMuted());
103 } 103 }
104 104
105 void VolumeController::OnOutputMuteChanged() { 105 void VolumeController::OnOutputMuteChanged() {
106 CrasAudioHandler* audio_handler = CrasAudioHandler::Get(); 106 CrasAudioHandler* audio_handler = CrasAudioHandler::Get();
107 extensions::DispatchVolumeChangedEvent( 107 extensions::DispatchVolumeChangedEvent(
108 audio_handler->GetOutputVolumePercent(), 108 audio_handler->GetOutputVolumePercent(),
109 audio_handler->IsOutputMuted()); 109 audio_handler->IsOutputMuted());
110 } 110 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/volume_controller_browsertest_chromeos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698