| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 service_worker_navigation_handle_core, blob_storage_context, | 124 service_worker_navigation_handle_core, blob_storage_context, |
| 124 request_info->begin_params.skip_service_worker, resource_type, | 125 request_info->begin_params.skip_service_worker, resource_type, |
| 125 request_info->begin_params.request_context_type, frame_type, | 126 request_info->begin_params.request_context_type, frame_type, |
| 126 request_info->are_ancestors_secure, | 127 request_info->are_ancestors_secure, |
| 127 request_info->common_params.post_data, web_contents_getter); | 128 request_info->common_params.post_data, web_contents_getter); |
| 128 if (service_worker_handler) | 129 if (service_worker_handler) |
| 129 handlers_.push_back(std::move(service_worker_handler)); | 130 handlers_.push_back(std::move(service_worker_handler)); |
| 130 } | 131 } |
| 131 | 132 |
| 132 if (appcache_handle_core) { | 133 if (appcache_handle_core) { |
| 133 // TODO: add appcache code here. | 134 std::unique_ptr<URLLoaderRequestHandler> appcache_handler = |
| 135 AppCacheRequestHandler::InitializeForNavigationNetworkService( |
| 136 *resource_request_, appcache_handle_core, |
| 137 url_loader_factory_getter_.get()); |
| 138 if (appcache_handler) |
| 139 handlers_.push_back(std::move(appcache_handler)); |
| 134 } | 140 } |
| 135 | 141 |
| 136 Restart(std::move(url_loader_request), std::move(url_loader_client_ptr)); | 142 Restart(std::move(url_loader_request), std::move(url_loader_client_ptr)); |
| 137 } | 143 } |
| 138 | 144 |
| 139 // This could be called multiple times. | 145 // This could be called multiple times. |
| 140 void Restart(mojom::URLLoaderAssociatedRequest url_loader_request, | 146 void Restart(mojom::URLLoaderAssociatedRequest url_loader_request, |
| 141 mojom::URLLoaderClientPtr url_loader_client_ptr) { | 147 mojom::URLLoaderClientPtr url_loader_client_ptr) { |
| 142 url_loader_request_ = std::move(url_loader_request); | 148 url_loader_request_ = std::move(url_loader_request); |
| 143 url_loader_client_ptr_ = std::move(url_loader_client_ptr); | 149 url_loader_client_ptr_ = std::move(url_loader_client_ptr); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", | 357 TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", |
| 352 this, "&NavigationURLLoaderNetworkService", this, | 358 this, "&NavigationURLLoaderNetworkService", this, |
| 353 "success", false); | 359 "success", false); |
| 354 | 360 |
| 355 delegate_->OnRequestFailed(completion_status.exists_in_cache, | 361 delegate_->OnRequestFailed(completion_status.exists_in_cache, |
| 356 completion_status.error_code); | 362 completion_status.error_code); |
| 357 } | 363 } |
| 358 } | 364 } |
| 359 | 365 |
| 360 } // namespace content | 366 } // namespace content |
| OLD | NEW |