| 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 #ifndef ASH_SYSTEM_AUDIO_VOLUME_VIEW_H_ | 5 #ifndef ASH_SYSTEM_AUDIO_VOLUME_VIEW_H_ |
| 6 #define ASH_SYSTEM_AUDIO_VOLUME_VIEW_H_ | 6 #define ASH_SYSTEM_AUDIO_VOLUME_VIEW_H_ |
| 7 | 7 |
| 8 #include "ash/system/tray/actionable_view.h" | 8 #include "ash/system/tray/actionable_view.h" |
| 9 #include "ui/gfx/font.h" | 9 #include "ui/gfx/font.h" |
| 10 #include "ui/views/controls/button/button.h" | 10 #include "ui/views/controls/button/button.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 class VolumeSlider; | 29 class VolumeSlider; |
| 30 | 30 |
| 31 class VolumeView : public ActionableView, | 31 class VolumeView : public ActionableView, |
| 32 public views::ButtonListener, | 32 public views::ButtonListener, |
| 33 public views::SliderListener { | 33 public views::SliderListener { |
| 34 public: | 34 public: |
| 35 VolumeView(SystemTrayItem* owner, | 35 VolumeView(SystemTrayItem* owner, |
| 36 system::TrayAudioDelegate* audio_delegate, | 36 system::TrayAudioDelegate* audio_delegate, |
| 37 bool is_default_view); | 37 bool is_default_view); |
| 38 | 38 |
| 39 virtual ~VolumeView(); | 39 ~VolumeView() override; |
| 40 | 40 |
| 41 void Update(); | 41 void Update(); |
| 42 | 42 |
| 43 // Sets volume level on slider_, |percent| is ranged from [0.00] to [1.00]. | 43 // Sets volume level on slider_, |percent| is ranged from [0.00] to [1.00]. |
| 44 void SetVolumeLevel(float percent); | 44 void SetVolumeLevel(float percent); |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 // Updates bar_, device_type_ icon, and more_ buttons. | 47 // Updates bar_, device_type_ icon, and more_ buttons. |
| 48 void UpdateDeviceTypeAndMore(); | 48 void UpdateDeviceTypeAndMore(); |
| 49 void HandleVolumeUp(float percent); | 49 void HandleVolumeUp(float percent); |
| 50 void HandleVolumeDown(float percent); | 50 void HandleVolumeDown(float percent); |
| 51 | 51 |
| 52 // Overridden from views::View. | 52 // Overridden from views::View. |
| 53 virtual void Layout() override; | 53 void Layout() override; |
| 54 | 54 |
| 55 // Overridden from views::ButtonListener. | 55 // Overridden from views::ButtonListener. |
| 56 virtual void ButtonPressed(views::Button* sender, | 56 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 57 const ui::Event& event) override; | |
| 58 | 57 |
| 59 // Overridden from views::SliderListener. | 58 // Overridden from views::SliderListener. |
| 60 virtual void SliderValueChanged(views::Slider* sender, | 59 void SliderValueChanged(views::Slider* sender, |
| 61 float value, | 60 float value, |
| 62 float old_value, | 61 float old_value, |
| 63 views::SliderChangeReason reason) override; | 62 views::SliderChangeReason reason) override; |
| 64 | 63 |
| 65 // Overriden from ActionableView. | 64 // Overriden from ActionableView. |
| 66 virtual bool PerformAction(const ui::Event& event) override; | 65 bool PerformAction(const ui::Event& event) override; |
| 67 | 66 |
| 68 SystemTrayItem* owner_; | 67 SystemTrayItem* owner_; |
| 69 system::TrayAudioDelegate* audio_delegate_; | 68 system::TrayAudioDelegate* audio_delegate_; |
| 70 VolumeButton* icon_; | 69 VolumeButton* icon_; |
| 71 VolumeSlider* slider_; | 70 VolumeSlider* slider_; |
| 72 BarSeparator* bar_; | 71 BarSeparator* bar_; |
| 73 views::ImageView* device_type_; | 72 views::ImageView* device_type_; |
| 74 views::ImageView* more_; | 73 views::ImageView* more_; |
| 75 bool is_default_view_; | 74 bool is_default_view_; |
| 76 | 75 |
| 77 DISALLOW_COPY_AND_ASSIGN(VolumeView); | 76 DISALLOW_COPY_AND_ASSIGN(VolumeView); |
| 78 }; | 77 }; |
| 79 | 78 |
| 80 } // namespace tray | 79 } // namespace tray |
| 81 } // namespace ash | 80 } // namespace ash |
| 82 | 81 |
| 83 #endif // ASH_SYSTEM_AUDIO_VOLUME_VIEW_H_ | 82 #endif // ASH_SYSTEM_AUDIO_VOLUME_VIEW_H_ |
| 84 | 83 |
| OLD | NEW |