Commit d6317325 authored by Roberto Moura's avatar Roberto Moura Committed by Commit Bot

Add functionality to the New Tab button cell in the Grid View.

Open a new tab when the user taps the New Tab button cell.
Extend the GridViewControllerDelegate protocol to tell the delegate when
a new tab is opened.

Bug: 1127604, 1135329
Change-Id: If35f357df1c6a5f8eb9b181e76fb78ca241e0656
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2449994
Commit-Queue: Roberto Moura <mouraroberto@google.com>
Auto-Submit: Roberto Moura <mouraroberto@google.com>
Reviewed-by: default avataredchin <edchin@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815851}
parent caca7b86
......@@ -27,6 +27,10 @@
// |gridViewController|.
- (void)gridViewController:(GridViewController*)gridViewController
didCloseItemWithID:(NSString*)itemID;
// Tells the delegate that the plus sign was tapped in |gridViewController|,
// i.e., there was an intention to create a new item.
- (void)didTapPlusSignInGridViewController:
(GridViewController*)gridViewController;
// Tells the delegate that the item at |sourceIndex| was moved to
// |destinationIndex|.
- (void)gridViewController:(GridViewController*)gridViewController
......
......@@ -51,6 +51,11 @@
// No-op for unittests. This is only called when a user taps to close a cell,
// not generically when items are removed from the data source.
}
- (void)didTapPlusSignInGridViewController:
(GridViewController*)gridViewController {
// No-op for unittests. This is only called when a user taps on a
// plus sign cell, not generically when items are added to the data source.
}
@end
class GridViewControllerTest : public RootViewControllerTest {
......
......@@ -1191,6 +1191,17 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) {
}
}
- (void)didTapPlusSignInGridViewController:
(GridViewController*)gridViewController {
if (gridViewController == self.regularTabsViewController) {
[self.regularTabsDelegate addNewItem];
// TODO(crbug.com/1135329): Record when a new regular tab is opened.
} else if (gridViewController == self.incognitoTabsViewController) {
[self.incognitoTabsDelegate addNewItem];
// TODO(crbug.com/1135329): Record when a new incognito tab is opened.
}
}
- (void)gridViewController:(GridViewController*)gridViewController
didMoveItemWithID:(NSString*)itemID
toIndex:(NSUInteger)destinationIndex {
......
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