| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_COLLECTION
_UPDATER_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_COLLECTION
_UPDATER_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_COLLECTION
_UPDATER_H_ | 6 #define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_COLLECTION
_UPDATER_H_ |
| 7 | 7 |
| 8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
| 9 | 9 |
| 10 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h" | 10 #import "ios/chrome/browser/ui/content_suggestions/content_suggestion.h" |
| 11 | 11 |
| 12 @class CollectionViewItem; |
| 12 @protocol ContentSuggestionsDataSource; | 13 @protocol ContentSuggestionsDataSource; |
| 13 @class ContentSuggestionsViewController; | 14 @class ContentSuggestionsViewController; |
| 14 | 15 |
| 15 // Enum defining the ItemType of this ContentSuggestionsCollectionUpdater. | |
| 16 typedef NS_ENUM(NSInteger, ItemType) { | |
| 17 ItemTypeText = kItemTypeEnumZero, | |
| 18 ItemTypeArticle, | |
| 19 ItemTypeExpand, | |
| 20 ItemTypeStack, | |
| 21 ItemTypeFavicon, | |
| 22 }; | |
| 23 | |
| 24 // Updater for a CollectionViewController populating it with some items and | 16 // Updater for a CollectionViewController populating it with some items and |
| 25 // handling the items addition. | 17 // handling the items addition. |
| 26 @interface ContentSuggestionsCollectionUpdater : NSObject | 18 @interface ContentSuggestionsCollectionUpdater : NSObject |
| 27 | 19 |
| 28 // Initialize with the |dataSource| used to get the data. | 20 // Initialize with the |dataSource| used to get the data. |
| 29 - (instancetype)initWithDataSource:(id<ContentSuggestionsDataSource>)dataSource | 21 - (instancetype)initWithDataSource:(id<ContentSuggestionsDataSource>)dataSource |
| 30 NS_DESIGNATED_INITIALIZER; | 22 NS_DESIGNATED_INITIALIZER; |
| 31 | 23 |
| 32 - (instancetype)init NS_UNAVAILABLE; | 24 - (instancetype)init NS_UNAVAILABLE; |
| 33 | 25 |
| 34 // |collectionViewController| this Updater will update. Needs to be set before | 26 // |collectionViewController| this Updater will update. Needs to be set before |
| 35 // adding items. | 27 // adding items. |
| 36 @property(nonatomic, assign) | 28 @property(nonatomic, assign) |
| 37 ContentSuggestionsViewController* collectionViewController; | 29 ContentSuggestionsViewController* collectionViewController; |
| 38 | 30 |
| 39 // Adds a text item with a |title| and a |subtitle| in the section numbered | 31 // Adds a text item with a |title| and a |subtitle| in the section numbered |
| 40 // |section|. If |section| is greater than the current number of section, it | 32 // |section|. If |section| is greater than the current number of section, it |
| 41 // will add a new section at the end. | 33 // will add a new section at the end. |
| 42 - (void)addTextItem:(NSString*)title | 34 - (void)addTextItem:(NSString*)title |
| 43 subtitle:(NSString*)subtitle | 35 subtitle:(NSString*)subtitle |
| 44 toSection:(NSInteger)inputSection; | 36 toSection:(NSInteger)inputSection; |
| 45 | 37 |
| 46 // Returns whether the section should use the default, non-card style. | 38 // Returns whether the section should use the default, non-card style. |
| 47 - (BOOL)shouldUseCustomStyleForSection:(NSInteger)section; | 39 - (BOOL)shouldUseCustomStyleForSection:(NSInteger)section; |
| 48 | 40 |
| 41 // Returns the ContentSuggestionType associated with this item. |
| 42 - (ContentSuggestionType)contentSuggestionTypeForItem:(CollectionViewItem*)item; |
| 43 |
| 49 @end | 44 @end |
| 50 | 45 |
| 51 #endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_COLLECT
ION_UPDATER_H_ | 46 #endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_COLLECT
ION_UPDATER_H_ |
| OLD | NEW |