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 #import "ios/chrome/browser/content_suggestions/mediator_util.h" | 5 #import "ios/chrome/browser/content_suggestions/mediator_util.h" |
6 | 6 |
7 #include "base/strings/sys_string_conversions.h" | 7 #include "base/strings/sys_string_conversions.h" |
8 #include "components/ntp_snippets/category.h" | 8 #include "components/ntp_snippets/category.h" |
9 #import "ios/chrome/browser/content_suggestions/content_suggestions_category_wra
pper.h" | 9 #import "ios/chrome/browser/content_suggestions/content_suggestions_category_wra
pper.h" |
10 #import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion
_identifier.h" | 10 #import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion
_identifier.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 if (category.IsKnownCategory(ntp_snippets::KnownCategories::ARTICLES)) | 30 if (category.IsKnownCategory(ntp_snippets::KnownCategories::ARTICLES)) |
31 return ContentSuggestionTypeArticle; | 31 return ContentSuggestionTypeArticle; |
32 if (category.IsKnownCategory(ntp_snippets::KnownCategories::READING_LIST)) | 32 if (category.IsKnownCategory(ntp_snippets::KnownCategories::READING_LIST)) |
33 return ContentSuggestionTypeReadingList; | 33 return ContentSuggestionTypeReadingList; |
34 | 34 |
35 return ContentSuggestionTypeEmpty; | 35 return ContentSuggestionTypeEmpty; |
36 } | 36 } |
37 | 37 |
38 ContentSuggestionsSectionID SectionIDForCategory( | 38 ContentSuggestionsSectionID SectionIDForCategory( |
39 ntp_snippets::Category category) { | 39 ntp_snippets::Category category) { |
40 if (category.IsKnownCategory(ntp_snippets::KnownCategories::BOOKMARKS)) | |
41 return ContentSuggestionsSectionBookmarks; | |
42 if (category.IsKnownCategory(ntp_snippets::KnownCategories::ARTICLES)) | 40 if (category.IsKnownCategory(ntp_snippets::KnownCategories::ARTICLES)) |
43 return ContentSuggestionsSectionArticles; | 41 return ContentSuggestionsSectionArticles; |
44 if (category.IsKnownCategory(ntp_snippets::KnownCategories::READING_LIST)) | 42 if (category.IsKnownCategory(ntp_snippets::KnownCategories::READING_LIST)) |
45 return ContentSuggestionsSectionReadingList; | 43 return ContentSuggestionsSectionReadingList; |
46 | 44 |
47 return ContentSuggestionsSectionUnknown; | 45 return ContentSuggestionsSectionUnknown; |
48 } | 46 } |
49 | 47 |
50 ContentSuggestionsSectionLayout SectionLayoutForLayout( | 48 ContentSuggestionsSectionLayout SectionLayoutForLayout( |
51 ntp_snippets::ContentSuggestionsCardLayout layout) { | 49 ntp_snippets::ContentSuggestionsCardLayout layout) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 sectionInfo.title = base::SysUTF16ToNSString(categoryInfo->title()); | 89 sectionInfo.title = base::SysUTF16ToNSString(categoryInfo->title()); |
92 } | 90 } |
93 return sectionInfo; | 91 return sectionInfo; |
94 } | 92 } |
95 | 93 |
96 ntp_snippets::ContentSuggestion::ID SuggestionIDForSectionID( | 94 ntp_snippets::ContentSuggestion::ID SuggestionIDForSectionID( |
97 ContentSuggestionsCategoryWrapper* category, | 95 ContentSuggestionsCategoryWrapper* category, |
98 const std::string& id_in_category) { | 96 const std::string& id_in_category) { |
99 return ntp_snippets::ContentSuggestion::ID(category.category, id_in_category); | 97 return ntp_snippets::ContentSuggestion::ID(category.category, id_in_category); |
100 } | 98 } |
OLD | NEW |