| Index: chrome/browser/notifications/platform_notification_service_impl.cc
|
| diff --git a/chrome/browser/notifications/platform_notification_service_impl.cc b/chrome/browser/notifications/platform_notification_service_impl.cc
|
| index bcb89a79aece0f7d9e8956b2c446a2e65c59599b..a147fb3fac433c0e46c6f33eb7316907417cde85 100644
|
| --- a/chrome/browser/notifications/platform_notification_service_impl.cc
|
| +++ b/chrome/browser/notifications/platform_notification_service_impl.cc
|
| @@ -10,6 +10,7 @@
|
| #include "base/metrics/histogram_macros.h"
|
| #include "base/metrics/user_metrics_action.h"
|
| #include "base/prefs/pref_service.h"
|
| +#include "base/strings/string_number_conversions.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
|
| @@ -53,10 +54,6 @@
|
| #include "extensions/common/permissions/permissions_data.h"
|
| #endif
|
|
|
| -#if defined(OS_ANDROID)
|
| -#include "base/strings/string_number_conversions.h"
|
| -#endif
|
| -
|
| using content::BrowserContext;
|
| using content::BrowserThread;
|
| using content::PlatformNotificationContext;
|
| @@ -98,7 +95,12 @@ PlatformNotificationServiceImpl::GetInstance() {
|
| }
|
|
|
| PlatformNotificationServiceImpl::PlatformNotificationServiceImpl()
|
| - : notification_ui_manager_for_tests_(nullptr) {}
|
| + : notification_ui_manager_for_tests_(nullptr) {
|
| +#if defined(OS_MACOSX)
|
| + native_notification_ui_manager_.reset(
|
| + NotificationUIManager::CreateNativeNotificationManager());
|
| +#endif
|
| +}
|
|
|
| PlatformNotificationServiceImpl::~PlatformNotificationServiceImpl() {}
|
|
|
| @@ -335,12 +337,17 @@ void PlatformNotificationServiceImpl::ClosePersistentNotification(
|
| #if defined(OS_ANDROID)
|
| // TODO(peter): Remove this conversion when the notification ids are being
|
| // generated by the caller of this method.
|
| - std::string textual_persistent_notification_id =
|
| - base::Int64ToString(persistent_notification_id);
|
| GetNotificationUIManager()->CancelById(
|
| - textual_persistent_notification_id,
|
| + base::Int64ToString(persistent_notification_id),
|
| NotificationUIManager::GetProfileID(profile));
|
| #else
|
| + if (native_notification_ui_manager_ &&
|
| + native_notification_ui_manager_->AcceptNativeNotifications()) {
|
| + GetNotificationUIManager()->CancelById(
|
| + base::Int64ToString(persistent_notification_id),
|
| + NotificationUIManager::GetProfileID(profile));
|
| + }
|
| +
|
| auto iter = persistent_notifications_.find(persistent_notification_id);
|
| if (iter == persistent_notifications_.end())
|
| return;
|
| @@ -425,6 +432,11 @@ PlatformNotificationServiceImpl::GetNotificationUIManager() const {
|
| if (notification_ui_manager_for_tests_)
|
| return notification_ui_manager_for_tests_;
|
|
|
| + if (native_notification_ui_manager_ &&
|
| + native_notification_ui_manager_->AcceptNativeNotifications()) {
|
| + return native_notification_ui_manager_.get();
|
| + }
|
| +
|
| return g_browser_process->notification_ui_manager();
|
| }
|
|
|
|
|