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/volume_view.h" | 5 #include "ash/system/audio/volume_view.h" |
6 | 6 |
7 #include "ash/ash_constants.h" | 7 #include "ash/ash_constants.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/system/audio/tray_audio.h" | 9 #include "ash/system/audio/tray_audio.h" |
10 #include "ash/system/audio/tray_audio_delegate.h" | 10 #include "ash/system/audio/tray_audio_delegate.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 class VolumeButton : public views::ToggleImageButton { | 40 class VolumeButton : public views::ToggleImageButton { |
41 public: | 41 public: |
42 VolumeButton(views::ButtonListener* listener, | 42 VolumeButton(views::ButtonListener* listener, |
43 system::TrayAudioDelegate* audio_delegate) | 43 system::TrayAudioDelegate* audio_delegate) |
44 : views::ToggleImageButton(listener), | 44 : views::ToggleImageButton(listener), |
45 audio_delegate_(audio_delegate), | 45 audio_delegate_(audio_delegate), |
46 image_index_(-1) { | 46 image_index_(-1) { |
47 SetImageAlignment(ALIGN_CENTER, ALIGN_MIDDLE); | 47 SetImageAlignment(ALIGN_CENTER, ALIGN_MIDDLE); |
48 image_ = ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 48 image_ = ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
49 IDR_AURA_UBER_TRAY_VOLUME_LEVELS); | 49 IDR_AURA_UBER_TRAY_VOLUME_LEVELS); |
50 SetPreferredSize(gfx::Size(kTrayPopupItemHeight, kTrayPopupItemHeight)); | |
51 Update(); | 50 Update(); |
52 } | 51 } |
53 | 52 |
54 virtual ~VolumeButton() {} | 53 virtual ~VolumeButton() {} |
55 | 54 |
56 void Update() { | 55 void Update() { |
57 float level = | 56 float level = |
58 static_cast<float>(audio_delegate_->GetOutputVolumeLevel()) / 100.0f; | 57 static_cast<float>(audio_delegate_->GetOutputVolumeLevel()) / 100.0f; |
59 int image_index = audio_delegate_->IsOutputAudioMuted() ? | 58 int image_index = audio_delegate_->IsOutputAudioMuted() ? |
60 0 : (level == 1.0 ? | 59 0 : (level == 1.0 ? |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 | 320 |
322 bool VolumeView::PerformAction(const ui::Event& event) { | 321 bool VolumeView::PerformAction(const ui::Event& event) { |
323 if (!more_->visible()) | 322 if (!more_->visible()) |
324 return false; | 323 return false; |
325 owner_->TransitionDetailedView(); | 324 owner_->TransitionDetailedView(); |
326 return true; | 325 return true; |
327 } | 326 } |
328 | 327 |
329 } // namespace tray | 328 } // namespace tray |
330 } // namespace ash | 329 } // namespace ash |
OLD | NEW |