Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/system/tray/hover_highlight_view.h" | 5 #include "ash/system/tray/hover_highlight_view.h" |
| 6 | 6 |
| 7 #include "ash/resources/vector_icons/vector_icons.h" | 7 #include "ash/resources/vector_icons/vector_icons.h" |
| 8 #include "ash/system/tray/tray_constants.h" | 8 #include "ash/system/tray/tray_constants.h" |
| 9 #include "ash/system/tray/tray_popup_utils.h" | 9 #include "ash/system/tray/tray_popup_utils.h" |
| 10 #include "ash/system/tray/tri_view.h" | 10 #include "ash/system/tray/tri_view.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 | 49 |
| 50 void HoverHighlightView::SetRightViewVisible(bool visible) { | 50 void HoverHighlightView::SetRightViewVisible(bool visible) { |
| 51 if (!right_view_) | 51 if (!right_view_) |
| 52 return; | 52 return; |
| 53 | 53 |
| 54 right_view_->SetVisible(visible); | 54 right_view_->SetVisible(visible); |
| 55 Layout(); | 55 Layout(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void HoverHighlightView::SetSubText(const base::string16& sub_text) { | 58 void HoverHighlightView::SetSubText(const base::string16& sub_text) { |
| 59 if (sub_text.empty()) | |
|
mohsen
2017/04/27 19:39:37
We should either disallow empty string altogether
tdanderson
2017/04/27 20:52:16
Done.
| |
| 60 return; | |
| 61 | |
| 59 DCHECK(text_label_); | 62 DCHECK(text_label_); |
| 60 | 63 |
| 61 if (!sub_text_label_) { | 64 if (!sub_text_label_) { |
| 62 sub_text_label_ = TrayPopupUtils::CreateDefaultLabel(); | 65 sub_text_label_ = TrayPopupUtils::CreateDefaultLabel(); |
| 63 tri_view_->AddView(TriView::Container::CENTER, sub_text_label_); | 66 tri_view_->AddView(TriView::Container::CENTER, sub_text_label_); |
| 64 } | 67 } |
| 68 | |
| 65 TrayPopupItemStyle sub_style(TrayPopupItemStyle::FontStyle::CAPTION); | 69 TrayPopupItemStyle sub_style(TrayPopupItemStyle::FontStyle::CAPTION); |
| 66 sub_style.set_color_style(TrayPopupItemStyle::ColorStyle::INACTIVE); | 70 sub_style.set_color_style(TrayPopupItemStyle::ColorStyle::INACTIVE); |
| 67 sub_style.SetupLabel(sub_text_label_); | 71 sub_style.SetupLabel(sub_text_label_); |
| 68 sub_text_label_->SetText(sub_text); | 72 sub_text_label_->SetText(sub_text); |
| 69 } | 73 } |
| 70 | 74 |
| 71 void HoverHighlightView::AddIconAndLabel(const gfx::ImageSkia& image, | 75 void HoverHighlightView::AddIconAndLabel(const gfx::ImageSkia& image, |
| 72 const base::string16& text) { | 76 const base::string16& text) { |
| 73 DoAddIconAndLabel(image, text, | 77 DoAddIconAndLabel(image, text, |
| 74 TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL); | 78 TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 if (right_view_) | 202 if (right_view_) |
| 199 right_view_->SetEnabled(enabled()); | 203 right_view_->SetEnabled(enabled()); |
| 200 } | 204 } |
| 201 | 205 |
| 202 void HoverHighlightView::OnFocus() { | 206 void HoverHighlightView::OnFocus() { |
| 203 ScrollRectToVisible(gfx::Rect(gfx::Point(), size())); | 207 ScrollRectToVisible(gfx::Rect(gfx::Point(), size())); |
| 204 ActionableView::OnFocus(); | 208 ActionableView::OnFocus(); |
| 205 } | 209 } |
| 206 | 210 |
| 207 } // namespace ash | 211 } // namespace ash |
| OLD | NEW |