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

Unified Diff: chrome/browser/ui/ash/volume_controller_chromeos.cc

Issue 10825264: Consolidate volume control code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + Fix virutal function name. Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/ash/volume_controller_chromeos.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/ash/volume_controller_chromeos.cc
diff --git a/chrome/browser/ui/ash/volume_controller_chromeos.cc b/chrome/browser/ui/ash/volume_controller_chromeos.cc
index e18bb019673131abfaad2b68752ab77b6e5efde9..034f0d29e247a7b0c97a2398b5cd4f5af72d8b42 100644
--- a/chrome/browser/ui/ash/volume_controller_chromeos.cc
+++ b/chrome/browser/ui/ash/volume_controller_chromeos.cc
@@ -67,6 +67,24 @@ bool VolumeController::HandleVolumeUp(const ui::Accelerator& accelerator) {
return true;
}
+bool VolumeController::IsAudioMuted() const {
+ return chromeos::AudioHandler::GetInstance()->IsMuted();
+}
+
+void VolumeController::SetAudioMuted(bool muted) {
+ chromeos::AudioHandler::GetInstance()->SetMuted(muted);
+}
+
+// Gets the volume level. The range is [0, 1.0].
+float VolumeController::GetVolumeLevel() const {
+ return chromeos::AudioHandler::GetInstance()->GetVolumePercent() / 100.f;
+}
+
+// Sets the volume level. The range is [0, 1.0].
+void VolumeController::SetVolumeLevel(float level) {
+ chromeos::AudioHandler::GetInstance()->SetVolumePercent(level * 100.f);
+}
+
void VolumeController::SetVolumePercent(double percent) {
chromeos::AudioHandler* audio_handler = chromeos::AudioHandler::GetInstance();
audio_handler->SetVolumePercent(percent);
« no previous file with comments | « chrome/browser/ui/ash/volume_controller_chromeos.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698