| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 } | 104 } |
| 105 NOTREACHED() << "Unknown category " << category.id(); | 105 NOTREACHED() << "Unknown category " << category.id(); |
| 106 return CategoryStatus::NOT_PROVIDED; | 106 return CategoryStatus::NOT_PROVIDED; |
| 107 } | 107 } |
| 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_fetch_action=*/false, |
| 115 /*has_reload_action=*/false, | |
| 116 /*has_view_all_action=*/false, | 115 /*has_view_all_action=*/false, |
| 117 /*show_if_empty=*/false, | 116 /*show_if_empty=*/false, |
| 118 l10n_util::GetStringUTF16(IDS_NTP_RECENT_TAB_SUGGESTIONS_SECTION_EMPTY)); | 117 l10n_util::GetStringUTF16(IDS_NTP_RECENT_TAB_SUGGESTIONS_SECTION_EMPTY)); |
| 119 } | 118 } |
| 120 | 119 |
| 121 void RecentTabSuggestionsProvider::DismissSuggestion( | 120 void RecentTabSuggestionsProvider::DismissSuggestion( |
| 122 const ContentSuggestion::ID& suggestion_id) { | 121 const ContentSuggestion::ID& suggestion_id) { |
| 123 DCHECK_EQ(provided_category_, suggestion_id.category()); | 122 DCHECK_EQ(provided_category_, suggestion_id.category()); |
| 124 std::set<std::string> dismissed_ids = ReadDismissedIDsFromPrefs(); | 123 std::set<std::string> dismissed_ids = ReadDismissedIDsFromPrefs(); |
| 125 dismissed_ids.insert(suggestion_id.id_within_category()); | 124 dismissed_ids.insert(suggestion_id.id_within_category()); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 } | 345 } |
| 347 | 346 |
| 348 void RecentTabSuggestionsProvider::StoreDismissedIDsToPrefs( | 347 void RecentTabSuggestionsProvider::StoreDismissedIDsToPrefs( |
| 349 const std::set<std::string>& dismissed_ids) { | 348 const std::set<std::string>& dismissed_ids) { |
| 350 prefs::StoreDismissedIDsToPrefs(pref_service_, | 349 prefs::StoreDismissedIDsToPrefs(pref_service_, |
| 351 prefs::kDismissedRecentOfflineTabSuggestions, | 350 prefs::kDismissedRecentOfflineTabSuggestions, |
| 352 dismissed_ids); | 351 dismissed_ids); |
| 353 } | 352 } |
| 354 | 353 |
| 355 } // namespace ntp_snippets | 354 } // namespace ntp_snippets |
| OLD | NEW |