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

Side by Side Diff: components/ntp_snippets/sessions/foreign_sessions_suggestions_provider.cc

Issue 2421463002: FetchMore functionality backend (Closed)
Patch Set: Introduced callback, removed strategy. Created 4 years, 2 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 dismissed_ids); 138 dismissed_ids);
139 } 139 }
140 140
141 void ForeignSessionsSuggestionsProvider::FetchSuggestionImage( 141 void ForeignSessionsSuggestionsProvider::FetchSuggestionImage(
142 const ContentSuggestion::ID& suggestion_id, 142 const ContentSuggestion::ID& suggestion_id,
143 const ImageFetchedCallback& callback) { 143 const ImageFetchedCallback& callback) {
144 base::ThreadTaskRunnerHandle::Get()->PostTask( 144 base::ThreadTaskRunnerHandle::Get()->PostTask(
145 FROM_HERE, base::Bind(callback, gfx::Image())); 145 FROM_HERE, base::Bind(callback, gfx::Image()));
146 } 146 }
147 147
148 void ForeignSessionsSuggestionsProvider::FetchMore(
149 const Category& category,
150 FetchedMoreCallback callback) {
151 // Ignored.
152 }
153
148 void ForeignSessionsSuggestionsProvider::ClearHistory( 154 void ForeignSessionsSuggestionsProvider::ClearHistory(
149 base::Time begin, 155 base::Time begin,
150 base::Time end, 156 base::Time end,
151 const base::Callback<bool(const GURL& url)>& filter) { 157 const base::Callback<bool(const GURL& url)>& filter) {
152 std::set<std::string> dismissed_ids = prefs::ReadDismissedIDsFromPrefs( 158 std::set<std::string> dismissed_ids = prefs::ReadDismissedIDsFromPrefs(
153 *pref_service_, prefs::kDismissedForeignSessionsSuggestions); 159 *pref_service_, prefs::kDismissedForeignSessionsSuggestions);
154 for (auto iter = dismissed_ids.begin(); iter != dismissed_ids.end();) { 160 for (auto iter = dismissed_ids.begin(); iter != dismissed_ids.end();) {
155 if (filter.Run(GURL(*iter))) { 161 if (filter.Run(GURL(*iter))) {
156 iter = dismissed_ids.erase(iter); 162 iter = dismissed_ids.erase(iter);
157 } else { 163 } else {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 // This field is sandwiched between the url's favicon, which is on the left, 311 // This field is sandwiched between the url's favicon, which is on the left,
306 // and the |publish_date|, which is to the right. The domain should always 312 // and the |publish_date|, which is to the right. The domain should always
307 // appear next to the favicon. 313 // appear next to the favicon.
308 suggestion.set_publisher_name( 314 suggestion.set_publisher_name(
309 base::UTF8ToUTF16(data.navigation->virtual_url().host() + " - " + 315 base::UTF8ToUTF16(data.navigation->virtual_url().host() + " - " +
310 data.session->session_name)); 316 data.session->session_name));
311 return suggestion; 317 return suggestion;
312 } 318 }
313 319
314 } // namespace ntp_snippets 320 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698