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/audio/tray_audio.h" | 5 #include "ash/system/audio/tray_audio.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
| 8 #include <utility> |
8 | 9 |
9 #include "ash/ash_constants.h" | 10 #include "ash/ash_constants.h" |
10 #include "ash/display/display_manager.h" | 11 #include "ash/display/display_manager.h" |
11 #include "ash/metrics/user_metrics_recorder.h" | 12 #include "ash/metrics/user_metrics_recorder.h" |
12 #include "ash/shell.h" | 13 #include "ash/shell.h" |
13 #include "ash/system/audio/tray_audio_delegate.h" | 14 #include "ash/system/audio/tray_audio_delegate.h" |
14 #include "ash/system/audio/volume_view.h" | 15 #include "ash/system/audio/volume_view.h" |
15 #include "ash/system/tray/actionable_view.h" | 16 #include "ash/system/tray/actionable_view.h" |
16 #include "ash/system/tray/fixed_sized_scroll_view.h" | 17 #include "ash/system/tray/fixed_sized_scroll_view.h" |
17 #include "ash/system/tray/hover_highlight_view.h" | 18 #include "ash/system/tray/hover_highlight_view.h" |
(...skipping 18 matching lines...) Expand all Loading... |
36 #include "ui/views/controls/label.h" | 37 #include "ui/views/controls/label.h" |
37 #include "ui/views/controls/slider.h" | 38 #include "ui/views/controls/slider.h" |
38 #include "ui/views/layout/box_layout.h" | 39 #include "ui/views/layout/box_layout.h" |
39 #include "ui/views/view.h" | 40 #include "ui/views/view.h" |
40 | 41 |
41 namespace ash { | 42 namespace ash { |
42 | 43 |
43 TrayAudio::TrayAudio(SystemTray* system_tray, | 44 TrayAudio::TrayAudio(SystemTray* system_tray, |
44 scoped_ptr<system::TrayAudioDelegate> audio_delegate) | 45 scoped_ptr<system::TrayAudioDelegate> audio_delegate) |
45 : TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_VOLUME_MUTE), | 46 : TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_VOLUME_MUTE), |
46 audio_delegate_(audio_delegate.Pass()), | 47 audio_delegate_(std::move(audio_delegate)), |
47 volume_view_(NULL), | 48 volume_view_(NULL), |
48 pop_up_volume_view_(false) { | 49 pop_up_volume_view_(false) { |
49 Shell::GetInstance()->system_tray_notifier()->AddAudioObserver(this); | 50 Shell::GetInstance()->system_tray_notifier()->AddAudioObserver(this); |
50 Shell::GetScreen()->AddObserver(this); | 51 Shell::GetScreen()->AddObserver(this); |
51 } | 52 } |
52 | 53 |
53 TrayAudio::~TrayAudio() { | 54 TrayAudio::~TrayAudio() { |
54 Shell::GetScreen()->RemoveObserver(this); | 55 Shell::GetScreen()->RemoveObserver(this); |
55 Shell::GetInstance()->system_tray_notifier()->RemoveAudioObserver(this); | 56 Shell::GetInstance()->system_tray_notifier()->RemoveAudioObserver(this); |
56 } | 57 } |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 if (tray_view()) | 179 if (tray_view()) |
179 tray_view()->SetVisible(GetInitialVisibility()); | 180 tray_view()->SetVisible(GetInitialVisibility()); |
180 if (volume_view_) { | 181 if (volume_view_) { |
181 volume_view_->SetVolumeLevel( | 182 volume_view_->SetVolumeLevel( |
182 static_cast<float>(audio_delegate_->GetOutputVolumeLevel()) / 100.0f); | 183 static_cast<float>(audio_delegate_->GetOutputVolumeLevel()) / 100.0f); |
183 volume_view_->Update(); | 184 volume_view_->Update(); |
184 } | 185 } |
185 } | 186 } |
186 | 187 |
187 } // namespace ash | 188 } // namespace ash |
OLD | NEW |