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

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: Fixed the volume slider to transition to the detailed view on <return> keypress. 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
« no previous file with comments | « no previous file | ash/common/system/audio/volume_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bool OnKeyPressed(const ui::KeyEvent& event) override;
62 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; 63 void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
63 void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
64 64
65 SystemTrayItem* owner_;
66 // The only immediate child view of |this|. All other view elements are added
67 // to the |tri_view_| to handle layout.
68 TriView* tri_view_;
65 system::TrayAudioDelegate* audio_delegate_; 69 system::TrayAudioDelegate* audio_delegate_;
66 views::View* more_region_; 70 views::CustomButton* more_button_;
67 VolumeButton* icon_; 71 VolumeButton* icon_;
68 views::Slider* slider_; 72 views::Slider* slider_;
69 views::Separator* separator_; 73 views::Separator* separator_; // Not used in material design.
70 views::ImageView* device_type_; 74 views::ImageView* device_type_;
71 views::ImageView* more_;
72 bool is_default_view_; 75 bool is_default_view_;
73 76
74 DISALLOW_COPY_AND_ASSIGN(VolumeView); 77 DISALLOW_COPY_AND_ASSIGN(VolumeView);
75 }; 78 };
76 79
77 } // namespace tray 80 } // namespace tray
78 } // namespace ash 81 } // namespace ash
79 82
80 #endif // ASH_COMMON_SYSTEM_AUDIO_VOLUME_VIEW_H_ 83 #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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698