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

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

Issue 10690192: [Mac] Only attempt to replace a notification if the replacement_id is not empty. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
« 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/mac/cocoa_protocols.h" 7 #include "base/mac/cocoa_protocols.h"
8 #include "base/mac/mac_util.h" 8 #include "base/mac/mac_util.h"
9 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
10 #include "chrome/browser/notifications/notification.h" 10 #include "chrome/browser/notifications/notification.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 121
122 NotificationUIManagerMac::~NotificationUIManagerMac() { 122 NotificationUIManagerMac::~NotificationUIManagerMac() {
123 CancelAll(); 123 CancelAll();
124 } 124 }
125 125
126 void NotificationUIManagerMac::Add(const Notification& notification, 126 void NotificationUIManagerMac::Add(const Notification& notification,
127 Profile* profile) { 127 Profile* profile) {
128 if (notification.is_html()) { 128 if (notification.is_html()) {
129 builtin_manager_->Add(notification, profile); 129 builtin_manager_->Add(notification, profile);
130 } else { 130 } else {
131 id<CrUserNotification> replacee = FindNotificationWithReplacementId( 131 if (!notification.replace_id().empty()) {
132 notification.replace_id()); 132 id<CrUserNotification> replacee = FindNotificationWithReplacementId(
133 if (replacee) 133 notification.replace_id());
134 RemoveNotification(replacee); 134 if (replacee)
135 RemoveNotification(replacee);
136 }
135 137
136 // Owned by ControllerNotification. 138 // Owned by ControllerNotification.
137 id<CrUserNotification> ns_notification = 139 id<CrUserNotification> ns_notification =
138 [[NSClassFromString(@"NSUserNotification") alloc] init]; 140 [[NSClassFromString(@"NSUserNotification") alloc] init];
139 141
140 ns_notification.title = base::SysUTF16ToNSString(notification.title()); 142 ns_notification.title = base::SysUTF16ToNSString(notification.title());
141 ns_notification.subtitle = 143 ns_notification.subtitle =
142 base::SysUTF16ToNSString(notification.display_source()); 144 base::SysUTF16ToNSString(notification.display_source());
143 ns_notification.informativeText = 145 ns_notification.informativeText =
144 base::SysUTF16ToNSString(notification.body()); 146 base::SysUTF16ToNSString(notification.body());
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 notification->Click(); 300 notification->Click();
299 } 301 }
300 302
301 - (BOOL)userNotificationCenter:(NSUserNotificationCenter*)center 303 - (BOOL)userNotificationCenter:(NSUserNotificationCenter*)center
302 shouldPresentNotification:(id<CrUserNotification>)nsNotification { 304 shouldPresentNotification:(id<CrUserNotification>)nsNotification {
303 // Always display notifications, regardless of whether the app is foreground. 305 // Always display notifications, regardless of whether the app is foreground.
304 return YES; 306 return YES;
305 } 307 }
306 308
307 @end 309 @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