OLD | NEW |
---|---|
1 // Copyright 2015 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_MAC_H_ | 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_WIN_H_ |
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_MAC_H_ | 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_WIN_H_ |
7 | |
8 #include <windows.ui.notifications.h> | |
7 | 9 |
8 #include <set> | 10 #include <set> |
9 #include <string> | 11 #include <string> |
10 | 12 |
11 #include "base/mac/scoped_nsobject.h" | |
12 #include "base/macros.h" | |
13 #include "chrome/browser/notifications/notification_platform_bridge.h" | 13 #include "chrome/browser/notifications/notification_platform_bridge.h" |
14 | 14 |
15 namespace winui = ABI::Windows::UI; | |
16 | |
15 class Notification; | 17 class Notification; |
16 @class NotificationCenterDelegate; | |
17 @class NSUserNotificationCenter; | |
18 class PrefService; | |
19 | 18 |
20 // This class is an implementation of NotificationPlatformBridge that will | 19 // This class is an implementation of NotificationPlatformBridge that will |
21 // send platform notifications to the the MacOSX notification center. | 20 // send platform notifications to the Windows Notification Area. |
22 class NotificationPlatformBridgeMac : public NotificationPlatformBridge { | 21 class NotificationPlatformBridgeWin : public NotificationPlatformBridge { |
23 public: | 22 public: |
24 explicit NotificationPlatformBridgeMac( | 23 NotificationPlatformBridgeWin(); |
25 NSUserNotificationCenter* notification_center); | 24 ~NotificationPlatformBridgeWin() override; |
26 ~NotificationPlatformBridgeMac() override; | |
27 | 25 |
28 // NotificationPlatformBridge implementation. | 26 // NotificationPlatformBridge implementation. |
29 void Display(const std::string& notification_id, | 27 void Display(const std::string& notification_id, |
30 const std::string& profile_id, | 28 const std::string& profile_id, |
31 bool incognito, | 29 bool incognito, |
32 const Notification& notification) override; | 30 const Notification& notification) override; |
33 void Close(const std::string& profile_id, | 31 void Close(const std::string& profile_id, |
34 const std::string& notification_id) override; | 32 const std::string& notification_id) override; |
35 bool GetDisplayed(const std::string& profile_id, | 33 bool GetDisplayed(const std::string& profile_id, |
36 bool incognito, | 34 bool incognito, |
37 std::set<std::string>* notifications) const override; | 35 std::set<std::string>* notifications) const override; |
38 bool SupportsNotificationCenter() const override; | 36 bool SupportsNotificationCenter() const override; |
39 | 37 |
38 HRESULT OnActivate(winui::Notifications::IToastNotification* notification, | |
chrisha
2016/06/02 21:14:10
No comment for this function?
huangs
2016/06/14 01:12:35
Added. This is callback when notification gets cl
| |
39 IInspectable* inspectable); | |
40 | |
40 private: | 41 private: |
41 // Cocoa class that receives callbacks from the NSUserNotificationCenter. | 42 DISALLOW_COPY_AND_ASSIGN(NotificationPlatformBridgeWin); |
42 base::scoped_nsobject<NotificationCenterDelegate> delegate_; | |
43 | |
44 // The notification center to use, this can be overriden in tests | |
45 NSUserNotificationCenter* notification_center_; | |
46 | |
47 DISALLOW_COPY_AND_ASSIGN(NotificationPlatformBridgeMac); | |
48 }; | 43 }; |
49 | 44 |
50 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_MAC_H_ | 45 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_WIN_H_ |
OLD | NEW |