OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/system/chromeos/audio/tray_audio_chromeos.h" | 5 #include "ash/system/chromeos/audio/tray_audio_chromeos.h" |
6 | 6 |
7 #include "ash/metrics/user_metrics_recorder.h" | 7 #include "ash/metrics/user_metrics_recorder.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/system/audio/volume_view.h" | 9 #include "ash/system/audio/volume_view.h" |
10 #include "ash/system/chromeos/audio/audio_detailed_view.h" | 10 #include "ash/system/chromeos/audio/audio_detailed_view.h" |
11 #include "ash/system/chromeos/audio/tray_audio_delegate_chromeos.h" | 11 #include "ash/system/chromeos/audio/tray_audio_delegate_chromeos.h" |
12 #include "chromeos/dbus/dbus_thread_manager.h" | |
12 #include "ui/views/view.h" | 13 #include "ui/views/view.h" |
13 | 14 |
14 namespace ash { | 15 namespace ash { |
15 | 16 |
16 using system::TrayAudioDelegate; | 17 using system::TrayAudioDelegate; |
17 using system::TrayAudioDelegateChromeOs; | 18 using system::TrayAudioDelegateChromeOs; |
18 | 19 |
19 TrayAudioChromeOs::TrayAudioChromeOs(SystemTray* system_tray) | 20 TrayAudioChromeOs::TrayAudioChromeOs(SystemTray* system_tray) |
20 : TrayAudio(system_tray, | 21 : TrayAudio(system_tray, |
21 scoped_ptr<TrayAudioDelegate>(new TrayAudioDelegateChromeOs())), | 22 scoped_ptr<TrayAudioDelegate>(new TrayAudioDelegateChromeOs())), |
22 audio_detail_view_(NULL) { | 23 audio_detail_view_(NULL) { |
24 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver( | |
25 this); | |
23 } | 26 } |
24 | 27 |
25 TrayAudioChromeOs::~TrayAudioChromeOs() { | 28 TrayAudioChromeOs::~TrayAudioChromeOs() { |
29 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver( | |
30 this); | |
26 } | 31 } |
27 | 32 |
28 void TrayAudioChromeOs::Update() { | 33 void TrayAudioChromeOs::Update() { |
29 TrayAudio::Update(); | 34 TrayAudio::Update(); |
30 | 35 |
31 if (audio_detail_view_) | 36 if (audio_detail_view_) |
32 audio_detail_view_->Update(); | 37 audio_detail_view_->Update(); |
33 } | 38 } |
34 | 39 |
35 views::View* TrayAudioChromeOs::CreateDetailedView(user::LoginStatus status) { | 40 views::View* TrayAudioChromeOs::CreateDetailedView(user::LoginStatus status) { |
(...skipping 10 matching lines...) Expand all Loading... | |
46 | 51 |
47 void TrayAudioChromeOs::DestroyDetailedView() { | 52 void TrayAudioChromeOs::DestroyDetailedView() { |
48 if (audio_detail_view_) { | 53 if (audio_detail_view_) { |
49 audio_detail_view_ = NULL; | 54 audio_detail_view_ = NULL; |
50 } else if (volume_view_) { | 55 } else if (volume_view_) { |
51 volume_view_ = NULL; | 56 volume_view_ = NULL; |
52 pop_up_volume_view_ = false; | 57 pop_up_volume_view_ = false; |
53 } | 58 } |
54 } | 59 } |
55 | 60 |
61 void TrayAudioChromeOs::OnDisplayAdded(const gfx::Display& new_display) { | |
62 TrayAudio::OnDisplayAdded(new_display); | |
63 | |
64 // This event will be triggered when the lid of the device is opened to exit | |
65 // the docked mode, we should always start or re-start HDMI re-discovering | |
66 // grace period right after this event. | |
67 audio_delegate_->SetActiveHDMIOutoutRediscoveringIfNecessary(true); | |
68 } | |
69 | |
70 void TrayAudioChromeOs::OnDisplayRemoved(const gfx::Display& old_display) { | |
71 TrayAudio::OnDisplayRemoved(old_display); | |
72 | |
73 // This event will be triggered when the lid of the device is closed to enter | |
74 // the docked mode, we should always start or re-start HDMI re-discovering | |
75 // grace period right after this event. | |
76 audio_delegate_->SetActiveHDMIOutoutRediscoveringIfNecessary(true); | |
77 } | |
78 | |
79 void TrayAudioChromeOs::OnDisplayMetricsChanged(const gfx::Display& display, | |
80 uint32_t changed_metrics) { | |
81 // The event could be triggered multiple times during the HDMI display | |
82 // 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
| |
83 // it is already started earlier. | |
84 audio_delegate_->SetActiveHDMIOutoutRediscoveringIfNecessary(false); | |
85 } | |
86 | |
87 void TrayAudioChromeOs::SuspendDone(const base::TimeDelta& sleep_duration) { | |
88 // This event is triggered when the device resumes after earlier suspension, | |
89 // we should always start or re-start HDMI re-discovering | |
90 // grace period right after this event. | |
91 audio_delegate_->SetActiveHDMIOutoutRediscoveringIfNecessary(true); | |
92 } | |
93 | |
56 } // namespace ash | 94 } // namespace ash |
OLD | NEW |