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

Unified 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: Rebase Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/navigation_request.cc
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc
index 8feb8e20b4703844c6e6de8b98378b9c01a30f04..72cb81f2634b6a004cad49018512193258b1ec67 100644
--- a/content/browser/frame_host/navigation_request.cc
+++ b/content/browser/frame_host/navigation_request.cc
@@ -149,6 +149,11 @@ std::unique_ptr<NavigationRequest> NavigationRequest::CreateBrowserInitiated(
if (frame_entry.method() == "POST")
request_body = frame_entry.GetPostData();
+ base::Optional<url::Origin> initiator =
+ frame_tree_node->IsMainFrame()
+ ? base::Optional<url::Origin>()
+ : base::Optional<url::Origin>(
+ frame_tree_node->frame_tree()->root()->current_origin());
nasko 2016/11/18 19:49:15 Why have an initiator origin for browser-initiated
std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest(
frame_tree_node, entry.ConstructCommonNavigationParams(
frame_entry, request_body, dest_url, dest_referrer,
@@ -156,7 +161,7 @@ std::unique_ptr<NavigationRequest> NavigationRequest::CreateBrowserInitiated(
BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL,
false, // has_user_gestures
false, // skip_service_worker
- REQUEST_CONTEXT_TYPE_LOCATION),
+ REQUEST_CONTEXT_TYPE_LOCATION, initiator),
entry.ConstructRequestNavigationParams(
frame_entry, is_same_document_history_load,
is_history_navigation_in_new_child,
@@ -528,8 +533,8 @@ void NavigationRequest::OnStartChecksComplete(
frame_tree_node_->navigator()->GetController()->GetBrowserContext(),
base::MakeUnique<NavigationRequestInfo>(
common_params_, begin_params_, first_party_for_cookies,
- frame_tree_node_->current_origin(), frame_tree_node_->IsMainFrame(),
- parent_is_main_frame, IsSecureFrame(frame_tree_node_->parent()),
+ frame_tree_node_->IsMainFrame(), parent_is_main_frame,
+ IsSecureFrame(frame_tree_node_->parent()),
frame_tree_node_->frame_tree_node_id(), is_for_guests_only,
report_raw_headers),
std::move(navigation_ui_data),

Powered by Google App Engine
This is Rietveld 408576698