| 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" |
| 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/browser/service_worker/service_worker_registration.h" | 12 #include "content/browser/service_worker/service_worker_registration.h" |
| 13 #include "content/browser/service_worker/service_worker_url_request_job.h" | 13 #include "content/browser/service_worker/service_worker_url_request_job.h" |
| 14 #include "content/browser/service_worker/service_worker_utils.h" | 14 #include "content/browser/service_worker/service_worker_utils.h" |
| 15 #include "content/common/resource_request_body.h" | 15 #include "content/common/resource_request_body.h" |
| 16 #include "content/common/service_worker/service_worker_types.h" | 16 #include "content/common/service_worker/service_worker_types.h" |
| 17 #include "content/public/browser/resource_context.h" | 17 #include "content/public/browser/resource_context.h" |
| 18 #include "content/public/common/origin_util.h" |
| 18 #include "net/base/net_util.h" | 19 #include "net/base/net_util.h" |
| 19 #include "net/url_request/url_request.h" | 20 #include "net/url_request/url_request.h" |
| 20 #include "net/url_request/url_request_interceptor.h" | 21 #include "net/url_request/url_request_interceptor.h" |
| 21 #include "storage/browser/blob/blob_storage_context.h" | 22 #include "storage/browser/blob/blob_storage_context.h" |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| 24 | 25 |
| 25 namespace { | 26 namespace { |
| 26 | 27 |
| 27 int kUserDataKey; // Key value is not important. | 28 int kUserDataKey; // Key value is not important. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 56 storage::BlobStorageContext* blob_storage_context, | 57 storage::BlobStorageContext* blob_storage_context, |
| 57 int process_id, | 58 int process_id, |
| 58 int provider_id, | 59 int provider_id, |
| 59 bool skip_service_worker, | 60 bool skip_service_worker, |
| 60 FetchRequestMode request_mode, | 61 FetchRequestMode request_mode, |
| 61 FetchCredentialsMode credentials_mode, | 62 FetchCredentialsMode credentials_mode, |
| 62 ResourceType resource_type, | 63 ResourceType resource_type, |
| 63 RequestContextType request_context_type, | 64 RequestContextType request_context_type, |
| 64 RequestContextFrameType frame_type, | 65 RequestContextFrameType frame_type, |
| 65 scoped_refptr<ResourceRequestBody> body) { | 66 scoped_refptr<ResourceRequestBody> body) { |
| 66 if (!request->url().SchemeIsHTTPOrHTTPS()) | 67 if (!OriginCanAccessServiceWorkers(request->url())) |
| 67 return; | 68 return; |
| 68 | 69 |
| 69 if (!context_wrapper || !context_wrapper->context() || | 70 if (!context_wrapper || !context_wrapper->context() || |
| 70 provider_id == kInvalidServiceWorkerProviderId) { | 71 provider_id == kInvalidServiceWorkerProviderId) { |
| 71 return; | 72 return; |
| 72 } | 73 } |
| 73 | 74 |
| 74 ServiceWorkerProviderHost* provider_host = | 75 ServiceWorkerProviderHost* provider_host = |
| 75 context_wrapper->context()->GetProviderHost(process_id, provider_id); | 76 context_wrapper->context()->GetProviderHost(process_id, provider_id); |
| 76 if (!provider_host || !provider_host->IsContextAlive()) | 77 if (!provider_host || !provider_host->IsContextAlive()) |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 ResourceType resource_type) | 167 ResourceType resource_type) |
| 167 : context_(context), | 168 : context_(context), |
| 168 provider_host_(provider_host), | 169 provider_host_(provider_host), |
| 169 blob_storage_context_(blob_storage_context), | 170 blob_storage_context_(blob_storage_context), |
| 170 resource_type_(resource_type), | 171 resource_type_(resource_type), |
| 171 old_process_id_(0), | 172 old_process_id_(0), |
| 172 old_provider_id_(kInvalidServiceWorkerProviderId) { | 173 old_provider_id_(kInvalidServiceWorkerProviderId) { |
| 173 } | 174 } |
| 174 | 175 |
| 175 } // namespace content | 176 } // namespace content |
| OLD | NEW |