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 const scoped_refptr<ServiceWorkerRegistration>& | 76 scoped_refptr<ServiceWorkerRegistration> service_worker_registration) { |
77 service_worker_registration) { | |
78 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 77 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
79 // TODO(mvanouwerkerk): UMA logging. | 78 // TODO(mvanouwerkerk): UMA logging. |
80 if (service_worker_status != SERVICE_WORKER_OK) { | 79 if (service_worker_status != SERVICE_WORKER_OK) { |
81 RunDeliverCallback(deliver_message_callback, | 80 RunDeliverCallback(deliver_message_callback, |
82 PUSH_DELIVERY_STATUS_NO_SERVICE_WORKER); | 81 PUSH_DELIVERY_STATUS_NO_SERVICE_WORKER); |
83 return; | 82 return; |
84 } | 83 } |
85 | 84 |
86 ServiceWorkerVersion* version = service_worker_registration->active_version(); | 85 ServiceWorkerVersion* version = service_worker_registration->active_version(); |
87 DCHECK(version); | 86 DCHECK(version); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 case SERVICE_WORKER_ERROR_MAX_VALUE: | 151 case SERVICE_WORKER_ERROR_MAX_VALUE: |
153 NOTREACHED() << "Got unexpected error code: " << service_worker_status | 152 NOTREACHED() << "Got unexpected error code: " << service_worker_status |
154 << " " << ServiceWorkerStatusToString(service_worker_status); | 153 << " " << ServiceWorkerStatusToString(service_worker_status); |
155 delivery_status = PUSH_DELIVERY_STATUS_SERVICE_WORKER_ERROR; | 154 delivery_status = PUSH_DELIVERY_STATUS_SERVICE_WORKER_ERROR; |
156 break; | 155 break; |
157 } | 156 } |
158 RunDeliverCallback(deliver_message_callback, delivery_status); | 157 RunDeliverCallback(deliver_message_callback, delivery_status); |
159 } | 158 } |
160 | 159 |
161 } // namespace content | 160 } // namespace content |
OLD | NEW |