| 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 "chrome/browser/ui/cocoa/notifications/notification_service_delegate.h" |
| 6 |
| 5 #import <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.h> |
| 6 | 8 |
| 7 #import "chrome/browser/ui/cocoa/notifications/notification_service_delegate.h" | |
| 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" |
| 11 #import "chrome/browser/ui/cocoa/notifications/notification_delivery.h" | 11 #import "chrome/browser/ui/cocoa/notifications/notification_delivery.h" |
| 12 #import "chrome/browser/ui/cocoa/notifications/notification_response_builder_mac
.h" | 12 #import "chrome/browser/ui/cocoa/notifications/notification_response_builder_mac
.h" |
| 13 #import "chrome/browser/ui/cocoa/notifications/xpc_transaction_handler.h" | 13 #import "chrome/browser/ui/cocoa/notifications/xpc_transaction_handler.h" |
| 14 | 14 |
| 15 @class NSUserNotificationCenter; | 15 @class NSUserNotificationCenter; |
| 16 | 16 |
| 17 @implementation ServiceDelegate { | 17 @implementation ServiceDelegate { |
| 18 base::scoped_nsobject<XPCTransactionHandler> transactionHandler_; | 18 base::scoped_nsobject<XPCTransactionHandler> transactionHandler_; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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)]; |
| 54 connection_ = newConnection; | 54 connection_ = newConnection; |
| 55 [newConnection resume]; | 55 [newConnection resume]; |
| 56 | 56 |
| 57 return YES; | 57 return YES; |
| 58 } | 58 } |
| 59 | 59 |
| 60 // NSUserNotification center delegate | 60 // NSUserNotificationCenterDelegate: |
| 61 - (void)userNotificationCenter:(NSUserNotificationCenter*)center | 61 - (void)userNotificationCenter:(NSUserNotificationCenter*)center |
| 62 didActivateNotification:(NSUserNotification*)notification { | 62 didActivateNotification:(NSUserNotification*)notification { |
| 63 NSDictionary* response = | 63 NSDictionary* response = |
| 64 [NotificationResponseBuilder buildDictionary:notification]; | 64 [NotificationResponseBuilder buildDictionary:notification]; |
| 65 [[connection_ remoteObjectProxy] notificationClick:response]; | 65 [[connection_ remoteObjectProxy] notificationClick:response]; |
| 66 } | 66 } |
| 67 | 67 |
| 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 |