Commit 99162f9e authored by Eugene But's avatar Eugene But Committed by Commit Bot

Do not start SadTabCoordinator for invisible Tab.

This fixes the issue when side swiping from one SadTab to another.
Since -[SadTabCoordinator start] is idempotent it is important to start
coordinator for new sad tab, not for the old one which is not visible
anymore.

Bug: 901563
Change-Id: I9dfb488037da18be5fdb1079e849b723fa723c08
Reviewed-on: https://chromium-review.googlesource.com/c/1337814
Commit-Queue: Eugene But <eugenebut@chromium.org>
Reviewed-by: default avatarKurt Horimoto <kkhorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609011}
parent ca740c83
......@@ -5122,13 +5122,18 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint
[[self.infoBarCoordinator view] setHidden:NO];
if (base::FeatureList::IsEnabled(kPresentSadTabInViewController)) {
// SatTabCoordinator was stopped when SideSwipeContentView was removed.
SadTabTabHelper* sadTabHelper =
SadTabTabHelper::FromWebState(self.tabModel.currentTab.webState);
if (sadTabHelper && sadTabHelper->is_showing_sad_tab()) {
SadTabCoordinator* sadTabCoordinator =
base::mac::ObjCCastStrict<SadTabCoordinator>(_sadTabCoordinator);
[sadTabCoordinator start];
web::WebState* webState = self.tabModel.currentTab.webState;
if (webState && webState->IsVisible()) {
// Side swipe did not change the tab represented by |webState|.
SadTabTabHelper* sadTabHelper = SadTabTabHelper::FromWebState(webState);
if (sadTabHelper && sadTabHelper->is_showing_sad_tab()) {
SadTabCoordinator* sadTabCoordinator =
base::mac::ObjCCastStrict<SadTabCoordinator>(_sadTabCoordinator);
[sadTabCoordinator start];
}
} else {
// Side swipe did change the tab and |webState| represents previous tab
// which is not visible anymore.
}
}
}
......
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