Chromium Code Reviews| Index: content/browser/frame_host/navigation_handle_impl.cc |
| diff --git a/content/browser/frame_host/navigation_handle_impl.cc b/content/browser/frame_host/navigation_handle_impl.cc |
| index 0bdcce93ae786251d10410fbd256c138cdf676d8..d0810614acf83657c857ac7487c40a79b98354dd 100644 |
| --- a/content/browser/frame_host/navigation_handle_impl.cc |
| +++ b/content/browser/frame_host/navigation_handle_impl.cc |
| @@ -6,6 +6,7 @@ |
| #include <utility> |
| +#include "content/browser/frame_host/ancestor_throttle.h" |
| #include "content/browser/frame_host/frame_tree_node.h" |
| #include "content/browser/frame_host/navigator.h" |
| #include "content/browser/frame_host/navigator_delegate.h" |
| @@ -171,9 +172,9 @@ net::Error NavigationHandleImpl::GetNetErrorCode() { |
| } |
| RenderFrameHostImpl* NavigationHandleImpl::GetRenderFrameHost() { |
| - CHECK(state_ >= READY_TO_COMMIT) |
| + CHECK(state_ >= WILL_PROCESS_RESPONSE) |
|
mmenke
2016/05/02 18:17:28
nit: While you're here, CHECK_GE
Mike West
2016/05/05 08:14:28
Done.
|
| << "This accessor should only be called " |
| - "after the navigation is ready to commit."; |
| + "after a response has been received."; |
| return render_frame_host_; |
| } |
| @@ -292,10 +293,13 @@ void NavigationHandleImpl::WillStartRequest( |
| state_ = WILL_SEND_REQUEST; |
| complete_callback_ = callback; |
| - // Register the navigation throttles. The ScopedVector returned by |
| - // GetNavigationThrottles is not assigned to throttles_ directly because it |
| - // would overwrite any throttle previously added with |
| - // RegisterThrottleForTesting. |
| + // Register the platform's navigation throttles. |
| + std::unique_ptr<content::NavigationThrottle> ancestor_throttle = |
| + content::AncestorThrottle::MaybeCreateThrottleFor(this); |
| + if (ancestor_throttle) |
| + throttles_.push_back(std::move(ancestor_throttle)); |
| + |
| + // Register the embedder's navigation throttles. |
| ScopedVector<NavigationThrottle> throttles_to_register = |
| GetContentClient()->browser()->CreateThrottlesForNavigation(this); |
| if (throttles_to_register.size() > 0) { |
| @@ -412,7 +416,7 @@ NavigationHandleImpl::CheckWillStartRequest() { |
| next_index_ = i + 1; |
| return result; |
| - default: |
| + case NavigationThrottle::BLOCK_RESPONSE: |
| NOTREACHED(); |
| } |
| } |
| @@ -443,7 +447,7 @@ NavigationHandleImpl::CheckWillRedirectRequest() { |
| next_index_ = i + 1; |
| return result; |
| - default: |
| + case NavigationThrottle::BLOCK_RESPONSE: |
| NOTREACHED(); |
| } |
| } |
| @@ -469,6 +473,7 @@ NavigationHandleImpl::CheckWillProcessResponse() { |
| case NavigationThrottle::PROCEED: |
| continue; |
| + case NavigationThrottle::BLOCK_RESPONSE: |
| case NavigationThrottle::CANCEL: |
| case NavigationThrottle::CANCEL_AND_IGNORE: |
| state_ = CANCELING; |