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

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

Issue 2691593002: Connect ContentSuggestionsMediator to the ContentService (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
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 (item.type) {
75 case ItemTypeStack: 75 case ContentSuggestionsItemTypeStack:
76 [self.suggestionCommandHandler openReadingList]; 76 [self.suggestionCommandHandler openReadingList];
77 break; 77 break;
78 case ItemTypeArticle: 78 case ContentSuggestionsItemTypeArticle:
79 [self openArticle:item]; 79 [self openArticle:item];
80 break; 80 break;
81 default: 81 default:
82 break; 82 break;
83 } 83 }
84 } 84 }
85 85
86 #pragma mark - ContentSuggestionsExpandableCellDelegate 86 #pragma mark - ContentSuggestionsExpandableCellDelegate
87 87
88 - (void)collapseCell:(UICollectionViewCell*)cell { 88 - (void)collapseCell:(UICollectionViewCell*)cell {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 179 }
180 } 180 }
181 181
182 - (void)openArticle:(CollectionViewItem*)item { 182 - (void)openArticle:(CollectionViewItem*)item {
183 ContentSuggestionsArticleItem* article = 183 ContentSuggestionsArticleItem* article =
184 base::mac::ObjCCastStrict<ContentSuggestionsArticleItem>(item); 184 base::mac::ObjCCastStrict<ContentSuggestionsArticleItem>(item);
185 [self.suggestionCommandHandler openURL:article.articleURL]; 185 [self.suggestionCommandHandler openURL:article.articleURL];
186 } 186 }
187 187
188 @end 188 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698