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

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

Issue 2682353002: Mojoify the notificationclick and notificationclose events (Closed)
Patch Set: Mojoify the notificationclick and notificationclose events Created 3 years, 10 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
« no previous file with comments | « no previous file | content/browser/service_worker/embedded_worker_test_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5f097bc0251c56efd78460d4240f2c873e1a0016..ae529c283b3d34f796ecaa6b3e9fe810ff583880 100644
--- a/content/browser/notifications/notification_event_dispatcher_impl.cc
+++ b/content/browser/notifications/notification_event_dispatcher_impl.cc
@@ -5,12 +5,12 @@
#include "content/browser/notifications/notification_event_dispatcher_impl.h"
#include "base/callback.h"
+#include "base/optional.h"
#include "build/build_config.h"
#include "content/browser/notifications/platform_notification_context_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/service_worker/service_worker_messages.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/storage_partition.h"
@@ -208,12 +208,15 @@ void DispatchNotificationClickEventOnWorker(
DCHECK_CURRENTLY_ON(BrowserThread::IO);
int request_id = service_worker->StartRequest(
ServiceWorkerMetrics::EventType::NOTIFICATION_CLICK, callback);
- service_worker->DispatchSimpleEvent<
- ServiceWorkerHostMsg_NotificationClickEventFinished>(
- request_id,
- ServiceWorkerMsg_NotificationClickEvent(
- request_id, notification_database_data.notification_id,
- notification_database_data.notification_data, action_index, reply));
+
+ base::Optional<base::string16> optional_reply;
+ if (!reply.is_null())
+ optional_reply = reply.string();
+
+ service_worker->event_dispatcher()->DispatchNotificationClickEvent(
+ notification_database_data.notification_id,
+ notification_database_data.notification_data, action_index,
+ optional_reply, service_worker->CreateSimpleEventCallback(request_id));
}
// Dispatches the notification click event on the |service_worker_registration|.
@@ -277,11 +280,11 @@ void DispatchNotificationCloseEventOnWorker(
DCHECK_CURRENTLY_ON(BrowserThread::IO);
int request_id = service_worker->StartRequest(
ServiceWorkerMetrics::EventType::NOTIFICATION_CLOSE, callback);
- service_worker->DispatchSimpleEvent<
- ServiceWorkerHostMsg_NotificationCloseEventFinished>(
- request_id, ServiceWorkerMsg_NotificationCloseEvent(
- request_id, notification_database_data.notification_id,
- notification_database_data.notification_data));
+
+ service_worker->event_dispatcher()->DispatchNotificationCloseEvent(
+ notification_database_data.notification_id,
+ notification_database_data.notification_data,
+ service_worker->CreateSimpleEventCallback(request_id));
}
// Actually dispatches the notification close event on the service worker
« no previous file with comments | « no previous file | content/browser/service_worker/embedded_worker_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698