Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(879)

Side by Side Diff: chrome/browser/notifications/notification_ui_manager_mac.mm

Issue 1614993002: Do not try to load empty images (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_ui_manager_mac.h" 5 #include "chrome/browser/notifications/notification_ui_manager_mac.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 notification.context_message().empty() 114 notification.context_message().empty()
115 ? base::SysUTF8ToNSString(notification.origin_url().spec()) 115 ? base::SysUTF8ToNSString(notification.origin_url().spec())
116 : base::SysUTF16ToNSString(notification.context_message()); 116 : base::SysUTF16ToNSString(notification.context_message());
117 [toast setInformativeText:informativeText]; 117 [toast setInformativeText:informativeText];
118 118
119 // TODO(miguelg): Implement support for buttons 119 // TODO(miguelg): Implement support for buttons
120 toast.get().hasActionButton = NO; 120 toast.get().hasActionButton = NO;
121 121
122 // Some functionality is only available in 10.9+ or requires private APIs 122 // Some functionality is only available in 10.9+ or requires private APIs
123 // Icon 123 // Icon
124 if ([toast respondsToSelector:@selector(_identityImage)]) { 124 if ([toast respondsToSelector:@selector(_identityImage)] &&
125 !notification.icon().IsEmpty()) {
125 [toast setValue:notification.icon().ToNSImage() forKey:@"_identityImage"]; 126 [toast setValue:notification.icon().ToNSImage() forKey:@"_identityImage"];
126 [toast setValue:@NO forKey:@"_identityImageHasBorder"]; 127 [toast setValue:@NO forKey:@"_identityImageHasBorder"];
127 } 128 }
128 129
129 // Tag 130 // Tag
130 if ([toast respondsToSelector:@selector(setIdentifier:)] && 131 if ([toast respondsToSelector:@selector(setIdentifier:)] &&
131 !notification.tag().empty()) { 132 !notification.tag().empty()) {
132 [toast setValue:base::SysUTF8ToNSString(notification.tag()) 133 [toast setValue:base::SysUTF8ToNSString(notification.tag())
133 forKey:@"identifier"]; 134 forKey:@"identifier"];
134 } 135 }
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 -1 /* buttons not yet implemented */); 269 -1 /* buttons not yet implemented */);
269 } 270 }
270 271
271 - (BOOL)userNotificationCenter:(NSUserNotificationCenter*)center 272 - (BOOL)userNotificationCenter:(NSUserNotificationCenter*)center
272 shouldPresentNotification:(NSUserNotification*)nsNotification { 273 shouldPresentNotification:(NSUserNotification*)nsNotification {
273 // Always display notifications, regardless of whether the app is foreground. 274 // Always display notifications, regardless of whether the app is foreground.
274 return YES; 275 return YES;
275 } 276 }
276 277
277 @end 278 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698