| 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 "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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 base::Optional<url::Origin> initiator = | 199 base::Optional<url::Origin> initiator = |
| 200 frame_tree_node->IsMainFrame() | 200 frame_tree_node->IsMainFrame() |
| 201 ? base::Optional<url::Origin>() | 201 ? base::Optional<url::Origin>() |
| 202 : base::Optional<url::Origin>( | 202 : base::Optional<url::Origin>( |
| 203 frame_tree_node->frame_tree()->root()->current_origin()); | 203 frame_tree_node->frame_tree()->root()->current_origin()); |
| 204 | 204 |
| 205 // While the navigation was started via the LoadURL path it may have come from | 205 // While the navigation was started via the LoadURL path it may have come from |
| 206 // the renderer in the first place as part of OpenURL. | 206 // the renderer in the first place as part of OpenURL. |
| 207 bool browser_initiated = !entry.is_renderer_initiated(); | 207 bool browser_initiated = !entry.is_renderer_initiated(); |
| 208 | 208 |
| 209 CommonNavigationParams common_params = entry.ConstructCommonNavigationParams( |
| 210 frame_entry, request_body, dest_url, dest_referrer, navigation_type, |
| 211 previews_state, navigation_start); |
| 212 |
| 209 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest( | 213 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest( |
| 210 frame_tree_node, entry.ConstructCommonNavigationParams( | 214 frame_tree_node, common_params, |
| 211 frame_entry, request_body, dest_url, dest_referrer, | |
| 212 navigation_type, previews_state, navigation_start), | |
| 213 BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL, | 215 BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL, |
| 214 false, // has_user_gestures | 216 false, // has_user_gestures |
| 215 false, // skip_service_worker | 217 false, // skip_service_worker |
| 216 REQUEST_CONTEXT_TYPE_LOCATION, | 218 REQUEST_CONTEXT_TYPE_LOCATION, |
| 217 blink::WebMixedContentContextType::Blockable, | 219 blink::WebMixedContentContextType::Blockable, |
| 218 initiator), | 220 initiator), |
| 219 entry.ConstructRequestNavigationParams( | 221 entry.ConstructRequestNavigationParams( |
| 220 frame_entry, is_history_navigation_in_new_child, | 222 frame_entry, common_params.url, common_params.method, |
| 223 is_history_navigation_in_new_child, |
| 221 entry.GetSubframeUniqueNames(frame_tree_node), | 224 entry.GetSubframeUniqueNames(frame_tree_node), |
| 222 frame_tree_node->has_committed_real_load(), | 225 frame_tree_node->has_committed_real_load(), |
| 223 controller->GetPendingEntryIndex() == -1, | 226 controller->GetPendingEntryIndex() == -1, |
| 224 controller->GetIndexOfEntry(&entry), | 227 controller->GetIndexOfEntry(&entry), |
| 225 controller->GetLastCommittedEntryIndex(), | 228 controller->GetLastCommittedEntryIndex(), |
| 226 controller->GetEntryCount()), | 229 controller->GetEntryCount()), |
| 227 browser_initiated, | 230 browser_initiated, |
| 228 true, // may_transfer | 231 true, // may_transfer |
| 229 &frame_entry, &entry)); | 232 &frame_entry, &entry)); |
| 230 return navigation_request; | 233 return navigation_request; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 247 DCHECK(FrameMsg_Navigate_Type::IsReload(common_params.navigation_type) || | 250 DCHECK(FrameMsg_Navigate_Type::IsReload(common_params.navigation_type) || |
| 248 common_params.navigation_type == | 251 common_params.navigation_type == |
| 249 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT); | 252 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT); |
| 250 | 253 |
| 251 // TODO(clamy): See how we should handle override of the user agent when the | 254 // TODO(clamy): See how we should handle override of the user agent when the |
| 252 // navigation may start in a renderer and commit in another one. | 255 // navigation may start in a renderer and commit in another one. |
| 253 // TODO(clamy): See if the navigation start time should be measured in the | 256 // TODO(clamy): See if the navigation start time should be measured in the |
| 254 // renderer and sent to the browser instead of being measured here. | 257 // renderer and sent to the browser instead of being measured here. |
| 255 // TODO(clamy): The pending history list offset should be properly set. | 258 // TODO(clamy): The pending history list offset should be properly set. |
| 256 RequestNavigationParams request_params( | 259 RequestNavigationParams request_params( |
| 257 false, // is_overriding_user_agent | 260 false, // is_overriding_user_agent |
| 258 std::vector<GURL>(), // redirects | 261 std::vector<GURL>(), // redirects |
| 262 common_params.url, common_params.method, |
| 259 false, // can_load_local_resources | 263 false, // can_load_local_resources |
| 260 PageState(), // page_state | 264 PageState(), // page_state |
| 261 0, // nav_entry_id | 265 0, // nav_entry_id |
| 262 false, // is_history_navigation_in_new_child | 266 false, // is_history_navigation_in_new_child |
| 263 std::map<std::string, bool>(), // subframe_unique_names | 267 std::map<std::string, bool>(), // subframe_unique_names |
| 264 frame_tree_node->has_committed_real_load(), | 268 frame_tree_node->has_committed_real_load(), |
| 265 false, // intended_as_new_entry | 269 false, // intended_as_new_entry |
| 266 -1, // pending_history_list_offset | 270 -1, // pending_history_list_offset |
| 267 current_history_list_offset, current_history_list_length, | 271 current_history_list_offset, current_history_list_length, |
| 268 false, // is_view_source | 272 false, // is_view_source |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 | 429 |
| 426 // Mark time for the Navigation Timing API. | 430 // Mark time for the Navigation Timing API. |
| 427 if (request_params_.navigation_timing.redirect_start.is_null()) { | 431 if (request_params_.navigation_timing.redirect_start.is_null()) { |
| 428 request_params_.navigation_timing.redirect_start = | 432 request_params_.navigation_timing.redirect_start = |
| 429 request_params_.navigation_timing.fetch_start; | 433 request_params_.navigation_timing.fetch_start; |
| 430 } | 434 } |
| 431 request_params_.navigation_timing.redirect_end = base::TimeTicks::Now(); | 435 request_params_.navigation_timing.redirect_end = base::TimeTicks::Now(); |
| 432 request_params_.navigation_timing.fetch_start = base::TimeTicks::Now(); | 436 request_params_.navigation_timing.fetch_start = base::TimeTicks::Now(); |
| 433 | 437 |
| 434 request_params_.redirect_response.push_back(response->head); | 438 request_params_.redirect_response.push_back(response->head); |
| 439 request_params_.redirect_infos.push_back(redirect_info); |
| 435 | 440 |
| 436 request_params_.redirects.push_back(common_params_.url); | 441 request_params_.redirects.push_back(common_params_.url); |
| 437 common_params_.url = redirect_info.new_url; | 442 common_params_.url = redirect_info.new_url; |
| 438 common_params_.method = redirect_info.new_method; | 443 common_params_.method = redirect_info.new_method; |
| 439 common_params_.referrer.url = GURL(redirect_info.new_referrer); | 444 common_params_.referrer.url = GURL(redirect_info.new_referrer); |
| 440 | 445 |
| 441 // For non browser initiated navigations we need to check if the source has | 446 // For non browser initiated navigations we need to check if the source has |
| 442 // access to the URL. We always allow browser initiated requests. | 447 // access to the URL. We always allow browser initiated requests. |
| 443 // TODO(clamy): Kill the renderer if FilterURL fails? | 448 // TODO(clamy): Kill the renderer if FilterURL fails? |
| 444 GURL url = common_params_.url; | 449 GURL url = common_params_.url; |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); | 737 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); |
| 733 | 738 |
| 734 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 739 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
| 735 common_params_, request_params_, | 740 common_params_, request_params_, |
| 736 is_view_source_); | 741 is_view_source_); |
| 737 | 742 |
| 738 frame_tree_node_->ResetNavigationRequest(true); | 743 frame_tree_node_->ResetNavigationRequest(true); |
| 739 } | 744 } |
| 740 | 745 |
| 741 } // namespace content | 746 } // namespace content |
| OLD | NEW |