| 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 dd85b856122b0482f828615ced9c46712e65c261..3400713651ce129499cf3fd8d89cb6fb1e4b85a6 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
|
| @@ -118,9 +118,18 @@ const CGFloat kToolbarHeight = 64.0f;
|
| [cell setAppearanceForTabTitle:[self.dataSource titleAtIndex:indexPath.item]
|
| favicon:nil
|
| cellSize:CGSizeZero];
|
| + [cell setSelected:(indexPath.item == [self.dataSource indexOfActiveTab])];
|
| return cell;
|
| }
|
|
|
| +#pragma mark - UICollectionViewDelegate methods
|
| +
|
| +- (BOOL)collectionView:(UICollectionView*)collectionView
|
| + shouldSelectItemAtIndexPath:(NSIndexPath*)indexPath {
|
| + // Prevent user selection of items.
|
| + return NO;
|
| +}
|
| +
|
| #pragma mark - ZoomTransitionDelegate methods
|
|
|
| - (CGRect)rectForZoomWithKey:(NSObject*)key inView:(UIView*)view {
|
| @@ -149,6 +158,13 @@ const CGFloat kToolbarHeight = 64.0f;
|
| NSInteger index = [self.grid numberOfItemsInSection:0];
|
| NSIndexPath* indexPath = [NSIndexPath indexPathForItem:index inSection:0];
|
| auto updateBlock = ^{
|
| + // Unselect current selected item.
|
| + NSInteger selectedIndex = [self.dataSource indexOfActiveTab];
|
| + NSIndexPath* selectedIndexPath =
|
| + [NSIndexPath indexPathForItem:selectedIndex inSection:0];
|
| + [self.grid reloadItemsAtIndexPaths:@[ selectedIndexPath ]];
|
| +
|
| + // Create and show new tab.
|
| [self.tabCommandHandler createNewTabAtIndexPath:indexPath];
|
| [self.tabCommandHandler showTabAtIndexPath:indexPath];
|
| [self.grid insertItemsAtIndexPaths:@[ indexPath ]];
|
| @@ -164,7 +180,14 @@ const CGFloat kToolbarHeight = 64.0f;
|
| }
|
|
|
| - (void)cellPressed:(UICollectionViewCell*)cell {
|
| - [self.tabCommandHandler showTabAtIndexPath:[self.grid indexPathForCell:cell]];
|
| + NSInteger selectedIndex = [self.dataSource indexOfActiveTab];
|
| + NSIndexPath* selectedIndexPath =
|
| + [NSIndexPath indexPathForItem:selectedIndex inSection:0];
|
| +
|
| + NSIndexPath* newSelectedIndexPath = [self.grid indexPathForCell:cell];
|
| + [self.tabCommandHandler showTabAtIndexPath:newSelectedIndexPath];
|
| + [self.grid
|
| + reloadItemsAtIndexPaths:@[ selectedIndexPath, newSelectedIndexPath ]];
|
| }
|
|
|
| - (void)deleteButtonPressedForCell:(UICollectionViewCell*)cell {
|
|
|