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/physical_web_pages/physical_web_page_suggestio
ns_provider.h" | 5 #include "components/ntp_snippets/physical_web_pages/physical_web_page_suggestio
ns_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 CategoryStatus PhysicalWebPageSuggestionsProvider::GetCategoryStatus( | 110 CategoryStatus PhysicalWebPageSuggestionsProvider::GetCategoryStatus( |
111 Category category) { | 111 Category category) { |
112 return category_status_; | 112 return category_status_; |
113 } | 113 } |
114 | 114 |
115 CategoryInfo PhysicalWebPageSuggestionsProvider::GetCategoryInfo( | 115 CategoryInfo PhysicalWebPageSuggestionsProvider::GetCategoryInfo( |
116 Category category) { | 116 Category category) { |
117 return CategoryInfo(l10n_util::GetStringUTF16( | 117 return CategoryInfo(l10n_util::GetStringUTF16( |
118 IDS_NTP_PHYSICAL_WEB_PAGE_SUGGESTIONS_SECTION_HEADER), | 118 IDS_NTP_PHYSICAL_WEB_PAGE_SUGGESTIONS_SECTION_HEADER), |
119 ContentSuggestionsCardLayout::FULL_CARD, | 119 ContentSuggestionsCardLayout::FULL_CARD, |
120 /*has_fetch_action=*/false, | 120 ContentSuggestionsAdditionalAction::NONE, |
121 /*has_view_all_action=*/false, | |
122 /*show_if_empty=*/false, | 121 /*show_if_empty=*/false, |
123 l10n_util::GetStringUTF16( | 122 l10n_util::GetStringUTF16( |
124 IDS_NTP_PHYSICAL_WEB_PAGE_SUGGESTIONS_SECTION_EMPTY)); | 123 IDS_NTP_PHYSICAL_WEB_PAGE_SUGGESTIONS_SECTION_EMPTY)); |
125 } | 124 } |
126 | 125 |
127 void PhysicalWebPageSuggestionsProvider::DismissSuggestion( | 126 void PhysicalWebPageSuggestionsProvider::DismissSuggestion( |
128 const ContentSuggestion::ID& suggestion_id) { | 127 const ContentSuggestion::ID& suggestion_id) { |
129 DCHECK_EQ(provided_category_, suggestion_id.category()); | 128 DCHECK_EQ(provided_category_, suggestion_id.category()); |
130 std::set<std::string> dismissed_ids = ReadDismissedIDsFromPrefs(); | 129 std::set<std::string> dismissed_ids = ReadDismissedIDsFromPrefs(); |
131 dismissed_ids.insert(suggestion_id.id_within_category()); | 130 dismissed_ids.insert(suggestion_id.id_within_category()); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 } | 358 } |
360 | 359 |
361 void PhysicalWebPageSuggestionsProvider::StoreDismissedIDsToPrefs( | 360 void PhysicalWebPageSuggestionsProvider::StoreDismissedIDsToPrefs( |
362 const std::set<std::string>& dismissed_ids) { | 361 const std::set<std::string>& dismissed_ids) { |
363 prefs::StoreDismissedIDsToPrefs(pref_service_, | 362 prefs::StoreDismissedIDsToPrefs(pref_service_, |
364 prefs::kDismissedPhysicalWebPageSuggestions, | 363 prefs::kDismissedPhysicalWebPageSuggestions, |
365 dismissed_ids); | 364 dismissed_ids); |
366 } | 365 } |
367 | 366 |
368 } // namespace ntp_snippets | 367 } // namespace ntp_snippets |
OLD | NEW |