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/views/ash/volume_controller_chromeos.h" | 5 #include "chrome/browser/ui/views/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/system/system_api.h" |
10 #include "content/public/browser/user_metrics.h" | 10 #include "content/public/browser/user_metrics.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 if (audio_handler->GetVolumePercent() <= 0.1) // float comparison | 61 if (audio_handler->GetVolumePercent() <= 0.1) // float comparison |
62 audio_handler->SetVolumePercent(kVolumePercentOnVolumeUpWhileMuted); | 62 audio_handler->SetVolumePercent(kVolumePercentOnVolumeUpWhileMuted); |
63 } else { | 63 } else { |
64 audio_handler->AdjustVolumeByPercent(kStepPercentage); | 64 audio_handler->AdjustVolumeByPercent(kStepPercentage); |
65 } | 65 } |
66 | 66 |
67 extensions::DispatchVolumeChangedEvent(audio_handler->GetVolumePercent(), | 67 extensions::DispatchVolumeChangedEvent(audio_handler->GetVolumePercent(), |
68 audio_handler->IsMuted()); | 68 audio_handler->IsMuted()); |
69 return true; | 69 return true; |
70 } | 70 } |
| 71 |
| 72 void VolumeController::SetVolumePercent(double percent) { |
| 73 chromeos::AudioHandler* audio_handler = chromeos::AudioHandler::GetInstance(); |
| 74 if (audio_handler->IsMuted()) { |
| 75 audio_handler->SetMuted(false); |
| 76 } |
| 77 audio_handler->SetVolumePercent(percent); |
| 78 extensions::DispatchVolumeChangedEvent(audio_handler->GetVolumePercent(), |
| 79 audio_handler->IsMuted()); |
| 80 } |
OLD | NEW |