| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/custom_notification_view.h" | 5 #include "ui/message_center/views/custom_notification_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ui/gfx/geometry/size.h" | 9 #include "ui/gfx/geometry/size.h" |
| 10 #include "ui/message_center/message_center_style.h" | 10 #include "ui/message_center/message_center_style.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 if (!contents_view_delegate_) | 74 if (!contents_view_delegate_) |
| 75 return false; | 75 return false; |
| 76 return contents_view_delegate_->IsPinned(); | 76 return contents_view_delegate_->IsPinned(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 gfx::Size CustomNotificationView::GetPreferredSize() const { | 79 gfx::Size CustomNotificationView::GetPreferredSize() const { |
| 80 const gfx::Insets insets = GetInsets(); | 80 const gfx::Insets insets = GetInsets(); |
| 81 const int contents_width = kNotificationWidth - insets.width(); | 81 const int contents_width = kNotificationWidth - insets.width(); |
| 82 const int contents_height = contents_view_->GetHeightForWidth(contents_width); | 82 const int contents_height = contents_view_->GetHeightForWidth(contents_width); |
| 83 | 83 |
| 84 constexpr int kMaxContentHeight = 256; | 84 // This is union of max/min height for M (256-64) and N (284-92). |
| 85 constexpr int kMaxContentHeight = 284; |
| 85 constexpr int kMinContentHeight = 64; | 86 constexpr int kMinContentHeight = 64; |
| 86 return gfx::Size(kNotificationWidth, | 87 return gfx::Size(kNotificationWidth, |
| 87 std::max(kMinContentHeight + insets.height(), | 88 std::max(kMinContentHeight + insets.height(), |
| 88 std::min(kMaxContentHeight + insets.height(), | 89 std::min(kMaxContentHeight + insets.height(), |
| 89 contents_height + insets.height()))); | 90 contents_height + insets.height()))); |
| 90 } | 91 } |
| 91 | 92 |
| 92 void CustomNotificationView::Layout() { | 93 void CustomNotificationView::Layout() { |
| 93 MessageView::Layout(); | 94 MessageView::Layout(); |
| 94 | 95 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 116 } | 117 } |
| 117 | 118 |
| 118 void CustomNotificationView::OnPaint(gfx::Canvas* canvas) { | 119 void CustomNotificationView::OnPaint(gfx::Canvas* canvas) { |
| 119 MessageView::OnPaint(canvas); | 120 MessageView::OnPaint(canvas); |
| 120 if (contents_view_ && contents_view_->IsFocusable()) | 121 if (contents_view_ && contents_view_->IsFocusable()) |
| 121 views::Painter::PaintFocusPainter(contents_view_, canvas, | 122 views::Painter::PaintFocusPainter(contents_view_, canvas, |
| 122 focus_painter_.get()); | 123 focus_painter_.get()); |
| 123 } | 124 } |
| 124 | 125 |
| 125 } // namespace message_center | 126 } // namespace message_center |
| OLD | NEW |