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

Unified Diff: ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm

Issue 2755383002: Add ContentSuggestion for ReadingList (Closed)
Patch Set: Rebase Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
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 bea4610b3f01378aee9f95451d9c242bc4274d53..6ab71452369130c9db7571c8ab38708afb17116c 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
@@ -10,6 +10,7 @@
#import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_article_item.h"
#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_button_item_actions.h"
+#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_reading_list_item.h"
#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_stack_item.h"
#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_stack_item_actions.h"
#import "ios/chrome/browser/ui/content_suggestions/cells/expandable_item.h"
@@ -140,6 +141,9 @@ const NSTimeInterval kAnimationDuration = 0.35;
CollectionViewItem* item =
[self.collectionViewModel itemAtIndexPath:indexPath];
switch ([self.collectionUpdater contentSuggestionTypeForItem:item]) {
+ case ContentSuggestionTypeReadingList:
+ [self openReadingListItem:item];
+ break;
case ContentSuggestionTypeArticle:
[self openArticle:item];
break;
@@ -233,6 +237,16 @@ const NSTimeInterval kAnimationDuration = 0.35;
}
}
+// Opens the Reading List entry associated with |item|. |item| must be a
+// ContentSuggestionsReadingListItem.
+- (void)openReadingListItem:(CollectionViewItem*)item {
+ ContentSuggestionsReadingListItem* readingListItem =
+ base::mac::ObjCCastStrict<ContentSuggestionsReadingListItem>(item);
+ [self.suggestionCommandHandler openURL:readingListItem.url];
+}
+
+// Opens the article associated with |item|. |item| must be a
+// ContentSuggestionsArticleItem.
- (void)openArticle:(CollectionViewItem*)item {
ContentSuggestionsArticleItem* article =
base::mac::ObjCCastStrict<ContentSuggestionsArticleItem>(item);

Powered by Google App Engine
This is Rietveld 408576698