Chromium Code Reviews| 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_custom_notification_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" | |
| 10 #include "ui/message_center/notification.h" | |
| 11 #include "ui/message_center/views/message_center_controller.h" | |
| 12 #include "ui/message_center/views/message_view.h" | |
| 9 | 13 |
| 10 namespace arc { | 14 namespace arc { |
| 11 | 15 |
| 12 ArcNotificationDelegate::ArcNotificationDelegate( | 16 ArcNotificationDelegate::ArcNotificationDelegate( |
| 13 base::WeakPtr<ArcNotificationItem> item) | 17 base::WeakPtr<ArcNotificationItem> item) |
| 14 : item_(item) { | 18 : item_(item) { |
| 15 DCHECK(item_); | 19 DCHECK(item_); |
| 16 } | 20 } |
| 17 | 21 |
| 18 ArcNotificationDelegate::~ArcNotificationDelegate() {} | 22 ArcNotificationDelegate::~ArcNotificationDelegate() {} |
|
hidehiko
2017/05/11 14:22:47
nit: s/{}/= default;/
yoshiki
2017/05/12 08:42:37
Done.
| |
| 19 | 23 |
| 20 std::unique_ptr<message_center::CustomContent> | 24 std::unique_ptr<message_center::MessageView> |
| 21 ArcNotificationDelegate::CreateCustomContent() { | 25 ArcNotificationDelegate::CreateCustomMessageView( |
| 26 message_center::MessageCenterController* controller, | |
| 27 const message_center::Notification& notification) { | |
| 22 DCHECK(item_); | 28 DCHECK(item_); |
| 29 DCHECK_EQ(item_->GetNotificationId(), notification.id()); | |
| 30 | |
| 23 auto view = base::MakeUnique<ArcCustomNotificationView>(item_.get()); | 31 auto view = base::MakeUnique<ArcCustomNotificationView>(item_.get()); |
| 24 auto content_view_delegate = view->CreateContentViewDelegate(); | 32 auto content_view_delegate = view->CreateContentViewDelegate(); |
| 25 return base::MakeUnique<message_center::CustomContent>( | 33 return base::MakeUnique<ArcNotificationView>(std::move(view), |
| 26 std::move(view), std::move(content_view_delegate)); | 34 std::move(content_view_delegate), |
| 35 controller, notification); | |
| 27 } | 36 } |
| 28 | 37 |
| 29 void ArcNotificationDelegate::Close(bool by_user) { | 38 void ArcNotificationDelegate::Close(bool by_user) { |
| 30 DCHECK(item_); | 39 DCHECK(item_); |
| 31 item_->Close(by_user); | 40 item_->Close(by_user); |
| 32 } | 41 } |
| 33 | 42 |
| 34 void ArcNotificationDelegate::Click() { | 43 void ArcNotificationDelegate::Click() { |
| 35 DCHECK(item_); | 44 DCHECK(item_); |
| 36 item_->Click(); | 45 item_->Click(); |
| 37 } | 46 } |
| 38 | 47 |
| 39 } // namespace arc | 48 } // namespace arc |
| OLD | NEW |