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 CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ |
6 #define CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ | 6 #define CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 // passed in URL and icon types which most which closely match the passed in | 60 // passed in URL and icon types which most which closely match the passed in |
61 // |desired_size_in_dip| at the scale factors supported by the current | 61 // |desired_size_in_dip| at the scale factors supported by the current |
62 // platform (eg MacOS) in addition to 1x. | 62 // platform (eg MacOS) in addition to 1x. |
63 // |FaviconImageResult::icon_url| is the favicon that the favicon bitmaps in | 63 // |FaviconImageResult::icon_url| is the favicon that the favicon bitmaps in |
64 // |image| originate from. | 64 // |image| originate from. |
65 // TODO(pkotwicz): Enable constructing |image| from bitmaps from several | 65 // TODO(pkotwicz): Enable constructing |image| from bitmaps from several |
66 // icon URLs. | 66 // icon URLs. |
67 typedef base::Callback<void(const chrome::FaviconImageResult&)> | 67 typedef base::Callback<void(const chrome::FaviconImageResult&)> |
68 FaviconImageCallback; | 68 FaviconImageCallback; |
69 | 69 |
70 // Callback for GetRawFavicon() and GetRawFaviconForURL(). | 70 // Callback for GetRawFavicon(), GetRawFaviconForURL() and |
71 // GetLargestRawFavicon(). | |
71 // FaviconBitmapResult::bitmap_data is the bitmap in the thumbnail database | 72 // FaviconBitmapResult::bitmap_data is the bitmap in the thumbnail database |
72 // for the passed in URL and icon types whose pixel size best matches the | 73 // for the passed in URL and icon types. |
73 // passed in |desired_size_in_dip| and |desired_scale_factor|. Returns an | 74 // For GetRawFavicon() and GetRawFaviconForURL(), the returned bitmap's pixel |
74 // invalid chrome::FaviconBitmapResult if there are no matches. | 75 // size best matches the passed in |desired_size_in_dip| and |
76 // |desired_scale_factor|. | |
77 // For GetLargestRawFavicon() the returned bitmap is the largest one whose | |
78 // pixel size is larger than |minimum_size_in_pixels| in the order of | |
79 // |icon_types|, or the largest one of all |icon_types| if no icon is larger | |
80 // than |minimum_size_in_pixels|. | |
81 // Returns an invalid chrome::FaviconBitmapResult if there are no matches. | |
michaelbai
2013/10/18 17:31:49
Not sure whether we should have the detail descrip
sky
2013/10/18 19:29:00
I agree. I was only thinking you need update the f
| |
75 typedef base::Callback<void(const chrome::FaviconBitmapResult&)> | 82 typedef base::Callback<void(const chrome::FaviconBitmapResult&)> |
76 FaviconRawCallback; | 83 FaviconRawCallback; |
77 | 84 |
78 // Callback for GetFavicon() and GetFaviconForURL(). | 85 // Callback for GetFavicon() and GetFaviconForURL(). |
79 // | 86 // |
80 // The first argument is the set of bitmaps for the passed in URL and | 87 // The first argument is the set of bitmaps for the passed in URL and |
81 // icon types whose pixel sizes best match the passed in | 88 // icon types whose pixel sizes best match the passed in |
82 // |desired_size_in_dip| at the scale factors supported by the current | 89 // |desired_size_in_dip| at the scale factors supported by the current |
83 // platform (eg MacOS) in addition to 1x. The vector has at most one result | 90 // platform (eg MacOS) in addition to 1x. The vector has at most one result |
84 // for each of the scale factors. There are less entries if a single result | 91 // for each of the scale factors. There are less entries if a single result |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 const FaviconForURLParams& params, | 172 const FaviconForURLParams& params, |
166 const FaviconImageCallback& callback, | 173 const FaviconImageCallback& callback, |
167 CancelableTaskTracker* tracker); | 174 CancelableTaskTracker* tracker); |
168 | 175 |
169 CancelableTaskTracker::TaskId GetRawFaviconForURL( | 176 CancelableTaskTracker::TaskId GetRawFaviconForURL( |
170 const FaviconForURLParams& params, | 177 const FaviconForURLParams& params, |
171 ui::ScaleFactor desired_scale_factor, | 178 ui::ScaleFactor desired_scale_factor, |
172 const FaviconRawCallback& callback, | 179 const FaviconRawCallback& callback, |
173 CancelableTaskTracker* tracker); | 180 CancelableTaskTracker* tracker); |
174 | 181 |
182 // See HistoryService::GetLargestFaviconForURL(). | |
183 CancelableTaskTracker::TaskId GetLargestRawFaviconForURL( | |
184 Profile* profile, | |
185 const GURL& page_url, | |
186 const std::vector<int>& icon_types, | |
187 int minimum_size_in_pixels, | |
188 const FaviconRawCallback& callback, | |
189 CancelableTaskTracker* tracker); | |
190 | |
175 CancelableTaskTracker::TaskId GetFaviconForURL( | 191 CancelableTaskTracker::TaskId GetFaviconForURL( |
176 const FaviconForURLParams& params, | 192 const FaviconForURLParams& params, |
177 const FaviconResultsCallback& callback, | 193 const FaviconResultsCallback& callback, |
178 CancelableTaskTracker* tracker); | 194 CancelableTaskTracker* tracker); |
179 | 195 |
180 // Used to request a bitmap for the favicon with |favicon_id| which is not | 196 // Used to request a bitmap for the favicon with |favicon_id| which is not |
181 // resized from the size it is stored at in the database. If there are | 197 // resized from the size it is stored at in the database. If there are |
182 // multiple favicon bitmaps for |favicon_id|, the largest favicon bitmap is | 198 // multiple favicon bitmaps for |favicon_id|, the largest favicon bitmap is |
183 // returned. | 199 // returned. |
184 CancelableTaskTracker::TaskId GetLargestRawFaviconForID( | 200 CancelableTaskTracker::TaskId GetLargestRawFaviconForID( |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
261 void RunFaviconRawCallbackWithBitmapResults( | 277 void RunFaviconRawCallbackWithBitmapResults( |
262 const FaviconRawCallback& callback, | 278 const FaviconRawCallback& callback, |
263 int desired_size_in_dip, | 279 int desired_size_in_dip, |
264 ui::ScaleFactor desired_scale_factor, | 280 ui::ScaleFactor desired_scale_factor, |
265 const std::vector<chrome::FaviconBitmapResult>& favicon_bitmap_results); | 281 const std::vector<chrome::FaviconBitmapResult>& favicon_bitmap_results); |
266 | 282 |
267 DISALLOW_COPY_AND_ASSIGN(FaviconService); | 283 DISALLOW_COPY_AND_ASSIGN(FaviconService); |
268 }; | 284 }; |
269 | 285 |
270 #endif // CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ | 286 #endif // CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ |
OLD | NEW |