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 6b140ef425c9861dd32af6fd702019f191447d64..52ab39bddc844a533c26cfcfd06f3d12e9f197f7 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" |
| @@ -160,9 +161,9 @@ net::Error NavigationHandleImpl::GetNetErrorCode() { |
| } |
| RenderFrameHostImpl* NavigationHandleImpl::GetRenderFrameHost() { |
| - CHECK(state_ >= READY_TO_COMMIT) |
| + CHECK(state_ >= WILL_PROCESS_RESPONSE) |
|
nasko
2016/04/12 22:21:19
Would we know the RFH at this point?
Mike West
2016/04/13 13:28:08
We set it at the top of `NavigationHandleImpl::Wil
|
| << "This accessor should only be called " |
| - "after the navigation is ready to commit."; |
| + "after a response has been received."; |
| return render_frame_host_; |
| } |
| @@ -281,10 +282,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 = |
| + 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) { |
| @@ -401,7 +405,7 @@ NavigationHandleImpl::CheckWillStartRequest() { |
| next_index_ = i + 1; |
| return result; |
| - default: |
|
nasko
2016/04/12 22:21:19
Why remove the default case?
Mike West
2016/04/13 13:28:08
Because we completely enumerate the cases, and by
|
| + case NavigationThrottle::BLOCK_RESPONSE: |
| NOTREACHED(); |
| } |
| } |
| @@ -432,7 +436,7 @@ NavigationHandleImpl::CheckWillRedirectRequest() { |
| next_index_ = i + 1; |
| return result; |
| - default: |
|
nasko
2016/04/12 22:21:19
Same as above, why remove it?
Mike West
2016/04/13 13:28:08
Same as above: we completely enumerate the cases,
|
| + case NavigationThrottle::BLOCK_RESPONSE: |
| NOTREACHED(); |
| } |
| } |
| @@ -458,6 +462,7 @@ NavigationHandleImpl::CheckWillProcessResponse() { |
| case NavigationThrottle::PROCEED: |
| continue; |
| + case NavigationThrottle::BLOCK_RESPONSE: |
| case NavigationThrottle::CANCEL: |
| case NavigationThrottle::CANCEL_AND_IGNORE: |
| state_ = CANCELING; |