Index: chrome/browser/notifications/stub_notification_platform_bridge.cc |
diff --git a/chrome/browser/notifications/stub_notification_platform_bridge.cc b/chrome/browser/notifications/stub_notification_platform_bridge.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..731b4d7b6a4f6fb287ad62ff478b199e12369946 |
--- /dev/null |
+++ b/chrome/browser/notifications/stub_notification_platform_bridge.cc |
@@ -0,0 +1,46 @@ |
+// 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.
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/notifications/stub_notification_platform_bridge.h" |
+ |
+StubNotificationPlatformBridge::StubNotificationPlatformBridge() |
+ : NotificationPlatformBridge() {} |
+ |
+StubNotificationPlatformBridge::~StubNotificationPlatformBridge() {} |
+ |
+Notification StubNotificationPlatformBridge::GetNotificationAt(size_t index) { |
+ DCHECK_GT(notifications_.size(), index); |
+ return notifications_[index]; |
+} |
+ |
+void StubNotificationPlatformBridge::Display(const std::string& notification_id, |
+ const std::string& profile_id, |
+ bool incognito, |
+ const Notification& notification) { |
+ notifications_.push_back(notification); |
+} |
+ |
+void StubNotificationPlatformBridge::Close(const std::string& profile_id, |
+ const std::string& notification_id) { |
+ for (auto iter = notifications_.begin(); iter != notifications_.end(); |
+ ++iter) { |
+ if (iter->id() == notification_id) { |
+ notifications_.erase(iter); |
+ break; |
+ } |
+ } |
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
|
+} |
+ |
+bool StubNotificationPlatformBridge::GetDisplayed( |
+ const std::string& profile_id, |
+ bool incognito, |
+ std::set<std::string>* notifications) const { |
+ for (auto notification : notifications_) |
+ notifications->insert(notification.id()); |
+ return true; |
+} |
+ |
+bool StubNotificationPlatformBridge::SupportsNotificationCenter() const { |
+ return false; |
+} |