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 #include "content/browser/push_messaging/push_messaging_router.h" | 5 #include "content/browser/push_messaging/push_messaging_router.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 10 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 service_worker_registration_id, origin, | 66 service_worker_registration_id, origin, |
67 base::Bind(&PushMessagingRouter::FindServiceWorkerRegistrationCallback, | 67 base::Bind(&PushMessagingRouter::FindServiceWorkerRegistrationCallback, |
68 payload, deliver_message_callback)); | 68 payload, deliver_message_callback)); |
69 } | 69 } |
70 | 70 |
71 // static | 71 // static |
72 void PushMessagingRouter::FindServiceWorkerRegistrationCallback( | 72 void PushMessagingRouter::FindServiceWorkerRegistrationCallback( |
73 const PushEventPayload& payload, | 73 const PushEventPayload& payload, |
74 const DeliverMessageCallback& deliver_message_callback, | 74 const DeliverMessageCallback& deliver_message_callback, |
75 ServiceWorkerStatusCode service_worker_status, | 75 ServiceWorkerStatusCode service_worker_status, |
76 scoped_refptr<ServiceWorkerRegistration> service_worker_registration) { | 76 const scoped_refptr<ServiceWorkerRegistration>& |
| 77 service_worker_registration) { |
77 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 78 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
78 // TODO(mvanouwerkerk): UMA logging. | 79 // TODO(mvanouwerkerk): UMA logging. |
79 if (service_worker_status != SERVICE_WORKER_OK) { | 80 if (service_worker_status != SERVICE_WORKER_OK) { |
80 RunDeliverCallback(deliver_message_callback, | 81 RunDeliverCallback(deliver_message_callback, |
81 PUSH_DELIVERY_STATUS_NO_SERVICE_WORKER); | 82 PUSH_DELIVERY_STATUS_NO_SERVICE_WORKER); |
82 return; | 83 return; |
83 } | 84 } |
84 | 85 |
85 ServiceWorkerVersion* version = service_worker_registration->active_version(); | 86 ServiceWorkerVersion* version = service_worker_registration->active_version(); |
86 DCHECK(version); | 87 DCHECK(version); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 case SERVICE_WORKER_ERROR_MAX_VALUE: | 152 case SERVICE_WORKER_ERROR_MAX_VALUE: |
152 NOTREACHED() << "Got unexpected error code: " << service_worker_status | 153 NOTREACHED() << "Got unexpected error code: " << service_worker_status |
153 << " " << ServiceWorkerStatusToString(service_worker_status); | 154 << " " << ServiceWorkerStatusToString(service_worker_status); |
154 delivery_status = PUSH_DELIVERY_STATUS_SERVICE_WORKER_ERROR; | 155 delivery_status = PUSH_DELIVERY_STATUS_SERVICE_WORKER_ERROR; |
155 break; | 156 break; |
156 } | 157 } |
157 RunDeliverCallback(deliver_message_callback, delivery_status); | 158 RunDeliverCallback(deliver_message_callback, delivery_status); |
158 } | 159 } |
159 | 160 |
160 } // namespace content | 161 } // namespace content |
OLD | NEW |