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

Side by Side Diff: content/browser/notifications/notification_event_dispatcher_impl.cc

Issue 1795863006: service worker: Attribute purpose to start worker attempts for UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: patch for landing? Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/notifications/notification_event_dispatcher_impl.h" 5 #include "content/browser/notifications/notification_event_dispatcher_impl.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "content/browser/notifications/platform_notification_context_impl.h" 9 #include "content/browser/notifications/platform_notification_context_impl.h"
10 #include "content/browser/service_worker/service_worker_context_wrapper.h" 10 #include "content/browser/service_worker/service_worker_context_wrapper.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 // Dispatches the notification click event on the |service_worker_registration|. 221 // Dispatches the notification click event on the |service_worker_registration|.
222 void DoDispatchNotificationClickEvent( 222 void DoDispatchNotificationClickEvent(
223 int action_index, 223 int action_index,
224 const NotificationDispatchCompleteCallback& dispatch_complete_callback, 224 const NotificationDispatchCompleteCallback& dispatch_complete_callback,
225 const scoped_refptr<PlatformNotificationContext>& notification_context, 225 const scoped_refptr<PlatformNotificationContext>& notification_context,
226 const ServiceWorkerRegistration* service_worker_registration, 226 const ServiceWorkerRegistration* service_worker_registration,
227 const NotificationDatabaseData& notification_database_data) { 227 const NotificationDatabaseData& notification_database_data) {
228 ServiceWorkerVersion::StatusCallback status_callback = base::Bind( 228 ServiceWorkerVersion::StatusCallback status_callback = base::Bind(
229 &ServiceWorkerNotificationEventFinished, dispatch_complete_callback); 229 &ServiceWorkerNotificationEventFinished, dispatch_complete_callback);
230 service_worker_registration->active_version()->RunAfterStartWorker( 230 service_worker_registration->active_version()->RunAfterStartWorker(
231 ServiceWorkerMetrics::EventType::NOTIFICATION_CLICK,
231 base::Bind( 232 base::Bind(
232 &DispatchNotificationClickEventOnWorker, 233 &DispatchNotificationClickEventOnWorker,
233 make_scoped_refptr(service_worker_registration->active_version()), 234 make_scoped_refptr(service_worker_registration->active_version()),
234 notification_database_data, action_index, status_callback), 235 notification_database_data, action_index, status_callback),
235 status_callback); 236 status_callback);
236 } 237 }
237 238
238 // ----------------------------------------------------------------------------- 239 // -----------------------------------------------------------------------------
239 240
240 // Called when the notification data has been deleted to finish the notification 241 // Called when the notification data has been deleted to finish the notification
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 const scoped_refptr<PlatformNotificationContext>& notification_context, 293 const scoped_refptr<PlatformNotificationContext>& notification_context,
293 const ServiceWorkerRegistration* service_worker_registration, 294 const ServiceWorkerRegistration* service_worker_registration,
294 const NotificationDatabaseData& notification_database_data) { 295 const NotificationDatabaseData& notification_database_data) {
295 const ServiceWorkerVersion::StatusCallback dispatch_event_callback = 296 const ServiceWorkerVersion::StatusCallback dispatch_event_callback =
296 base::Bind(&DeleteNotificationDataFromDatabase, 297 base::Bind(&DeleteNotificationDataFromDatabase,
297 notification_database_data.notification_id, 298 notification_database_data.notification_id,
298 notification_database_data.origin, notification_context, 299 notification_database_data.origin, notification_context,
299 dispatch_complete_callback); 300 dispatch_complete_callback);
300 if (by_user) { 301 if (by_user) {
301 service_worker_registration->active_version()->RunAfterStartWorker( 302 service_worker_registration->active_version()->RunAfterStartWorker(
303 ServiceWorkerMetrics::EventType::NOTIFICATION_CLOSE,
302 base::Bind( 304 base::Bind(
303 &DispatchNotificationCloseEventOnWorker, 305 &DispatchNotificationCloseEventOnWorker,
304 make_scoped_refptr(service_worker_registration->active_version()), 306 make_scoped_refptr(service_worker_registration->active_version()),
305 notification_database_data, dispatch_event_callback), 307 notification_database_data, dispatch_event_callback),
306 dispatch_event_callback); 308 dispatch_event_callback);
307 } else { 309 } else {
308 dispatch_event_callback.Run(ServiceWorkerStatusCode::SERVICE_WORKER_OK); 310 dispatch_event_callback.Run(ServiceWorkerStatusCode::SERVICE_WORKER_OK);
309 } 311 }
310 } 312 }
311 313
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 const GURL& origin, 377 const GURL& origin,
376 bool by_user, 378 bool by_user,
377 const NotificationDispatchCompleteCallback& dispatch_complete_callback) { 379 const NotificationDispatchCompleteCallback& dispatch_complete_callback) {
378 DispatchNotificationEvent(browser_context, persistent_notification_id, origin, 380 DispatchNotificationEvent(browser_context, persistent_notification_id, origin,
379 base::Bind(&DoDispatchNotificationCloseEvent, 381 base::Bind(&DoDispatchNotificationCloseEvent,
380 by_user, dispatch_complete_callback), 382 by_user, dispatch_complete_callback),
381 dispatch_complete_callback); 383 dispatch_complete_callback);
382 } 384 }
383 385
384 } // namespace content 386 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698