Commit 051bc595 authored by edchin's avatar edchin Committed by Commit Bot

[ios] Disable Undo-Close-All when tab grid is not empty

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: default avatarSergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811938}
parent 0b607d96
......@@ -1158,6 +1158,10 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) {
- (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;
......@@ -1247,10 +1251,11 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) {
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:
......
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