| 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 #ifndef CHROME_BROWSER_NOTIFICATIONS_STUB_NOTIFICATION_PLATFORM_BRIDGE_H_ | 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_STUB_NOTIFICATION_PLATFORM_BRIDGE_H_ |
| 6 #define CHROME_BROWSER_NOTIFICATIONS_STUB_NOTIFICATION_PLATFORM_BRIDGE_H_ | 6 #define CHROME_BROWSER_NOTIFICATIONS_STUB_NOTIFICATION_PLATFORM_BRIDGE_H_ |
| 7 | 7 |
| 8 #include <unordered_map> | 8 #include <unordered_map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "chrome/browser/notifications/notification.h" | 12 #include "chrome/browser/notifications/notification.h" |
| 13 #include "chrome/browser/notifications/notification_operation_common.h" |
| 13 #include "chrome/browser/notifications/notification_platform_bridge.h" | 14 #include "chrome/browser/notifications/notification_platform_bridge.h" |
| 14 | 15 |
| 15 // Implementation of NotificationPlatformBridge used for tests. | 16 // Implementation of NotificationPlatformBridge used for tests. |
| 16 class StubNotificationPlatformBridge : public NotificationPlatformBridge { | 17 class StubNotificationPlatformBridge : public NotificationPlatformBridge { |
| 17 public: | 18 public: |
| 18 StubNotificationPlatformBridge(); | 19 StubNotificationPlatformBridge(); |
| 19 ~StubNotificationPlatformBridge() override; | 20 ~StubNotificationPlatformBridge() override; |
| 20 | 21 |
| 21 // Returns the notification being displayed at position |index|. | 22 // Returns the notification being displayed at position |index|. |
| 22 Notification GetNotificationAt(std::string profile_id, size_t index); | 23 Notification GetNotificationAt(std::string profile_id, size_t index); |
| 23 | 24 |
| 24 // NotificationPlatformBridge implementation. | 25 // NotificationPlatformBridge implementation. |
| 25 void Display(const std::string& notification_id, | 26 void Display( |
| 26 const std::string& profile_id, | 27 notification_operation_common::NotificationHandlerType notification_type, |
| 27 bool incognito, | 28 const std::string& notification_id, |
| 28 const Notification& notification) override; | 29 const std::string& profile_id, |
| 30 bool incognito, |
| 31 const Notification& notification) override; |
| 29 void Close(const std::string& profile_id, | 32 void Close(const std::string& profile_id, |
| 30 const std::string& notification_id) override; | 33 const std::string& notification_id) override; |
| 31 bool GetDisplayed(const std::string& profile_id, | 34 bool GetDisplayed(const std::string& profile_id, |
| 32 bool incognito, | 35 bool incognito, |
| 33 std::set<std::string>* notifications) const override; | 36 std::set<std::string>* notifications) const override; |
| 34 bool SupportsNotificationCenter() const override; | 37 bool SupportsNotificationCenter() const override; |
| 35 | 38 |
| 36 private: | 39 private: |
| 37 // Map of profile Ids to list of notifications shown for said profile. | 40 // Map of profile Ids to list of notifications shown for said profile. |
| 38 std::unordered_map<std::string, std::vector<Notification>> notifications_; | 41 std::unordered_map<std::string, std::vector<Notification>> notifications_; |
| 39 | 42 |
| 40 DISALLOW_COPY_AND_ASSIGN(StubNotificationPlatformBridge); | 43 DISALLOW_COPY_AND_ASSIGN(StubNotificationPlatformBridge); |
| 41 }; | 44 }; |
| 42 | 45 |
| 43 #endif // CHROME_BROWSER_NOTIFICATIONS_STUB_NOTIFICATION_PLATFORM_BRIDGE_H_ | 46 #endif // CHROME_BROWSER_NOTIFICATIONS_STUB_NOTIFICATION_PLATFORM_BRIDGE_H_ |
| OLD | NEW |