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

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.
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 namespace test {
14 class TrayInfoLabelTest;
15 } // namespace test
16
17 // A view containing only a label, which is to be inserted as a
18 // row within a system menu detailed view (e.g., the "Scanning for devices..."
19 // message that can appear at the top of the Bluetooth detailed view).
20 // TrayInfoLabel can be clickable; this property is configured by its delegate.
21 class TrayInfoLabel : public ActionableView {
22 public:
23 // A delegate for determining whether or not a TrayInfoLabel is clickable, and
24 // handling actions when it is clicked.
25 class Delegate {
26 public:
27 virtual ~Delegate(){};
28 virtual void OnLabelClicked(int message_id) = 0;
29 virtual bool IsLabelClickable(int message_id) = 0;
30 };
31
32 // |delegate| may be null, which results in a TrayInfoLabel which cannot be
33 // clicked.
34 TrayInfoLabel(Delegate* delegate, int message_id);
35 ~TrayInfoLabel() override{};
36
37 // Updates the TrayInfoLabel to display the message associated with
38 // |message_id|. This may update text styling if the delegate indicates that
39 // the TrayInfoLabel should be clickable.
40 void Update(int message_id);
41
42 // ActionableView:
43 bool PerformAction(const ui::Event& event) override;
44 void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
45
46 private:
47 friend class test::TrayInfoLabelTest;
48
49 bool IsClickable();
50
51 views::Label* const label_;
52 int message_id_;
53
54 Delegate* delegate_;
55
56 DISALLOW_COPY_AND_ASSIGN(TrayInfoLabel);
57 };
58
59 } // namespace ash
60
61 #endif // ASH_SYSTEM_TRAY_TRAY_INFO_LABEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698