Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Side by Side Diff: chrome/browser/ui/cocoa/notifications/notification_service_delegate.mm

Issue 2709213005: [Mac] Add XPC alerts to GetDisplayedNotifications (Closed)
Patch Set: review Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/notifications/notification_delivery.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/ui/cocoa/notifications/notification_service_delegate.h" 5 #import "chrome/browser/ui/cocoa/notifications/notification_service_delegate.h"
6 6
7 #import <AppKit/AppKit.h> 7 #import <AppKit/AppKit.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
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:[NSData class], [NSDictionary class], 41 setClasses:[NSSet setWithObjects:[NSArray class], [NSData class],
42 [NSImage class], [NSNumber class], 42 [NSDictionary class], [NSImage class],
43 [NSString class], nil] 43 [NSNumber class], [NSString class],
44 nil]
44 forSelector:@selector(deliverNotification:) 45 forSelector:@selector(deliverNotification:)
45 argumentIndex:0 46 argumentIndex:0
46 ofReply:NO]; 47 ofReply:NO];
47 48
48 base::scoped_nsobject<AlertNotificationService> object( 49 base::scoped_nsobject<AlertNotificationService> object(
49 [[AlertNotificationService alloc] 50 [[AlertNotificationService alloc]
50 initWithTransactionHandler:transactionHandler_]); 51 initWithTransactionHandler:transactionHandler_]);
51 newConnection.exportedObject = object.get(); 52 newConnection.exportedObject = object.get();
52 newConnection.remoteObjectInterface = 53 newConnection.remoteObjectInterface =
53 [NSXPCInterface interfaceWithProtocol:@protocol(NotificationReply)]; 54 [NSXPCInterface interfaceWithProtocol:@protocol(NotificationReply)];
(...skipping 14 matching lines...) Expand all
68 // _NSUserNotificationCenterDelegatePrivate: 69 // _NSUserNotificationCenterDelegatePrivate:
69 - (void)userNotificationCenter:(NSUserNotificationCenter*)center 70 - (void)userNotificationCenter:(NSUserNotificationCenter*)center
70 didDismissAlert:(NSUserNotification*)notification { 71 didDismissAlert:(NSUserNotification*)notification {
71 NSDictionary* response = 72 NSDictionary* response =
72 [NotificationResponseBuilder buildDictionary:notification]; 73 [NotificationResponseBuilder buildDictionary:notification];
73 [[connection_ remoteObjectProxy] notificationClick:response]; 74 [[connection_ remoteObjectProxy] notificationClick:response];
74 [transactionHandler_ closeTransactionIfNeeded]; 75 [transactionHandler_ closeTransactionIfNeeded];
75 } 76 }
76 77
77 @end 78 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/notifications/notification_delivery.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698