Chromium Code Reviews| Index: ash/system/tray/hover_highlight_view.cc |
| diff --git a/ash/system/tray/hover_highlight_view.cc b/ash/system/tray/hover_highlight_view.cc |
| index c3f7cfa37c159b7b20ac4127aec38643b7f37a6e..b4d61205708c83364ffd63bf1203e14cfd4ce380 100644 |
| --- a/ash/system/tray/hover_highlight_view.cc |
| +++ b/ash/system/tray/hover_highlight_view.cc |
| @@ -55,6 +55,27 @@ void HoverHighlightView::SetRightViewVisible(bool visible) { |
| Layout(); |
| } |
| +void HoverHighlightView::SetSubText(const base::string16& sub_text) { |
|
tdanderson
2017/04/24 15:43:39
As far as I can tell, right now there are no place
mohsen
2017/04/25 05:10:01
Done.
|
| + DCHECK(text_label_); |
| + |
| + if (sub_text.empty()) { |
| + if (!sub_text_label_) |
| + return; |
| + tri_view_->RemoveView(TriView::Container::CENTER, sub_text_label_); |
| + delete sub_text_label_; |
| + sub_text_label_ = nullptr; |
| + } else { |
| + if (!sub_text_label_) { |
| + sub_text_label_ = TrayPopupUtils::CreateDefaultLabel(); |
| + tri_view_->AddView(TriView::Container::CENTER, sub_text_label_); |
| + } |
| + TrayPopupItemStyle sub_style(TrayPopupItemStyle::FontStyle::CAPTION); |
| + sub_style.set_color_style(TrayPopupItemStyle::ColorStyle::INACTIVE); |
| + sub_style.SetupLabel(sub_text_label_); |
| + sub_text_label_->SetText(sub_text); |
| + } |
| +} |
| + |
| void HoverHighlightView::AddIconAndLabel(const gfx::ImageSkia& image, |
| const base::string16& text) { |
| DoAddIconAndLabel(image, text, |
| @@ -102,16 +123,9 @@ void HoverHighlightView::DoAddIconAndLabels( |
| text_label_->SetEnabled(enabled()); |
| TrayPopupItemStyle style(font_style); |
| style.SetupLabel(text_label_); |
| - |
| tri_view_->AddView(TriView::Container::CENTER, text_label_); |
| - if (!sub_text.empty()) { |
| - sub_text_label_ = TrayPopupUtils::CreateDefaultLabel(); |
| - sub_text_label_->SetText(sub_text); |
| - TrayPopupItemStyle sub_style(TrayPopupItemStyle::FontStyle::CAPTION); |
| - sub_style.set_color_style(TrayPopupItemStyle::ColorStyle::INACTIVE); |
| - sub_style.SetupLabel(sub_text_label_); |
| - tri_view_->AddView(TriView::Container::CENTER, sub_text_label_); |
| - } |
| + |
| + SetSubText(sub_text); |
| tri_view_->SetContainerVisible(TriView::Container::END, false); |