Chromium Code Reviews| Index: ash/system/tray/tray_details_view.h |
| diff --git a/ash/system/tray/tray_details_view.h b/ash/system/tray/tray_details_view.h |
| index f046fcdcdeec65b9c5ef0b51d7c26a5ff1a25161..bc3656381ca333841f6cb838248ebac051074913 100644 |
| --- a/ash/system/tray/tray_details_view.h |
| +++ b/ash/system/tray/tray_details_view.h |
| @@ -8,11 +8,13 @@ |
| #include <memory> |
| #include "ash/ash_export.h" |
| +#include "ash/system/tray/actionable_view.h" |
| #include "ash/system/tray/tray_constants.h" |
| #include "ash/system/tray/view_click_listener.h" |
| #include "base/macros.h" |
| #include "base/timer/timer.h" |
| #include "ui/views/controls/button/button.h" |
| +#include "ui/views/controls/button/label_button.h" |
| #include "ui/views/view.h" |
| namespace gfx { |
| @@ -54,23 +56,39 @@ class ASH_EXPORT TrayDetailsView : public views::View, |
| SystemTrayItem* owner() { return owner_; } |
| - protected: |
| + 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.
|
| + |
| // A view containing only a label, which is to be inserted as a non-targetable |
| // row within a system menu detailed view (e.g., the "Scanning for devices..." |
| // 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.
|
| - class InfoLabel : public View { |
| + class InfoLabel : public ActionableView { |
| public: |
| - explicit InfoLabel(int message_id); |
| - ~InfoLabel() override; |
|
Kyle Horimoto
2017/07/10 18:37:08
Don't remove the destructor.
|
| + 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.
|
| + void Update(int message_id); |
|
Kyle Horimoto
2017/07/10 18:37:08
nit: Previously, SetMessage() was pretty obvious i
lesliewatkins
2017/07/12 21:49:50
Done.
|
| + 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.
|
| - void SetMessage(int message_id); |
| + // ActionableView: |
| + bool PerformAction(const ui::Event& event) override; |
| + void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
| private: |
| + bool IsClickable(); |
| + |
| views::Label* const label_; |
| + int message_id_; |
| + |
| + InfoLabelDelegate* delegate_; |
| DISALLOW_COPY_AND_ASSIGN(InfoLabel); |
| }; |
| + // A delegate for handling actions when an InfoLabel is clicked. |
| + 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.
|
| + public: |
| + virtual void OnLabelClicked(InfoLabel* label) = 0; |
| + }; |
|
James Cook
2017/07/10 18:43:03
needs virtual destructor
lesliewatkins
2017/07/12 21:49:50
Done.
|
| + |
| + protected: |
| // views::View: |
| void Layout() override; |
| int GetHeightForWidth(int width) const override; |