| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/service_worker/service_worker_dispatcher_host.h" | 5 #include "content/browser/service_worker/service_worker_dispatcher_host.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "content/browser/service_worker/embedded_worker_registry.h" | 8 #include "content/browser/service_worker/embedded_worker_registry.h" |
| 9 #include "content/browser/service_worker/service_worker_context_core.h" | 9 #include "content/browser/service_worker/service_worker_context_core.h" |
| 10 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 10 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 190 |
| 191 void ServiceWorkerDispatcherHost::OnWorkerStopped(int embedded_worker_id) { | 191 void ServiceWorkerDispatcherHost::OnWorkerStopped(int embedded_worker_id) { |
| 192 if (!context_) | 192 if (!context_) |
| 193 return; | 193 return; |
| 194 context_->embedded_worker_registry()->OnWorkerStopped( | 194 context_->embedded_worker_registry()->OnWorkerStopped( |
| 195 render_process_id_, embedded_worker_id); | 195 render_process_id_, embedded_worker_id); |
| 196 } | 196 } |
| 197 | 197 |
| 198 void ServiceWorkerDispatcherHost::OnSendMessageToBrowser( | 198 void ServiceWorkerDispatcherHost::OnSendMessageToBrowser( |
| 199 int embedded_worker_id, | 199 int embedded_worker_id, |
| 200 int request_id, |
| 200 const IPC::Message& message) { | 201 const IPC::Message& message) { |
| 201 if (!context_) | 202 if (!context_) |
| 202 return; | 203 return; |
| 203 context_->embedded_worker_registry()->OnSendMessageToBrowser( | 204 context_->embedded_worker_registry()->OnSendMessageToBrowser( |
| 204 embedded_worker_id, message); | 205 embedded_worker_id, request_id, message); |
| 205 } | 206 } |
| 206 | 207 |
| 207 void ServiceWorkerDispatcherHost::UnregistrationComplete( | 208 void ServiceWorkerDispatcherHost::UnregistrationComplete( |
| 208 int32 thread_id, | 209 int32 thread_id, |
| 209 int32 request_id, | 210 int32 request_id, |
| 210 ServiceWorkerStatusCode status) { | 211 ServiceWorkerStatusCode status) { |
| 211 if (status != SERVICE_WORKER_OK) { | 212 if (status != SERVICE_WORKER_OK) { |
| 212 SendRegistrationError(thread_id, request_id, status); | 213 SendRegistrationError(thread_id, request_id, status); |
| 213 return; | 214 return; |
| 214 } | 215 } |
| 215 | 216 |
| 216 Send(new ServiceWorkerMsg_ServiceWorkerUnregistered(thread_id, request_id)); | 217 Send(new ServiceWorkerMsg_ServiceWorkerUnregistered(thread_id, request_id)); |
| 217 } | 218 } |
| 218 | 219 |
| 219 void ServiceWorkerDispatcherHost::SendRegistrationError( | 220 void ServiceWorkerDispatcherHost::SendRegistrationError( |
| 220 int32 thread_id, | 221 int32 thread_id, |
| 221 int32 request_id, | 222 int32 request_id, |
| 222 ServiceWorkerStatusCode status) { | 223 ServiceWorkerStatusCode status) { |
| 223 base::string16 error_message; | 224 base::string16 error_message; |
| 224 blink::WebServiceWorkerError::ErrorType error_type; | 225 blink::WebServiceWorkerError::ErrorType error_type; |
| 225 GetServiceWorkerRegistrationStatusResponse( | 226 GetServiceWorkerRegistrationStatusResponse( |
| 226 status, &error_type, &error_message); | 227 status, &error_type, &error_message); |
| 227 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( | 228 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( |
| 228 thread_id, request_id, error_type, error_message)); | 229 thread_id, request_id, error_type, error_message)); |
| 229 } | 230 } |
| 230 | 231 |
| 231 } // namespace content | 232 } // namespace content |
| OLD | NEW |