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

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

Issue 2957043002: Add a row in the network tray to inform users to turn Bluetooth on to enable Tether. (Closed)
Patch Set: 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
(Empty)
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved.
James Cook 2017/07/18 17:26:10 super-nit: no (c)
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef ASH_SYSTEM_TRAY_TRAY_INFO_LABEL_H_
6 #define ASH_SYSTEM_TRAY_TRAY_INFO_LABEL_H_
7
8 #include "ash/system/tray/actionable_view.h"
9 #include "ui/views/controls/label.h"
10
11 namespace ash {
12
13 class TrayInfoLabelTest;
Kyle Horimoto 2017/07/18 17:10:05 nit: You don't need to forward declare friend clas
14
15 // A view containing only a label, which is to be inserted as a
16 // row within a system menu detailed view (e.g., the "Scanning for devices..."
17 // message that can appear at the top of the Bluetooth detailed view).
18 // TrayInfoLabel can be clickable; this property is configured by its delegate.
19 class TrayInfoLabel : public ActionableView {
20 public:
21 // A delegate for determining whether or not a TrayInfoLabel is clickable, and
22 // handling actions when it is clicked.
23 class Delegate {
24 public:
25 virtual ~Delegate(){};
James Cook 2017/07/18 17:26:10 nit: space after ) and no ;
26 virtual void OnLabelClicked(int message_id) = 0;
27 virtual bool IsLabelClickable(int message_id) const = 0;
28 };
29
30 // |delegate| may be null, which results in a TrayInfoLabel which cannot be
31 // clicked.
32 TrayInfoLabel(Delegate* delegate, int message_id);
33 ~TrayInfoLabel() override{};
34
35 // Updates the TrayInfoLabel to display the message associated with
36 // |message_id|. This may update text styling if the delegate indicates that
37 // the TrayInfoLabel should be clickable.
38 void Update(int message_id);
39
40 // ActionableView:
41 bool PerformAction(const ui::Event& event) override;
42 void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
43
44 private:
45 friend class TrayInfoLabelTest;
46
47 bool IsClickable();
48
49 views::Label* const label_;
50 int message_id_;
51
52 Delegate* delegate_;
53
54 DISALLOW_COPY_AND_ASSIGN(TrayInfoLabel);
55 };
56
57 } // namespace ash
58
59 #endif // ASH_SYSTEM_TRAY_TRAY_INFO_LABEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698