Index: chrome/browser/notifications/notification_display_service_factory.cc |
diff --git a/chrome/browser/notifications/notification_display_service_factory.cc b/chrome/browser/notifications/notification_display_service_factory.cc |
index 8b40bcdab31544c9e5c7c2a0f2df89c79634622f..3e7c4f17533e5000c53c894bbd2a78fa6578b7cd 100644 |
--- a/chrome/browser/notifications/notification_display_service_factory.cc |
+++ b/chrome/browser/notifications/notification_display_service_factory.cc |
@@ -12,9 +12,10 @@ |
#include "chrome/browser/profiles/incognito_helpers.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/common/chrome_features.h" |
+#include "chrome/common/features.h" |
#include "components/keyed_service/content/browser_context_dependency_manager.h" |
-#if defined(OS_ANDROID) || defined(OS_MACOSX) |
+#if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) |
#include "chrome/browser/notifications/native_notification_display_service.h" |
#endif |
@@ -44,17 +45,20 @@ NotificationDisplayServiceFactory::NotificationDisplayServiceFactory() |
// - All other platforms always use the MessageCenterDisplayService. |
KeyedService* NotificationDisplayServiceFactory::BuildServiceInstanceFor( |
content::BrowserContext* context) const { |
+#if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) |
#if defined(OS_ANDROID) |
return new NativeNotificationDisplayService( |
Profile::FromBrowserContext(context), |
g_browser_process->notification_platform_bridge()); |
-#elif defined(OS_MACOSX) |
- if (base::FeatureList::IsEnabled(features::kNativeNotifications)) { |
+#else // defined(OS_ANDROID) |
+ if (base::FeatureList::IsEnabled(features::kNativeNotifications) && |
+ g_browser_process->notification_platform_bridge()) { |
return new NativeNotificationDisplayService( |
Profile::FromBrowserContext(context), |
g_browser_process->notification_platform_bridge()); |
} |
-#endif |
+#endif // defined(OS_ANDROID) |
+#endif // BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) |
return new MessageCenterDisplayService( |
Profile::FromBrowserContext(context), |
g_browser_process->notification_ui_manager()); |