Chromium Code Reviews| 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..074e909af5b0fd1bd8a5faf9ca76fd3d71f4e806 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_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,11 +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; |
| +#endif |
|
Peter Beverloo
2016/04/20 17:34:08
nit: I think we generally use #if / #else / #endif
sky
2016/04/20 19:51:59
+1 (same comment for notification_bridge()).
Miguel Garcia
2016/04/21 14:32:10
Acknowledged.
Miguel Garcia
2016/04/21 14:32:10
Done.
|
| 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(); |
| @@ -1058,8 +1074,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; |