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

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

Issue 2682353002: Mojoify the notificationclick and notificationclose events (Closed)
Patch Set: 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
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..1f634db9fb760f10ec6edfdefb931cae5f818c15 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,16 @@ 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;
awdf 2017/02/13 07:04:42 Is Optional<string> preferable to NullableString i
Peter Beverloo 2017/02/13 14:14:33 It's necessary for Mojo, but since base::Optional
+ 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, base::Bind(&ServiceWorkerVersion::OnSimpleEventFinished,
+ service_worker, request_id));
Peter Beverloo 2017/02/10 03:21:28 Err, this and line 288 need to use base::Unretaine
Peter Beverloo 2017/02/10 16:41:06 Done.
}
// Dispatches the notification click event on the |service_worker_registration|.
@@ -277,11 +281,12 @@ 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,
+ base::Bind(&ServiceWorkerVersion::OnSimpleEventFinished, service_worker,
+ request_id));
}
// Actually dispatches the notification close event on the service worker

Powered by Google App Engine
This is Rietveld 408576698