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, // has_user_gestures | 208 false, // has_user_gestures |
209 false, // skip_service_worker | 209 false, // skip_service_worker |
210 REQUEST_CONTEXT_TYPE_LOCATION), | 210 REQUEST_CONTEXT_TYPE_LOCATION), |
211 entry.ConstructRequestNavigationParams( | 211 entry.ConstructRequestNavigationParams( |
212 frame_entry, is_same_document_history_load, | 212 frame_entry, is_same_document_history_load, |
213 is_history_navigation_in_new_child, | 213 is_history_navigation_in_new_child, |
214 entry.GetSubframeUniqueNames(frame_tree_node), | 214 entry.GetSubframeUniqueNames(frame_tree_node), |
215 frame_tree_node->has_committed_real_load(), | 215 frame_tree_node->has_committed_real_load(), |
216 controller->GetPendingEntryIndex() == -1, | 216 controller->GetPendingEntryIndex() == -1, |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 did_create_service_worker_host | 450 did_create_service_worker_host |
451 ? navigation_handle_->service_worker_handle() | 451 ? navigation_handle_->service_worker_handle() |
452 ->service_worker_provider_host_id() | 452 ->service_worker_provider_host_id() |
453 : kInvalidServiceWorkerProviderId; | 453 : kInvalidServiceWorkerProviderId; |
454 | 454 |
455 request_params_.appcache_host_id = | 455 request_params_.appcache_host_id = |
456 navigation_handle_->appcache_handle() | 456 navigation_handle_->appcache_handle() |
457 ? navigation_handle_->appcache_handle()->appcache_host_id() | 457 ? navigation_handle_->appcache_handle()->appcache_host_id() |
458 : kAppCacheNoHostId; | 458 : kAppCacheNoHostId; |
459 | 459 |
460 // Update the lofi state of the request. | 460 // Update the previews state of the request. |
461 if (response->head.is_using_lofi) | 461 common_params_.previews_state = response->head.previews_state; |
462 common_params_.lofi_state = LOFI_ON; | |
463 else | |
464 common_params_.lofi_state = LOFI_OFF; | |
465 | 462 |
466 // Select an appropriate renderer to commit the navigation. | 463 // Select an appropriate renderer to commit the navigation. |
467 RenderFrameHostImpl* render_frame_host = | 464 RenderFrameHostImpl* render_frame_host = |
468 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); | 465 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); |
469 NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(render_frame_host, | 466 NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(render_frame_host, |
470 common_params_.url); | 467 common_params_.url); |
471 | 468 |
472 // For renderer-initiated navigations that are set to commit in a different | 469 // For renderer-initiated navigations that are set to commit in a different |
473 // renderer, allow the embedder to cancel the transfer. | 470 // renderer, allow the embedder to cancel the transfer. |
474 if (!browser_initiated_ && | 471 if (!browser_initiated_ && |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); | 656 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); |
660 | 657 |
661 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 658 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
662 common_params_, request_params_, | 659 common_params_, request_params_, |
663 is_view_source_); | 660 is_view_source_); |
664 | 661 |
665 frame_tree_node_->ResetNavigationRequest(true); | 662 frame_tree_node_->ResetNavigationRequest(true); |
666 } | 663 } |
667 | 664 |
668 } // namespace content | 665 } // namespace content |
OLD | NEW |