Index: chrome/browser/chromeos/system/ash_system_tray_delegate.cc |
diff --git a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc |
index 5bd64e8ad6034f62ee6e02f2929810082c6698de..6e44a1fbd869c41b6a9b023fc09c1cd3028c0f9c 100644 |
--- a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc |
+++ b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc |
@@ -118,6 +118,11 @@ const int kSessionLengthLimitMinMs = 30 * 1000; // 30 seconds. |
// The maximum session length limit that can be set. |
const int kSessionLengthLimitMaxMs = 24 * 60 * 60 * 1000; // 24 hours. |
+bool UseNewAudioHandler() { |
+ return !CommandLine::ForCurrentProcess()-> |
+ HasSwitch(ash::switches::kAshDisableNewAudioHandler); |
+} |
+ |
ash::NetworkIconInfo CreateNetworkIconInfo(const Network* network) { |
ash::NetworkIconInfo info; |
info.name = network->type() == TYPE_ETHERNET ? |
@@ -300,8 +305,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, |
} |
virtual void Initialize() OVERRIDE { |
- if (!CommandLine::ForCurrentProcess()-> |
- HasSwitch(ash::switches::kAshEnableNewAudioHandler)) { |
+ if (!UseNewAudioHandler()) { |
AudioHandler::GetInstance()->AddVolumeObserver(this); |
} |
DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); |
@@ -364,9 +368,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, |
} |
virtual ~SystemTrayDelegate() { |
- if (!CommandLine::ForCurrentProcess()-> |
- HasSwitch(ash::switches::kAshEnableNewAudioHandler) && |
- AudioHandler::GetInstance()) { |
+ if (!UseNewAudioHandler() && AudioHandler::GetInstance()) { |
AudioHandler::GetInstance()->RemoveVolumeObserver(this); |
} |