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

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

Issue 2653953005: PlzNavigate: transmit redirect info to the renderer side (Closed)
Patch Set: PlzNavigate: transmit redirect info to the renderer side Created 3 years, 10 months 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 "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "content/browser/appcache/appcache_navigation_handle.h" 10 #include "content/browser/appcache/appcache_navigation_handle.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 base::Optional<url::Origin> initiator = 214 base::Optional<url::Origin> initiator =
215 frame_tree_node->IsMainFrame() 215 frame_tree_node->IsMainFrame()
216 ? base::Optional<url::Origin>() 216 ? base::Optional<url::Origin>()
217 : base::Optional<url::Origin>( 217 : base::Optional<url::Origin>(
218 frame_tree_node->frame_tree()->root()->current_origin()); 218 frame_tree_node->frame_tree()->root()->current_origin());
219 219
220 // While the navigation was started via the LoadURL path it may have come from 220 // While the navigation was started via the LoadURL path it may have come from
221 // the renderer in the first place as part of OpenURL. 221 // the renderer in the first place as part of OpenURL.
222 bool browser_initiated = !entry.is_renderer_initiated(); 222 bool browser_initiated = !entry.is_renderer_initiated();
223 223
224 CommonNavigationParams common_params = entry.ConstructCommonNavigationParams(
225 frame_entry, request_body, dest_url, dest_referrer, navigation_type,
226 previews_state, navigation_start);
227
224 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest( 228 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest(
225 frame_tree_node, entry.ConstructCommonNavigationParams( 229 frame_tree_node, common_params,
226 frame_entry, request_body, dest_url, dest_referrer,
227 navigation_type, previews_state, navigation_start),
228 BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL, 230 BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL,
229 false, // has_user_gestures 231 false, // has_user_gestures
230 false, // skip_service_worker 232 false, // skip_service_worker
231 REQUEST_CONTEXT_TYPE_LOCATION, 233 REQUEST_CONTEXT_TYPE_LOCATION,
232 blink::WebMixedContentContextType::Blockable, 234 blink::WebMixedContentContextType::Blockable,
233 initiator), 235 initiator),
234 entry.ConstructRequestNavigationParams( 236 entry.ConstructRequestNavigationParams(
235 frame_entry, is_history_navigation_in_new_child, 237 frame_entry, common_params.url, common_params.method,
238 is_history_navigation_in_new_child,
236 entry.GetSubframeUniqueNames(frame_tree_node), 239 entry.GetSubframeUniqueNames(frame_tree_node),
237 frame_tree_node->has_committed_real_load(), 240 frame_tree_node->has_committed_real_load(),
238 controller->GetPendingEntryIndex() == -1, 241 controller->GetPendingEntryIndex() == -1,
239 controller->GetIndexOfEntry(&entry), 242 controller->GetIndexOfEntry(&entry),
240 controller->GetLastCommittedEntryIndex(), 243 controller->GetLastCommittedEntryIndex(),
241 controller->GetEntryCount()), 244 controller->GetEntryCount()),
242 browser_initiated, 245 browser_initiated,
243 true, // may_transfer 246 true, // may_transfer
244 &frame_entry, &entry)); 247 &frame_entry, &entry));
245 return navigation_request; 248 return navigation_request;
(...skipping 16 matching lines...) Expand all
262 DCHECK(FrameMsg_Navigate_Type::IsReload(common_params.navigation_type) || 265 DCHECK(FrameMsg_Navigate_Type::IsReload(common_params.navigation_type) ||
263 common_params.navigation_type == 266 common_params.navigation_type ==
264 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT); 267 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT);
265 268
266 // TODO(clamy): See how we should handle override of the user agent when the 269 // TODO(clamy): See how we should handle override of the user agent when the
267 // navigation may start in a renderer and commit in another one. 270 // navigation may start in a renderer and commit in another one.
268 // TODO(clamy): See if the navigation start time should be measured in the 271 // TODO(clamy): See if the navigation start time should be measured in the
269 // renderer and sent to the browser instead of being measured here. 272 // renderer and sent to the browser instead of being measured here.
270 // TODO(clamy): The pending history list offset should be properly set. 273 // TODO(clamy): The pending history list offset should be properly set.
271 RequestNavigationParams request_params( 274 RequestNavigationParams request_params(
272 false, // is_overriding_user_agent 275 false, // is_overriding_user_agent
273 std::vector<GURL>(), // redirects 276 std::vector<GURL>(), // redirects
277 common_params.url, common_params.method,
nasko 2017/02/10 23:53:09 nit: Put each argument on a separate line to be co
clamy 2017/02/13 14:29:37 Done.
274 false, // can_load_local_resources 278 false, // can_load_local_resources
275 PageState(), // page_state 279 PageState(), // page_state
276 0, // nav_entry_id 280 0, // nav_entry_id
277 false, // is_history_navigation_in_new_child 281 false, // is_history_navigation_in_new_child
278 std::map<std::string, bool>(), // subframe_unique_names 282 std::map<std::string, bool>(), // subframe_unique_names
279 frame_tree_node->has_committed_real_load(), 283 frame_tree_node->has_committed_real_load(),
280 false, // intended_as_new_entry 284 false, // intended_as_new_entry
281 -1, // pending_history_list_offset 285 -1, // pending_history_list_offset
282 current_history_list_offset, current_history_list_length, 286 current_history_list_offset, current_history_list_length,
283 false, // is_view_source 287 false, // is_view_source
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 444
441 // Mark time for the Navigation Timing API. 445 // Mark time for the Navigation Timing API.
442 if (request_params_.navigation_timing.redirect_start.is_null()) { 446 if (request_params_.navigation_timing.redirect_start.is_null()) {
443 request_params_.navigation_timing.redirect_start = 447 request_params_.navigation_timing.redirect_start =
444 request_params_.navigation_timing.fetch_start; 448 request_params_.navigation_timing.fetch_start;
445 } 449 }
446 request_params_.navigation_timing.redirect_end = base::TimeTicks::Now(); 450 request_params_.navigation_timing.redirect_end = base::TimeTicks::Now();
447 request_params_.navigation_timing.fetch_start = base::TimeTicks::Now(); 451 request_params_.navigation_timing.fetch_start = base::TimeTicks::Now();
448 452
449 request_params_.redirect_response.push_back(response->head); 453 request_params_.redirect_response.push_back(response->head);
454 request_params_.redirect_infos.push_back(redirect_info);
450 455
451 request_params_.redirects.push_back(common_params_.url); 456 request_params_.redirects.push_back(common_params_.url);
452 common_params_.url = redirect_info.new_url; 457 common_params_.url = redirect_info.new_url;
453 common_params_.method = redirect_info.new_method; 458 common_params_.method = redirect_info.new_method;
454 common_params_.referrer.url = GURL(redirect_info.new_referrer); 459 common_params_.referrer.url = GURL(redirect_info.new_referrer);
455 460
456 // For non browser initiated navigations we need to check if the source has 461 // For non browser initiated navigations we need to check if the source has
457 // access to the URL. We always allow browser initiated requests. 462 // access to the URL. We always allow browser initiated requests.
458 // TODO(clamy): Kill the renderer if FilterURL fails? 463 // TODO(clamy): Kill the renderer if FilterURL fails?
459 GURL url = common_params_.url; 464 GURL url = common_params_.url;
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); 752 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture);
748 753
749 render_frame_host->CommitNavigation(response_.get(), std::move(body_), 754 render_frame_host->CommitNavigation(response_.get(), std::move(body_),
750 common_params_, request_params_, 755 common_params_, request_params_,
751 is_view_source_); 756 is_view_source_);
752 757
753 frame_tree_node_->ResetNavigationRequest(true); 758 frame_tree_node_->ResetNavigationRequest(true);
754 } 759 }
755 760
756 } // namespace content 761 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698