| 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 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_view_cont
roller.h" | 5 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_view_cont
roller.h" |
| 6 | 6 |
| 7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrom
e.h" | 8 #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrom
e.h" |
| 9 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" | 9 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" |
| 10 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h" | 10 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 140 |
| 141 CollectionViewItem* item = | 141 CollectionViewItem* item = |
| 142 [self.collectionViewModel itemAtIndexPath:indexPath]; | 142 [self.collectionViewModel itemAtIndexPath:indexPath]; |
| 143 switch ([self.collectionUpdater contentSuggestionTypeForItem:item]) { | 143 switch ([self.collectionUpdater contentSuggestionTypeForItem:item]) { |
| 144 case ContentSuggestionTypeReadingList: | 144 case ContentSuggestionTypeReadingList: |
| 145 [self openReadingListItem:item]; | 145 [self openReadingListItem:item]; |
| 146 break; | 146 break; |
| 147 case ContentSuggestionTypeArticle: | 147 case ContentSuggestionTypeArticle: |
| 148 [self openArticle:item]; | 148 [self openArticle:item]; |
| 149 break; | 149 break; |
| 150 case ContentSuggestionTypeMostVisited: |
| 151 // TODO(crbug.com/707754): Open the most visited site. |
| 152 break; |
| 150 case ContentSuggestionTypeEmpty: | 153 case ContentSuggestionTypeEmpty: |
| 151 break; | 154 break; |
| 152 } | 155 } |
| 153 } | 156 } |
| 154 | 157 |
| 155 #pragma mark - ContentSuggestionsExpandableCellDelegate | 158 #pragma mark - ContentSuggestionsExpandableCellDelegate |
| 156 | 159 |
| 157 - (void)collapseCell:(UICollectionViewCell*)cell { | 160 - (void)collapseCell:(UICollectionViewCell*)cell { |
| 158 [self expand:NO cell:cell]; | 161 [self expand:NO cell:cell]; |
| 159 } | 162 } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 - (void)addEmptySectionPlaceholderIfNeeded:(NSInteger)section { | 294 - (void)addEmptySectionPlaceholderIfNeeded:(NSInteger)section { |
| 292 if ([self.collectionViewModel numberOfItemsInSection:section] > 0) | 295 if ([self.collectionViewModel numberOfItemsInSection:section] > 0) |
| 293 return; | 296 return; |
| 294 | 297 |
| 295 NSIndexPath* emptyItem = | 298 NSIndexPath* emptyItem = |
| 296 [self.collectionUpdater addEmptyItemForSection:section]; | 299 [self.collectionUpdater addEmptyItemForSection:section]; |
| 297 [self.collectionView insertItemsAtIndexPaths:@[ emptyItem ]]; | 300 [self.collectionView insertItemsAtIndexPaths:@[ emptyItem ]]; |
| 298 } | 301 } |
| 299 | 302 |
| 300 @end | 303 @end |
| OLD | NEW |