Chromium Code Reviews| 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 "chrome/browser/notifications/message_center_display_service.h" | 5 #include "chrome/browser/notifications/message_center_display_service.h" |
| 6 | 6 |
| 7 #include "chrome/browser/notifications/notification.h" | 7 #include "chrome/browser/notifications/notification.h" |
| 8 #include "chrome/browser/notifications/notification_ui_manager.h" | 8 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "content/public/browser/browser_thread.h" | |
| 10 | 11 |
| 11 MessageCenterDisplayService::MessageCenterDisplayService( | 12 MessageCenterDisplayService::MessageCenterDisplayService( |
| 12 Profile* profile, | 13 Profile* profile, |
| 13 NotificationUIManager* ui_manager) | 14 NotificationUIManager* ui_manager) |
| 14 : profile_(profile), ui_manager_(ui_manager) {} | 15 : profile_(profile), ui_manager_(ui_manager) {} |
| 15 | 16 |
| 16 MessageCenterDisplayService::~MessageCenterDisplayService() {} | 17 MessageCenterDisplayService::~MessageCenterDisplayService() {} |
| 17 | 18 |
| 18 void MessageCenterDisplayService::Display( | 19 void MessageCenterDisplayService::Display( |
| 19 NotificationCommon::Type notification_type, | 20 NotificationCommon::Type notification_type, |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 34 | 35 |
| 35 bool MessageCenterDisplayService::GetDisplayed( | 36 bool MessageCenterDisplayService::GetDisplayed( |
| 36 std::set<std::string>* notifications) const { | 37 std::set<std::string>* notifications) const { |
| 37 DCHECK(notifications); | 38 DCHECK(notifications); |
| 38 for (auto notification_id : ui_manager_->GetAllIdsByProfile( | 39 for (auto notification_id : ui_manager_->GetAllIdsByProfile( |
| 39 NotificationUIManager::GetProfileID(profile_))) { | 40 NotificationUIManager::GetProfileID(profile_))) { |
| 40 notifications->insert(notification_id); | 41 notifications->insert(notification_id); |
| 41 } | 42 } |
| 42 return true; | 43 return true; |
| 43 } | 44 } |
| 45 | |
| 46 void MessageCenterDisplayService::GetDisplayedAsync( | |
| 47 const NotificationCommon::NotificationResultCallback& callback) const { | |
| 48 std::unique_ptr<std::set<std::string>> displayedNotifications = | |
|
Robert Sesek
2017/02/24 22:38:05
nit: under_scores
Miguel Garcia
2017/03/22 22:00:06
Done.
| |
| 49 base::MakeUnique<std::set<std::string>>(); | |
| 50 GetDisplayed(displayedNotifications.get()); | |
| 51 content::BrowserThread::PostTask( | |
| 52 content::BrowserThread::IO, FROM_HERE, | |
| 53 base::Bind(callback, base::Passed(&displayedNotifications), | |
| 54 true /* supports sync */)); | |
| 55 } | |
| OLD | NEW |