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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 const base::string16& message) const { | 74 const base::string16& message) const { |
75 HoverHighlightView* child = new HoverHighlightView(click_listener_); | 75 HoverHighlightView* child = new HoverHighlightView(click_listener_); |
76 if (icon_resource_id_) { | 76 if (icon_resource_id_) { |
77 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 77 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
78 gfx::ImageSkia icon = | 78 gfx::ImageSkia icon = |
79 MaterialDesignController::IsSystemTrayMenuMaterial() | 79 MaterialDesignController::IsSystemTrayMenuMaterial() |
80 ? gfx::CreateVectorIcon(ResourceIdToVectorIcon(icon_resource_id_), | 80 ? gfx::CreateVectorIcon(ResourceIdToVectorIcon(icon_resource_id_), |
81 kMenuIconColor) | 81 kMenuIconColor) |
82 : *rb.GetImageSkiaNamed(icon_resource_id_); | 82 : *rb.GetImageSkiaNamed(icon_resource_id_); |
83 child->AddIconAndLabel(icon, message, false /* highlight */); | 83 child->AddIconAndLabel(icon, message, false /* highlight */); |
84 child->SetBorder(views::Border::CreateEmptyBorder( | 84 child->SetBorder(views::CreateEmptyBorder(0, kTrayPopupPaddingHorizontal, 0, |
85 0, kTrayPopupPaddingHorizontal, 0, kTrayPopupPaddingHorizontal)); | 85 kTrayPopupPaddingHorizontal)); |
86 child->text_label()->SetMultiLine(true); | 86 child->text_label()->SetMultiLine(true); |
87 child->text_label()->SizeToFit(kTrayNotificationContentsWidth); | 87 child->text_label()->SizeToFit(kTrayNotificationContentsWidth); |
88 } else { | 88 } else { |
89 child->AddLabel(message, gfx::ALIGN_LEFT, false /* highlight */); | 89 child->AddLabel(message, gfx::ALIGN_LEFT, false /* highlight */); |
90 child->text_label()->SetMultiLine(true); | 90 child->text_label()->SetMultiLine(true); |
91 child->text_label()->SizeToFit(kTrayNotificationContentsWidth + | 91 child->text_label()->SizeToFit(kTrayNotificationContentsWidth + |
92 kNotificationIconWidth); | 92 kNotificationIconWidth); |
93 } | 93 } |
94 child->text_label()->SetAllowCharacterBreak(true); | 94 child->text_label()->SetAllowCharacterBreak(true); |
95 child->SetExpandable(true); | 95 child->SetExpandable(true); |
96 child->SetVisible(true); | 96 child->SetVisible(true); |
97 return child; | 97 return child; |
98 } | 98 } |
99 | 99 |
100 } // namespace ash | 100 } // namespace ash |
OLD | NEW |