Skip to content

Commit

Permalink
Add Selection mode entry point from TabGrid Context menu
Browse files Browse the repository at this point in the history
Bug: 1196955
Change-Id: I8f904e86795cd53f78567fca9e78eb437d9781ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3061510
Reviewed-by: Mark Cogan <marq@chromium.org>
Reviewed-by: Caitlin Fischer <caitlinfischer@google.com>
Commit-Queue: Mohammad Refaat <mrefaat@chromium.org>
Cr-Commit-Position: refs/heads/master@{#907627}
  • Loading branch information
mrefaat88 authored and Chromium LUCI CQ committed Aug 2, 2021
1 parent 82f07d1 commit 938b695
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ios/chrome/browser/ui/menu/tab_context_menu_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ class DistantSession;
// Tells the delegate to edit the bookmark for |URL|.
- (void)editBookmarkWithURL:(const GURL&)URL;

// Tells the delegate to open the tab grid selection mode.
- (void)selectTabs;

// Tells the delegate to close the tab with the item identifier |identifier|.
- (void)closeTabWithIdentifier:(NSString*)identifier incognito:(BOOL)incognito;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ - (UIContextMenuConfiguration*)contextMenuConfigurationForGridCell:
}
}

if ([weakSelf.contextMenuDelegate
respondsToSelector:@selector(selectTabs)]) {
[menuElements addObject:[actionFactory actionToSelectTabsWithBlock:^{
[weakSelf.contextMenuDelegate selectTabs];
}]];
}
if ([weakSelf.contextMenuDelegate
respondsToSelector:@selector(closeTabWithIdentifier:
incognito:)]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,12 @@ - (void)closeTabWithIdentifier:(NSString*)identifier incognito:(BOOL)incognito {
}
}

- (void)selectTabs {
base::RecordAction(
base::UserMetricsAction("MobileTabGridTabContextMenuSelectTabs"));
self.baseViewController.tabGridMode = TabGridModeSelection;
}

- (void)removeSessionAtTableSectionWithIdentifier:(NSInteger)sectionIdentifier {
[self.baseViewController.remoteTabsViewController
removeSessionAtTableSectionWithIdentifier:sectionIdentifier];
Expand Down
8 changes: 8 additions & 0 deletions tools/metrics/actions/actions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16210,6 +16210,14 @@ should be able to be added at any place in this file.
</description>
</action>

<action name="MobileTabGridTabContextMenuSelectTabs">
<owner>mrefaat@chromium.org</owner>
<owner>michaeldo@chromium.org</owner>
<description>
User in the iOS tab grid used the tab context menu to enter selection mode.
</description>
</action>

<action name="MobileTabGridUndoCloseAllRegularTabs">
<owner>edchin@chromium.org</owner>
<owner>marq@chromium.org</owner>
Expand Down

0 comments on commit 938b695

Please sign in to comment.