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

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

Issue 11958025: Start delegating notifications to MessageCenter on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added USE_ASH guard to test code as well Created 7 years, 11 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/notification_ui_manager.cc
diff --git a/chrome/browser/notifications/notification_ui_manager.cc b/chrome/browser/notifications/notification_ui_manager.cc
index b4b7f883662ab18a81f9163e82c857b4c59384a0..5539382369e7f130aaed2f281d53135d8f8b8fdf 100644
--- a/chrome/browser/notifications/notification_ui_manager.cc
+++ b/chrome/browser/notifications/notification_ui_manager.cc
@@ -10,16 +10,32 @@
#if defined(ENABLE_MESSAGE_CENTER)
#include "chrome/browser/notifications/message_center_notification_manager.h"
+
+// MessageCenter either lives in ash::Shell (with USE_ASH), or in
+// BrowserProcess for non-ash builds. It has to be in ash::Shell since UI
+// elements of Shell that show notifications use it.
+#if defined(USE_ASH)
+#include "ash/shell.h"
+#else
+#include "chrome/browser/browser_process.h"
+#endif
+
+namespace {
+message_center::MessageCenter* GetMessageCenterInstance() {
+#if defined (USE_ASH)
+ return ash::Shell::GetInstance()->message_center();
+#else
+ return g_browser_process->message_center();
#endif
+}
+}
+#endif // defined(ENABLE_MESSAGE_CENTER)
// static
bool NotificationUIManager::DelegatesToMessageCenter() {
-#if defined(ENABLE_MESSAGE_CENTER)
return CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableRichNotifications);
-#else
return false;
-#endif
}
#if !defined(OS_MACOSX)
@@ -27,7 +43,7 @@ bool NotificationUIManager::DelegatesToMessageCenter() {
NotificationUIManager* NotificationUIManager::Create(PrefService* local_state) {
#if defined(ENABLE_MESSAGE_CENTER)
if (DelegatesToMessageCenter())
- return new MessageCenterNotificationManager();
+ return new MessageCenterNotificationManager(GetMessageCenterInstance());
#endif
BalloonNotificationUIManager* balloon_manager =
new BalloonNotificationUIManager(local_state);

Powered by Google App Engine
This is Rietveld 408576698