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

Unified Diff: chrome/browser/notifications/notification_platform_bridge_mac.mm

Issue 2774453002: Remove enbale_xpc_notifications compile flag (Closed)
Patch Set: rebase Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/BUILD.gn ('k') | chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/notifications/notification_platform_bridge_mac.mm
diff --git a/chrome/browser/notifications/notification_platform_bridge_mac.mm b/chrome/browser/notifications/notification_platform_bridge_mac.mm
index 3e81cd6ea85eaf08ba44d3acab707bbdf50bccf8..50a54b6b8a263daae4279f23954de63b0032ed4c 100644
--- a/chrome/browser/notifications/notification_platform_bridge_mac.mm
+++ b/chrome/browser/notifications/notification_platform_bridge_mac.mm
@@ -144,23 +144,16 @@ NotificationPlatformBridgeMac::~NotificationPlatformBridgeMac() {
// TODO(miguelg) do not remove banners if possible.
[notification_center_ removeAllDeliveredNotifications];
-#if BUILDFLAG(ENABLE_XPC_NOTIFICATIONS)
[alert_dispatcher_ closeAllNotifications];
-#endif // BUILDFLAG(ENABLE_XPC_NOTIFICATIONS)
}
// static
NotificationPlatformBridge* NotificationPlatformBridge::Create() {
-#if BUILDFLAG(ENABLE_XPC_NOTIFICATIONS)
base::scoped_nsobject<AlertDispatcherImpl> alert_dispatcher(
[[AlertDispatcherImpl alloc] init]);
return new NotificationPlatformBridgeMac(
[NSUserNotificationCenter defaultUserNotificationCenter],
alert_dispatcher.get());
-#else
- return new NotificationPlatformBridgeMac(
- [NSUserNotificationCenter defaultUserNotificationCenter], nil);
-#endif // ENABLE_XPC_NOTIFICATIONS
}
void NotificationPlatformBridgeMac::Display(
@@ -232,7 +225,6 @@ void NotificationPlatformBridgeMac::Display(
[builder setIncognito:incognito];
[builder setNotificationType:[NSNumber numberWithInteger:notification_type]];
-#if BUILDFLAG(ENABLE_XPC_NOTIFICATIONS)
// Send persistent notifications to the XPC service so they
// can be displayed as alerts. Chrome itself can only display
// banners.
@@ -243,10 +235,6 @@ void NotificationPlatformBridgeMac::Display(
NSUserNotification* toast = [builder buildUserNotification];
[notification_center_ deliverNotification:toast];
}
-#else
- NSUserNotification* toast = [builder buildUserNotification];
- [notification_center_ deliverNotification:toast];
-#endif // ENABLE_XPC_NOTIFICATIONS
}
void NotificationPlatformBridgeMac::Close(const std::string& profile_id,
@@ -270,49 +258,24 @@ void NotificationPlatformBridgeMac::Close(const std::string& profile_id,
break;
}
}
-#if BUILDFLAG(ENABLE_XPC_NOTIFICATIONS)
+
// If no banner existed with that ID try to see if there is an alert
// in the xpc server.
if (!notification_removed) {
[alert_dispatcher_ closeNotificationWithId:candidate_id
withProfileId:current_profile_id];
}
-#endif // ENABLE_XPC_NOTIFICATIONS
}
void NotificationPlatformBridgeMac::GetDisplayed(
const std::string& profile_id,
bool incognito,
const GetDisplayedNotificationsCallback& callback) const {
-#if BUILDFLAG(ENABLE_XPC_NOTIFICATIONS)
[alert_dispatcher_
getDisplayedAlertsForProfileId:base::SysUTF8ToNSString(profile_id)
incognito:incognito
notificationCenter:notification_center_
callback:callback];
-
-#else
-
- auto displayed_notifications = base::MakeUnique<std::set<std::string>>();
- NSString* current_profile_id = base::SysUTF8ToNSString(profile_id);
- for (NSUserNotification* toast in
- [notification_center_ deliveredNotifications]) {
- NSString* toast_profile_id = [toast.userInfo
- objectForKey:notification_constants::kNotificationProfileId];
- BOOL incognito_notification = [[toast.userInfo
- objectForKey:notification_constants::kNotificationIncognito] boolValue];
- if ([toast_profile_id isEqualToString:current_profile_id] &&
- incognito == incognito_notification) {
- displayed_notifications->insert(base::SysNSStringToUTF8([toast.userInfo
- objectForKey:notification_constants::kNotificationId]));
- }
- }
- content::BrowserThread::PostTask(
- content::BrowserThread::UI, FROM_HERE,
- base::Bind(callback, base::Passed(&displayed_notifications),
- true /* supports_synchronization */));
-
-#endif // ENABLE_XPC_NOTIFICATIONS
}
// static
« no previous file with comments | « chrome/BUILD.gn ('k') | chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698