Commit 3a42ed0d authored by Sebastien Lalancette's avatar Sebastien Lalancette Committed by Commit Bot

[iOS] Fix Tab Grid Recent Tabs Open in New Tab

The issue:
Triggering "Open in New Tab" from the tab grid recent tabs' context menu
did not navigate the user to that tab. The tab count was incremented,
but it was hard to tell from the UI that something happened.

The fix:
Navigate the user to the new tab.

Other fix:
- Added a similar solution for incognito. The issue didn't happen in
  incognito, but I found it awkward to not have a similar approach.

Bug: 1093302
Change-Id: I0513a1195b768bfaa802788443f411b8a24879c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2359557Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Commit-Queue: Sebastien Lalancette <seblalancette@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799130}
parent de95c6cd
......@@ -180,14 +180,17 @@
}
- (void)dismissRecentTabs {
// Stopping this coordinator reveals the tab UI underneath.
self.completion = nil;
[self stop];
}
- (void)showActiveRegularTabFromRecentTabs {
// Stopping this coordinator reveals the tab UI underneath.
self.completion = nil;
[self stop];
[self dismissRecentTabs];
}
- (void)showActiveIncognitoTabFromRecentTabs {
[self dismissRecentTabs];
}
- (void)showHistoryFromRecentTabs {
......
......@@ -75,21 +75,23 @@
[[NSMutableArray alloc] init];
[menuElements
addObject:[actionFactory
actionToOpenInNewTabWithURL:item.URL
completion:^{
[self.recentTabsPresentationDelegate
dismissRecentTabs];
}]];
addObject:
[actionFactory
actionToOpenInNewTabWithURL:item.URL
completion:^{
[strongSelf.recentTabsPresentationDelegate
showActiveRegularTabFromRecentTabs];
}]];
ProceduralBlock incognitoCompletion = ^{
[strongSelf.recentTabsPresentationDelegate
showActiveIncognitoTabFromRecentTabs];
};
[menuElements
addObject:
[actionFactory
actionToOpenInNewIncognitoTabWithURL:item.URL
completion:^{
[self.recentTabsPresentationDelegate
dismissRecentTabs];
}]];
completion:incognitoCompletion]];
if (IsMultipleScenesSupported()) {
[menuElements
......@@ -98,8 +100,9 @@
actionToOpenInNewWindowWithURL:item.URL
activityOrigin:WindowActivityRecentTabsOrigin
completion:^{
[self.recentTabsPresentationDelegate
dismissRecentTabs];
[strongSelf
.recentTabsPresentationDelegate
dismissRecentTabs];
}]];
}
......@@ -133,11 +136,13 @@
return [UIMenu menuWithTitle:@"" children:@[]];
}
RecentTabsContextMenuHelper* strongSelf = weakSelf;
// Record that this context menu was shown to the user.
RecordMenuShown(MenuScenario::kRecentTabsHeader);
ActionFactory* actionFactory = [[ActionFactory alloc]
initWithBrowser:self.browser
initWithBrowser:strongSelf.browser
scenario:MenuScenario::kRecentTabsHeader];
NSMutableArray<UIMenuElement*>* menuElements =
......@@ -149,14 +154,14 @@
if (!session->tabs.empty()) {
[menuElements addObject:[actionFactory actionToOpenAllTabsWithBlock:^{
[self.recentTabsPresentationDelegate
[strongSelf.recentTabsPresentationDelegate
openAllTabsFromSession:session];
}]];
}
[menuElements
addObject:[actionFactory actionToHideWithBlock:^{
[weakSelf.recentTabsContextMenuDelegate
[strongSelf.recentTabsContextMenuDelegate
removeSessionAtSessionSectionIdentifier:sectionIdentifier];
}]];
......
......@@ -20,6 +20,9 @@ class DistantSession;
// Tells the receiver to show the tab UI for regular tabs. NO-OP if the correct
// tab UI is already visible. Receiver may also dismiss recent tabs.
- (void)showActiveRegularTabFromRecentTabs;
// Tells the receiver to show the tab UI for incognito tabs. NO-OP if the
// correct tab UI is already visible. Receiver may also dismiss recent tabs.
- (void)showActiveIncognitoTabFromRecentTabs;
// Tells the receiver to show the history UI. Receiver may also dismiss recent
// tabs.
- (void)showHistoryFromRecentTabs;
......
......@@ -407,6 +407,12 @@
focusOmnibox:NO];
}
- (void)showActiveIncognitoTabFromRecentTabs {
[self.delegate tabGrid:self
shouldFinishWithBrowser:self.incognitoBrowser
focusOmnibox:NO];
}
#pragma mark - HistoryPresentationDelegate
- (void)showActiveRegularTabFromHistory {
......
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