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

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
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_request_info.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 LoFiState lofi_state, 202 LoFiState lofi_state,
203 bool is_same_document_history_load, 203 bool is_same_document_history_load,
204 bool is_history_navigation_in_new_child, 204 bool is_history_navigation_in_new_child,
205 const base::TimeTicks& navigation_start, 205 const base::TimeTicks& navigation_start,
206 NavigationControllerImpl* controller) { 206 NavigationControllerImpl* controller) {
207 // Fill POST data in the request body. 207 // Fill POST data in the request body.
208 scoped_refptr<ResourceRequestBodyImpl> request_body; 208 scoped_refptr<ResourceRequestBodyImpl> request_body;
209 if (frame_entry.method() == "POST") 209 if (frame_entry.method() == "POST")
210 request_body = frame_entry.GetPostData(); 210 request_body = frame_entry.GetPostData();
211 211
212 base::Optional<url::Origin> initiator =
213 frame_tree_node->IsMainFrame()
214 ? base::Optional<url::Origin>()
215 : base::Optional<url::Origin>(
216 frame_tree_node->frame_tree()->root()->current_origin());
212 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest( 217 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest(
213 frame_tree_node, entry.ConstructCommonNavigationParams( 218 frame_tree_node, entry.ConstructCommonNavigationParams(
214 frame_entry, request_body, dest_url, dest_referrer, 219 frame_entry, request_body, dest_url, dest_referrer,
215 navigation_type, lofi_state, navigation_start), 220 navigation_type, lofi_state, navigation_start),
216 BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL, 221 BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL,
217 false, // has_user_gestures 222 false, // has_user_gestures
218 false, // skip_service_worker 223 false, // skip_service_worker
219 REQUEST_CONTEXT_TYPE_LOCATION), 224 REQUEST_CONTEXT_TYPE_LOCATION, initiator),
220 entry.ConstructRequestNavigationParams( 225 entry.ConstructRequestNavigationParams(
221 frame_entry, is_same_document_history_load, 226 frame_entry, is_same_document_history_load,
222 is_history_navigation_in_new_child, 227 is_history_navigation_in_new_child,
223 entry.GetSubframeUniqueNames(frame_tree_node), 228 entry.GetSubframeUniqueNames(frame_tree_node),
224 frame_tree_node->has_committed_real_load(), 229 frame_tree_node->has_committed_real_load(),
225 controller->GetPendingEntryIndex() == -1, 230 controller->GetPendingEntryIndex() == -1,
226 controller->GetIndexOfEntry(&entry), 231 controller->GetIndexOfEntry(&entry),
227 controller->GetLastCommittedEntryIndex(), 232 controller->GetLastCommittedEntryIndex(),
228 controller->GetEntryCount()), 233 controller->GetEntryCount()),
229 true, &frame_entry, &entry)); 234 true, &frame_entry, &entry));
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 navigation_handle_->GetStartingSiteInstance()->GetSiteURL(). 610 navigation_handle_->GetStartingSiteInstance()->GetSiteURL().
606 SchemeIs(kGuestScheme); 611 SchemeIs(kGuestScheme);
607 612
608 bool report_raw_headers = 613 bool report_raw_headers =
609 RenderFrameDevToolsAgentHost::IsNetworkHandlerEnabled(frame_tree_node_); 614 RenderFrameDevToolsAgentHost::IsNetworkHandlerEnabled(frame_tree_node_);
610 615
611 loader_ = NavigationURLLoader::Create( 616 loader_ = NavigationURLLoader::Create(
612 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), 617 frame_tree_node_->navigator()->GetController()->GetBrowserContext(),
613 base::MakeUnique<NavigationRequestInfo>( 618 base::MakeUnique<NavigationRequestInfo>(
614 common_params_, begin_params_, first_party_for_cookies, 619 common_params_, begin_params_, first_party_for_cookies,
615 frame_tree_node_->current_origin(), frame_tree_node_->IsMainFrame(), 620 frame_tree_node_->IsMainFrame(), parent_is_main_frame,
616 parent_is_main_frame, IsSecureFrame(frame_tree_node_->parent()), 621 IsSecureFrame(frame_tree_node_->parent()),
617 frame_tree_node_->frame_tree_node_id(), is_for_guests_only, 622 frame_tree_node_->frame_tree_node_id(), is_for_guests_only,
618 report_raw_headers, navigating_frame_host->GetVisibilityState()), 623 report_raw_headers, navigating_frame_host->GetVisibilityState()),
619 std::move(navigation_ui_data), 624 std::move(navigation_ui_data),
620 navigation_handle_->service_worker_handle(), 625 navigation_handle_->service_worker_handle(),
621 navigation_handle_->appcache_handle(), this); 626 navigation_handle_->appcache_handle(), this);
622 } 627 }
623 628
624 void NavigationRequest::OnRedirectChecksComplete( 629 void NavigationRequest::OnRedirectChecksComplete(
625 NavigationThrottle::ThrottleCheckResult result) { 630 NavigationThrottle::ThrottleCheckResult result) {
626 DCHECK(result != NavigationThrottle::DEFER); 631 DCHECK(result != NavigationThrottle::DEFER);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); 687 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture);
683 688
684 render_frame_host->CommitNavigation(response_.get(), std::move(body_), 689 render_frame_host->CommitNavigation(response_.get(), std::move(body_),
685 common_params_, request_params_, 690 common_params_, request_params_,
686 is_view_source_); 691 is_view_source_);
687 692
688 frame_tree_node_->ResetNavigationRequest(true); 693 frame_tree_node_->ResetNavigationRequest(true);
689 } 694 }
690 695
691 } // namespace content 696 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_request_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698