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

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

Issue 2824173005: [Content suggestions] Reveal URL with favicon in snippets-internals (Closed)
Patch Set: Vitalii's comments #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_suggestion.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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 [&suggestion_id](const ContentSuggestion& suggestion) { 167 [&suggestion_id](const ContentSuggestion& suggestion) {
168 return suggestion_id == suggestion.id(); 168 return suggestion_id == suggestion.id();
169 }); 169 });
170 if (position == suggestions->end() || !large_icon_service_) { 170 if (position == suggestions->end() || !large_icon_service_) {
171 base::ThreadTaskRunnerHandle::Get()->PostTask( 171 base::ThreadTaskRunnerHandle::Get()->PostTask(
172 FROM_HERE, base::Bind(callback, gfx::Image())); 172 FROM_HERE, base::Bind(callback, gfx::Image()));
173 RecordFaviconFetchResult(FaviconFetchResult::FAILURE); 173 RecordFaviconFetchResult(FaviconFetchResult::FAILURE);
174 return; 174 return;
175 } 175 }
176 176
177 const GURL& domain_with_favicon = 177 const GURL& domain_with_favicon = position->url_with_favicon();
178 position->url_with_favicon().GetWithEmptyPath();
179 178
180 // TODO(jkrcal): Create a general wrapper function in LargeIconService that 179 // TODO(jkrcal): Create a general wrapper function in LargeIconService that
181 // does handle the get-from-cache-and-fallback-to-google-server functionality 180 // does handle the get-from-cache-and-fallback-to-google-server functionality
182 // in one shot (for all clients that do not need to react in between). 181 // in one shot (for all clients that do not need to react in between).
183 large_icon_service_->GetLargeIconImageOrFallbackStyle( 182 large_icon_service_->GetLargeIconImageOrFallbackStyle(
184 domain_with_favicon, minimum_size_in_pixel, desired_size_in_pixel, 183 domain_with_favicon, minimum_size_in_pixel, desired_size_in_pixel,
185 base::Bind(&ContentSuggestionsService::OnGetFaviconFromCacheFinished, 184 base::Bind(&ContentSuggestionsService::OnGetFaviconFromCacheFinished,
186 base::Unretained(this), domain_with_favicon, 185 base::Unretained(this), domain_with_favicon,
187 minimum_size_in_pixel, desired_size_in_pixel, callback, 186 minimum_size_in_pixel, desired_size_in_pixel, callback,
188 /*continue_to_google_server=*/true), 187 /*continue_to_google_server=*/true),
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 void ContentSuggestionsService::StoreDismissedCategoriesToPrefs() { 649 void ContentSuggestionsService::StoreDismissedCategoriesToPrefs() {
651 base::ListValue list; 650 base::ListValue list;
652 for (const auto& category_provider_pair : dismissed_providers_by_category_) { 651 for (const auto& category_provider_pair : dismissed_providers_by_category_) {
653 list.AppendInteger(category_provider_pair.first.id()); 652 list.AppendInteger(category_provider_pair.first.id());
654 } 653 }
655 654
656 pref_service_->Set(prefs::kDismissedCategories, list); 655 pref_service_->Set(prefs::kDismissedCategories, list);
657 } 656 }
658 657
659 } // namespace ntp_snippets 658 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/ntp_snippets/content_suggestion.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698