| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 return category_status_; | 70 return category_status_; |
| 71 NOTREACHED() << "Unknown category " << category.id(); | 71 NOTREACHED() << "Unknown category " << category.id(); |
| 72 return CategoryStatus::NOT_PROVIDED; | 72 return CategoryStatus::NOT_PROVIDED; |
| 73 } | 73 } |
| 74 | 74 |
| 75 CategoryInfo RecentTabSuggestionsProvider::GetCategoryInfo(Category category) { | 75 CategoryInfo RecentTabSuggestionsProvider::GetCategoryInfo(Category category) { |
| 76 DCHECK_EQ(provided_category_, category); | 76 DCHECK_EQ(provided_category_, category); |
| 77 return CategoryInfo( | 77 return CategoryInfo( |
| 78 l10n_util::GetStringUTF16(IDS_NTP_RECENT_TAB_SUGGESTIONS_SECTION_HEADER), | 78 l10n_util::GetStringUTF16(IDS_NTP_RECENT_TAB_SUGGESTIONS_SECTION_HEADER), |
| 79 ContentSuggestionsCardLayout::MINIMAL_CARD, | 79 ContentSuggestionsCardLayout::MINIMAL_CARD, |
| 80 /*has_more_button=*/false, | 80 /*has_more_action=*/false, |
| 81 /*has_reload_action=*/false, |
| 82 /*has_view_all_action=*/false, |
| 81 /*show_if_empty=*/false, | 83 /*show_if_empty=*/false, |
| 82 l10n_util::GetStringUTF16(IDS_NTP_SUGGESTIONS_SECTION_EMPTY)); | 84 l10n_util::GetStringUTF16(IDS_NTP_SUGGESTIONS_SECTION_EMPTY)); |
| 83 // TODO(vitaliii): Replace IDS_NTP_SUGGESTIONS_SECTION_EMPTY with a | 85 // TODO(vitaliii): Replace IDS_NTP_SUGGESTIONS_SECTION_EMPTY with a |
| 84 // category-specific string. | 86 // category-specific string. |
| 85 } | 87 } |
| 86 | 88 |
| 87 void RecentTabSuggestionsProvider::DismissSuggestion( | 89 void RecentTabSuggestionsProvider::DismissSuggestion( |
| 88 const ContentSuggestion::ID& suggestion_id) { | 90 const ContentSuggestion::ID& suggestion_id) { |
| 89 DCHECK_EQ(provided_category_, suggestion_id.category()); | 91 DCHECK_EQ(provided_category_, suggestion_id.category()); |
| 90 std::set<std::string> dismissed_ids = ReadDismissedIDsFromPrefs(); | 92 std::set<std::string> dismissed_ids = ReadDismissedIDsFromPrefs(); |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 } | 264 } |
| 263 | 265 |
| 264 void RecentTabSuggestionsProvider::StoreDismissedIDsToPrefs( | 266 void RecentTabSuggestionsProvider::StoreDismissedIDsToPrefs( |
| 265 const std::set<std::string>& dismissed_ids) { | 267 const std::set<std::string>& dismissed_ids) { |
| 266 prefs::StoreDismissedIDsToPrefs(pref_service_, | 268 prefs::StoreDismissedIDsToPrefs(pref_service_, |
| 267 prefs::kDismissedRecentOfflineTabSuggestions, | 269 prefs::kDismissedRecentOfflineTabSuggestions, |
| 268 dismissed_ids); | 270 dismissed_ids); |
| 269 } | 271 } |
| 270 | 272 |
| 271 } // namespace ntp_snippets | 273 } // namespace ntp_snippets |
| OLD | NEW |