| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 const Notification& notification) { | 573 const Notification& notification) { |
| 574 gfx::Size image_view_size(kNotificationIconSize, kNotificationIconSize); | 574 gfx::Size image_view_size(kNotificationIconSize, kNotificationIconSize); |
| 575 | 575 |
| 576 if (!icon_view_) { | 576 if (!icon_view_) { |
| 577 icon_view_ = new ProportionalImageView(image_view_size); | 577 icon_view_ = new ProportionalImageView(image_view_size); |
| 578 AddChildView(icon_view_); | 578 AddChildView(icon_view_); |
| 579 } | 579 } |
| 580 | 580 |
| 581 gfx::ImageSkia icon = notification.icon().AsImageSkia(); | 581 gfx::ImageSkia icon = notification.icon().AsImageSkia(); |
| 582 icon_view_->SetImage(icon, icon.size()); | 582 icon_view_->SetImage(icon, icon.size()); |
| 583 | |
| 584 if (notification.draw_icon_background()) { | |
| 585 icon_view_->set_background( | |
| 586 views::Background::CreateSolidBackground(kIconBackgroundColor)); | |
| 587 } else { | |
| 588 icon_view_->set_background(nullptr); | |
| 589 } | |
| 590 } | 583 } |
| 591 | 584 |
| 592 void NotificationView::CreateOrUpdateImageView( | 585 void NotificationView::CreateOrUpdateImageView( |
| 593 const Notification& notification) { | 586 const Notification& notification) { |
| 594 // |image_view_| is the view representing the area covered by the | 587 // |image_view_| is the view representing the area covered by the |
| 595 // notification's image, including background and border. Its size can be | 588 // notification's image, including background and border. Its size can be |
| 596 // specified in advance and images will be scaled to fit including a border if | 589 // specified in advance and images will be scaled to fit including a border if |
| 597 // necessary. | 590 // necessary. |
| 598 if (notification.image().IsEmpty()) { | 591 if (notification.image().IsEmpty()) { |
| 599 delete image_container_; | 592 delete image_container_; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 | 704 |
| 712 return message_line_limit; | 705 return message_line_limit; |
| 713 } | 706 } |
| 714 | 707 |
| 715 int NotificationView::GetMessageHeight(int width, int limit) const { | 708 int NotificationView::GetMessageHeight(int width, int limit) const { |
| 716 return message_view_ ? | 709 return message_view_ ? |
| 717 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0; | 710 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0; |
| 718 } | 711 } |
| 719 | 712 |
| 720 } // namespace message_center | 713 } // namespace message_center |
| OLD | NEW |