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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 LoFiState lofi_state, | 152 LoFiState lofi_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 base::Optional<url::Origin> initiator = |
| 163 frame_tree_node->IsMainFrame() |
| 164 ? base::Optional<url::Origin>() |
| 165 : base::Optional<url::Origin>( |
| 166 frame_tree_node->frame_tree()->root()->current_origin()); |
162 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest( | 167 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest( |
163 frame_tree_node, entry.ConstructCommonNavigationParams( | 168 frame_tree_node, entry.ConstructCommonNavigationParams( |
164 frame_entry, request_body, dest_url, dest_referrer, | 169 frame_entry, request_body, dest_url, dest_referrer, |
165 navigation_type, lofi_state, navigation_start), | 170 navigation_type, lofi_state, navigation_start), |
166 BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL, | 171 BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL, |
167 false, // skip_service_worker | 172 false, // skip_service_worker |
168 REQUEST_CONTEXT_TYPE_LOCATION), | 173 REQUEST_CONTEXT_TYPE_LOCATION, initiator), |
169 entry.ConstructRequestNavigationParams( | 174 entry.ConstructRequestNavigationParams( |
170 frame_entry, is_same_document_history_load, | 175 frame_entry, is_same_document_history_load, |
171 is_history_navigation_in_new_child, | 176 is_history_navigation_in_new_child, |
172 entry.GetSubframeUniqueNames(frame_tree_node), | 177 entry.GetSubframeUniqueNames(frame_tree_node), |
173 frame_tree_node->has_committed_real_load(), | 178 frame_tree_node->has_committed_real_load(), |
174 controller->GetPendingEntryIndex() == -1, | 179 controller->GetPendingEntryIndex() == -1, |
175 controller->GetIndexOfEntry(&entry), | 180 controller->GetIndexOfEntry(&entry), |
176 controller->GetLastCommittedEntryIndex(), | 181 controller->GetLastCommittedEntryIndex(), |
177 controller->GetEntryCount()), | 182 controller->GetEntryCount()), |
178 true, &frame_entry, &entry)); | 183 true, &frame_entry, &entry)); |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 navigation_handle_->GetStartingSiteInstance()->GetSiteURL(). | 551 navigation_handle_->GetStartingSiteInstance()->GetSiteURL(). |
547 SchemeIs(kGuestScheme); | 552 SchemeIs(kGuestScheme); |
548 | 553 |
549 bool report_raw_headers = | 554 bool report_raw_headers = |
550 RenderFrameDevToolsAgentHost::IsNetworkHandlerEnabled(frame_tree_node_); | 555 RenderFrameDevToolsAgentHost::IsNetworkHandlerEnabled(frame_tree_node_); |
551 | 556 |
552 loader_ = NavigationURLLoader::Create( | 557 loader_ = NavigationURLLoader::Create( |
553 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), | 558 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), |
554 base::MakeUnique<NavigationRequestInfo>( | 559 base::MakeUnique<NavigationRequestInfo>( |
555 common_params_, begin_params_, first_party_for_cookies, | 560 common_params_, begin_params_, first_party_for_cookies, |
556 frame_tree_node_->current_origin(), frame_tree_node_->IsMainFrame(), | 561 frame_tree_node_->IsMainFrame(), parent_is_main_frame, |
557 parent_is_main_frame, IsSecureFrame(frame_tree_node_->parent()), | 562 IsSecureFrame(frame_tree_node_->parent()), |
558 frame_tree_node_->frame_tree_node_id(), is_for_guests_only, | 563 frame_tree_node_->frame_tree_node_id(), is_for_guests_only, |
559 report_raw_headers), | 564 report_raw_headers), |
560 std::move(navigation_ui_data), | 565 std::move(navigation_ui_data), |
561 navigation_handle_->service_worker_handle(), | 566 navigation_handle_->service_worker_handle(), |
562 navigation_handle_->appcache_handle(), this); | 567 navigation_handle_->appcache_handle(), this); |
563 } | 568 } |
564 | 569 |
565 void NavigationRequest::OnRedirectChecksComplete( | 570 void NavigationRequest::OnRedirectChecksComplete( |
566 NavigationThrottle::ThrottleCheckResult result) { | 571 NavigationThrottle::ThrottleCheckResult result) { |
567 CHECK(result != NavigationThrottle::DEFER); | 572 CHECK(result != NavigationThrottle::DEFER); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 TransferNavigationHandleOwnership(render_frame_host); | 618 TransferNavigationHandleOwnership(render_frame_host); |
614 | 619 |
615 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 620 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
616 common_params_, request_params_, | 621 common_params_, request_params_, |
617 is_view_source_); | 622 is_view_source_); |
618 | 623 |
619 frame_tree_node_->ResetNavigationRequest(true); | 624 frame_tree_node_->ResetNavigationRequest(true); |
620 } | 625 } |
621 | 626 |
622 } // namespace content | 627 } // namespace content |
OLD | NEW |