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 "content/browser/devtools/render_frame_devtools_agent_host.h" | 9 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
10 #include "content/browser/frame_host/frame_tree.h" | 10 #include "content/browser/frame_host/frame_tree.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 scoped_refptr<ResourceRequestBody> request_body; | 85 scoped_refptr<ResourceRequestBody> request_body; |
86 if (entry.GetHasPostData()) { | 86 if (entry.GetHasPostData()) { |
87 request_body = new ResourceRequestBody(); | 87 request_body = new ResourceRequestBody(); |
88 request_body->AppendBytes( | 88 request_body->AppendBytes( |
89 reinterpret_cast<const char *>( | 89 reinterpret_cast<const char *>( |
90 entry.GetBrowserInitiatedPostData()->front()), | 90 entry.GetBrowserInitiatedPostData()->front()), |
91 entry.GetBrowserInitiatedPostData()->size()); | 91 entry.GetBrowserInitiatedPostData()->size()); |
92 } | 92 } |
93 | 93 |
94 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest( | 94 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest( |
95 frame_tree_node, entry.ConstructCommonNavigationParams( | 95 frame_tree_node, |
96 dest_url, dest_referrer, navigation_type, lofi_state, | 96 entry.ConstructCommonNavigationParams( |
97 navigation_start), | 97 request_body ? "POST" : "GET", dest_url, dest_referrer, |
| 98 navigation_type, lofi_state, navigation_start), |
98 BeginNavigationParams(headers.ToString(), | 99 BeginNavigationParams(headers.ToString(), |
99 LoadFlagFromNavigationType(navigation_type), | 100 LoadFlagFromNavigationType(navigation_type), |
100 false, // has_user_gestures | 101 false, // has_user_gestures |
101 false, // skip_service_worker | 102 false, // skip_service_worker |
102 REQUEST_CONTEXT_TYPE_LOCATION), | 103 REQUEST_CONTEXT_TYPE_LOCATION), |
103 entry.ConstructRequestNavigationParams( | 104 entry.ConstructRequestNavigationParams( |
104 frame_entry, is_same_document_history_load, | 105 frame_entry, is_same_document_history_load, |
105 frame_tree_node->has_committed_real_load(), | 106 frame_tree_node->has_committed_real_load(), |
106 controller->GetPendingEntryIndex() == -1, | 107 controller->GetPendingEntryIndex() == -1, |
107 controller->GetIndexOfEntry(&entry), | 108 controller->GetIndexOfEntry(&entry), |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 state_ = STARTED; | 209 state_ = STARTED; |
209 RenderFrameDevToolsAgentHost::OnBeforeNavigation(navigation_handle_.get()); | 210 RenderFrameDevToolsAgentHost::OnBeforeNavigation(navigation_handle_.get()); |
210 | 211 |
211 if (ShouldMakeNetworkRequestForURL(common_params_.url)) { | 212 if (ShouldMakeNetworkRequestForURL(common_params_.url)) { |
212 // It's safe to use base::Unretained because this NavigationRequest owns | 213 // It's safe to use base::Unretained because this NavigationRequest owns |
213 // the NavigationHandle where the callback will be stored. | 214 // the NavigationHandle where the callback will be stored. |
214 // TODO(clamy): pass the real value for |is_external_protocol| if needed. | 215 // TODO(clamy): pass the real value for |is_external_protocol| if needed. |
215 // TODO(clamy): pass the method to the NavigationHandle instead of a | 216 // TODO(clamy): pass the method to the NavigationHandle instead of a |
216 // boolean. | 217 // boolean. |
217 navigation_handle_->WillStartRequest( | 218 navigation_handle_->WillStartRequest( |
218 common_params_.method, Referrer::SanitizeForRequest( | 219 common_params_.method, info_->request_body, |
219 common_params_.url, common_params_.referrer), | 220 Referrer::SanitizeForRequest(common_params_.url, |
| 221 common_params_.referrer), |
220 begin_params_.has_user_gesture, common_params_.transition, false, | 222 begin_params_.has_user_gesture, common_params_.transition, false, |
221 base::Bind(&NavigationRequest::OnStartChecksComplete, | 223 base::Bind(&NavigationRequest::OnStartChecksComplete, |
222 base::Unretained(this))); | 224 base::Unretained(this))); |
223 return; | 225 return; |
224 } | 226 } |
225 | 227 |
226 // There is no need to make a network request for this navigation, so commit | 228 // There is no need to make a network request for this navigation, so commit |
227 // it immediately. | 229 // it immediately. |
228 state_ = RESPONSE_STARTED; | 230 state_ = RESPONSE_STARTED; |
229 | 231 |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 browser_context, navigating_frame_host->GetSiteInstance()); | 461 browser_context, navigating_frame_host->GetSiteInstance()); |
460 DCHECK(partition); | 462 DCHECK(partition); |
461 | 463 |
462 ServiceWorkerContextWrapper* service_worker_context = | 464 ServiceWorkerContextWrapper* service_worker_context = |
463 static_cast<ServiceWorkerContextWrapper*>( | 465 static_cast<ServiceWorkerContextWrapper*>( |
464 partition->GetServiceWorkerContext()); | 466 partition->GetServiceWorkerContext()); |
465 navigation_handle_->InitServiceWorkerHandle(service_worker_context); | 467 navigation_handle_->InitServiceWorkerHandle(service_worker_context); |
466 } | 468 } |
467 | 469 |
468 } // namespace content | 470 } // namespace content |
OLD | NEW |