Chromium Code Reviews| 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_DATA_SOURC E_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_DATA_SOURC E_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_DATA_SOURC E_H_ | 6 #define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_DATA_SOURC E_H_ |
| 7 | 7 |
| 8 @class ContentSuggestion; | 8 @class ContentSuggestion; |
| 9 @class ContentSuggestionIdentifier; | 9 @class ContentSuggestionIdentifier; |
| 10 @class ContentSuggestionsSectionInformation; | 10 @class ContentSuggestionsSectionInformation; |
| 11 @class FaviconAttributesProvider; | |
| 11 @protocol ContentSuggestionsDataSink; | 12 @protocol ContentSuggestionsDataSink; |
| 12 @protocol ContentSuggestionsImageFetcher; | 13 @protocol ContentSuggestionsImageFetcher; |
| 13 | 14 |
| 14 // Typedef for a block taking the fetched suggestions as parameter. | 15 // Typedef for a block taking the fetched suggestions as parameter. |
| 15 typedef void (^MoreSuggestionsFetched)(NSArray<ContentSuggestion*>* _Nonnull); | 16 typedef void (^MoreSuggestionsFetched)(NSArray<ContentSuggestion*>* _Nonnull); |
| 16 | 17 |
| 17 // DataSource for the content suggestions. Provides the suggestions data in a | 18 // DataSource for the content suggestions. Provides the suggestions data in a |
| 18 // format compatible with Objective-C. | 19 // format compatible with Objective-C. |
| 19 @protocol ContentSuggestionsDataSource | 20 @protocol ContentSuggestionsDataSource |
| 20 | 21 |
| 21 // The data sink that will be notified when the data change. | 22 // The data sink that will be notified when the data change. |
| 22 @property(nonatomic, nullable, weak) id<ContentSuggestionsDataSink> dataSink; | 23 @property(nonatomic, nullable, weak) id<ContentSuggestionsDataSink> dataSink; |
| 23 | 24 |
| 25 // Returns a FaviconAttributesProvider to fetch the favicon for the suggestions. | |
| 26 @property(nonatomic, nullable, strong, readonly) | |
| 27 FaviconAttributesProvider* attributesProvider; | |
|
lpromero
2017/03/29 13:32:07
I think this should not be know by the UI layer. Y
gambard
2017/03/30 08:07:11
Done.
| |
| 28 | |
| 24 // Returns all the data currently available. | 29 // Returns all the data currently available. |
| 25 - (nonnull NSArray<ContentSuggestion*>*)allSuggestions; | 30 - (nonnull NSArray<ContentSuggestion*>*)allSuggestions; |
| 26 | 31 |
| 27 // Returns the data currently available for the section identified by | 32 // Returns the data currently available for the section identified by |
| 28 // |sectionInfo|. | 33 // |sectionInfo|. |
| 29 - (nonnull NSArray<ContentSuggestion*>*)suggestionsForSection: | 34 - (nonnull NSArray<ContentSuggestion*>*)suggestionsForSection: |
| 30 (nonnull ContentSuggestionsSectionInformation*)sectionInfo; | 35 (nonnull ContentSuggestionsSectionInformation*)sectionInfo; |
| 31 | 36 |
| 32 // Returns an image updater for the suggestions provided by this data source. | 37 // Returns an image updater for the suggestions provided by this data source. |
| 33 - (nullable id<ContentSuggestionsImageFetcher>)imageFetcher; | 38 - (nullable id<ContentSuggestionsImageFetcher>)imageFetcher; |
| 34 | 39 |
| 35 // Fetches additional content. All the |knownSuggestions| must come from the | 40 // Fetches additional content. All the |knownSuggestions| must come from the |
| 36 // same |sectionInfo|. If the fetch was completed, the given |callback| is | 41 // same |sectionInfo|. If the fetch was completed, the given |callback| is |
| 37 // called with the new content. | 42 // called with the new content. |
| 38 - (void)fetchMoreSuggestionsKnowing: | 43 - (void)fetchMoreSuggestionsKnowing: |
| 39 (nullable NSArray<ContentSuggestionIdentifier*>*)knownSuggestions | 44 (nullable NSArray<ContentSuggestionIdentifier*>*)knownSuggestions |
| 40 fromSectionInfo: | 45 fromSectionInfo: |
| 41 (nonnull ContentSuggestionsSectionInformation*) | 46 (nonnull ContentSuggestionsSectionInformation*) |
| 42 sectionInfo | 47 sectionInfo |
| 43 callback:(nullable MoreSuggestionsFetched)callback; | 48 callback:(nullable MoreSuggestionsFetched)callback; |
| 44 | 49 |
| 45 @end | 50 @end |
| 46 | 51 |
| 47 #endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_DATA_SO URCE_H_ | 52 #endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_DATA_SO URCE_H_ |
| OLD | NEW |