Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Side by Side Diff: content/browser/service_worker/service_worker_dispatcher_host.cc

Issue 289963002: Use new WebServiceWorkerError::ErrorType names. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_registration_status.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "content/browser/message_port_message_filter.h" 9 #include "content/browser/message_port_message_filter.h"
10 #include "content/browser/message_port_service.h" 10 #include "content/browser/message_port_service.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 void ServiceWorkerDispatcherHost::OnRegisterServiceWorker( 150 void ServiceWorkerDispatcherHost::OnRegisterServiceWorker(
151 int thread_id, 151 int thread_id,
152 int request_id, 152 int request_id,
153 int provider_id, 153 int provider_id,
154 const GURL& pattern, 154 const GURL& pattern,
155 const GURL& script_url) { 155 const GURL& script_url) {
156 if (!context_ || !ServiceWorkerUtils::IsFeatureEnabled()) { 156 if (!context_ || !ServiceWorkerUtils::IsFeatureEnabled()) {
157 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( 157 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError(
158 thread_id, 158 thread_id,
159 request_id, 159 request_id,
160 WebServiceWorkerError::DisabledError, 160 WebServiceWorkerError::ErrorTypeDisabled,
161 base::ASCIIToUTF16(kDisabledErrorMessage))); 161 base::ASCIIToUTF16(kDisabledErrorMessage)));
162 return; 162 return;
163 } 163 }
164 164
165 // TODO(alecflett): This check is insufficient for release. Add a 165 // TODO(alecflett): This check is insufficient for release. Add a
166 // ServiceWorker-specific policy query in 166 // ServiceWorker-specific policy query in
167 // ChildProcessSecurityImpl. See http://crbug.com/311631. 167 // ChildProcessSecurityImpl. See http://crbug.com/311631.
168 if (pattern.GetOrigin() != script_url.GetOrigin()) { 168 if (pattern.GetOrigin() != script_url.GetOrigin()) {
169 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( 169 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError(
170 thread_id, 170 thread_id,
171 request_id, 171 request_id,
172 WebServiceWorkerError::SecurityError, 172 WebServiceWorkerError::ErrorTypeSecurity,
173 base::ASCIIToUTF16(kDomainMismatchErrorMessage))); 173 base::ASCIIToUTF16(kDomainMismatchErrorMessage)));
174 return; 174 return;
175 } 175 }
176 176
177 ServiceWorkerProviderHost* provider_host = context_->GetProviderHost( 177 ServiceWorkerProviderHost* provider_host = context_->GetProviderHost(
178 render_process_id_, provider_id); 178 render_process_id_, provider_id);
179 if (!provider_host) { 179 if (!provider_host) {
180 BadMessageReceived(); 180 BadMessageReceived();
181 return; 181 return;
182 } 182 }
(...skipping 14 matching lines...) Expand all
197 int request_id, 197 int request_id,
198 int provider_id, 198 int provider_id,
199 const GURL& pattern) { 199 const GURL& pattern) {
200 // TODO(alecflett): This check is insufficient for release. Add a 200 // TODO(alecflett): This check is insufficient for release. Add a
201 // ServiceWorker-specific policy query in 201 // ServiceWorker-specific policy query in
202 // ChildProcessSecurityImpl. See http://crbug.com/311631. 202 // ChildProcessSecurityImpl. See http://crbug.com/311631.
203 if (!context_ || !ServiceWorkerUtils::IsFeatureEnabled()) { 203 if (!context_ || !ServiceWorkerUtils::IsFeatureEnabled()) {
204 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( 204 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError(
205 thread_id, 205 thread_id,
206 request_id, 206 request_id,
207 blink::WebServiceWorkerError::DisabledError, 207 blink::WebServiceWorkerError::ErrorTypeDisabled,
208 base::ASCIIToUTF16(kDisabledErrorMessage))); 208 base::ASCIIToUTF16(kDisabledErrorMessage)));
209 return; 209 return;
210 } 210 }
211 211
212 ServiceWorkerProviderHost* provider_host = context_->GetProviderHost( 212 ServiceWorkerProviderHost* provider_host = context_->GetProviderHost(
213 render_process_id_, provider_id); 213 render_process_id_, provider_id);
214 if (!provider_host) { 214 if (!provider_host) {
215 BadMessageReceived(); 215 BadMessageReceived();
216 return; 216 return;
217 } 217 }
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 ServiceWorkerStatusCode status) { 405 ServiceWorkerStatusCode status) {
406 base::string16 error_message; 406 base::string16 error_message;
407 blink::WebServiceWorkerError::ErrorType error_type; 407 blink::WebServiceWorkerError::ErrorType error_type;
408 GetServiceWorkerRegistrationStatusResponse( 408 GetServiceWorkerRegistrationStatusResponse(
409 status, &error_type, &error_message); 409 status, &error_type, &error_message);
410 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( 410 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError(
411 thread_id, request_id, error_type, error_message)); 411 thread_id, request_id, error_type, error_message));
412 } 412 }
413 413
414 } // namespace content 414 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_registration_status.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698