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 | |
32 } // namespace | 27 } // namespace |
33 | 28 |
34 namespace content { | 29 namespace content { |
35 | 30 |
36 ServiceWorkerDispatcherHost::ServiceWorkerDispatcherHost( | 31 ServiceWorkerDispatcherHost::ServiceWorkerDispatcherHost( |
37 int render_process_id) | 32 int render_process_id) |
38 : BrowserMessageFilter( | 33 : render_process_id_(render_process_id) { |
39 kFilteredMessageClasses, arraysize(kFilteredMessageClasses)), | |
40 render_process_id_(render_process_id) { | |
41 } | 34 } |
42 | 35 |
43 ServiceWorkerDispatcherHost::~ServiceWorkerDispatcherHost() { | 36 ServiceWorkerDispatcherHost::~ServiceWorkerDispatcherHost() { |
44 if (context_) { | 37 if (context_) { |
45 context_->RemoveAllProviderHostsForProcess(render_process_id_); | 38 context_->RemoveAllProviderHostsForProcess(render_process_id_); |
46 context_->embedded_worker_registry()->RemoveChildProcessSender( | 39 context_->embedded_worker_registry()->RemoveChildProcessSender( |
47 render_process_id_); | 40 render_process_id_); |
48 } | 41 } |
49 } | 42 } |
50 | 43 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 ServiceWorkerStatusCode status) { | 225 ServiceWorkerStatusCode status) { |
233 base::string16 error_message; | 226 base::string16 error_message; |
234 blink::WebServiceWorkerError::ErrorType error_type; | 227 blink::WebServiceWorkerError::ErrorType error_type; |
235 GetServiceWorkerRegistrationStatusResponse( | 228 GetServiceWorkerRegistrationStatusResponse( |
236 status, &error_type, &error_message); | 229 status, &error_type, &error_message); |
237 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( | 230 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( |
238 thread_id, request_id, error_type, error_message)); | 231 thread_id, request_id, error_type, error_message)); |
239 } | 232 } |
240 | 233 |
241 } // namespace content | 234 } // namespace content |
OLD | NEW |