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"
24 class TrayAudioDelegate
;
30 class VolumeView
: public ActionableView
,
31 public views::ButtonListener
,
32 public views::SliderListener
{
34 VolumeView(SystemTrayItem
* owner
,
35 system::TrayAudioDelegate
* audio_delegate
,
36 bool is_default_view
);
38 ~VolumeView() override
;
42 // Sets volume level on slider_, |percent| is ranged from [0.00] to [1.00].
43 void SetVolumeLevel(float percent
);
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
,
58 views::SliderChangeReason reason
) override
;
60 // Overriden from ActionableView.
61 bool PerformAction(const ui::Event
& event
) override
;
64 void OnBoundsChanged(const gfx::Rect
& previous_bounds
) override
;
66 SystemTrayItem
* owner_
;
67 system::TrayAudioDelegate
* audio_delegate_
;
68 views::View
* more_region_
;
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
);
82 #endif // ASH_SYSTEM_AUDIO_VOLUME_VIEW_H_