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/storage_partition_impl.h" |
14 #include "content/common/resource_request_body.h" | 15 #include "content/common/resource_request_body.h" |
15 #include "content/common/service_worker/service_worker_types.h" | 16 #include "content/common/service_worker/service_worker_types.h" |
16 #include "content/common/service_worker/service_worker_utils.h" | 17 #include "content/common/service_worker/service_worker_utils.h" |
| 18 #include "content/public/browser/content_browser_client.h" |
17 #include "content/public/browser/resource_context.h" | 19 #include "content/public/browser/resource_context.h" |
18 #include "content/public/common/origin_util.h" | 20 #include "content/public/common/origin_util.h" |
19 #include "net/base/net_util.h" | 21 #include "net/base/net_util.h" |
20 #include "net/url_request/url_request.h" | 22 #include "net/url_request/url_request.h" |
21 #include "net/url_request/url_request_interceptor.h" | 23 #include "net/url_request/url_request_interceptor.h" |
22 #include "storage/browser/blob/blob_storage_context.h" | 24 #include "storage/browser/blob/blob_storage_context.h" |
23 | 25 |
24 namespace content { | 26 namespace content { |
25 | 27 |
26 namespace { | 28 namespace { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 int process_id, | 60 int process_id, |
59 int provider_id, | 61 int provider_id, |
60 bool skip_service_worker, | 62 bool skip_service_worker, |
61 FetchRequestMode request_mode, | 63 FetchRequestMode request_mode, |
62 FetchCredentialsMode credentials_mode, | 64 FetchCredentialsMode credentials_mode, |
63 FetchRedirectMode redirect_mode, | 65 FetchRedirectMode redirect_mode, |
64 ResourceType resource_type, | 66 ResourceType resource_type, |
65 RequestContextType request_context_type, | 67 RequestContextType request_context_type, |
66 RequestContextFrameType frame_type, | 68 RequestContextFrameType frame_type, |
67 scoped_refptr<ResourceRequestBody> body) { | 69 scoped_refptr<ResourceRequestBody> body) { |
| 70 BrowserContext* browser_context = |
| 71 context_wrapper->storage_partition() |
| 72 ? context_wrapper->storage_partition()->browser_context() |
| 73 : nullptr; |
| 74 |
68 // Create the handler even for insecure HTTP since it's used in the | 75 // Create the handler even for insecure HTTP since it's used in the |
69 // case of redirect to HTTPS. | 76 // case of redirect to HTTPS. |
70 if (!request->url().SchemeIsHTTPOrHTTPS() && | 77 if (!request->url().SchemeIsHTTPOrHTTPS() && |
71 !OriginCanAccessServiceWorkers(request->url())) { | 78 !OriginCanAccessServiceWorkers(request->url()) && |
| 79 !GetContentClient() |
| 80 ->browser() |
| 81 ->GetHandlerFor(browser_context, request->url()) |
| 82 .SchemeIsHTTPOrHTTPS()) { |
72 return; | 83 return; |
73 } | 84 } |
74 | 85 |
75 if (!context_wrapper || !context_wrapper->context() || | 86 if (!context_wrapper || !context_wrapper->context() || |
76 provider_id == kInvalidServiceWorkerProviderId) { | 87 provider_id == kInvalidServiceWorkerProviderId) { |
77 return; | 88 return; |
78 } | 89 } |
79 | 90 |
80 ServiceWorkerProviderHost* provider_host = | 91 ServiceWorkerProviderHost* provider_host = |
81 context_wrapper->context()->GetProviderHost(process_id, provider_id); | 92 context_wrapper->context()->GetProviderHost(process_id, provider_id); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 ResourceType resource_type) | 180 ResourceType resource_type) |
170 : context_(context), | 181 : context_(context), |
171 provider_host_(provider_host), | 182 provider_host_(provider_host), |
172 blob_storage_context_(blob_storage_context), | 183 blob_storage_context_(blob_storage_context), |
173 resource_type_(resource_type), | 184 resource_type_(resource_type), |
174 old_process_id_(0), | 185 old_process_id_(0), |
175 old_provider_id_(kInvalidServiceWorkerProviderId) { | 186 old_provider_id_(kInvalidServiceWorkerProviderId) { |
176 } | 187 } |
177 | 188 |
178 } // namespace content | 189 } // namespace content |
OLD | NEW |