| 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/arc/notification/arc_notification_manager.h" | 5 #include "ui/arc/notification/arc_notification_manager.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/system/toast/toast_manager.h" | 8 #include "ash/system/toast/toast_manager.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 11 #include "ui/arc/notification/arc_notification_item.h" | 11 #include "ui/arc/notification/arc_notification_item.h" |
| 12 #include "ui/arc/notification/arc_notification_surface_collection.h" |
| 12 | 13 |
| 13 namespace arc { | 14 namespace arc { |
| 14 | 15 |
| 15 ArcNotificationManager::ArcNotificationManager(ArcBridgeService* bridge_service, | 16 ArcNotificationManager::ArcNotificationManager(ArcBridgeService* bridge_service, |
| 16 const AccountId& main_profile_id) | 17 const AccountId& main_profile_id) |
| 17 : ArcNotificationManager(bridge_service, | 18 : ArcNotificationManager(bridge_service, |
| 18 main_profile_id, | 19 main_profile_id, |
| 19 message_center::MessageCenter::Get()) {} | 20 message_center::MessageCenter::Get()) {} |
| 20 | 21 |
| 21 ArcNotificationManager::ArcNotificationManager( | 22 ArcNotificationManager::ArcNotificationManager( |
| 22 ArcBridgeService* bridge_service, | 23 ArcBridgeService* bridge_service, |
| 23 const AccountId& main_profile_id, | 24 const AccountId& main_profile_id, |
| 24 message_center::MessageCenter* message_center) | 25 message_center::MessageCenter* message_center) |
| 25 : ArcService(bridge_service), | 26 : ArcService(bridge_service), |
| 26 main_profile_id_(main_profile_id), | 27 main_profile_id_(main_profile_id), |
| 27 message_center_(message_center), | 28 message_center_(message_center), |
| 29 notification_surface_collection_(new ArcNotificationSurfaceCollection), |
| 28 binding_(this) { | 30 binding_(this) { |
| 29 arc_bridge_service()->AddObserver(this); | 31 arc_bridge_service()->AddObserver(this); |
| 30 } | 32 } |
| 31 | 33 |
| 32 ArcNotificationManager::~ArcNotificationManager() { | 34 ArcNotificationManager::~ArcNotificationManager() { |
| 33 arc_bridge_service()->RemoveObserver(this); | 35 arc_bridge_service()->RemoveObserver(this); |
| 34 } | 36 } |
| 35 | 37 |
| 36 void ArcNotificationManager::OnNotificationsInstanceReady() { | 38 void ArcNotificationManager::OnNotificationsInstanceReady() { |
| 37 DCHECK(!ready_); | 39 DCHECK(!ready_); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 void ArcNotificationManager::OnToastPosted(mojom::ArcToastDataPtr data) { | 183 void ArcNotificationManager::OnToastPosted(mojom::ArcToastDataPtr data) { |
| 182 ash::Shell::GetInstance()->toast_manager()->Show( | 184 ash::Shell::GetInstance()->toast_manager()->Show( |
| 183 ash::ToastData(data->id, data->text, data->duration, data->dismiss_text)); | 185 ash::ToastData(data->id, data->text, data->duration, data->dismiss_text)); |
| 184 } | 186 } |
| 185 | 187 |
| 186 void ArcNotificationManager::OnToastCancelled(mojom::ArcToastDataPtr data) { | 188 void ArcNotificationManager::OnToastCancelled(mojom::ArcToastDataPtr data) { |
| 187 ash::Shell::GetInstance()->toast_manager()->Cancel(data->id); | 189 ash::Shell::GetInstance()->toast_manager()->Cancel(data->id); |
| 188 } | 190 } |
| 189 | 191 |
| 190 } // namespace arc | 192 } // namespace arc |
| OLD | NEW |