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"
19 class HoverHighlightView
;
23 class TrayAudioDelegate
;
31 class VolumeView
: public ActionableView
,
32 public views::ButtonListener
,
33 public views::SliderListener
{
35 VolumeView(SystemTrayItem
* owner
,
36 system::TrayAudioDelegate
* audio_delegate
,
37 bool is_default_view
);
39 virtual ~VolumeView();
43 // Sets volume level on slider_, |percent| is ranged from [0.00] to [1.00].
44 void SetVolumeLevel(float percent
);
47 // Updates bar_, device_type_ icon, and more_ buttons.
48 void UpdateDeviceTypeAndMore();
49 void HandleVolumeUp(float percent
);
50 void HandleVolumeDown(float percent
);
52 // Overridden from views::View.
53 virtual void Layout() OVERRIDE
;
55 // Overridden from views::ButtonListener.
56 virtual void ButtonPressed(views::Button
* sender
,
57 const ui::Event
& event
) OVERRIDE
;
59 // Overridden from views::SliderListener.
60 virtual void SliderValueChanged(views::Slider
* sender
,
63 views::SliderChangeReason reason
) OVERRIDE
;
65 // Overriden from ActionableView.
66 virtual bool PerformAction(const ui::Event
& event
) OVERRIDE
;
68 SystemTrayItem
* owner_
;
69 system::TrayAudioDelegate
* audio_delegate_
;
71 VolumeSlider
* slider_
;
73 views::ImageView
* device_type_
;
74 views::ImageView
* more_
;
75 bool is_default_view_
;
77 DISALLOW_COPY_AND_ASSIGN(VolumeView
);
83 #endif // ASH_SYSTEM_AUDIO_VOLUME_VIEW_H_