| 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 <set> | 5 #include <set> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "chrome/browser/notifications/message_center_display_service.h" | 8 #include "chrome/browser/notifications/message_center_display_service.h" |
| 9 | 9 |
| 10 #include "chrome/browser/notifications/notification.h" | 10 #include "chrome/browser/notifications/notification.h" |
| 11 #include "chrome/browser/notifications/notification_ui_manager.h" | 11 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 14 | 14 |
| 15 MessageCenterDisplayService::MessageCenterDisplayService( | 15 MessageCenterDisplayService::MessageCenterDisplayService( |
| 16 Profile* profile, | 16 Profile* profile, |
| 17 NotificationUIManager* ui_manager) | 17 NotificationUIManager* ui_manager) |
| 18 : profile_(profile), ui_manager_(ui_manager) {} | 18 : NotificationDisplayService(profile), |
| 19 profile_(profile), |
| 20 ui_manager_(ui_manager) {} |
| 19 | 21 |
| 20 MessageCenterDisplayService::~MessageCenterDisplayService() {} | 22 MessageCenterDisplayService::~MessageCenterDisplayService() {} |
| 21 | 23 |
| 22 void MessageCenterDisplayService::Display( | 24 void MessageCenterDisplayService::Display( |
| 23 NotificationCommon::Type notification_type, | 25 NotificationCommon::Type notification_type, |
| 24 const std::string& notification_id, | 26 const std::string& notification_id, |
| 25 const Notification& notification) { | 27 const Notification& notification) { |
| 26 // TODO(miguelg): MCDS should stop relying on the |notification|'s delegate | 28 // TODO(miguelg): MCDS should stop relying on the |notification|'s delegate |
| 27 // for Close/Click operations once the Notification object becomes a mojom | 29 // for Close/Click operations once the Notification object becomes a mojom |
| 28 // type. | 30 // type. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 40 const DisplayedNotificationsCallback& callback) { | 42 const DisplayedNotificationsCallback& callback) { |
| 41 auto displayed_notifications = | 43 auto displayed_notifications = |
| 42 base::MakeUnique<std::set<std::string>>(ui_manager_->GetAllIdsByProfile( | 44 base::MakeUnique<std::set<std::string>>(ui_manager_->GetAllIdsByProfile( |
| 43 NotificationUIManager::GetProfileID(profile_))); | 45 NotificationUIManager::GetProfileID(profile_))); |
| 44 | 46 |
| 45 content::BrowserThread::PostTask( | 47 content::BrowserThread::PostTask( |
| 46 content::BrowserThread::UI, FROM_HERE, | 48 content::BrowserThread::UI, FROM_HERE, |
| 47 base::BindOnce(callback, base::Passed(&displayed_notifications), | 49 base::BindOnce(callback, base::Passed(&displayed_notifications), |
| 48 true /* supports_synchronization */)); | 50 true /* supports_synchronization */)); |
| 49 } | 51 } |
| OLD | NEW |