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

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

Issue 10911261: chromeos: Stop calling ProfileManager::GetDefaultProfile() from extension event dispatch functions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added function comments Created 8 years, 3 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
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());
+ }
}

Powered by Google App Engine
This is Rietveld 408576698