OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "chrome/browser/notifications/notification_platform_bridge_mac.h" | 5 #include "chrome/browser/notifications/notification_platform_bridge_mac.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 const std::string& profile_id, | 276 const std::string& profile_id, |
277 bool incognito, | 277 bool incognito, |
278 std::set<std::string>* notifications) const { | 278 std::set<std::string>* notifications) const { |
279 DCHECK(notifications); | 279 DCHECK(notifications); |
280 | 280 |
281 NSString* current_profile_id = base::SysUTF8ToNSString(profile_id); | 281 NSString* current_profile_id = base::SysUTF8ToNSString(profile_id); |
282 for (NSUserNotification* toast in | 282 for (NSUserNotification* toast in |
283 [notification_center_ deliveredNotifications]) { | 283 [notification_center_ deliveredNotifications]) { |
284 NSString* toast_profile_id = [toast.userInfo | 284 NSString* toast_profile_id = [toast.userInfo |
285 objectForKey:notification_constants::kNotificationProfileId]; | 285 objectForKey:notification_constants::kNotificationProfileId]; |
286 if (toast_profile_id == current_profile_id) { | 286 if ([toast_profile_id isEqualToString:current_profile_id]) { |
287 notifications->insert(base::SysNSStringToUTF8([toast.userInfo | 287 notifications->insert(base::SysNSStringToUTF8([toast.userInfo |
288 objectForKey:notification_constants::kNotificationId])); | 288 objectForKey:notification_constants::kNotificationId])); |
289 } | 289 } |
290 } | 290 } |
291 return true; | 291 return true; |
292 } | 292 } |
293 | 293 |
294 // static | 294 // static |
295 void NotificationPlatformBridgeMac::ProcessNotificationResponse( | 295 void NotificationPlatformBridgeMac::ProcessNotificationResponse( |
296 NSDictionary* response) { | 296 NSDictionary* response) { |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 [[xpcConnection_ remoteObjectProxy] closeAllNotifications]; | 475 [[xpcConnection_ remoteObjectProxy] closeAllNotifications]; |
476 } | 476 } |
477 | 477 |
478 // NotificationReply implementation | 478 // NotificationReply implementation |
479 - (void)notificationClick:(NSDictionary*)notificationResponseData { | 479 - (void)notificationClick:(NSDictionary*)notificationResponseData { |
480 NotificationPlatformBridgeMac::ProcessNotificationResponse( | 480 NotificationPlatformBridgeMac::ProcessNotificationResponse( |
481 notificationResponseData); | 481 notificationResponseData); |
482 } | 482 } |
483 | 483 |
484 @end | 484 @end |
OLD | NEW |