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