Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Unified Diff: content/browser/frame_host/navigation_handle_impl.cc

Issue 2632633006: Implement NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE. (Closed)
Patch Set: Rebase. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 a5459d616a3ec8087786bbe6be27ca47b1aa541f..4618ff5ead4a88123ac9044bc785e72edbf3ca11 100644
--- a/content/browser/frame_host/navigation_handle_impl.cc
+++ b/content/browser/frame_host/navigation_handle_impl.cc
@@ -338,7 +338,14 @@ void NavigationHandleImpl::CancelDeferredNavigation(
state_ == DEFERRING_REDIRECT ||
state_ == DEFERRING_RESPONSE);
DCHECK(result == NavigationThrottle::CANCEL_AND_IGNORE ||
- result == NavigationThrottle::CANCEL);
+ result == NavigationThrottle::CANCEL ||
+ result == NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE);
+ DCHECK(state_ != DEFERRING_RESPONSE ||
+ result != NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE);
+
+ if (result == NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE)
+ frame_tree_node_->SetFrameOwnerCollapsedState(true);
+
state_ = CANCELING;
RunCompleteCallback(result);
}
@@ -649,6 +656,13 @@ void NavigationHandleImpl::DidCommitNavigation(
state_ = DID_COMMIT_ERROR_PAGE;
} else {
state_ = DID_COMMIT;
+
+ // Getting this far means that the navigation was not blocked, and neither
+ // is this the error page navigation following a blocked navigation. Ensure
+ // the frame owner element is no longer collapsed as a result of a prior
+ // navigation having been blocked with BLOCK_REQUEST_AND_COLLAPSE.
+ if (!frame_tree_node()->IsMainFrame())
+ frame_tree_node()->SetFrameOwnerCollapsedState(false);
}
}
@@ -681,6 +695,11 @@ NavigationHandleImpl::CheckWillStartRequest() {
state_ = CANCELING;
return result;
+ case NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE:
+ frame_tree_node_->SetFrameOwnerCollapsedState(true);
+ state_ = CANCELING;
+ return result;
+
case NavigationThrottle::DEFER:
state_ = DEFERRING_START;
next_index_ = i + 1;
@@ -712,6 +731,11 @@ NavigationHandleImpl::CheckWillRedirectRequest() {
state_ = CANCELING;
return result;
+ case NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE:
+ frame_tree_node_->SetFrameOwnerCollapsedState(true);
+ state_ = CANCELING;
+ return result;
+
case NavigationThrottle::DEFER:
state_ = DEFERRING_REDIRECT;
next_index_ = i + 1;
@@ -756,6 +780,7 @@ NavigationHandleImpl::CheckWillProcessResponse() {
return result;
case NavigationThrottle::BLOCK_REQUEST:
+ case NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE:
NOTREACHED();
}
}

Powered by Google App Engine
This is Rietveld 408576698