| 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/stub_notification_platform_bridge.h" | 5 #include "chrome/browser/notifications/stub_notification_platform_bridge.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
| 9 | 9 |
| 10 StubNotificationPlatformBridge::StubNotificationPlatformBridge() | 10 StubNotificationPlatformBridge::StubNotificationPlatformBridge() |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 if (profile_notifications.empty()) | 50 if (profile_notifications.empty()) |
| 51 notifications_.erase(profile_id); | 51 notifications_.erase(profile_id); |
| 52 break; | 52 break; |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 void StubNotificationPlatformBridge::GetDisplayed( | 57 void StubNotificationPlatformBridge::GetDisplayed( |
| 58 const std::string& profile_id, | 58 const std::string& profile_id, |
| 59 bool incognito, | 59 bool incognito, |
| 60 const DisplayedNotificationsCallback& callback) const { | 60 const GetDisplayedNotificationsCallback& callback) const { |
| 61 auto displayed_notifications = base::MakeUnique<std::set<std::string>>(); | 61 auto displayed_notifications = base::MakeUnique<std::set<std::string>>(); |
| 62 | 62 |
| 63 if (notifications_.find(profile_id) != notifications_.end()) { | 63 if (notifications_.find(profile_id) != notifications_.end()) { |
| 64 const std::vector<Notification>& profile_notifications = | 64 const std::vector<Notification>& profile_notifications = |
| 65 notifications_.at(profile_id); | 65 notifications_.at(profile_id); |
| 66 for (auto notification : profile_notifications) | 66 for (auto notification : profile_notifications) |
| 67 displayed_notifications->insert(notification.id()); | 67 displayed_notifications->insert(notification.id()); |
| 68 } | 68 } |
| 69 | 69 |
| 70 content::BrowserThread::PostTask( | 70 content::BrowserThread::PostTask( |
| 71 content::BrowserThread::UI, FROM_HERE, | 71 content::BrowserThread::UI, FROM_HERE, |
| 72 base::Bind(callback, base::Passed(&displayed_notifications), | 72 base::Bind(callback, base::Passed(&displayed_notifications), |
| 73 true /* supports_synchronization */)); | 73 true /* supports_synchronization */)); |
| 74 } | 74 } |
| OLD | NEW |