Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_handle_impl.h" | 5 #include "content/browser/frame_host/navigation_handle_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "content/browser/browsing_data/clear_site_data_throttle.h" | 10 #include "content/browser/browsing_data/clear_site_data_throttle.h" |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 // Reset the callback to ensure it will not be called later. | 301 // Reset the callback to ensure it will not be called later. |
| 302 complete_callback_.Reset(); | 302 complete_callback_.Reset(); |
| 303 return result; | 303 return result; |
| 304 } | 304 } |
| 305 | 305 |
| 306 NavigationThrottle::ThrottleCheckResult | 306 NavigationThrottle::ThrottleCheckResult |
| 307 NavigationHandleImpl::CallWillProcessResponseForTesting( | 307 NavigationHandleImpl::CallWillProcessResponseForTesting( |
| 308 content::RenderFrameHost* render_frame_host) { | 308 content::RenderFrameHost* render_frame_host) { |
| 309 NavigationThrottle::ThrottleCheckResult result = NavigationThrottle::DEFER; | 309 NavigationThrottle::ThrottleCheckResult result = NavigationThrottle::DEFER; |
| 310 WillProcessResponse(static_cast<RenderFrameHostImpl*>(render_frame_host), | 310 WillProcessResponse(static_cast<RenderFrameHostImpl*>(render_frame_host), |
| 311 scoped_refptr<net::HttpResponseHeaders>(), | 311 scoped_refptr<net::HttpResponseHeaders>(), SSLStatus(), |
| 312 base::Bind(&UpdateThrottleCheckResult, &result)); | 312 base::Bind(&UpdateThrottleCheckResult, &result)); |
| 313 | 313 |
| 314 // Reset the callback to ensure it will not be called later. | 314 // Reset the callback to ensure it will not be called later. |
| 315 complete_callback_.Reset(); | 315 complete_callback_.Reset(); |
| 316 return result; | 316 return result; |
| 317 } | 317 } |
| 318 | 318 |
| 319 NavigationData* NavigationHandleImpl::GetNavigationData() { | 319 NavigationData* NavigationHandleImpl::GetNavigationData() { |
| 320 return navigation_data_.get(); | 320 return navigation_data_.get(); |
| 321 } | 321 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 382 NavigationThrottle::ThrottleCheckResult result = CheckWillRedirectRequest(); | 382 NavigationThrottle::ThrottleCheckResult result = CheckWillRedirectRequest(); |
| 383 | 383 |
| 384 // If the navigation is not deferred, run the callback. | 384 // If the navigation is not deferred, run the callback. |
| 385 if (result != NavigationThrottle::DEFER) | 385 if (result != NavigationThrottle::DEFER) |
| 386 RunCompleteCallback(result); | 386 RunCompleteCallback(result); |
| 387 } | 387 } |
| 388 | 388 |
| 389 void NavigationHandleImpl::WillProcessResponse( | 389 void NavigationHandleImpl::WillProcessResponse( |
| 390 RenderFrameHostImpl* render_frame_host, | 390 RenderFrameHostImpl* render_frame_host, |
| 391 scoped_refptr<net::HttpResponseHeaders> response_headers, | 391 scoped_refptr<net::HttpResponseHeaders> response_headers, |
| 392 const SSLStatus& ssl_status, | |
| 392 const ThrottleChecksFinishedCallback& callback) { | 393 const ThrottleChecksFinishedCallback& callback) { |
| 393 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); | 394 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); |
| 394 render_frame_host_ = render_frame_host; | 395 render_frame_host_ = render_frame_host; |
| 395 response_headers_ = response_headers; | 396 response_headers_ = response_headers; |
| 396 state_ = WILL_PROCESS_RESPONSE; | 397 state_ = WILL_PROCESS_RESPONSE; |
| 398 ssl_status_ = ssl_status; | |
| 397 complete_callback_ = callback; | 399 complete_callback_ = callback; |
| 398 | 400 |
| 399 // Notify each throttle of the response. | 401 // Notify each throttle of the response. |
| 400 NavigationThrottle::ThrottleCheckResult result = CheckWillProcessResponse(); | 402 NavigationThrottle::ThrottleCheckResult result = CheckWillProcessResponse(); |
| 401 | 403 |
| 402 // If the navigation is about to proceed, then it's ready to commit. | 404 // If the navigation is about to proceed, then it's ready to commit. |
| 403 if (result == NavigationThrottle::PROCEED) | 405 if (result == NavigationThrottle::PROCEED) |
| 404 ReadyToCommitNavigation(render_frame_host); | 406 ReadyToCommitNavigation(render_frame_host); |
| 405 | 407 |
| 406 // If the navigation is not deferred, run the callback. | 408 // If the navigation is not deferred, run the callback. |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 430 | 432 |
| 431 method_ = params.method; | 433 method_ = params.method; |
| 432 has_user_gesture_ = (params.gesture == NavigationGestureUser); | 434 has_user_gesture_ = (params.gesture == NavigationGestureUser); |
| 433 transition_ = params.transition; | 435 transition_ = params.transition; |
| 434 render_frame_host_ = render_frame_host; | 436 render_frame_host_ = render_frame_host; |
| 435 is_same_page_ = same_page; | 437 is_same_page_ = same_page; |
| 436 | 438 |
| 437 state_ = net_error_code_ == net::OK ? DID_COMMIT : DID_COMMIT_ERROR_PAGE; | 439 state_ = net_error_code_ == net::OK ? DID_COMMIT : DID_COMMIT_ERROR_PAGE; |
| 438 } | 440 } |
| 439 | 441 |
| 442 | |
|
Avi (use Gerrit)
2016/08/25 23:36:00
extra blank line
jam
2016/08/26 03:36:43
Done.
| |
| 443 void NavigationHandleImpl::UpdateSSLCertId(int new_cert_id) { | |
| 444 DCHECK(ssl_status_.cert_id) << "Must have set an SSL certificate already."; | |
| 445 ssl_status_.cert_id = new_cert_id; | |
| 446 } | |
| 447 | |
| 440 NavigationThrottle::ThrottleCheckResult | 448 NavigationThrottle::ThrottleCheckResult |
| 441 NavigationHandleImpl::CheckWillStartRequest() { | 449 NavigationHandleImpl::CheckWillStartRequest() { |
| 442 DCHECK(state_ == WILL_SEND_REQUEST || state_ == DEFERRING_START); | 450 DCHECK(state_ == WILL_SEND_REQUEST || state_ == DEFERRING_START); |
| 443 DCHECK(state_ != WILL_SEND_REQUEST || next_index_ == 0); | 451 DCHECK(state_ != WILL_SEND_REQUEST || next_index_ == 0); |
| 444 DCHECK(state_ != DEFERRING_START || next_index_ != 0); | 452 DCHECK(state_ != DEFERRING_START || next_index_ != 0); |
| 445 for (size_t i = next_index_; i < throttles_.size(); ++i) { | 453 for (size_t i = next_index_; i < throttles_.size(); ++i) { |
| 446 NavigationThrottle::ThrottleCheckResult result = | 454 NavigationThrottle::ThrottleCheckResult result = |
| 447 throttles_[i]->WillStartRequest(); | 455 throttles_[i]->WillStartRequest(); |
| 448 switch (result) { | 456 switch (result) { |
| 449 case NavigationThrottle::PROCEED: | 457 case NavigationThrottle::PROCEED: |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 565 throttles_to_register.push_back(std::move(clear_site_data_throttle)); | 573 throttles_to_register.push_back(std::move(clear_site_data_throttle)); |
| 566 | 574 |
| 567 if (throttles_to_register.size() > 0) { | 575 if (throttles_to_register.size() > 0) { |
| 568 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), | 576 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), |
| 569 throttles_to_register.end()); | 577 throttles_to_register.end()); |
| 570 throttles_to_register.weak_clear(); | 578 throttles_to_register.weak_clear(); |
| 571 } | 579 } |
| 572 } | 580 } |
| 573 | 581 |
| 574 } // namespace content | 582 } // namespace content |
| OLD | NEW |