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 034f0d29e247a7b0c97a2398b5cd4f5af72d8b42..40d9f3cdf98115850d371e4662f70e48302dea79 100644 |
--- a/chrome/browser/ui/ash/volume_controller_chromeos.cc |
+++ b/chrome/browser/ui/ash/volume_controller_chromeos.cc |
@@ -7,6 +7,7 @@ |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/chromeos/audio/audio_handler.h" |
#include "chrome/browser/extensions/system/system_api.h" |
+#include "chrome/browser/profiles/profile_manager.h" |
#include "content/public/browser/user_metrics.h" |
namespace { |
@@ -26,8 +27,12 @@ bool VolumeController::HandleVolumeMute(const ui::Accelerator& accelerator) { |
// http://crosbug.com/3751 |
audio_handler->SetMuted(true); |
- extensions::DispatchVolumeChangedEvent(audio_handler->GetVolumePercent(), |
- audio_handler->IsMuted()); |
+ Profile* profile = ProfileManager::GetDefaultProfile(); |
+ if (profile) { |
+ extensions::DispatchVolumeChangedEvent(profile, |
+ audio_handler->GetVolumePercent(), |
+ audio_handler->IsMuted()); |
+ } |
return true; |
} |
@@ -41,8 +46,12 @@ bool VolumeController::HandleVolumeDown(const ui::Accelerator& accelerator) { |
else |
audio_handler->AdjustVolumeByPercent(-kStepPercentage); |
- extensions::DispatchVolumeChangedEvent(audio_handler->GetVolumePercent(), |
- audio_handler->IsMuted()); |
+ Profile* profile = ProfileManager::GetDefaultProfile(); |
+ if (profile) { |
+ extensions::DispatchVolumeChangedEvent(profile, |
+ audio_handler->GetVolumePercent(), |
+ audio_handler->IsMuted()); |
+ } |
return true; |
} |
@@ -62,8 +71,12 @@ bool VolumeController::HandleVolumeUp(const ui::Accelerator& accelerator) { |
audio_handler->AdjustVolumeByPercent(kStepPercentage); |
} |
- extensions::DispatchVolumeChangedEvent(audio_handler->GetVolumePercent(), |
- audio_handler->IsMuted()); |
+ Profile* profile = ProfileManager::GetDefaultProfile(); |
+ if (profile) { |
+ extensions::DispatchVolumeChangedEvent(profile, |
+ audio_handler->GetVolumePercent(), |
+ audio_handler->IsMuted()); |
+ } |
return true; |
} |
@@ -88,6 +101,10 @@ void VolumeController::SetVolumeLevel(float level) { |
void VolumeController::SetVolumePercent(double percent) { |
chromeos::AudioHandler* audio_handler = chromeos::AudioHandler::GetInstance(); |
audio_handler->SetVolumePercent(percent); |
- extensions::DispatchVolumeChangedEvent(audio_handler->GetVolumePercent(), |
- audio_handler->IsMuted()); |
+ Profile* profile = ProfileManager::GetDefaultProfile(); |
+ if (profile) { |
+ extensions::DispatchVolumeChangedEvent(profile, |
+ audio_handler->GetVolumePercent(), |
+ audio_handler->IsMuted()); |
+ } |
} |