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
3 // found in the LICENSE file.
5 #include "ash/system/chromeos/audio/tray_audio_chromeos.h"
7 #include "ash/metrics/user_metrics_recorder.h"
9 #include "ash/system/audio/volume_view.h"
10 #include "ash/system/chromeos/audio/audio_detailed_view.h"
11 #include "ash/system/chromeos/audio/tray_audio_delegate_chromeos.h"
12 #include "ui/views/view.h"
16 using system::TrayAudioDelegate
;
17 using system::TrayAudioDelegateChromeOs
;
19 TrayAudioChromeOs::TrayAudioChromeOs(SystemTray
* system_tray
)
20 : TrayAudio(system_tray
,
21 scoped_ptr
<TrayAudioDelegate
>(new TrayAudioDelegateChromeOs())),
22 audio_detail_view_(NULL
) {
25 TrayAudioChromeOs::~TrayAudioChromeOs() {
28 void TrayAudioChromeOs::Update() {
31 if (audio_detail_view_
)
32 audio_detail_view_
->Update();
35 views::View
* TrayAudioChromeOs::CreateDetailedView(user::LoginStatus status
) {
36 if (pop_up_volume_view_
) {
37 volume_view_
= new tray::VolumeView(this, audio_delegate_
.get(), false);
40 Shell::GetInstance()->metrics()->RecordUserMetricsAction(
41 ash::UMA_STATUS_AREA_DETAILED_AUDIO_VIEW
);
43 new tray::AudioDetailedView(this, status
);
44 return audio_detail_view_
;
48 void TrayAudioChromeOs::DestroyDetailedView() {
49 if (audio_detail_view_
) {
50 audio_detail_view_
= NULL
;
51 } else if (volume_view_
) {
53 pop_up_volume_view_
= false;