OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #include "ash/system/chromeos/audio/tray_audio_chromeos.h" | |
6 | |
7 #include "ash/ash_switches.h" | |
8 #include "ash/metrics/user_metrics_recorder.h" | |
9 #include "ash/shell.h" | |
10 #include "ash/system/audio/volume_view.h" | |
11 #include "ash/system/chromeos/audio/audio_detailed_view.h" | |
12 #include "ui/views/view.h" | |
13 | |
14 namespace ash { | |
15 namespace internal { | |
16 | |
17 TrayAudioChromeOs::TrayAudioChromeOs( | |
18 SystemTray* system_tray, | |
19 system::TrayAudioDelegate* audio_delegate) | |
20 : TrayAudio(system_tray, audio_delegate), | |
21 audio_detail_view_(NULL) { | |
22 } | |
23 | |
24 TrayAudioChromeOs::~TrayAudioChromeOs() { | |
25 } | |
26 | |
27 void TrayAudioChromeOs::Update() { | |
28 TrayAudio::Update(); | |
29 | |
30 if (audio_detail_view_) | |
31 audio_detail_view_->Update(); | |
32 } | |
33 | |
34 views::View* TrayAudioChromeOs::CreateDetailedView(user::LoginStatus status) { | |
35 if (!ash::switches::ShowAudioDeviceMenu() || pop_up_volume_view_) { | |
36 volume_view_ = new tray::VolumeView(this, audio_delegate_, false); | |
37 return volume_view_; | |
38 } else { | |
39 Shell::GetInstance()->metrics()->RecordUserMetricsAction( | |
40 ash::UMA_STATUS_AREA_DETAILED_AUDIO_VIEW); | |
41 audio_detail_view_ = | |
42 new tray::AudioDetailedView(this, status); | |
43 return audio_detail_view_; | |
44 } | |
45 } | |
46 | |
47 void TrayAudioChromeOs::DestroyDetailedView() { | |
48 if (audio_detail_view_) { | |
49 audio_detail_view_ = NULL; | |
50 } else if (volume_view_) { | |
51 volume_view_ = NULL; | |
52 pop_up_volume_view_ = false; | |
53 } | |
54 } | |
55 | |
56 } // namespace internal | |
57 } // namespace ash | |
OLD | NEW |