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

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

Issue 2532783003: [NTP] Translateable strings for recent tabs and physical web sections. (Closed)
Patch Set: Created 4 years 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 CategoryInfo RecentTabSuggestionsProvider::GetCategoryInfo(Category category) { 103 CategoryInfo RecentTabSuggestionsProvider::GetCategoryInfo(Category category) {
104 DCHECK_EQ(provided_category_, category); 104 DCHECK_EQ(provided_category_, category);
105 return CategoryInfo( 105 return CategoryInfo(
106 l10n_util::GetStringUTF16(IDS_NTP_RECENT_TAB_SUGGESTIONS_SECTION_HEADER), 106 l10n_util::GetStringUTF16(IDS_NTP_RECENT_TAB_SUGGESTIONS_SECTION_HEADER),
107 ContentSuggestionsCardLayout::MINIMAL_CARD, 107 ContentSuggestionsCardLayout::MINIMAL_CARD,
108 /*has_more_action=*/false, 108 /*has_more_action=*/false,
109 /*has_reload_action=*/false, 109 /*has_reload_action=*/false,
110 /*has_view_all_action=*/false, 110 /*has_view_all_action=*/false,
111 /*show_if_empty=*/false, 111 /*show_if_empty=*/false,
112 l10n_util::GetStringUTF16(IDS_NTP_SUGGESTIONS_SECTION_EMPTY)); 112 l10n_util::GetStringUTF16(IDS_NTP_RECENT_TAB_SUGGESTIONS_SECTION_EMPTY));
113 // TODO(vitaliii): Replace IDS_NTP_SUGGESTIONS_SECTION_EMPTY with a
114 // category-specific string.
115 } 113 }
116 114
117 void RecentTabSuggestionsProvider::DismissSuggestion( 115 void RecentTabSuggestionsProvider::DismissSuggestion(
118 const ContentSuggestion::ID& suggestion_id) { 116 const ContentSuggestion::ID& suggestion_id) {
119 DCHECK_EQ(provided_category_, suggestion_id.category()); 117 DCHECK_EQ(provided_category_, suggestion_id.category());
120 std::set<std::string> dismissed_ids = ReadDismissedIDsFromPrefs(); 118 std::set<std::string> dismissed_ids = ReadDismissedIDsFromPrefs();
121 dismissed_ids.insert(suggestion_id.id_within_category()); 119 dismissed_ids.insert(suggestion_id.id_within_category());
122 StoreDismissedIDsToPrefs(dismissed_ids); 120 StoreDismissedIDsToPrefs(dismissed_ids);
123 } 121 }
124 122
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 } 334 }
337 335
338 void RecentTabSuggestionsProvider::StoreDismissedIDsToPrefs( 336 void RecentTabSuggestionsProvider::StoreDismissedIDsToPrefs(
339 const std::set<std::string>& dismissed_ids) { 337 const std::set<std::string>& dismissed_ids) {
340 prefs::StoreDismissedIDsToPrefs(pref_service_, 338 prefs::StoreDismissedIDsToPrefs(pref_service_,
341 prefs::kDismissedRecentOfflineTabSuggestions, 339 prefs::kDismissedRecentOfflineTabSuggestions,
342 dismissed_ids); 340 dismissed_ids);
343 } 341 }
344 342
345 } // namespace ntp_snippets 343 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698