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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 DCHECK(text_label_); | 59 DCHECK(text_label_); |
| 60 DCHECK(!sub_text.empty()); | |
| 61 | 60 |
| 62 if (!sub_text_label_) { | 61 if (!sub_text.empty()) { |
| 63 sub_text_label_ = TrayPopupUtils::CreateDefaultLabel(); | 62 sub_text_label_ = TrayPopupUtils::CreateDefaultLabel(); |
|
stevenjb
2017/05/04 17:25:58
You still need the if (!sub_text_label_) test here
| |
| 63 sub_text_label_->SetText(sub_text); | |
| 64 TrayPopupItemStyle sub_style(TrayPopupItemStyle::FontStyle::CAPTION); | |
| 65 sub_style.set_color_style(TrayPopupItemStyle::ColorStyle::INACTIVE); | |
| 66 sub_style.SetupLabel(sub_text_label_); | |
| 64 tri_view_->AddView(TriView::Container::CENTER, sub_text_label_); | 67 tri_view_->AddView(TriView::Container::CENTER, sub_text_label_); |
| 65 } | 68 } |
| 66 | |
| 67 TrayPopupItemStyle sub_style(TrayPopupItemStyle::FontStyle::CAPTION); | |
| 68 sub_style.set_color_style(TrayPopupItemStyle::ColorStyle::INACTIVE); | |
| 69 sub_style.SetupLabel(sub_text_label_); | |
| 70 sub_text_label_->SetText(sub_text); | |
| 71 } | 69 } |
| 72 | 70 |
| 73 void HoverHighlightView::AddIconAndLabel(const gfx::ImageSkia& image, | 71 void HoverHighlightView::AddIconAndLabel(const gfx::ImageSkia& image, |
| 74 const base::string16& text) { | 72 const base::string16& text) { |
| 75 DoAddIconAndLabel(image, text, | 73 DoAddIconAndLabel(image, text, |
| 76 TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL); | 74 TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL); |
| 77 } | 75 } |
| 78 | 76 |
| 79 void HoverHighlightView::AddIconAndLabels(const gfx::ImageSkia& image, | 77 void HoverHighlightView::AddIconAndLabels(const gfx::ImageSkia& image, |
| 80 const base::string16& text, | 78 const base::string16& text, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 if (right_view_) | 199 if (right_view_) |
| 202 right_view_->SetEnabled(enabled()); | 200 right_view_->SetEnabled(enabled()); |
| 203 } | 201 } |
| 204 | 202 |
| 205 void HoverHighlightView::OnFocus() { | 203 void HoverHighlightView::OnFocus() { |
| 206 ScrollRectToVisible(gfx::Rect(gfx::Point(), size())); | 204 ScrollRectToVisible(gfx::Rect(gfx::Point(), size())); |
| 207 ActionableView::OnFocus(); | 205 ActionableView::OnFocus(); |
| 208 } | 206 } |
| 209 | 207 |
| 210 } // namespace ash | 208 } // namespace ash |
| OLD | NEW |