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/frame_host/navigation_request.h" | 5 #include "content/browser/frame_host/navigation_request.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "content/browser/appcache/appcache_navigation_handle.h" | 9 #include "content/browser/appcache/appcache_navigation_handle.h" |
10 #include "content/browser/appcache/chrome_appcache_service.h" | 10 #include "content/browser/appcache/chrome_appcache_service.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 } // namespace | 183 } // namespace |
184 | 184 |
185 // static | 185 // static |
186 std::unique_ptr<NavigationRequest> NavigationRequest::CreateBrowserInitiated( | 186 std::unique_ptr<NavigationRequest> NavigationRequest::CreateBrowserInitiated( |
187 FrameTreeNode* frame_tree_node, | 187 FrameTreeNode* frame_tree_node, |
188 const GURL& dest_url, | 188 const GURL& dest_url, |
189 const Referrer& dest_referrer, | 189 const Referrer& dest_referrer, |
190 const FrameNavigationEntry& frame_entry, | 190 const FrameNavigationEntry& frame_entry, |
191 const NavigationEntryImpl& entry, | 191 const NavigationEntryImpl& entry, |
192 FrameMsg_Navigate_Type::Value navigation_type, | 192 FrameMsg_Navigate_Type::Value navigation_type, |
193 LoFiState lofi_state, | 193 PreviewsState previews_state, |
194 bool is_same_document_history_load, | 194 bool is_same_document_history_load, |
195 bool is_history_navigation_in_new_child, | 195 bool is_history_navigation_in_new_child, |
196 const base::TimeTicks& navigation_start, | 196 const base::TimeTicks& navigation_start, |
197 NavigationControllerImpl* controller) { | 197 NavigationControllerImpl* controller) { |
198 // Fill POST data in the request body. | 198 // Fill POST data in the request body. |
199 scoped_refptr<ResourceRequestBodyImpl> request_body; | 199 scoped_refptr<ResourceRequestBodyImpl> request_body; |
200 if (frame_entry.method() == "POST") | 200 if (frame_entry.method() == "POST") |
201 request_body = frame_entry.GetPostData(); | 201 request_body = frame_entry.GetPostData(); |
202 | 202 |
203 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest( | 203 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest( |
204 frame_tree_node, entry.ConstructCommonNavigationParams( | 204 frame_tree_node, entry.ConstructCommonNavigationParams( |
205 frame_entry, request_body, dest_url, dest_referrer, | 205 frame_entry, request_body, dest_url, dest_referrer, |
206 navigation_type, lofi_state, navigation_start), | 206 navigation_type, previews_state, navigation_start), |
207 BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL, | 207 BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL, |
208 false, // skip_service_worker | 208 false, // skip_service_worker |
209 REQUEST_CONTEXT_TYPE_LOCATION), | 209 REQUEST_CONTEXT_TYPE_LOCATION), |
210 entry.ConstructRequestNavigationParams( | 210 entry.ConstructRequestNavigationParams( |
211 frame_entry, is_same_document_history_load, | 211 frame_entry, is_same_document_history_load, |
212 is_history_navigation_in_new_child, | 212 is_history_navigation_in_new_child, |
213 entry.GetSubframeUniqueNames(frame_tree_node), | 213 entry.GetSubframeUniqueNames(frame_tree_node), |
214 frame_tree_node->has_committed_real_load(), | 214 frame_tree_node->has_committed_real_load(), |
215 controller->GetPendingEntryIndex() == -1, | 215 controller->GetPendingEntryIndex() == -1, |
216 controller->GetIndexOfEntry(&entry), | 216 controller->GetIndexOfEntry(&entry), |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 did_create_service_worker_host | 448 did_create_service_worker_host |
449 ? navigation_handle_->service_worker_handle() | 449 ? navigation_handle_->service_worker_handle() |
450 ->service_worker_provider_host_id() | 450 ->service_worker_provider_host_id() |
451 : kInvalidServiceWorkerProviderId; | 451 : kInvalidServiceWorkerProviderId; |
452 | 452 |
453 request_params_.appcache_host_id = | 453 request_params_.appcache_host_id = |
454 navigation_handle_->appcache_handle() | 454 navigation_handle_->appcache_handle() |
455 ? navigation_handle_->appcache_handle()->appcache_host_id() | 455 ? navigation_handle_->appcache_handle()->appcache_host_id() |
456 : kAppCacheNoHostId; | 456 : kAppCacheNoHostId; |
457 | 457 |
458 // Update the lofi state of the request. | 458 // Update the previews state of the request. |
459 if (response->head.is_using_lofi) | 459 common_params_.previews_state = response->head.previews_state; |
460 common_params_.lofi_state = LOFI_ON; | |
461 else | |
462 common_params_.lofi_state = LOFI_OFF; | |
463 | 460 |
464 // Select an appropriate renderer to commit the navigation. | 461 // Select an appropriate renderer to commit the navigation. |
465 RenderFrameHostImpl* render_frame_host = | 462 RenderFrameHostImpl* render_frame_host = |
466 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); | 463 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); |
467 NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(render_frame_host, | 464 NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(render_frame_host, |
468 common_params_.url); | 465 common_params_.url); |
469 | 466 |
470 // For renderer-initiated navigations that are set to commit in a different | 467 // For renderer-initiated navigations that are set to commit in a different |
471 // renderer, allow the embedder to cancel the transfer. | 468 // renderer, allow the embedder to cancel the transfer. |
472 if (!browser_initiated_ && | 469 if (!browser_initiated_ && |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 TransferNavigationHandleOwnership(render_frame_host); | 652 TransferNavigationHandleOwnership(render_frame_host); |
656 | 653 |
657 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 654 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
658 common_params_, request_params_, | 655 common_params_, request_params_, |
659 is_view_source_); | 656 is_view_source_); |
660 | 657 |
661 frame_tree_node_->ResetNavigationRequest(true); | 658 frame_tree_node_->ResetNavigationRequest(true); |
662 } | 659 } |
663 | 660 |
664 } // namespace content | 661 } // namespace content |
OLD | NEW |