OLD | NEW |
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 "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/chromeos/audio/audio_handler.h" | 9 #include "chrome/browser/chromeos/audio/audio_handler.h" |
10 #include "chrome/browser/extensions/api/system_private/system_private_api.h" | 10 #include "chrome/browser/extensions/api/system_private/system_private_api.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 bool VolumeController::HandleVolumeUp(const ui::Accelerator& accelerator) { | 80 bool VolumeController::HandleVolumeUp(const ui::Accelerator& accelerator) { |
81 if (accelerator.key_code() == ui::VKEY_VOLUME_UP) | 81 if (accelerator.key_code() == ui::VKEY_VOLUME_UP) |
82 content::RecordAction(content::UserMetricsAction("Accel_VolumeUp_F10")); | 82 content::RecordAction(content::UserMetricsAction("Accel_VolumeUp_F10")); |
83 | 83 |
84 if (ash::switches::UseNewAudioHandler()) { | 84 if (ash::switches::UseNewAudioHandler()) { |
85 CrasAudioHandler* audio_handler = CrasAudioHandler::Get(); | 85 CrasAudioHandler* audio_handler = CrasAudioHandler::Get(); |
86 | 86 |
87 if (audio_handler->IsOutputMuted()) | 87 if (audio_handler->IsOutputMuted()) |
88 audio_handler->SetOutputMute(false); | 88 audio_handler->SetOutputMute(false); |
89 audio_handler->AdjustOutputVolumeByPercent(kStepPercentage); | 89 else |
| 90 audio_handler->AdjustOutputVolumeByPercent(kStepPercentage); |
90 return true; | 91 return true; |
91 } | 92 } |
92 | 93 |
93 chromeos::AudioHandler* audio_handler = chromeos::AudioHandler::GetInstance(); | 94 chromeos::AudioHandler* audio_handler = chromeos::AudioHandler::GetInstance(); |
94 if (audio_handler->IsMuted()) { | 95 if (audio_handler->IsMuted()) { |
95 audio_handler->SetMuted(false); | 96 audio_handler->SetMuted(false); |
96 } else { | 97 } else { |
97 audio_handler->AdjustVolumeByPercent(kStepPercentage); | 98 audio_handler->AdjustVolumeByPercent(kStepPercentage); |
98 } | 99 } |
99 | 100 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 audio_handler->IsOutputMuted()); | 140 audio_handler->IsOutputMuted()); |
140 } | 141 } |
141 | 142 |
142 void VolumeController::OnOutputMuteChanged() { | 143 void VolumeController::OnOutputMuteChanged() { |
143 DCHECK(ash::switches::UseNewAudioHandler()); | 144 DCHECK(ash::switches::UseNewAudioHandler()); |
144 CrasAudioHandler* audio_handler = CrasAudioHandler::Get(); | 145 CrasAudioHandler* audio_handler = CrasAudioHandler::Get(); |
145 extensions::DispatchVolumeChangedEvent( | 146 extensions::DispatchVolumeChangedEvent( |
146 audio_handler->GetOutputVolumePercent(), | 147 audio_handler->GetOutputVolumePercent(), |
147 audio_handler->IsOutputMuted()); | 148 audio_handler->IsOutputMuted()); |
148 } | 149 } |
OLD | NEW |