| 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/child_process_security_policy_impl.h" | 9 #include "content/browser/child_process_security_policy_impl.h" |
| 10 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 10 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 frame_tree_node_->ResetNavigationRequest(false); | 348 frame_tree_node_->ResetNavigationRequest(false); |
| 349 return; | 349 return; |
| 350 } | 350 } |
| 351 } | 351 } |
| 352 | 352 |
| 353 // It's safe to use base::Unretained because this NavigationRequest owns the | 353 // It's safe to use base::Unretained because this NavigationRequest owns the |
| 354 // NavigationHandle where the callback will be stored. | 354 // NavigationHandle where the callback will be stored. |
| 355 // TODO(clamy): pass the real value for |is_external_protocol| if needed. | 355 // TODO(clamy): pass the real value for |is_external_protocol| if needed. |
| 356 navigation_handle_->WillRedirectRequest( | 356 navigation_handle_->WillRedirectRequest( |
| 357 common_params_.url, common_params_.method, common_params_.referrer.url, | 357 common_params_.url, common_params_.method, common_params_.referrer.url, |
| 358 false, response->head.headers, | 358 false, response->head.headers, response->head.connection_info, |
| 359 base::Bind(&NavigationRequest::OnRedirectChecksComplete, | 359 base::Bind(&NavigationRequest::OnRedirectChecksComplete, |
| 360 base::Unretained(this))); | 360 base::Unretained(this))); |
| 361 } | 361 } |
| 362 | 362 |
| 363 void NavigationRequest::OnResponseStarted( | 363 void NavigationRequest::OnResponseStarted( |
| 364 const scoped_refptr<ResourceResponse>& response, | 364 const scoped_refptr<ResourceResponse>& response, |
| 365 std::unique_ptr<StreamHandle> body, | 365 std::unique_ptr<StreamHandle> body, |
| 366 const SSLStatus& ssl_status, | 366 const SSLStatus& ssl_status, |
| 367 std::unique_ptr<NavigationData> navigation_data) { | 367 std::unique_ptr<NavigationData> navigation_data) { |
| 368 DCHECK(state_ == STARTED); | 368 DCHECK(state_ == STARTED); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 navigation_handle_->set_navigation_data(std::move(navigation_data)); | 418 navigation_handle_->set_navigation_data(std::move(navigation_data)); |
| 419 | 419 |
| 420 // Store the response and the StreamHandle until checks have been processed. | 420 // Store the response and the StreamHandle until checks have been processed. |
| 421 response_ = response; | 421 response_ = response; |
| 422 body_ = std::move(body); | 422 body_ = std::move(body); |
| 423 | 423 |
| 424 // Check if the navigation should be allowed to proceed. | 424 // Check if the navigation should be allowed to proceed. |
| 425 // TODO(clamy): pass the right values for request_id, is_download and | 425 // TODO(clamy): pass the right values for request_id, is_download and |
| 426 // is_stream. | 426 // is_stream. |
| 427 navigation_handle_->WillProcessResponse( | 427 navigation_handle_->WillProcessResponse( |
| 428 render_frame_host, response->head.headers.get(), ssl_status, | 428 render_frame_host, response->head.headers.get(), |
| 429 GlobalRequestID(), common_params_.should_replace_current_entry, false, | 429 response->head.connection_info, ssl_status, GlobalRequestID(), |
| 430 false, base::Closure(), | 430 common_params_.should_replace_current_entry, false, false, |
| 431 base::Closure(), |
| 431 base::Bind(&NavigationRequest::OnWillProcessResponseChecksComplete, | 432 base::Bind(&NavigationRequest::OnWillProcessResponseChecksComplete, |
| 432 base::Unretained(this))); | 433 base::Unretained(this))); |
| 433 } | 434 } |
| 434 | 435 |
| 435 void NavigationRequest::OnRequestFailed(bool has_stale_copy_in_cache, | 436 void NavigationRequest::OnRequestFailed(bool has_stale_copy_in_cache, |
| 436 int net_error) { | 437 int net_error) { |
| 437 DCHECK(state_ == STARTED); | 438 DCHECK(state_ == STARTED); |
| 438 state_ = FAILED; | 439 state_ = FAILED; |
| 439 navigation_handle_->set_net_error_code(static_cast<net::Error>(net_error)); | 440 navigation_handle_->set_net_error_code(static_cast<net::Error>(net_error)); |
| 440 frame_tree_node_->navigator()->FailedNavigation( | 441 frame_tree_node_->navigator()->FailedNavigation( |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); | 590 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); |
| 590 | 591 |
| 591 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 592 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
| 592 common_params_, request_params_, | 593 common_params_, request_params_, |
| 593 is_view_source_); | 594 is_view_source_); |
| 594 | 595 |
| 595 frame_tree_node_->ResetNavigationRequest(true); | 596 frame_tree_node_->ResetNavigationRequest(true); |
| 596 } | 597 } |
| 597 | 598 |
| 598 } // namespace content | 599 } // namespace content |
| OLD | NEW |