| 
									
										
										
										
											2015-12-24 21:55:18 +08:00
										 |  |  | // Copyright (c) 2015 GitHub, Inc.
 | 
					
						
							|  |  |  | // Use of this source code is governed by the MIT license that can be
 | 
					
						
							|  |  |  | // found in the LICENSE file.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-19 13:56:58 -07:00
										 |  |  | #ifndef SHELL_BROWSER_NOTIFICATIONS_MAC_COCOA_NOTIFICATION_H_
 | 
					
						
							|  |  |  | #define SHELL_BROWSER_NOTIFICATIONS_MAC_COCOA_NOTIFICATION_H_
 | 
					
						
							| 
									
										
										
										
											2015-12-24 21:55:18 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | #import <Foundation/Foundation.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-15 21:07:27 -08:00
										 |  |  | #include <map>
 | 
					
						
							| 
									
										
										
										
											2017-05-18 15:06:57 -07:00
										 |  |  | #include <string>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-24 21:55:18 +08:00
										 |  |  | #include "base/mac/scoped_nsobject.h"
 | 
					
						
							| 
									
										
										
										
											2019-06-19 13:46:59 -07:00
										 |  |  | #include "shell/browser/notifications/notification.h"
 | 
					
						
							| 
									
										
										
										
											2015-12-24 21:55:18 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-19 14:23:04 -07:00
										 |  |  | namespace electron { | 
					
						
							| 
									
										
										
										
											2015-12-24 21:55:18 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-24 22:06:41 +08:00
										 |  |  | class CocoaNotification : public Notification { | 
					
						
							| 
									
										
										
										
											2015-12-24 21:55:18 +08:00
										 |  |  |  public: | 
					
						
							| 
									
										
										
										
											2015-12-25 10:16:07 +08:00
										 |  |  |   CocoaNotification(NotificationDelegate* delegate, | 
					
						
							|  |  |  |                     NotificationPresenter* presenter); | 
					
						
							| 
									
										
										
										
											2018-04-17 16:03:51 -07:00
										 |  |  |   ~CocoaNotification() override; | 
					
						
							| 
									
										
										
										
											2015-12-24 21:55:18 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-25 11:05:48 +08:00
										 |  |  |   // Notification:
 | 
					
						
							| 
									
										
										
										
											2017-06-24 21:03:27 +10:00
										 |  |  |   void Show(const NotificationOptions& options) override; | 
					
						
							| 
									
										
										
										
											2015-12-25 10:16:07 +08:00
										 |  |  |   void Dismiss() override; | 
					
						
							| 
									
										
										
										
											2015-12-24 21:55:18 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-15 16:14:13 +09:00
										 |  |  |   void NotificationDisplayed(); | 
					
						
							| 
									
										
										
										
											2017-05-31 16:17:29 +09:00
										 |  |  |   void NotificationReplied(const std::string& reply); | 
					
						
							| 
									
										
										
										
											2018-01-16 19:07:54 -08:00
										 |  |  |   void NotificationActivated(); | 
					
						
							| 
									
										
										
										
											2019-02-25 18:21:57 +01:00
										 |  |  |   void NotificationActivated(NSUserNotificationAction* action); | 
					
						
							| 
									
										
										
										
											2018-08-13 13:09:25 +02:00
										 |  |  |   void NotificationDismissed(); | 
					
						
							| 
									
										
										
										
											2015-12-24 21:55:18 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-25 10:16:07 +08:00
										 |  |  |   NSUserNotification* notification() const { return notification_; } | 
					
						
							| 
									
										
										
										
											2015-12-24 21:55:18 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-25 10:16:07 +08:00
										 |  |  |  private: | 
					
						
							| 
									
										
										
										
											2017-12-12 16:09:11 -08:00
										 |  |  |   void LogAction(const char* action); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-24 21:55:18 +08:00
										 |  |  |   base::scoped_nsobject<NSUserNotification> notification_; | 
					
						
							| 
									
										
										
										
											2018-01-15 20:50:03 -08:00
										 |  |  |   std::map<std::string, unsigned> additional_action_indices_; | 
					
						
							|  |  |  |   unsigned action_index_; | 
					
						
							| 
									
										
										
										
											2015-12-24 21:55:18 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   DISALLOW_COPY_AND_ASSIGN(CocoaNotification); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-19 14:23:04 -07:00
										 |  |  | }  // namespace electron
 | 
					
						
							| 
									
										
										
										
											2015-12-24 21:55:18 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-19 13:56:58 -07:00
										 |  |  | #endif  // SHELL_BROWSER_NOTIFICATIONS_MAC_COCOA_NOTIFICATION_H_
 |