| 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 dde877bfb314722fa83408d641834414f062fb25..706910feee4065a8b232f5cbe64c90b07389b014 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
|
| @@ -9,6 +9,7 @@
|
| #import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_view_controller.h"
|
|
|
| #include "base/mac/foundation_util.h"
|
| +#import "ios/chrome/browser/ui/tab_switcher/tab_switcher_panel_cell.h"
|
| #import "ios/chrome/browser/ui/tab_switcher/tab_switcher_panel_collection_view_layout.h"
|
| #import "ios/chrome/browser/ui/tab_switcher/tab_switcher_panel_overlay_view.h"
|
| #import "ios/clean/chrome/browser/ui/actions/settings_actions.h"
|
| @@ -18,7 +19,6 @@
|
| #import "ios/clean/chrome/browser/ui/commands/tab_grid_commands.h"
|
| #import "ios/clean/chrome/browser/ui/tab_grid/mdc_floating_button+cr_tab_grid.h"
|
| #import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_collection_view_layout.h"
|
| -#import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_tab_cell.h"
|
| #import "ios/clean/chrome/browser/ui/tab_grid/ui_stack_view+cr_tab_grid.h"
|
|
|
| #if !defined(__has_feature) || !__has_feature(objc_arc)
|
| @@ -73,8 +73,8 @@
|
| self.grid = grid;
|
| self.grid.dataSource = self;
|
| self.grid.delegate = self;
|
| - [self.grid registerClass:[TabGridTabCell class]
|
| - forCellWithReuseIdentifier:[TabGridTabCell identifier]];
|
| + [self.grid registerClass:[TabSwitcherLocalSessionCell class]
|
| + forCellWithReuseIdentifier:[TabSwitcherLocalSessionCell identifier]];
|
|
|
| [NSLayoutConstraint activateConstraints:@[
|
| [self.grid.topAnchor constraintEqualToAnchor:toolbar.bottomAnchor],
|
| @@ -119,25 +119,17 @@
|
|
|
| - (UICollectionViewCell*)collectionView:(UICollectionView*)collectionView
|
| cellForItemAtIndexPath:(nonnull NSIndexPath*)indexPath {
|
| - TabGridTabCell* cell =
|
| - base::mac::ObjCCastStrict<TabGridTabCell>([collectionView
|
| - dequeueReusableCellWithReuseIdentifier:[TabGridTabCell identifier]
|
| + TabSwitcherLocalSessionCell* cell =
|
| + base::mac::ObjCCastStrict<TabSwitcherLocalSessionCell>([collectionView
|
| + dequeueReusableCellWithReuseIdentifier:
|
| + [TabSwitcherLocalSessionCell identifier]
|
| forIndexPath:indexPath]);
|
| cell.delegate = self;
|
| [cell setSessionType:TabSwitcherSessionType::REGULAR_SESSION];
|
| [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
|
| @@ -168,13 +160,6 @@
|
| 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 ]];
|
| @@ -190,14 +175,7 @@
|
| }
|
|
|
| - (void)cellPressed:(UICollectionViewCell*)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 ]];
|
| + [self.tabCommandHandler showTabAtIndexPath:[self.grid indexPathForCell:cell]];
|
| }
|
|
|
| - (void)deleteButtonPressedForCell:(UICollectionViewCell*)cell {
|
|
|