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

Unified Diff: content/browser/notifications/notification_event_dispatcher_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: content/browser/notifications/notification_event_dispatcher_impl.cc
diff --git a/content/browser/notifications/notification_event_dispatcher_impl.cc b/content/browser/notifications/notification_event_dispatcher_impl.cc
index 47779cfe660c259a18820b5b7e469975679d9d59..ae529c283b3d34f796ecaa6b3e9fe810ff583880 100644
--- a/content/browser/notifications/notification_event_dispatcher_impl.cc
+++ b/content/browser/notifications/notification_event_dispatcher_impl.cc
@@ -7,16 +7,12 @@
#include "base/callback.h"
#include "base/optional.h"
#include "build/build_config.h"
-#include "content/browser/notifications/notification_message_filter.h"
#include "content/browser/notifications/platform_notification_context_impl.h"
-#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/browser/service_worker/service_worker_registration.h"
#include "content/browser/service_worker/service_worker_storage.h"
-#include "content/common/platform_notification_messages.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/render_process_host.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/common/platform_notification_data.h"
@@ -360,8 +356,9 @@
return base::Singleton<NotificationEventDispatcherImpl>::get();
}
-NotificationEventDispatcherImpl::NotificationEventDispatcherImpl() = default;
-NotificationEventDispatcherImpl::~NotificationEventDispatcherImpl() = default;
+NotificationEventDispatcherImpl::NotificationEventDispatcherImpl() {}
+
+NotificationEventDispatcherImpl::~NotificationEventDispatcherImpl() {}
void NotificationEventDispatcherImpl::DispatchNotificationClickEvent(
BrowserContext* browser_context,
@@ -390,78 +387,4 @@
dispatch_complete_callback);
}
-void NotificationEventDispatcherImpl::RegisterNonPersistentNotification(
- const std::string& notification_id,
- int renderer_id,
- int non_persistent_id) {
- renderer_ids_[notification_id] = renderer_id;
- non_persistent_ids_[notification_id] = non_persistent_id;
-}
-
-void NotificationEventDispatcherImpl::DispatchNonPersistentShowEvent(
- const std::string& notification_id) {
- if (!renderer_ids_.count(notification_id))
- return;
- DCHECK(non_persistent_ids_.count(notification_id));
-
- RenderProcessHost* sender =
- RenderProcessHost::FromID(renderer_ids_[notification_id]);
- if (!sender)
- return;
-
- sender->Send(new PlatformNotificationMsg_DidShow(
- non_persistent_ids_[notification_id]));
-}
-
-void NotificationEventDispatcherImpl::DispatchNonPersistentClickEvent(
- const std::string& notification_id) {
- if (!renderer_ids_.count(notification_id))
- return;
- DCHECK(non_persistent_ids_.count(notification_id));
-
- RenderProcessHost* sender =
- RenderProcessHost::FromID(renderer_ids_[notification_id]);
-
- // This can happen when a notification is clicked by the user but the
- // renderer does not exist any more, for example because the tab has been
- // closed.
- if (!sender)
- return;
- sender->Send(new PlatformNotificationMsg_DidClick(
- non_persistent_ids_[notification_id]));
-}
-
-void NotificationEventDispatcherImpl::DispatchNonPersistentCloseEvent(
- const std::string& notification_id) {
- if (!renderer_ids_.count(notification_id))
- return;
- DCHECK(non_persistent_ids_.count(notification_id));
-
- RenderProcessHost* sender =
- RenderProcessHost::FromID(renderer_ids_[notification_id]);
-
- // This can happen when a notification is closed by the user but the
- // renderer does not exist any more, for example because the tab has been
- // closed.
- if (!sender)
- return;
- sender->Send(new PlatformNotificationMsg_DidClose(
- non_persistent_ids_[notification_id]));
-
- static_cast<RenderProcessHostImpl*>(sender)
- ->notification_message_filter()
- ->DidCloseNotification(notification_id);
-}
-
-void NotificationEventDispatcherImpl::RendererGone(int renderer_id) {
- for (auto iter = renderer_ids_.begin(); iter != renderer_ids_.end();) {
- if (iter->second == renderer_id) {
- non_persistent_ids_.erase(iter->first);
- iter = renderer_ids_.erase(iter);
- } else {
- iter++;
- }
- }
-}
-
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698