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 // FaviconBitmapResult::bitmap_data is the bitmap in the thumbnail database | 71 // GetLargestRawFavicon(). |
72 // for the passed in URL and icon types whose pixel size best matches the | 72 // See function for details on value. |
73 // passed in |desired_size_in_dip| and |desired_scale_factor|. Returns an | |
74 // invalid chrome::FaviconBitmapResult if there are no matches. | |
75 typedef base::Callback<void(const chrome::FaviconBitmapResult&)> | 73 typedef base::Callback<void(const chrome::FaviconBitmapResult&)> |
76 FaviconRawCallback; | 74 FaviconRawCallback; |
77 | 75 |
78 // Callback for GetFavicon() and GetFaviconForURL(). | 76 // Callback for GetFavicon() and GetFaviconForURL(). |
79 // | 77 // |
80 // The first argument is the set of bitmaps for the passed in URL and | 78 // 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 | 79 // icon types whose pixel sizes best match the passed in |
82 // |desired_size_in_dip| at the scale factors supported by the current | 80 // |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 | 81 // 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 | 82 // 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, | 163 const FaviconForURLParams& params, |
166 const FaviconImageCallback& callback, | 164 const FaviconImageCallback& callback, |
167 CancelableTaskTracker* tracker); | 165 CancelableTaskTracker* tracker); |
168 | 166 |
169 CancelableTaskTracker::TaskId GetRawFaviconForURL( | 167 CancelableTaskTracker::TaskId GetRawFaviconForURL( |
170 const FaviconForURLParams& params, | 168 const FaviconForURLParams& params, |
171 ui::ScaleFactor desired_scale_factor, | 169 ui::ScaleFactor desired_scale_factor, |
172 const FaviconRawCallback& callback, | 170 const FaviconRawCallback& callback, |
173 CancelableTaskTracker* tracker); | 171 CancelableTaskTracker* tracker); |
174 | 172 |
| 173 // See HistoryService::GetLargestFaviconForURL(). |
| 174 CancelableTaskTracker::TaskId GetLargestRawFaviconForURL( |
| 175 Profile* profile, |
| 176 const GURL& page_url, |
| 177 const std::vector<int>& icon_types, |
| 178 int minimum_size_in_pixels, |
| 179 const FaviconRawCallback& callback, |
| 180 CancelableTaskTracker* tracker); |
| 181 |
175 CancelableTaskTracker::TaskId GetFaviconForURL( | 182 CancelableTaskTracker::TaskId GetFaviconForURL( |
176 const FaviconForURLParams& params, | 183 const FaviconForURLParams& params, |
177 const FaviconResultsCallback& callback, | 184 const FaviconResultsCallback& callback, |
178 CancelableTaskTracker* tracker); | 185 CancelableTaskTracker* tracker); |
179 | 186 |
180 // Used to request a bitmap for the favicon with |favicon_id| which is not | 187 // 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 | 188 // 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 | 189 // multiple favicon bitmaps for |favicon_id|, the largest favicon bitmap is |
183 // returned. | 190 // returned. |
184 CancelableTaskTracker::TaskId GetLargestRawFaviconForID( | 191 CancelableTaskTracker::TaskId GetLargestRawFaviconForID( |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 void RunFaviconRawCallbackWithBitmapResults( | 268 void RunFaviconRawCallbackWithBitmapResults( |
262 const FaviconRawCallback& callback, | 269 const FaviconRawCallback& callback, |
263 int desired_size_in_dip, | 270 int desired_size_in_dip, |
264 ui::ScaleFactor desired_scale_factor, | 271 ui::ScaleFactor desired_scale_factor, |
265 const std::vector<chrome::FaviconBitmapResult>& favicon_bitmap_results); | 272 const std::vector<chrome::FaviconBitmapResult>& favicon_bitmap_results); |
266 | 273 |
267 DISALLOW_COPY_AND_ASSIGN(FaviconService); | 274 DISALLOW_COPY_AND_ASSIGN(FaviconService); |
268 }; | 275 }; |
269 | 276 |
270 #endif // CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ | 277 #endif // CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ |
OLD | NEW |