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

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: tdanderson@ and khorimoto@ comments 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"
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 21 matching lines...) Expand all
47 // ViewClickListener: 49 // ViewClickListener:
48 // Don't override this --- override HandleViewClicked. 50 // Don't override this --- override HandleViewClicked.
49 void OnViewClicked(views::View* sender) final; 51 void OnViewClicked(views::View* sender) final;
50 52
51 // views::ButtonListener: 53 // views::ButtonListener:
52 // Don't override this --- override HandleButtonPressed. 54 // Don't override this --- override HandleButtonPressed.
53 void ButtonPressed(views::Button* sender, const ui::Event& event) final; 55 void ButtonPressed(views::Button* sender, const ui::Event& event) final;
54 56
55 SystemTrayItem* owner() { return owner_; } 57 SystemTrayItem* owner() { return owner_; }
56 58
57 protected: 59 class InfoLabelDelegate;
Kyle Horimoto 2017/07/10 18:37:08 We should still keep InfoLabel protected. There sh
James Cook 2017/07/11 23:14:15 I chatted with Leslie over IM. I suggest a differe
lesliewatkins 2017/07/12 21:49:50 Done.
60
58 // A view containing only a label, which is to be inserted as a non-targetable 61 // 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..." 62 // 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). 63 // message that can appear at the top of the Bluetooth detailed view).
Kyle Horimoto 2017/07/10 18:37:08 nit: Now that this is clickable, add some descript
lesliewatkins 2017/07/12 21:49:50 Done.
61 class InfoLabel : public View { 64 class InfoLabel : public ActionableView {
62 public: 65 public:
63 explicit InfoLabel(int message_id); 66 explicit InfoLabel(int message_id, InfoLabelDelegate* delegate);
James Cook 2017/07/10 18:43:03 no explicit nit: Usually the delegate* is the fir
lesliewatkins 2017/07/12 21:49:50 Done.
64 ~InfoLabel() override; 67 void Update(int message_id);
Kyle Horimoto 2017/07/10 18:37:08 Don't remove the destructor.
Kyle Horimoto 2017/07/10 18:37:08 nit: Previously, SetMessage() was pretty obvious i
lesliewatkins 2017/07/12 21:49:50 Done.
68 const int& message_id();
Kyle Horimoto 2017/07/10 18:37:08 You can get rid of this function after my explanat
James Cook 2017/07/10 18:43:03 just return the int, there's no perf win for retur
lesliewatkins 2017/07/12 21:49:50 Acknowledged.
lesliewatkins 2017/07/12 21:49:50 Done.
65 69
66 void SetMessage(int message_id); 70 // ActionableView:
71 bool PerformAction(const ui::Event& event) override;
72 void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
67 73
68 private: 74 private:
75 bool IsClickable();
76
69 views::Label* const label_; 77 views::Label* const label_;
78 int message_id_;
79
80 InfoLabelDelegate* delegate_;
70 81
71 DISALLOW_COPY_AND_ASSIGN(InfoLabel); 82 DISALLOW_COPY_AND_ASSIGN(InfoLabel);
72 }; 83 };
73 84
85 // A delegate for handling actions when an InfoLabel is clicked.
86 class InfoLabelDelegate {
James Cook 2017/07/10 18:43:03 optional: You could also declare this as an inner
lesliewatkins 2017/07/12 21:49:50 Acknowledged.
87 public:
88 virtual void OnLabelClicked(InfoLabel* label) = 0;
89 };
James Cook 2017/07/10 18:43:03 needs virtual destructor
lesliewatkins 2017/07/12 21:49:50 Done.
90
91 protected:
74 // views::View: 92 // views::View:
75 void Layout() override; 93 void Layout() override;
76 int GetHeightForWidth(int width) const override; 94 int GetHeightForWidth(int width) const override;
77 95
78 // Exposes the layout manager of this view to give control to subclasses. 96 // Exposes the layout manager of this view to give control to subclasses.
79 views::BoxLayout* box_layout() { return box_layout_; } 97 views::BoxLayout* box_layout() { return box_layout_; }
80 98
81 // Creates the row containing the back button and title. For material design 99 // 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 100 // this appears at the top of the view, for non-material design it appears
83 // at the bottom. 101 // at the bottom.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 197
180 // Used to delay the transition to the default view. 198 // Used to delay the transition to the default view.
181 base::OneShotTimer transition_delay_timer_; 199 base::OneShotTimer transition_delay_timer_;
182 200
183 DISALLOW_COPY_AND_ASSIGN(TrayDetailsView); 201 DISALLOW_COPY_AND_ASSIGN(TrayDetailsView);
184 }; 202 };
185 203
186 } // namespace ash 204 } // namespace ash
187 205
188 #endif // ASH_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ 206 #endif // ASH_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698