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

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

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
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 #ifndef COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ 5 #ifndef COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_
6 #define COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ 6 #define COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 const std::vector<ContentSuggestion>& GetSuggestionsForCategory( 117 const std::vector<ContentSuggestion>& GetSuggestionsForCategory(
118 Category category) const; 118 Category category) const;
119 119
120 // Fetches the image for the suggestion with the given |suggestion_id| and 120 // Fetches the image for the suggestion with the given |suggestion_id| and
121 // runs the |callback|. If that suggestion doesn't exist or the fetch fails, 121 // runs the |callback|. If that suggestion doesn't exist or the fetch fails,
122 // the callback gets an empty image. The callback will not be called 122 // the callback gets an empty image. The callback will not be called
123 // synchronously. 123 // synchronously.
124 void FetchSuggestionImage(const ContentSuggestion::ID& suggestion_id, 124 void FetchSuggestionImage(const ContentSuggestion::ID& suggestion_id,
125 const ImageFetchedCallback& callback); 125 const ImageFetchedCallback& callback);
126 126
127 // Fetches the favicon from local cache (if larger than or equal to
128 // |minimum_size_in_pixel|) or from Google server (if there is no icon in the
129 // cache) and returns the results in the callback. If that suggestion doesn't
130 // exist or the fetch fails, the callback gets an empty image. The callback
131 // will not be called synchronously.
132 void FetchSuggestionFavicon(const ContentSuggestion::ID& suggestion_id,
133 int minimum_size_in_pixel,
134 int desired_size_in_pixel,
135 const ImageFetchedCallback& callback);
136
127 // Dismisses the suggestion with the given |suggestion_id|, if it exists. 137 // Dismisses the suggestion with the given |suggestion_id|, if it exists.
128 // This will not trigger an update through the observers (i.e. providers must 138 // This will not trigger an update through the observers (i.e. providers must
129 // not call |Observer::OnNewSuggestions|). 139 // not call |Observer::OnNewSuggestions|).
130 void DismissSuggestion(const ContentSuggestion::ID& suggestion_id); 140 void DismissSuggestion(const ContentSuggestion::ID& suggestion_id);
131 141
132 // Dismisses the given |category|, if it exists. 142 // Dismisses the given |category|, if it exists.
133 // This will not trigger an update through the observers. 143 // This will not trigger an update through the observers.
134 void DismissCategory(Category category); 144 void DismissCategory(Category category);
135 145
136 // Restores all dismissed categories. 146 // Restores all dismissed categories.
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 360
351 // Provides order for categories. 361 // Provides order for categories.
352 std::unique_ptr<CategoryRanker> category_ranker_; 362 std::unique_ptr<CategoryRanker> category_ranker_;
353 363
354 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); 364 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService);
355 }; 365 };
356 366
357 } // namespace ntp_snippets 367 } // namespace ntp_snippets
358 368
359 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ 369 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698