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

Unified Diff: ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm

Issue 2818453002: Download favicon from server for suggested articles (Closed)
Patch Set: Address comments Created 3 years, 8 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
« no previous file with comments | « no previous file | ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm
diff --git a/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm b/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm
index 19dbe62a4ee352666e252241b74221e5f525a326..6a83d8f74f1aece6a03afe4b61cbda015bf984a0 100644
--- a/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm
+++ b/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm
@@ -234,6 +234,27 @@ initWithContentService:(ntp_snippets::ContentSuggestionsService*)contentService
completion:completion];
}
+- (void)fetchFaviconImageForSuggestion:(ContentSuggestionIdentifier*)suggestion
+ completion:(void (^)(UIImage*))completion {
+ if (!completion)
+ return;
+
+ void (^imageCallback)(const gfx::Image&) = ^(const gfx::Image& image) {
+ if (!image.IsEmpty()) {
+ completion([image.ToUIImage() copy]);
+ }
+ };
+
+ ntp_snippets::ContentSuggestion::ID identifier =
+ ntp_snippets::ContentSuggestion::ID(
+ [[self categoryWrapperForSectionInfo:suggestion.sectionInfo]
+ category],
+ suggestion.IDInSection);
+ self.contentService->FetchSuggestionFavicon(
+ identifier, /* minimum_size_in_pixel = */ 1, kDefaultFaviconSize,
+ base::BindBlockArc(imageCallback));
+}
+
#pragma mark - ContentSuggestionsServiceObserver
- (void)contentSuggestionsService:
« no previous file with comments | « no previous file | ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698