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

Unified Diff: ios/chrome/browser/ui/content_suggestions/content_suggestions_data_source.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_data_source.h
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_data_source.h b/ios/chrome/browser/ui/content_suggestions/content_suggestions_data_source.h
index 671b7f152877e7fb5fe325688d4a6ed68e35561a..5ea35b4acf3c5dc9a96f8231860e99b8cedb70ff 100644
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_data_source.h
+++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_data_source.h
@@ -5,16 +5,20 @@
#ifndef IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_DATA_SOURCE_H_
#define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_DATA_SOURCE_H_
+#import <UIKit/UIKit.h>
+
+@class CollectionViewItem;
@class ContentSuggestion;
@class ContentSuggestionIdentifier;
@class ContentSuggestionsSectionInformation;
@class FaviconAttributes;
@protocol ContentSuggestionsDataSink;
@protocol ContentSuggestionsImageFetcher;
-class GURL;
+@protocol SuggestedContent;
// Typedef for a block taking the fetched suggestions as parameter.
-typedef void (^MoreSuggestionsFetched)(NSArray<ContentSuggestion*>* _Nonnull);
+typedef void (^MoreSuggestionsFetched)(
+ NSArray<CollectionViewItem<SuggestedContent>*>* _Nullable);
// DataSource for the content suggestions. Provides the suggestions data in a
// format compatible with Objective-C.
@@ -23,30 +27,30 @@ typedef void (^MoreSuggestionsFetched)(NSArray<ContentSuggestion*>* _Nonnull);
// The data sink that will be notified when the data change.
@property(nonatomic, nullable, weak) id<ContentSuggestionsDataSink> dataSink;
-// Returns all the data currently available.
-- (nonnull NSArray<ContentSuggestion*>*)allSuggestions;
+// Returns all the sections information in the order they should be displayed.
+- (nonnull NSArray<ContentSuggestionsSectionInformation*>*)sectionsInfo;
-// Returns the data currently available for the section identified by
-// |sectionInfo|.
-- (nonnull NSArray<ContentSuggestion*>*)suggestionsForSection:
+// Returns the items associated with the |sectionInfo|.
+- (nonnull NSArray<CollectionViewItem<SuggestedContent>*>*)itemsForSectionInfo:
(nonnull ContentSuggestionsSectionInformation*)sectionInfo;
// Returns an image updater for the suggestions provided by this data source.
- (nullable id<ContentSuggestionsImageFetcher>)imageFetcher;
-// Fetches favicon attributes and calls the completion block.
-- (void)fetchFaviconAttributesForURL:(const GURL&)URL
- completion:
- (void (^_Nonnull)(FaviconAttributes* _Nonnull))
- completion;
+// Fetches favicon attributes associated with the |item| and calls the
+// |completion| block.
+- (void)fetchFaviconAttributesForItem:
+ (nonnull CollectionViewItem<SuggestedContent>*)item
+ completion:
+ (void (^_Nonnull)(FaviconAttributes* _Nonnull))
+ completion;
-// Fetches favicon image associated with this |suggestion| in history. If it is
-// not present in the history, tries to download it. Calls the completion block
-// if an image has been found.
-// This can only be used for public URL.
+// Fetches the favicon image associated with the |item|. If there is no image
+// cached locally and the provider allows it, it tries to download it. The
+// |completion| block is only called if an image is found.
- (void)
-fetchFaviconImageForSuggestion:(nonnull ContentSuggestionIdentifier*)suggestion
- completion:(void (^_Nonnull)(UIImage* _Nonnull))completion;
+fetchFaviconImageForItem:(nonnull CollectionViewItem<SuggestedContent>*)item
+ completion:(void (^_Nonnull)(UIImage* _Nonnull))completion;
// Fetches additional content. All the |knownSuggestions| must come from the
// same |sectionInfo|. If the fetch was completed, the given |callback| is
@@ -56,7 +60,7 @@ fetchFaviconImageForSuggestion:(nonnull ContentSuggestionIdentifier*)suggestion
fromSectionInfo:
(nonnull ContentSuggestionsSectionInformation*)
sectionInfo
- callback:(nullable MoreSuggestionsFetched)callback;
+ callback:(nonnull MoreSuggestionsFetched)callback;
@end

Powered by Google App Engine
This is Rietveld 408576698