Commit bf7eefda authored by Xiaoqian Dai's avatar Xiaoqian Dai Committed by Commit Bot

back nudge: fix the issue that nudge can be fired more than once.

For one navigation operation, we would like the nudge only be fired
once. So this CL makes more restriction on when the navigation status
change can be fired to show the nudge ui (and cancel the previous one if
applicable).

Bug: 1009005b
Change-Id: I90b79e9ffb6219a66172364c976e69a9479670dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2086553Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Xiaoqian Dai <xdai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746830}
parent 63b1b0c1
...@@ -46,8 +46,14 @@ void BackGestureContextualNudgeDelegate::MaybeStartTrackingNavigation( ...@@ -46,8 +46,14 @@ void BackGestureContextualNudgeDelegate::MaybeStartTrackingNavigation(
void BackGestureContextualNudgeDelegate::DidFinishNavigation( void BackGestureContextualNudgeDelegate::DidFinishNavigation(
content::NavigationHandle* navigation_handle) { content::NavigationHandle* navigation_handle) {
DCHECK(window_); DCHECK(window_);
if (navigation_handle->HasCommitted()) // Make sure for one valid navigation, we only fire one status change
// notification.
if (navigation_handle->HasCommitted() &&
(navigation_handle->IsInMainFrame() ||
navigation_handle->HasSubframeNavigationEntryCommitted()) &&
(navigation_handle->GetURL() != navigation_handle->GetPreviousURL())) {
controller_->NavigationEntryChanged(window_); controller_->NavigationEntryChanged(window_);
}
} }
void BackGestureContextualNudgeDelegate::OnTabStripModelChanged( void BackGestureContextualNudgeDelegate::OnTabStripModelChanged(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment