Index: chrome/browser/ui/cocoa/notifications/notification_builder_mac.mm |
diff --git a/chrome/browser/ui/cocoa/notifications/notification_builder_mac.mm b/chrome/browser/ui/cocoa/notifications/notification_builder_mac.mm |
index 42732bdf4b85c5d89bd79787702f0bc43f7f86bb..8c272c3a53530f48eea00f7da2158d8330678ec9 100644 |
--- a/chrome/browser/ui/cocoa/notifications/notification_builder_mac.mm |
+++ b/chrome/browser/ui/cocoa/notifications/notification_builder_mac.mm |
@@ -6,7 +6,9 @@ |
#import <AppKit/AppKit.h> |
+#include "base/mac/mac_util.h" |
#include "base/mac/scoped_nsobject.h" |
+ |
#include "chrome/browser/ui/cocoa/notifications/notification_constants_mac.h" |
namespace { |
@@ -68,8 +70,14 @@ NSString* const kNotificationSettingsButtonTag = @"settingsButton"; |
} |
- (void)setIcon:(NSImage*)icon { |
- if (icon) |
- [notificationData_ setObject:icon forKey:kNotificationImage]; |
+ if (icon) { |
+ if (base::mac::IsAtLeastOS10_10()) { |
Robert Sesek
2017/03/06 16:12:05
Rather than using base::mac, use [icon conformsToP
Miguel Garcia
2017/03/06 16:30:42
So the problem is that down in line 136 I don't ha
Robert Sesek
2017/03/06 17:34:59
You can check the Class too: https://developer.app
|
+ [notificationData_ setObject:icon forKey:kNotificationImage]; |
+ } else { // in 10.09 NSImage does not conform to NSecureCoding |
Robert Sesek
2017/03/06 16:12:05
It's just "10.9" -- also use proper punctuation an
Miguel Garcia
2017/03/06 16:30:42
Done.
|
+ [notificationData_ setObject:[icon TIFFRepresentation] |
+ forKey:kNotificationImage]; |
+ } |
+ } |
} |
- (void)setButtons:(NSString*)primaryButton |
@@ -125,8 +133,14 @@ NSString* const kNotificationSettingsButtonTag = @"settingsButton"; |
// Icon |
if ([notificationData_ objectForKey:kNotificationImage]) { |
if ([toast respondsToSelector:@selector(_identityImage)]) { |
- NSImage* image = [notificationData_ objectForKey:kNotificationImage]; |
- [toast setValue:image forKey:@"_identityImage"]; |
+ if (base::mac::IsAtLeastOS10_10()) { |
+ NSImage* image = [notificationData_ objectForKey:kNotificationImage]; |
+ [toast setValue:image forKey:@"_identityImage"]; |
+ } else { // in 10.09 NSImage does not confirm to NSSecureCoding |
Robert Sesek
2017/03/06 16:12:05
Same.
Miguel Garcia
2017/03/06 16:30:42
Done.
|
+ base::scoped_nsobject<NSImage> image([[NSImage alloc] |
+ initWithData:[notificationData_ objectForKey:kNotificationImage]]); |
+ [toast setValue:image forKey:@"_identityImage"]; |
+ } |
[toast setValue:@NO forKey:@"_identityImageHasBorder"]; |
} |
} |