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

Unified Diff: ash/system/chromeos/audio/tray_audio_chromeos.cc

Issue 1199413008: Work around for HDMI audio output rediscovering transistion loss. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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: ash/system/chromeos/audio/tray_audio_chromeos.cc
diff --git a/ash/system/chromeos/audio/tray_audio_chromeos.cc b/ash/system/chromeos/audio/tray_audio_chromeos.cc
index d944e4ad3409b79c1d1ba1876988590a725b5a12..3d420ff6e655efc91d6ca93beb48897909439fb8 100644
--- a/ash/system/chromeos/audio/tray_audio_chromeos.cc
+++ b/ash/system/chromeos/audio/tray_audio_chromeos.cc
@@ -9,6 +9,7 @@
#include "ash/system/audio/volume_view.h"
#include "ash/system/chromeos/audio/audio_detailed_view.h"
#include "ash/system/chromeos/audio/tray_audio_delegate_chromeos.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
#include "ui/views/view.h"
namespace ash {
@@ -20,9 +21,13 @@ TrayAudioChromeOs::TrayAudioChromeOs(SystemTray* system_tray)
: TrayAudio(system_tray,
scoped_ptr<TrayAudioDelegate>(new TrayAudioDelegateChromeOs())),
audio_detail_view_(NULL) {
+ chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(
+ this);
}
TrayAudioChromeOs::~TrayAudioChromeOs() {
+ chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(
+ this);
}
void TrayAudioChromeOs::Update() {
@@ -53,4 +58,37 @@ void TrayAudioChromeOs::DestroyDetailedView() {
}
}
+void TrayAudioChromeOs::OnDisplayAdded(const gfx::Display& new_display) {
+ TrayAudio::OnDisplayAdded(new_display);
+
+ // This event will be triggered when the lid of the device is opened to exit
+ // the docked mode, we should always start or re-start HDMI re-discovering
+ // grace period right after this event.
+ audio_delegate_->SetActiveHDMIOutoutRediscoveringIfNecessary(true);
+}
+
+void TrayAudioChromeOs::OnDisplayRemoved(const gfx::Display& old_display) {
+ TrayAudio::OnDisplayRemoved(old_display);
+
+ // This event will be triggered when the lid of the device is closed to enter
+ // the docked mode, we should always start or re-start HDMI re-discovering
+ // grace period right after this event.
+ audio_delegate_->SetActiveHDMIOutoutRediscoveringIfNecessary(true);
+}
+
+void TrayAudioChromeOs::OnDisplayMetricsChanged(const gfx::Display& display,
+ uint32_t changed_metrics) {
+ // The event could be triggered multiple times during the HDMI display
+ // transition, we don't need to restart HDMI re-discovering grace period
cychiang 2015/06/26 10:00:21 does the transition mean resolution transition, or
jennyz 2015/06/29 20:49:41 This will be called during the resolution changes
+ // it is already started earlier.
+ audio_delegate_->SetActiveHDMIOutoutRediscoveringIfNecessary(false);
+}
+
+void TrayAudioChromeOs::SuspendDone(const base::TimeDelta& sleep_duration) {
+ // This event is triggered when the device resumes after earlier suspension,
+ // we should always start or re-start HDMI re-discovering
+ // grace period right after this event.
+ audio_delegate_->SetActiveHDMIOutoutRediscoveringIfNecessary(true);
+}
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698