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

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

Issue 2709213005: [Mac] Add XPC alerts to GetDisplayedNotifications (Closed)
Patch Set: review Created 3 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 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_NOTIFICATION_PLATFORM_BRIDGE_H_ 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_H_ 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/callback_forward.h" 12 #include "base/callback_forward.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "chrome/browser/notifications/displayed_notifications_dispatch_callback .h"
14 #include "chrome/browser/notifications/notification_common.h" 15 #include "chrome/browser/notifications/notification_common.h"
15 16
16 class Notification; 17 class Notification;
17 18
18 // Provides the low-level interface that enables notifications to be displayed 19 // Provides the low-level interface that enables notifications to be displayed
19 // and interacted with on the user's screen, orthogonal of whether this 20 // and interacted with on the user's screen, orthogonal of whether this
20 // functionality is provided by the browser or by the operating system. 21 // functionality is provided by the browser or by the operating system.
21 // TODO(miguelg): Add support for click and close events. 22 // TODO(miguelg): Add support for click and close events.
22 class NotificationPlatformBridge { 23 class NotificationPlatformBridge {
23 public: 24 public:
24 using DisplayedNotificationsCallback =
25 base::Callback<void(std::unique_ptr<std::set<std::string>>,
26 bool /* supports_synchronization */)>;
27
28 static NotificationPlatformBridge* Create(); 25 static NotificationPlatformBridge* Create();
29 26
30 virtual ~NotificationPlatformBridge() {} 27 virtual ~NotificationPlatformBridge() {}
31 28
32 // Shows a toast on screen using the data passed in |notification|. 29 // Shows a toast on screen using the data passed in |notification|.
33 virtual void Display(NotificationCommon::Type notification_type, 30 virtual void Display(NotificationCommon::Type notification_type,
34 const std::string& notification_id, 31 const std::string& notification_id,
35 const std::string& profile_id, 32 const std::string& profile_id,
36 bool is_incognito, 33 bool is_incognito,
37 const Notification& notification) = 0; 34 const Notification& notification) = 0;
38 35
39 // Closes a nofication with |notification_id| and |profile_id| if being 36 // Closes a nofication with |notification_id| and |profile_id| if being
40 // displayed. 37 // displayed.
41 virtual void Close(const std::string& profile_id, 38 virtual void Close(const std::string& profile_id,
42 const std::string& notification_id) = 0; 39 const std::string& notification_id) = 0;
43 40
44 // Writes the ids of all currently displaying notifications and posts 41 // Writes the ids of all currently displaying notifications and posts
45 // |callback| with the result. 42 // |callback| with the result.
46 virtual void GetDisplayed( 43 virtual void GetDisplayed(
47 const std::string& profile_id, 44 const std::string& profile_id,
48 bool incognito, 45 bool incognito,
49 const DisplayedNotificationsCallback& callback) const = 0; 46 const GetDisplayedNotificationsCallback& callback) const = 0;
50 47
51 protected: 48 protected:
52 NotificationPlatformBridge() {} 49 NotificationPlatformBridge() {}
53 50
54 private: 51 private:
55 DISALLOW_COPY_AND_ASSIGN(NotificationPlatformBridge); 52 DISALLOW_COPY_AND_ASSIGN(NotificationPlatformBridge);
56 }; 53 };
57 54
58 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_H_ 55 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698