| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 } // namespace | 142 } // namespace |
| 143 | 143 |
| 144 // static | 144 // static |
| 145 std::unique_ptr<NavigationRequest> NavigationRequest::CreateBrowserInitiated( | 145 std::unique_ptr<NavigationRequest> NavigationRequest::CreateBrowserInitiated( |
| 146 FrameTreeNode* frame_tree_node, | 146 FrameTreeNode* frame_tree_node, |
| 147 const GURL& dest_url, | 147 const GURL& dest_url, |
| 148 const Referrer& dest_referrer, | 148 const Referrer& dest_referrer, |
| 149 const FrameNavigationEntry& frame_entry, | 149 const FrameNavigationEntry& frame_entry, |
| 150 const NavigationEntryImpl& entry, | 150 const NavigationEntryImpl& entry, |
| 151 FrameMsg_Navigate_Type::Value navigation_type, | 151 FrameMsg_Navigate_Type::Value navigation_type, |
| 152 LoFiState lofi_state, | 152 PreviewsState previews_state, |
| 153 bool is_same_document_history_load, | 153 bool is_same_document_history_load, |
| 154 bool is_history_navigation_in_new_child, | 154 bool is_history_navigation_in_new_child, |
| 155 const base::TimeTicks& navigation_start, | 155 const base::TimeTicks& navigation_start, |
| 156 NavigationControllerImpl* controller) { | 156 NavigationControllerImpl* controller) { |
| 157 // Fill POST data in the request body. | 157 // Fill POST data in the request body. |
| 158 scoped_refptr<ResourceRequestBodyImpl> request_body; | 158 scoped_refptr<ResourceRequestBodyImpl> request_body; |
| 159 if (frame_entry.method() == "POST") | 159 if (frame_entry.method() == "POST") |
| 160 request_body = frame_entry.GetPostData(); | 160 request_body = frame_entry.GetPostData(); |
| 161 | 161 |
| 162 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest( | 162 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest( |
| 163 frame_tree_node, entry.ConstructCommonNavigationParams( | 163 frame_tree_node, entry.ConstructCommonNavigationParams( |
| 164 frame_entry, request_body, dest_url, dest_referrer, | 164 frame_entry, request_body, dest_url, dest_referrer, |
| 165 navigation_type, lofi_state, navigation_start), | 165 navigation_type, previews_state, navigation_start), |
| 166 BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL, | 166 BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL, |
| 167 false, // skip_service_worker | 167 false, // skip_service_worker |
| 168 REQUEST_CONTEXT_TYPE_LOCATION), | 168 REQUEST_CONTEXT_TYPE_LOCATION), |
| 169 entry.ConstructRequestNavigationParams( | 169 entry.ConstructRequestNavigationParams( |
| 170 frame_entry, is_same_document_history_load, | 170 frame_entry, is_same_document_history_load, |
| 171 is_history_navigation_in_new_child, | 171 is_history_navigation_in_new_child, |
| 172 entry.GetSubframeUniqueNames(frame_tree_node), | 172 entry.GetSubframeUniqueNames(frame_tree_node), |
| 173 frame_tree_node->has_committed_real_load(), | 173 frame_tree_node->has_committed_real_load(), |
| 174 controller->GetPendingEntryIndex() == -1, | 174 controller->GetPendingEntryIndex() == -1, |
| 175 controller->GetIndexOfEntry(&entry), | 175 controller->GetIndexOfEntry(&entry), |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 did_create_service_worker_host | 406 did_create_service_worker_host |
| 407 ? navigation_handle_->service_worker_handle() | 407 ? navigation_handle_->service_worker_handle() |
| 408 ->service_worker_provider_host_id() | 408 ->service_worker_provider_host_id() |
| 409 : kInvalidServiceWorkerProviderId; | 409 : kInvalidServiceWorkerProviderId; |
| 410 | 410 |
| 411 request_params_.appcache_host_id = | 411 request_params_.appcache_host_id = |
| 412 navigation_handle_->appcache_handle() | 412 navigation_handle_->appcache_handle() |
| 413 ? navigation_handle_->appcache_handle()->appcache_host_id() | 413 ? navigation_handle_->appcache_handle()->appcache_host_id() |
| 414 : kAppCacheNoHostId; | 414 : kAppCacheNoHostId; |
| 415 | 415 |
| 416 // Update the lofi state of the request. | 416 // Update the previews state of the request. |
| 417 if (response->head.is_using_lofi) | 417 common_params_.previews_state = response->head.previews_state; |
| 418 common_params_.lofi_state = LOFI_ON; | |
| 419 else | |
| 420 common_params_.lofi_state = LOFI_OFF; | |
| 421 | 418 |
| 422 // Select an appropriate renderer to commit the navigation. | 419 // Select an appropriate renderer to commit the navigation. |
| 423 RenderFrameHostImpl* render_frame_host = | 420 RenderFrameHostImpl* render_frame_host = |
| 424 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); | 421 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); |
| 425 NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(render_frame_host, | 422 NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(render_frame_host, |
| 426 common_params_.url); | 423 common_params_.url); |
| 427 | 424 |
| 428 // For renderer-initiated navigations that are set to commit in a different | 425 // For renderer-initiated navigations that are set to commit in a different |
| 429 // renderer, allow the embedder to cancel the transfer. | 426 // renderer, allow the embedder to cancel the transfer. |
| 430 if (!browser_initiated_ && | 427 if (!browser_initiated_ && |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 TransferNavigationHandleOwnership(render_frame_host); | 610 TransferNavigationHandleOwnership(render_frame_host); |
| 614 | 611 |
| 615 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 612 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
| 616 common_params_, request_params_, | 613 common_params_, request_params_, |
| 617 is_view_source_); | 614 is_view_source_); |
| 618 | 615 |
| 619 frame_tree_node_->ResetNavigationRequest(true); | 616 frame_tree_node_->ResetNavigationRequest(true); |
| 620 } | 617 } |
| 621 | 618 |
| 622 } // namespace content | 619 } // namespace content |
| OLD | NEW |