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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 thread_id, | 107 thread_id, |
108 request_id, | 108 request_id, |
109 WebServiceWorkerError::SecurityError, | 109 WebServiceWorkerError::SecurityError, |
110 base::ASCIIToUTF16(kDomainMismatchErrorMessage))); | 110 base::ASCIIToUTF16(kDomainMismatchErrorMessage))); |
111 return; | 111 return; |
112 } | 112 } |
113 | 113 |
114 context_->RegisterServiceWorker( | 114 context_->RegisterServiceWorker( |
115 pattern, | 115 pattern, |
116 script_url, | 116 script_url, |
117 render_process_id_, | |
118 base::Bind(&ServiceWorkerDispatcherHost::RegistrationComplete, | 117 base::Bind(&ServiceWorkerDispatcherHost::RegistrationComplete, |
119 this, | 118 this, |
120 thread_id, | 119 thread_id, |
121 request_id)); | 120 request_id)); |
122 } | 121 } |
123 | 122 |
124 void ServiceWorkerDispatcherHost::OnUnregisterServiceWorker( | 123 void ServiceWorkerDispatcherHost::OnUnregisterServiceWorker( |
125 int32 thread_id, | 124 int32 thread_id, |
126 int32 request_id, | 125 int32 request_id, |
127 const GURL& pattern) { | 126 const GURL& pattern) { |
128 // TODO(alecflett): This check is insufficient for release. Add a | 127 // TODO(alecflett): This check is insufficient for release. Add a |
129 // ServiceWorker-specific policy query in | 128 // ServiceWorker-specific policy query in |
130 // ChildProcessSecurityImpl. See http://crbug.com/311631. | 129 // ChildProcessSecurityImpl. See http://crbug.com/311631. |
131 if (!context_ || !context_->IsEnabled()) { | 130 if (!context_ || !context_->IsEnabled()) { |
132 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( | 131 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( |
133 thread_id, | 132 thread_id, |
134 request_id, | 133 request_id, |
135 blink::WebServiceWorkerError::DisabledError, | 134 blink::WebServiceWorkerError::DisabledError, |
136 base::ASCIIToUTF16(kDisabledErrorMessage))); | 135 base::ASCIIToUTF16(kDisabledErrorMessage))); |
137 return; | 136 return; |
138 } | 137 } |
139 | 138 |
140 context_->UnregisterServiceWorker( | 139 context_->UnregisterServiceWorker( |
141 pattern, | 140 pattern, |
142 render_process_id_, | |
143 base::Bind(&ServiceWorkerDispatcherHost::UnregistrationComplete, | 141 base::Bind(&ServiceWorkerDispatcherHost::UnregistrationComplete, |
144 this, | 142 this, |
145 thread_id, | 143 thread_id, |
146 request_id)); | 144 request_id)); |
147 } | 145 } |
148 | 146 |
149 void ServiceWorkerDispatcherHost::OnProviderCreated(int provider_id) { | 147 void ServiceWorkerDispatcherHost::OnProviderCreated(int provider_id) { |
150 if (!context_) | 148 if (!context_) |
151 return; | 149 return; |
152 if (context_->GetProviderHost(render_process_id_, provider_id)) { | 150 if (context_->GetProviderHost(render_process_id_, provider_id)) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 ServiceWorkerStatusCode status) { | 223 ServiceWorkerStatusCode status) { |
226 base::string16 error_message; | 224 base::string16 error_message; |
227 blink::WebServiceWorkerError::ErrorType error_type; | 225 blink::WebServiceWorkerError::ErrorType error_type; |
228 GetServiceWorkerRegistrationStatusResponse( | 226 GetServiceWorkerRegistrationStatusResponse( |
229 status, &error_type, &error_message); | 227 status, &error_type, &error_message); |
230 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( | 228 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( |
231 thread_id, request_id, error_type, error_message)); | 229 thread_id, request_id, error_type, error_message)); |
232 } | 230 } |
233 | 231 |
234 } // namespace content | 232 } // namespace content |
OLD | NEW |