Chromium Code Reviews| 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/child_process_security_policy_impl.h" | 9 #include "content/browser/child_process_security_policy_impl.h" |
| 10 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 10 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 LoFiState lofi_state, | 142 LoFiState lofi_state, |
| 143 bool is_same_document_history_load, | 143 bool is_same_document_history_load, |
| 144 bool is_history_navigation_in_new_child, | 144 bool is_history_navigation_in_new_child, |
| 145 const base::TimeTicks& navigation_start, | 145 const base::TimeTicks& navigation_start, |
| 146 NavigationControllerImpl* controller) { | 146 NavigationControllerImpl* controller) { |
| 147 // Fill POST data in the request body. | 147 // Fill POST data in the request body. |
| 148 scoped_refptr<ResourceRequestBodyImpl> request_body; | 148 scoped_refptr<ResourceRequestBodyImpl> request_body; |
| 149 if (frame_entry.method() == "POST") | 149 if (frame_entry.method() == "POST") |
| 150 request_body = frame_entry.GetPostData(); | 150 request_body = frame_entry.GetPostData(); |
| 151 | 151 |
| 152 base::Optional<url::Origin> initiator = | |
| 153 frame_tree_node->IsMainFrame() | |
| 154 ? base::Optional<url::Origin>() | |
| 155 : base::Optional<url::Origin>( | |
| 156 frame_tree_node->frame_tree()->root()->current_origin()); | |
|
nasko
2016/11/18 19:49:15
Why have an initiator origin for browser-initiated
| |
| 152 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest( | 157 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest( |
| 153 frame_tree_node, entry.ConstructCommonNavigationParams( | 158 frame_tree_node, entry.ConstructCommonNavigationParams( |
| 154 frame_entry, request_body, dest_url, dest_referrer, | 159 frame_entry, request_body, dest_url, dest_referrer, |
| 155 navigation_type, lofi_state, navigation_start), | 160 navigation_type, lofi_state, navigation_start), |
| 156 BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL, | 161 BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL, |
| 157 false, // has_user_gestures | 162 false, // has_user_gestures |
| 158 false, // skip_service_worker | 163 false, // skip_service_worker |
| 159 REQUEST_CONTEXT_TYPE_LOCATION), | 164 REQUEST_CONTEXT_TYPE_LOCATION, initiator), |
| 160 entry.ConstructRequestNavigationParams( | 165 entry.ConstructRequestNavigationParams( |
| 161 frame_entry, is_same_document_history_load, | 166 frame_entry, is_same_document_history_load, |
| 162 is_history_navigation_in_new_child, | 167 is_history_navigation_in_new_child, |
| 163 entry.GetSubframeUniqueNames(frame_tree_node), | 168 entry.GetSubframeUniqueNames(frame_tree_node), |
| 164 frame_tree_node->has_committed_real_load(), | 169 frame_tree_node->has_committed_real_load(), |
| 165 controller->GetPendingEntryIndex() == -1, | 170 controller->GetPendingEntryIndex() == -1, |
| 166 controller->GetIndexOfEntry(&entry), | 171 controller->GetIndexOfEntry(&entry), |
| 167 controller->GetLastCommittedEntryIndex(), | 172 controller->GetLastCommittedEntryIndex(), |
| 168 controller->GetEntryCount()), | 173 controller->GetEntryCount()), |
| 169 true, &frame_entry, &entry)); | 174 true, &frame_entry, &entry)); |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 521 navigation_handle_->GetStartingSiteInstance()->GetSiteURL(). | 526 navigation_handle_->GetStartingSiteInstance()->GetSiteURL(). |
| 522 SchemeIs(kGuestScheme); | 527 SchemeIs(kGuestScheme); |
| 523 | 528 |
| 524 bool report_raw_headers = | 529 bool report_raw_headers = |
| 525 RenderFrameDevToolsAgentHost::IsNetworkHandlerEnabled(frame_tree_node_); | 530 RenderFrameDevToolsAgentHost::IsNetworkHandlerEnabled(frame_tree_node_); |
| 526 | 531 |
| 527 loader_ = NavigationURLLoader::Create( | 532 loader_ = NavigationURLLoader::Create( |
| 528 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), | 533 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), |
| 529 base::MakeUnique<NavigationRequestInfo>( | 534 base::MakeUnique<NavigationRequestInfo>( |
| 530 common_params_, begin_params_, first_party_for_cookies, | 535 common_params_, begin_params_, first_party_for_cookies, |
| 531 frame_tree_node_->current_origin(), frame_tree_node_->IsMainFrame(), | 536 frame_tree_node_->IsMainFrame(), parent_is_main_frame, |
| 532 parent_is_main_frame, IsSecureFrame(frame_tree_node_->parent()), | 537 IsSecureFrame(frame_tree_node_->parent()), |
| 533 frame_tree_node_->frame_tree_node_id(), is_for_guests_only, | 538 frame_tree_node_->frame_tree_node_id(), is_for_guests_only, |
| 534 report_raw_headers), | 539 report_raw_headers), |
| 535 std::move(navigation_ui_data), | 540 std::move(navigation_ui_data), |
| 536 navigation_handle_->service_worker_handle(), this); | 541 navigation_handle_->service_worker_handle(), this); |
| 537 } | 542 } |
| 538 | 543 |
| 539 void NavigationRequest::OnRedirectChecksComplete( | 544 void NavigationRequest::OnRedirectChecksComplete( |
| 540 NavigationThrottle::ThrottleCheckResult result) { | 545 NavigationThrottle::ThrottleCheckResult result) { |
| 541 CHECK(result != NavigationThrottle::DEFER); | 546 CHECK(result != NavigationThrottle::DEFER); |
| 542 | 547 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 589 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); | 594 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); |
| 590 | 595 |
| 591 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 596 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
| 592 common_params_, request_params_, | 597 common_params_, request_params_, |
| 593 is_view_source_); | 598 is_view_source_); |
| 594 | 599 |
| 595 frame_tree_node_->ResetNavigationRequest(true); | 600 frame_tree_node_->ResetNavigationRequest(true); |
| 596 } | 601 } |
| 597 | 602 |
| 598 } // namespace content | 603 } // namespace content |
| OLD | NEW |