| 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 FaviconAttributes; |
| 11 @protocol ContentSuggestionsDataSink; | 12 @protocol ContentSuggestionsDataSink; |
| 12 @protocol ContentSuggestionsImageFetcher; | 13 @protocol ContentSuggestionsImageFetcher; |
| 14 class GURL; |
| 13 | 15 |
| 14 // Typedef for a block taking the fetched suggestions as parameter. | 16 // Typedef for a block taking the fetched suggestions as parameter. |
| 15 typedef void (^MoreSuggestionsFetched)(NSArray<ContentSuggestion*>* _Nonnull); | 17 typedef void (^MoreSuggestionsFetched)(NSArray<ContentSuggestion*>* _Nonnull); |
| 16 | 18 |
| 17 // DataSource for the content suggestions. Provides the suggestions data in a | 19 // DataSource for the content suggestions. Provides the suggestions data in a |
| 18 // format compatible with Objective-C. | 20 // format compatible with Objective-C. |
| 19 @protocol ContentSuggestionsDataSource | 21 @protocol ContentSuggestionsDataSource |
| 20 | 22 |
| 21 // The data sink that will be notified when the data change. | 23 // The data sink that will be notified when the data change. |
| 22 @property(nonatomic, nullable, weak) id<ContentSuggestionsDataSink> dataSink; | 24 @property(nonatomic, nullable, weak) id<ContentSuggestionsDataSink> dataSink; |
| 23 | 25 |
| 24 // Returns all the data currently available. | 26 // Returns all the data currently available. |
| 25 - (nonnull NSArray<ContentSuggestion*>*)allSuggestions; | 27 - (nonnull NSArray<ContentSuggestion*>*)allSuggestions; |
| 26 | 28 |
| 27 // Returns the data currently available for the section identified by | 29 // Returns the data currently available for the section identified by |
| 28 // |sectionInfo|. | 30 // |sectionInfo|. |
| 29 - (nonnull NSArray<ContentSuggestion*>*)suggestionsForSection: | 31 - (nonnull NSArray<ContentSuggestion*>*)suggestionsForSection: |
| 30 (nonnull ContentSuggestionsSectionInformation*)sectionInfo; | 32 (nonnull ContentSuggestionsSectionInformation*)sectionInfo; |
| 31 | 33 |
| 32 // Returns an image updater for the suggestions provided by this data source. | 34 // Returns an image updater for the suggestions provided by this data source. |
| 33 - (nullable id<ContentSuggestionsImageFetcher>)imageFetcher; | 35 - (nullable id<ContentSuggestionsImageFetcher>)imageFetcher; |
| 34 | 36 |
| 37 // Fetches favicon attributes and calls the completion block. |
| 38 - (void)fetchFaviconAttributesForURL:(const GURL&)URL |
| 39 completion: |
| 40 (void (^_Nonnull)(FaviconAttributes* _Nonnull)) |
| 41 completion; |
| 42 |
| 35 // Fetches additional content. All the |knownSuggestions| must come from the | 43 // Fetches additional content. All the |knownSuggestions| must come from the |
| 36 // same |sectionInfo|. If the fetch was completed, the given |callback| is | 44 // same |sectionInfo|. If the fetch was completed, the given |callback| is |
| 37 // called with the new content. | 45 // called with the new content. |
| 38 - (void)fetchMoreSuggestionsKnowing: | 46 - (void)fetchMoreSuggestionsKnowing: |
| 39 (nullable NSArray<ContentSuggestionIdentifier*>*)knownSuggestions | 47 (nullable NSArray<ContentSuggestionIdentifier*>*)knownSuggestions |
| 40 fromSectionInfo: | 48 fromSectionInfo: |
| 41 (nonnull ContentSuggestionsSectionInformation*) | 49 (nonnull ContentSuggestionsSectionInformation*) |
| 42 sectionInfo | 50 sectionInfo |
| 43 callback:(nullable MoreSuggestionsFetched)callback; | 51 callback:(nullable MoreSuggestionsFetched)callback; |
| 44 | 52 |
| 45 @end | 53 @end |
| 46 | 54 |
| 47 #endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_DATA_SO
URCE_H_ | 55 #endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_DATA_SO
URCE_H_ |
| OLD | NEW |