| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_request_handler.h" | 5 #include "content/browser/service_worker/service_worker_request_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 int process_id, | 58 int process_id, |
| 59 int provider_id, | 59 int provider_id, |
| 60 bool skip_service_worker, | 60 bool skip_service_worker, |
| 61 FetchRequestMode request_mode, | 61 FetchRequestMode request_mode, |
| 62 FetchCredentialsMode credentials_mode, | 62 FetchCredentialsMode credentials_mode, |
| 63 FetchRedirectMode redirect_mode, | 63 FetchRedirectMode redirect_mode, |
| 64 ResourceType resource_type, | 64 ResourceType resource_type, |
| 65 RequestContextType request_context_type, | 65 RequestContextType request_context_type, |
| 66 RequestContextFrameType frame_type, | 66 RequestContextFrameType frame_type, |
| 67 scoped_refptr<ResourceRequestBody> body) { | 67 scoped_refptr<ResourceRequestBody> body) { |
| 68 if (!OriginCanAccessServiceWorkers(request->url())) | 68 // Create the handler even for insecure HTTP since it's used in the |
| 69 // case of redirect to HTTPS. |
| 70 if (!request->url().SchemeIsHTTPOrHTTPS() && |
| 71 !OriginCanAccessServiceWorkers(request->url())) { |
| 69 return; | 72 return; |
| 73 } |
| 70 | 74 |
| 71 if (!context_wrapper || !context_wrapper->context() || | 75 if (!context_wrapper || !context_wrapper->context() || |
| 72 provider_id == kInvalidServiceWorkerProviderId) { | 76 provider_id == kInvalidServiceWorkerProviderId) { |
| 73 return; | 77 return; |
| 74 } | 78 } |
| 75 | 79 |
| 76 ServiceWorkerProviderHost* provider_host = | 80 ServiceWorkerProviderHost* provider_host = |
| 77 context_wrapper->context()->GetProviderHost(process_id, provider_id); | 81 context_wrapper->context()->GetProviderHost(process_id, provider_id); |
| 78 if (!provider_host || !provider_host->IsContextAlive()) | 82 if (!provider_host || !provider_host->IsContextAlive()) |
| 79 return; | 83 return; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 ResourceType resource_type) | 169 ResourceType resource_type) |
| 166 : context_(context), | 170 : context_(context), |
| 167 provider_host_(provider_host), | 171 provider_host_(provider_host), |
| 168 blob_storage_context_(blob_storage_context), | 172 blob_storage_context_(blob_storage_context), |
| 169 resource_type_(resource_type), | 173 resource_type_(resource_type), |
| 170 old_process_id_(0), | 174 old_process_id_(0), |
| 171 old_provider_id_(kInvalidServiceWorkerProviderId) { | 175 old_provider_id_(kInvalidServiceWorkerProviderId) { |
| 172 } | 176 } |
| 173 | 177 |
| 174 } // namespace content | 178 } // namespace content |
| OLD | NEW |