OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_TRAY_TRAY_DETAILS_VIEW_H_ | 5 #ifndef ASH_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ |
6 #define ASH_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ | 6 #define ASH_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
11 #include "ash/system/tray/actionable_view.h" | |
11 #include "ash/system/tray/tray_constants.h" | 12 #include "ash/system/tray/tray_constants.h" |
12 #include "ash/system/tray/view_click_listener.h" | 13 #include "ash/system/tray/view_click_listener.h" |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
15 #include "ui/views/controls/button/button.h" | 16 #include "ui/views/controls/button/button.h" |
17 #include "ui/views/controls/button/label_button.h" | |
16 #include "ui/views/view.h" | 18 #include "ui/views/view.h" |
17 | 19 |
18 namespace gfx { | 20 namespace gfx { |
19 struct VectorIcon; | 21 struct VectorIcon; |
20 } // namespace gfx | 22 } // namespace gfx |
21 | 23 |
22 namespace views { | 24 namespace views { |
23 class BoxLayout; | 25 class BoxLayout; |
24 class CustomButton; | 26 class CustomButton; |
25 class Label; | 27 class Label; |
(...skipping 28 matching lines...) Expand all Loading... | |
54 | 56 |
55 SystemTrayItem* owner() { return owner_; } | 57 SystemTrayItem* owner() { return owner_; } |
56 | 58 |
57 protected: | 59 protected: |
58 // A view containing only a label, which is to be inserted as a non-targetable | 60 // A view containing only a label, which is to be inserted as a non-targetable |
59 // row within a system menu detailed view (e.g., the "Scanning for devices..." | 61 // row within a system menu detailed view (e.g., the "Scanning for devices..." |
60 // message that can appear at the top of the Bluetooth detailed view). | 62 // message that can appear at the top of the Bluetooth detailed view). |
61 class InfoLabel : public View { | 63 class InfoLabel : public View { |
62 public: | 64 public: |
63 explicit InfoLabel(int message_id); | 65 explicit InfoLabel(int message_id); |
64 ~InfoLabel() override; | 66 virtual void SetMessage(int message_id) = 0; |
65 | 67 |
66 void SetMessage(int message_id); | 68 DISALLOW_COPY_AND_ASSIGN(InfoLabel); |
Kyle Horimoto
2017/07/07 17:33:59
This should be private.
lesliewatkins
2017/07/09 00:57:48
Done.
| |
69 }; | |
70 | |
71 class InfoLabelNoAction : public InfoLabel { | |
Kyle Horimoto
2017/07/07 17:34:00
nit: tanderson@ probably has a better idea about U
tdanderson
2017/07/07 21:25:11
I made a suggestion above that could avoid introdu
lesliewatkins
2017/07/09 00:57:47
Acknowledged.
| |
72 public: | |
73 InfoLabelNoAction(int message_id); | |
74 | |
75 // InfoLabel: | |
76 void SetMessage(int message_id) override; | |
67 | 77 |
68 private: | 78 private: |
69 views::Label* const label_; | 79 views::Label* const label_; |
70 | 80 |
71 DISALLOW_COPY_AND_ASSIGN(InfoLabel); | 81 DISALLOW_COPY_AND_ASSIGN(InfoLabelNoAction); |
72 }; | 82 }; |
73 | 83 |
84 class InfoLabelEnableBluetooth : public InfoLabel, | |
Kyle Horimoto
2017/07/07 17:33:59
Does this even need to be an InfoLabel at all? The
| |
85 public views::ButtonListener { | |
tdanderson
2017/07/07 21:25:11
By extending ButtonListener instead of ActionableV
| |
86 public: | |
87 InfoLabelEnableBluetooth(int message_id); | |
88 | |
89 // ButtonListener: | |
90 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | |
91 // InfoLabel: | |
Kyle Horimoto
2017/07/07 17:34:00
nit: Newline before this.
| |
92 void SetMessage(int message_id) override; | |
93 | |
94 private: | |
95 views::LabelButton* const label_button_; | |
96 | |
97 DISALLOW_COPY_AND_ASSIGN(InfoLabelEnableBluetooth); | |
98 }; | |
99 | |
100 // InfoLabel: Factory method | |
Kyle Horimoto
2017/07/07 17:33:59
nit: Remove this comment and/or change the descrip
| |
101 InfoLabel* CreateInfoLabel(int message_id); | |
Kyle Horimoto
2017/07/07 17:33:59
This should be static.
| |
102 | |
74 // views::View: | 103 // views::View: |
75 void Layout() override; | 104 void Layout() override; |
76 int GetHeightForWidth(int width) const override; | 105 int GetHeightForWidth(int width) const override; |
77 | 106 |
78 // Exposes the layout manager of this view to give control to subclasses. | 107 // Exposes the layout manager of this view to give control to subclasses. |
79 views::BoxLayout* box_layout() { return box_layout_; } | 108 views::BoxLayout* box_layout() { return box_layout_; } |
80 | 109 |
81 // Creates the row containing the back button and title. For material design | 110 // Creates the row containing the back button and title. For material design |
82 // this appears at the top of the view, for non-material design it appears | 111 // this appears at the top of the view, for non-material design it appears |
83 // at the bottom. | 112 // at the bottom. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
179 | 208 |
180 // Used to delay the transition to the default view. | 209 // Used to delay the transition to the default view. |
181 base::OneShotTimer transition_delay_timer_; | 210 base::OneShotTimer transition_delay_timer_; |
182 | 211 |
183 DISALLOW_COPY_AND_ASSIGN(TrayDetailsView); | 212 DISALLOW_COPY_AND_ASSIGN(TrayDetailsView); |
184 }; | 213 }; |
185 | 214 |
186 } // namespace ash | 215 } // namespace ash |
187 | 216 |
188 #endif // ASH_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ | 217 #endif // ASH_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ |
OLD | NEW |