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

Side by Side Diff: components/ntp_snippets/content_suggestions_service.cc

Issue 2781583002: [Content suggestions] Add a function to the service API to fetch favicons (Closed)
Patch Set: Fix compilation #2 Created 3 years, 8 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
« no previous file with comments | « components/ntp_snippets/content_suggestions_service.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/content_suggestions_service.h" 5 #include "components/ntp_snippets/content_suggestions_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 LOG(WARNING) << "Requested image for suggestion " << suggestion_id 118 LOG(WARNING) << "Requested image for suggestion " << suggestion_id
119 << " for unavailable category " << suggestion_id.category(); 119 << " for unavailable category " << suggestion_id.category();
120 base::ThreadTaskRunnerHandle::Get()->PostTask( 120 base::ThreadTaskRunnerHandle::Get()->PostTask(
121 FROM_HERE, base::Bind(callback, gfx::Image())); 121 FROM_HERE, base::Bind(callback, gfx::Image()));
122 return; 122 return;
123 } 123 }
124 providers_by_category_[suggestion_id.category()]->FetchSuggestionImage( 124 providers_by_category_[suggestion_id.category()]->FetchSuggestionImage(
125 suggestion_id, callback); 125 suggestion_id, callback);
126 } 126 }
127 127
128 void ContentSuggestionsService::FetchSuggestionFavicon(
129 const ContentSuggestion::ID& suggestion_id,
130 int minimum_size_in_pixel,
131 int desired_size_in_pixel,
132 const ImageFetchedCallback& callback) {
133 // TODO(jkrcal): Implement.
134 }
135
128 void ContentSuggestionsService::ClearHistory( 136 void ContentSuggestionsService::ClearHistory(
129 base::Time begin, 137 base::Time begin,
130 base::Time end, 138 base::Time end,
131 const base::Callback<bool(const GURL& url)>& filter) { 139 const base::Callback<bool(const GURL& url)>& filter) {
132 for (const auto& provider : providers_) { 140 for (const auto& provider : providers_) {
133 provider->ClearHistory(begin, end, filter); 141 provider->ClearHistory(begin, end, filter);
134 } 142 }
135 category_ranker_->ClearHistory(begin, end); 143 category_ranker_->ClearHistory(begin, end);
136 // This potentially removed personalized data which we shouldn't display 144 // This potentially removed personalized data which we shouldn't display
137 // anymore. 145 // anymore.
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 void ContentSuggestionsService::StoreDismissedCategoriesToPrefs() { 518 void ContentSuggestionsService::StoreDismissedCategoriesToPrefs() {
511 base::ListValue list; 519 base::ListValue list;
512 for (const auto& category_provider_pair : dismissed_providers_by_category_) { 520 for (const auto& category_provider_pair : dismissed_providers_by_category_) {
513 list.AppendInteger(category_provider_pair.first.id()); 521 list.AppendInteger(category_provider_pair.first.id());
514 } 522 }
515 523
516 pref_service_->Set(prefs::kDismissedCategories, list); 524 pref_service_->Set(prefs::kDismissedCategories, list);
517 } 525 }
518 526
519 } // namespace ntp_snippets 527 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/ntp_snippets/content_suggestions_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698