OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef ASH_COMMON_SYSTEM_CHROMEOS_AUDIO_VOLUME_VIEW_H_ | |
6 #define ASH_COMMON_SYSTEM_CHROMEOS_AUDIO_VOLUME_VIEW_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "ui/views/controls/button/button.h" | |
10 #include "ui/views/controls/slider.h" | |
11 #include "ui/views/view.h" | |
12 | |
13 namespace views { | |
14 class CustomButton; | |
15 class ImageView; | |
16 } | |
17 | |
18 namespace ash { | |
19 class SystemTrayItem; | |
20 class TriView; | |
21 | |
22 namespace system { | |
23 class TrayAudioDelegate; | |
24 } | |
25 | |
26 namespace tray { | |
27 class VolumeButton; | |
28 | |
29 class VolumeView : public views::View, | |
30 public views::SliderListener, | |
31 public views::ButtonListener { | |
32 public: | |
33 VolumeView(SystemTrayItem* owner, | |
34 system::TrayAudioDelegate* audio_delegate, | |
35 bool is_default_view); | |
36 | |
37 ~VolumeView() override; | |
38 | |
39 void Update(); | |
40 | |
41 // Sets volume level on slider_, |percent| is ranged from [0.00] to [1.00]. | |
42 void SetVolumeLevel(float percent); | |
43 | |
44 private: | |
45 // Updates device_type_ icon and more_ button. | |
46 void UpdateDeviceTypeAndMore(); | |
47 void HandleVolumeUp(int percent); | |
48 void HandleVolumeDown(int percent); | |
49 | |
50 // SliderListener: | |
51 void SliderValueChanged(views::Slider* sender, | |
52 float value, | |
53 float old_value, | |
54 views::SliderChangeReason reason) override; | |
55 | |
56 // views::ButtonListener: | |
57 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | |
58 | |
59 SystemTrayItem* owner_; | |
60 // The only immediate child view of |this|. All other view elements are added | |
61 // to the |tri_view_| to handle layout. | |
62 TriView* tri_view_; | |
63 system::TrayAudioDelegate* audio_delegate_; | |
64 views::CustomButton* more_button_; | |
65 VolumeButton* icon_; | |
66 views::Slider* slider_; | |
67 views::ImageView* device_type_; | |
68 bool is_default_view_; | |
69 | |
70 DISALLOW_COPY_AND_ASSIGN(VolumeView); | |
71 }; | |
72 | |
73 } // namespace tray | |
74 } // namespace ash | |
75 | |
76 #endif // ASH_COMMON_SYSTEM_CHROMEOS_AUDIO_VOLUME_VIEW_H_ | |
OLD | NEW |