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 @@
}
- (void)showTabGridButtonPopup {
UIViewController* viewController = [[UIViewController alloc] init];
UILabel* label = [[UILabel alloc] init];
label.text = @"TabGrid";
viewController.view = label;
// TODO(crbug.com/821560): Use the tab grid menu instead of a label.
[self presentPopupForContent:viewController fromNamedGuide:kTabSwitcherGuide];
PopupMenuTableViewController* tableViewController =
[[PopupMenuTableViewController alloc] init];
tableViewController.dispatcher =
static_cast<id<ApplicationCommands, BrowserCommands>>(self.dispatcher);
tableViewController.baseViewController = self.baseViewController;
self.mediator = [[PopupMenuMediator alloc] initWithType:PopupMenuTypeTabGrid];
self.mediator.webStateList = self.webStateList;
self.mediator.popupMenu = tableViewController;
[self presentPopupForContent:tableViewController
fromNamedGuide:kTabSwitcherGuide];
}
- (void)searchButtonPopup {
......
......@@ -217,6 +217,7 @@ PopupMenuToolsItem* CreateTableViewItem(int titleID,
case PopupMenuTypeNavigationBackward:
break;
case PopupMenuTypeTabGrid:
self.items = @[ [self itemsForNewTab] ];
break;
case PopupMenuTypeSearch:
break;
......
......@@ -77,6 +77,7 @@
[self addLongPressGestureToView:self.view.backButton];
[self addLongPressGestureToView:self.view.forwardButton];
[self addLongPressGestureToView:self.view.forwardButtonTrailingPosition];
[self addLongPressGestureToView:self.view.tabGridButton];
}
- (void)traitCollectionDidChange:(UITraitCollection*)previousTraitCollection {
......@@ -270,6 +271,8 @@
} else {
[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