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

Unified Diff: chrome/browser/ui/cocoa/notifications/notification_service_delegate.mm

Issue 2419213003: Ensure the xpc transaction is ended (Closed)
Patch Set: review Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/notifications/notification_service_delegate.mm
diff --git a/chrome/browser/ui/cocoa/notifications/notification_service_delegate.mm b/chrome/browser/ui/cocoa/notifications/notification_service_delegate.mm
index 919ad464ef5a5271025968e30b4a83f239a62e01..efd078525cf2d3109fc89e4982aebabea1c65bf1 100644
--- a/chrome/browser/ui/cocoa/notifications/notification_service_delegate.mm
+++ b/chrome/browser/ui/cocoa/notifications/notification_service_delegate.mm
@@ -10,16 +10,20 @@
#import "chrome/browser/ui/cocoa/notifications/alert_notification_service.h"
#import "chrome/browser/ui/cocoa/notifications/notification_delivery.h"
#import "chrome/browser/ui/cocoa/notifications/notification_response_builder_mac.h"
+#import "chrome/browser/ui/cocoa/notifications/xpc_transaction_handler.h"
@class NSUserNotificationCenter;
-@implementation ServiceDelegate
+@implementation ServiceDelegate {
+ base::scoped_nsobject<XPCTransactionHandler> transactionHandler_;
+}
@synthesize connection = connection_;
- (instancetype)init {
if ((self = [super init])) {
[[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate:self];
+ transactionHandler_.reset([[XPCTransactionHandler alloc] init]);
}
return self;
}
@@ -42,7 +46,8 @@
ofReply:NO];
base::scoped_nsobject<AlertNotificationService> object(
- [[AlertNotificationService alloc] init]);
+ [[AlertNotificationService alloc]
+ initWithTransactionHandler:transactionHandler_]);
newConnection.exportedObject = object.get();
newConnection.remoteObjectInterface =
[NSXPCInterface interfaceWithProtocol:@protocol(NotificationReply)];
@@ -66,6 +71,7 @@
NSDictionary* response =
[NotificationResponseBuilder buildDictionary:notification];
[[connection_ remoteObjectProxy] notificationClick:response];
+ [transactionHandler_ closeTransactionIfNeeded];
}
@end

Powered by Google App Engine
This is Rietveld 408576698