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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_FAVICON_CORE_FAVICON_SERVICE_H_ 5 #ifndef COMPONENTS_FAVICON_CORE_FAVICON_SERVICE_H_
6 #define COMPONENTS_FAVICON_CORE_FAVICON_SERVICE_H_ 6 #define COMPONENTS_FAVICON_CORE_FAVICON_SERVICE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 const GURL& page_url, 113 const GURL& page_url,
114 int icon_types, 114 int icon_types,
115 int desired_size_in_pixel, 115 int desired_size_in_pixel,
116 const favicon_base::FaviconRawBitmapCallback& callback, 116 const favicon_base::FaviconRawBitmapCallback& callback,
117 base::CancelableTaskTracker* tracker); 117 base::CancelableTaskTracker* tracker);
118 118
119 // See HistoryService::GetLargestFaviconForPageURL(). 119 // See HistoryService::GetLargestFaviconForPageURL().
120 base::CancelableTaskTracker::TaskId GetLargestRawFaviconForPageURL( 120 base::CancelableTaskTracker::TaskId GetLargestRawFaviconForPageURL(
121 const GURL& page_url, 121 const GURL& page_url,
122 const std::vector<int>& icon_types, 122 const std::vector<int>& icon_types,
123 int minimum_size_in_pixels, 123 int minimum_size_in_pixel,
124 const favicon_base::FaviconRawBitmapCallback& callback, 124 const favicon_base::FaviconRawBitmapCallback& callback,
125 base::CancelableTaskTracker* tracker); 125 base::CancelableTaskTracker* tracker);
126 126
127 base::CancelableTaskTracker::TaskId GetFaviconForPageURL( 127 base::CancelableTaskTracker::TaskId GetFaviconForPageURL(
128 const GURL& page_url, 128 const GURL& page_url,
129 int icon_types, 129 int icon_types,
130 int desired_size_in_dip, 130 int desired_size_in_dip,
131 const favicon_base::FaviconResultsCallback& callback, 131 const favicon_base::FaviconResultsCallback& callback,
132 base::CancelableTaskTracker* tracker); 132 base::CancelableTaskTracker* tracker);
133 133
134 // Requests the best large icon for the page at |page_url| given the requested
135 // |desired_size_in_pixel|. If no good large icon can be found, returns the
136 // fallback style to use, for which the background is set to the dominant
137 // color of a smaller icon when one is available.
138 base::CancelableTaskTracker::TaskId GetLargeIconOrFallbackStyle(
139 const GURL& page_url,
140 int desired_size_in_pixel,
141 const favicon_base::LargeIconCallback& callback,
142 base::CancelableTaskTracker* tracker);
143
134 // Set the favicon mappings to |page_url| for |icon_types| in the history 144 // Set the favicon mappings to |page_url| for |icon_types| in the history
135 // database. 145 // database.
136 // Sample |icon_urls|: 146 // Sample |icon_urls|:
137 // { ICON_URL1 -> TOUCH_ICON, known to the database, 147 // { ICON_URL1 -> TOUCH_ICON, known to the database,
138 // ICON_URL2 -> TOUCH_ICON, not known to the database, 148 // ICON_URL2 -> TOUCH_ICON, not known to the database,
139 // ICON_URL3 -> TOUCH_PRECOMPOSED_ICON, known to the database } 149 // ICON_URL3 -> TOUCH_PRECOMPOSED_ICON, known to the database }
140 // The new mappings are computed from |icon_urls| with these rules: 150 // The new mappings are computed from |icon_urls| with these rules:
141 // 1) Any urls in |icon_urls| which are not already known to the database are 151 // 1) Any urls in |icon_urls| which are not already known to the database are
142 // rejected. 152 // rejected.
143 // Sample new mappings to |page_url|: { ICON_URL1, ICON_URL3 } 153 // Sample new mappings to |page_url|: { ICON_URL1, ICON_URL3 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // Intermediate callback for GetRawFavicon() and GetRawFaviconForPageURL() 243 // Intermediate callback for GetRawFavicon() and GetRawFaviconForPageURL()
234 // so that history service can deal solely with FaviconResultsCallback. 244 // so that history service can deal solely with FaviconResultsCallback.
235 // Resizes favicon_base::FaviconRawBitmapResult if necessary and runs 245 // Resizes favicon_base::FaviconRawBitmapResult if necessary and runs
236 // |callback|. 246 // |callback|.
237 void RunFaviconRawBitmapCallbackWithBitmapResults( 247 void RunFaviconRawBitmapCallbackWithBitmapResults(
238 const favicon_base::FaviconRawBitmapCallback& callback, 248 const favicon_base::FaviconRawBitmapCallback& callback,
239 int desired_size_in_pixel, 249 int desired_size_in_pixel,
240 const std::vector<favicon_base::FaviconRawBitmapResult>& 250 const std::vector<favicon_base::FaviconRawBitmapResult>&
241 favicon_bitmap_results); 251 favicon_bitmap_results);
242 252
253 // Intermediate callback for GetLargeIconOrFallbackStyle(). Ensures the large
254 // 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.
255 // invoke |callback|.
256 void RunLargeIconCallback(
257 const favicon_base::LargeIconCallback& callback,
258 int desired_size_in_pixel,
259 const favicon_base::FaviconRawBitmapResult& bitmap_result);
260
243 base::hash_set<MissingFaviconURLHash> missing_favicon_urls_; 261 base::hash_set<MissingFaviconURLHash> missing_favicon_urls_;
244 history::HistoryService* history_service_; 262 history::HistoryService* history_service_;
245 FaviconClient* favicon_client_; 263 FaviconClient* favicon_client_;
246 264
265 // A pre-populated list of the types of icon files to consider when looking
266 // for large icons. Note: this is simply an optimization over populating an
267 // icon type vector on each request.
268 std::vector<int> large_icon_types_;
269
247 DISALLOW_COPY_AND_ASSIGN(FaviconService); 270 DISALLOW_COPY_AND_ASSIGN(FaviconService);
248 }; 271 };
249 272
250 } // namespace favicon 273 } // namespace favicon
251 274
252 #endif // COMPONENTS_FAVICON_CORE_FAVICON_SERVICE_H_ 275 #endif // COMPONENTS_FAVICON_CORE_FAVICON_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698