Skip to content

Commit

Permalink
[ios] Disable Undo-Close-All when tab grid is not empty
Browse files Browse the repository at this point in the history
Undo-Close-All is only valid when the tab grid is empty.
This CL disables the undo action when a tab is added.

Bug: 1112759
Change-Id: I41e407068a227fc87b53be12db8f35329cff52a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2438233
Commit-Queue: edchin <edchin@chromium.org>
Auto-Submit: edchin <edchin@chromium.org>
Reviewed-by: Sergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811938}
  • Loading branch information
edx246 authored and Commit Bot committed Sep 30, 2020
1 parent 0b607d9 commit 051bc59
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ios/chrome/browser/ui/tab_grid/tab_grid_view_controller.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,10 @@ - (void)gridViewController:(GridViewController*)gridViewController

- (void)gridViewController:(GridViewController*)gridViewController
didChangeItemCount:(NSUInteger)count {
if (count > 0) {
// Undo is only available when the tab grid is empty.
self.undoCloseAllAvailable = NO;
}
[self configureButtonsForActiveAndCurrentPage];
if (gridViewController == self.regularTabsViewController) {
self.topToolbar.pageControl.regularTabCount = count;
Expand Down Expand Up @@ -1247,10 +1251,11 @@ - (void)closeAllButtonTapped:(id)sender {
self.regularTabsViewController.gridEmpty);
if (self.undoCloseAllAvailable) {
[self.regularTabsDelegate undoCloseAllItems];
self.undoCloseAllAvailable = NO;
} else {
[self.regularTabsDelegate saveAndCloseAllItems];
self.undoCloseAllAvailable = YES;
}
self.undoCloseAllAvailable = !self.undoCloseAllAvailable;
[self configureCloseAllButtonForCurrentPageAndUndoAvailability];
break;
case TabGridPageRemoteTabs:
Expand Down

0 comments on commit 051bc59

Please sign in to comment.