Commit 07981acb authored by edchin's avatar edchin Committed by Commit Bot

[ios] Modify done button behavior in tab grid

Updating the done button behavior to follow these rules:
- If I'm looking at something, that's where I end up when I press done.
- If I'm looking at recent tabs, then ending up where I began is least
surprising.

Bug: 836312
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: Idcac4af078aa0e8ca658aec8601db212b21585c0
Reviewed-on: https://chromium-review.googlesource.com/1108749Reviewed-by: default avataredchin <edchin@chromium.org>
Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Commit-Queue: edchin <edchin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569178}
parent 38174dbf
......@@ -622,7 +622,16 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) {
- (void)configureButtonsForActiveAndCurrentPage {
self.newTabButton.page = self.currentPage;
switch (self.activePage) {
if (self.currentPage == TabGridPageRemoteTabs) {
[self configureDoneButtonBasedOnPage:self.activePage];
} else {
[self configureDoneButtonBasedOnPage:self.currentPage];
}
[self configureCloseAllButtonForCurrentPageAndUndoAvailability];
}
- (void)configureDoneButtonBasedOnPage:(TabGridPage)page {
switch (page) {
case TabGridPageIncognitoTabs:
self.doneButton.enabled = !self.incognitoTabsViewController.gridEmpty;
break;
......@@ -630,11 +639,10 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) {
self.doneButton.enabled = !self.regularTabsViewController.gridEmpty;
break;
case TabGridPageRemoteTabs:
NOTREACHED() << "It is not possible to have entered tab grid directly "
"into remote tabs.";
NOTREACHED() << "The done button should not be configured based on the "
"contents of the recent tabs page.";
break;
}
[self configureCloseAllButtonForCurrentPageAndUndoAvailability];
}
- (void)configureCloseAllButtonForCurrentPageAndUndoAvailability {
......@@ -794,7 +802,12 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) {
#pragma mark - Control actions
- (void)doneButtonTapped:(id)sender {
[self.tabPresentationDelegate showActiveTabInPage:self.activePage];
TabGridPage newActivePage = self.currentPage;
if (self.currentPage == TabGridPageRemoteTabs) {
newActivePage = self.activePage;
}
self.activePage = newActivePage;
[self.tabPresentationDelegate showActiveTabInPage:newActivePage];
}
- (void)closeAllButtonTapped:(id)sender {
......
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