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 "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/chromeos/audio/audio_handler.h" | 8 #include "chrome/browser/chromeos/audio/audio_handler.h" |
9 #include "chrome/browser/extensions/system/system_api.h" | 9 #include "chrome/browser/extensions/api/system_private/system_private_api.h" |
10 #include "content/public/browser/user_metrics.h" | 10 #include "content/public/browser/user_metrics.h" |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 // Percent by which the volume should be changed when a volume key is pressed. | 14 // Percent by which the volume should be changed when a volume key is pressed. |
15 const double kStepPercentage = 4.0; | 15 const double kStepPercentage = 4.0; |
16 | 16 |
17 } // namespace | 17 } // namespace |
18 | 18 |
19 bool VolumeController::HandleVolumeMute(const ui::Accelerator& accelerator) { | 19 bool VolumeController::HandleVolumeMute(const ui::Accelerator& accelerator) { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 void VolumeController::SetVolumeLevel(float level) { | 79 void VolumeController::SetVolumeLevel(float level) { |
80 SetVolumePercent(level * 100.f); | 80 SetVolumePercent(level * 100.f); |
81 } | 81 } |
82 | 82 |
83 void VolumeController::SetVolumePercent(double percent) { | 83 void VolumeController::SetVolumePercent(double percent) { |
84 chromeos::AudioHandler* audio_handler = chromeos::AudioHandler::GetInstance(); | 84 chromeos::AudioHandler* audio_handler = chromeos::AudioHandler::GetInstance(); |
85 audio_handler->SetVolumePercent(percent); | 85 audio_handler->SetVolumePercent(percent); |
86 extensions::DispatchVolumeChangedEvent(audio_handler->GetVolumePercent(), | 86 extensions::DispatchVolumeChangedEvent(audio_handler->GetVolumePercent(), |
87 audio_handler->IsMuted()); | 87 audio_handler->IsMuted()); |
88 } | 88 } |
OLD | NEW |