OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/loader/navigation_url_loader_network_service.h" | 5 #include "content/browser/loader/navigation_url_loader_network_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
11 #include "content/browser/appcache/appcache_navigation_handle.h" | 11 #include "content/browser/appcache/appcache_navigation_handle.h" |
| 12 #include "content/browser/appcache/appcache_request_handler.h" |
12 #include "content/browser/blob_storage/chrome_blob_storage_context.h" | 13 #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
13 #include "content/browser/frame_host/frame_tree_node.h" | 14 #include "content/browser/frame_host/frame_tree_node.h" |
14 #include "content/browser/frame_host/navigation_request_info.h" | 15 #include "content/browser/frame_host/navigation_request_info.h" |
15 #include "content/browser/loader/navigation_resource_handler.h" | 16 #include "content/browser/loader/navigation_resource_handler.h" |
16 #include "content/browser/loader/navigation_resource_throttle.h" | 17 #include "content/browser/loader/navigation_resource_throttle.h" |
17 #include "content/browser/loader/navigation_url_loader_delegate.h" | 18 #include "content/browser/loader/navigation_url_loader_delegate.h" |
18 #include "content/browser/loader/url_loader_request_handler.h" | 19 #include "content/browser/loader/url_loader_request_handler.h" |
19 #include "content/browser/resource_context_impl.h" | 20 #include "content/browser/resource_context_impl.h" |
20 #include "content/browser/service_worker/service_worker_navigation_handle.h" | 21 #include "content/browser/service_worker/service_worker_navigation_handle.h" |
21 #include "content/browser/service_worker/service_worker_navigation_handle_core.h
" | 22 #include "content/browser/service_worker/service_worker_navigation_handle_core.h
" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 service_worker_navigation_handle_core, blob_storage_context, | 160 service_worker_navigation_handle_core, blob_storage_context, |
160 request_info->begin_params.skip_service_worker, resource_type, | 161 request_info->begin_params.skip_service_worker, resource_type, |
161 request_info->begin_params.request_context_type, frame_type, | 162 request_info->begin_params.request_context_type, frame_type, |
162 request_info->are_ancestors_secure, | 163 request_info->are_ancestors_secure, |
163 request_info->common_params.post_data, web_contents_getter); | 164 request_info->common_params.post_data, web_contents_getter); |
164 if (service_worker_handler) | 165 if (service_worker_handler) |
165 handlers_.push_back(std::move(service_worker_handler)); | 166 handlers_.push_back(std::move(service_worker_handler)); |
166 } | 167 } |
167 | 168 |
168 if (appcache_handle_core) { | 169 if (appcache_handle_core) { |
169 // TODO: add appcache code here. | 170 std::unique_ptr<URLLoaderRequestHandler> appcache_handler = |
| 171 AppCacheRequestHandler::InitializeForNavigationNetworkService( |
| 172 *resource_request_, appcache_handle_core); |
| 173 if (appcache_handler) |
| 174 handlers_.push_back(std::move(appcache_handler)); |
170 } | 175 } |
171 | 176 |
172 Restart(std::move(url_loader_request), std::move(url_loader_client_ptr_)); | 177 Restart(std::move(url_loader_request), std::move(url_loader_client_ptr_)); |
173 } | 178 } |
174 | 179 |
175 // This could be called multiple times. | 180 // This could be called multiple times. |
176 void Restart(mojom::URLLoaderRequest url_loader_request, | 181 void Restart(mojom::URLLoaderRequest url_loader_request, |
177 mojom::URLLoaderClientPtr url_loader_client_ptr) { | 182 mojom::URLLoaderClientPtr url_loader_client_ptr) { |
178 url_loader_request_ = std::move(url_loader_request); | 183 url_loader_request_ = std::move(url_loader_request); |
179 url_loader_client_ptr_ = std::move(url_loader_client_ptr); | 184 url_loader_client_ptr_ = std::move(url_loader_client_ptr); |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", | 394 TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", |
390 this, "&NavigationURLLoaderNetworkService", this, | 395 this, "&NavigationURLLoaderNetworkService", this, |
391 "success", false); | 396 "success", false); |
392 | 397 |
393 delegate_->OnRequestFailed(completion_status.exists_in_cache, | 398 delegate_->OnRequestFailed(completion_status.exists_in_cache, |
394 completion_status.error_code); | 399 completion_status.error_code); |
395 } | 400 } |
396 } | 401 } |
397 | 402 |
398 } // namespace content | 403 } // namespace content |
OLD | NEW |