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

Unified Diff: chrome/browser/notifications/message_center_notification_manager.cc

Issue 2794103002: Add initial support for native Linux desktop notifications (Closed)
Patch Set: Refactor, move impl to chrome/browser/notifications Created 3 years, 9 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
Index: chrome/browser/notifications/message_center_notification_manager.cc
diff --git a/chrome/browser/notifications/message_center_notification_manager.cc b/chrome/browser/notifications/message_center_notification_manager.cc
index e60cdd6f8c11a0a9b8e80ab4bde751eb77425501..0b5bf12228e267c7671355b1480af23d40adf1c3 100644
--- a/chrome/browser/notifications/message_center_notification_manager.cc
+++ b/chrome/browser/notifications/message_center_notification_manager.cc
@@ -7,6 +7,7 @@
#include <memory>
#include <utility>
+#include "base/command_line.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "build/build_config.h"
@@ -18,6 +19,7 @@
#include "chrome/browser/notifications/profile_notification.h"
#include "chrome/browser/notifications/screen_lock_notification_blocker.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/chrome_switches.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/url_constants.h"
#include "extensions/browser/extension_registry.h"
@@ -38,6 +40,10 @@
#include "ash/shell.h"
#endif
+#if defined(USE_GLIB) && defined(USE_GIO)
+#include "chrome/browser/notifications/dbus_notification_manager.h"
+#endif
+
using message_center::NotifierId;
MessageCenterNotificationManager::MessageCenterNotificationManager(
@@ -62,8 +68,17 @@ MessageCenterNotificationManager::MessageCenterNotificationManager(
#if defined(OS_WIN) || defined(OS_MACOSX) \
|| (defined(OS_LINUX) && !defined(OS_CHROMEOS))
+#if defined(USE_GLIB) && defined(USE_GIO)
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kUseSystemNotifications)) {
+ dbus_notification_manager_.reset(
+ DbusNotificationManager::CreateDbusNotificationManager(message_center));
Peter Beverloo 2017/04/03 23:39:29 Instead of putting this in MessageCenterNotificati
Tom (Use chromium acct) 2017/04/04 02:43:17 Done.
+ }
+ if (dbus_notification_manager_)
+ return; // Do not create a message center tray if using the dbus impl.
+#endif
// On Windows, Linux and Mac, the notification manager owns the tray icon and
- // views.Other platforms have global ownership and Create will return NULL.
+ // views. Other platforms have global ownership and Create will return NULL.
tray_.reset(message_center::CreateMessageCenterTray());
#endif
}

Powered by Google App Engine
This is Rietveld 408576698