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

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

Issue 163953007: Refactor the TrayAudio code so that it can be used by other platforms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove missing else condition Created 6 years, 10 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/system_tray_delegate_chromeos.cc
diff --git a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
index 7ee966b5c341e69e6ebb7bf2ad0b5e7dc9835242..569c798e272ac8d5e9004a2e01f566ba1e9b15a5 100644
--- a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
+++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
@@ -89,6 +89,7 @@
#include "chrome/browser/upgrade_detector.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
+#include "chromeos/audio/cras_audio_handler.h"
jennyz 2014/02/18 17:57:48 nit: cras_audio_handler.h is already included in t
#include "chromeos/chromeos_switches.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/session_manager_client.h"
@@ -312,6 +313,9 @@ void SystemTrayDelegateChromeOS::Initialize() {
if (LoginState::IsInitialized())
LoginState::Get()->AddObserver(this);
+
+ if (CrasAudioHandler::IsInitialized())
+ CrasAudioHandler::Get()->AddAudioObserver(this);
}
void SystemTrayDelegateChromeOS::Shutdown() {
@@ -366,7 +370,10 @@ SystemTrayDelegateChromeOS::~SystemTrayDelegateChromeOS() {
->RemoveSessionStateObserver(this);
LoginState::Get()->RemoveObserver(this);
- // Stop observing Drive operations.
+ if (CrasAudioHandler::IsInitialized())
+ CrasAudioHandler::Get()->RemoveAudioObserver(this);
+
+// Stop observing Drive operations.
UnobserveDriveUpdates();
policy::BrowserPolicyConnectorChromeOS* connector =
@@ -1207,6 +1214,33 @@ void SystemTrayDelegateChromeOS::InputMethodPropertyChanged(
GetSystemTrayNotifier()->NotifyRefreshIME(false);
}
+// Overridden from CrasAudioHandler::AudioObserver.
+void SystemTrayDelegateChromeOS::OnOutputVolumeChanged() {
+ GetSystemTrayNotifier()->NotifyAudioOutputVolumeChanged();
+}
+
+void SystemTrayDelegateChromeOS::OnOutputMuteChanged() {
+ GetSystemTrayNotifier()->NotifyAudioOutputMuteChanged();
+}
+
+void SystemTrayDelegateChromeOS::OnInputGainChanged() {
+}
+
+void SystemTrayDelegateChromeOS::OnInputMuteChanged() {
+}
+
+void SystemTrayDelegateChromeOS::OnAudioNodesChanged() {
+ GetSystemTrayNotifier()->NotifyAudioNodesChanged();
+}
+
+void SystemTrayDelegateChromeOS::OnActiveOutputNodeChanged() {
+ GetSystemTrayNotifier()->NotifyAudioActiveOutputNodeChanged();
+}
+
+void SystemTrayDelegateChromeOS::OnActiveInputNodeChanged() {
+ GetSystemTrayNotifier()->NotifyAudioActiveInputNodeChanged();
+}
+
// drive::JobListObserver overrides.
void SystemTrayDelegateChromeOS::OnJobAdded(const drive::JobInfo& job_info) {
OnJobUpdated(job_info);

Powered by Google App Engine
This is Rietveld 408576698