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

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

Issue 2921263002: Remove many delegates, let's see what breaks
Patch Set: fix test Created 3 years, 6 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/stub_notification_display_service.cc
diff --git a/chrome/browser/notifications/stub_notification_display_service.cc b/chrome/browser/notifications/stub_notification_display_service.cc
index 3a94e79456643c788fceb77fe0e080b92c10ff02..578c43a8b8edc4b0153e7e80186278b5ad1f405b 100644
--- a/chrome/browser/notifications/stub_notification_display_service.cc
+++ b/chrome/browser/notifications/stub_notification_display_service.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include "base/memory/ptr_util.h"
+#include "chrome/browser/notifications/notification_handler.h"
#include "chrome/browser/profiles/profile.h"
// static
@@ -17,7 +18,7 @@ std::unique_ptr<KeyedService> StubNotificationDisplayService::FactoryForTests(
}
StubNotificationDisplayService::StubNotificationDisplayService(Profile* profile)
- : NotificationDisplayService(profile) {}
+ : NotificationDisplayService(profile), profile_(profile) {}
StubNotificationDisplayService::~StubNotificationDisplayService() = default;
@@ -35,20 +36,22 @@ void StubNotificationDisplayService::RemoveNotification(
if (iter == notifications_.end())
return;
- // TODO(peter): Invoke the handlers when that has been generalized.
- iter->second.delegate()->Close(by_user);
-
+ NotificationHandler* handler = GetNotificationHandler(notification_type);
+ DCHECK(handler);
+ handler->OnClose(profile_, iter->second.origin_url().spec(), notification_id,
+ by_user);
notifications_.erase(iter);
}
void StubNotificationDisplayService::RemoveAllNotifications(
NotificationCommon::Type notification_type,
bool by_user) {
+ NotificationHandler* handler = GetNotificationHandler(notification_type);
+ DCHECK(handler);
for (auto iter = notifications_.begin(); iter != notifications_.end();) {
if (iter->first == notification_type) {
- // TODO(peter): Invoke the handlers when that has been generalized.
- iter->second.delegate()->Close(by_user);
-
+ handler->OnClose(profile_, iter->second.origin_url().spec(),
+ iter->second.id(), by_user);
iter = notifications_.erase(iter);
} else {
iter++;

Powered by Google App Engine
This is Rietveld 408576698