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

Side by Side Diff: ash/system/tray/tray_details_view.h

Issue 2957043002: Add a row in the network tray to inform users to turn Bluetooth on to enable Tether. (Closed)
Patch Set: added actions and slightly refactored the infolabel class Created 3 years, 5 months 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 (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"
16 #include "ui/views/view.h" 17 #include "ui/views/view.h"
17 18
18 namespace gfx { 19 namespace gfx {
19 struct VectorIcon; 20 struct VectorIcon;
20 } // namespace gfx 21 } // namespace gfx
(...skipping 29 matching lines...) Expand all
50 51
51 // views::ButtonListener: 52 // views::ButtonListener:
52 // Don't override this --- override HandleButtonPressed. 53 // Don't override this --- override HandleButtonPressed.
53 void ButtonPressed(views::Button* sender, const ui::Event& event) final; 54 void ButtonPressed(views::Button* sender, const ui::Event& event) final;
54 55
55 SystemTrayItem* owner() { return owner_; } 56 SystemTrayItem* owner() { return owner_; }
56 57
57 protected: 58 protected:
58 // A view containing only a label, which is to be inserted as a non-targetable 59 // 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..." 60 // 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). 61 // message that can appear at the top of the Bluetooth detailed view).
tdanderson 2017/06/27 19:33:21 By making InfoLabel an ActionableView, you would b
Kyle Horimoto 2017/06/27 20:37:10 Good point. Would you suggest creating a specific
tdanderson 2017/06/27 21:27:39 I'll leave it to Leslie to investigate possible ap
61 class InfoLabel : public View { 62 class InfoLabel : public ActionableView {
62 public: 63 public:
63 explicit InfoLabel(int message_id); 64 explicit InfoLabel(int message_id);
64 ~InfoLabel() override; 65 void Update(int message_id);
Kyle Horimoto 2017/06/27 19:36:57 Please add documentation to explain what Update()
65 66
67 enum Action { NONE, OPEN_BLUETOOTH_SETTINGS };
68
69 protected:
70 // ActionableView
tdanderson 2017/06/27 19:33:21 nit: ':' at end of 'ActionableView'
Kyle Horimoto 2017/06/27 19:36:57 Colon at the end of the line: // ActionableView:
71 bool PerformAction(const ui::Event& event) override;
72
73 private:
74 void SetAction(int message_id);
75 void SetStyle();
66 void SetMessage(int message_id); 76 void SetMessage(int message_id);
67 77
68 private:
69 views::Label* const label_; 78 views::Label* const label_;
70 79
80 Action action_;
81
71 DISALLOW_COPY_AND_ASSIGN(InfoLabel); 82 DISALLOW_COPY_AND_ASSIGN(InfoLabel);
72 }; 83 };
73 84
74 // views::View: 85 // views::View:
75 void Layout() override; 86 void Layout() override;
76 int GetHeightForWidth(int width) const override; 87 int GetHeightForWidth(int width) const override;
77 88
78 // Exposes the layout manager of this view to give control to subclasses. 89 // Exposes the layout manager of this view to give control to subclasses.
79 views::BoxLayout* box_layout() { return box_layout_; } 90 views::BoxLayout* box_layout() { return box_layout_; }
80 91
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 190
180 // Used to delay the transition to the default view. 191 // Used to delay the transition to the default view.
181 base::OneShotTimer transition_delay_timer_; 192 base::OneShotTimer transition_delay_timer_;
182 193
183 DISALLOW_COPY_AND_ASSIGN(TrayDetailsView); 194 DISALLOW_COPY_AND_ASSIGN(TrayDetailsView);
184 }; 195 };
185 196
186 } // namespace ash 197 } // namespace ash
187 198
188 #endif // ASH_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ 199 #endif // ASH_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698