Chromium Code Reviews| 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..12d593fde2523b7238140672ba3038d248e5715e 100644 |
| --- a/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm |
| +++ b/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm |
| @@ -234,6 +234,26 @@ 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]); |
|
lpromero
2017/04/14 13:19:40
Is the copy necessary? UIImage is immutable.
gambard
2017/04/14 13:28:10
It is a memory management thing. You can ask stkha
|
| + } |
| + }; |
| + |
| + ntp_snippets::ContentSuggestion::ID identifier = |
| + ntp_snippets::ContentSuggestion::ID( |
| + [[self categoryWrapperForSectionInfo:suggestion.sectionInfo] |
| + category], |
| + suggestion.IDInSection); |
| + self.contentService->FetchSuggestionFavicon( |
| + identifier, 1, kDefaultFaviconSize, base::BindBlockArc(imageCallback)); |
|
lpromero
2017/04/14 13:19:40
Optional nit: Can you add something like: "identif
gambard
2017/04/14 13:28:10
Done.
|
| +} |
| + |
| #pragma mark - ContentSuggestionsServiceObserver |
| - (void)contentSuggestionsService: |