Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.cc

Issue 2751093003: Unifies the additional actions for Categories (Closed)
Patch Set: Fix compilation on Android (hopefully) Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 87 }
88 NOTREACHED() << "Unknown category " << category.id(); 88 NOTREACHED() << "Unknown category " << category.id();
89 return CategoryStatus::NOT_PROVIDED; 89 return CategoryStatus::NOT_PROVIDED;
90 } 90 }
91 91
92 CategoryInfo RecentTabSuggestionsProvider::GetCategoryInfo(Category category) { 92 CategoryInfo RecentTabSuggestionsProvider::GetCategoryInfo(Category category) {
93 DCHECK_EQ(provided_category_, category); 93 DCHECK_EQ(provided_category_, category);
94 return CategoryInfo( 94 return CategoryInfo(
95 l10n_util::GetStringUTF16(IDS_NTP_RECENT_TAB_SUGGESTIONS_SECTION_HEADER), 95 l10n_util::GetStringUTF16(IDS_NTP_RECENT_TAB_SUGGESTIONS_SECTION_HEADER),
96 ContentSuggestionsCardLayout::MINIMAL_CARD, 96 ContentSuggestionsCardLayout::MINIMAL_CARD,
97 /*has_fetch_action=*/false, 97 ContentSuggestionsAdditionalAction::NONE,
98 /*has_view_all_action=*/false,
99 /*show_if_empty=*/false, 98 /*show_if_empty=*/false,
100 l10n_util::GetStringUTF16(IDS_NTP_RECENT_TAB_SUGGESTIONS_SECTION_EMPTY)); 99 l10n_util::GetStringUTF16(IDS_NTP_RECENT_TAB_SUGGESTIONS_SECTION_EMPTY));
101 } 100 }
102 101
103 void RecentTabSuggestionsProvider::DismissSuggestion( 102 void RecentTabSuggestionsProvider::DismissSuggestion(
104 const ContentSuggestion::ID& suggestion_id) { 103 const ContentSuggestion::ID& suggestion_id) {
105 DCHECK_EQ(provided_category_, suggestion_id.category()); 104 DCHECK_EQ(provided_category_, suggestion_id.category());
106 std::set<std::string> dismissed_ids = ReadDismissedIDsFromPrefs(); 105 std::set<std::string> dismissed_ids = ReadDismissedIDsFromPrefs();
107 dismissed_ids.insert(suggestion_id.id_within_category()); 106 dismissed_ids.insert(suggestion_id.id_within_category());
108 StoreDismissedIDsToPrefs(dismissed_ids); 107 StoreDismissedIDsToPrefs(dismissed_ids);
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 } 308 }
310 309
311 void RecentTabSuggestionsProvider::StoreDismissedIDsToPrefs( 310 void RecentTabSuggestionsProvider::StoreDismissedIDsToPrefs(
312 const std::set<std::string>& dismissed_ids) { 311 const std::set<std::string>& dismissed_ids) {
313 prefs::StoreDismissedIDsToPrefs(pref_service_, 312 prefs::StoreDismissedIDsToPrefs(pref_service_,
314 prefs::kDismissedRecentOfflineTabSuggestions, 313 prefs::kDismissedRecentOfflineTabSuggestions,
315 dismissed_ids); 314 dismissed_ids);
316 } 315 }
317 316
318 } // namespace ntp_snippets 317 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698