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

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

Issue 2142463002: ash: Remove media dependency from ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: oops Created 4 years, 5 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
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/audio/sounds.h"
8 #include "ash/common/ash_switches.h" 7 #include "ash/common/ash_switches.h"
9 #include "base/command_line.h" 8 #include "base/command_line.h"
10 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
11 #include "chrome/browser/extensions/api/system_private/system_private_api.h" 11 #include "chrome/browser/extensions/api/system_private/system_private_api.h"
12 #include "chromeos/audio/chromeos_sounds.h" 12 #include "chromeos/audio/chromeos_sounds.h"
13 #include "chromeos/chromeos_switches.h" 13 #include "chromeos/chromeos_switches.h"
14 #include "content/public/browser/user_metrics.h" 14 #include "content/public/browser/user_metrics.h"
15 #include "grit/browser_resources.h" 15 #include "grit/browser_resources.h"
16 #include "media/audio/sounds/sounds_manager.h" 16 #include "media/audio/sounds/sounds_manager.h"
17 #include "ui/base/resource/resource_bundle.h" 17 #include "ui/base/resource/resource_bundle.h"
18 18
19 using chromeos::CrasAudioHandler; 19 using chromeos::CrasAudioHandler;
20 20
21 namespace { 21 namespace {
22 22
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 !base::CommandLine::ForCurrentProcess()->HasSwitch( 27 return !base::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::PlaySystemSoundIfSpokenFeedback(chromeos::SOUND_VOLUME_ADJUST); 33 chromeos::AccessibilityManager::Get()->PlayEarcon(
34 chromeos::SOUND_VOLUME_ADJUST,
35 chromeos::PlaySoundOption::SPOKEN_FEEDBACK_ENABLED);
36 }
34 } 37 }
35 38
36 } // namespace 39 } // namespace
37 40
38 VolumeController::VolumeController() { 41 VolumeController::VolumeController() {
39 CrasAudioHandler::Get()->AddAudioObserver(this); 42 CrasAudioHandler::Get()->AddAudioObserver(this);
40 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 43 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
41 if (VolumeAdjustSoundEnabled()) { 44 if (VolumeAdjustSoundEnabled()) {
42 media::SoundsManager::Get()->Initialize( 45 media::SoundsManager::Get()->Initialize(
43 chromeos::SOUND_VOLUME_ADJUST, 46 chromeos::SOUND_VOLUME_ADJUST,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 audio_handler->IsOutputMuted()); 102 audio_handler->IsOutputMuted());
100 } 103 }
101 104
102 void VolumeController::OnOutputMuteChanged(bool /* mute_on */, 105 void VolumeController::OnOutputMuteChanged(bool /* mute_on */,
103 bool /* system_adjust */) { 106 bool /* system_adjust */) {
104 CrasAudioHandler* audio_handler = CrasAudioHandler::Get(); 107 CrasAudioHandler* audio_handler = CrasAudioHandler::Get();
105 extensions::DispatchVolumeChangedEvent( 108 extensions::DispatchVolumeChangedEvent(
106 audio_handler->GetOutputVolumePercent(), 109 audio_handler->GetOutputVolumePercent(),
107 audio_handler->IsOutputMuted()); 110 audio_handler->IsOutputMuted());
108 } 111 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698