| OLD | NEW |
| 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 #ifndef CONTENT_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_ROUTER_H_ | 5 #ifndef CONTENT_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_ROUTER_H_ |
| 6 #define CONTENT_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_ROUTER_H_ | 6 #define CONTENT_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_ROUTER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 const DeliverMessageCallback& deliver_message_callback, | 47 const DeliverMessageCallback& deliver_message_callback, |
| 48 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context); | 48 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context); |
| 49 | 49 |
| 50 // If a registration was successfully retrieved, dispatches a push event with | 50 // If a registration was successfully retrieved, dispatches a push event with |
| 51 // |data| on the Service Worker identified by |service_worker_registration|. | 51 // |data| on the Service Worker identified by |service_worker_registration|. |
| 52 // Must be called on the IO thread. | 52 // Must be called on the IO thread. |
| 53 static void FindServiceWorkerRegistrationCallback( | 53 static void FindServiceWorkerRegistrationCallback( |
| 54 const PushEventPayload& payload, | 54 const PushEventPayload& payload, |
| 55 const DeliverMessageCallback& deliver_message_callback, | 55 const DeliverMessageCallback& deliver_message_callback, |
| 56 ServiceWorkerStatusCode service_worker_status, | 56 ServiceWorkerStatusCode service_worker_status, |
| 57 scoped_refptr<ServiceWorkerRegistration> service_worker_registration); | 57 const scoped_refptr<ServiceWorkerRegistration>& |
| 58 service_worker_registration); |
| 58 | 59 |
| 59 // Delivers a push message with |data| to a specific |service_worker|. Must be | 60 // Delivers a push message with |data| to a specific |service_worker|. Must be |
| 60 // called on the IO thread, with the the worker running. | 61 // called on the IO thread, with the the worker running. |
| 61 static void DeliverMessageToWorker( | 62 static void DeliverMessageToWorker( |
| 62 const scoped_refptr<ServiceWorkerVersion>& service_worker, | 63 const scoped_refptr<ServiceWorkerVersion>& service_worker, |
| 63 const scoped_refptr<ServiceWorkerRegistration>& | 64 const scoped_refptr<ServiceWorkerRegistration>& |
| 64 service_worker_registration, | 65 service_worker_registration, |
| 65 const PushEventPayload& payload, | 66 const PushEventPayload& payload, |
| 66 const DeliverMessageCallback& deliver_message_callback); | 67 const DeliverMessageCallback& deliver_message_callback); |
| 67 | 68 |
| 68 // Gets called asynchronously after the Service Worker has dispatched the push | 69 // Gets called asynchronously after the Service Worker has dispatched the push |
| 69 // event. Must be called on the IO thread. | 70 // event. Must be called on the IO thread. |
| 70 static void DeliverMessageEnd( | 71 static void DeliverMessageEnd( |
| 71 const DeliverMessageCallback& deliver_message_callback, | 72 const DeliverMessageCallback& deliver_message_callback, |
| 72 const scoped_refptr<ServiceWorkerRegistration>& | 73 const scoped_refptr<ServiceWorkerRegistration>& |
| 73 service_worker_registration, | 74 service_worker_registration, |
| 74 ServiceWorkerStatusCode service_worker_status); | 75 ServiceWorkerStatusCode service_worker_status); |
| 75 | 76 |
| 76 DISALLOW_IMPLICIT_CONSTRUCTORS(PushMessagingRouter); | 77 DISALLOW_IMPLICIT_CONSTRUCTORS(PushMessagingRouter); |
| 77 }; | 78 }; |
| 78 | 79 |
| 79 } // namespace content | 80 } // namespace content |
| 80 | 81 |
| 81 #endif // CONTENT_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_ROUTER_H_ | 82 #endif // CONTENT_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_ROUTER_H_ |
| OLD | NEW |