OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.
h" | 5 #include "components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.
h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 CategoryInfo RecentTabSuggestionsProvider::GetCategoryInfo(Category category) { | 109 CategoryInfo RecentTabSuggestionsProvider::GetCategoryInfo(Category category) { |
110 DCHECK_EQ(provided_category_, category); | 110 DCHECK_EQ(provided_category_, category); |
111 return CategoryInfo( | 111 return CategoryInfo( |
112 l10n_util::GetStringUTF16(IDS_NTP_RECENT_TAB_SUGGESTIONS_SECTION_HEADER), | 112 l10n_util::GetStringUTF16(IDS_NTP_RECENT_TAB_SUGGESTIONS_SECTION_HEADER), |
113 ContentSuggestionsCardLayout::MINIMAL_CARD, | 113 ContentSuggestionsCardLayout::MINIMAL_CARD, |
114 /*has_more_action=*/false, | 114 /*has_more_action=*/false, |
115 /*has_reload_action=*/false, | 115 /*has_reload_action=*/false, |
116 /*has_view_all_action=*/false, | 116 /*has_view_all_action=*/false, |
117 /*show_if_empty=*/false, | 117 /*show_if_empty=*/false, |
118 l10n_util::GetStringUTF16(IDS_NTP_SUGGESTIONS_SECTION_EMPTY)); | 118 l10n_util::GetStringUTF16(IDS_NTP_RECENT_TAB_SUGGESTIONS_SECTION_EMPTY)); |
119 // TODO(vitaliii): Replace IDS_NTP_SUGGESTIONS_SECTION_EMPTY with a | |
120 // category-specific string. | |
121 } | 119 } |
122 | 120 |
123 void RecentTabSuggestionsProvider::DismissSuggestion( | 121 void RecentTabSuggestionsProvider::DismissSuggestion( |
124 const ContentSuggestion::ID& suggestion_id) { | 122 const ContentSuggestion::ID& suggestion_id) { |
125 DCHECK_EQ(provided_category_, suggestion_id.category()); | 123 DCHECK_EQ(provided_category_, suggestion_id.category()); |
126 std::set<std::string> dismissed_ids = ReadDismissedIDsFromPrefs(); | 124 std::set<std::string> dismissed_ids = ReadDismissedIDsFromPrefs(); |
127 dismissed_ids.insert(suggestion_id.id_within_category()); | 125 dismissed_ids.insert(suggestion_id.id_within_category()); |
128 StoreDismissedIDsToPrefs(dismissed_ids); | 126 StoreDismissedIDsToPrefs(dismissed_ids); |
129 } | 127 } |
130 | 128 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 } | 343 } |
346 | 344 |
347 void RecentTabSuggestionsProvider::StoreDismissedIDsToPrefs( | 345 void RecentTabSuggestionsProvider::StoreDismissedIDsToPrefs( |
348 const std::set<std::string>& dismissed_ids) { | 346 const std::set<std::string>& dismissed_ids) { |
349 prefs::StoreDismissedIDsToPrefs(pref_service_, | 347 prefs::StoreDismissedIDsToPrefs(pref_service_, |
350 prefs::kDismissedRecentOfflineTabSuggestions, | 348 prefs::kDismissedRecentOfflineTabSuggestions, |
351 dismissed_ids); | 349 dismissed_ids); |
352 } | 350 } |
353 | 351 |
354 } // namespace ntp_snippets | 352 } // namespace ntp_snippets |
OLD | NEW |