Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5688)

Unified Diff: chrome/browser/notifications/stub_notification_platform_bridge.h

Issue 1895473002: PlatformNotificationService layering cleanup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@display_manager2
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/notifications/stub_notification_platform_bridge.h
diff --git a/chrome/browser/notifications/stub_notification_platform_bridge.h b/chrome/browser/notifications/stub_notification_platform_bridge.h
new file mode 100644
index 0000000000000000000000000000000000000000..368c502f905b5ef6f8e6362ce76c561553ec8acf
--- /dev/null
+++ b/chrome/browser/notifications/stub_notification_platform_bridge.h
@@ -0,0 +1,43 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_NOTIFICATIONS_STUB_NOTIFICATION_PLATFORM_BRIDGE_H_
+#define CHROME_BROWSER_NOTIFICATIONS_STUB_NOTIFICATION_PLATFORM_BRIDGE_H_
+
+#include <unordered_map>
+#include <vector>
+
+#include "base/macros.h"
+#include "chrome/browser/notifications/notification.h"
+#include "chrome/browser/notifications/notification_platform_bridge.h"
+
+// Implementation of NotificationPlatformBridge used for tests.
+class StubNotificationPlatformBridge : public NotificationPlatformBridge {
+ public:
+ StubNotificationPlatformBridge();
+ ~StubNotificationPlatformBridge() override;
+
+ // Returns the notification being displayed at position |index|.
+ Notification GetNotificationAt(std::string profile_id, size_t index);
+
+ // NotificationPlatformBridge implementation.
+ void Display(const std::string& notification_id,
+ const std::string& profile_id,
+ bool incognito,
+ const Notification& notification) override;
+ void Close(const std::string& profile_id,
+ const std::string& notification_id) override;
+ bool GetDisplayed(const std::string& profile_id,
+ bool incognito,
+ std::set<std::string>* notifications) const override;
+ bool SupportsNotificationCenter() const override;
+
+ private:
+ // Map of profile Ids to list of notifications shown for said profile.
+ std::unordered_map<std::string, std::vector<Notification>> notifications_;
+
+ DISALLOW_COPY_AND_ASSIGN(StubNotificationPlatformBridge);
+};
+
+#endif // CHROME_BROWSER_NOTIFICATIONS_STUB_NOTIFICATION_PLATFORM_BRIDGE_H_

Powered by Google App Engine
This is Rietveld 408576698