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

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

Issue 2638413006: Add ContentSuggestionsMediator (Closed)
Patch Set: Fix Created 3 years, 11 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.mm
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm
index 6ba3bf0d340c143416dae2fdfca4c943d48adf6a..a50816265429f9f597c407e4cc66ed6f8ad2db8d 100644
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm
+++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm
@@ -9,6 +9,8 @@
#import "ios/chrome/browser/ui/collection_view/collection_view_controller.h"
#import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.h"
+#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_data_sink.h"
+#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_data_source.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_expandable_item.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_favicon_item.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_item.h"
@@ -19,9 +21,26 @@
#error "This file requires ARC support."
#endif
+@interface ContentSuggestionsCollectionUpdater ()<ContentSuggestionsDataSink>
+
+@property(nonatomic, strong) id<ContentSuggestionsDataSource> dataSource;
lpromero 2017/01/26 10:10:20 Can we risk creating a cycle if the one creating a
marq (ping after 24h) 2017/01/27 12:44:55 Does this need to be strong? Delegates usually are
gambard 2017/01/30 15:19:17 Yes, the data source should be kept alive by the c
+
+@end
+
@implementation ContentSuggestionsCollectionUpdater
@synthesize collectionViewController = _collectionViewController;
+@synthesize dataSource = _dataSource;
+
+- (instancetype)initWithDataSource:
+ (id<ContentSuggestionsDataSource>)dataSource {
+ self = [super init];
+ if (self) {
+ _dataSource = dataSource;
+ _dataSource.dataSink = self;
+ }
+ return self;
+}
#pragma mark - Properties
@@ -30,6 +49,9 @@
_collectionViewController = collectionViewController;
[collectionViewController loadModel];
CollectionViewModel* model = collectionViewController.collectionViewModel;
+
+ // Loads the data with the dataSource instead of hard coded value.
lpromero 2017/01/26 10:10:20 Mark this with // PLACEHOLDER
marq (ping after 24h) 2017/01/27 12:44:55 Also, clarify that this is a change that needs to
gambard 2017/01/30 15:19:17 Done.
+
NSInteger sectionIdentifier = kSectionIdentifierEnumZero;
// Stack Item.
@@ -88,6 +110,13 @@
}
}
+#pragma mark - ContentSuggestionsDataSink
+
+- (void)dataAvailable {
+ [self.dataSource getMoreData];
marq (ping after 24h) 2017/01/27 12:44:55 Either delete the dataSource call or assign the re
gambard 2017/01/30 15:19:17 Done.
+ // Do something.
+}
+
#pragma mark - Public methods
- (void)addTextItem:(NSString*)title

Powered by Google App Engine
This is Rietveld 408576698