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

Side by Side Diff: components/ntp_snippets/sessions/foreign_sessions_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/sessions/foreign_sessions_suggestions_provider .h" 5 #include "components/ntp_snippets/sessions/foreign_sessions_suggestions_provider .h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <tuple> 9 #include <tuple>
10 #include <utility> 10 #include <utility>
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 DCHECK_EQ(category, provided_category_); 192 DCHECK_EQ(category, provided_category_);
193 return category_status_; 193 return category_status_;
194 } 194 }
195 195
196 CategoryInfo ForeignSessionsSuggestionsProvider::GetCategoryInfo( 196 CategoryInfo ForeignSessionsSuggestionsProvider::GetCategoryInfo(
197 Category category) { 197 Category category) {
198 DCHECK_EQ(category, provided_category_); 198 DCHECK_EQ(category, provided_category_);
199 return CategoryInfo(l10n_util::GetStringUTF16( 199 return CategoryInfo(l10n_util::GetStringUTF16(
200 IDS_NTP_FOREIGN_SESSIONS_SUGGESTIONS_SECTION_HEADER), 200 IDS_NTP_FOREIGN_SESSIONS_SUGGESTIONS_SECTION_HEADER),
201 ContentSuggestionsCardLayout::MINIMAL_CARD, 201 ContentSuggestionsCardLayout::MINIMAL_CARD,
202 /*has_fetch_action=*/false, 202 ContentSuggestionsAdditionalAction::VIEW_ALL,
203 /*has_view_all_action=*/true,
204 /*show_if_empty=*/false, 203 /*show_if_empty=*/false,
205 l10n_util::GetStringUTF16( 204 l10n_util::GetStringUTF16(
206 IDS_NTP_FOREIGN_SESSIONS_SUGGESTIONS_SECTION_EMPTY)); 205 IDS_NTP_FOREIGN_SESSIONS_SUGGESTIONS_SECTION_EMPTY));
207 } 206 }
208 207
209 void ForeignSessionsSuggestionsProvider::DismissSuggestion( 208 void ForeignSessionsSuggestionsProvider::DismissSuggestion(
210 const ContentSuggestion::ID& suggestion_id) { 209 const ContentSuggestion::ID& suggestion_id) {
211 // Assume this suggestion is still valid, and blindly add it to dismissals. 210 // Assume this suggestion is still valid, and blindly add it to dismissals.
212 // Pruning will happen the next time we are asked to suggest. 211 // Pruning will happen the next time we are asked to suggest.
213 std::set<std::string> dismissed_ids = prefs::ReadDismissedIDsFromPrefs( 212 std::set<std::string> dismissed_ids = prefs::ReadDismissedIDsFromPrefs(
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 data.navigation->virtual_url().spec(), 398 data.navigation->virtual_url().spec(),
400 data.navigation->virtual_url()); 399 data.navigation->virtual_url());
401 suggestion.set_title(data.navigation->title()); 400 suggestion.set_title(data.navigation->title());
402 suggestion.set_publish_date(data.tab->timestamp); 401 suggestion.set_publish_date(data.tab->timestamp);
403 suggestion.set_publisher_name( 402 suggestion.set_publisher_name(
404 base::UTF8ToUTF16(data.navigation->virtual_url().host())); 403 base::UTF8ToUTF16(data.navigation->virtual_url().host()));
405 return suggestion; 404 return suggestion;
406 } 405 }
407 406
408 } // namespace ntp_snippets 407 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698