| 
									
										
										
										
											2018-10-17 20:01:11 +02: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.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "atom/browser/notifications/win/notification_presenter_win7.h"
 | 
					
						
							| 
									
										
										
										
											2017-05-18 15:06:57 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <string>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-17 20:01:11 +02:00
										 |  |  | #include "atom/browser/notifications/win/win32_notification.h"
 | 
					
						
							| 
									
										
										
										
											2017-03-15 13:56:06 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-17 20:01:11 +02:00
										 |  |  | namespace atom { | 
					
						
							| 
									
										
										
										
											2017-03-15 13:56:06 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-17 20:01:11 +02:00
										 |  |  | atom::Notification* NotificationPresenterWin7::CreateNotificationObject( | 
					
						
							| 
									
										
										
										
											2017-04-03 12:11:39 +02:00
										 |  |  |     NotificationDelegate* delegate) { | 
					
						
							| 
									
										
										
										
											2018-04-17 21:56:12 -04:00
										 |  |  |   return new Win32Notification(delegate, this); | 
					
						
							| 
									
										
										
										
											2017-03-15 13:56:06 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-03 10:38:21 +02:00
										 |  |  | Win32Notification* NotificationPresenterWin7::GetNotificationObjectByRef( | 
					
						
							| 
									
										
										
										
											2017-04-03 12:11:39 +02:00
										 |  |  |     const DesktopNotificationController::Notification& ref) { | 
					
						
							| 
									
										
										
										
											2018-06-21 16:45:45 -07:00
										 |  |  |   for (auto* n : this->notifications()) { | 
					
						
							|  |  |  |     auto* w32n = static_cast<Win32Notification*>(n); | 
					
						
							| 
									
										
										
										
											2018-04-17 21:56:12 -04:00
										 |  |  |     if (w32n->GetRef() == ref) | 
					
						
							|  |  |  |       return w32n; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2017-03-15 13:56:06 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-17 21:56:12 -04:00
										 |  |  |   return nullptr; | 
					
						
							| 
									
										
										
										
											2017-03-15 13:56:06 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-03 10:38:21 +02:00
										 |  |  | Win32Notification* NotificationPresenterWin7::GetNotificationObjectByTag( | 
					
						
							| 
									
										
										
										
											2017-04-03 12:11:39 +02:00
										 |  |  |     const std::string& tag) { | 
					
						
							| 
									
										
										
										
											2018-06-21 16:45:45 -07:00
										 |  |  |   for (auto* n : this->notifications()) { | 
					
						
							|  |  |  |     auto* w32n = static_cast<Win32Notification*>(n); | 
					
						
							| 
									
										
										
										
											2018-04-17 21:56:12 -04:00
										 |  |  |     if (w32n->GetTag() == tag) | 
					
						
							|  |  |  |       return w32n; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2017-03-15 13:56:06 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-17 21:56:12 -04:00
										 |  |  |   return nullptr; | 
					
						
							| 
									
										
										
										
											2017-03-15 13:56:06 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-03 10:38:21 +02:00
										 |  |  | void NotificationPresenterWin7::OnNotificationClicked( | 
					
						
							| 
									
										
										
										
											2018-10-17 20:01:11 +02:00
										 |  |  |     const Notification& notification) { | 
					
						
							| 
									
										
										
										
											2018-06-21 16:45:45 -07:00
										 |  |  |   auto* n = GetNotificationObjectByRef(notification); | 
					
						
							| 
									
										
										
										
											2018-04-17 21:56:12 -04:00
										 |  |  |   if (n) | 
					
						
							|  |  |  |     n->NotificationClicked(); | 
					
						
							| 
									
										
										
										
											2017-03-15 13:56:06 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-03 10:38:21 +02:00
										 |  |  | void NotificationPresenterWin7::OnNotificationDismissed( | 
					
						
							| 
									
										
										
										
											2018-10-17 20:01:11 +02:00
										 |  |  |     const Notification& notification) { | 
					
						
							| 
									
										
										
										
											2018-06-21 16:45:45 -07:00
										 |  |  |   auto* n = GetNotificationObjectByRef(notification); | 
					
						
							| 
									
										
										
										
											2018-04-17 21:56:12 -04:00
										 |  |  |   if (n) | 
					
						
							|  |  |  |     n->NotificationDismissed(); | 
					
						
							| 
									
										
										
										
											2017-03-15 13:56:06 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-17 20:01:11 +02:00
										 |  |  | }  // namespace atom
 |