Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ash / system / chromeos / audio / tray_audio_chromeos.cc
blob0126dda7ef5b3808a4a758dfdcf0c9e2c1d2df22
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"
8 #include "ash/shell.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"
14 namespace ash {
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() {
29 TrayAudio::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);
38 return volume_view_;
39 } else {
40 Shell::GetInstance()->metrics()->RecordUserMetricsAction(
41 ash::UMA_STATUS_AREA_DETAILED_AUDIO_VIEW);
42 audio_detail_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_) {
52 volume_view_ = NULL;
53 pop_up_volume_view_ = false;
57 } // namespace ash