| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 if (!context_->GetProviderHost(render_process_id_, provider_id)) { | 162 if (!context_->GetProviderHost(render_process_id_, provider_id)) { |
| 163 BadMessageReceived(); | 163 BadMessageReceived(); |
| 164 return; | 164 return; |
| 165 } | 165 } |
| 166 context_->RemoveProviderHost(render_process_id_, provider_id); | 166 context_->RemoveProviderHost(render_process_id_, provider_id); |
| 167 } | 167 } |
| 168 | 168 |
| 169 void ServiceWorkerDispatcherHost::RegistrationComplete( | 169 void ServiceWorkerDispatcherHost::RegistrationComplete( |
| 170 int32 thread_id, | 170 int32 thread_id, |
| 171 int32 request_id, | 171 int32 request_id, |
| 172 ServiceWorkerRegistrationStatus status, | 172 ServiceWorkerStatusCode status, |
| 173 int64 registration_id) { | 173 int64 registration_id) { |
| 174 if (status != REGISTRATION_OK) { | 174 if (status != SERVICE_WORKER_OK) { |
| 175 SendRegistrationError(thread_id, request_id, status); | 175 SendRegistrationError(thread_id, request_id, status); |
| 176 return; | 176 return; |
| 177 } | 177 } |
| 178 | 178 |
| 179 Send(new ServiceWorkerMsg_ServiceWorkerRegistered( | 179 Send(new ServiceWorkerMsg_ServiceWorkerRegistered( |
| 180 thread_id, request_id, registration_id)); | 180 thread_id, request_id, registration_id)); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void ServiceWorkerDispatcherHost::OnWorkerStarted( | 183 void ServiceWorkerDispatcherHost::OnWorkerStarted( |
| 184 int thread_id, int embedded_worker_id) { | 184 int thread_id, int embedded_worker_id) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 200 const IPC::Message& message) { | 200 const IPC::Message& message) { |
| 201 if (!context_) | 201 if (!context_) |
| 202 return; | 202 return; |
| 203 context_->embedded_worker_registry()->OnSendMessageToBrowser( | 203 context_->embedded_worker_registry()->OnSendMessageToBrowser( |
| 204 embedded_worker_id, message); | 204 embedded_worker_id, message); |
| 205 } | 205 } |
| 206 | 206 |
| 207 void ServiceWorkerDispatcherHost::UnregistrationComplete( | 207 void ServiceWorkerDispatcherHost::UnregistrationComplete( |
| 208 int32 thread_id, | 208 int32 thread_id, |
| 209 int32 request_id, | 209 int32 request_id, |
| 210 ServiceWorkerRegistrationStatus status) { | 210 ServiceWorkerStatusCode status) { |
| 211 if (status != REGISTRATION_OK) { | 211 if (status != SERVICE_WORKER_OK) { |
| 212 SendRegistrationError(thread_id, request_id, status); | 212 SendRegistrationError(thread_id, request_id, status); |
| 213 return; | 213 return; |
| 214 } | 214 } |
| 215 | 215 |
| 216 Send(new ServiceWorkerMsg_ServiceWorkerUnregistered(thread_id, request_id)); | 216 Send(new ServiceWorkerMsg_ServiceWorkerUnregistered(thread_id, request_id)); |
| 217 } | 217 } |
| 218 | 218 |
| 219 void ServiceWorkerDispatcherHost::SendRegistrationError( | 219 void ServiceWorkerDispatcherHost::SendRegistrationError( |
| 220 int32 thread_id, | 220 int32 thread_id, |
| 221 int32 request_id, | 221 int32 request_id, |
| 222 ServiceWorkerRegistrationStatus status) { | 222 ServiceWorkerStatusCode status) { |
| 223 base::string16 error_message; | 223 base::string16 error_message; |
| 224 blink::WebServiceWorkerError::ErrorType error_type; | 224 blink::WebServiceWorkerError::ErrorType error_type; |
| 225 GetServiceWorkerRegistrationStatusResponse( | 225 GetServiceWorkerRegistrationStatusResponse( |
| 226 status, &error_type, &error_message); | 226 status, &error_type, &error_message); |
| 227 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( | 227 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( |
| 228 thread_id, request_id, error_type, error_message)); | 228 thread_id, request_id, error_type, error_message)); |
| 229 } | 229 } |
| 230 | 230 |
| 231 } // namespace content | 231 } // namespace content |
| OLD | NEW |