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

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

Issue 2473483006: Adds a Fetch() method to the ContentSuggestionService which asks any provider to provide more conte… (Closed)
Patch Set: comments by Markus. Created 4 years, 1 month 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 dismissed_ids); 142 dismissed_ids);
143 } 143 }
144 144
145 void ForeignSessionsSuggestionsProvider::FetchSuggestionImage( 145 void ForeignSessionsSuggestionsProvider::FetchSuggestionImage(
146 const ContentSuggestion::ID& suggestion_id, 146 const ContentSuggestion::ID& suggestion_id,
147 const ImageFetchedCallback& callback) { 147 const ImageFetchedCallback& callback) {
148 base::ThreadTaskRunnerHandle::Get()->PostTask( 148 base::ThreadTaskRunnerHandle::Get()->PostTask(
149 FROM_HERE, base::Bind(callback, gfx::Image())); 149 FROM_HERE, base::Bind(callback, gfx::Image()));
150 } 150 }
151 151
152 void ForeignSessionsSuggestionsProvider::Fetch(
153 const Category& category,
154 const std::set<std::string>& known_suggestion_ids,
155 FetchingCallback callback) {
156 NOTREACHED();
157 }
158
152 void ForeignSessionsSuggestionsProvider::ClearHistory( 159 void ForeignSessionsSuggestionsProvider::ClearHistory(
153 base::Time begin, 160 base::Time begin,
154 base::Time end, 161 base::Time end,
155 const base::Callback<bool(const GURL& url)>& filter) { 162 const base::Callback<bool(const GURL& url)>& filter) {
156 std::set<std::string> dismissed_ids = prefs::ReadDismissedIDsFromPrefs( 163 std::set<std::string> dismissed_ids = prefs::ReadDismissedIDsFromPrefs(
157 *pref_service_, prefs::kDismissedForeignSessionsSuggestions); 164 *pref_service_, prefs::kDismissedForeignSessionsSuggestions);
158 for (auto iter = dismissed_ids.begin(); iter != dismissed_ids.end();) { 165 for (auto iter = dismissed_ids.begin(); iter != dismissed_ids.end();) {
159 if (filter.Run(GURL(*iter))) { 166 if (filter.Run(GURL(*iter))) {
160 iter = dismissed_ids.erase(iter); 167 iter = dismissed_ids.erase(iter);
161 } else { 168 } else {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 // This field is sandwiched between the url's favicon, which is on the left, 316 // This field is sandwiched between the url's favicon, which is on the left,
310 // and the |publish_date|, which is to the right. The domain should always 317 // and the |publish_date|, which is to the right. The domain should always
311 // appear next to the favicon. 318 // appear next to the favicon.
312 suggestion.set_publisher_name( 319 suggestion.set_publisher_name(
313 base::UTF8ToUTF16(data.navigation->virtual_url().host() + " - " + 320 base::UTF8ToUTF16(data.navigation->virtual_url().host() + " - " +
314 data.session->session_name)); 321 data.session->session_name));
315 return suggestion; 322 return suggestion;
316 } 323 }
317 324
318 } // namespace ntp_snippets 325 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698