OLD | NEW |
---|---|
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 Loading... | |
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, return the | |
huangs
2015/04/17 03:55:17
NIT: return --> returns
beaudoin
2015/04/17 14:50:52
Done.
| |
136 // dominant color of a smaller icon, if available. | |
137 base::CancelableTaskTracker::TaskId getLargeIcon( | |
huangs
2015/04/17 03:55:17
NIT: Should capitalize => GetLargeIcon(); also fix
beaudoin
2015/04/17 14:50:52
Done.
| |
138 const GURL& pageURL, | |
huangs
2015/04/17 03:55:17
NIT: pageURL --> page_url
beaudoin
2015/04/17 14:50:52
Done.
| |
139 int desired_size_in_pixel, | |
140 const favicon_base::LargeIconCallback& callback, | |
141 base::CancelableTaskTracker* tracker); | |
142 | |
134 // Set the favicon mappings to |page_url| for |icon_types| in the history | 143 // Set the favicon mappings to |page_url| for |icon_types| in the history |
135 // database. | 144 // database. |
136 // Sample |icon_urls|: | 145 // Sample |icon_urls|: |
137 // { ICON_URL1 -> TOUCH_ICON, known to the database, | 146 // { ICON_URL1 -> TOUCH_ICON, known to the database, |
138 // ICON_URL2 -> TOUCH_ICON, not known to the database, | 147 // ICON_URL2 -> TOUCH_ICON, not known to the database, |
139 // ICON_URL3 -> TOUCH_PRECOMPOSED_ICON, known to the database } | 148 // ICON_URL3 -> TOUCH_PRECOMPOSED_ICON, known to the database } |
140 // The new mappings are computed from |icon_urls| with these rules: | 149 // 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 | 150 // 1) Any urls in |icon_urls| which are not already known to the database are |
142 // rejected. | 151 // rejected. |
143 // Sample new mappings to |page_url|: { ICON_URL1, ICON_URL3 } | 152 // Sample new mappings to |page_url|: { ICON_URL1, ICON_URL3 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
233 // Intermediate callback for GetRawFavicon() and GetRawFaviconForPageURL() | 242 // Intermediate callback for GetRawFavicon() and GetRawFaviconForPageURL() |
234 // so that history service can deal solely with FaviconResultsCallback. | 243 // so that history service can deal solely with FaviconResultsCallback. |
235 // Resizes favicon_base::FaviconRawBitmapResult if necessary and runs | 244 // Resizes favicon_base::FaviconRawBitmapResult if necessary and runs |
236 // |callback|. | 245 // |callback|. |
237 void RunFaviconRawBitmapCallbackWithBitmapResults( | 246 void RunFaviconRawBitmapCallbackWithBitmapResults( |
238 const favicon_base::FaviconRawBitmapCallback& callback, | 247 const favicon_base::FaviconRawBitmapCallback& callback, |
239 int desired_size_in_pixel, | 248 int desired_size_in_pixel, |
240 const std::vector<favicon_base::FaviconRawBitmapResult>& | 249 const std::vector<favicon_base::FaviconRawBitmapResult>& |
241 favicon_bitmap_results); | 250 favicon_bitmap_results); |
242 | 251 |
252 // Intermediate callback for getLargeIcon(). Ensures the large icon is the | |
huangs
2015/04/17 03:55:17
NIT: GetLargeIcon()
beaudoin
2015/04/17 14:50:52
Done.
| |
253 // desired size, if not extract the dominant color and use this for invoking | |
254 // |callback|. | |
255 void RunLargeIconCallback( | |
256 const favicon_base::LargeIconCallback& callback, | |
257 int desired_size_in_pixel, | |
258 const favicon_base::FaviconRawBitmapResult& bitmap_result); | |
259 | |
243 base::hash_set<MissingFaviconURLHash> missing_favicon_urls_; | 260 base::hash_set<MissingFaviconURLHash> missing_favicon_urls_; |
244 history::HistoryService* history_service_; | 261 history::HistoryService* history_service_; |
245 FaviconClient* favicon_client_; | 262 FaviconClient* favicon_client_; |
246 | 263 |
264 // A pre-populated list of the types of icon files to consider when looking | |
265 // for large icons. Note: this is simply an optimization over populating an | |
266 // icon type vector on each request. | |
267 std::vector<int> large_icon_types_; | |
268 | |
247 DISALLOW_COPY_AND_ASSIGN(FaviconService); | 269 DISALLOW_COPY_AND_ASSIGN(FaviconService); |
248 }; | 270 }; |
249 | 271 |
250 } // namespace favicon | 272 } // namespace favicon |
251 | 273 |
252 #endif // COMPONENTS_FAVICON_CORE_FAVICON_SERVICE_H_ | 274 #endif // COMPONENTS_FAVICON_CORE_FAVICON_SERVICE_H_ |
OLD | NEW |