| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/arc/notification/arc_notification_delegate.h" | 5 #include "ui/arc/notification/arc_notification_delegate.h" |
| 6 | 6 |
| 7 #include "ui/arc/notification/arc_custom_notification_view.h" | 7 #include "ui/arc/notification/arc_notification_content_view.h" |
| 8 #include "ui/arc/notification/arc_notification_item.h" | 8 #include "ui/arc/notification/arc_notification_item.h" |
| 9 #include "ui/arc/notification/arc_notification_view.h" | 9 #include "ui/arc/notification/arc_notification_view.h" |
| 10 #include "ui/message_center/notification.h" | 10 #include "ui/message_center/notification.h" |
| 11 #include "ui/message_center/views/message_center_controller.h" | 11 #include "ui/message_center/views/message_center_controller.h" |
| 12 #include "ui/message_center/views/message_view.h" | 12 #include "ui/message_center/views/message_view.h" |
| 13 | 13 |
| 14 namespace arc { | 14 namespace arc { |
| 15 | 15 |
| 16 ArcNotificationDelegate::ArcNotificationDelegate( | 16 ArcNotificationDelegate::ArcNotificationDelegate( |
| 17 base::WeakPtr<ArcNotificationItem> item) | 17 base::WeakPtr<ArcNotificationItem> item) |
| 18 : item_(item) { | 18 : item_(item) { |
| 19 DCHECK(item_); | 19 DCHECK(item_); |
| 20 } | 20 } |
| 21 | 21 |
| 22 ArcNotificationDelegate::~ArcNotificationDelegate() = default; | 22 ArcNotificationDelegate::~ArcNotificationDelegate() = default; |
| 23 | 23 |
| 24 std::unique_ptr<message_center::MessageView> | 24 std::unique_ptr<message_center::MessageView> |
| 25 ArcNotificationDelegate::CreateCustomMessageView( | 25 ArcNotificationDelegate::CreateCustomMessageView( |
| 26 message_center::MessageCenterController* controller, | 26 message_center::MessageCenterController* controller, |
| 27 const message_center::Notification& notification) { | 27 const message_center::Notification& notification) { |
| 28 DCHECK(item_); | 28 DCHECK(item_); |
| 29 DCHECK_EQ(item_->GetNotificationId(), notification.id()); | 29 DCHECK_EQ(item_->GetNotificationId(), notification.id()); |
| 30 | 30 |
| 31 auto view = base::MakeUnique<ArcCustomNotificationView>(item_.get()); | 31 auto view = base::MakeUnique<ArcNotificationContentView>(item_.get()); |
| 32 auto content_view_delegate = view->CreateContentViewDelegate(); | 32 auto content_view_delegate = view->CreateContentViewDelegate(); |
| 33 return base::MakeUnique<ArcNotificationView>(std::move(view), | 33 return base::MakeUnique<ArcNotificationView>(std::move(view), |
| 34 std::move(content_view_delegate), | 34 std::move(content_view_delegate), |
| 35 controller, notification); | 35 controller, notification); |
| 36 } | 36 } |
| 37 | 37 |
| 38 void ArcNotificationDelegate::Close(bool by_user) { | 38 void ArcNotificationDelegate::Close(bool by_user) { |
| 39 DCHECK(item_); | 39 DCHECK(item_); |
| 40 item_->Close(by_user); | 40 item_->Close(by_user); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void ArcNotificationDelegate::Click() { | 43 void ArcNotificationDelegate::Click() { |
| 44 DCHECK(item_); | 44 DCHECK(item_); |
| 45 item_->Click(); | 45 item_->Click(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 } // namespace arc | 48 } // namespace arc |
| OLD | NEW |