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

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

Issue 2916383004: Revert of Minimize the delegate dependencies for non persistent notifications. (Closed)
Patch Set: Created 3 years, 7 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/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 5d82dad0225d0f077297a93443f692ab34ed70c8..4c60c08daae8000ad58f8de373444e782274bc8e 100644
--- a/chrome/browser/notifications/platform_notification_service_impl.cc
+++ b/chrome/browser/notifications/platform_notification_service_impl.cc
@@ -15,8 +15,6 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/engagement/site_engagement_service.h"
-#include "chrome/browser/notifications/native_notification_delegate.h"
-#include "chrome/browser/notifications/notification_common.h"
#include "chrome/browser/notifications/notification_display_service_factory.h"
#include "chrome/browser/notifications/notification_object_proxy.h"
#include "chrome/browser/notifications/persistent_notification_delegate.h"
@@ -29,8 +27,6 @@
#include "chrome/browser/safe_browsing/ping_manager.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/common/chrome_features.h"
-#include "chrome/common/features.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
@@ -124,7 +120,6 @@
PlatformNotificationServiceImpl::~PlatformNotificationServiceImpl() {}
-// TODO(miguelg): Move this to PersistentNotificationHandler
void PlatformNotificationServiceImpl::OnPersistentNotificationClick(
BrowserContext* browser_context,
const std::string& notification_id,
@@ -170,7 +165,6 @@
base::Unretained(this)));
}
-// TODO(miguelg): Move this to PersistentNotificationHandler
void PlatformNotificationServiceImpl::OnPersistentNotificationClose(
BrowserContext* browser_context,
const std::string& notification_id,
@@ -317,27 +311,15 @@
DCHECK_EQ(0u, notification_data.actions.size());
DCHECK_EQ(0u, notification_resources.action_icons.size());
- // Temporary change while the delegates are merged.
- NotificationDelegate* notification_delegate;
-#if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
- if (base::FeatureList::IsEnabled(features::kNativeNotifications) &&
- g_browser_process->notification_platform_bridge()) {
- notification_delegate = new NativeNotificationDelegate(notification_id);
- } else {
- notification_delegate = new NotificationObjectProxy(
- browser_context, notification_id, origin, std::move(delegate));
- }
-#else
- notification_delegate = new NotificationObjectProxy(
+ NotificationObjectProxy* proxy = new NotificationObjectProxy(
browser_context, notification_id, origin, std::move(delegate));
-#endif // BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
-
Notification notification = CreateNotificationFromData(
profile, GURL() /* service_worker_scope */, origin, notification_data,
- notification_resources, notification_delegate);
+ notification_resources, proxy);
GetNotificationDisplayService(profile)->Display(
- NotificationCommon::NON_PERSISTENT, notification_id, notification);
+ NotificationCommon::NON_PERSISTENT, notification.delegate_id(),
+ notification);
if (cancel_callback) {
#if defined(OS_WIN)
std::string profile_id =
@@ -345,8 +327,9 @@
#elif defined(OS_POSIX)
std::string profile_id = profile->GetPath().BaseName().value();
#endif
- *cancel_callback = base::Bind(&CancelNotification, notification_id,
- profile_id, profile->IsOffTheRecord());
+ *cancel_callback =
+ base::Bind(&CancelNotification, notification.delegate_id(), profile_id,
+ profile->IsOffTheRecord());
}
}
@@ -371,7 +354,6 @@
// The notification settings button will be appended after the developer-
// supplied buttons, available in |notification_data.actions|.
int settings_button_index = notification_data.actions.size();
-
PersistentNotificationDelegate* delegate = new PersistentNotificationDelegate(
browser_context, notification_id, origin, settings_button_index);

Powered by Google App Engine
This is Rietveld 408576698