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

Side by Side Diff: chrome/browser/notifications/stub_notification_platform_bridge.h

Issue 2749453002: Make GetDisplayedNotifications asynchronous. (Closed)
Patch Set: review Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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_common.h" 13 #include "chrome/browser/notifications/notification_common.h"
14 #include "chrome/browser/notifications/notification_platform_bridge.h" 14 #include "chrome/browser/notifications/notification_platform_bridge.h"
15 15
16 // Implementation of NotificationPlatformBridge used for tests. 16 // Implementation of NotificationPlatformBridge used for tests.
17 class StubNotificationPlatformBridge : public NotificationPlatformBridge { 17 class StubNotificationPlatformBridge : public NotificationPlatformBridge {
18 public: 18 public:
19 StubNotificationPlatformBridge(); 19 StubNotificationPlatformBridge();
20 ~StubNotificationPlatformBridge() override; 20 ~StubNotificationPlatformBridge() override;
21 21
22 // Returns the notification being displayed at position |index|. 22 // Returns the notification being displayed at position |index|.
23 Notification GetNotificationAt(std::string profile_id, size_t index); 23 Notification GetNotificationAt(std::string profile_id, size_t index);
24 24
25 // Returns the number of notifications displayed.
26 size_t GetNotificationCount();
27
25 // NotificationPlatformBridge implementation. 28 // NotificationPlatformBridge implementation.
26 void Display(NotificationCommon::Type notification_type, 29 void Display(NotificationCommon::Type notification_type,
27 const std::string& notification_id, 30 const std::string& notification_id,
28 const std::string& profile_id, 31 const std::string& profile_id,
29 bool incognito, 32 bool incognito,
30 const Notification& notification) override; 33 const Notification& notification) override;
31 void Close(const std::string& profile_id, 34 void Close(const std::string& profile_id,
32 const std::string& notification_id) override; 35 const std::string& notification_id) override;
33 bool GetDisplayed(const std::string& profile_id, 36 void GetDisplayed(
34 bool incognito, 37 const std::string& profile_id,
35 std::set<std::string>* notifications) const override; 38 bool incognito,
39 const DisplayedNotificationsCallback& callback) const override;
36 40
37 private: 41 private:
38 // Map of profile Ids to list of notifications shown for said profile. 42 // Map of profile Ids to list of notifications shown for said profile.
39 std::unordered_map<std::string, std::vector<Notification>> notifications_; 43 std::unordered_map<std::string, std::vector<Notification>> notifications_;
40 44
41 DISALLOW_COPY_AND_ASSIGN(StubNotificationPlatformBridge); 45 DISALLOW_COPY_AND_ASSIGN(StubNotificationPlatformBridge);
42 }; 46 };
43 47
44 #endif // CHROME_BROWSER_NOTIFICATIONS_STUB_NOTIFICATION_PLATFORM_BRIDGE_H_ 48 #endif // CHROME_BROWSER_NOTIFICATIONS_STUB_NOTIFICATION_PLATFORM_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698