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/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 NSString* toast_profile_id = [toast.userInfo | 202 NSString* toast_profile_id = [toast.userInfo |
203 objectForKey:notification_constants::kNotificationProfileId]; | 203 objectForKey:notification_constants::kNotificationProfileId]; |
204 if (toast_profile_id == current_profile_id) { | 204 if (toast_profile_id == current_profile_id) { |
205 notifications->insert(base::SysNSStringToUTF8([toast.userInfo | 205 notifications->insert(base::SysNSStringToUTF8([toast.userInfo |
206 objectForKey:notification_constants::kNotificationId])); | 206 objectForKey:notification_constants::kNotificationId])); |
207 } | 207 } |
208 } | 208 } |
209 return true; | 209 return true; |
210 } | 210 } |
211 | 211 |
212 bool NotificationPlatformBridgeMac::SupportsNotificationCenter() const { | |
213 return true; | |
214 } | |
215 | |
216 // static | 212 // static |
217 bool NotificationPlatformBridgeMac::VerifyNotificationData( | 213 bool NotificationPlatformBridgeMac::VerifyNotificationData( |
218 NSDictionary* response) { | 214 NSDictionary* response) { |
219 if (![response | 215 if (![response |
220 objectForKey:notification_constants::kNotificationButtonIndex] || | 216 objectForKey:notification_constants::kNotificationButtonIndex] || |
221 ![response objectForKey:notification_constants::kNotificationOperation] || | 217 ![response objectForKey:notification_constants::kNotificationOperation] || |
222 ![response objectForKey:notification_constants::kNotificationId] || | 218 ![response objectForKey:notification_constants::kNotificationId] || |
223 ![response objectForKey:notification_constants::kNotificationProfileId] || | 219 ![response objectForKey:notification_constants::kNotificationProfileId] || |
224 ![response objectForKey:notification_constants::kNotificationIncognito] || | 220 ![response objectForKey:notification_constants::kNotificationIncognito] || |
225 ![response objectForKey:notification_constants::kNotificationType]) { | 221 ![response objectForKey:notification_constants::kNotificationType]) { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 notificationOrigin, persistentNotificationId, buttonIndex.intValue)); | 318 notificationOrigin, persistentNotificationId, buttonIndex.intValue)); |
323 } | 319 } |
324 | 320 |
325 - (BOOL)userNotificationCenter:(NSUserNotificationCenter*)center | 321 - (BOOL)userNotificationCenter:(NSUserNotificationCenter*)center |
326 shouldPresentNotification:(NSUserNotification*)nsNotification { | 322 shouldPresentNotification:(NSUserNotification*)nsNotification { |
327 // Always display notifications, regardless of whether the app is foreground. | 323 // Always display notifications, regardless of whether the app is foreground. |
328 return YES; | 324 return YES; |
329 } | 325 } |
330 | 326 |
331 @end | 327 @end |
OLD | NEW |