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

Unified Diff: chrome/browser/browser_process_impl.cc

Issue 1814923002: Nuke NotificationUIManager from PlatformNotificationServiceImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@profile_manager_load
Patch Set: Created 4 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
Index: chrome/browser/browser_process_impl.cc
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 5f02edebc2ad637a5e53a377b949b3b21ce2e41d..5a714eba28f89e0890d8ebfd7a2c9192e6b5b609 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -51,6 +51,7 @@
#include "chrome/browser/metrics/thread_watcher.h"
#include "chrome/browser/net/chrome_net_log_helper.h"
#include "chrome/browser/net/crl_set_fetcher.h"
+#include "chrome/browser/notifications/notification_bridge.h"
#include "chrome/browser/notifications/notification_ui_manager.h"
#include "chrome/browser/plugins/chrome_plugin_service_filter.h"
#include "chrome/browser/plugins/plugin_finder.h"
@@ -188,6 +189,7 @@ BrowserProcessImpl::BrowserProcessImpl(
created_local_state_(false),
created_icon_manager_(false),
created_notification_ui_manager_(false),
+ created_notification_bridge_(false),
created_safe_browsing_service_(false),
shutting_down_(false),
tearing_down_(false),
@@ -569,11 +571,25 @@ BrowserProcessImpl::extension_event_router_forwarder() {
NotificationUIManager* BrowserProcessImpl::notification_ui_manager() {
DCHECK(CalledOnValidThread());
+// TODO(miguelg) return NULL for MAC as well once native notifications
+// are enabled by default.
+#if defined(OS_ANDROID)
+ return nullptr;
+#endif
if (!created_notification_ui_manager_)
CreateNotificationUIManager();
return notification_ui_manager_.get();
}
+NotificationBridge* BrowserProcessImpl::notification_bridge() {
+#if defined(OS_ANDROID) || defined(OS_MACOSX)
+ if (!created_notification_bridge_)
+ CreateNotificationBridge();
+ return notification_bridge_.get();
+#endif
+ return nullptr;
+}
+
message_center::MessageCenter* BrowserProcessImpl::message_center() {
DCHECK(CalledOnValidThread());
return message_center::MessageCenter::Get();
@@ -1057,8 +1073,18 @@ void BrowserProcessImpl::CreateIntranetRedirectDetector() {
intranet_redirect_detector_.swap(intranet_redirect_detector);
}
+void BrowserProcessImpl::CreateNotificationBridge() {
+#if (defined(OS_ANDROID) || defined(OS_MACOSX)) && defined(ENABLE_NOTIFICATIONS)
+ DCHECK(notification_bridge_.get() == NULL);
+ notification_bridge_.reset(NotificationBridge::Create());
+ created_notification_bridge_ = true;
+#endif
+}
+
void BrowserProcessImpl::CreateNotificationUIManager() {
-#if defined(ENABLE_NOTIFICATIONS)
+// Android does not use the NotificationUIManager anuymore
+// All notification traffic is routed through NotificationBridge.
+#if defined(ENABLE_NOTIFICATIONS) && !defined(OS_ANDROID)
DCHECK(notification_ui_manager_.get() == NULL);
notification_ui_manager_.reset(NotificationUIManager::Create(local_state()));
created_notification_ui_manager_ = true;

Powered by Google App Engine
This is Rietveld 408576698