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

Unified Diff: content/browser/notifications/notification_message_filter.cc

Issue 2888303004: Minimize the delegate dependencies for non persistent notifications. (Closed)
Patch Set: format 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: content/browser/notifications/notification_message_filter.cc
diff --git a/content/browser/notifications/notification_message_filter.cc b/content/browser/notifications/notification_message_filter.cc
index 56064347d26ab470e7c5aa4d74596e7273e25d19..998d2bd586fdad80adefe781fe8440931d942056 100644
--- a/content/browser/notifications/notification_message_filter.cc
+++ b/content/browser/notifications/notification_message_filter.cc
@@ -10,6 +10,7 @@
#include "base/command_line.h"
#include "base/feature_list.h"
#include "content/browser/bad_message.h"
+#include "content/browser/notifications/notification_event_dispatcher_impl.h"
#include "content/browser/notifications/notification_id_generator.h"
#include "content/browser/notifications/page_notification_delegate.h"
#include "content/browser/notifications/platform_notification_context_impl.h"
@@ -96,7 +97,7 @@ NotificationMessageFilter::NotificationMessageFilter(
browser_context_(browser_context),
weak_factory_io_(this) {}
-NotificationMessageFilter::~NotificationMessageFilter() {}
+NotificationMessageFilter::~NotificationMessageFilter() = default;
void NotificationMessageFilter::DidCloseNotification(
const std::string& notification_id) {
@@ -105,6 +106,10 @@ void NotificationMessageFilter::DidCloseNotification(
}
void NotificationMessageFilter::OnDestruct() const {
+ NotificationEventDispatcherImpl* event_dispatcher =
+ content::NotificationEventDispatcherImpl::GetInstance();
+ DCHECK(event_dispatcher);
+ event_dispatcher->RendererGone(process_id_);
BrowserThread::DeleteOnIOThread::Destruct(this);
}
@@ -161,6 +166,11 @@ void NotificationMessageFilter::OnShowPlatformNotification(
origin, notification_data.tag, non_persistent_notification_id,
process_id_);
+ NotificationEventDispatcherImpl* event_dispatcher =
+ content::NotificationEventDispatcherImpl::GetInstance();
+ event_dispatcher->RegisterNonPersistentNotification(
+ notification_id, process_id_, non_persistent_notification_id);
+
std::unique_ptr<DesktopNotificationDelegate> delegate(
new PageNotificationDelegate(process_id_, non_persistent_notification_id,
notification_id));

Powered by Google App Engine
This is Rietveld 408576698