| Index: chrome/browser/ui/cocoa/notifications/alert_notification_service.mm
|
| diff --git a/chrome/browser/ui/cocoa/notifications/alert_notification_service.mm b/chrome/browser/ui/cocoa/notifications/alert_notification_service.mm
|
| index 45e22f821884676fd880212af456a8a4ca7d3427..d81f2b6ef1ad8514bcabd04e5fd7dbc3d27a5e66 100644
|
| --- a/chrome/browser/ui/cocoa/notifications/alert_notification_service.mm
|
| +++ b/chrome/browser/ui/cocoa/notifications/alert_notification_service.mm
|
| @@ -7,19 +7,29 @@
|
| #import "base/mac/scoped_nsobject.h"
|
| #import "chrome/browser/ui/cocoa/notifications/notification_builder_mac.h"
|
| #include "chrome/browser/ui/cocoa/notifications/notification_constants_mac.h"
|
| +#import "chrome/browser/ui/cocoa/notifications/xpc_transaction_handler.h"
|
|
|
| @class NSUserNotificationCenter;
|
|
|
| -@implementation AlertNotificationService
|
| +@implementation AlertNotificationService {
|
| + XPCTransactionHandler* transactionHandler_;
|
| +}
|
| +
|
| +- (instancetype)initWithTransactionHandler:(XPCTransactionHandler*)handler {
|
| + if ((self = [super init])) {
|
| + transactionHandler_ = handler;
|
| + }
|
| + return self;
|
| +}
|
|
|
| - (void)deliverNotification:(NSDictionary*)notificationData {
|
| base::scoped_nsobject<NotificationBuilder> builder(
|
| [[NotificationBuilder alloc] initWithDictionary:notificationData]);
|
|
|
| NSUserNotification* toast = [builder buildUserNotification];
|
| -
|
| [[NSUserNotificationCenter defaultUserNotificationCenter]
|
| deliverNotification:toast];
|
| + [transactionHandler_ openTransactionIfNeeded];
|
| }
|
|
|
| - (void)closeNotificationWithId:(NSString*)notificationId
|
| @@ -37,6 +47,7 @@
|
| if ([candidateId isEqualToString:notificationId] &&
|
| [profileId isEqualToString:candidateProfileId]) {
|
| [notificationCenter removeDeliveredNotification:candidate];
|
| + [transactionHandler_ closeTransactionIfNeeded];
|
| break;
|
| }
|
| }
|
| @@ -45,6 +56,7 @@
|
| - (void)closeAllNotifications {
|
| [[NSUserNotificationCenter defaultUserNotificationCenter]
|
| removeAllDeliveredNotifications];
|
| + [transactionHandler_ closeTransactionIfNeeded];
|
| }
|
|
|
| @end
|
|
|