Chromium Code Reviews| Index: ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm |
| diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm |
| index 3fb509f14aefe104bec348c3038c1326ee9dde0e..83b87bd0222f60ec727b1cee7d6339d3b16b08a0 100644 |
| --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm |
| +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm |
| @@ -41,6 +41,8 @@ const NSTimeInterval kAnimationDuration = 0.35; |
| @synthesize suggestionCommandHandler = _suggestionCommandHandler; |
| @synthesize collectionUpdater = _collectionUpdater; |
| +#pragma mark - Public |
| + |
| - (instancetype)initWithStyle:(CollectionViewControllerStyle)style |
| dataSource:(id<ContentSuggestionsDataSource>)dataSource { |
| self = [super initWithStyle:style]; |
| @@ -51,6 +53,19 @@ const NSTimeInterval kAnimationDuration = 0.35; |
| return self; |
| } |
| +- (void)dismissEntryAtIndexPath:(NSIndexPath*)indexPath { |
| + if (!indexPath) |
| + return; |
| + |
| + [self.collectionView performBatchUpdates:^{ |
| + [self collectionView:self.collectionView |
| + willDeleteItemsAtIndexPaths:@[ indexPath ]]; |
|
lpromero
2017/03/06 10:29:00
Why do you call this? So that the item is removed
gambard
2017/03/06 12:16:00
I use performBatchUpdates defensively because the
lpromero
2017/03/06 13:02:30
Can -dismissEntryAtIndexPath: be called several ti
gambard
2017/03/06 17:25:33
For now it should not be called in the same turn o
|
| + |
| + [self.collectionView deleteItemsAtIndexPaths:@[ indexPath ]]; |
| + } |
| + completion:nil]; |
| +} |
| + |
| #pragma mark - UIViewController |
| - (void)viewDidLoad { |
| @@ -197,8 +212,10 @@ const NSTimeInterval kAnimationDuration = 0.35; |
| ContentSuggestionsArticleItem* articleItem = |
| base::mac::ObjCCastStrict<ContentSuggestionsArticleItem>(touchedItem); |
| - [self.suggestionCommandHandler displayContextMenuForArticle:articleItem |
| - atPoint:touchLocation]; |
| + [self.suggestionCommandHandler |
| + displayContextMenuForArticle:articleItem |
| + atPoint:touchLocation |
| + atIndexPath:touchedItemIndexPath]; |
| } |
| @end |