Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Side by Side Diff: ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm

Issue 2697843003: Display articles in Content Suggestions (Closed)
Patch Set: Address comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } 64 }
65 65
66 #pragma mark - UICollectionViewDelegate 66 #pragma mark - UICollectionViewDelegate
67 67
68 - (void)collectionView:(UICollectionView*)collectionView 68 - (void)collectionView:(UICollectionView*)collectionView
69 didSelectItemAtIndexPath:(NSIndexPath*)indexPath { 69 didSelectItemAtIndexPath:(NSIndexPath*)indexPath {
70 [super collectionView:collectionView didSelectItemAtIndexPath:indexPath]; 70 [super collectionView:collectionView didSelectItemAtIndexPath:indexPath];
71 71
72 CollectionViewItem* item = 72 CollectionViewItem* item =
73 [self.collectionViewModel itemAtIndexPath:indexPath]; 73 [self.collectionViewModel itemAtIndexPath:indexPath];
74 switch (item.type) { 74 switch ([self.collectionUpdater contentSuggestionTypeForItem:item]) {
75 case ItemTypeStack: 75 case ContentSuggestionTypeArticle:
76 [self.suggestionCommandHandler openReadingList];
77 break;
78 case ItemTypeArticle:
79 [self openArticle:item]; 76 [self openArticle:item];
80 break; 77 break;
81 default:
82 break;
83 } 78 }
84 } 79 }
85 80
86 #pragma mark - ContentSuggestionsExpandableCellDelegate 81 #pragma mark - ContentSuggestionsExpandableCellDelegate
87 82
88 - (void)collapseCell:(UICollectionViewCell*)cell { 83 - (void)collapseCell:(UICollectionViewCell*)cell {
89 [self expand:NO cell:cell]; 84 [self expand:NO cell:cell];
90 } 85 }
91 86
92 - (void)expandCell:(UICollectionViewCell*)cell { 87 - (void)expandCell:(UICollectionViewCell*)cell {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 174 }
180 } 175 }
181 176
182 - (void)openArticle:(CollectionViewItem*)item { 177 - (void)openArticle:(CollectionViewItem*)item {
183 ContentSuggestionsArticleItem* article = 178 ContentSuggestionsArticleItem* article =
184 base::mac::ObjCCastStrict<ContentSuggestionsArticleItem>(item); 179 base::mac::ObjCCastStrict<ContentSuggestionsArticleItem>(item);
185 [self.suggestionCommandHandler openURL:article.articleURL]; 180 [self.suggestionCommandHandler openURL:article.articleURL];
186 } 181 }
187 182
188 @end 183 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698