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_NATIVE_NOTIFICATION_DISPLAY_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NATIVE_NOTIFICATION_DISPLAY_SERVICE_H_ |
6 #define CHROME_BROWSER_NOTIFICATIONS_NATIVE_NOTIFICATION_DISPLAY_SERVICE_H_ | 6 #define CHROME_BROWSER_NOTIFICATIONS_NATIVE_NOTIFICATION_DISPLAY_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 17 matching lines...) Expand all Loading... |
28 NotificationPlatformBridge* notification_bridge); | 28 NotificationPlatformBridge* notification_bridge); |
29 ~NativeNotificationDisplayService() override; | 29 ~NativeNotificationDisplayService() override; |
30 | 30 |
31 // NotificationDisplayService implementation. | 31 // NotificationDisplayService implementation. |
32 void Display(NotificationCommon::Type notification_type, | 32 void Display(NotificationCommon::Type notification_type, |
33 const std::string& notification_id, | 33 const std::string& notification_id, |
34 const Notification& notification) override; | 34 const Notification& notification) override; |
35 void Close(NotificationCommon::Type notification_type, | 35 void Close(NotificationCommon::Type notification_type, |
36 const std::string& notification_id) override; | 36 const std::string& notification_id) override; |
37 bool GetDisplayed(std::set<std::string>* notifications) const override; | 37 bool GetDisplayed(std::set<std::string>* notifications) const override; |
38 bool SupportsNotificationCenter() const override; | |
39 | 38 |
40 // Used by the notification bridge to propagate back events (click, close...). | 39 // Used by the notification bridge to propagate back events (click, close...). |
41 void ProcessNotificationOperation(NotificationCommon::Operation operation, | 40 void ProcessNotificationOperation(NotificationCommon::Operation operation, |
42 NotificationCommon::Type notification_type, | 41 NotificationCommon::Type notification_type, |
43 const std::string& origin, | 42 const std::string& origin, |
44 const std::string& notification_id, | 43 const std::string& notification_id, |
45 int action_index); | 44 int action_index); |
46 | 45 |
47 // Registers an implementation object to handle notification operations | 46 // Registers an implementation object to handle notification operations |
48 // for |notification_type|. | 47 // for |notification_type|. |
49 void AddNotificationHandler(NotificationCommon::Type notification_type, | 48 void AddNotificationHandler(NotificationCommon::Type notification_type, |
50 std::unique_ptr<NotificationHandler> handler); | 49 std::unique_ptr<NotificationHandler> handler); |
51 | 50 |
52 // Removes an implementation added via |AddNotificationHandler|. | 51 // Removes an implementation added via |AddNotificationHandler|. |
53 void RemoveNotificationHandler(NotificationCommon::Type notification_type); | 52 void RemoveNotificationHandler(NotificationCommon::Type notification_type); |
54 | 53 |
55 private: | 54 private: |
56 NotificationHandler* GetNotificationHandler( | 55 NotificationHandler* GetNotificationHandler( |
57 NotificationCommon::Type notification_type); | 56 NotificationCommon::Type notification_type); |
58 | 57 |
59 Profile* profile_; | 58 Profile* profile_; |
60 NotificationPlatformBridge* notification_bridge_; | 59 NotificationPlatformBridge* notification_bridge_; |
61 std::map<NotificationCommon::Type, std::unique_ptr<NotificationHandler>> | 60 std::map<NotificationCommon::Type, std::unique_ptr<NotificationHandler>> |
62 notification_handlers_; | 61 notification_handlers_; |
63 | 62 |
64 DISALLOW_COPY_AND_ASSIGN(NativeNotificationDisplayService); | 63 DISALLOW_COPY_AND_ASSIGN(NativeNotificationDisplayService); |
65 }; | 64 }; |
66 | 65 |
67 #endif // CHROME_BROWSER_NOTIFICATIONS_NATIVE_NOTIFICATION_DISPLAY_SERVICE_H_ | 66 #endif // CHROME_BROWSER_NOTIFICATIONS_NATIVE_NOTIFICATION_DISPLAY_SERVICE_H_ |
OLD | NEW |