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 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "content/browser/loader/url_loader_request_handler.h" | 12 #include "content/browser/loader/url_loader_request_handler.h" |
13 #include "content/browser/service_worker/service_worker_context_core.h" | 13 #include "content/browser/service_worker/service_worker_context_core.h" |
14 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 14 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
15 #include "content/browser/service_worker/service_worker_navigation_handle_core.h " | 15 #include "content/browser/service_worker/service_worker_navigation_handle_core.h " |
16 #include "content/browser/service_worker/service_worker_provider_host.h" | 16 #include "content/browser/service_worker/service_worker_provider_host.h" |
17 #include "content/browser/service_worker/service_worker_registration.h" | 17 #include "content/browser/service_worker/service_worker_registration.h" |
18 #include "content/browser/service_worker/service_worker_url_request_job.h" | 18 #include "content/browser/service_worker/service_worker_url_request_job.h" |
19 #include "content/common/resource_request_body_impl.h" | 19 #include "content/common/resource_request_body_impl.h" |
20 #include "content/common/service_worker/service_worker_types.h" | 20 #include "content/common/service_worker/service_worker_types.h" |
21 #include "content/common/service_worker/service_worker_utils.h" | 21 #include "content/common/service_worker/service_worker_utils.h" |
22 #include "content/public/browser/resource_context.h" | 22 #include "content/public/browser/resource_context.h" |
23 #include "content/public/common/browser_side_navigation_policy.h" | 23 #include "content/public/common/browser_side_navigation_policy.h" |
24 #include "content/public/common/child_process_host.h" | 24 #include "content/public/common/child_process_host.h" |
25 #include "content/public/common/content_features.h" | |
25 #include "content/public/common/content_switches.h" | 26 #include "content/public/common/content_switches.h" |
26 #include "content/public/common/origin_util.h" | 27 #include "content/public/common/origin_util.h" |
27 #include "ipc/ipc_message.h" | 28 #include "ipc/ipc_message.h" |
28 #include "net/base/url_util.h" | 29 #include "net/base/url_util.h" |
29 #include "net/url_request/url_request.h" | 30 #include "net/url_request/url_request.h" |
30 #include "net/url_request/url_request_interceptor.h" | 31 #include "net/url_request/url_request_interceptor.h" |
31 #include "storage/browser/blob/blob_storage_context.h" | 32 #include "storage/browser/blob/blob_storage_context.h" |
32 | 33 |
33 namespace content { | 34 namespace content { |
34 | 35 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 ServiceWorkerNavigationHandleCore* navigation_handle_core, | 124 ServiceWorkerNavigationHandleCore* navigation_handle_core, |
124 storage::BlobStorageContext* blob_storage_context, | 125 storage::BlobStorageContext* blob_storage_context, |
125 bool skip_service_worker, | 126 bool skip_service_worker, |
126 ResourceType resource_type, | 127 ResourceType resource_type, |
127 RequestContextType request_context_type, | 128 RequestContextType request_context_type, |
128 RequestContextFrameType frame_type, | 129 RequestContextFrameType frame_type, |
129 bool is_parent_frame_secure, | 130 bool is_parent_frame_secure, |
130 scoped_refptr<ResourceRequestBodyImpl> body, | 131 scoped_refptr<ResourceRequestBodyImpl> body, |
131 const base::Callback<WebContents*(void)>& web_contents_getter) { | 132 const base::Callback<WebContents*(void)>& web_contents_getter) { |
132 DCHECK(IsBrowserSideNavigationEnabled() && | 133 DCHECK(IsBrowserSideNavigationEnabled() && |
133 base::CommandLine::ForCurrentProcess()->HasSwitch( | 134 base::FeatureList::IsEnabled(features::kNetworkService)); |
Alexei Svitkine (slow)
2017/06/29 13:58:24
NIt: Seems better to have these as separate DCHECK
jam
2017/06/30 17:21:18
since I'm just changing flag->feature, I'll leave
| |
134 switches::kEnableNetworkService)); | |
135 DCHECK(navigation_handle_core); | 135 DCHECK(navigation_handle_core); |
136 | 136 |
137 // Create the handler even for insecure HTTP since it's used in the | 137 // Create the handler even for insecure HTTP since it's used in the |
138 // case of redirect to HTTPS. | 138 // case of redirect to HTTPS. |
139 if (!resource_request.url.SchemeIsHTTPOrHTTPS() && | 139 if (!resource_request.url.SchemeIsHTTPOrHTTPS() && |
140 !OriginCanAccessServiceWorkers(resource_request.url)) { | 140 !OriginCanAccessServiceWorkers(resource_request.url)) { |
141 return nullptr; | 141 return nullptr; |
142 } | 142 } |
143 | 143 |
144 if (!navigation_handle_core->context_wrapper() || | 144 if (!navigation_handle_core->context_wrapper() || |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
295 ResourceType resource_type) | 295 ResourceType resource_type) |
296 : context_(context), | 296 : context_(context), |
297 provider_host_(provider_host), | 297 provider_host_(provider_host), |
298 blob_storage_context_(blob_storage_context), | 298 blob_storage_context_(blob_storage_context), |
299 resource_type_(resource_type), | 299 resource_type_(resource_type), |
300 old_process_id_(0), | 300 old_process_id_(0), |
301 old_provider_id_(kInvalidServiceWorkerProviderId) { | 301 old_provider_id_(kInvalidServiceWorkerProviderId) { |
302 } | 302 } |
303 | 303 |
304 } // namespace content | 304 } // namespace content |
OLD | NEW |