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 d096bdfd0bd69cfec66356ced4dc248c1be4d37a..01c8bab72794528c4a1b90c4d1def6d2d1d1c06c 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" |
@@ -159,9 +160,9 @@ net::Error NavigationHandleImpl::GetNetErrorCode() { |
} |
RenderFrameHostImpl* NavigationHandleImpl::GetRenderFrameHost() { |
- CHECK(state_ >= READY_TO_COMMIT) |
+ CHECK(state_ >= WILL_PROCESS_RESPONSE) |
<< "This accessor should only be called " |
- "after the navigation is ready to commit."; |
+ "after a response has been received."; |
return render_frame_host_; |
} |
@@ -280,10 +281,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)); |
nasko
2016/04/29 18:56:02
Should we register this throttle only in the case
Mike West
2016/05/02 09:37:52
It's a great idea! In fact, it's exactly what this
nasko
2016/05/02 17:22:08
Ah, I knew I saw it once and missed it on the last
|
+ |
+ // Register the embedder's navigation throttles. |
ScopedVector<NavigationThrottle> throttles_to_register = |
GetContentClient()->browser()->CreateThrottlesForNavigation(this); |
if (throttles_to_register.size() > 0) { |
@@ -400,7 +404,7 @@ NavigationHandleImpl::CheckWillStartRequest() { |
next_index_ = i + 1; |
return result; |
- default: |
+ case NavigationThrottle::BLOCK_RESPONSE: |
NOTREACHED(); |
} |
} |
@@ -431,7 +435,7 @@ NavigationHandleImpl::CheckWillRedirectRequest() { |
next_index_ = i + 1; |
return result; |
- default: |
+ case NavigationThrottle::BLOCK_RESPONSE: |
NOTREACHED(); |
} |
} |
@@ -457,6 +461,7 @@ NavigationHandleImpl::CheckWillProcessResponse() { |
case NavigationThrottle::PROCEED: |
continue; |
+ case NavigationThrottle::BLOCK_RESPONSE: |
case NavigationThrottle::CANCEL: |
case NavigationThrottle::CANCEL_AND_IGNORE: |
state_ = CANCELING; |