Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Unified Diff: ios/clean/chrome/browser/ui/tab_grid/tab_grid_view_controller.mm

Issue 2699223003: [tab_grid] Hack-in new tab FAB action. (Closed)
Patch Set: Address comments. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/clean/chrome/browser/ui/tab_grid/tab_grid_coordinator.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/clean/chrome/browser/ui/tab_grid/tab_grid_view_controller.mm
diff --git a/ios/clean/chrome/browser/ui/tab_grid/tab_grid_view_controller.mm b/ios/clean/chrome/browser/ui/tab_grid/tab_grid_view_controller.mm
index 6296bbe1925abe2f6e98119c66f8d4de537d3fcc..7c365fbcb7998ab208498c8057f871634dd87da1 100644
--- a/ios/clean/chrome/browser/ui/tab_grid/tab_grid_view_controller.mm
+++ b/ios/clean/chrome/browser/ui/tab_grid/tab_grid_view_controller.mm
@@ -145,6 +145,19 @@ const CGFloat kToolbarHeight = 64.0f;
[self.tabGridCommandHandler showTabGrid];
}
+- (void)createNewTab:(id)sender {
+ // PLACEHOLDER: The new WebStateList data structure will have implications
+ // on how new tabs are created.
+ NSInteger index = [self.grid numberOfItemsInSection:0];
+ NSIndexPath* indexPath = [NSIndexPath indexPathForItem:index inSection:0];
+ auto updateBlock = ^{
+ [self.tabCommandHandler createNewTabAtIndexPath:indexPath];
+ [self.tabCommandHandler showTabAtIndexPath:indexPath];
+ [self.grid insertItemsAtIndexPaths:@[ indexPath ]];
+ };
+ [self.grid performBatchUpdates:updateBlock completion:nil];
+}
+
#pragma mark - SessionCellDelegate
- (TabSwitcherCache*)tabSwitcherCache {
« no previous file with comments | « ios/clean/chrome/browser/ui/tab_grid/tab_grid_coordinator.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698