Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1881)

Side by Side Diff: content/browser/frame_host/navigation_request.cc

Issue 2099243002: PlzNavigate: properly set the initiator of the navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 LoFiState lofi_state, 193 LoFiState lofi_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 base::Optional<url::Origin> initiator =
204 frame_tree_node->IsMainFrame()
205 ? base::Optional<url::Origin>()
206 : base::Optional<url::Origin>(
207 frame_tree_node->frame_tree()->root()->current_origin());
203 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest( 208 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest(
204 frame_tree_node, entry.ConstructCommonNavigationParams( 209 frame_tree_node, entry.ConstructCommonNavigationParams(
205 frame_entry, request_body, dest_url, dest_referrer, 210 frame_entry, request_body, dest_url, dest_referrer,
206 navigation_type, lofi_state, navigation_start), 211 navigation_type, lofi_state, navigation_start),
207 BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL, 212 BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL,
208 false, // has_user_gestures 213 false, // has_user_gestures
209 false, // skip_service_worker 214 false, // skip_service_worker
210 REQUEST_CONTEXT_TYPE_LOCATION), 215 REQUEST_CONTEXT_TYPE_LOCATION, initiator),
211 entry.ConstructRequestNavigationParams( 216 entry.ConstructRequestNavigationParams(
212 frame_entry, is_same_document_history_load, 217 frame_entry, is_same_document_history_load,
213 is_history_navigation_in_new_child, 218 is_history_navigation_in_new_child,
214 entry.GetSubframeUniqueNames(frame_tree_node), 219 entry.GetSubframeUniqueNames(frame_tree_node),
215 frame_tree_node->has_committed_real_load(), 220 frame_tree_node->has_committed_real_load(),
216 controller->GetPendingEntryIndex() == -1, 221 controller->GetPendingEntryIndex() == -1,
217 controller->GetIndexOfEntry(&entry), 222 controller->GetIndexOfEntry(&entry),
218 controller->GetLastCommittedEntryIndex(), 223 controller->GetLastCommittedEntryIndex(),
219 controller->GetEntryCount()), 224 controller->GetEntryCount()),
220 true, &frame_entry, &entry)); 225 true, &frame_entry, &entry));
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 navigation_handle_->GetStartingSiteInstance()->GetSiteURL(). 598 navigation_handle_->GetStartingSiteInstance()->GetSiteURL().
594 SchemeIs(kGuestScheme); 599 SchemeIs(kGuestScheme);
595 600
596 bool report_raw_headers = 601 bool report_raw_headers =
597 RenderFrameDevToolsAgentHost::IsNetworkHandlerEnabled(frame_tree_node_); 602 RenderFrameDevToolsAgentHost::IsNetworkHandlerEnabled(frame_tree_node_);
598 603
599 loader_ = NavigationURLLoader::Create( 604 loader_ = NavigationURLLoader::Create(
600 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), 605 frame_tree_node_->navigator()->GetController()->GetBrowserContext(),
601 base::MakeUnique<NavigationRequestInfo>( 606 base::MakeUnique<NavigationRequestInfo>(
602 common_params_, begin_params_, first_party_for_cookies, 607 common_params_, begin_params_, first_party_for_cookies,
603 frame_tree_node_->current_origin(), frame_tree_node_->IsMainFrame(), 608 frame_tree_node_->IsMainFrame(), parent_is_main_frame,
604 parent_is_main_frame, IsSecureFrame(frame_tree_node_->parent()), 609 IsSecureFrame(frame_tree_node_->parent()),
605 frame_tree_node_->frame_tree_node_id(), is_for_guests_only, 610 frame_tree_node_->frame_tree_node_id(), is_for_guests_only,
606 report_raw_headers, navigating_frame_host->GetVisibilityState()), 611 report_raw_headers, navigating_frame_host->GetVisibilityState()),
607 std::move(navigation_ui_data), 612 std::move(navigation_ui_data),
608 navigation_handle_->service_worker_handle(), 613 navigation_handle_->service_worker_handle(),
609 navigation_handle_->appcache_handle(), this); 614 navigation_handle_->appcache_handle(), this);
610 } 615 }
611 616
612 void NavigationRequest::OnRedirectChecksComplete( 617 void NavigationRequest::OnRedirectChecksComplete(
613 NavigationThrottle::ThrottleCheckResult result) { 618 NavigationThrottle::ThrottleCheckResult result) {
614 CHECK(result != NavigationThrottle::DEFER); 619 CHECK(result != NavigationThrottle::DEFER);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); 667 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture);
663 668
664 render_frame_host->CommitNavigation(response_.get(), std::move(body_), 669 render_frame_host->CommitNavigation(response_.get(), std::move(body_),
665 common_params_, request_params_, 670 common_params_, request_params_,
666 is_view_source_); 671 is_view_source_);
667 672
668 frame_tree_node_->ResetNavigationRequest(true); 673 frame_tree_node_->ResetNavigationRequest(true);
669 } 674 }
670 675
671 } // namespace content 676 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_request_info.h » ('j') | content/common/navigation_params.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698