| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 128 |
| 129 CollectionViewItem* item = | 129 CollectionViewItem* item = |
| 130 [self.collectionViewModel itemAtIndexPath:indexPath]; | 130 [self.collectionViewModel itemAtIndexPath:indexPath]; |
| 131 switch ([self.collectionUpdater contentSuggestionTypeForItem:item]) { | 131 switch ([self.collectionUpdater contentSuggestionTypeForItem:item]) { |
| 132 case ContentSuggestionTypeReadingList: | 132 case ContentSuggestionTypeReadingList: |
| 133 [self openReadingListItem:item]; | 133 [self openReadingListItem:item]; |
| 134 break; | 134 break; |
| 135 case ContentSuggestionTypeArticle: | 135 case ContentSuggestionTypeArticle: |
| 136 [self openArticle:item]; | 136 [self openArticle:item]; |
| 137 break; | 137 break; |
| 138 case ContentSuggestionTypeMostVisited: |
| 139 // TODO(crbug.com/707754): Open the most visited site. |
| 140 break; |
| 138 case ContentSuggestionTypeEmpty: | 141 case ContentSuggestionTypeEmpty: |
| 139 break; | 142 break; |
| 140 } | 143 } |
| 141 } | 144 } |
| 142 | 145 |
| 143 #pragma mark - MDCCollectionViewStylingDelegate | 146 #pragma mark - MDCCollectionViewStylingDelegate |
| 144 | 147 |
| 145 - (UIColor*)collectionView:(nonnull UICollectionView*)collectionView | 148 - (UIColor*)collectionView:(nonnull UICollectionView*)collectionView |
| 146 cellBackgroundColorAtIndexPath:(nonnull NSIndexPath*)indexPath { | 149 cellBackgroundColorAtIndexPath:(nonnull NSIndexPath*)indexPath { |
| 147 if ([self.collectionUpdater | 150 if ([self.collectionUpdater |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 - (void)addEmptySectionPlaceholderIfNeeded:(NSInteger)section { | 238 - (void)addEmptySectionPlaceholderIfNeeded:(NSInteger)section { |
| 236 if ([self.collectionViewModel numberOfItemsInSection:section] > 0) | 239 if ([self.collectionViewModel numberOfItemsInSection:section] > 0) |
| 237 return; | 240 return; |
| 238 | 241 |
| 239 NSIndexPath* emptyItem = | 242 NSIndexPath* emptyItem = |
| 240 [self.collectionUpdater addEmptyItemForSection:section]; | 243 [self.collectionUpdater addEmptyItemForSection:section]; |
| 241 [self.collectionView insertItemsAtIndexPaths:@[ emptyItem ]]; | 244 [self.collectionView insertItemsAtIndexPaths:@[ emptyItem ]]; |
| 242 } | 245 } |
| 243 | 246 |
| 244 @end | 247 @end |
| OLD | NEW |