| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 physical_web_data_source_->UnregisterListener(this); | 65 physical_web_data_source_->UnregisterListener(this); |
| 66 } | 66 } |
| 67 | 67 |
| 68 CategoryStatus PhysicalWebPageSuggestionsProvider::GetCategoryStatus( | 68 CategoryStatus PhysicalWebPageSuggestionsProvider::GetCategoryStatus( |
| 69 Category category) { | 69 Category category) { |
| 70 return category_status_; | 70 return category_status_; |
| 71 } | 71 } |
| 72 | 72 |
| 73 CategoryInfo PhysicalWebPageSuggestionsProvider::GetCategoryInfo( | 73 CategoryInfo PhysicalWebPageSuggestionsProvider::GetCategoryInfo( |
| 74 Category category) { | 74 Category category) { |
| 75 // TODO(vitaliii): Use the proper string once it has been agreed on. | 75 return CategoryInfo(l10n_util::GetStringUTF16( |
| 76 // TODO(vitaliii): Use a translateable string. (crbug.com/667764) | 76 IDS_NTP_PHYSICAL_WEB_PAGE_SUGGESTIONS_SECTION_HEADER), |
| 77 return CategoryInfo( | 77 ContentSuggestionsCardLayout::FULL_CARD, |
| 78 base::ASCIIToUTF16("Physical web pages"), | 78 /*has_more_action=*/false, |
| 79 ContentSuggestionsCardLayout::FULL_CARD, | 79 /*has_reload_action=*/false, |
| 80 /*has_more_action=*/false, | 80 /*has_view_all_action=*/false, |
| 81 /*has_reload_action=*/false, | 81 /*show_if_empty=*/false, |
| 82 /*has_view_all_action=*/false, | 82 l10n_util::GetStringUTF16( |
| 83 /*show_if_empty=*/false, | 83 IDS_NTP_PHYSICAL_WEB_PAGE_SUGGESTIONS_SECTION_EMPTY)); |
| 84 l10n_util::GetStringUTF16(IDS_NTP_SUGGESTIONS_SECTION_EMPTY)); | |
| 85 } | 84 } |
| 86 | 85 |
| 87 void PhysicalWebPageSuggestionsProvider::DismissSuggestion( | 86 void PhysicalWebPageSuggestionsProvider::DismissSuggestion( |
| 88 const ContentSuggestion::ID& suggestion_id) { | 87 const ContentSuggestion::ID& suggestion_id) { |
| 89 DCHECK_EQ(provided_category_, suggestion_id.category()); | 88 DCHECK_EQ(provided_category_, suggestion_id.category()); |
| 90 std::set<std::string> dismissed_ids = ReadDismissedIDsFromPrefs(); | 89 std::set<std::string> dismissed_ids = ReadDismissedIDsFromPrefs(); |
| 91 dismissed_ids.insert(suggestion_id.id_within_category()); | 90 dismissed_ids.insert(suggestion_id.id_within_category()); |
| 92 StoreDismissedIDsToPrefs(dismissed_ids); | 91 StoreDismissedIDsToPrefs(dismissed_ids); |
| 93 } | 92 } |
| 94 | 93 |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 } | 298 } |
| 300 | 299 |
| 301 void PhysicalWebPageSuggestionsProvider::StoreDismissedIDsToPrefs( | 300 void PhysicalWebPageSuggestionsProvider::StoreDismissedIDsToPrefs( |
| 302 const std::set<std::string>& dismissed_ids) { | 301 const std::set<std::string>& dismissed_ids) { |
| 303 prefs::StoreDismissedIDsToPrefs(pref_service_, | 302 prefs::StoreDismissedIDsToPrefs(pref_service_, |
| 304 prefs::kDismissedPhysicalWebPageSuggestions, | 303 prefs::kDismissedPhysicalWebPageSuggestions, |
| 305 dismissed_ids); | 304 dismissed_ids); |
| 306 } | 305 } |
| 307 | 306 |
| 308 } // namespace ntp_snippets | 307 } // namespace ntp_snippets |
| OLD | NEW |