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

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

Issue 1895473002: PlatformNotificationService layering cleanup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@display_manager2
Patch Set: Created 4 years, 7 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
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/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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 toast.get().userInfo = @{ 173 toast.get().userInfo = @{
174 kNotificationOriginKey : 174 kNotificationOriginKey :
175 base::SysUTF8ToNSString(notification.origin_url().spec()), 175 base::SysUTF8ToNSString(notification.origin_url().spec()),
176 kNotificationPersistentIdKey : base::SysUTF8ToNSString(notification_id), 176 kNotificationPersistentIdKey : base::SysUTF8ToNSString(notification_id),
177 kNotificationProfilePersistentIdKey : base::SysUTF8ToNSString(profile_id), 177 kNotificationProfilePersistentIdKey : base::SysUTF8ToNSString(profile_id),
178 kNotificationIncognitoKey : [NSNumber numberWithBool:incognito] 178 kNotificationIncognitoKey : [NSNumber numberWithBool:incognito]
179 }; 179 };
180 180
181 [notification_center_ deliverNotification:toast]; 181 [notification_center_ deliverNotification:toast];
182 notification.delegate()->Display();
183 } 182 }
184 183
185 void NotificationUIManagerMac::Close(const std::string& profile_id, 184 void NotificationUIManagerMac::Close(const std::string& profile_id,
186 const std::string& notification_id) { 185 const std::string& notification_id) {
187 NSString* candidate_id = base::SysUTF8ToNSString(notification_id); 186 NSString* candidate_id = base::SysUTF8ToNSString(notification_id);
188 187
189 NSString* current_profile_id = base::SysUTF8ToNSString(profile_id); 188 NSString* current_profile_id = base::SysUTF8ToNSString(profile_id);
190 for (NSUserNotification* toast in 189 for (NSUserNotification* toast in
191 [notification_center_ deliveredNotifications]) { 190 [notification_center_ deliveredNotifications]) {
192 NSString* toast_id = 191 NSString* toast_id =
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 persistentNotificationId.longLongValue, buttonIndex); 286 persistentNotificationId.longLongValue, buttonIndex);
288 } 287 }
289 288
290 - (BOOL)userNotificationCenter:(NSUserNotificationCenter*)center 289 - (BOOL)userNotificationCenter:(NSUserNotificationCenter*)center
291 shouldPresentNotification:(NSUserNotification*)nsNotification { 290 shouldPresentNotification:(NSUserNotification*)nsNotification {
292 // Always display notifications, regardless of whether the app is foreground. 291 // Always display notifications, regardless of whether the app is foreground.
293 return YES; 292 return YES;
294 } 293 }
295 294
296 @end 295 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698