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 #include <utility> |
9 | 9 |
10 #include "ash/ash_constants.h" | 10 #include "ash/ash_constants.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 return true; | 62 return true; |
63 #else | 63 #else |
64 return false; | 64 return false; |
65 #endif | 65 #endif |
66 } | 66 } |
67 | 67 |
68 bool TrayAudio::GetInitialVisibility() { | 68 bool TrayAudio::GetInitialVisibility() { |
69 return audio_delegate_->IsOutputAudioMuted(); | 69 return audio_delegate_->IsOutputAudioMuted(); |
70 } | 70 } |
71 | 71 |
72 views::View* TrayAudio::CreateDefaultView(user::LoginStatus status) { | 72 views::View* TrayAudio::CreateDefaultView(LoginStatus status) { |
73 volume_view_ = new tray::VolumeView(this, audio_delegate_.get(), true); | 73 volume_view_ = new tray::VolumeView(this, audio_delegate_.get(), true); |
74 return volume_view_; | 74 return volume_view_; |
75 } | 75 } |
76 | 76 |
77 views::View* TrayAudio::CreateDetailedView(user::LoginStatus status) { | 77 views::View* TrayAudio::CreateDetailedView(LoginStatus status) { |
78 volume_view_ = new tray::VolumeView(this, audio_delegate_.get(), false); | 78 volume_view_ = new tray::VolumeView(this, audio_delegate_.get(), false); |
79 return volume_view_; | 79 return volume_view_; |
80 } | 80 } |
81 | 81 |
82 void TrayAudio::DestroyDefaultView() { | 82 void TrayAudio::DestroyDefaultView() { |
83 volume_view_ = NULL; | 83 volume_view_ = NULL; |
84 } | 84 } |
85 | 85 |
86 void TrayAudio::DestroyDetailedView() { | 86 void TrayAudio::DestroyDetailedView() { |
87 if (volume_view_) { | 87 if (volume_view_) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 if (tray_view()) | 179 if (tray_view()) |
180 tray_view()->SetVisible(GetInitialVisibility()); | 180 tray_view()->SetVisible(GetInitialVisibility()); |
181 if (volume_view_) { | 181 if (volume_view_) { |
182 volume_view_->SetVolumeLevel( | 182 volume_view_->SetVolumeLevel( |
183 static_cast<float>(audio_delegate_->GetOutputVolumeLevel()) / 100.0f); | 183 static_cast<float>(audio_delegate_->GetOutputVolumeLevel()) / 100.0f); |
184 volume_view_->Update(); | 184 volume_view_->Update(); |
185 } | 185 } |
186 } | 186 } |
187 | 187 |
188 } // namespace ash | 188 } // namespace ash |
OLD | NEW |