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

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

Issue 2458703003: Create a stub NSUserNotificationCenter and make tests use it. (Closed)
Patch Set: review Created 4 years, 1 month 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 | chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm » ('j') | 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_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/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 const std::string& profile_id, 276 const std::string& profile_id,
277 bool incognito, 277 bool incognito,
278 std::set<std::string>* notifications) const { 278 std::set<std::string>* notifications) const {
279 DCHECK(notifications); 279 DCHECK(notifications);
280 280
281 NSString* current_profile_id = base::SysUTF8ToNSString(profile_id); 281 NSString* current_profile_id = base::SysUTF8ToNSString(profile_id);
282 for (NSUserNotification* toast in 282 for (NSUserNotification* toast in
283 [notification_center_ deliveredNotifications]) { 283 [notification_center_ deliveredNotifications]) {
284 NSString* toast_profile_id = [toast.userInfo 284 NSString* toast_profile_id = [toast.userInfo
285 objectForKey:notification_constants::kNotificationProfileId]; 285 objectForKey:notification_constants::kNotificationProfileId];
286 if (toast_profile_id == current_profile_id) { 286 if ([toast_profile_id isEqualToString:current_profile_id]) {
287 notifications->insert(base::SysNSStringToUTF8([toast.userInfo 287 notifications->insert(base::SysNSStringToUTF8([toast.userInfo
288 objectForKey:notification_constants::kNotificationId])); 288 objectForKey:notification_constants::kNotificationId]));
289 } 289 }
290 } 290 }
291 return true; 291 return true;
292 } 292 }
293 293
294 // static 294 // static
295 void NotificationPlatformBridgeMac::ProcessNotificationResponse( 295 void NotificationPlatformBridgeMac::ProcessNotificationResponse(
296 NSDictionary* response) { 296 NSDictionary* response) {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 [[xpcConnection_ remoteObjectProxy] closeAllNotifications]; 475 [[xpcConnection_ remoteObjectProxy] closeAllNotifications];
476 } 476 }
477 477
478 // NotificationReply implementation 478 // NotificationReply implementation
479 - (void)notificationClick:(NSDictionary*)notificationResponseData { 479 - (void)notificationClick:(NSDictionary*)notificationResponseData {
480 NotificationPlatformBridgeMac::ProcessNotificationResponse( 480 NotificationPlatformBridgeMac::ProcessNotificationResponse(
481 notificationResponseData); 481 notificationResponseData);
482 } 482 }
483 483
484 @end 484 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698