Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 non-targetable | |
|
Kyle Horimoto
2017/07/12 22:45:59
What does non-targetable mean? I Googled it and di
lesliewatkins
2017/07/13 22:12:48
I didn't write that, but based on context, it may
| |
| 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 // InfoLabel can be clickable if it is passed a non-null TrayDetailClickHandler | |
|
Kyle Horimoto
2017/07/12 22:45:59
How about "InfoLabel can be clickable; this proper
Kyle Horimoto
2017/07/12 22:45:59
InfoLabel --> TrayInfoLabel, TrayDetailClickHandle
lesliewatkins
2017/07/13 22:12:47
Done.
lesliewatkins
2017/07/13 22:12:48
Done.
| |
| 21 // in its constructructor. | |
| 22 class TrayInfoLabel : public ActionableView { | |
| 23 public: | |
| 24 // A delegate for handling actions when an InfoLabel is clicked. | |
|
Kyle Horimoto
2017/07/12 22:45:59
nit: It does more than just that :)
lesliewatkins
2017/07/13 22:12:47
Changed the wording to reflect that it also determ
| |
| 25 class Delegate { | |
| 26 public: | |
| 27 virtual ~Delegate(){}; | |
| 28 virtual void OnLabelClicked(int message_id) = 0; | |
| 29 virtual bool LabelIsClickable(int message_id) = 0; | |
|
Kyle Horimoto
2017/07/12 22:45:59
nit: IsLabelClickable() reads better.
lesliewatkins
2017/07/13 22:12:48
Done.
| |
| 30 }; | |
| 31 | |
| 32 // handler can be nullptr, in which case, the InfoLabel will not be | |
|
Kyle Horimoto
2017/07/12 22:45:59
handler --> delegate
Kyle Horimoto
2017/07/12 22:45:59
How about "|delegate| may be null, which results i
lesliewatkins
2017/07/13 22:12:47
Done.
lesliewatkins
2017/07/13 22:12:48
Done.
| |
| 33 // clickable. Its status as clickable will be reflected in the style | |
| 34 // of the label. | |
| 35 TrayInfoLabel(Delegate* delegate, int message_id); | |
| 36 ~TrayInfoLabel() override{}; | |
| 37 | |
| 38 // Updates the message id, the label text, and the style if the | |
|
Kyle Horimoto
2017/07/12 22:45:59
How about: "Updates the InfoLabel to display the m
lesliewatkins
2017/07/13 22:12:48
Done.
| |
| 39 // InfoLabel changes from clickable to non-clickable (or vice versa). | |
| 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_ | |
| OLD | NEW |