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

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 0b2d2d4ccc9c74366d5f26a5fc44f2995f684b87..c03d2b59466df622bddc1fe2a338023706749277 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -53,6 +53,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_platform_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"
@@ -190,6 +191,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),
@@ -571,9 +573,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;
+#else
if (!created_notification_ui_manager_)
CreateNotificationUIManager();
return notification_ui_manager_.get();
+#endif
+}
+
+NotificationPlatformBridge* BrowserProcessImpl::notification_platform_bridge() {
+#if defined(OS_ANDROID) || defined(OS_MACOSX)
+ if (!created_notification_bridge_)
+ CreateNotificationPlatformBridge();
+ return notification_bridge_.get();
+#else
+ return nullptr;
+#endif
}
message_center::MessageCenter* BrowserProcessImpl::message_center() {
@@ -1058,8 +1076,18 @@ void BrowserProcessImpl::CreateIntranetRedirectDetector() {
intranet_redirect_detector_.swap(intranet_redirect_detector);
}
+void BrowserProcessImpl::CreateNotificationPlatformBridge() {
+#if (defined(OS_ANDROID) || defined(OS_MACOSX)) && defined(ENABLE_NOTIFICATIONS)
+ DCHECK(notification_bridge_.get() == NULL);
+ notification_bridge_.reset(NotificationPlatformBridge::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 NotificationPlatformBridge.
+#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;
« no previous file with comments | « chrome/browser/browser_process_impl.h ('k') | chrome/browser/notifications/message_center_display_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698