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 "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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 bool VolumeController::HandleVolumeDown(const ui::Accelerator& accelerator) { | 61 bool VolumeController::HandleVolumeDown(const ui::Accelerator& accelerator) { |
62 if (accelerator.key_code() == ui::VKEY_VOLUME_DOWN) | 62 if (accelerator.key_code() == ui::VKEY_VOLUME_DOWN) |
63 content::RecordAction(base::UserMetricsAction("Accel_VolumeDown_F9")); | 63 content::RecordAction(base::UserMetricsAction("Accel_VolumeDown_F9")); |
64 | 64 |
65 CrasAudioHandler* audio_handler = CrasAudioHandler::Get(); | 65 CrasAudioHandler* audio_handler = CrasAudioHandler::Get(); |
66 if (audio_handler->IsOutputMuted()) { | 66 if (audio_handler->IsOutputMuted()) { |
67 audio_handler->SetOutputVolumePercent(0); | 67 audio_handler->SetOutputVolumePercent(0); |
68 } else { | 68 } else { |
69 audio_handler->AdjustOutputVolumeByPercent(-kStepPercentage); | 69 audio_handler->AdjustOutputVolumeByPercent(-kStepPercentage); |
70 if (audio_handler->IsOutputVolumeBelowDefaultMuteLvel()) | 70 if (audio_handler->IsOutputVolumeBelowDefaultMuteLevel()) |
71 audio_handler->SetOutputMute(true); | 71 audio_handler->SetOutputMute(true); |
72 else | 72 else |
73 PlayVolumeAdjustSound(); | 73 PlayVolumeAdjustSound(); |
74 } | 74 } |
75 return true; | 75 return true; |
76 } | 76 } |
77 | 77 |
78 bool VolumeController::HandleVolumeUp(const ui::Accelerator& accelerator) { | 78 bool VolumeController::HandleVolumeUp(const ui::Accelerator& accelerator) { |
79 if (accelerator.key_code() == ui::VKEY_VOLUME_UP) | 79 if (accelerator.key_code() == ui::VKEY_VOLUME_UP) |
80 content::RecordAction(base::UserMetricsAction("Accel_VolumeUp_F10")); | 80 content::RecordAction(base::UserMetricsAction("Accel_VolumeUp_F10")); |
(...skipping 20 matching lines...) Expand all Loading... |
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 } |
OLD | NEW |