| 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 StubNotificationPlatformBridge::StubNotificationPlatformBridge() | 7 StubNotificationPlatformBridge::StubNotificationPlatformBridge() |
| 8 : NotificationPlatformBridge() {} | 8 : NotificationPlatformBridge() {} |
| 9 | 9 |
| 10 StubNotificationPlatformBridge::~StubNotificationPlatformBridge() {} | 10 StubNotificationPlatformBridge::~StubNotificationPlatformBridge() {} |
| 11 | 11 |
| 12 Notification StubNotificationPlatformBridge::GetNotificationAt( | 12 Notification StubNotificationPlatformBridge::GetNotificationAt( |
| 13 std::string profile_id, | 13 std::string profile_id, |
| 14 size_t index) { | 14 size_t index) { |
| 15 DCHECK(notifications_.find(profile_id) != notifications_.end()); | 15 DCHECK(notifications_.find(profile_id) != notifications_.end()); |
| 16 DCHECK_GT(notifications_[profile_id].size(), index); | 16 DCHECK_GT(notifications_[profile_id].size(), index); |
| 17 | 17 |
| 18 return notifications_[profile_id][index]; | 18 return notifications_[profile_id][index]; |
| 19 } | 19 } |
| 20 | 20 |
| 21 void StubNotificationPlatformBridge::Display(const std::string& notification_id, | 21 void StubNotificationPlatformBridge::Display( |
| 22 const std::string& profile_id, | 22 NotificationCommon::Type notification_type, |
| 23 bool incognito, | 23 const std::string& notification_id, |
| 24 const Notification& notification) { | 24 const std::string& profile_id, |
| 25 bool incognito, |
| 26 const Notification& notification) { |
| 25 notifications_[profile_id].push_back(notification); | 27 notifications_[profile_id].push_back(notification); |
| 26 } | 28 } |
| 27 | 29 |
| 28 void StubNotificationPlatformBridge::Close(const std::string& profile_id, | 30 void StubNotificationPlatformBridge::Close(const std::string& profile_id, |
| 29 const std::string& notification_id) { | 31 const std::string& notification_id) { |
| 30 if (notifications_.find(profile_id) == notifications_.end()) | 32 if (notifications_.find(profile_id) == notifications_.end()) |
| 31 return; | 33 return; |
| 32 std::vector<Notification> profile_notifications = notifications_[profile_id]; | 34 std::vector<Notification> profile_notifications = notifications_[profile_id]; |
| 33 for (auto iter = profile_notifications.begin(); | 35 for (auto iter = profile_notifications.begin(); |
| 34 iter != profile_notifications.end(); ++iter) { | 36 iter != profile_notifications.end(); ++iter) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 51 const std::vector<Notification>& profile_notifications = | 53 const std::vector<Notification>& profile_notifications = |
| 52 notifications_.at(profile_id); | 54 notifications_.at(profile_id); |
| 53 for (auto notification : profile_notifications) | 55 for (auto notification : profile_notifications) |
| 54 notifications->insert(notification.id()); | 56 notifications->insert(notification.id()); |
| 55 return true; | 57 return true; |
| 56 } | 58 } |
| 57 | 59 |
| 58 bool StubNotificationPlatformBridge::SupportsNotificationCenter() const { | 60 bool StubNotificationPlatformBridge::SupportsNotificationCenter() const { |
| 59 return false; | 61 return false; |
| 60 } | 62 } |
| OLD | NEW |