OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_DISPLAY_SERVICE_PROXY_H_ | |
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_DISPLAY_SERVICE_PROXY_H_ | |
7 | |
8 #include <queue> | |
Peter Beverloo
2017/04/19 13:26:41
#include <memory>
#include "base/callback.h"
class
Tom (Use chromium acct)
2017/04/20 01:43:47
Done.
| |
9 | |
10 #include "chrome/browser/notifications/notification_display_service.h" | |
11 | |
12 class MessageCenterDisplayService; | |
13 class NativeNotificationDisplayService; | |
14 | |
15 class NotificationDisplayServiceProxy : public NotificationDisplayService { | |
16 public: | |
17 explicit NotificationDisplayServiceProxy(Profile* profile); | |
18 | |
19 ~NotificationDisplayServiceProxy() override; | |
20 | |
21 // NotificationDisplayService: | |
22 void Display(NotificationCommon::Type notification_type, | |
23 const std::string& notification_id, | |
24 const Notification& notification) override; | |
25 void Close(NotificationCommon::Type notification_type, | |
26 const std::string& notification_id) override; | |
27 void GetDisplayed(const DisplayedNotificationsCallback& callback) override; | |
28 | |
29 NativeNotificationDisplayService* native_notification_display_service() { | |
30 return native_notification_display_service_.get(); | |
31 } | |
32 | |
33 private: | |
34 NotificationDisplayService* GetNotificationDisplayService() const; | |
35 | |
36 void OnNotificationPlatformBridgeInitialized(bool success); | |
37 | |
38 // Takes ownership of |action|. | |
39 void RunAction(base::Callback<void(NotificationDisplayService*)> action); | |
40 | |
41 Profile* profile_; | |
42 | |
43 std::queue<base::Callback<void(NotificationDisplayService*)>> actions_; | |
44 | |
45 std::unique_ptr<NativeNotificationDisplayService> | |
46 native_notification_display_service_; | |
47 | |
48 std::unique_ptr<MessageCenterDisplayService> message_center_display_service_; | |
49 | |
50 DISALLOW_COPY_AND_ASSIGN(NotificationDisplayServiceProxy); | |
51 }; | |
52 | |
53 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_DISPLAY_SERVICE_PROXY_H_ | |
OLD | NEW |