| 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" |
| 11 #include "ui/views/background.h" | 11 #include "ui/views/background.h" |
| 12 #include "ui/views/controls/button/image_button.h" | 12 #include "ui/views/controls/button/image_button.h" |
| 13 #include "ui/views/controls/image_view.h" | 13 #include "ui/views/controls/image_view.h" |
| 14 #include "ui/views/painter.h" | 14 #include "ui/views/painter.h" |
| 15 | 15 |
| 16 namespace message_center { | 16 namespace message_center { |
| 17 | 17 |
| 18 CustomNotificationView::CustomNotificationView( | 18 CustomNotificationView::CustomNotificationView( |
| 19 MessageCenterController* controller, | 19 MessageCenterController* controller, |
| 20 const Notification& notification) | 20 const Notification& notification) |
| 21 : MessageView(controller, notification) { | 21 : MessageView(controller, notification) { |
| 22 DCHECK_EQ(NOTIFICATION_TYPE_CUSTOM, notification.type()); | 22 DCHECK_EQ(NOTIFICATION_TYPE_CUSTOM, notification.type()); |
| 23 | 23 |
| 24 auto custom_content = notification.delegate()->CreateCustomContent(); | 24 auto custom_content = notification.delegate()->CreateCustomContent(this); |
| 25 | 25 |
| 26 contents_view_ = custom_content->view.release(); | 26 contents_view_ = custom_content->view.release(); |
| 27 DCHECK(contents_view_); | 27 DCHECK(contents_view_); |
| 28 AddChildView(contents_view_); | 28 AddChildView(contents_view_); |
| 29 | 29 |
| 30 contents_view_delegate_ = std::move(custom_content->delegate); | 30 contents_view_delegate_ = std::move(custom_content->delegate); |
| 31 DCHECK(contents_view_delegate_); | 31 DCHECK(contents_view_delegate_); |
| 32 | 32 |
| 33 if (contents_view_->background()) { | 33 if (contents_view_->background()) { |
| 34 background_view()->background()->SetNativeControlColor( | 34 background_view()->background()->SetNativeControlColor( |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 116 } |
| 117 | 117 |
| 118 void CustomNotificationView::OnPaint(gfx::Canvas* canvas) { | 118 void CustomNotificationView::OnPaint(gfx::Canvas* canvas) { |
| 119 MessageView::OnPaint(canvas); | 119 MessageView::OnPaint(canvas); |
| 120 if (contents_view_ && contents_view_->IsFocusable()) | 120 if (contents_view_ && contents_view_->IsFocusable()) |
| 121 views::Painter::PaintFocusPainter(contents_view_, canvas, | 121 views::Painter::PaintFocusPainter(contents_view_, canvas, |
| 122 focus_painter_.get()); | 122 focus_painter_.get()); |
| 123 } | 123 } |
| 124 | 124 |
| 125 } // namespace message_center | 125 } // namespace message_center |
| OLD | NEW |