Chromium Code Reviews| Index: ash/system/tray/tray_details_view.cc |
| diff --git a/ash/system/tray/tray_details_view.cc b/ash/system/tray/tray_details_view.cc |
| index f4507f0779185c5f8924c021d5a87d7975fa7729..60a9c24ee3dd19c20e35c79478911ecc9ac6637f 100644 |
| --- a/ash/system/tray/tray_details_view.cc |
| +++ b/ash/system/tray/tray_details_view.cc |
| @@ -5,10 +5,12 @@ |
| #include "ash/system/tray/tray_details_view.h" |
| #include "ash/ash_view_ids.h" |
| +#include "ash/shell.h" |
| #include "ash/strings/grit/ash_strings.h" |
| #include "ash/system/tray/hover_highlight_view.h" |
| #include "ash/system/tray/system_menu_button.h" |
| #include "ash/system/tray/system_tray.h" |
| +#include "ash/system/tray/system_tray_controller.h" |
| #include "ash/system/tray/system_tray_item.h" |
| #include "ash/system/tray/tray_constants.h" |
| #include "ash/system/tray/tray_popup_item_style.h" |
| @@ -241,12 +243,10 @@ const int kTitleRowPaddingBottom = |
| // TrayDetailsView::InfoLabel: |
| TrayDetailsView::InfoLabel::InfoLabel(int message_id) |
| - : label_(TrayPopupUtils::CreateDefaultLabel()) { |
| + : ActionableView(nullptr, TrayPopupInkDropStyle::FILL_BOUNDS), |
|
Kyle Horimoto
2017/06/27 19:36:57
/* owner */
|
| + label_(TrayPopupUtils::CreateDefaultLabel()) { |
| SetLayoutManager(new views::FillLayout); |
| - TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::SYSTEM_INFO); |
| - style.SetupLabel(label_); |
| - |
| TriView* tri_view = TrayPopupUtils::CreateMultiTargetRowView(); |
| tri_view->SetInsets(gfx::Insets(0, |
| kMenuExtraMarginFromLeftEdge + |
| @@ -258,15 +258,55 @@ TrayDetailsView::InfoLabel::InfoLabel(int message_id) |
| tri_view->AddView(TriView::Container::CENTER, label_); |
| AddChildView(tri_view); |
| + Update(message_id); |
| +} |
| + |
| +void TrayDetailsView::InfoLabel::Update(int message_id) { |
| + SetAction(message_id); |
| + SetStyle(); |
| SetMessage(message_id); |
| } |
| -TrayDetailsView::InfoLabel::~InfoLabel() {} |
| +void TrayDetailsView::InfoLabel::SetAction(int message_id) { |
| + if (message_id == IDS_ASH_STATUS_TRAY_ENABLE_BLUETOOTH) |
|
tdanderson
2017/06/27 19:33:21
TrayDetailsView::InfoLabel is a class used (or can
|
| + action_ = Action::OPEN_BLUETOOTH_SETTINGS; |
| + else |
| + action_ = Action::NONE; |
| + |
| + if (action_ == Action::NONE) |
|
Kyle Horimoto
2017/06/27 19:36:57
Just put these SetInkDropMode() calls in the if/el
|
| + SetInkDropMode(InkDropHostView::InkDropMode::OFF); |
| + else |
| + SetInkDropMode(InkDropHostView::InkDropMode::ON); |
| +} |
| + |
| +void TrayDetailsView::InfoLabel::SetStyle() { |
| + TrayPopupItemStyle::FontStyle font_style; |
| + |
| + if (action_ == Action::NONE) |
|
Kyle Horimoto
2017/06/27 19:36:56
You can also just merge this into the above functi
|
| + font_style = TrayPopupItemStyle::FontStyle::SYSTEM_INFO; |
| + else |
| + font_style = TrayPopupItemStyle::FontStyle::CLICKABLE_SYSTEM_INFO; |
| + |
| + TrayPopupItemStyle style(font_style); |
| + style.SetupLabel(label_); |
| +} |
| void TrayDetailsView::InfoLabel::SetMessage(int message_id) { |
| label_->SetText(l10n_util::GetStringUTF16(message_id)); |
| } |
| +bool TrayDetailsView::InfoLabel::PerformAction(const ui::Event& event) { |
| + switch (action_) { |
| + case Action::OPEN_BLUETOOTH_SETTINGS: |
|
tdanderson
2017/06/27 19:33:21
Side note: please check with your PM as to whether
Kyle Horimoto
2017/06/27 19:36:57
You can just use an if() instead of a switch() sin
Kyle Horimoto
2017/06/27 20:37:10
Good point. Leslie, please talk to hansberry@ rega
lesliewatkins
2017/07/07 16:19:19
Sent him a message, will follow up when I get a re
|
| + Shell::Get()->system_tray_controller()->ShowBluetoothSettings(); |
| + break; |
| + case Action::NONE: |
| + default: |
| + break; |
| + } |
| + return true; |
| +} |
| + |
| //////////////////////////////////////////////////////////////////////////////// |
| // TrayDetailsView: |