| 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 #import <Foundation/Foundation.h> | 6 #import <Foundation/Foundation.h> |
| 7 | 7 |
| 8 #import "chrome/browser/ui/cocoa/notifications/xpc_transaction_handler.h" | 8 #import "chrome/browser/ui/cocoa/notifications/xpc_transaction_handler.h" |
| 9 | 9 |
| 10 @class NSUserNotificationCenter; | 10 @class NSUserNotificationCenter; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 xpc_transaction_begin(); | 28 xpc_transaction_begin(); |
| 29 transactionOpen_ = true; | 29 transactionOpen_ = true; |
| 30 } | 30 } |
| 31 } | 31 } |
| 32 | 32 |
| 33 - (void)closeTransactionIfNeeded { | 33 - (void)closeTransactionIfNeeded { |
| 34 @synchronized(self) { | 34 @synchronized(self) { |
| 35 NSUserNotificationCenter* notificationCenter = | 35 NSUserNotificationCenter* notificationCenter = |
| 36 [NSUserNotificationCenter defaultUserNotificationCenter]; | 36 [NSUserNotificationCenter defaultUserNotificationCenter]; |
| 37 NSUInteger showing = [[notificationCenter deliveredNotifications] count]; | 37 NSUInteger showing = [[notificationCenter deliveredNotifications] count]; |
| 38 if (showing == 0) { | 38 if (showing == 0 && transactionOpen_) { |
| 39 xpc_transaction_end(); | 39 xpc_transaction_end(); |
| 40 transactionOpen_ = false; | 40 transactionOpen_ = false; |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 @end | 44 @end |
| OLD | NEW |