| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // ====== New Architecture ===== | 5 // ====== New Architecture ===== |
| 6 // = This code is only used in the new iOS Chrome architecture. = | 6 // = This code is only used in the new iOS Chrome architecture. = |
| 7 // ============================================================================ | 7 // ============================================================================ |
| 8 | 8 |
| 9 #import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_view_controller.h" | 9 #import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_view_controller.h" |
| 10 | 10 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 - (void)showSettings:(id)sender { | 138 - (void)showSettings:(id)sender { |
| 139 [self.settingsCommandHandler showSettings]; | 139 [self.settingsCommandHandler showSettings]; |
| 140 } | 140 } |
| 141 | 141 |
| 142 #pragma mark - TabGridActions | 142 #pragma mark - TabGridActions |
| 143 | 143 |
| 144 - (void)showTabGrid:(id)sender { | 144 - (void)showTabGrid:(id)sender { |
| 145 [self.tabGridCommandHandler showTabGrid]; | 145 [self.tabGridCommandHandler showTabGrid]; |
| 146 } | 146 } |
| 147 | 147 |
| 148 - (void)createNewTab:(id)sender { |
| 149 // PLACEHOLDER: The new WebStateList data structure will have implications |
| 150 // on how new tabs are created. |
| 151 NSInteger index = [self.grid numberOfItemsInSection:0]; |
| 152 NSIndexPath* indexPath = [NSIndexPath indexPathForItem:index inSection:0]; |
| 153 auto updateBlock = ^{ |
| 154 [self.tabCommandHandler createNewTabAtIndexPath:indexPath]; |
| 155 [self.tabCommandHandler showTabAtIndexPath:indexPath]; |
| 156 [self.grid insertItemsAtIndexPaths:@[ indexPath ]]; |
| 157 }; |
| 158 [self.grid performBatchUpdates:updateBlock completion:nil]; |
| 159 } |
| 160 |
| 148 #pragma mark - SessionCellDelegate | 161 #pragma mark - SessionCellDelegate |
| 149 | 162 |
| 150 - (TabSwitcherCache*)tabSwitcherCache { | 163 - (TabSwitcherCache*)tabSwitcherCache { |
| 151 // PLACEHOLDER: return image cache. | 164 // PLACEHOLDER: return image cache. |
| 152 return nil; | 165 return nil; |
| 153 } | 166 } |
| 154 | 167 |
| 155 - (void)cellPressed:(UICollectionViewCell*)cell { | 168 - (void)cellPressed:(UICollectionViewCell*)cell { |
| 156 [self.tabCommandHandler showTabAtIndexPath:[self.grid indexPathForCell:cell]]; | 169 [self.tabCommandHandler showTabAtIndexPath:[self.grid indexPathForCell:cell]]; |
| 157 } | 170 } |
| 158 | 171 |
| 159 - (void)deleteButtonPressedForCell:(UICollectionViewCell*)cell { | 172 - (void)deleteButtonPressedForCell:(UICollectionViewCell*)cell { |
| 160 auto updateBlock = ^{ | 173 auto updateBlock = ^{ |
| 161 NSIndexPath* indexPath = [self.grid indexPathForCell:cell]; | 174 NSIndexPath* indexPath = [self.grid indexPathForCell:cell]; |
| 162 [self.tabCommandHandler closeTabAtIndexPath:indexPath]; | 175 [self.tabCommandHandler closeTabAtIndexPath:indexPath]; |
| 163 [self.grid deleteItemsAtIndexPaths:@[ indexPath ]]; | 176 [self.grid deleteItemsAtIndexPaths:@[ indexPath ]]; |
| 164 }; | 177 }; |
| 165 [self.grid performBatchUpdates:updateBlock completion:nil]; | 178 [self.grid performBatchUpdates:updateBlock completion:nil]; |
| 166 } | 179 } |
| 167 | 180 |
| 168 @end | 181 @end |
| OLD | NEW |