| 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 25 matching lines...) Expand all Loading... |
| 36 #include "content/public/common/appcache_info.h" | 36 #include "content/public/common/appcache_info.h" |
| 37 #include "content/public/common/content_client.h" | 37 #include "content/public/common/content_client.h" |
| 38 #include "content/public/common/request_context_type.h" | 38 #include "content/public/common/request_context_type.h" |
| 39 #include "content/public/common/resource_response.h" | 39 #include "content/public/common/resource_response.h" |
| 40 #include "content/public/common/url_constants.h" | 40 #include "content/public/common/url_constants.h" |
| 41 #include "net/base/load_flags.h" | 41 #include "net/base/load_flags.h" |
| 42 #include "net/base/net_errors.h" | 42 #include "net/base/net_errors.h" |
| 43 #include "net/base/url_util.h" | 43 #include "net/base/url_util.h" |
| 44 #include "net/http/http_request_headers.h" | 44 #include "net/http/http_request_headers.h" |
| 45 #include "net/url_request/redirect_info.h" | 45 #include "net/url_request/redirect_info.h" |
| 46 #include "third_party/WebKit/public/platform/WebMixedContentContextType.h" |
| 46 #include "third_party/WebKit/public/web/WebSandboxFlags.h" | 47 #include "third_party/WebKit/public/web/WebSandboxFlags.h" |
| 47 | 48 |
| 48 namespace content { | 49 namespace content { |
| 49 | 50 |
| 50 namespace { | 51 namespace { |
| 51 | 52 |
| 52 // Returns the net load flags to use based on the navigation type. | 53 // Returns the net load flags to use based on the navigation type. |
| 53 // TODO(clamy): Remove the blink code that sets the caching flags when | 54 // TODO(clamy): Remove the blink code that sets the caching flags when |
| 54 // PlzNavigate launches. | 55 // PlzNavigate launches. |
| 55 void UpdateLoadFlagsWithCacheFlags( | 56 void UpdateLoadFlagsWithCacheFlags( |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 // the renderer in the first place as part of OpenURL. | 222 // the renderer in the first place as part of OpenURL. |
| 222 bool browser_initiated = !entry.is_renderer_initiated(); | 223 bool browser_initiated = !entry.is_renderer_initiated(); |
| 223 | 224 |
| 224 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest( | 225 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest( |
| 225 frame_tree_node, entry.ConstructCommonNavigationParams( | 226 frame_tree_node, entry.ConstructCommonNavigationParams( |
| 226 frame_entry, request_body, dest_url, dest_referrer, | 227 frame_entry, request_body, dest_url, dest_referrer, |
| 227 navigation_type, lofi_state, navigation_start), | 228 navigation_type, lofi_state, navigation_start), |
| 228 BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL, | 229 BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL, |
| 229 false, // has_user_gestures | 230 false, // has_user_gestures |
| 230 false, // skip_service_worker | 231 false, // skip_service_worker |
| 231 REQUEST_CONTEXT_TYPE_LOCATION, initiator), | 232 REQUEST_CONTEXT_TYPE_LOCATION, |
| 233 blink::WebMixedContentContextType::Blockable, |
| 234 initiator), |
| 232 entry.ConstructRequestNavigationParams( | 235 entry.ConstructRequestNavigationParams( |
| 233 frame_entry, is_same_document_history_load, | 236 frame_entry, is_same_document_history_load, |
| 234 is_history_navigation_in_new_child, | 237 is_history_navigation_in_new_child, |
| 235 entry.GetSubframeUniqueNames(frame_tree_node), | 238 entry.GetSubframeUniqueNames(frame_tree_node), |
| 236 frame_tree_node->has_committed_real_load(), | 239 frame_tree_node->has_committed_real_load(), |
| 237 controller->GetPendingEntryIndex() == -1, | 240 controller->GetPendingEntryIndex() == -1, |
| 238 controller->GetIndexOfEntry(&entry), | 241 controller->GetIndexOfEntry(&entry), |
| 239 controller->GetLastCommittedEntryIndex(), | 242 controller->GetLastCommittedEntryIndex(), |
| 240 controller->GetEntryCount()), | 243 controller->GetEntryCount()), |
| 241 browser_initiated, | 244 browser_initiated, |
| 242 true, // may_transfer | 245 true, // may_transfer |
| 243 &frame_entry, &entry)); | 246 &frame_entry, &entry)); |
| 244 return navigation_request; | 247 return navigation_request; |
| 245 } | 248 } |
| 246 | 249 |
| 247 // static | 250 // static |
| 248 std::unique_ptr<NavigationRequest> NavigationRequest::CreateRendererInitiated( | 251 std::unique_ptr<NavigationRequest> NavigationRequest::CreateRendererInitiated( |
| 249 FrameTreeNode* frame_tree_node, | 252 FrameTreeNode* frame_tree_node, |
| 250 const CommonNavigationParams& common_params, | 253 const CommonNavigationParams& common_params, |
| 251 const BeginNavigationParams& begin_params, | 254 const BeginNavigationParams& begin_params, |
| 252 int current_history_list_offset, | 255 int current_history_list_offset, |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 // the NavigationHandle where the callback will be stored. | 353 // the NavigationHandle where the callback will be stored. |
| 351 // TODO(clamy): pass the real value for |is_external_protocol| if needed. | 354 // TODO(clamy): pass the real value for |is_external_protocol| if needed. |
| 352 // TODO(clamy): pass the method to the NavigationHandle instead of a | 355 // TODO(clamy): pass the method to the NavigationHandle instead of a |
| 353 // boolean. | 356 // boolean. |
| 354 navigation_handle_->WillStartRequest( | 357 navigation_handle_->WillStartRequest( |
| 355 common_params_.method, common_params_.post_data, | 358 common_params_.method, common_params_.post_data, |
| 356 Referrer::SanitizeForRequest(common_params_.url, | 359 Referrer::SanitizeForRequest(common_params_.url, |
| 357 common_params_.referrer), | 360 common_params_.referrer), |
| 358 begin_params_.has_user_gesture, common_params_.transition, false, | 361 begin_params_.has_user_gesture, common_params_.transition, false, |
| 359 begin_params_.request_context_type, | 362 begin_params_.request_context_type, |
| 363 begin_params_.mixed_content_context_type, |
| 360 base::Bind(&NavigationRequest::OnStartChecksComplete, | 364 base::Bind(&NavigationRequest::OnStartChecksComplete, |
| 361 base::Unretained(this))); | 365 base::Unretained(this))); |
| 362 return; | 366 return; |
| 363 } | 367 } |
| 364 | 368 |
| 365 // There is no need to make a network request for this navigation, so commit | 369 // There is no need to make a network request for this navigation, so commit |
| 366 // it immediately. | 370 // it immediately. |
| 367 state_ = RESPONSE_STARTED; | 371 state_ = RESPONSE_STARTED; |
| 368 | 372 |
| 369 // Select an appropriate RenderFrameHost. | 373 // Select an appropriate RenderFrameHost. |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); | 714 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); |
| 711 | 715 |
| 712 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 716 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
| 713 common_params_, request_params_, | 717 common_params_, request_params_, |
| 714 is_view_source_); | 718 is_view_source_); |
| 715 | 719 |
| 716 frame_tree_node_->ResetNavigationRequest(true); | 720 frame_tree_node_->ResetNavigationRequest(true); |
| 717 } | 721 } |
| 718 | 722 |
| 719 } // namespace content | 723 } // namespace content |
| OLD | NEW |