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

Unified Diff: components/favicon/core/favicon_service.h

Issue 1092873002: [Icons NTP] Refactor large_icon_source to extract the logic shared between desktop and Android to f… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
Index: components/favicon/core/favicon_service.h
diff --git a/components/favicon/core/favicon_service.h b/components/favicon/core/favicon_service.h
index e2379671ceda7ae2b10657f7053d1382971116a8..33aa6e5f4a0dd15bb3ff37149e9214083eb63917 100644
--- a/components/favicon/core/favicon_service.h
+++ b/components/favicon/core/favicon_service.h
@@ -120,7 +120,7 @@ class FaviconService : public KeyedService {
base::CancelableTaskTracker::TaskId GetLargestRawFaviconForPageURL(
const GURL& page_url,
const std::vector<int>& icon_types,
- int minimum_size_in_pixels,
+ int minimum_size_in_pixel,
const favicon_base::FaviconRawBitmapCallback& callback,
base::CancelableTaskTracker* tracker);
@@ -131,6 +131,16 @@ class FaviconService : public KeyedService {
const favicon_base::FaviconResultsCallback& callback,
base::CancelableTaskTracker* tracker);
+ // Requests the best large icon for the page at |page_url| given the requested
+ // |desired_size_in_pixel|. If no good large icon can be found, returns the
+ // fallback style to use, for which the background is set to the dominant
+ // color of a smaller icon when one is available.
+ base::CancelableTaskTracker::TaskId GetLargeIconOrFallbackStyle(
+ const GURL& page_url,
+ int desired_size_in_pixel,
+ const favicon_base::LargeIconCallback& callback,
+ base::CancelableTaskTracker* tracker);
+
// Set the favicon mappings to |page_url| for |icon_types| in the history
// database.
// Sample |icon_urls|:
@@ -240,10 +250,23 @@ class FaviconService : public KeyedService {
const std::vector<favicon_base::FaviconRawBitmapResult>&
favicon_bitmap_results);
+ // Intermediate callback for GetLargeIconOrFallbackStyle(). Ensures the large
+ // icon is the desired size, if compute the icon fallback style and use it to
huangs 2015/04/17 15:30:47 TYPO: "if compute"
beaudoin 2015/04/17 20:29:05 Done.
+ // invoke |callback|.
+ void RunLargeIconCallback(
+ const favicon_base::LargeIconCallback& callback,
+ int desired_size_in_pixel,
+ const favicon_base::FaviconRawBitmapResult& bitmap_result);
+
base::hash_set<MissingFaviconURLHash> missing_favicon_urls_;
history::HistoryService* history_service_;
FaviconClient* favicon_client_;
+ // A pre-populated list of the types of icon files to consider when looking
+ // for large icons. Note: this is simply an optimization over populating an
+ // icon type vector on each request.
+ std::vector<int> large_icon_types_;
+
DISALLOW_COPY_AND_ASSIGN(FaviconService);
};

Powered by Google App Engine
This is Rietveld 408576698