| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/common/system/tray/label_tray_view.h" | 5 #include "ash/common/system/tray/label_tray_view.h" |
| 6 | 6 |
| 7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
| 8 #include "ash/common/system/tray/hover_highlight_view.h" | 8 #include "ash/common/system/tray/hover_highlight_view.h" |
| 9 #include "ash/common/system/tray/tray_constants.h" | 9 #include "ash/common/system/tray/tray_constants.h" |
| 10 #include "ash/common/system/tray/view_click_listener.h" | 10 #include "ash/common/system/tray/view_click_listener.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 views::View* LabelTrayView::CreateChildView( | 70 views::View* LabelTrayView::CreateChildView( |
| 71 const base::string16& message) const { | 71 const base::string16& message) const { |
| 72 HoverHighlightView* child = new HoverHighlightView(click_listener_); | 72 HoverHighlightView* child = new HoverHighlightView(click_listener_); |
| 73 if (icon_resource_id_) { | 73 if (icon_resource_id_) { |
| 74 const bool use_md = MaterialDesignController::IsSystemTrayMenuMaterial(); | 74 const bool use_md = MaterialDesignController::IsSystemTrayMenuMaterial(); |
| 75 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 75 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 76 gfx::ImageSkia icon = | 76 gfx::ImageSkia icon = |
| 77 use_md ? gfx::CreateVectorIcon( | 77 use_md ? gfx::CreateVectorIcon( |
| 78 ResourceIdToVectorIcon(icon_resource_id_), kMenuIconColor) | 78 ResourceIdToVectorIcon(icon_resource_id_), kMenuIconColor) |
| 79 : *rb.GetImageSkiaNamed(icon_resource_id_); | 79 : *rb.GetImageSkiaNamed(icon_resource_id_); |
| 80 child->AddIconAndLabelForDefaultView(icon, message, false /* highlight */); | 80 child->AddIconAndLabelForDefaultView(icon, message); |
| 81 child->text_label()->SetMultiLine(true); | 81 child->text_label()->SetMultiLine(true); |
| 82 if (!use_md) { | 82 if (!use_md) { |
| 83 child->SetBorder(views::CreateEmptyBorder( | 83 child->SetBorder(views::CreateEmptyBorder( |
| 84 0, kTrayPopupPaddingHorizontal, 0, kTrayPopupPaddingHorizontal)); | 84 0, kTrayPopupPaddingHorizontal, 0, kTrayPopupPaddingHorizontal)); |
| 85 child->text_label()->SizeToFit(kTrayNotificationContentsWidth); | 85 child->text_label()->SizeToFit(kTrayNotificationContentsWidth); |
| 86 } | 86 } |
| 87 } else { | 87 } else { |
| 88 child->AddLabel(message, gfx::ALIGN_LEFT, false /* highlight */); | 88 child->AddLabel(message, gfx::ALIGN_LEFT, false /* highlight */); |
| 89 child->text_label()->SetMultiLine(true); | 89 child->text_label()->SetMultiLine(true); |
| 90 child->text_label()->SizeToFit(kTrayNotificationContentsWidth + | 90 child->text_label()->SizeToFit(kTrayNotificationContentsWidth + |
| 91 kNotificationIconWidth); | 91 kNotificationIconWidth); |
| 92 } | 92 } |
| 93 child->text_label()->SetAllowCharacterBreak(true); | 93 child->text_label()->SetAllowCharacterBreak(true); |
| 94 child->SetExpandable(true); | 94 child->SetExpandable(true); |
| 95 child->SetVisible(true); | 95 child->SetVisible(true); |
| 96 return child; | 96 return child; |
| 97 } | 97 } |
| 98 | 98 |
| 99 } // namespace ash | 99 } // namespace ash |
| OLD | NEW |