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 "ui/message_center/views/notification_view.h" | 5 #include "ui/message_center/views/notification_view.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); | 319 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); |
320 top_view_->SetBorder( | 320 top_view_->SetBorder( |
321 MakeEmptyBorder(kTextTopPadding - 8, 0, kTextBottomPadding - 5, 0)); | 321 MakeEmptyBorder(kTextTopPadding - 8, 0, kTextBottomPadding - 5, 0)); |
322 | 322 |
323 const gfx::FontList default_label_font_list = views::Label().font_list(); | 323 const gfx::FontList default_label_font_list = views::Label().font_list(); |
324 | 324 |
325 // Create the title view if appropriate. | 325 // Create the title view if appropriate. |
326 title_view_ = NULL; | 326 title_view_ = NULL; |
327 if (!notification.title().empty()) { | 327 if (!notification.title().empty()) { |
328 const gfx::FontList& font_list = | 328 const gfx::FontList& font_list = |
329 default_label_font_list.DeriveFontListWithSizeDelta(2); | 329 default_label_font_list.DeriveWithSizeDelta(2); |
330 int padding = kTitleLineHeight - font_list.GetHeight(); | 330 int padding = kTitleLineHeight - font_list.GetHeight(); |
331 title_view_ = new BoundedLabel( | 331 title_view_ = new BoundedLabel( |
332 gfx::TruncateString(notification.title(), kTitleCharacterLimit), | 332 gfx::TruncateString(notification.title(), kTitleCharacterLimit), |
333 font_list); | 333 font_list); |
334 title_view_->SetLineHeight(kTitleLineHeight); | 334 title_view_->SetLineHeight(kTitleLineHeight); |
335 title_view_->SetLineLimit(IsExperimentalNotificationUIEnabled() ? | 335 title_view_->SetLineLimit(IsExperimentalNotificationUIEnabled() ? |
336 message_center::kExperimentalTitleLineLimit : | 336 message_center::kExperimentalTitleLineLimit : |
337 message_center::kTitleLineLimit); | 337 message_center::kTitleLineLimit); |
338 title_view_->SetColors(message_center::kRegularTextColor, | 338 title_view_->SetColors(message_center::kRegularTextColor, |
339 kRegularTextBackgroundColor); | 339 kRegularTextBackgroundColor); |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 return message_view_ ? | 668 return message_view_ ? |
669 message_view_->GetLinesForWidthAndLimit(width, limit) : 0; | 669 message_view_->GetLinesForWidthAndLimit(width, limit) : 0; |
670 } | 670 } |
671 | 671 |
672 int NotificationView::GetMessageHeight(int width, int limit) { | 672 int NotificationView::GetMessageHeight(int width, int limit) { |
673 return message_view_ ? | 673 return message_view_ ? |
674 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0; | 674 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0; |
675 } | 675 } |
676 | 676 |
677 } // namespace message_center | 677 } // namespace message_center |
OLD | NEW |