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" |
11 #include "content/browser/service_worker/service_worker_provider_host.h" | 11 #include "content/browser/service_worker/service_worker_provider_host.h" |
12 #include "content/common/service_worker/embedded_worker_messages.h" | 12 #include "content/common/service_worker/embedded_worker_messages.h" |
13 #include "content/common/service_worker/service_worker_messages.h" | 13 #include "content/common/service_worker/service_worker_messages.h" |
14 #include "ipc/ipc_message_macros.h" | 14 #include "ipc/ipc_message_macros.h" |
15 #include "third_party/WebKit/public/platform/WebServiceWorkerError.h" | 15 #include "third_party/WebKit/public/platform/WebServiceWorkerError.h" |
16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
17 | 17 |
18 using blink::WebServiceWorkerError; | 18 using blink::WebServiceWorkerError; |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 const char kDisabledErrorMessage[] = | 22 const char kDisabledErrorMessage[] = |
23 "ServiceWorker is disabled"; | 23 "ServiceWorker is disabled"; |
24 const char kDomainMismatchErrorMessage[] = | 24 const char kDomainMismatchErrorMessage[] = |
25 "Scope and scripts do not have the same origin"; | 25 "Scope and scripts do not have the same origin"; |
26 | 26 |
| 27 const uint32 kFilteredMessageClasses[] = { |
| 28 ServiceWorkerMsgStart, |
| 29 EmbeddedWorkerMsgStart, |
| 30 }; |
| 31 |
27 } // namespace | 32 } // namespace |
28 | 33 |
29 namespace content { | 34 namespace content { |
30 | 35 |
31 ServiceWorkerDispatcherHost::ServiceWorkerDispatcherHost( | 36 ServiceWorkerDispatcherHost::ServiceWorkerDispatcherHost( |
32 int render_process_id) | 37 int render_process_id) |
33 : render_process_id_(render_process_id) { | 38 : BrowserMessageFilter( |
| 39 kFilteredMessageClasses, arraysize(kFilteredMessageClasses)), |
| 40 render_process_id_(render_process_id) { |
34 } | 41 } |
35 | 42 |
36 ServiceWorkerDispatcherHost::~ServiceWorkerDispatcherHost() { | 43 ServiceWorkerDispatcherHost::~ServiceWorkerDispatcherHost() { |
37 if (context_) { | 44 if (context_) { |
38 context_->RemoveAllProviderHostsForProcess(render_process_id_); | 45 context_->RemoveAllProviderHostsForProcess(render_process_id_); |
39 context_->embedded_worker_registry()->RemoveChildProcessSender( | 46 context_->embedded_worker_registry()->RemoveChildProcessSender( |
40 render_process_id_); | 47 render_process_id_); |
41 } | 48 } |
42 } | 49 } |
43 | 50 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 ServiceWorkerStatusCode status) { | 232 ServiceWorkerStatusCode status) { |
226 base::string16 error_message; | 233 base::string16 error_message; |
227 blink::WebServiceWorkerError::ErrorType error_type; | 234 blink::WebServiceWorkerError::ErrorType error_type; |
228 GetServiceWorkerRegistrationStatusResponse( | 235 GetServiceWorkerRegistrationStatusResponse( |
229 status, &error_type, &error_message); | 236 status, &error_type, &error_message); |
230 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( | 237 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( |
231 thread_id, request_id, error_type, error_message)); | 238 thread_id, request_id, error_type, error_message)); |
232 } | 239 } |
233 | 240 |
234 } // namespace content | 241 } // namespace content |
OLD | NEW |