Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: ash/common/system/audio/volume_view.h

Issue 2482043002: [ash-md] Updated layout of Brightness and Audio system menu rows to the material design spec. (Closed)
Patch Set: Some polish after self review. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_COMMON_SYSTEM_AUDIO_VOLUME_VIEW_H_ 5 #ifndef ASH_COMMON_SYSTEM_AUDIO_VOLUME_VIEW_H_
6 #define ASH_COMMON_SYSTEM_AUDIO_VOLUME_VIEW_H_ 6 #define ASH_COMMON_SYSTEM_AUDIO_VOLUME_VIEW_H_
7 7
8 #include "ash/common/system/tray/actionable_view.h"
9 #include "base/macros.h" 8 #include "base/macros.h"
10 #include "ui/gfx/font.h"
11 #include "ui/views/controls/button/button.h" 9 #include "ui/views/controls/button/button.h"
12 #include "ui/views/controls/slider.h" 10 #include "ui/views/controls/slider.h"
11 #include "ui/views/view.h"
13 12
14 namespace views { 13 namespace views {
15 class View; 14 class CustomButton;
16 class ImageView; 15 class ImageView;
17 class Separator; 16 class Separator;
18 class Slider; 17 class Slider;
19 } 18 }
20 19
21 namespace ash { 20 namespace ash {
22 class SystemTrayItem; 21 class SystemTrayItem;
22 class TriView;
23 23
24 namespace system { 24 namespace system {
25 class TrayAudioDelegate; 25 class TrayAudioDelegate;
26 } 26 }
27 27
28 namespace tray { 28 namespace tray {
29 class VolumeButton; 29 class VolumeButton;
30 30
31 class VolumeView : public ActionableView, 31 class VolumeView : public views::View,
32 public views::SliderListener { 32 public views::SliderListener,
33 public views::ButtonListener {
33 public: 34 public:
34 VolumeView(SystemTrayItem* owner, 35 VolumeView(SystemTrayItem* owner,
35 system::TrayAudioDelegate* audio_delegate, 36 system::TrayAudioDelegate* audio_delegate,
36 bool is_default_view); 37 bool is_default_view);
37 38
38 ~VolumeView() override; 39 ~VolumeView() override;
39 40
40 void Update(); 41 void Update();
41 42
42 // 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].
43 void SetVolumeLevel(float percent); 44 void SetVolumeLevel(float percent);
44 45
45 private: 46 private:
46 // Updates bar_, device_type_ icon, and more_ buttons. 47 // Updates device_type_ icon and more_ button.
47 void UpdateDeviceTypeAndMore(); 48 void UpdateDeviceTypeAndMore();
48 void HandleVolumeUp(float percent); 49 void HandleVolumeUp(float percent);
49 void HandleVolumeDown(float percent); 50 void HandleVolumeDown(float percent);
50 51
51 // Overridden from views::SliderListener. 52 // SliderListener:
52 void SliderValueChanged(views::Slider* sender, 53 void SliderValueChanged(views::Slider* sender,
53 float value, 54 float value,
54 float old_value, 55 float old_value,
55 views::SliderChangeReason reason) override; 56 views::SliderChangeReason reason) override;
56 57
57 // Overriden from ActionableView. 58 // views::ButtonListener:
58 bool PerformAction(const ui::Event& event) override;
59 void ButtonPressed(views::Button* sender, const ui::Event& event) override; 59 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
60 60
61 // views::View: 61 // views::View:
62 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; 62 void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
63 void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
64 63
64 SystemTrayItem* owner_;
65 // Container view used to layout the children.
tdanderson 2016/11/09 01:38:33 Maybe add to this comment to clarify that |tri_vie
bruthig 2016/11/10 02:54:54 Done.
66 TriView* tri_view_;
65 system::TrayAudioDelegate* audio_delegate_; 67 system::TrayAudioDelegate* audio_delegate_;
66 views::View* more_region_; 68 views::CustomButton* more_button_;
67 VolumeButton* icon_; 69 VolumeButton* icon_;
68 views::Slider* slider_; 70 views::Slider* slider_;
69 views::Separator* separator_; 71 views::Separator* separator_;
70 views::ImageView* device_type_; 72 views::ImageView* device_type_;
71 views::ImageView* more_;
72 bool is_default_view_; 73 bool is_default_view_;
tdanderson 2016/11/09 01:38:33 nit: can you please add a "// not used in material
bruthig 2016/11/10 02:54:54 Done.
73 74
74 DISALLOW_COPY_AND_ASSIGN(VolumeView); 75 DISALLOW_COPY_AND_ASSIGN(VolumeView);
75 }; 76 };
76 77
77 } // namespace tray 78 } // namespace tray
78 } // namespace ash 79 } // namespace ash
79 80
80 #endif // ASH_COMMON_SYSTEM_AUDIO_VOLUME_VIEW_H_ 81 #endif // ASH_COMMON_SYSTEM_AUDIO_VOLUME_VIEW_H_
OLDNEW
« no previous file with comments | « no previous file | ash/common/system/audio/volume_view.cc » ('j') | ash/common/system/audio/volume_view.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698