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

Unified Diff: components/ntp_snippets/content_suggestions_service.h

Issue 2790743003: [Content suggestions] Implement fetching publishers' favicons (Closed)
Patch Set: Fix iOS compilation 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 side-by-side diff with in-line comments
Download patch
Index: components/ntp_snippets/content_suggestions_service.h
diff --git a/components/ntp_snippets/content_suggestions_service.h b/components/ntp_snippets/content_suggestions_service.h
index a9fc454a1da560eebd56d3ab062894bdacfd1baa..04b522b337fb45c77aa84c35a3fe2aecadb394b0 100644
--- a/components/ntp_snippets/content_suggestions_service.h
+++ b/components/ntp_snippets/content_suggestions_service.h
@@ -15,6 +15,7 @@
#include "base/observer_list.h"
#include "base/optional.h"
#include "base/scoped_observer.h"
+#include "base/task/cancelable_task_tracker.h"
#include "base/time/time.h"
#include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/history_service_observer.h"
@@ -31,6 +32,14 @@
class PrefService;
class PrefRegistrySimple;
+namespace favicon {
+class LargeIconService;
+} // namespace favicon
+
+namespace favicon_base {
+struct LargeIconImageResult;
+} // namespace favicon_base
+
namespace ntp_snippets {
class RemoteSuggestionsProvider;
@@ -90,6 +99,8 @@ class ContentSuggestionsService : public KeyedService,
State state,
SigninManagerBase* signin_manager, // Can be nullptr in unittests.
history::HistoryService* history_service, // Can be nullptr in unittests.
+ favicon::LargeIconService*
+ large_icon_service, // Can be nullptr in unittests.
Bernhard Bauer 2017/03/31 16:45:16 Nit: I would move the comment to the previous line
jkrcal 2017/04/03 12:37:36 Done.
PrefService* pref_service,
std::unique_ptr<CategoryRanker> category_ranker,
std::unique_ptr<UserClassifier> user_classifier,
@@ -304,6 +315,21 @@ class ContentSuggestionsService : public KeyedService,
void RestoreDismissedCategoriesFromPrefs();
void StoreDismissedCategoriesToPrefs();
+ // Callbacks for fetching favicons.
+ void OnGetFaviconFromCacheFinished(
+ const GURL& publisher_url,
+ int minimum_size_in_pixel,
+ int desired_size_in_pixel,
+ const ImageFetchedCallback& callback,
+ bool continue_to_google_server,
+ const favicon_base::LargeIconImageResult& result);
+ void OnGetFaviconFromGoogleServerFinished(
+ const GURL& publisher_url,
+ int minimum_size_in_pixel,
+ int desired_size_in_pixel,
+ const ImageFetchedCallback& callback,
+ bool success);
+
// Whether the content suggestions feature is enabled.
State state_;
@@ -349,11 +375,15 @@ class ContentSuggestionsService : public KeyedService,
const std::vector<ContentSuggestion> no_suggestions_;
+ base::CancelableTaskTracker favicons_task_tracker_;
+
// Keep a direct reference to this special provider to redirect debugging
// calls to it. If the RemoteSuggestionsProvider is loaded, it is also present
// in |providers_|, otherwise this is a nullptr.
RemoteSuggestionsProvider* remote_suggestions_provider_;
+ favicon::LargeIconService* large_icon_service_;
+
PrefService* pref_service_;
// Interface for informing about external events that have influence on

Powered by Google App Engine
This is Rietveld 408576698