Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
|
Peter Beverloo
2016/04/25 13:37:29
2014??
Miguel Garcia
2016/04/25 17:19:59
Done.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/notifications/stub_notification_platform_bridge.h" | |
| 6 | |
| 7 StubNotificationPlatformBridge::StubNotificationPlatformBridge() | |
| 8 : NotificationPlatformBridge() {} | |
| 9 | |
| 10 StubNotificationPlatformBridge::~StubNotificationPlatformBridge() {} | |
| 11 | |
| 12 Notification StubNotificationPlatformBridge::GetNotificationAt(size_t index) { | |
| 13 DCHECK_GT(notifications_.size(), index); | |
| 14 return notifications_[index]; | |
| 15 } | |
| 16 | |
| 17 void StubNotificationPlatformBridge::Display(const std::string& notification_id, | |
| 18 const std::string& profile_id, | |
| 19 bool incognito, | |
| 20 const Notification& notification) { | |
| 21 notifications_.push_back(notification); | |
| 22 } | |
| 23 | |
| 24 void StubNotificationPlatformBridge::Close(const std::string& profile_id, | |
| 25 const std::string& notification_id) { | |
| 26 for (auto iter = notifications_.begin(); iter != notifications_.end(); | |
| 27 ++iter) { | |
| 28 if (iter->id() == notification_id) { | |
| 29 notifications_.erase(iter); | |
| 30 break; | |
| 31 } | |
| 32 } | |
|
Peter Beverloo
2016/04/25 13:37:29
This should probably care about the |profile_id|?
Miguel Garcia
2016/04/25 17:19:59
Moved to a map of vectors
Happy to discuss if the
| |
| 33 } | |
| 34 | |
| 35 bool StubNotificationPlatformBridge::GetDisplayed( | |
| 36 const std::string& profile_id, | |
| 37 bool incognito, | |
| 38 std::set<std::string>* notifications) const { | |
| 39 for (auto notification : notifications_) | |
| 40 notifications->insert(notification.id()); | |
| 41 return true; | |
| 42 } | |
| 43 | |
| 44 bool StubNotificationPlatformBridge::SupportsNotificationCenter() const { | |
| 45 return false; | |
| 46 } | |
| OLD | NEW |