| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 std::unique_ptr<NavigationRequest> NavigationRequest::CreateBrowserInitiated( | 197 std::unique_ptr<NavigationRequest> NavigationRequest::CreateBrowserInitiated( |
| 198 FrameTreeNode* frame_tree_node, | 198 FrameTreeNode* frame_tree_node, |
| 199 const GURL& dest_url, | 199 const GURL& dest_url, |
| 200 const Referrer& dest_referrer, | 200 const Referrer& dest_referrer, |
| 201 const FrameNavigationEntry& frame_entry, | 201 const FrameNavigationEntry& frame_entry, |
| 202 const NavigationEntryImpl& entry, | 202 const NavigationEntryImpl& entry, |
| 203 FrameMsg_Navigate_Type::Value navigation_type, | 203 FrameMsg_Navigate_Type::Value navigation_type, |
| 204 PreviewsState previews_state, | 204 PreviewsState previews_state, |
| 205 bool is_same_document_history_load, | 205 bool is_same_document_history_load, |
| 206 bool is_history_navigation_in_new_child, | 206 bool is_history_navigation_in_new_child, |
| 207 bool has_user_gesture, |
| 207 const base::TimeTicks& navigation_start, | 208 const base::TimeTicks& navigation_start, |
| 208 NavigationControllerImpl* controller) { | 209 NavigationControllerImpl* controller) { |
| 209 // Fill POST data in the request body. | 210 // Fill POST data in the request body. |
| 210 scoped_refptr<ResourceRequestBodyImpl> request_body; | 211 scoped_refptr<ResourceRequestBodyImpl> request_body; |
| 211 if (frame_entry.method() == "POST") | 212 if (frame_entry.method() == "POST") |
| 212 request_body = frame_entry.GetPostData(); | 213 request_body = frame_entry.GetPostData(); |
| 213 | 214 |
| 214 base::Optional<url::Origin> initiator = | 215 base::Optional<url::Origin> initiator = |
| 215 frame_tree_node->IsMainFrame() | 216 frame_tree_node->IsMainFrame() |
| 216 ? base::Optional<url::Origin>() | 217 ? base::Optional<url::Origin>() |
| 217 : base::Optional<url::Origin>( | 218 : base::Optional<url::Origin>( |
| 218 frame_tree_node->frame_tree()->root()->current_origin()); | 219 frame_tree_node->frame_tree()->root()->current_origin()); |
| 219 | 220 |
| 220 // While the navigation was started via the LoadURL path it may have come from | 221 // 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. | 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, previews_state, navigation_start), | 228 navigation_type, previews_state, navigation_start), |
| 228 BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL, | 229 BeginNavigationParams(entry.extra_headers(), |
| 229 false, // has_user_gestures | 230 net::LOAD_NORMAL, |
| 231 has_user_gesture, |
| 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, is_history_navigation_in_new_child, |
| 236 entry.GetSubframeUniqueNames(frame_tree_node), | 238 entry.GetSubframeUniqueNames(frame_tree_node), |
| 237 frame_tree_node->has_committed_real_load(), | 239 frame_tree_node->has_committed_real_load(), |
| 238 controller->GetPendingEntryIndex() == -1, | 240 controller->GetPendingEntryIndex() == -1, |
| 239 controller->GetIndexOfEntry(&entry), | 241 controller->GetIndexOfEntry(&entry), |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); | 749 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); |
| 748 | 750 |
| 749 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 751 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
| 750 common_params_, request_params_, | 752 common_params_, request_params_, |
| 751 is_view_source_); | 753 is_view_source_); |
| 752 | 754 |
| 753 frame_tree_node_->ResetNavigationRequest(true); | 755 frame_tree_node_->ResetNavigationRequest(true); |
| 754 } | 756 } |
| 755 | 757 |
| 756 } // namespace content | 758 } // namespace content |
| OLD | NEW |