Chromium Code Reviews| 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 = |
|
michaeln
2017/06/09 01:48:30
nice how this just slots in here
| |
| 171 AppCacheRequestHandler::InitializeForNavigationNetworkService( | |
| 172 *resource_request_, appcache_handle_core, | |
| 173 url_loader_factory_getter_.get()); | |
| 174 if (appcache_handler) | |
| 175 handlers_.push_back(std::move(appcache_handler)); | |
| 170 } | 176 } |
| 171 | 177 |
| 172 Restart(std::move(url_loader_request), std::move(url_loader_client_ptr_)); | 178 Restart(std::move(url_loader_request), std::move(url_loader_client_ptr_)); |
| 173 } | 179 } |
| 174 | 180 |
| 175 // This could be called multiple times. | 181 // This could be called multiple times. |
| 176 void Restart(mojom::URLLoaderRequest url_loader_request, | 182 void Restart(mojom::URLLoaderRequest url_loader_request, |
| 177 mojom::URLLoaderClientPtr url_loader_client_ptr) { | 183 mojom::URLLoaderClientPtr url_loader_client_ptr) { |
| 178 url_loader_request_ = std::move(url_loader_request); | 184 url_loader_request_ = std::move(url_loader_request); |
| 179 url_loader_client_ptr_ = std::move(url_loader_client_ptr); | 185 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", | 395 TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", |
| 390 this, "&NavigationURLLoaderNetworkService", this, | 396 this, "&NavigationURLLoaderNetworkService", this, |
| 391 "success", false); | 397 "success", false); |
| 392 | 398 |
| 393 delegate_->OnRequestFailed(completion_status.exists_in_cache, | 399 delegate_->OnRequestFailed(completion_status.exists_in_cache, |
| 394 completion_status.error_code); | 400 completion_status.error_code); |
| 395 } | 401 } |
| 396 } | 402 } |
| 397 | 403 |
| 398 } // namespace content | 404 } // namespace content |
| OLD | NEW |