| 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/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 } | 687 } |
| 688 | 688 |
| 689 DCHECK(bottom_view_); | 689 DCHECK(bottom_view_); |
| 690 DCHECK_EQ(this, bottom_view_->parent()); | 690 DCHECK_EQ(this, bottom_view_->parent()); |
| 691 | 691 |
| 692 // TODO(dewittj): Detect a compatible update and use the existing image view. | 692 // TODO(dewittj): Detect a compatible update and use the existing image view. |
| 693 if (!notification.image().IsEmpty()) { | 693 if (!notification.image().IsEmpty()) { |
| 694 gfx::Size image_size(kNotificationPreferredImageWidth, | 694 gfx::Size image_size(kNotificationPreferredImageWidth, |
| 695 kNotificationPreferredImageHeight); | 695 kNotificationPreferredImageHeight); |
| 696 image_view_ = MakeNotificationImage(notification.image(), image_size); | 696 image_view_ = MakeNotificationImage(notification.image(), image_size); |
| 697 bottom_view_->AddChildView(image_view_); | 697 bottom_view_->AddChildViewAt(image_view_, 0); |
| 698 } | 698 } |
| 699 } | 699 } |
| 700 | 700 |
| 701 void NotificationView::CreateOrUpdateActionButtonViews( | 701 void NotificationView::CreateOrUpdateActionButtonViews( |
| 702 const Notification& notification) { | 702 const Notification& notification) { |
| 703 std::vector<ButtonInfo> buttons = notification.buttons(); | 703 std::vector<ButtonInfo> buttons = notification.buttons(); |
| 704 bool new_buttons = action_buttons_.size() != buttons.size(); | 704 bool new_buttons = action_buttons_.size() != buttons.size(); |
| 705 | 705 |
| 706 if (new_buttons || buttons.size() == 0) { | 706 if (new_buttons || buttons.size() == 0) { |
| 707 // STLDeleteElements also clears the container. | 707 // STLDeleteElements also clears the container. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 | 777 |
| 778 return message_line_limit; | 778 return message_line_limit; |
| 779 } | 779 } |
| 780 | 780 |
| 781 int NotificationView::GetMessageHeight(int width, int limit) const { | 781 int NotificationView::GetMessageHeight(int width, int limit) const { |
| 782 return message_view_ ? | 782 return message_view_ ? |
| 783 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0; | 783 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0; |
| 784 } | 784 } |
| 785 | 785 |
| 786 } // namespace message_center | 786 } // namespace message_center |
| OLD | NEW |