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_CONTENT_SUGGESTIONS_MEDIATOR_UTIL_H_ | 5 #ifndef IOS_CHROME_BROWSER_CONTENT_SUGGESTIONS_MEDIATOR_UTIL_H_ |
6 #define IOS_CHROME_BROWSER_CONTENT_SUGGESTIONS_MEDIATOR_UTIL_H_ | 6 #define IOS_CHROME_BROWSER_CONTENT_SUGGESTIONS_MEDIATOR_UTIL_H_ |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/optional.h" | 9 #include "base/optional.h" |
10 #include "components/ntp_snippets/category_info.h" | 10 #include "components/ntp_snippets/category_info.h" |
11 #include "components/ntp_snippets/content_suggestion.h" | 11 #include "components/ntp_snippets/content_suggestion.h" |
12 #include "components/ntp_snippets/status.h" | 12 #include "components/ntp_snippets/status.h" |
13 #include "components/ntp_tiles/ntp_tile.h" | 13 #include "components/ntp_tiles/ntp_tile.h" |
14 #import "ios/chrome/browser/ui/content_suggestions/cells/suggested_content.h" | 14 #import "ios/chrome/browser/ui/content_suggestions/cells/suggested_content.h" |
15 #import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion s_section_information.h" | 15 #import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion s_section_information.h" |
16 | 16 |
17 namespace ntp_snippets { | 17 namespace ntp_snippets { |
18 class Category; | 18 class Category; |
19 } | 19 } |
20 | 20 |
21 @class CollectionViewItem; | 21 @class CollectionViewItem; |
22 @class ContentSuggestionsCategoryWrapper; | 22 @class ContentSuggestionsCategoryWrapper; |
23 @class ContentSuggestionsMostVisitedItem; | |
23 | 24 |
24 // TODO(crbug.com/701275): Once base::BindBlock supports the move semantics, | 25 // TODO(crbug.com/701275): Once base::BindBlock supports the move semantics, |
25 // remove this wrapper. | 26 // remove this wrapper. |
26 // Wraps a callback taking a const ref to a callback taking an object. | 27 // Wraps a callback taking a const ref to a callback taking an object. |
27 void BindWrapper( | 28 void BindWrapper( |
28 base::Callback<void(ntp_snippets::Status status_code, | 29 base::Callback<void(ntp_snippets::Status status_code, |
29 const std::vector<ntp_snippets::ContentSuggestion>& | 30 const std::vector<ntp_snippets::ContentSuggestion>& |
30 suggestions)> callback, | 31 suggestions)> callback, |
31 ntp_snippets::Status status_code, | 32 ntp_snippets::Status status_code, |
32 std::vector<ntp_snippets::ContentSuggestion> suggestions); | 33 std::vector<ntp_snippets::ContentSuggestion> suggestions); |
(...skipping 19 matching lines...) Expand all Loading... | |
52 ntp_snippets::ContentSuggestion::ID SuggestionIDForSectionID( | 53 ntp_snippets::ContentSuggestion::ID SuggestionIDForSectionID( |
53 ContentSuggestionsCategoryWrapper* category, | 54 ContentSuggestionsCategoryWrapper* category, |
54 const std::string& id_in_category); | 55 const std::string& id_in_category); |
55 | 56 |
56 // Creates and returns a SectionInfo for the Most Visited section. | 57 // Creates and returns a SectionInfo for the Most Visited section. |
57 ContentSuggestionsSectionInformation* MostVisitedSectionInformation(); | 58 ContentSuggestionsSectionInformation* MostVisitedSectionInformation(); |
58 | 59 |
59 // Records the page impression of the ntp tiles. | 60 // Records the page impression of the ntp tiles. |
60 void RecordPageImpression(const std::vector<ntp_tiles::NTPTile>& mostVisited); | 61 void RecordPageImpression(const std::vector<ntp_tiles::NTPTile>& mostVisited); |
61 | 62 |
62 // Converts a ntp_snippets::ContentSuggestion to an adapted CollectionViewItem | 63 // Converts a ntp_snippets::ContentSuggestion to an adapted CollectionViewItem |
jif
2017/05/17 13:13:28
s/ntp_snippets::ContentSuggestion/ntp_tiles::NTPTi
gambard
2017/05/17 14:13:32
Done.
| |
63 // with a |sectionInfo|. | 64 // with a |sectionInfo|. |
64 CollectionViewItem<SuggestedContent>* ConvertNTPTile( | 65 ContentSuggestionsMostVisitedItem* ConvertNTPTile( |
65 const ntp_tiles::NTPTile& tile, | 66 const ntp_tiles::NTPTile& tile, |
66 ContentSuggestionsSectionInformation* sectionInfo); | 67 ContentSuggestionsSectionInformation* sectionInfo); |
67 | 68 |
68 #endif // IOS_CHROME_BROWSER_CONTENT_SUGGESTIONS_MEDIATOR_UTIL_H_ | 69 #endif // IOS_CHROME_BROWSER_CONTENT_SUGGESTIONS_MEDIATOR_UTIL_H_ |
OLD | NEW |