Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / ash / system / audio / volume_view.h
blob6db678936d7df43e01192db794fcb370c5813ce4
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.
5 #ifndef ASH_SYSTEM_AUDIO_VOLUME_VIEW_H_
6 #define ASH_SYSTEM_AUDIO_VOLUME_VIEW_H_
8 #include "ash/system/tray/actionable_view.h"
9 #include "ui/gfx/font.h"
10 #include "ui/views/controls/button/button.h"
11 #include "ui/views/controls/slider.h"
13 namespace views {
14 class View;
15 class ImageView;
16 class Separator;
17 class Slider;
20 namespace ash {
21 class SystemTrayItem;
23 namespace system {
24 class TrayAudioDelegate;
27 namespace tray {
28 class VolumeButton;
30 class VolumeView : public ActionableView,
31 public views::ButtonListener,
32 public views::SliderListener {
33 public:
34 VolumeView(SystemTrayItem* owner,
35 system::TrayAudioDelegate* audio_delegate,
36 bool is_default_view);
38 ~VolumeView() override;
40 void Update();
42 // Sets volume level on slider_, |percent| is ranged from [0.00] to [1.00].
43 void SetVolumeLevel(float percent);
45 private:
46 // Updates bar_, device_type_ icon, and more_ buttons.
47 void UpdateDeviceTypeAndMore();
48 void HandleVolumeUp(float percent);
49 void HandleVolumeDown(float percent);
51 // Overridden from views::ButtonListener.
52 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
54 // Overridden from views::SliderListener.
55 void SliderValueChanged(views::Slider* sender,
56 float value,
57 float old_value,
58 views::SliderChangeReason reason) override;
60 // Overriden from ActionableView.
61 bool PerformAction(const ui::Event& event) override;
63 // views::View:
64 void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
66 SystemTrayItem* owner_;
67 system::TrayAudioDelegate* audio_delegate_;
68 views::View* more_region_;
69 VolumeButton* icon_;
70 views::Slider* slider_;
71 views::Separator* separator_;
72 views::ImageView* device_type_;
73 views::ImageView* more_;
74 bool is_default_view_;
76 DISALLOW_COPY_AND_ASSIGN(VolumeView);
79 } // namespace tray
80 } // namespace ash
82 #endif // ASH_SYSTEM_AUDIO_VOLUME_VIEW_H_