| 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..3754aa9ff72f0f36b8e098e34d786d9f22279726 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,20 @@ const NSTimeInterval kAnimationDuration = 0.35;
|
| return self;
|
| }
|
|
|
| +- (void)dismissEntryAtIndexPath:(NSIndexPath*)indexPath {
|
| + if (!indexPath || ![self.collectionViewModel hasItemAtIndexPath:indexPath]) {
|
| + return;
|
| + }
|
| +
|
| + [self.collectionView performBatchUpdates:^{
|
| + [self collectionView:self.collectionView
|
| + willDeleteItemsAtIndexPaths:@[ indexPath ]];
|
| +
|
| + [self.collectionView deleteItemsAtIndexPaths:@[ indexPath ]];
|
| + }
|
| + completion:nil];
|
| +}
|
| +
|
| #pragma mark - UIViewController
|
|
|
| - (void)viewDidLoad {
|
| @@ -197,8 +213,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
|
|
|