| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_SECTION_IN
FORMATION_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_IDENTIFIER_CONTENT_SUGGESTIONS
_SECTION_INFORMATION_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_SECTION_IN
FORMATION_H_ | 6 #define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_IDENTIFIER_CONTENT_SUGGESTIONS
_SECTION_INFORMATION_H_ |
| 7 | 7 |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 | 9 |
| 10 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" | |
| 11 | |
| 12 // Layout for the section and its items. | 10 // Layout for the section and its items. |
| 13 typedef NS_ENUM(NSInteger, ContentSuggestionsSectionLayout) { | 11 typedef NS_ENUM(NSInteger, ContentSuggestionsSectionLayout) { |
| 14 // Follows the card layout. | 12 // Follows the card layout. |
| 15 ContentSuggestionsSectionLayoutCard, | 13 ContentSuggestionsSectionLayoutCard, |
| 16 // No specific layout. | 14 // No specific layout. |
| 17 ContentSuggestionsSectionLayoutCustom, | 15 ContentSuggestionsSectionLayoutCustom, |
| 18 }; | 16 }; |
| 19 | 17 |
| 20 // This enum is used for ordering the sections and as ID for the section. Make | 18 // This enum is used for ordering the sections and as ID for the section. Make |
| 21 // all sections in the same collection have different ID. | 19 // all sections in the same collection have different ID. |
| 22 // When adding a new kind of suggestions, add a new corresponding section. The | 20 // When adding a new kind of suggestions, add a new corresponding section. The |
| 23 // ordering is not persisted between launch, reordering is possible. | 21 // ordering is not persisted between launch, reordering is possible. |
| 24 typedef NS_ENUM(NSInteger, ContentSuggestionsSectionID) { | 22 typedef NS_ENUM(NSInteger, ContentSuggestionsSectionID) { |
| 25 ContentSuggestionsSectionBookmarks = 0, | 23 ContentSuggestionsSectionBookmarks = 0, |
| 26 ContentSuggestionsSectionArticles = 1, | 24 ContentSuggestionsSectionArticles = 1, |
| 27 | 25 |
| 28 // Do not use this. It will trigger a DCHECK. | 26 // Do not use this. It will trigger a DCHECK. |
| 29 // Do not add value after this one. | 27 // Do not add value after this one. |
| 30 ContentSuggestionsSectionUnknown | 28 ContentSuggestionsSectionUnknown |
| 31 }; | 29 }; |
| 32 | 30 |
| 33 // Contains the information needed to display the section. | 31 // Contains the information needed to display the section. |
| 34 @interface ContentSuggestionsSectionInformation : NSObject | 32 @interface ContentSuggestionsSectionInformation : NSObject |
| 35 | 33 |
| 36 - (instancetype)initWithSectionID:(ContentSuggestionsSectionID)sectionID | 34 - (instancetype)initWithSectionID:(ContentSuggestionsSectionID)sectionID |
| 37 NS_DESIGNATED_INITIALIZER; | 35 NS_DESIGNATED_INITIALIZER; |
| 38 - (instancetype)init NS_UNAVAILABLE; | 36 - (instancetype)init NS_UNAVAILABLE; |
| 39 | 37 |
| 40 // Item to display when the section is empty. If nil the section should not be | |
| 41 // displayed when empty. | |
| 42 @property(nonatomic, strong) CollectionViewItem* emptyCell; | |
| 43 // Layout to display the content of the section. | 38 // Layout to display the content of the section. |
| 44 @property(nonatomic, assign) ContentSuggestionsSectionLayout layout; | 39 @property(nonatomic, assign) ContentSuggestionsSectionLayout layout; |
| 45 // ID of the section. Used for ordering. | 40 // ID of the section. Used for ordering. |
| 46 @property(nonatomic, assign, readonly) ContentSuggestionsSectionID sectionID; | 41 @property(nonatomic, assign, readonly) ContentSuggestionsSectionID sectionID; |
| 47 // Title for the section. | 42 // Title for the section. |
| 48 @property(nonatomic, copy) NSString* title; | 43 @property(nonatomic, copy) NSString* title; |
| 49 // Title of the section's footer. If it is nil, no footer is created. | 44 // Title of the section's footer. If it is nil, no footer is created. |
| 50 @property(nonatomic, copy) NSString* footerTitle; | 45 @property(nonatomic, copy) NSString* footerTitle; |
| 51 | 46 |
| 52 @end | 47 @end |
| 53 | 48 |
| 54 #endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_SECTION
_INFORMATION_H_ | 49 #endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_IDENTIFIER_CONTENT_SUGGESTI
ONS_SECTION_INFORMATION_H_ |
| OLD | NEW |