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 #import <AppKit/AppKit.h> | 5 #import <AppKit/AppKit.h> |
6 | 6 |
7 #import "chrome/browser/ui/cocoa/notifications/notification_service_delegate.h" | 7 #import "chrome/browser/ui/cocoa/notifications/notification_service_delegate.h" |
8 | 8 |
9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
10 #import "chrome/browser/ui/cocoa/notifications/alert_notification_service.h" | 10 #import "chrome/browser/ui/cocoa/notifications/alert_notification_service.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 - (void)dealloc { | 31 - (void)dealloc { |
32 [[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate:nil]; | 32 [[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate:nil]; |
33 [super dealloc]; | 33 [super dealloc]; |
34 } | 34 } |
35 | 35 |
36 - (BOOL)listener:(NSXPCListener*)listener | 36 - (BOOL)listener:(NSXPCListener*)listener |
37 shouldAcceptNewConnection:(NSXPCConnection*)newConnection { | 37 shouldAcceptNewConnection:(NSXPCConnection*)newConnection { |
38 newConnection.exportedInterface = | 38 newConnection.exportedInterface = |
39 [NSXPCInterface interfaceWithProtocol:@protocol(NotificationDelivery)]; | 39 [NSXPCInterface interfaceWithProtocol:@protocol(NotificationDelivery)]; |
40 [newConnection.exportedInterface | 40 [newConnection.exportedInterface |
41 setClasses:[NSSet setWithObjects:[NSDictionary class], [NSImage class], | 41 setClasses:[NSSet setWithObjects:[NSArray class], [NSDictionary class], |
42 [NSNumber class], [NSString class], | 42 [NSImage class], [NSNumber class], |
43 nil] | 43 [NSString class], nil] |
44 forSelector:@selector(deliverNotification:) | 44 forSelector:@selector(deliverNotification:) |
45 argumentIndex:0 | 45 argumentIndex:0 |
46 ofReply:NO]; | 46 ofReply:NO]; |
47 | 47 |
48 base::scoped_nsobject<AlertNotificationService> object( | 48 base::scoped_nsobject<AlertNotificationService> object( |
49 [[AlertNotificationService alloc] | 49 [[AlertNotificationService alloc] |
50 initWithTransactionHandler:transactionHandler_]); | 50 initWithTransactionHandler:transactionHandler_]); |
51 newConnection.exportedObject = object.get(); | 51 newConnection.exportedObject = object.get(); |
52 newConnection.remoteObjectInterface = | 52 newConnection.remoteObjectInterface = |
53 [NSXPCInterface interfaceWithProtocol:@protocol(NotificationReply)]; | 53 [NSXPCInterface interfaceWithProtocol:@protocol(NotificationReply)]; |
(...skipping 14 matching lines...) Expand all Loading... |
68 // _NSUserNotificationCenterDelegatePrivate | 68 // _NSUserNotificationCenterDelegatePrivate |
69 - (void)userNotificationCenter:(NSUserNotificationCenter*)center | 69 - (void)userNotificationCenter:(NSUserNotificationCenter*)center |
70 didDismissAlert:(NSUserNotification*)notification { | 70 didDismissAlert:(NSUserNotification*)notification { |
71 NSDictionary* response = | 71 NSDictionary* response = |
72 [NotificationResponseBuilder buildDictionary:notification]; | 72 [NotificationResponseBuilder buildDictionary:notification]; |
73 [[connection_ remoteObjectProxy] notificationClick:response]; | 73 [[connection_ remoteObjectProxy] notificationClick:response]; |
74 [transactionHandler_ closeTransactionIfNeeded]; | 74 [transactionHandler_ closeTransactionIfNeeded]; |
75 } | 75 } |
76 | 76 |
77 @end | 77 @end |
OLD | NEW |