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

Unified Diff: ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.h

Issue 2877513003: ContentSuggestionsDataSource returns CollectionViewItem (Closed)
Patch Set: Address comments Created 3 years, 7 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_collection_updater.h
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.h b/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.h
index 1dd77eca70bdc3d26de6892f7defcbf61152e086..97b15673e4ff4c0b6b111d1e3e9a402e2c347015 100644
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.h
+++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.h
@@ -7,11 +7,22 @@
#import <UIKit/UIKit.h>
-#import "ios/chrome/browser/ui/content_suggestions/content_suggestion.h"
-
@class CollectionViewItem;
-@protocol ContentSuggestionsDataSource;
+@class ContentSuggestionsSectionInformation;
@class ContentSuggestionsViewController;
+@protocol ContentSuggestionsDataSource;
+@protocol SuggestedContent;
+
+// Enum defining the type of a ContentSuggestions.
+typedef NS_ENUM(NSInteger, ContentSuggestionType) {
+ // Use this type to pass information about an empty section. Suggestion of
+ // this type are empty and should not be displayed. The informations to be
+ // displayed are contained in the SectionInfo.
+ ContentSuggestionTypeEmpty,
+ ContentSuggestionTypeArticle,
+ ContentSuggestionTypeReadingList,
+ ContentSuggestionTypeMostVisited,
+};
// Updater for a CollectionViewController populating it with some items and
// handling the items addition.
@@ -25,7 +36,7 @@
// |collectionViewController| this Updater will update. Needs to be set before
// adding items.
-@property(nonatomic, assign)
+@property(nonatomic, weak)
ContentSuggestionsViewController* collectionViewController;
// Returns whether the section should use the default, non-card style.
@@ -36,16 +47,18 @@
// Adds the sections for the |suggestions| to the model and returns their
// indices.
-- (NSIndexSet*)addSectionsForSuggestionsToModel:
- (NSArray<ContentSuggestion*>*)suggestions;
+- (NSIndexSet*)addSectionsForSectionInfoToModel:
+ (NSArray<ContentSuggestionsSectionInformation*>*)sectionsInfo;
-// Adds the |suggestions| to the model and returns their index paths.
-// The caller must ensure the corresponding sections have been added to the
-// model.
-- (NSArray<NSIndexPath*>*)addSuggestionsToModel:
- (NSArray<ContentSuggestion*>*)suggestions;
+// Adds the |suggestions| to the model in the section corresponding to
+// |sectionInfo| and returns their index paths. The caller must ensure the
+// corresponding section has been added to the model.
+- (NSArray<NSIndexPath*>*)
+addSuggestionsToModel:
+ (NSArray<CollectionViewItem<SuggestedContent>*>*)suggestions
+ withSectionInfo:(ContentSuggestionsSectionInformation*)sectionInfo;
-// Adds the empty item to this |section| and returns its index path. The updater
+// Adds an empty item to this |section| and returns its index path. The updater
// does not do any check about the number of elements in the section.
- (NSIndexPath*)addEmptyItemForSection:(NSInteger)section;

Powered by Google App Engine
This is Rietveld 408576698