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/common/system/audio/tray_audio.h" | 5 #include "ash/common/system/audio/tray_audio.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "ash/common/ash_constants.h" | 10 #include "ash/common/ash_constants.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "ui/views/controls/image_view.h" | 35 #include "ui/views/controls/image_view.h" |
36 #include "ui/views/controls/label.h" | 36 #include "ui/views/controls/label.h" |
37 #include "ui/views/controls/slider.h" | 37 #include "ui/views/controls/slider.h" |
38 #include "ui/views/layout/box_layout.h" | 38 #include "ui/views/layout/box_layout.h" |
39 #include "ui/views/view.h" | 39 #include "ui/views/view.h" |
40 | 40 |
41 namespace ash { | 41 namespace ash { |
42 | 42 |
43 TrayAudio::TrayAudio(SystemTray* system_tray, | 43 TrayAudio::TrayAudio(SystemTray* system_tray, |
44 std::unique_ptr<system::TrayAudioDelegate> audio_delegate) | 44 std::unique_ptr<system::TrayAudioDelegate> audio_delegate) |
45 : TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_VOLUME_MUTE), | 45 : TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_VOLUME_MUTE, UMA_AUDIO), |
46 audio_delegate_(std::move(audio_delegate)), | 46 audio_delegate_(std::move(audio_delegate)), |
47 volume_view_(NULL), | 47 volume_view_(NULL), |
48 pop_up_volume_view_(false) { | 48 pop_up_volume_view_(false) { |
49 WmShell::Get()->system_tray_notifier()->AddAudioObserver(this); | 49 WmShell::Get()->system_tray_notifier()->AddAudioObserver(this); |
50 display::Screen::GetScreen()->AddObserver(this); | 50 display::Screen::GetScreen()->AddObserver(this); |
51 } | 51 } |
52 | 52 |
53 TrayAudio::~TrayAudio() { | 53 TrayAudio::~TrayAudio() { |
54 display::Screen::GetScreen()->RemoveObserver(this); | 54 display::Screen::GetScreen()->RemoveObserver(this); |
55 WmShell::Get()->system_tray_notifier()->RemoveAudioObserver(this); | 55 WmShell::Get()->system_tray_notifier()->RemoveAudioObserver(this); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 if (tray_view()) | 177 if (tray_view()) |
178 tray_view()->SetVisible(GetInitialVisibility()); | 178 tray_view()->SetVisible(GetInitialVisibility()); |
179 if (volume_view_) { | 179 if (volume_view_) { |
180 volume_view_->SetVolumeLevel( | 180 volume_view_->SetVolumeLevel( |
181 static_cast<float>(audio_delegate_->GetOutputVolumeLevel()) / 100.0f); | 181 static_cast<float>(audio_delegate_->GetOutputVolumeLevel()) / 100.0f); |
182 volume_view_->Update(); | 182 volume_view_->Update(); |
183 } | 183 } |
184 } | 184 } |
185 | 185 |
186 } // namespace ash | 186 } // namespace ash |
OLD | NEW |