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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 navigation_handle_->WillRedirectRequest( | 283 navigation_handle_->WillRedirectRequest( |
284 common_params_.url, common_params_.method, common_params_.referrer.url, | 284 common_params_.url, common_params_.method, common_params_.referrer.url, |
285 false, response->head.headers, | 285 false, response->head.headers, |
286 base::Bind(&NavigationRequest::OnRedirectChecksComplete, | 286 base::Bind(&NavigationRequest::OnRedirectChecksComplete, |
287 base::Unretained(this))); | 287 base::Unretained(this))); |
288 } | 288 } |
289 | 289 |
290 void NavigationRequest::OnResponseStarted( | 290 void NavigationRequest::OnResponseStarted( |
291 const scoped_refptr<ResourceResponse>& response, | 291 const scoped_refptr<ResourceResponse>& response, |
292 std::unique_ptr<StreamHandle> body, | 292 std::unique_ptr<StreamHandle> body, |
| 293 const SSLStatus& ssl_status, |
293 std::unique_ptr<NavigationData> navigation_data) { | 294 std::unique_ptr<NavigationData> navigation_data) { |
294 DCHECK(state_ == STARTED); | 295 DCHECK(state_ == STARTED); |
295 state_ = RESPONSE_STARTED; | 296 state_ = RESPONSE_STARTED; |
296 | 297 |
297 // HTTP 204 (No Content) and HTTP 205 (Reset Content) responses should not | 298 // HTTP 204 (No Content) and HTTP 205 (Reset Content) responses should not |
298 // commit; they leave the frame showing the previous page. | 299 // commit; they leave the frame showing the previous page. |
299 DCHECK(response); | 300 DCHECK(response); |
300 if (response->head.headers.get() && | 301 if (response->head.headers.get() && |
301 (response->head.headers->response_code() == 204 || | 302 (response->head.headers->response_code() == 204 || |
302 response->head.headers->response_code() == 205)) { | 303 response->head.headers->response_code() == 205)) { |
(...skipping 26 matching lines...) Expand all Loading... |
329 | 330 |
330 if (navigation_data) | 331 if (navigation_data) |
331 navigation_handle_->set_navigation_data(std::move(navigation_data)); | 332 navigation_handle_->set_navigation_data(std::move(navigation_data)); |
332 | 333 |
333 // Store the response and the StreamHandle until checks have been processed. | 334 // Store the response and the StreamHandle until checks have been processed. |
334 response_ = response; | 335 response_ = response; |
335 body_ = std::move(body); | 336 body_ = std::move(body); |
336 | 337 |
337 // Check if the navigation should be allowed to proceed. | 338 // Check if the navigation should be allowed to proceed. |
338 navigation_handle_->WillProcessResponse( | 339 navigation_handle_->WillProcessResponse( |
339 render_frame_host, response->head.headers.get(), | 340 render_frame_host, response->head.headers.get(), ssl_status, |
340 base::Bind(&NavigationRequest::OnWillProcessResponseChecksComplete, | 341 base::Bind(&NavigationRequest::OnWillProcessResponseChecksComplete, |
341 base::Unretained(this))); | 342 base::Unretained(this))); |
342 } | 343 } |
343 | 344 |
344 void NavigationRequest::OnRequestFailed(bool has_stale_copy_in_cache, | 345 void NavigationRequest::OnRequestFailed(bool has_stale_copy_in_cache, |
345 int net_error) { | 346 int net_error) { |
346 DCHECK(state_ == STARTED); | 347 DCHECK(state_ == STARTED); |
347 state_ = FAILED; | 348 state_ = FAILED; |
348 navigation_handle_->set_net_error_code(static_cast<net::Error>(net_error)); | 349 navigation_handle_->set_net_error_code(static_cast<net::Error>(net_error)); |
349 frame_tree_node_->navigator()->FailedNavigation( | 350 frame_tree_node_->navigator()->FailedNavigation( |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 | 460 |
460 TransferNavigationHandleOwnership(render_frame_host); | 461 TransferNavigationHandleOwnership(render_frame_host); |
461 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 462 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
462 common_params_, request_params_, | 463 common_params_, request_params_, |
463 is_view_source_); | 464 is_view_source_); |
464 | 465 |
465 frame_tree_node_->ResetNavigationRequest(true); | 466 frame_tree_node_->ResetNavigationRequest(true); |
466 } | 467 } |
467 | 468 |
468 } // namespace content | 469 } // namespace content |
OLD | NEW |