Commit 635bc2d2 authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

Add popup menu to the tab grid button

This CL adds a popup menu to create new (incognito) tab when long
pressing the tab grid button.

Bug: 821560
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: Ib1a8c7ff3e82cb4422ba50f01993be5e28be275d
Reviewed-on: https://chromium-review.googlesource.com/980255Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#546054}
parent 7b882500
...@@ -94,12 +94,18 @@ ...@@ -94,12 +94,18 @@
} }
- (void)showTabGridButtonPopup { - (void)showTabGridButtonPopup {
UIViewController* viewController = [[UIViewController alloc] init]; PopupMenuTableViewController* tableViewController =
UILabel* label = [[UILabel alloc] init]; [[PopupMenuTableViewController alloc] init];
label.text = @"TabGrid"; tableViewController.dispatcher =
viewController.view = label; static_cast<id<ApplicationCommands, BrowserCommands>>(self.dispatcher);
// TODO(crbug.com/821560): Use the tab grid menu instead of a label. tableViewController.baseViewController = self.baseViewController;
[self presentPopupForContent:viewController fromNamedGuide:kTabSwitcherGuide];
self.mediator = [[PopupMenuMediator alloc] initWithType:PopupMenuTypeTabGrid];
self.mediator.webStateList = self.webStateList;
self.mediator.popupMenu = tableViewController;
[self presentPopupForContent:tableViewController
fromNamedGuide:kTabSwitcherGuide];
} }
- (void)searchButtonPopup { - (void)searchButtonPopup {
......
...@@ -217,6 +217,7 @@ PopupMenuToolsItem* CreateTableViewItem(int titleID, ...@@ -217,6 +217,7 @@ PopupMenuToolsItem* CreateTableViewItem(int titleID,
case PopupMenuTypeNavigationBackward: case PopupMenuTypeNavigationBackward:
break; break;
case PopupMenuTypeTabGrid: case PopupMenuTypeTabGrid:
self.items = @[ [self itemsForNewTab] ];
break; break;
case PopupMenuTypeSearch: case PopupMenuTypeSearch:
break; break;
......
...@@ -77,6 +77,7 @@ ...@@ -77,6 +77,7 @@
[self addLongPressGestureToView:self.view.backButton]; [self addLongPressGestureToView:self.view.backButton];
[self addLongPressGestureToView:self.view.forwardButton]; [self addLongPressGestureToView:self.view.forwardButton];
[self addLongPressGestureToView:self.view.forwardButtonTrailingPosition]; [self addLongPressGestureToView:self.view.forwardButtonTrailingPosition];
[self addLongPressGestureToView:self.view.tabGridButton];
} }
- (void)traitCollectionDidChange:(UITraitCollection*)previousTraitCollection { - (void)traitCollectionDidChange:(UITraitCollection*)previousTraitCollection {
...@@ -270,6 +271,8 @@ ...@@ -270,6 +271,8 @@
} else { } else {
[self.dispatcher showTabHistoryPopupForForwardHistory]; [self.dispatcher showTabHistoryPopupForForwardHistory];
} }
} else if (gesture.view == self.view.tabGridButton) {
[self.dispatcher showTabGridButtonPopup];
} }
} }
......
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