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

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

Issue 2782613004: Add FaviconAttributesProvider to ContentSuggestions (Closed)
Patch Set: Cleanup 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/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 ed03e0942834cd15862878b26d12ddfc38582a5b..58df66b67b95a6e0d1ff2d228e0ccacb41073cf7 100644
--- a/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm
+++ b/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm
@@ -8,11 +8,13 @@
#include "base/memory/ptr_util.h"
#include "base/optional.h"
#include "base/strings/sys_string_conversions.h"
+#include "components/favicon/core/large_icon_service.h"
#include "components/ntp_snippets/category.h"
#include "components/ntp_snippets/category_info.h"
#include "components/ntp_snippets/content_suggestion.h"
#import "ios/chrome/browser/content_suggestions/content_suggestions_category_wrapper.h"
#import "ios/chrome/browser/content_suggestions/content_suggestions_service_bridge_observer.h"
+#import "ios/chrome/browser/favicon/favicon_attributes_provider.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestion.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_data_sink.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_image_fetcher.h"
@@ -28,6 +30,9 @@
namespace {
+// Size of the favicon returned by the provider.
+const CGFloat kDefaultFaviconSize = 16;
+
// TODO(crbug.com/701275): Once base::BindBlock supports the move semantics,
// remove this wrapper.
// Wraps a callback taking a const ref to a callback taking an object.
@@ -155,17 +160,23 @@ ntp_snippets::ContentSuggestion::ID SuggestionIDForSectionID(
@synthesize contentService = _contentService;
@synthesize dataSink = _dataSink;
@synthesize sectionInformationByCategory = _sectionInformationByCategory;
+@synthesize attributesProvider = _attributesProvider;
#pragma mark - Public
-- (instancetype)initWithContentService:
- (ntp_snippets::ContentSuggestionsService*)contentService {
+- (instancetype)
+initWithContentService:(ntp_snippets::ContentSuggestionsService*)contentService
+ largeIconService:(favicon::LargeIconService*)largeIconService {
self = [super init];
if (self) {
_suggestionBridge =
base::MakeUnique<ContentSuggestionsServiceBridge>(self, contentService);
_contentService = contentService;
_sectionInformationByCategory = [[NSMutableDictionary alloc] init];
+ _attributesProvider = [[FaviconAttributesProvider alloc]
+ initWithFaviconSize:kDefaultFaviconSize
+ minFaviconSize:1
lpromero 2017/03/29 13:32:07 That's small, isn't it? Or why not 0?
gambard 2017/03/30 08:07:11 The idea is "the smallest possible if you have one
+ largeIconService:largeIconService];
}
return self;
}

Powered by Google App Engine
This is Rietveld 408576698