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

Unified Diff: components/ntp_snippets/content_suggestions_service.h

Issue 2790743003: [Content suggestions] Implement fetching publishers' favicons (Closed)
Patch Set: Minor fix 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/ntp_snippets/DEPS ('k') | components/ntp_snippets/content_suggestions_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a6b7894e4c902dad305250f0b61e2030f758a46a..40d665c78e818a179cf0381e6c4d0cac7046e4c3 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.
+ // Can be nullptr in unittests.
+ favicon::LargeIconService* large_icon_service,
PrefService* pref_service,
std::unique_ptr<CategoryRanker> category_ranker,
std::unique_ptr<UserClassifier> user_classifier,
@@ -317,6 +328,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_;
@@ -362,11 +388,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
« no previous file with comments | « components/ntp_snippets/DEPS ('k') | components/ntp_snippets/content_suggestions_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698